fix conflicts

This commit is contained in:
Marion Muszynski 2017-01-27 13:09:02 +01:00
commit 877fab90a7
6 changed files with 147 additions and 31 deletions

View File

@ -51,7 +51,7 @@ if (isset($_GET['getSales'])){
$export = true;
foreach($sales as $key => $sale) {
$delay = SaleDelay::getDelay($sale->delivery_delay,2);
$delay = SaleDelay::getDelaySmallName($sale->delivery_delay,2);
echo '<tr id="item_'.$sale->id. '">
<td>'.$sale->id.'</td>
<td>'.$sale->id_category.'</td>
@ -73,7 +73,7 @@ if (isset($_GET['getSales'])){
echo '<td>'.((int) $sale->id_employee != 0? $employees[(int) $sale->id_employee]: '--').'</td>
<td '.(in_array('fr', $sale->versions) ? 'class="green"' : 'class="red"').'>FR</td>
<td '.(in_array('es', $sale->versions) ? 'class="green"' : 'class="red"').'>ES</td>
<td>'.$delay['name'].'</td>
<td>'.$delay.'</td>
<td class="position">';
if($key != 0){
echo '<a href="" class="updatePosition" data-way="0" data-position='. $sale->position .'><img title="Haut" alt="Haut" src="../img/admin/up.gif"></a>';

View File

@ -8,8 +8,10 @@
{/if}
</h4>
<ul class="block_content bullet">
{foreach $blocklinkmulti2_links as $blocklinkmulti2_link name=blocklinkmulti2_links}
{foreach $blocklinkmulti2_links as $blocklinkmulti2_link key=link name=blocklinkmulti2_links}
{if $link != 4}
<li class="link_{$smarty.foreach.blocklinkmulti1_link.index}">{if $blocklinkmulti2_link.$url_link!=''}<a href="{$blocklinkmulti2_link.$url_link|htmlentities}"{if $blocklinkmulti2_link.newWindow} onclick="window.open(this.href);return false;"{/if}><span>{$blocklinkmulti2_link.$lang}</span></a>{else}<span>{$blocklinkmulti2_link.$lang}</span>{/if}</li>
{/if}
{/foreach}
</ul>
</div>

View File

@ -152,6 +152,9 @@ class Parcel {
if($this->product_type == 'BOM') {
$this->product_type = 'DOM';
}
if(!in_array($so_data['cecountry'], array('BE', 'AD', 'MC', 'FR', 'GP', 'RE', 'MQ', 'YT', 'NC', 'PM', 'GF'))) {
$this->product_type = 'DOS';
}
$this->dst_address['email'] = $so_data['ceemail'];
if(empty($this->dst_address['email'])) {
@ -159,15 +162,15 @@ class Parcel {
}
if(!empty($so_data['cename'])) {
$this->dst_address['lastName'] = mb_substr($so_data['cename'], 0, 35);
$this->dst_address['lastName'] = mb_substr(str_replace(array('°', 'º', 'º', 'º', 'ª', 'ā','ª','Á','ł','İ'), array(' ', '', '', '', 'a', 'a','a','A','l','i'), $so_data['cename']), 0, 35);
} else {
$this->dst_address['lastName'] = mb_substr($so_data['prname'], 0, 35);
$this->dst_address['lastName'] = mb_substr(str_replace(array('°', 'º', 'º', 'º', 'ª', 'ā','ª','Á','ł','İ'), array(' ', '', '', '', 'a', 'a','a','A','l','i'), $so_data['prname']), 0, 35);
}
if(!empty($so_data['cefirstname'])) {
$this->dst_address['firstName'] = mb_substr(str_replace('', ' ', $so_data['cefirstname']), 0, 29);
$this->dst_address['firstName'] = mb_substr(str_replace(array('°', 'º', 'º', 'º', 'ª', 'ā','ª','Á','ł','','İ'), array(' ', '', '', '', 'a', 'a','a','A','l',' ','i'), $so_data['cefirstname']), 0, 29);
} else {
$this->dst_address['firstName'] = mb_substr(str_replace('', ' ', $so_data['prfirstname']), 0, 29);
$this->dst_address['firstName'] = mb_substr(str_replace(array('°', 'º', 'º', 'º', 'ª', 'ā','ª','Á','ł','','İ'), array(' ', '', '', '', 'a', 'a','a','A','l',' ','i'), $so_data['prfirstname']), 0, 29);
}
$address_lines = array();
@ -178,19 +181,19 @@ class Parcel {
}
if(count($address_lines) == 1) {
$this->dst_address['line2'] = str_replace(array('º', 'º', 'º', 'ª',), array('', '', '', 'a'), $address_lines[0]);
$this->dst_address['line2'] = str_replace(array('°', 'º', 'º', 'º', 'ª', 'ā','ª'), array(' ', '', '', '', 'a', 'a','a'), $address_lines[0]);
} elseif(count($address_lines) == 2) {
$this->dst_address['line2'] = str_replace(array('º', 'º', 'º', 'ª',), array('', '', '', 'a'), $address_lines[0]);
$this->dst_address['line3'] = str_replace(array('º', 'º', 'º', 'ª',), array('', '', '', 'a'), $address_lines[1]);
$this->dst_address['line2'] = str_replace(array('°', 'º', 'º', 'º', 'ª', 'ā','ª'), array(' ', '', '', '', 'a', 'a','a'), $address_lines[0]);
$this->dst_address['line3'] = str_replace(array('°', 'º', 'º', 'º', 'ª', 'ā','ª'), array(' ', '', '', '', 'a', 'a','a'), $address_lines[1]);
} elseif(count($address_lines) == 3) {
$this->dst_address['line0'] = str_replace(array('º', 'º', 'º', 'ª',), array('', '', '', 'a'), $address_lines[0]);
$this->dst_address['line2'] = str_replace(array('º', 'º', 'º', 'ª',), array('', '', '', 'a'), $address_lines[1]);
$this->dst_address['line3'] = str_replace(array('º', 'º', 'º', 'ª',), array('', '', '', 'a'), $address_lines[2]);
$this->dst_address['line0'] = str_replace(array('°', 'º', 'º', 'º', 'ª', 'ā','ª'), array(' ', '', '', '', 'a', 'a','a'), $address_lines[0]);
$this->dst_address['line2'] = str_replace(array('°', 'º', 'º', 'º', 'ª', 'ā','ª'), array(' ', '', '', '', 'a', 'a','a'), $address_lines[1]);
$this->dst_address['line3'] = str_replace(array('°', 'º', 'º', 'º', 'ª', 'ā','ª'), array(' ', '', '', '', 'a', 'a','a'), $address_lines[2]);
} else {
$this->dst_address['line0'] = str_replace(array('º', 'º', 'º', 'ª',), array('', '', '', 'a'), $address_lines[0]);
$this->dst_address['line1'] = str_replace(array('º', 'º', 'º', 'ª',), array('', '', '', 'a'), $address_lines[1]);
$this->dst_address['line2'] = str_replace(array('º', 'º', 'º', 'ª',), array('', '', '', 'a'), $address_lines[2]);
$this->dst_address['line3'] = str_replace(array('º', 'º', 'º', 'ª',), array('', '', '', 'a'), $address_lines[3]);
$this->dst_address['line0'] = str_replace(array('°', 'º', 'º', 'º', 'ª', 'ā','ª'), array(' ', '', '', '', 'a', 'a','a'), $address_lines[0]);
$this->dst_address['line1'] = str_replace(array('°', 'º', 'º', 'º', 'ª', 'ā','ª'), array(' ', '', '', '', 'a', 'a','a'), $address_lines[1]);
$this->dst_address['line2'] = str_replace(array('°', 'º', 'º', 'º', 'ª', 'ā','ª'), array(' ', '', '', '', 'a', 'a','a'), $address_lines[2]);
$this->dst_address['line3'] = str_replace(array('°', 'º', 'º', 'º', 'ª', 'ā','ª'), array(' ', '', '', '', 'a', 'a','a'), $address_lines[3]);
}
$this->dst_address['countryCode'] = $so_data['cecountry'];
@ -201,14 +204,30 @@ class Parcel {
$this->dst_address['zipCode'] = (string) mb_substr($so_data['przipcode'], 0, 5);
}
$this->dst_address['city'] = (string) mb_substr($so_data['prtown'], 0, 35);
$this->dst_address['mobileNumber'] = (string) mb_substr($so_data['cephonenumber'], 0, 32);
$this->dst_address['mobileNumber'] = (string) mb_substr(str_replace(array('.','°', '|', ' ', '’',"/"),'',$so_data['cephonenumber']), 0, 32);
if(strlen($this->dst_address['mobileNumber']) > 10) {
if(preg_match('/^(0033|\+33|33)[0-9]{9,10}$/', $this->dst_address['mobileNumber'])) {
$this->dst_address['mobileNumber'] = '0'.mb_substr(mb_substr($this->dst_address['mobileNumber'], -10), 1);
}
if(strtolower($so_data['cecountry']) == 'be' && preg_match('/^(0032|32)[0-9]{9,10}$/', $this->dst_address['mobileNumber'])) {
$this->dst_address['mobileNumber'] = '+32'.mb_substr(mb_substr($this->dst_address['mobileNumber'], -10), 1);
}
} elseif(strtolower($so_data['cecountry']) == 'fr' && preg_match('/^[0-9]{9,10}$/', $this->dst_address['mobileNumber'])) {
if(strlen($this->dst_address['mobileNumber']) == 9) {
$this->dst_address['mobileNumber'] = '0'.$this->dst_address['mobileNumber'];
} elseif(strlen($this->dst_address['mobileNumber']) == 10) {
$this->dst_address['mobileNumber'] = '0'.mb_substr(mb_substr($this->dst_address['mobileNumber'], -10), 1);
}
} elseif(strtolower($so_data['cecountry']) == 'be' && preg_match('/^[0-9]{9,10}$/', $this->dst_address['mobileNumber'])) {
if(strlen($this->dst_address['mobileNumber']) == 9) {
$this->dst_address['mobileNumber'] = '+32'.$this->dst_address['mobileNumber'];
} elseif(strlen($this->dst_address['mobileNumber']) == 10) {
$this->dst_address['mobileNumber'] = '+32'.mb_substr(mb_substr($this->dst_address['mobileNumber'], -10), 1);
}
}
if(mb_substr($this->dst_address['mobileNumber'], 0, 2) != '06' && mb_substr($this->dst_address['mobileNumber'], 0, 2) != '07') {
if(strtolower($so_data['cecountry']) == 'fr' && mb_substr($this->dst_address['mobileNumber'], 0, 2) != '06' && mb_substr($this->dst_address['mobileNumber'], 0, 2) != '07') {
$this->dst_address['mobileNumber'] = '0600000000';
}
@ -222,9 +241,9 @@ class Parcel {
$this->instructions = trim(str_replace(array('°', '|', ' ', '’', "\n", "\r"), ' ', (string) $so_data['cedeliveryinformation']));
$this->prid = $so_data['prid'];
} else {
$this->dst_address['companyName'] = (string) mb_substr(str_replace(array('', $unicode_ack, $unicode_ack2), ' ', $dst_address->company), 0, 35);
$this->dst_address['lastName'] = (string) mb_substr(str_replace(array('', $unicode_ack, $unicode_ack2), ' ', $dst_address->firstname), 0, 35);
$this->dst_address['firstName'] = (string) mb_substr(strtoupper(str_replace(array('', $unicode_ack, $unicode_ack2), ' ', $dst_address->lastname)), 0, 29);
$this->dst_address['companyName'] = (string) mb_substr(str_replace(array('°', 'º', 'º', 'º', 'ª', 'ā','ª','Á','ł','',', $unicode_ack, $unicode_ack2), array(' ', '', '', '', 'a', 'a','a','A','l',' ','i',' ',' '), $dst_address->company), 0, 35);
$this->dst_address['lastName'] = (string) mb_substr(str_replace(array('°', 'º', 'º', 'º', 'ª', 'ā','ª','Á','ł','',', $unicode_ack, $unicode_ack2), array(' ', '', '', '', 'a', 'a','a','A','l',' ','i',' ',' '), $dst_address->firstname), 0, 35);
$this->dst_address['firstName'] = (string) mb_substr(strtoupper(str_replace(array('°', 'º', 'º', 'º', 'ª', 'ā','ª','Á','ł','',', $unicode_ack, $unicode_ack2), array(' ', '', '', '', 'a', 'a','a','A','l',' ','i',' ',' '), $dst_address->lastname)), 0, 29);
$this->dst_address['email'] = (string) $dst_customer->email;
if($dst_address->id_country == 193) {
$this->dst_address['zipCode'] = mb_substr((string) str_ireplace(array('SI-', 'SL-'), '', $dst_address->postcode), 0, 5);
@ -232,7 +251,7 @@ class Parcel {
$this->dst_address['zipCode'] = mb_substr((string) str_replace(array(' ', '-'), '', $dst_address->postcode), 0, 5);
}
$this->dst_address['city'] = (string) mb_substr(strtoupper($dst_address->city), 0, 35);
if(in_array($dst_country->iso_code, array('MO', 'GP', 'RE', 'MQ', 'YT', 'NC', 'PM', 'GF'))) {
if(in_array($dst_country->iso_code, array('GP', 'RE', 'MQ', 'YT', 'NC', 'PM', 'GF'))) {
$this->dst_address['countryCode'] = 'FR';
} else {
$this->dst_address['countryCode'] = (string) $dst_country->iso_code;
@ -241,7 +260,10 @@ class Parcel {
$this->dst_address['line3'] = str_replace(array('º', 'º', 'º', 'ª',), array('', '', '', 'a'), (string) $dst_address->address2);
$this->instructions = trim(str_replace(array('°', '|', ' ', '’', "\n", "\r"), ' ', (string) $dst_address->other));
if(in_array($dst_country->iso_code, array('FR', 'AD', 'MO', 'GP', 'RE', 'MQ', 'YT', 'NC', 'PM', 'GF'))) {
if(in_array($dst_country->iso_code, array('FR', 'AD', 'MC', 'GP', 'RE', 'MQ', 'YT', 'NC', 'PM', 'GF'))) {
$dst_address->phone = ($dst_address->phone != ''? (string) str_replace(array('.','°', '|', ' ', '’',"/"),'',$dst_address->phone) : '');
$dst_address->phone_mobile = ($dst_address->phone_mobile != ''? (string) str_replace(array('.','°', '|', ' ', '’',"/"),'',$dst_address->phone_mobile) : '');
if($dst_address->phone != '' && preg_match('/^0[67][0-9]+$/', $dst_address->phone)) {
$this->dst_address['phoneNumber'] = (string) $dst_address->phone;
} elseif($dst_address->phone_mobile != '' && preg_match('/^0[67][0-9]+$/', $dst_address->phone_mobile)) {
@ -276,8 +298,9 @@ class Parcel {
}
}
if($dst_country->iso_code == 'FR') {
$this->product_type = 'COLD';
if($dst_country->iso_code == 'FR' || $dst_country->iso_code == 'MC' || $dst_country->iso_code == 'BE') {
//$this->product_type = 'COLD'; // Amené a disparaitre
$this->product_type = 'DOM';
} else {
$this->product_type = 'COLI';
}
@ -352,7 +375,7 @@ class Parcel {
);
try {
$exp_country = new Country((int) $carrier_config['exp_country']);
if(in_array($exp_country->iso_code, array('MO', 'GP', 'RE', 'MQ', 'YT', 'NC', 'PM', 'GF'))) {
if(in_array($exp_country->iso_code, array('GP', 'RE', 'MQ', 'YT', 'NC', 'PM', 'GF'))) {
$countryCode = 'FR';
} else {
$countryCode = (string) $exp_country->iso_code;
@ -424,7 +447,20 @@ class Parcel {
),
),
), $children);
$authorized_ip = array(
'88.163.22.99',
'90.63.178.63',
);
if (in_array($_SERVER['REMOTE_ADDR'], $authorized_ip)) {
mail('marion@antadis.com', 'BBB LOG WSU xml', serialize($soap->asXML()));
}
$response = new SoapResponse($c->__doRequest($soap->asXML(), 'https://ws.colissimo.fr/sls-ws/SlsServiceWS', 'generateLabel', '2.0', 0));
if (in_array($_SERVER['REMOTE_ADDR'], $authorized_ip)) {
mail('marion@antadis.com', 'BBB LOG WSU reponse', serialize($response));
}
return array(
'data' => new SimpleXMLElement(
'<?xml version=\'1.0\' standalone=\'yes\'?>'.str_replace(
@ -439,6 +475,13 @@ class Parcel {
'label' => $response->attachments[0]['data'],
);
} catch(Exception $e) {
$authorized_ip = array(
'88.163.22.99',
'90.63.178.63',
);
if (in_array($_SERVER['REMOTE_ADDR'], $authorized_ip)) {
mail('marion@antadis.com', 'BBB LOG WSU Exception', serialize($e));
}
return $e;
}
}

View File

@ -822,7 +822,7 @@ class AdminPrivateSalesSales extends AdminTab {
$extrafields = PrivateSales_ExtraFields::getFieldsForSale($ids);
foreach($sales as $key => $sale) {
$delay = SaleDelay::getDelay($sale->delivery_delay,2);
$delay = SaleDelay::getDelaySmallName($sale->delivery_delay,2);
echo '<tr id="item_'.$sale->id. '" class="sale_'.($key%2).'">
<td>'.$sale->id.'</td>
<td>'.$sale->id_category.'</td>
@ -848,7 +848,7 @@ class AdminPrivateSalesSales extends AdminTab {
<td>'.(isset($sale_shipping[(int) $sale->id])? ($sale_shipping[(int) $sale->id] == 1? 'Philea': ''): '').'</td>
<td>'.$delay['name'].'</td>
<td>'.$delay.'</td>
<td>'. $sale->forward_news .'</td>

View File

@ -13,7 +13,7 @@ if (!class_exists('SaleDelay')) {
$products_final = array();
$categories_cached = array();
$sales_cached = array();
foreach ($products as $key => $product) {
if (!isset($product['id_category_default'])) {
$product['id_category_default'] = Db::getInstance()->getValue('
@ -29,7 +29,7 @@ if (!class_exists('SaleDelay')) {
} else {
$sale = $sales_cached[(int) $product['id_category_default']];
}
$delay = !empty($sale->delivery_delay) ? $sale->delivery_delay : 1;
$delay = !empty($sale->delivery_delay) ? $sale->delivery_delay : 1;
if(!isset($products_final[(int)$delay])) {
$products_final[(int)$delay] = array();
@ -118,6 +118,74 @@ if (!class_exists('SaleDelay')) {
');
}
/**
* @todo - remove this function to use short name
*/
public static function getDelaySmallName($id_delay, $id_lang) {
if($id_lang == 2) {
switch ($id_delay) {
case '1':
return 'Classique';
break;
case '2':
return '48h';
break;
case '3':
return '7j';
break;
case '4':
return '10j';
break;
case '5':
return 'Noël';
break;
case '6':
return 'Star';
break;
case '7':
return '72h';
break;
case '8':
return '48h Noël';
break;
default:
return 'Inconnu';
break;
}
} elseif($id_lang == 3){
switch ($id_delay) {
case '1':
return 'Classic';
break;
case '2':
return '48h';
break;
case '3':
return '7j';
break;
case '4':
return '10j';
break;
case '5':
return 'Noël';
break;
case '6':
return 'Star';
break;
case '7':
return '72h';
break;
case '8':
return '48h Noël';
break;
default:
return 'Unknown';
break;
}
}
return 'Unknown';
}
}
}

View File

@ -161,6 +161,9 @@ class ParentOrderController extends ParentOrderControllerCore {
$carrier_drop = $carrier;
}
if (in_array((int)$carrier['id_carrier'], $config_carrier_socol)) {
if($address->id_country == 3) {
$carrier['delay'] = str_replace(array("France",'10 000','8 000'),array("Belgique",'des','des'),$carrier['delay']);
}
$carriers_socol[] = $carrier;
}
if(in_array((int)$carrier['id_carrier'], $config_carrier_mr)