Merge branch 'ticket-13942-fixDeliveryDelay' into develop
This commit is contained in:
commit
aca897dd80
@ -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,15 @@ 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')
|
||||
) {
|
||||
$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 );
|
||||
}
|
||||
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);
|
||||
@ -472,11 +489,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', '');
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user