From 0e84b8211458c97aaa190e844080a8385c2ebc59 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Mon, 21 Aug 2017 11:44:27 +0200 Subject: [PATCH 1/3] remove company name for MR expe --- .../philea_magistor/script/send_commande.php | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/modules/philea_magistor/script/send_commande.php b/modules/philea_magistor/script/send_commande.php index da399ab5..c12c970b 100644 --- a/modules/philea_magistor/script/send_commande.php +++ b/modules/philea_magistor/script/send_commande.php @@ -247,7 +247,15 @@ if($magistorModule->active) { $data .= str_pad( '', 4, '0', STR_PAD_LEFT ); $data .= str_pad( $carrier_value , 50, ' ', STR_PAD_RIGHT );//$db->getValue('SELECT name FROM `'._DB_PREFIX_.'carrier` WHERE id_carrier = '.$order->id_carrier) $data .= str_pad( substr(utf8_decode(cleanChar($address_invoice->firstname.' '.$address_invoice->lastname)),0,50), 50, ' ', STR_PAD_RIGHT ); - $data .= str_pad( substr(utf8_decode(cleanChar($address_invoice->company)),0,50), 50, ' ', STR_PAD_RIGHT ); + if(in_array((int) $order->id_carrier, $carriers_mr) + && $delivery_info + && !in_array($delivery_info['dlv_mode'], array('LD1', 'LDS', 'HOM') + ) { + // no company name for a delivery in relay point + $data .= str_pad( '', 50, ' ', STR_PAD_RIGHT ); + } else { + $data .= str_pad( substr(utf8_decode(cleanChar($address_invoice->company)),0,50), 50, ' ', STR_PAD_RIGHT ); + } $data .= str_pad( substr(utf8_decode(cleanChar($address_invoice->address1)),0,50), 50, ' ', STR_PAD_RIGHT ); $data .= str_pad( substr(utf8_decode(cleanChar($address_invoice->address2)),0,50), 50, ' ', STR_PAD_RIGHT ); $data .= str_pad( substr(utf8_decode(cleanChar($address_invoice->other)),0,50), 50, ' ', STR_PAD_RIGHT ); @@ -273,6 +281,14 @@ if($magistorModule->active) { $data .= str_pad(substr(utf8_decode(cleanChar($address_delivery->lastname)), 0, 50), 50, ' ', STR_PAD_RIGHT); $data .= str_pad(substr(utf8_decode(cleanChar($address_invoice->firstname.' '.$address_invoice->lastname)), 0, 50), 50, ' ', STR_PAD_RIGHT); } + // LIVRAISON MR (NO DOMICILE) + elseif(in_array((int) $order->id_carrier, $carriers_mr) + && $delivery_info + && !in_array($delivery_info['dlv_mode'], array('LD1', 'LDS', 'HOM') + ) { + // no company name for a delivery in relay point + $data .= str_pad( '', 50, ' ', STR_PAD_RIGHT ); + } else { $data .= str_pad(substr(utf8_decode(cleanChar($address_delivery->firstname.' '.$address_delivery->lastname)), 0, 50), 50, ' ', STR_PAD_RIGHT); $data .= str_pad(substr(utf8_decode(cleanChar($address_delivery->company)), 0, 50), 50, ' ', STR_PAD_RIGHT); @@ -471,11 +487,11 @@ if($magistorModule->active) { NOW() ) '); - if (!empty($multi)) { - mail('marion@antadis.com', '[BBB] Philea - Send command with multi', 'multi : '.implode(',',$multi).' - file : '.$file); // log multi - } else { - mail('marion@antadis.com', '[BBB] Philea - Send command without multi', 'Pas de multi - file : '.$file); // log multi - } + // if (!empty($multi)) { + // mail('marion@antadis.com', '[BBB] Philea - Send command with multi', 'multi : '.implode(',',$multi).' - file : '.$file); // log multi + // } else { + // mail('marion@antadis.com', '[BBB] Philea - Send command without multi', 'Pas de multi - file : '.$file); // log multi + // } file_put_contents($fileName . '.DAT', "\xEF\xBB\xBF".utf8_encode($data)); file_put_contents($fileName . '.BAL', ''); From f36246257c00d2efee79697d22ddaf3754df3e88 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Mon, 21 Aug 2017 11:46:25 +0200 Subject: [PATCH 2/3] fix conflict --- modules/philea_magistor/script/send_commande.php | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/philea_magistor/script/send_commande.php b/modules/philea_magistor/script/send_commande.php index c12c970b..f0781954 100644 --- a/modules/philea_magistor/script/send_commande.php +++ b/modules/philea_magistor/script/send_commande.php @@ -286,6 +286,7 @@ if($magistorModule->active) { && $delivery_info && !in_array($delivery_info['dlv_mode'], array('LD1', 'LDS', 'HOM') ) { + $data .= str_pad(substr(utf8_decode(cleanChar($address_delivery->firstname.' '.$address_delivery->lastname)), 0, 50), 50, ' ', STR_PAD_RIGHT); // no company name for a delivery in relay point $data .= str_pad( '', 50, ' ', STR_PAD_RIGHT ); } From deebe9e91007dc6ee4fac7d1b8bcfd20c6a195a7 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Mon, 21 Aug 2017 12:05:51 +0200 Subject: [PATCH 3/3] fix sale delay --- modules/privatesales_delay/saledelay.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/privatesales_delay/saledelay.php b/modules/privatesales_delay/saledelay.php index 24cc2a72..17bb830e 100755 --- a/modules/privatesales_delay/saledelay.php +++ b/modules/privatesales_delay/saledelay.php @@ -70,6 +70,19 @@ if (!class_exists('SaleDelay')) { } else { $delivery_date[$delay]['date_end'] = self::getDateWithDelay((int) $delivery_date[$delay]['value_max'], $date_calcul, $include_we); } + + if ($delay != 5) { + $diff = (int)$delivery_date[$delay]['value_max'] - (int)$delivery_date[$delay]['value']; + $interval = $delivery_date[$delay]['date_end']->diff($delivery_date[$delay]['date_start']); + if((int)$diff != (int)$interval->format('%a')){ + $day_to_add = (int)$diff - (int)$interval->format('%a'); + if($day_to_add>1){ + $delivery_date[$delay]['date_end'] = $delivery_date[$delay]['date_end']->modify('+'.$day_to_add.' days'); + }else{ + $delivery_date[$delay]['date_end'] = $delivery_date[$delay]['date_end']->modify('+'.$day_to_add.' day'); + } + } + } } } return $delivery_date;