commit
99e634d8ce
@ -1,3 +1,7 @@
|
|||||||
|
## 2016-10-06 v.2.0.4
|
||||||
|
* Оптимизация History
|
||||||
|
* Исправлена ошибка выгрузки доставок при установке
|
||||||
|
|
||||||
## 2016-10-04 v.2.0.3
|
## 2016-10-04 v.2.0.3
|
||||||
* fix состава отгрузки
|
* fix состава отгрузки
|
||||||
|
|
||||||
|
@ -443,6 +443,7 @@ class RetailCrmHistory
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($order['externalId']) && $order['externalId']) {
|
if (isset($order['externalId']) && $order['externalId']) {
|
||||||
|
$itemUpdate = false;
|
||||||
$newOrder = Bitrix\Sale\Order::load($order['externalId']);
|
$newOrder = Bitrix\Sale\Order::load($order['externalId']);
|
||||||
|
|
||||||
if (!$newOrder instanceof \Bitrix\Sale\Order) {
|
if (!$newOrder instanceof \Bitrix\Sale\Order) {
|
||||||
@ -597,62 +598,67 @@ class RetailCrmHistory
|
|||||||
|
|
||||||
//items
|
//items
|
||||||
$basket = $newOrder->getBasket();
|
$basket = $newOrder->getBasket();
|
||||||
|
if (isset($order['items'])) {
|
||||||
foreach ($order['items'] as $product) {
|
$itemUpdate = true;
|
||||||
$item = self::getExistsItem($basket, 'catalog', $product['offer']['externalId']);
|
foreach ($order['items'] as $product) {
|
||||||
if (!$item) {
|
$item = self::getExistsItem($basket, 'catalog', $product['offer']['externalId']);
|
||||||
$item = $basket->createItem('catalog', $product['offer']['externalId']);
|
if (!$item) {
|
||||||
if ($item instanceof \Bitrix\Sale\Basket) {
|
if($product['delete']){
|
||||||
$elem = self::getInfoElement();
|
continue;
|
||||||
$item->setFields(array(
|
}
|
||||||
'CURRENCY' => \Bitrix\Currency\CurrencyManager::getBaseCurrency(),
|
$item = $basket->createItem('catalog', $product['offer']['externalId']);
|
||||||
'LID' => \Bitrix\Main\Context::getCurrent()->getSite(),
|
if ($item instanceof \Bitrix\Sale\Basket) {
|
||||||
'BASE_PRICE' => $product['initialPrice'],
|
$elem = self::getInfoElement();
|
||||||
'NAME' => $elem['NAME'],
|
$item->setFields(array(
|
||||||
'DETAIL_PAGE_URL' => $elem['URL']
|
'CURRENCY' => \Bitrix\Currency\CurrencyManager::getBaseCurrency(),
|
||||||
));
|
'LID' => \Bitrix\Main\Context::getCurrent()->getSite(),
|
||||||
} else {
|
'BASE_PRICE' => $product['initialPrice'],
|
||||||
RCrmActions::eventLog('RetailCrmHistory::orderHistory', 'createItem', 'Error item add');
|
'NAME' => $elem['NAME'],
|
||||||
|
'DETAIL_PAGE_URL' => $elem['URL']
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
RCrmActions::eventLog('RetailCrmHistory::orderHistory', 'createItem', 'Error item add');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($product['delete']) {
|
||||||
|
$item->delete();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ($product['quantity']) {
|
if ($product['quantity']) {
|
||||||
$item->setFieldNoDemand('QUANTITY', $product['quantity']);
|
$item->setFieldNoDemand('QUANTITY', $product['quantity']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists('discount', $product) || array_key_exists('discountPercent', $product)) {
|
if (array_key_exists('discount', $product) || array_key_exists('discountPercent', $product)) {
|
||||||
if (!isset($orderCrm)) {
|
if (!isset($orderCrm)) {
|
||||||
try {
|
try {
|
||||||
$orderCrm = $api->ordersGet($order['id'], 'id');
|
$orderCrm = $api->ordersGet($order['id'], 'id');
|
||||||
} catch (\RetailCrm\Exception\CurlException $e) {
|
} catch (\RetailCrm\Exception\CurlException $e) {
|
||||||
RCrmActions::eventLog(
|
RCrmActions::eventLog(
|
||||||
'RetailCrmHistory::orderHistory', 'RetailCrm\RestApi::ordersGet::CurlException',
|
'RetailCrmHistory::orderHistory', 'RetailCrm\RestApi::ordersGet::CurlException',
|
||||||
$e->getCode() . ': ' . $e->getMessage()
|
$e->getCode() . ': ' . $e->getMessage()
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($orderCrm['order']['items'] as $itemCrm) {
|
||||||
|
if ($itemCrm['offer']['externalId'] == $product['offer']['externalId']) {
|
||||||
|
$itemCost = $itemCrm['initialPrice'] - $itemCrm['discount'] - round(($itemCrm['initialPrice'] / 100 * $itemCrm['discountPercent']), 2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($itemCost) && $itemCost > 0) {
|
||||||
|
$item->setField('CUSTOM_PRICE', 'Y');
|
||||||
|
$item->setField('PRICE', $itemCost);
|
||||||
|
$item->setField('DISCOUNT_NAME', '');
|
||||||
|
$item->setField('DISCOUNT_VALUE', '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($orderCrm['order']['items'] as $itemCrm) {
|
$basket->save();
|
||||||
if ($itemCrm['offer']['externalId'] == $product['offer']['externalId']) {
|
|
||||||
$itemCost = $itemCrm['initialPrice'] - $itemCrm['discount'] - round(($itemCrm['initialPrice'] / 100 * $itemCrm['discountPercent']), 2);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($itemCost) && $itemCost > 0) {
|
|
||||||
$item->setField('CUSTOM_PRICE', 'Y');
|
|
||||||
$item->setField('PRICE', $itemCost);
|
|
||||||
$item->setField('DISCOUNT_NAME', '');
|
|
||||||
$item->setField('DISCOUNT_VALUE', '');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($product['delete']) {
|
|
||||||
$item->delete();
|
|
||||||
}
|
|
||||||
$basket->save();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$orderSumm = 0;
|
$orderSumm = 0;
|
||||||
@ -678,7 +684,8 @@ class RetailCrmHistory
|
|||||||
}
|
}
|
||||||
|
|
||||||
//delivery
|
//delivery
|
||||||
if (array_key_exists('code', $order['delivery'])/* || array_key_exists('service', $order['delivery'])*/) {
|
if (array_key_exists('code', $order['delivery'])) {
|
||||||
|
$itemUpdate = true;
|
||||||
//если пусто, удаляем, если нет, update или add
|
//если пусто, удаляем, если нет, update или add
|
||||||
if (!isset($orderCrm)) {
|
if (!isset($orderCrm)) {
|
||||||
try {
|
try {
|
||||||
@ -711,7 +718,9 @@ class RetailCrmHistory
|
|||||||
|
|
||||||
Bitrix\Sale\OrderTable::update($order['externalId'], array('MARKED' => 'N', 'EMP_MARKED_ID' => '', 'REASON_MARKED' => ''));
|
Bitrix\Sale\OrderTable::update($order['externalId'], array('MARKED' => 'N', 'EMP_MARKED_ID' => '', 'REASON_MARKED' => ''));
|
||||||
|
|
||||||
self::updateShipmentItem($order['externalId']);
|
if ($itemUpdate) {
|
||||||
|
self::updateShipmentItem($order['externalId']);
|
||||||
|
}
|
||||||
|
|
||||||
if (function_exists('retailCrmAfterOrderSave')) {
|
if (function_exists('retailCrmAfterOrderSave')) {
|
||||||
retailCrmAfterOrderSave($order);
|
retailCrmAfterOrderSave($order);
|
||||||
|
@ -1 +1,2 @@
|
|||||||
- fix состава отгрузки
|
- Оптимизация History
|
||||||
|
- Исправлена ошибка выгрузки доставок при установке
|
@ -680,7 +680,8 @@ class intaro_retailcrm extends CModule
|
|||||||
}
|
}
|
||||||
} elseif (htmlspecialchars(trim($_POST['delivery-types-export'])) == 'true') {//отправка доставок в црм
|
} elseif (htmlspecialchars(trim($_POST['delivery-types-export'])) == 'true') {//отправка доставок в црм
|
||||||
// send to intaro crm and save delivery types!
|
// send to intaro crm and save delivery types!
|
||||||
foreach ($optionsDelivTypes as $deliveryType) {
|
$arDeliveryServiceAll = \Bitrix\Sale\Delivery\Services\Manager::getActiveList();
|
||||||
|
foreach ($arResult['bitrixDeliveryTypesList'] as $deliveryType) {
|
||||||
$load = true;
|
$load = true;
|
||||||
try {
|
try {
|
||||||
$this->RETAIL_CRM_API->deliveryTypesEdit(RCrmActions::clearArr(array(
|
$this->RETAIL_CRM_API->deliveryTypesEdit(RCrmActions::clearArr(array(
|
||||||
@ -698,7 +699,8 @@ class intaro_retailcrm extends CModule
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ($load) {
|
if ($load) {
|
||||||
foreach ($optionsDelivTypes as $deliveryService) {
|
$deliveryTypesArr[$deliveryType['ID']] = $deliveryType['ID'];
|
||||||
|
foreach ($arDeliveryServiceAll as $deliveryService) {
|
||||||
if ($deliveryService['PARENT_ID'] != 0 && $deliveryService['PARENT_ID'] == $deliveryType['ID']) {
|
if ($deliveryService['PARENT_ID'] != 0 && $deliveryService['PARENT_ID'] == $deliveryType['ID']) {
|
||||||
$srv = explode(':', $deliveryService['CODE']);
|
$srv = explode(':', $deliveryService['CODE']);
|
||||||
if (count($srv) == 2) {
|
if (count($srv) == 2) {
|
||||||
@ -710,7 +712,7 @@ class intaro_retailcrm extends CModule
|
|||||||
)));
|
)));
|
||||||
} catch (\RetailCrm\Exception\CurlException $e) {
|
} catch (\RetailCrm\Exception\CurlException $e) {
|
||||||
RCrmActions::eventLog(
|
RCrmActions::eventLog(
|
||||||
'intaro.retailcrm/options.php', 'RetailCrm\ApiClient::deliveryServiceEdit::CurlException',
|
'intaro.crm/install/index.php', 'RetailCrm\ApiClient::deliveryServiceEdit::CurlException',
|
||||||
$e->getCode() . ': ' . $e->getMessage()
|
$e->getCode() . ': ' . $e->getMessage()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?
|
<?
|
||||||
$arModuleVersion = array(
|
$arModuleVersion = array(
|
||||||
"VERSION" => "2.0.3",
|
"VERSION" => "2.0.4",
|
||||||
"VERSION_DATE" => "2016-10-04 18:00:00"
|
"VERSION_DATE" => "2016-10-06 18:00:00"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ $MESS ['PAYMENT_N'] = 'Не оплачен';
|
|||||||
$MESS ['LEGAL_DETAIL'] = 'Юридические и банковские реквизиты';
|
$MESS ['LEGAL_DETAIL'] = 'Юридические и банковские реквизиты';
|
||||||
$MESS ['ORDER_CUSTOM'] = 'Кастомные поля';
|
$MESS ['ORDER_CUSTOM'] = 'Кастомные поля';
|
||||||
$MESS ['ORDER_UPLOAD'] = 'Повторная выгрузка заказов';
|
$MESS ['ORDER_UPLOAD'] = 'Повторная выгрузка заказов';
|
||||||
$MESS ['ORDER_NUMBERS'] = 'Номера заказов: ';
|
$MESS ['ORDER_NUMBER'] = 'Номера заказов: ';
|
||||||
$MESS ['ORDER_UPLOAD_INFO'] = 'Для загрузки всех заказов нажмите кнопку «Начать выгрузку». Или перечислите необходимые ID заказов через запятую, интервалы через тире. Например: 1, 3, 5-10, 12, 13... и т.д.';
|
$MESS ['ORDER_UPLOAD_INFO'] = 'Для загрузки всех заказов нажмите кнопку «Начать выгрузку». Или перечислите необходимые ID заказов через запятую, интервалы через тире. Например: 1, 3, 5-10, 12, 13... и т.д.';
|
||||||
|
|
||||||
$MESS ['ICRM_OPTIONS_SUBMIT_TITLE'] = 'Сохранить настройки';
|
$MESS ['ICRM_OPTIONS_SUBMIT_TITLE'] = 'Сохранить настройки';
|
||||||
|
@ -930,7 +930,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] == 'Y')) {
|
|||||||
<td colspan="2"><b><?php echo GetMessage('ORDER_UPLOAD'); ?></b></td>
|
<td colspan="2"><b><?php echo GetMessage('ORDER_UPLOAD'); ?></b></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="adm-detail-content-cell-r"><?php echo GetMessage('ORDER_NUMBERS'); ?> <input id="order-nombers" style="width:86%" type="text" value="" name="orders"></td>
|
<td class="adm-detail-content-cell-r"><?php echo GetMessage('ORDER_NUMBER'); ?> <input id="order-nombers" style="width:86%" type="text" value="" name="orders"></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user