1
0
mirror of synced 2024-11-25 14:56:09 +03:00

+upd class

This commit is contained in:
Grisha Pomadchin 2013-09-03 18:23:27 +04:00
parent c2729dcb93
commit edcadcd052
2 changed files with 41 additions and 12 deletions

View File

@ -12,6 +12,7 @@ class ICrmOrderActions
protected static $CRM_PAYMENT = 'payment_arr'; //order payment Y/N
protected static $CRM_ORDER_LAST_ID = 'order_last_id';
protected static $CRM_ORDER_SITES = 'sites_ids';
protected static $CRM_ORDER_PROPS = 'order_props';
/**
* Mass order uploading, without repeating; always returns true, but writes error log
@ -57,6 +58,7 @@ class ICrmOrderActions
$optionsPayStatuses = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_STATUSES, 0)); // --statuses
$optionsPayment = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT, 0));
$optionsSites = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_ORDER_SITES, 0));
$optionsOrderProps = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_ORDER_PROPS, 0));
$api = new IntaroCrm\RestApi($api_host, $api_key);
@ -66,7 +68,8 @@ class ICrmOrderActions
'optionsPayTypes' => $optionsPayTypes,
'optionsPayStatuses' => $optionsPayStatuses,
'optionsPayment' => $optionsPayment,
'optionSites' => $optionsSites
'optionSites' => $optionsSites,
'optionsOrderProps' => $optionsOrderProps
);
//packmode
@ -259,24 +262,49 @@ 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 $arParams['optionsOrderProps']['index']: $resOrderDeliveryAddress['index'] = self::toJSON($ar['VALUE']);
break;
case 'CITY': $resOrderDeliveryAddress['city'] = self::toJSON($ar['VALUE']);
break;
case 'ADDRESS': $resOrderDeliveryAddress['text'] = self::toJSON($ar['VALUE']);
case $arParams['optionsOrderProps']['text']: $resOrderDeliveryAddress['text'] = self::toJSON($ar['VALUE']);
break;
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(" ", self::toJSON($ar['VALUE']));
case $arParams['optionsOrderProps']['fio']: $resOrder['contactName'] = explode(" ", self::toJSON($ar['VALUE']));
break;
case 'PHONE': $resOrder['phone'] = $ar['VALUE'];
case $arParams['optionsOrderProps']['phone']: $resOrder['phone'] = $ar['VALUE'];
break;
case 'EMAIL': $resOrder['email'] = $ar['VALUE'];
case $arParams['optionsOrderProps']['email']: $resOrder['email'] = $ar['VALUE'];
break;
}
if (count($arParams['optionsOrderProps'] > 5)) {
switch ($ar['CODE']) {
/*case $arParams['optionsOrderProps']['country']: $resOrderDeliveryAddress['country'] = self::toJSON($ar['VALUE']);
break;
case $arParams['optionsOrderProps']['region']: $resOrderDeliveryAddress['region'] = self::toJSON($ar['VALUE']);
break;
case $arParams['optionsOrderProps']['city']: $resOrderDeliveryAddress['city'] = self::toJSON($ar['VALUE']);
break; */
case $arParams['optionsOrderProps']['street']: $resOrderDeliveryAddress['street'] = self::toJSON($ar['VALUE']);
break;
case $arParams['optionsOrderProps']['building']: $resOrderDeliveryAddress['building'] = self::toJSON($ar['VALUE']);
break;
case $arParams['optionsOrderProps']['flat']: $resOrderDeliveryAddress['flat'] = self::toJSON($ar['VALUE']);
break;
case $arParams['optionsOrderProps']['inercomcode']: $resOrderDeliveryAddress['intercomcode'] = self::toJSON($ar['VALUE']);
break;
case $arParams['optionsOrderProps']['floor']: $resOrderDeliveryAddress['floor'] = self::toJSON($ar['VALUE']);
break;
case $arParams['optionsOrderProps']['block']: $resOrderDeliveryAddress['block'] = self::toJSON($ar['VALUE']);
break;
case $arParams['optionsOrderProps']['house']: $resOrderDeliveryAddress['house'] = self::toJSON($ar['VALUE']);
break;
}
}
}
$items = array();

View File

@ -25,6 +25,7 @@ if($_GET['errc']) echo CAdminMessage::ShowMessage(GetMessage($_GET['errc']));
if($_GET['ok'] && $_GET['ok'] == 'Y') echo CAdminMessage::ShowNote(GetMessage('ICRM_OPTIONS_OK'));
$arResult = array();
$arResult['orderProps'][0]['NAME'] = GetMessage('FIO');
$arResult['orderProps'][0]['ID'] = 'fio';
$arResult['orderProps'][1]['NAME'] = GetMessage('ZIP');
@ -36,12 +37,12 @@ $arResult['orderProps'][3]['ID'] = 'email';
// address
$arResult['orderProps'][4]['NAME'] = GetMessage('ADDRESS');
$arResult['orderProps'][4]['ID'] = 'text';
$arResult['orderProps'][5]['NAME'] = GetMessage('COUNTRY');
$arResult['orderProps'][5]['ID'] = 'country';
$arResult['orderProps'][6]['NAME'] = GetMessage('REGION');
$arResult['orderProps'][6]['ID'] = 'region';
$arResult['orderProps'][7]['NAME'] = GetMessage('CITY');
$arResult['orderProps'][7]['ID'] = 'city';
//$arResult['orderProps'][5]['NAME'] = GetMessage('COUNTRY');
//$arResult['orderProps'][5]['ID'] = 'country';
//$arResult['orderProps'][6]['NAME'] = GetMessage('REGION');
//$arResult['orderProps'][6]['ID'] = 'region';
//$arResult['orderProps'][7]['NAME'] = GetMessage('CITY');
//$arResult['orderProps'][7]['ID'] = 'city';
$arResult['orderProps'][8]['NAME'] = GetMessage('STREET');
$arResult['orderProps'][8]['ID'] = 'street';
$arResult['orderProps'][9]['NAME'] = GetMessage('BUILDING');