This commit is contained in:
Michael RICOIS 2018-01-11 13:03:54 +01:00
parent 391d526942
commit 9228227d89

View File

@ -158,13 +158,16 @@ class AdminLogistics extends AdminTab {
return TRUE;
}
public function postProcess() {
public function postProcess()
{
global $cookie, $logistics_carriers;
// Delete number
if(( in_array((int)$cookie->profile, array(1,9,7,13,14)) )
&& ( $delete_number = Tools::getValue('delete_number') )) {
if($delete = (int) Tools::getValue('delete_laposte')) {
// Suppression LAPOSTE
if ($delete = (int) Tools::getValue('delete_laposte')) {
Db::getInstance()->ExecuteS('
DELETE FROM `'._DB_PREFIX_.'lapostews`
WHERE `id_order_detail` = '.$delete.'
@ -185,7 +188,9 @@ class AdminLogistics extends AdminTab {
AND `shipping_number` = "'.pSQL($delete_number).'"
');
}
} elseif($delete = (int) Tools::getValue('delete_exapaq')) {
}
// Suppression EXAPAQ
elseif ($delete = (int) Tools::getValue('delete_exapaq')) {
Db::getInstance()->ExecuteS('
DELETE FROM `'._DB_PREFIX_.'exapaqws`
WHERE `id_order_detail` = '.$delete.'
@ -203,7 +208,9 @@ class AdminLogistics extends AdminTab {
AND `shipping_number` = "'.pSQL($delete_number).'"
');
}
} elseif($delete = (int) Tools::getValue('delete_mondialrelay')) {
}
// Suppression MONDIAL RELAY
elseif ($delete = (int) Tools::getValue('delete_mondialrelay')) {
Db::getInstance()->ExecuteS('
DELETE FROM `'._DB_PREFIX_.'mondialrelay_parcel`
WHERE `id_order_detail` = '.$delete.'
@ -222,7 +229,12 @@ class AdminLogistics extends AdminTab {
');
}
}
// Suppression PHILEA
elseif ($delete = (int) Tools::getValue('delete_philea')) {
}
// Pour les commandes ...
$id_order_details = array();
foreach(Db::getInstance()->ExecuteS('
SELECT `id_order_detail`
@ -273,9 +285,9 @@ class AdminLogistics extends AdminTab {
) {
$weight = 0.24;
$order = new Order((int) $id_order);
if(Validate::isLoadedObject($order)) {
if (Validate::isLoadedObject($order)) {
$parcel_carrier == 'laposte'? $weight = 0.24: TRUE;
if($parcel_carrier == "laposte" || $parcel_carrier == "mondialrelay") {
if ($parcel_carrier == "laposte" || $parcel_carrier == "mondialrelay") {
$result = $logistics_carriers[$parcel_carrier]->registerParcel($order, $products, $weight);
if($result[0] != '') {
$this->_html .= $result[0];
@ -301,10 +313,10 @@ class AdminLogistics extends AdminTab {
$this->_html .= '<p class="conf">'.$this->l('Registration complete, label sent to printer').'</p><br />';
if($_SERVER['REMOTE_ADDR'] != '109.190.53.175'
&& $_SERVER['REMOTE_ADDR'] != '78.226.56.137'
&& $_SERVER['REMOTE_ADDR'] != '88.163.22.223'
&& $_SERVER['REMOTE_ADDR'] != '37.160.139.229'
&& substr($_SERVER['REMOTE_ADDR'], 0, 2) != '37') {
&& $_SERVER['REMOTE_ADDR'] != '78.226.56.137'
&& $_SERVER['REMOTE_ADDR'] != '88.163.22.223'
&& $_SERVER['REMOTE_ADDR'] != '37.160.139.229'
&& substr($_SERVER['REMOTE_ADDR'], 0, 2) != '37') {
$products_names = array();
foreach(Db::getInstance()->ExecuteS('