• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/requisite/conversion/psrequisiteconverter.php
  • Класс: Bitrix\Crm\Requisite\Conversion\PSRequisiteConverter
  • Вызов: PSRequisiteConverter::updateInvoice
static function updateInvoice($info)
{
	if (is_array(self::$psEntityTreeMap) && is_array($info))
	{
		$id = isset($info['ID']) ? (int)$info['ID'] : 0;
		$psId = isset($info['PAY_SYSTEM_ID']) ? (int)$info['PAY_SYSTEM_ID'] : 0;
		if ($id > 0 && $psId > 0 && is_array(self::$psEntityTreeMap[$psId]))
		{
			$myCompanyId = isset(self::$psEntityTreeMap[$psId]['CO']) ?
				(int)self::$psEntityTreeMap[$psId]['CO'] : 0;
			$mcRequisiteId = isset(self::$psEntityTreeMap[$psId]['RQ']) ?
				(int)self::$psEntityTreeMap[$psId]['RQ'] : 0;
			$mcBankDetailId = isset(self::$psEntityTreeMap[$psId]['BD']) ?
				(int)self::$psEntityTreeMap[$psId]['BD'] : 0;

			if ($myCompanyId > 0)
			{
				Invoice\Internals\InvoiceTable::update($id, array('UF_MYCOMPANY_ID' => $myCompanyId));
			}
			if ($mcRequisiteId > 0)
			{
				$bindings = EntityLink::getByEntity(\CCrmOwnerType::Invoice, $id);
				if (!is_array($bindings))
				{
					$bindings = array(
						'REQUISITE_ID' => 0,
						'BANK_DETAIL_ID' => 0
					);
				}
				EntityLink::register(
					\CCrmOwnerType::Invoice, $id,
					$bindings['REQUISITE_ID'], $bindings['BANK_DETAIL_ID'],
					$mcRequisiteId, $mcBankDetailId
				);
			}
		}
	}
}