$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 { $arProductRow['PRODUCT_ID'] = 0; } $arProductRow['PRODUCT_NAME'] = $data; } } elseif ($currentKey == 'PRODUCT_PRICE') { // Process price only if product has been resolved if (isset($arProductRow['PRODUCT_ID'])) { $arProductRow['PRICE'] = doubleval($data); } } elseif ($currentKey == 'PRODUCT_QUANTITY') { // Process quntity only if product has been resolved if (isset($arProductRow['PRODUCT_ID'])) {