$arLead[$currentKey] = $data; } else { // 2. Try to interpret value as TITLE. If not found leave value as is $result = array_search($data, $arStatus['STATUS_LIST']); $arLead[$currentKey] = $result !== false ? $result : $data; } } elseif ($currentKey == 'SOURCE_ID') { if (isset($arStatus['SOURCE_LIST'][$data])) { // 1. Try to interpret value as ID $arLead[$currentKey] = $data; } else { $result = array_search($data, $arStatus['SOURCE_LIST']); $arLead[$currentKey] = $result !== false ? $result : $data; } } elseif ($currentKey == 'CURRENCY_ID') { $currency = CCrmCurrency::GetByName($data); if (!$currency) { $currency = CCrmCurrency::GetByID($data); } $arLead[$currentKey] = $currency ? $currency['CURRENCY'] : CCrmCurrency::GetBaseCurrencyID(); } elseif ($currentKey == 'PRODUCT_ID') { // For compatibility $arProduct = CCrmProduct::GetByOriginID('CRM_PROD_' . $data); if (is_array($arProduct)) { $arProductRow = array('PRODUCT_ID' => $arProduct['ID'], 'QUANTITY' => 1); // PRICE equals to OPPORTUNITY. We will set PRICE latter } else { $arProduct = CCrmProduct::GetByName($data); if ($arProduct) { $arProductRow['PRODUCT_ID'] = $arProduct['ID']; } else {