CCrmInvoiceEventFormat::FormatInvoicePersonTypeChanged

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmInvoiceEventFormat
  4. FormatInvoicePersonTypeChanged
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_invoice_event.php
  • Класс: \CCrmInvoiceEventFormat
  • Вызов: CCrmInvoiceEventFormat::FormatInvoicePersonTypeChanged
static function FormatInvoicePersonTypeChanged($arData)
{
	$info = GetMessage("CRM_INVOICE_EVENT_INFO_PERSON_TYPE_CHANGED");
	if (is_array($arData))
	{
		foreach ($arData as $param => $value)
		{
			if ($param == "PERSON_TYPE_ID")
			{
				$dbRes = \Bitrix\Crm\Invoice\PersonType::getList([
					'filter' => [
						'=ID' => $value
					]
				]);
				$res = $dbRes->fetch();
				$value = "\"".$res["NAME"]."\"";
				if ($res["CODE"] === 'CRM_CONTACT')
					$value = '"'.GetMessage('CRM_PERSON_TYPE_CONTACT').'"';
				else if ($res["CODE"] === 'CRM_COMPANY')
					$value = '"'.GetMessage('CRM_PERSON_TYPE_COMPANY').'"';
			}

			$info = str_replace("#".$param."#", $value, $info);
		}
	}

	return array(
		"INFO" => $info
	);
}

Добавить комментарий