• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/merger/requisitemerginghelper.php
  • Класс: Bitrix\Crm\Merger\RequisiteMergingHelper
  • Вызов: RequisiteMergingHelper::isBankDetailMatchingByKey
protected function isBankDetailMatchingByKey(array $targBankDetail, array $seedBankDetail)
{
	$result = false;

	$dupFieldsMap = Crm\EntityBankDetail::getDuplicateCriterionFieldsMap();

	$seedCountryId = isset($seedBankDetail['COUNTRY_ID']) ? (int)$seedBankDetail['COUNTRY_ID'] : 0;
	$targCountryId = isset($targBankDetail['COUNTRY_ID']) ? (int)$targBankDetail['COUNTRY_ID'] : 0;

	if ($seedCountryId > 0 && $seedCountryId === $targCountryId)
	{
		$countryId = $seedCountryId;

		if (is_array($this->bankDetailFieldsMap[$countryId]) && !empty($this->bankDetailFieldsMap[$countryId])
			&& is_array($dupFieldsMap[$countryId]))
		{
			foreach ($dupFieldsMap[$countryId] as $fieldName)
			{
				if (in_array($fieldName, $this->bankDetailFieldsMap[$countryId], true))
				{
					$seedValue = isset($seedBankDetail[$fieldName]) ? $seedBankDetail[$fieldName] : null;
					$targValue = isset($targBankDetail[$fieldName]) ? $targBankDetail[$fieldName] : null;
					$isSeedValueEmpty = ($seedValue === null
						|| (is_string($seedValue) ? $seedValue == '' : empty($seedValue)));
					$isTargValueEmpty = ($targValue === null
						|| (is_string($targValue) ? $targValue == '' : empty($targValue)));
					if (!$isSeedValueEmpty && !$isTargValueEmpty && $seedValue == $targValue)
					{
						$result = true;
						break;
					}
				}
			}
		}
	}

	return $result;
}