transfer status and bug fixes (#13)

This commit is contained in:
DmitryZagorulko 2017-05-24 18:22:19 +04:00 committed by Alex Lushpai
parent 04a084f94f
commit b6f010f2fc
2 changed files with 30 additions and 29 deletions

View File

@ -293,33 +293,6 @@ if ($history->isSuccessful() && count($history->history) > 0) {
} else {
$orderToUpdate = new Order((int) $order['externalId']);
/*
* check status
*/
if(!empty($order['status'])) {
$stype = $order['status'];
if ($statuses[$stype] != null) {
if ($statuses[$stype] != $orderToUpdate->current_state) {
Db::getInstance()->execute('
INSERT INTO `' . _DB_PREFIX_ . 'order_history` (`id_employee`, `id_order`, `id_order_state`, `date_add`)
VALUES (
0,
' . $orderToUpdate->id . ',
' . $statuses[$stype] . ',
"' . date('Y-m-d H:i:s') . '"
)
');
Db::getInstance()->execute('
UPDATE `' . _DB_PREFIX_ . 'orders`
SET `current_state` = \'' . $statuses[$stype] . '\'
WHERE `id_order` = ' . (int)$order['externalId']
);
}
}
}
/*
* check delivery type
*/
@ -574,6 +547,34 @@ if ($history->isSuccessful() && count($history->history) > 0) {
unset($ItemDiscount);
}
/*
* check status
*/
if(!empty($order['status'])) {
$stype = $order['status'];
if ($statuses[$stype] != null) {
if ($statuses[$stype] != $orderToUpdate->current_state) {
Db::getInstance()->execute('
INSERT INTO `' . _DB_PREFIX_ . 'order_history` (`id_employee`, `id_order`, `id_order_state`, `date_add`)
VALUES (
0,
' . $orderToUpdate->id . ',
' . $statuses[$stype] . ',
"' . date('Y-m-d H:i:s') . '"
)
');
Db::getInstance()->execute('
UPDATE `' . _DB_PREFIX_ . 'orders`
SET `current_state` = \'' . $statuses[$stype] . '\'
WHERE `id_order` = ' . (int)$order['externalId']
);
}
}
}
}
}
/*

View File

@ -395,8 +395,8 @@ class RetailCRM extends Module
$address = array_shift($addressCollection);
if ($address instanceof Address) {
$phone = is_null($address->phone)
? is_null($address->phone_mobile) ? '' : $address->phone_mobile
$phone = empty($address->phone)
? empty($address->phone_mobile) ? '' : $address->phone_mobile
: $address->phone;
$postcode = $address->postcode;