add synchro erp action
This commit is contained in:
parent
821c2c37b7
commit
70884dcea0
@ -1520,6 +1520,35 @@ class AdminOrdersControllerCore extends AdminController
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
|
||||
}
|
||||
} elseif (Tools::getValue('syncherp') == 1) {
|
||||
$id_order = Tools::getValue('id_order', false);
|
||||
if ($id_order) {
|
||||
$order = new Order((int)$id_order);
|
||||
if (!$order->isSynchIntoErp()) {
|
||||
|
||||
if ($order->getIdErp() === 1) {
|
||||
$order->deletIdErpIfNotSynch();
|
||||
}
|
||||
|
||||
$params['id_order'] = $order->id;
|
||||
$params['newOrderStatus'] = new StdClass();
|
||||
|
||||
if ($order->hasStatusInHistory(2)) {
|
||||
$params['newOrderStatus']->id = 2;
|
||||
} elseif ($order->hasStatusInHistory(10)) {
|
||||
$params['newOrderStatus']->id = 10;
|
||||
} elseif ($order->hasStatusInHistory(1)) {
|
||||
$params['newOrderStatus']->id = 1;
|
||||
}
|
||||
|
||||
if (!empty($params['newOrderStatus']->id)) {
|
||||
$erporder = Module::getInstanceByName('erporder');
|
||||
if ($erporder) {
|
||||
return $erporder->hookActionOrderStatusPostUpdate($params);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
parent::postProcess();
|
||||
|
Loading…
Reference in New Issue
Block a user