update special char replace in ws for label

This commit is contained in:
Marion Muszynski 2016-05-18 12:14:17 +02:00
parent 8a91954f1e
commit a8e7c0c14a

View File

@ -176,20 +176,36 @@ class Parcel {
}
$dst_address_ws->country = (string) mb_substr($dst_country->name[$cookie->id_lang], 0, 32);
if(Module::isInstalled('socolissimo') && ($so_data = Db::getInstance()->getRow('
if((Module::isInstalled('socolissimo') || Module::isInstalled('soflexibilite')) && ($so_data = Db::getInstance()->getRow('
SELECT *
FROM `'._DB_PREFIX_.'socolissimo_delivery_info`
WHERE `id_cart` = '.(int) $this->order->id_cart.'
AND `id_customer` = '.(int) $this->order->id_customer.'
'))) {
$unicode_0 = json_decode('"\u0006"');
$unicode_1 = json_decode('"\u200b"');
$unicode_2 = json_decode('"\u00ad"');
$dst_address_ws->email = $so_data['ceemail'];
$dst_address_ws->Name = mb_substr($so_data['prfirstname'], 0, 32);
$dst_address_ws->Surname = mb_substr($so_data['prname'], 0, 32);
$dst_address_ws->Name = str_replace(
array('Á', '°', 'º', 'º', 'º', 'ª', "\t", "\n", "\r", ' ', '', '', $unicode_0, $unicode_1, $unicode_2,),
array('A', '', '', '', '', 'a', ' ', ' ', ' ', ' ', '-', '', '', '', '',),
mb_substr($so_data['prfirstname'], 0, 32)
);
$dst_address_ws->Surname = str_replace(
array('Á', '°', 'º', 'º', 'º', 'ª', "\t", "\n", "\r", ' ', '', '', $unicode_0, $unicode_1, $unicode_2,),
array('A', '', '', '', '', 'a', ' ', ' ', ' ', ' ', '-', '', '', '', '',),
mb_substr($so_data['prname'], 0, 32)
);
$address_lines = array();
for($i = 1; $i < 5; $i++) {
if(($line = (string) mb_substr($so_data['pradress'.$i], 0, 32)) != '') {
$address_lines[] = trim($line);
$address_lines[] = str_replace(
array('Á', '°', 'º', 'º', 'º', 'ª', "\t", "\n", "\r", ' ', '', '', $unicode_0, $unicode_1, $unicode_2,),
array('A', '', '', '', '', 'a', ' ', ' ', ' ', ' ', '-', '', '', '', '',),
trim($line)
);
}
}
@ -229,7 +245,11 @@ class Parcel {
$dst_address_ws->DoorCode2 = $doorcode;
}
$this->letter->parcel->Instructions = str_replace(array('°', "\n", "\r"), '', (string) $so_data['cedeliveryinformation']);
$this->letter->parcel->Instructions = $address_lines[] = str_replace(
array('Á', '°', 'º', 'º', 'º', 'ª', "\t", "\n", "\r", ' ', '', '', $unicode_0, $unicode_1, $unicode_2,),
array('A', '', '', '', '', 'a', ' ', ' ', ' ', ' ', '-', '', '', '', '',),
(string) $so_data['cedeliveryinformation']
);
$this->letter->parcel->DeliveryMode = (string) $so_data['delivery_mode'];
if(!in_array($this->letter->parcel->DeliveryMode, array('DOM', 'DOS', 'RDV'))) {
$this->letter->parcel->RegateCode = $so_data['prid']; //(string) ltrim($so_data['prid'], '0');