1
0
mirror of synced 2024-11-22 05:16:09 +03:00

new api err statuses; +apiUpd added order createdAt field

This commit is contained in:
Grisha Pomadchin 2013-07-24 17:29:50 +04:00
parent 6230fc1392
commit 58eacc3caf
2 changed files with 25 additions and 5 deletions

View File

@ -84,10 +84,15 @@ class ICrmOrderActions
$orders = $api->orderUpload($resOrders); $orders = $api->orderUpload($resOrders);
// error pushing orders // error pushing orders
if (!$orders) { if (($api->getStatusCode() != 200) || ($api->getStatusCode() != 460)) {
//handle err //handle err
self::eventLog('ICrmOrderActions::uploadOrders', 'IntaroCrm\RestApi::orderUpload', $api->getLastError()); self::eventLog('ICrmOrderActions::uploadOrders', 'IntaroCrm\RestApi::orderUpload', $api->getLastError());
return true; return false; // in pack mode return errors
}
// if some orders not uploaded
if ($api->getStatusCode() == 460) {
self::eventLog('ICrmOrderActions::uploadOrders', 'IntaroCrm\RestApi::orderUpload', $api->getLastError());
} }
} }
} else { // package mode (by default runs after install) } else { // package mode (by default runs after install)
@ -110,12 +115,17 @@ class ICrmOrderActions
$orders = $api->orderUpload($resOrders); $orders = $api->orderUpload($resOrders);
// error pushing orders // error pushing orders
if (!$orders) { if (($api->getStatusCode() != 200) || ($api->getStatusCode() != 460)) {
//handle err //handle err
self::eventLog('ICrmOrderActions::uploadOrders', 'IntaroCrm\RestApi::orderUpload', $api->getLastError()); self::eventLog('ICrmOrderActions::uploadOrders', 'IntaroCrm\RestApi::orderUpload', $api->getLastError());
return false; // in pack mode return errors return false; // in pack mode return errors
} }
// if some orders not uploaded
if($api->getStatusCode() == 460) {
self::eventLog('ICrmOrderActions::uploadOrders', 'IntaroCrm\RestApi::orderUpload', $api->getLastError());
}
COption::SetOptionString(self::$MODULE_ID, self::$CRM_ORDER_LAST_ID, $lastOrderId); COption::SetOptionString(self::$MODULE_ID, self::$CRM_ORDER_LAST_ID, $lastOrderId);
return true; // end of pack return true; // end of pack
@ -126,11 +136,16 @@ class ICrmOrderActions
$orders = $api->orderUpload($resOrders); $orders = $api->orderUpload($resOrders);
// error pushing orders // error pushing orders
if (!$orders) { if (($api->getStatusCode() != 200) || ($api->getStatusCode() != 460)) {
//handle err //handle err
self::eventLog('ICrmOrderActions::uploadOrders', 'IntaroCrm\RestApi::orderUpload', $api->getLastError()); self::eventLog('ICrmOrderActions::uploadOrders', 'IntaroCrm\RestApi::orderUpload', $api->getLastError());
return false; // in pack mode return errors return false; // in pack mode return errors
} }
// if some orders not uploaded
if ($api->getStatusCode() == 460) {
self::eventLog('ICrmOrderActions::uploadOrders', 'IntaroCrm\RestApi::orderUpload', $api->getLastError());
}
} }
} }
@ -276,6 +291,10 @@ class ICrmOrderActions
if($arFields['CANCELED'] == 'Y') if($arFields['CANCELED'] == 'Y')
$arFields['STATUS_ID'] = $arFields['CANCELED']; $arFields['STATUS_ID'] = $arFields['CANCELED'];
$createdAt = \datetime::createfromformat('Y-m-d H:i:s', $arFields['DATE_INSERT']);
if($createdAt)
$createdAt = $createdAt->format('d-m-Y H:i:s');
$resOrder = self::clearArr(array( $resOrder = self::clearArr(array(
'contactName' => $resOrder['contactName'], 'contactName' => $resOrder['contactName'],
'phone' => $resOrder['phone'], 'phone' => $resOrder['phone'],
@ -291,6 +310,7 @@ class ICrmOrderActions
'deliveryType' => $arParams['optionsDelivTypes'][$resultDeliveryTypeId], 'deliveryType' => $arParams['optionsDelivTypes'][$resultDeliveryTypeId],
'status' => $arParams['optionsPayStatuses'][$arFields['STATUS_ID']], 'status' => $arParams['optionsPayStatuses'][$arFields['STATUS_ID']],
'statusComment' => $arFields['REASON_CANCELED'], 'statusComment' => $arFields['REASON_CANCELED'],
'createdAt' => $createdAt,
'deliveryAddress' => $resOrderDeliveryAddress, 'deliveryAddress' => $resOrderDeliveryAddress,
'items' => $items 'items' => $items
)); ));

View File

@ -1,5 +1,5 @@
<? <?
$arModuleVersion = array( $arModuleVersion = array(
'VERSION' => '0.3.5', 'VERSION' => '0.3.5',
'VERSION_DATE' => '2013-07-24 16:38:00', 'VERSION_DATE' => '2013-07-24 17:28:00',
); );