1
0
mirror of synced 2024-11-25 06:46:08 +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 'optionsPayment' => $optionsPayment
); );
// pack mode enable / disable //packmode
// can send data evry 500 rows
if (!$steps) {
while ($arOrder = $dbOrder->GetNext()) { //here orders by id asc; with offset
$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; $orderCount = 0;
while ($arOrder = $dbOrder->GetNext()) { // here orders by id asc while ($arOrder = $dbOrder->GetNext()) { // here orders by id asc
@ -181,7 +136,6 @@ class ICrmOrderActions
return false; // in pack mode return errors return false; // in pack mode return errors
} }
} }
}
if($lastOrderId) if($lastOrderId)
COption::SetOptionString(self::$MODULE_ID, self::$CRM_ORDER_LAST_ID, $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') if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
&& isset($_POST['ajax']) && ($_POST['ajax'] == 1)) { && 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); $lastUpOrderId = COption::GetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, 0);
$countLeft = (int) CSaleOrder::GetList(array("ID" => "ASC"), array('>ID' => $lastUpOrderId), array()); $countLeft = (int) CSaleOrder::GetList(array("ID" => "ASC"), array('>ID' => $lastUpOrderId), array());

View File

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