1
0
mirror of synced 2024-11-22 13:26:10 +03:00
This commit is contained in:
Grisha Pomadchin 2013-08-15 19:18:44 +04:00
parent ca6e71d55f
commit e68db44642

View File

@ -568,13 +568,13 @@ class intaro_intarocrm extends CModule
//form delivery types ids arr //form delivery types ids arr
$deliveryTypesArr = array(); $deliveryTypesArr = array();
if (htmlspecialchars(trim($_POST['delivery-types-export'])) == 'true') { if (htmlspecialchars(trim($_POST['delivery-types-export'])) == 'false') {
if ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch()) { if ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch()) {
do { do {
$deliveryTypesArr[$arDeliveryTypesList['ID']] = htmlspecialchars(trim($_POST['delivery-type-' . $arDeliveryTypesList['ID']])); $deliveryTypesArr[$arDeliveryTypesList['ID']] = htmlspecialchars(trim($_POST['delivery-type-' . $arDeliveryTypesList['ID']]));
} while ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch()); } while ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch());
} }
} else { } elseif (htmlspecialchars(trim($_POST['delivery-types-export'])) == 'true') {
// send to intaro crm and save // send to intaro crm and save
if ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch()) { if ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch()) {
do { do {
@ -592,18 +592,19 @@ class intaro_intarocrm extends CModule
$deliveryTypesArr[$arDeliveryTypesList['ID']] = $resultDeliveryTypeId; $deliveryTypesArr[$arDeliveryTypesList['ID']] = $resultDeliveryTypeId;
// send to crm // send to crm
$this->INTARO_CRM_API->deliveryTypeEdit(array( $this->INTARO_CRM_API->deliveryTypeEdit(ICrmOrderActions::clearArr(array(
'code' => $resultDeliveryTypeId, 'code' => $resultDeliveryTypeId,
'name' => ICrmOrderActions::toJSON($arDeliveryTypesList['NAME']), 'name' => ICrmOrderActions::toJSON($arDeliveryTypesList['NAME']),
'defaultCost' => $arDeliveryTypesList['PRICE'], 'defaultCost' => $arDeliveryTypesList['PRICE'],
'description' => ICrmOrderActions::toJSON($arDeliveryTypesList['DESCRIPTION']), 'description' => ICrmOrderActions::toJSON($arDeliveryTypesList['DESCRIPTION']),
'paymentTypes' => '' 'paymentTypes' => ''
)); )));
// error pushing customer // error pushing customer
if (($this->INTARO_CRM_API->getStatusCode() != 200) || ($this->INTARO_CRM_API->getStatusCode() != 201)) { if (($this->INTARO_CRM_API->getStatusCode() != 200)
|| ($this->INTARO_CRM_API->getStatusCode() != 201)) {
//handle err //handle err
self::eventLog('install/index.php', 'IntaroCrm\RestApi::deliveryTypeEdit', $this->INTARO_CRM_API->getLastError()); ICrmOrderActions::eventLog('install/index.php', 'IntaroCrm\RestApi::deliveryTypeEdit', $this->INTARO_CRM_API->getLastError());
} }
} while ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch()); } while ($arDeliveryTypesList = $dbDeliveryTypesList->Fetch());