1
0
mirror of synced 2024-11-28 16:26:07 +03:00

only package mode

This commit is contained in:
pomadchin 2013-08-14 16:51:40 +04:00
parent 8d5918cfc3
commit f564c6c8e0
3 changed files with 72 additions and 118 deletions

View File

@ -66,53 +66,8 @@ class ICrmOrderActions
'optionsPayment' => $optionsPayment
);
// pack mode enable / disable
// can send data evry 500 rows
if (!$steps) {
while ($arOrder = $dbOrder->GetNext()) { //here orders by id asc; with offset
//packmode
$result = self::orderCreate($arOrder, $api, $arParams);
if (!$result['order'] || !$result['customer'])
continue;
$resOrders[] = $result['order'];
$resCustomers[] = $result['customer'];
$lastOrderId = $arOrder['ID'];
}
if (!empty($resOrders) && !empty($resCustomers)) {
$customers = $api->customerUpload($resCustomers);
// error pushing customers
if ($api->getStatusCode() != 201) {
//handle err
//self::eventLog('ICrmOrderActions::uploadOrders', 'IntaroCrm\RestApi::customerUpload', $api->getLastError());
if ($api->getStatusCode() != 460) // some orders were sent
return true;
}
$resOrders[] = $order;
$lastOrderId = $arOrder['ID'];
}
if (!empty($resOrders)) {
$orders = $api->orderUpload($resOrders);
// error pushing orders
if ($api->getStatusCode() != 201) {
//handle err
self::eventLog('ICrmOrderActions::uploadOrders', 'IntaroCrm\RestApi::orderUpload', $api->getLastError());
if ($api->getStatusCode() != 460) // some orders were sent
return true;
}
}
} else { // package mode (by default runs after install)
$orderCount = 0;
while ($arOrder = $dbOrder->GetNext()) { // here orders by id asc
@ -181,7 +136,6 @@ class ICrmOrderActions
return false; // in pack mode return errors
}
}
}
if($lastOrderId)
COption::SetOptionString(self::$MODULE_ID, self::$CRM_ORDER_LAST_ID, $lastOrderId);

View File

@ -496,7 +496,7 @@ class intaro_intarocrm extends CModule
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
&& isset($_POST['ajax']) && ($_POST['ajax'] == 1)) {
ICrmOrderActions::uploadOrders(true); // each 50
ICrmOrderActions::uploadOrders(); // each 50
$lastUpOrderId = COption::GetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, 0);
$countLeft = (int) CSaleOrder::GetList(array("ID" => "ASC"), array('>ID' => $lastUpOrderId), array());

View File

@ -1,6 +1,6 @@
<?php
$MESS ['STEP_NAME'] = 'Шаг 4';
$MESS ['MOD_NEXT_STEP'] = 'Следующий шаг';
$MESS ['MOD_NEXT_STEP'] = 'Завершить установку';
$MESS ['MOD_PREV_STEP'] = 'Предыдущий шаг';
$MESS ['DELIVERY_TYPES_LIST'] = 'Способы доставки';
$MESS ['PAYMENT_TYPES_LIST'] = 'Способы оплаты';