1
0
mirror of synced 2024-11-22 21:36:10 +03:00

working customerUpload + send city fix;

This commit is contained in:
Grisha Pomadchin 2013-07-29 18:38:15 +04:00
parent 4f934aed10
commit befb6f59d4

View File

@ -153,6 +153,8 @@ class ICrmOrderActions
} }
} }
self::eventLog('json', 'json', json_encode($resOrders));
if (!empty($resOrders)) { if (!empty($resOrders)) {
$customers = $api->customerUpload($resCustomers); $customers = $api->customerUpload($resCustomers);
@ -297,13 +299,18 @@ class ICrmOrderActions
$rsOrderProps = CSaleOrderPropsValue::GetList(array(), array('ORDER_ID' => $arFields['ID'])); $rsOrderProps = CSaleOrderPropsValue::GetList(array(), array('ORDER_ID' => $arFields['ID']));
while ($ar = $rsOrderProps->Fetch()) { while ($ar = $rsOrderProps->Fetch()) {
switch ($ar['CODE']) { switch ($ar['CODE']) {
case 'ZIP': $resOrderDeliveryAddress['index'] = self::toJSON($ar['VALUE']); case 'ZIP': $resOrderDeliveryAddress['index'] = ICrmOrderActions::toJSON($ar['VALUE']);
break; break;
case 'CITY': $resOrderDeliveryAddress['city'] = self::toJSON($ar['VALUE']); case 'CITY': $resOrderDeliveryAddress['city'] = ICrmOrderActions::toJSON($ar['VALUE']);
break; break;
case 'ADDRESS': $resOrderDeliveryAddress['text'] = self::toJSON($ar['VALUE']); case 'ADDRESS': $resOrderDeliveryAddress['text'] = ICrmOrderActions::toJSON($ar['VALUE']);
break; break;
case 'FIO': $resOrder['contactName'] = explode(" ", self::toJSON($ar['VALUE'])); case 'LOCATION': if(!isset($resOrderDeliveryAddress['city']) && !$resOrderDeliveryAddress['city']) {
$resOrderDeliveryAddress['city'] = CSaleLocation::GetByID($ar['VALUE']);
$resOrderDeliveryAddress['city'] = self::toJSON($resOrderDeliveryAddress['city']['CITY_NAME_LANG']);
}
break;
case 'FIO': $resOrder['contactName'] = explode(" ", ICrmOrderActions::toJSON($ar['VALUE']));
break; break;
case 'PHONE': $resOrder['phone'] = $ar['VALUE']; case 'PHONE': $resOrder['phone'] = $ar['VALUE'];
break; break;
@ -402,7 +409,7 @@ class ICrmOrderActions
* @param type $str in SITE_CHARSET * @param type $str in SITE_CHARSET
* @return type $str in utf-8 * @return type $str in utf-8
*/ */
protected static function toJSON($str) { public static function toJSON($str) {
global $APPLICATION; global $APPLICATION;
return $APPLICATION->ConvertCharset($str, SITE_CHARSET, 'utf-8'); return $APPLICATION->ConvertCharset($str, SITE_CHARSET, 'utf-8');