show mr delivery address on invoice pdf

This commit is contained in:
Marion Muszynski 2017-07-07 12:15:20 +02:00
parent 71936e370d
commit dfe25a8005

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)))
{