Merge branch 'ticket-11985-MRDeliveryAddress' into develop

This commit is contained in:
Marion Muszynski 2017-07-07 12:38:40 +02:00
commit 827aac76dc
3 changed files with 54 additions and 13 deletions

View File

@ -33,18 +33,20 @@ if($address) {
WHERE `direction` = "'.pSQL(sprintf('%05d', (int) ((string) substr($num, -5)))).'"
AND `prpay` = "'.pSQL($address['MR_Selected_Pays']).'"
');
Db::getInstance()->Execute('
UPDATE `'._DB_PREFIX_.'mr_selected`
SET `MR_Selected_Num` = "'.pSQL($num).'",
`MR_Selected_LgAdr1` = "'.pSQL(trim($rel['colnom'])).'",
`MR_Selected_LgAdr2` = "'.pSQL(trim($rel['colbat'])).'",
`MR_Selected_LgAdr3` = "'.pSQL(trim($rel['colrue'])).'",
`MR_Selected_LgAdr4` = "'.pSQL(trim($rel['coldit'])).'",
`MR_Selected_CP` = "'.pSQL(trim($rel['codpos'])).'",
`MR_Selected_Ville` = "'.pSQL(trim($rel['libbp'])).'",
`MR_Selected_Pays` = "'.pSQL(trim($rel['prpay'])).'"
WHERE `id_cart` = '.(int) Tools::getValue('id_cart').'
');
if($rel) {
Db::getInstance()->Execute('
UPDATE `'._DB_PREFIX_.'mr_selected`
SET `MR_Selected_Num` = "'.pSQL($num).'",
`MR_Selected_LgAdr1` = "'.pSQL(trim($rel['colnom'])).'",
`MR_Selected_LgAdr2` = "'.pSQL(trim($rel['colbat'])).'",
`MR_Selected_LgAdr3` = "'.pSQL(trim($rel['colrue'])).'",
`MR_Selected_LgAdr4` = "'.pSQL(trim($rel['coldit'])).'",
`MR_Selected_CP` = "'.pSQL(trim($rel['codpos'])).'",
`MR_Selected_Ville` = "'.pSQL(trim($rel['libbp'])).'",
`MR_Selected_Pays` = "'.pSQL(trim($rel['prpay'])).'"
WHERE `id_cart` = '.(int) Tools::getValue('id_cart').'
');
}
}
}
$order = Db::getInstance()->getRow('

View File

@ -519,6 +519,45 @@ class PDFCore extends PDF_PageGroupCore
$addressType[$type]['addressObject'],
$addressType[$type]['addressFields']);
if($type == 'delivery') {
if((strpos(Db::getInstance()->getValue('
SELECT `name`
FROM `'._DB_PREFIX_.'carrier`
WHERE `id_carrier` = '.(int)$order->id_carrier
),'Mondial Relay') !== false) && ($mr_point = Db::getInstance()->getRow('
SELECT mr.*, c.`firstname`, c.`lastname`
FROM `'._DB_PREFIX_.'mr_selected` mr
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = mr.`id_customer`)
WHERE mr.`id_cart` = '.(int)$order->id_cart.'
AND mr.`id_order` = '.(int)$order->id.'
'))) {
$address_lines = array();
if (!empty($mr_point['MR_Selected_LgAdr2'])){
$address_lines[] = $mr_point['MR_Selected_LgAdr2'].'';
}
if (!empty($mr_point['MR_Selected_LgAdr3'])){
$address_lines[] = $mr_point['MR_Selected_LgAdr3'].'';
}
if (!empty($mr_point['MR_Selected_LgAdr4'])){
$address_lines[] = $mr_point['MR_Selected_LgAdr4'].'';
}
$addressType[$type]['addressFormatedValues'] = array(
'firstname' => $mr_point['firstname'],
'lastname' => $mr_point['lastname'],
'company' => trim($mr_point['MR_Selected_LgAdr1']),
'vat_number' => '',
'address1' => trim($address_lines[0]),
'address2' => trim($address_lines[1]),
'postcode' => trim($mr_point['MR_Selected_CP']),
'city' => trim($mr_point['MR_Selected_Ville']),
'Country:name' => trim($mr_point['MR_Selected_Pays']),
'phone' => '',
'phone_mobile' => '',
);
}
}
foreach ($addressType[$type]['addressFields'] as $line)
if (($patternsList = explode(' ', $line)))
{

View File

@ -1,6 +1,6 @@
<br />
<fieldset id="sf_panel" class="panel" style="width: 400px;">
{*$edit_url*}
{$edit_url}
<div class="float-left" style="width: 50%; float: left; text-align: center;">
<img src="{$mondialrelay_logo|escape:'htmlall':'UTF-8'}" alt="Mondial Relay"><br />
<br />