Set philea as first
This commit is contained in:
parent
6cdeaba17f
commit
65cec1825d
@ -274,7 +274,7 @@ class AdminLogistics extends AdminTab
|
||||
$order = new Order((int) $id_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];
|
||||
|
@ -130,6 +130,7 @@ if(($id_order = (int) Tools::getValue('id_order'))
|
||||
$link = new Link(2);
|
||||
$products = array();
|
||||
foreach($order->getProductsDetail() as $p) {
|
||||
// --- Get quantity sent
|
||||
// LaPoste
|
||||
$p['product_quantity_sent'] += (int) Db::getInstance()->getValue('
|
||||
SELECT IFNULL(SUM(`quantity`), 0)
|
||||
@ -214,8 +215,18 @@ if(($id_order = (int) Tools::getValue('id_order'))
|
||||
$p['location'] = isset($locations[(int) $p['product_id'].'-'.(int) $p['product_attribute_id']]) ?
|
||||
$locations[(int) $p['product_id'].'-'.(int) $p['product_attribute_id']]: '';
|
||||
|
||||
// Get Shipping Numbers
|
||||
// --- Get Shipping Numbers
|
||||
$shipping_numbers = array();
|
||||
// Philea
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT l.`shipping_number`
|
||||
FROM `'._DB_PREFIX_.'philea_parcel` l
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON (d.`id_order_detail` = l.`id_order_detail`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_history` h ON (h.`id_order` = d.`id_order`)
|
||||
WHERE h.`id_order` = '.(int) $order->id.'
|
||||
') as $row) {
|
||||
$shipping_numbers[] = '"'.pSQL($row['shipping_number']).'"';
|
||||
}
|
||||
// LaPoste
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT l.`shipping_number`
|
||||
@ -246,21 +257,11 @@ if(($id_order = (int) Tools::getValue('id_order'))
|
||||
') as $row) {
|
||||
$shipping_numbers[] = '"'.pSQL($row['shipping_number']).'"';
|
||||
}
|
||||
// Philea
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT l.`shipping_number`
|
||||
FROM `'._DB_PREFIX_.'philea_parcel` l
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON (d.`id_order_detail` = l.`id_order_detail`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_history` h ON (h.`id_order` = d.`id_order`)
|
||||
WHERE h.`id_order` = '.(int) $order->id.'
|
||||
') as $row) {
|
||||
$shipping_numbers[] = '"'.pSQL($row['shipping_number']).'"';
|
||||
}
|
||||
|
||||
if(((int) $p['product_quantity_sent'] === 0) && Db::getInstance()->getRow('
|
||||
SELECT h.`id_sale`
|
||||
FROM `'._DB_PREFIX_.'shipping_history` h
|
||||
WHERE h.`id_sale` = '.((int) $p['id_sale'] === 999999? 0: (int) $p['id_sale']).'
|
||||
WHERE h.`id_sale` = '.((int) $p['id_sale'] === 999999 ? 0: (int) $p['id_sale']).'
|
||||
AND h.`id_order` = '.(int) $order->id.'
|
||||
'.(count($shipping_numbers) > 0? 'AND h.`shipping_number` NOT IN ('.implode(', ', $shipping_numbers).')': '').'
|
||||
')) {
|
||||
@ -288,8 +289,24 @@ if(($id_order = (int) Tools::getValue('id_order'))
|
||||
if(count($id_order_details) > 0) {
|
||||
$logs = array();
|
||||
|
||||
// Send by PHILEA
|
||||
if ($l = Db::getInstance()->ExecuteS('
|
||||
SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`, "Philea" as firstname,
|
||||
(CASE c.`external_module_name` WHEN "soflexibilite" THEN "laposte" ELSE c.`external_module_name` END) as carrier,
|
||||
"1" as philea
|
||||
FROM `'._DB_PREFIX_.'philea_parcel` l
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON d.`id_order_detail` = l.`id_order_detail`
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = d.`id_order`
|
||||
LEFT JOIN `'._DB_PREFIX_.'carrier` c ON c.`id_carrier` = o.`id_carrier`
|
||||
WHERE l.`id_order_detail` IN ('.implode(', ', $id_order_details).')
|
||||
AND l.`quantity` > 0
|
||||
ORDER BY l.`date_add` DESC
|
||||
')) {
|
||||
$logs = array_merge($logs, $l);
|
||||
}
|
||||
|
||||
// Send by LAPOSTE
|
||||
if($l = Db::getInstance()->ExecuteS('
|
||||
if ($l = Db::getInstance()->ExecuteS('
|
||||
SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`,
|
||||
e.`firstname`, e.`lastname`, "laposte" as carrier, "0" as philea
|
||||
FROM `'._DB_PREFIX_.'lapostews` l
|
||||
@ -304,7 +321,7 @@ if(($id_order = (int) Tools::getValue('id_order'))
|
||||
}
|
||||
|
||||
// Send by EXAPAQ
|
||||
if($l = Db::getInstance()->ExecuteS('
|
||||
if ($l = Db::getInstance()->ExecuteS('
|
||||
SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`,
|
||||
e.`firstname`, e.`lastname`, "exapaq" as carrier, "0" as philea
|
||||
FROM `'._DB_PREFIX_.'exapaqws` l
|
||||
@ -319,7 +336,7 @@ if(($id_order = (int) Tools::getValue('id_order'))
|
||||
}
|
||||
|
||||
// Send by MONDIAL RELAY
|
||||
if($l = Db::getInstance()->ExecuteS('
|
||||
if ($l = Db::getInstance()->ExecuteS('
|
||||
SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`,
|
||||
e.`firstname`, e.`lastname`, "mondialrelay" as carrier, "0" as philea
|
||||
FROM `'._DB_PREFIX_.'mondialrelay_parcel` l
|
||||
@ -334,7 +351,7 @@ if(($id_order = (int) Tools::getValue('id_order'))
|
||||
}
|
||||
|
||||
// Send by DROPSHIPPING
|
||||
if($l = Db::getInstance()->ExecuteS('
|
||||
if ($l = Db::getInstance()->ExecuteS('
|
||||
SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`,
|
||||
"Dropshipping" as firstname, "0" as philea
|
||||
FROM `'._DB_PREFIX_.'ant_dropshipping_parcel` l
|
||||
@ -346,22 +363,7 @@ if(($id_order = (int) Tools::getValue('id_order'))
|
||||
')) {
|
||||
$logs = array_merge($logs, $l);
|
||||
}
|
||||
|
||||
// Send by PHILEA
|
||||
if($l = Db::getInstance()->ExecuteS('
|
||||
SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`, "Philea" as firstname,
|
||||
(CASE c.`external_module_name` WHEN "soflexibilite" THEN "laposte" ELSE c.`external_module_name` END) as carrier,
|
||||
"1" as philea
|
||||
FROM `'._DB_PREFIX_.'philea_parcel` l
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON d.`id_order_detail` = l.`id_order_detail`
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = d.`id_order`
|
||||
LEFT JOIN `'._DB_PREFIX_.'carrier` c ON c.`id_carrier` = o.`id_carrier`
|
||||
WHERE l.`id_order_detail` IN ('.implode(', ', $id_order_details).')
|
||||
AND l.`quantity` > 0
|
||||
ORDER BY l.`date_add` DESC
|
||||
')) {
|
||||
$logs = array_merge($logs, $l);
|
||||
}
|
||||
|
||||
} else {
|
||||
$logs = array();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user