Merge branch 'ticket-14739-PackLogistic'
This commit is contained in:
commit
3851c2e70f
@ -623,7 +623,8 @@ $laposte_formats = array(
|
||||
);
|
||||
|
||||
|
||||
class LaposteCarrier {
|
||||
class LaposteCarrier
|
||||
{
|
||||
public $displayName = 'La Poste';
|
||||
|
||||
public function l($string, $specific = false, $id_lang = null) {
|
||||
@ -658,7 +659,8 @@ class LaposteCarrier {
|
||||
);
|
||||
}
|
||||
|
||||
public function registerParcel($order, $products, $weight) {
|
||||
public function registerParcel($order, $products, $weight)
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$html = '';
|
||||
@ -734,7 +736,8 @@ class LaposteCarrier {
|
||||
return array($html, $result);
|
||||
}
|
||||
|
||||
public function renderLabel($order, $weight, $shipping_data) {
|
||||
public function renderLabel($order, $weight, $shipping_data)
|
||||
{
|
||||
global $cookie, $laposte_formats;
|
||||
|
||||
/**
|
||||
@ -1548,58 +1551,126 @@ class LaposteCarrier {
|
||||
$history = new OrderHistory();
|
||||
$history->id_order = (int) $order->id;
|
||||
|
||||
$fully_sent = TRUE;
|
||||
$fully_sent = FALSE;
|
||||
$products_sent = array();
|
||||
$to_send = array();
|
||||
$shipping_numbers = array();
|
||||
|
||||
$order_details = array();
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT `id_order_detail`
|
||||
FROM `'._DB_PREFIX_.'order_detail`
|
||||
WHERE `id_order` = '.(int) $order->id.'
|
||||
') as $row) {
|
||||
$order_details[] = (int) $row['id_order_detail'];
|
||||
}
|
||||
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT d.`id_order_detail`, IF(
|
||||
(d.`product_quantity` - IF(
|
||||
d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded`
|
||||
) - IFNULL(SUM(s.`quantity`), 0)) > 0, 1, 0
|
||||
) AS `remain`, s.`shipping_number`
|
||||
) AS `remain`
|
||||
FROM `'._DB_PREFIX_.'order_detail` d
|
||||
LEFT OUTER JOIN `'._DB_PREFIX_.'lapostews` s
|
||||
ON s.`id_order_detail` = d.`id_order_detail`
|
||||
WHERE d.`id_order` = '.(int) $order->id.'
|
||||
GROUP BY d.`id_order_detail`
|
||||
') as $quantity_remain) {
|
||||
if($quantity_remain['shipping_number']) {
|
||||
$shipping_numbers[] = pSQL($quantity_remain['shipping_number']);
|
||||
}
|
||||
if((int) $quantity_remain['remain'] > 0) {
|
||||
$fully_sent = FALSE;
|
||||
$to_send[] = (int) $quantity_remain['id_order_detail'];
|
||||
if((int) $quantity_remain['remain'] == 0) {
|
||||
$products_sent[] = (int) $quantity_remain['id_order_detail'];
|
||||
}
|
||||
}
|
||||
|
||||
$_to_send = array();
|
||||
foreach($to_send as $p) {
|
||||
$id_sale = (int) Db::getInstance()->getValue('
|
||||
SELECT `id_sale`
|
||||
FROM `'._DB_PREFIX_.'product_ps_cache`
|
||||
WHERE `id_product` = (
|
||||
SELECT `product_id`
|
||||
FROM `'._DB_PREFIX_.'order_detail`
|
||||
WHERE `id_order` = '.(int) $order->id.'
|
||||
AND `id_order_detail` = '.(int) $p.'
|
||||
)
|
||||
');
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT d.`id_order_detail`, IF(
|
||||
(d.`product_quantity` - IF(
|
||||
d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded`
|
||||
) - IFNULL(SUM(s.`quantity`), 0)) > 0, 1, 0
|
||||
) AS `remain`
|
||||
FROM `'._DB_PREFIX_.'order_detail` d
|
||||
LEFT OUTER JOIN `'._DB_PREFIX_.'exapaqws` s
|
||||
ON s.`id_order_detail` = d.`id_order_detail`
|
||||
WHERE d.`id_order` = '.(int) $order->id.'
|
||||
GROUP BY d.`id_order_detail`
|
||||
') as $quantity_remain) {
|
||||
if((int) $quantity_remain['remain'] == 0) {
|
||||
$products_sent[] = (int) $quantity_remain['id_order_detail'];
|
||||
}
|
||||
}
|
||||
|
||||
if(!Db::getInstance()->getValue('
|
||||
SELECT `id_order`
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT d.`id_order_detail`, IF(
|
||||
(d.`product_quantity` - IF(
|
||||
d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded`
|
||||
) - IFNULL(SUM(s.`quantity`), 0)) > 0, 1, 0
|
||||
) AS `remain`
|
||||
FROM `'._DB_PREFIX_.'order_detail` d
|
||||
LEFT OUTER JOIN `'._DB_PREFIX_.'mondialrelay_parcel` s
|
||||
ON s.`id_order_detail` = d.`id_order_detail`
|
||||
WHERE d.`id_order` = '.(int) $order->id.'
|
||||
GROUP BY d.`id_order_detail`
|
||||
') as $quantity_remain) {
|
||||
if((int) $quantity_remain['remain'] == 0) {
|
||||
$products_sent[] = (int) $quantity_remain['id_order_detail'];
|
||||
}
|
||||
}
|
||||
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT d.`id_order_detail`, IF(
|
||||
(d.`product_quantity` - IF(
|
||||
d.`product_quantity_return` > 0, d.`product_quantity_return`, d.`product_quantity_refunded`
|
||||
) - IFNULL(SUM(s.`quantity`), 0)) > 0, 1, 0
|
||||
) AS `remain`
|
||||
FROM `'._DB_PREFIX_.'order_detail` d
|
||||
LEFT OUTER JOIN `'._DB_PREFIX_.'philea_parcel` s
|
||||
ON s.`id_order_detail` = d.`id_order_detail`
|
||||
WHERE d.`id_order` = '.(int) $order->id.'
|
||||
GROUP BY d.`id_order_detail`
|
||||
') as $quantity_remain) {
|
||||
if((int) $quantity_remain['remain'] == 0) {
|
||||
$products_sent[] = (int) $quantity_remain['id_order_detail'];
|
||||
}
|
||||
}
|
||||
|
||||
$remaining = array();
|
||||
foreach($order_details as $d) {
|
||||
if(!in_array($d, $products_sent)) {
|
||||
$remaining[] = (int) $d;
|
||||
}
|
||||
}
|
||||
|
||||
if(count($remaining) == 0) {
|
||||
$fully_sent = TRUE;
|
||||
} else {
|
||||
$id_sales = array();
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT DISTINCT c.`id_sale`
|
||||
FROM `'._DB_PREFIX_.'product_ps_cache` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` d
|
||||
ON c.`id_product` = d.`product_id`
|
||||
WHERE d.`id_order_detail` IN ('.implode(', ', $remaining).')
|
||||
') as $row) {
|
||||
$id_sales[] = (int) $row['id_sale'];
|
||||
}
|
||||
|
||||
$sent_sales = array();
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT DISTINCT `id_sale`
|
||||
FROM `'._DB_PREFIX_.'shipping_history`
|
||||
WHERE `id_order` = '.(int) $order->id.'
|
||||
AND `id_sale` = '.(int) $id_sale.'
|
||||
AND `shipping_number` NOT IN ("'.implode('", "', $shipping_numbers).'")
|
||||
')) {
|
||||
$_to_send[] = $p;
|
||||
AND `id_sale` IN ('.implode(', ', $id_sales).')
|
||||
') as $row) {
|
||||
$sent_sales[] = (int) $row['id_sale'];
|
||||
}
|
||||
}
|
||||
|
||||
if(count($_to_send) === 0) {
|
||||
$fully_sent = TRUE;
|
||||
$remaining = array();
|
||||
foreach($id_sales as $s) {
|
||||
if(!in_array($s, $sent_sales)) {
|
||||
$remaining[] = (int) $s;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$fully_sent = (count($remaining) == 0);
|
||||
}
|
||||
|
||||
//mail('perron@antadis.com', 'test logistics', (int) $order->id);
|
||||
|
@ -382,14 +382,18 @@ class Parcel {
|
||||
'exp_phone' => Configuration::get('LAPOSTEWS_EXP_PHONE'),
|
||||
);
|
||||
|
||||
$c = new SoapClient(
|
||||
'https://ws.colissimo.fr/sls-ws/SlsServiceWS?wsdl',
|
||||
array(
|
||||
'trace' => 0,
|
||||
'exceptions' => 1,
|
||||
'cache_wsdl' => 0? WSDL_CACHE_MEMORY: WSDL_CACHE_NONE,
|
||||
)
|
||||
);
|
||||
$c = false;
|
||||
try {
|
||||
$c = new SoapClient(
|
||||
'https://ws.colissimo.fr/sls-ws/SlsServiceWS?wsdl',
|
||||
array(
|
||||
'trace' => 0,
|
||||
'exceptions' => 1,
|
||||
'cache_wsdl' => 0 ? WSDL_CACHE_MEMORY: WSDL_CACHE_NONE,
|
||||
)
|
||||
);
|
||||
} catch (Exception $e) {}
|
||||
|
||||
try {
|
||||
$exp_country = new Country((int) $carrier_config['exp_country']);
|
||||
if(in_array($exp_country->iso_code, array('GP', 'RE', 'MQ', 'YT', 'NC', 'PM', 'GF'))) {
|
||||
|
1653
modules/ant_logistic/wsdl/SlsServiceWS.wsdl
Normal file
1653
modules/ant_logistic/wsdl/SlsServiceWS.wsdl
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user