From befb6f59d486729da86964138df4925f31d69200 Mon Sep 17 00:00:00 2001 From: Grisha Pomadchin Date: Mon, 29 Jul 2013 18:38:15 +0400 Subject: [PATCH] working customerUpload + send city fix; --- .../classes/general/ICrmOrderActions.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/intaro.intarocrm/classes/general/ICrmOrderActions.php b/intaro.intarocrm/classes/general/ICrmOrderActions.php index f8785ab1..a9fea3ea 100755 --- a/intaro.intarocrm/classes/general/ICrmOrderActions.php +++ b/intaro.intarocrm/classes/general/ICrmOrderActions.php @@ -152,6 +152,8 @@ class ICrmOrderActions return true; // end of pack } } + + self::eventLog('json', 'json', json_encode($resOrders)); if (!empty($resOrders)) { $customers = $api->customerUpload($resCustomers); @@ -297,13 +299,18 @@ class ICrmOrderActions $rsOrderProps = CSaleOrderPropsValue::GetList(array(), array('ORDER_ID' => $arFields['ID'])); while ($ar = $rsOrderProps->Fetch()) { switch ($ar['CODE']) { - case 'ZIP': $resOrderDeliveryAddress['index'] = self::toJSON($ar['VALUE']); + case 'ZIP': $resOrderDeliveryAddress['index'] = ICrmOrderActions::toJSON($ar['VALUE']); break; - case 'CITY': $resOrderDeliveryAddress['city'] = self::toJSON($ar['VALUE']); + case 'CITY': $resOrderDeliveryAddress['city'] = ICrmOrderActions::toJSON($ar['VALUE']); break; - case 'ADDRESS': $resOrderDeliveryAddress['text'] = self::toJSON($ar['VALUE']); + case 'ADDRESS': $resOrderDeliveryAddress['text'] = ICrmOrderActions::toJSON($ar['VALUE']); 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; case 'PHONE': $resOrder['phone'] = $ar['VALUE']; break; @@ -402,7 +409,7 @@ class ICrmOrderActions * @param type $str in SITE_CHARSET * @return type $str in utf-8 */ - protected static function toJSON($str) { + public static function toJSON($str) { global $APPLICATION; return $APPLICATION->ConvertCharset($str, SITE_CHARSET, 'utf-8');