Merge branch 'ticket-11985-MondialRelay_part2' into develop
This commit is contained in:
commit
161a2dbc5b
@ -273,16 +273,18 @@ class MondialrelayCarrier {
|
||||
}
|
||||
|
||||
$delivery_infos = Db::getInstance()->getRow('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'mr_selected`
|
||||
WHERE `id_order` = '.(int) $order->id.'
|
||||
SELECT s.*, m.`dlv_mode`
|
||||
FROM `'._DB_PREFIX_.'mr_selected` s
|
||||
LEFT JOIN `'._DB_PREFIX_.'mr_method` m ON s.`id_method` = m.`id_mr_method`
|
||||
WHERE s.`id_order` = '.(int) $order->id.'
|
||||
');
|
||||
|
||||
// Hack 5 numbers relay num
|
||||
if (isset($delivery_infos['MR_Selected_Num']) && $delivery_infos['MR_Selected_Num'])
|
||||
$delivery_infos['MR_Selected_Num'] = substr($delivery_infos['MR_Selected_Num'], -5);
|
||||
|
||||
if(!$delivery_infos) {
|
||||
if(!$delivery_infos || in_array($delivery_infos['dlv_mode'], array('LDS', 'LD1', 'HOM'))) {
|
||||
$mode = $delivery_infos? $delivery_infos['dlv_mode']: 'LD1';
|
||||
$shipping = array(
|
||||
$delivery_address->firstname.' '.$delivery_address->lastname,
|
||||
$delivery_address->company,
|
||||
@ -303,42 +305,39 @@ class MondialrelayCarrier {
|
||||
AND `direction` = "'.pSQL($delivery_infos['MR_Selected_Num']).'"
|
||||
AND `prpay` = "'.pSQL($delivery_infos['MR_Selected_Pays']).'"
|
||||
');
|
||||
|
||||
$mode = $delivery_infos['id_method'] == 0? 'LD1': '24R';
|
||||
|
||||
if ($mode == 'LD1'){
|
||||
$shipping = array(
|
||||
$delivery_address->firstname.' '.$delivery_address->lastname,
|
||||
$mr_relais['colnom'],
|
||||
$mr_relais['colbat'],
|
||||
$mr_relais['colrue'],
|
||||
$mr_relais['coldit'],
|
||||
$mr_relais['codpos'],
|
||||
$mr_relais['libbp'],
|
||||
empty($delivery_address->phone)? $delivery_address->phone_mobile: $delivery_address->phone,
|
||||
'',
|
||||
);
|
||||
$mode = $delivery_infos['dlv_mode'];
|
||||
if($mode == '24R') {
|
||||
if($mr_relais['narel'] == 'F') {
|
||||
$mode = '24X';
|
||||
} elseif($mr_relais['narel'] == 'E') {
|
||||
$mode = '24L';
|
||||
} else {
|
||||
$mode = '24R';
|
||||
}
|
||||
}
|
||||
else{ // 24R
|
||||
$shipping = array(
|
||||
$delivery_address->firstname.' '.$delivery_address->lastname,
|
||||
$mr_relais['colnom'],
|
||||
$mr_relais['colbat'],
|
||||
$mr_relais['colrue'],
|
||||
$mr_relais['coldit'],
|
||||
$mr_relais['codpos'],
|
||||
$mr_relais['libbp'],
|
||||
empty($delivery_address->phone)? $delivery_address->phone_mobile: $delivery_address->phone,
|
||||
'',
|
||||
);
|
||||
}
|
||||
|
||||
$shipping = array(
|
||||
$delivery_address->firstname.' '.$delivery_address->lastname,
|
||||
$mr_relais['colnom'],
|
||||
$mr_relais['colbat'],
|
||||
str_replace(' AVENUE D', ' AV. D', str_replace(' GENERAL LECLERC', ' GAL LECLERC', $mr_relais['colrue'])),
|
||||
$mr_relais['coldit'],
|
||||
$mr_relais['codpos'],
|
||||
$mr_relais['libbp'],
|
||||
empty($delivery_address->phone_mobile)? $delivery_address->phone: $delivery_address->phone_mobile,
|
||||
'',
|
||||
);
|
||||
$dest_country = (int) Db::getInstance()->getValue('
|
||||
SELECT `id_country`
|
||||
FROM `'._DB_PREFIX_.'country`
|
||||
WHERE `iso_code` = "'.pSQL($delivery_infos['MR_Selected_Pays']).'"
|
||||
');
|
||||
}
|
||||
|
||||
if(mb_strlen($shipping[2]) > 22 && $shipping[3] == '') {
|
||||
$shipping[3] = mb_substr($shipping[2], 22, 22);
|
||||
$shipping[2] = mb_substr($shipping[2], 0, 22);
|
||||
}
|
||||
|
||||
$format = str_replace(
|
||||
array(
|
||||
'{SHIPPING_NUMBER_C25I}',
|
||||
@ -474,7 +473,7 @@ class MondialrelayCarrier {
|
||||
$delivery_infos['MR_Selected_Num'] = substr($delivery_infos['MR_Selected_Num'], -5);
|
||||
}
|
||||
|
||||
if(!$delivery_infos|| in_array($delivery_infos['dlv_mode'], array('LDS', 'LD1', 'HOM'))) {
|
||||
if(!$delivery_infos || in_array($delivery_infos['dlv_mode'], array('LDS', 'LD1', 'HOM'))) {
|
||||
$mode = $delivery_infos? $delivery_infos['dlv_mode']: 'LD1';
|
||||
|
||||
$address = Db::getInstance()->getRow('
|
||||
|
Loading…
Reference in New Issue
Block a user