From 4e1f49725258fc1d0013f95310a5e96739ecd858 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Wed, 11 Jan 2017 10:54:50 +0100 Subject: [PATCH 1/3] comment mr modif for philea --- .../philea_magistor/script/send_commande.php | 81 ++++++++++--------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/modules/philea_magistor/script/send_commande.php b/modules/philea_magistor/script/send_commande.php index 2693fc64..03a20be6 100644 --- a/modules/philea_magistor/script/send_commande.php +++ b/modules/philea_magistor/script/send_commande.php @@ -186,7 +186,7 @@ if($magistorModule->active) { continue; }*/ $carriers_socol = array(67,87,88,89); - $carriers_mr = array(90); + //$carriers_mr = array(90); // fake data $customer = new Customer($order->id_customer); $address_invoice = new Address($order->id_address_invoice); @@ -208,21 +208,22 @@ if($magistorModule->active) { } $prid = $delivery_info['prid']; } - } elseif(in_array((int) $order->id_carrier, $carriers_mr) { - /* MONDIAL RELAY */ - $delivery_info = $db->getRow(' - SELECT mr_m.`col_mode`, mr_m.`dlv_mode`, mr_s.* - FROM `'._DB_PREFIX_.'mr_selected` mr_s - LEFT JOIN `'._DB_PREFIX_.'mr_method` mr_m ON (mr_m.`id_mr_method` = mr_s.`id_method`) - WHERE mr_s.`id_cart` = '.(int) $order->id_cart.' - AND mr_m.`id_carrier` = '.(int) $order->id_carrier.' - AND `MR_Selected_Num` IS NOT NULL - '); - if($delivery_info) { - $carrier_value = $mr_to_magistor[$delivery_info['dlv_mode']]; - $prid = substr($delivery_info['MR_Selected_Num'], -5); - } } + //elseif(in_array((int) $order->id_carrier, $carriers_mr) { + // /* MONDIAL RELAY */ + // $delivery_info = $db->getRow(' + // SELECT mr_m.`col_mode`, mr_m.`dlv_mode`, mr_s.* + // FROM `'._DB_PREFIX_.'mr_selected` mr_s + // LEFT JOIN `'._DB_PREFIX_.'mr_method` mr_m ON (mr_m.`id_mr_method` = mr_s.`id_method`) + // WHERE mr_s.`id_cart` = '.(int) $order->id_cart.' + // AND mr_m.`id_carrier` = '.(int) $order->id_carrier.' + // AND `MR_Selected_Num` IS NOT NULL + // '); + // if($delivery_info) { + // $carrier_value = $mr_to_magistor[$delivery_info['dlv_mode']]; + // $prid = substr($delivery_info['MR_Selected_Num'], -5); + // } + // } if(!$carrier_value) { @@ -266,13 +267,13 @@ if($magistorModule->active) { $data .= str_pad(substr(utf8_decode(cleanChar($address_invoice->firstname.' '.$address_invoice->lastname)), 0, 50), 50, ' ', STR_PAD_RIGHT); } // LIVRAISON DOMICILE MONDIAL RELAY - elseif(in_array((int) $order->id_carrier, $carriers_mr) - && $delivery_info - && in_array($delivery_info['dlv_mode'], array('LD1', 'LDS', 'HOM')) - ) { - $data .= str_pad(substr(utf8_decode(cleanChars($address_delivery->lastname)), 0, 50), 50, ' ', STR_PAD_RIGHT); - $data .= str_pad(substr(utf8_decode(cleanChars($address_invoice->firstname.' '.$address_invoice->lastname)), 0, 50), 50, ' ', STR_PAD_RIGHT); - } + // elseif(in_array((int) $order->id_carrier, $carriers_mr) + // && $delivery_info + // && in_array($delivery_info['dlv_mode'], array('LD1', 'LDS', 'HOM')) + // ) { + // $data .= str_pad(substr(utf8_decode(cleanChars($address_delivery->lastname)), 0, 50), 50, ' ', STR_PAD_RIGHT); + // $data .= str_pad(substr(utf8_decode(cleanChars($address_invoice->firstname.' '.$address_invoice->lastname)), 0, 50), 50, ' ', STR_PAD_RIGHT); + // } else { $data .= str_pad(substr(utf8_decode(cleanChar($address_delivery->firstname.' '.$address_delivery->lastname)), 0, 50), 50, ' ', STR_PAD_RIGHT); $data .= str_pad(substr(utf8_decode(cleanChar($address_delivery->company)), 0, 50), 50, ' ', STR_PAD_RIGHT); @@ -305,24 +306,24 @@ if($magistorModule->active) { $data .= str_pad('', 50, ' ', STR_PAD_RIGHT); } // LIVRAISON MONDIAL RELAY - elseif (in_array((int) $order->id_carrier, $carriers_mr) && $delivery_info) { - // MR DOMICILE - if (in_array($delivery_info['dlv_mode'], array('LD1', 'LDS', 'HOM'))){ - $data .= str_pad( substr(utf8_decode(cleanChars($address_delivery->firstname.' '.$address_delivery->lastname)), 0, 50), 50, ' ', STR_PAD_RIGHT); - $data .= str_pad( substr(utf8_decode(cleanChars($address_delivery->company)), 0, 50), 50, ' ', STR_PAD_RIGHT); - } else { - $data .= str_pad( substr(utf8_decode(cleanChars($address_delivery->lastname)), 0, 50), 50, ' ', STR_PAD_RIGHT); - $data .= str_pad( substr(utf8_decode(cleanChars($address_invoice->firstname.' '.$address_invoice->lastname)), 0, 50), 50, ' ', STR_PAD_RIGHT); - } - $data .= str_pad( substr(utf8_decode($address_delivery->address1),0,50), 50, ' ', STR_PAD_RIGHT ); - $data .= str_pad( substr(utf8_decode($address_delivery->address2),0,50), 50, ' ', STR_PAD_RIGHT ); - $data .= str_pad( substr(utf8_decode(cleanChar($address_delivery->other)),0,50), 50, ' ', STR_PAD_RIGHT );//ADRESSE 3 - $data .= str_pad( substr(utf8_decode($address_delivery->postcode),0,8), 8, ' ', STR_PAD_RIGHT ); - $data .= str_pad( substr(utf8_decode($address_delivery->city),0,50), 50, ' ', STR_PAD_RIGHT ); - $data .= str_pad( utf8_decode($db->getValue('SELECT iso_code FROM `'._DB_PREFIX_.'country` WHERE id_country = '.$address_delivery->id_country)), 50, ' ', STR_PAD_RIGHT ); - $data .= str_pad( (isset($address_delivery->phone_mobile)?$address_delivery->phone_mobile:$address_delivery->phone), 50, ' ', STR_PAD_RIGHT ); - $data .= str_pad( '', 50, ' ', STR_PAD_RIGHT ); - } + // elseif (in_array((int) $order->id_carrier, $carriers_mr) && $delivery_info) { + // // MR DOMICILE + // if (in_array($delivery_info['dlv_mode'], array('LD1', 'LDS', 'HOM'))){ + // $data .= str_pad( substr(utf8_decode(cleanChars($address_delivery->firstname.' '.$address_delivery->lastname)), 0, 50), 50, ' ', STR_PAD_RIGHT); + // $data .= str_pad( substr(utf8_decode(cleanChars($address_delivery->company)), 0, 50), 50, ' ', STR_PAD_RIGHT); + // } else { + // $data .= str_pad( substr(utf8_decode(cleanChars($address_delivery->lastname)), 0, 50), 50, ' ', STR_PAD_RIGHT); + // $data .= str_pad( substr(utf8_decode(cleanChars($address_invoice->firstname.' '.$address_invoice->lastname)), 0, 50), 50, ' ', STR_PAD_RIGHT); + // } + // $data .= str_pad( substr(utf8_decode($address_delivery->address1),0,50), 50, ' ', STR_PAD_RIGHT ); + // $data .= str_pad( substr(utf8_decode($address_delivery->address2),0,50), 50, ' ', STR_PAD_RIGHT ); + // $data .= str_pad( substr(utf8_decode(cleanChar($address_delivery->other)),0,50), 50, ' ', STR_PAD_RIGHT );//ADRESSE 3 + // $data .= str_pad( substr(utf8_decode($address_delivery->postcode),0,8), 8, ' ', STR_PAD_RIGHT ); + // $data .= str_pad( substr(utf8_decode($address_delivery->city),0,50), 50, ' ', STR_PAD_RIGHT ); + // $data .= str_pad( utf8_decode($db->getValue('SELECT iso_code FROM `'._DB_PREFIX_.'country` WHERE id_country = '.$address_delivery->id_country)), 50, ' ', STR_PAD_RIGHT ); + // $data .= str_pad( (isset($address_delivery->phone_mobile)?$address_delivery->phone_mobile:$address_delivery->phone), 50, ' ', STR_PAD_RIGHT ); + // $data .= str_pad( '', 50, ' ', STR_PAD_RIGHT ); + // } // LIVRAISON DOMICILE else{ $data .= str_pad( '', 50, ' ', STR_PAD_RIGHT); From 5192561baca67b3bb0d1a4e5939013864111fb59 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Wed, 11 Jan 2017 15:33:44 +0100 Subject: [PATCH 2/3] update BlockOrderSummary, AdminPrivateSalesSale, ParentOrderController, AdminLogistic, logistic, OrderDetailController, order_detail tpl, mondial relay tpl for Mondial Relay --- .../AdminAntConfigurations.php | 9 + .../blockordersummary/blockordersummary.php | 29 +- modules/logistics/AdminLogistics.php | 36 ++- modules/logistics/logistics.php | 306 +++++++++++++----- modules/mondialrelay/mondialrelay.php | 6 +- .../front/checkout_process_widget.tpl | 74 ++--- .../views/templates/front/order_detail.tpl | 27 +- .../privatesales/AdminPrivateSalesSales.php | 12 +- .../controllers/OrderDetailController.php | 33 +- .../controllers/ParentOrderController.php | 11 +- themes/site/css/style.css | 45 ++- themes/site/order-detail.tpl | 2 +- 12 files changed, 435 insertions(+), 155 deletions(-) diff --git a/modules/ant_configurations/AdminAntConfigurations.php b/modules/ant_configurations/AdminAntConfigurations.php index fd310ca6..3f68f568 100644 --- a/modules/ant_configurations/AdminAntConfigurations.php +++ b/modules/ant_configurations/AdminAntConfigurations.php @@ -16,6 +16,7 @@ class AdminAntConfigurations extends AdminTab Configuration::updateValue('ANT_CARRIER_DROP', Tools::getValue('carrier_dropshipping')); Configuration::updateValue('ANT_CARRIER_DOM', Tools::getValue('carrier_domicile')); Configuration::updateValue('ANT_CARRIERS_SOCOL', Tools::getValue('carriers_socol')); + Configuration::updateValue('ANT_CARRIERS_MR', Tools::getValue('carriers_mr')); Configuration::updateValue('ANT_CARRIERS_OOH', Tools::getValue('carriers_ooh')); HelperFormBootstrap::echoConfirmation($this->l('Configurations mises à jour')); @@ -310,6 +311,14 @@ class AdminAntConfigurations extends AdminTab 'label' => $this->l('Transporteur socol :'), 'default' => Configuration::get('ANT_CARRIERS_SOCOL') ), + array( + 'type' => 'simpleText', + 'name' => 'carriers_mr', + 'label-class' => 'col-md-6', + 'input-class' => 'col-md-4', + 'label' => $this->l('Transporteur MR :'), + 'default' => Configuration::get('ANT_CARRIERS_MR') + ), array( 'type' => 'simpleText', 'name' => 'carriers_ooh', diff --git a/modules/blockordersummary/blockordersummary.php b/modules/blockordersummary/blockordersummary.php index a53d233f..3648838a 100644 --- a/modules/blockordersummary/blockordersummary.php +++ b/modules/blockordersummary/blockordersummary.php @@ -202,9 +202,7 @@ class BlockOrderSummary extends Module { LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = ppp.`id_order_detail`) WHERE od.`id_order` ='. (int)$params['order']->id ); - //$carrier_socol = array(38,40,45);// local - //$carrier_socol = array(45,47,48);// dev - $carrier_socol = array(87,88,89);// prod + $carrier_socol = explode(',',Configuration::get('ANT_CARRIERS_SOCOL')); echo '
@@ -360,6 +358,31 @@ class BlockOrderSummary extends Module { $order_address = nl2br(AddressFormat::generateAddress(new Address((int) $cart->id_address_delivery))); } } + } elseif(Db::getInstance()->getValue(' + SELECT COUNT(*) + FROM `'._DB_PREFIX_.'mr_method` + WHERE `id_carrier` = '.(int) $cart->id_carrier.' + ')) { + $mr = Db::getInstance()->getRow(' + SELECT mr_s.* + FROM `' . _DB_PREFIX_ . 'mr_selected` mr_s + WHERE `id_cart` = ' . (int) $cart->id . ' + '); + if($mr) { + $order_address = nl2br(preg_replace("/(\r\n){2,}/", "\r\n", implode("\r\n", array( + $mr['MR_Selected_LgAdr1'], + $mr['MR_Selected_LgAdr2'], + $mr['MR_Selected_LgAdr3'] . ' ' . $mr['MR_Selected_LgAdr4'], + $mr['MR_Selected_CP'] . ' ' . $mr['MR_Selected_Ville'], + 'FRANCE', + )))); + } else { + if($order) { + $order_address = nl2br(AddressFormat::generateAddress(new Address((int) $order->id_address_delivery))); + } else { + $order_address = nl2br(AddressFormat::generateAddress(new Address((int) $cart->id_address_delivery))); + } + } } else { if($order) { $order_address = nl2br(AddressFormat::generateAddress(new Address((int) $order->id_address_delivery))); diff --git a/modules/logistics/AdminLogistics.php b/modules/logistics/AdminLogistics.php index 2369857e..9a4692dd 100644 --- a/modules/logistics/AdminLogistics.php +++ b/modules/logistics/AdminLogistics.php @@ -4,7 +4,7 @@ if(!defined('_PS_VERSION_')) { } global $logistics_carriers; -/*foreach(array_map(function($value) { +foreach(array_map(function($value) { return str_replace('.', '', $value); }, array_diff(scandir(dirname(__FILE__).'/carriers'), array('.', '..'))) as $lg) { if(is_dir(dirname(__FILE__).'/carriers/'.$lg)) { @@ -12,9 +12,9 @@ global $logistics_carriers; $name = ucfirst($lg).'Carrier'; $logistics_carriers[$lg] = new $name(); } -}*/ -include dirname(__FILE__).'/carriers/laposte/laposte.php'; -$logistics_carriers['laposte'] = new LaposteCarrier(); +} +//include dirname(__FILE__).'/carriers/laposte/laposte.php'; +//$logistics_carriers['laposte'] = new LaposteCarrier(); include _PS_ROOT_DIR_.'/modules/privatesales/Sale.php'; @@ -184,6 +184,24 @@ class AdminLogistics extends AdminTab { AND `shipping_number` = "'.pSQL($delete_number).'" '); } + } elseif($delete = (int) Tools::getValue('delete_mondialrelay')) { + Db::getInstance()->ExecuteS(' + DELETE FROM `'._DB_PREFIX_.'mondialrelay_parcel` + WHERE `id_order_detail` = '.$delete.' + AND `shipping_number` = "'.pSQL($delete_number).'" + '); + + if(!Db::getInstance()->getRow(' + SELECT `shipping_number` + FROM `'._DB_PREFIX_.'mondialrelay_parcel` + WHERE `shipping_number` = "'.pSQL($delete_number).'" + ')) { + Db::getInstance()->ExecuteS(' + DELETE FROM `'._DB_PREFIX_.'shipping_history` + WHERE `id_order` = '.(int) Tools::getValue('id_order').' + AND `shipping_number` = "'.pSQL($delete_number).'" + '); + } } $id_order_details = array(); @@ -291,6 +309,12 @@ class AdminLogistics extends AdminTab { } elseif(Tools::isSubmit('submitTestExapaq')) { $this->_html .= '

'.$this->l('Registration complete, label sent to printer').'


'; $this->printLabel($logistics_carriers['exapaq']->renderLabel(new Order(23336), 0.24, array('shipping_number' => '100000000', 'exapass' => '250094100000000068'))); + } elseif(Tools::isSubmit('submitTestMondialrelay')) { + $this->_html .= '

'.$this->l('Registration complete, label sent to printer').'


'; + $result = $logistics_carriers['mondialrelay']->registerParcel(new Order(864899), array('1903302' => "1"), 1.2); + $render = $logistics_carriers['mondialrelay']->renderLabel(new Order(864899), 1.2, $result[1]); + $this->printLabel($render); + //$this->printLabel($logistics_carriers['mondialrelay']->renderLabel(new Order(864899), 1.2, '6J12345123451')); } elseif(Tools::isSubmit('submitShip') && ($id_order = (int) Tools::getValue('id_order'))) { $order = new Order((int) $id_order); @@ -485,6 +509,7 @@ class AdminLogistics extends AdminTab { var carriers_laposte = $.parseJSON("'.addslashes(json_encode(unserialize(Configuration::get('LAPOSTEWS_CARRIERS')))).'"); var carriers_exapaq = $.parseJSON("'.addslashes(json_encode(unserialize(Configuration::get('EXAPAQWS_CARRIERS')))).'"); + var mondialrelayws_carriers = $.parseJSON("'.addslashes(json_encode(unserialize(Configuration::get('MONDIALRELAYWS_CARRIERS')))).'"); var locked_products = $.parseJSON("'.addslashes(json_encode($locked_products)).'"); var sales_list = $.parseJSON("'.addslashes(json_encode($sales_list)).'"); @@ -624,6 +649,7 @@ class AdminLogistics extends AdminTab { if(( $.inArray(loaded.order.id_carrier, carriers_laposte) > 0 || $.inArray(loaded.order.id_carrier, carriers_exapaq) > 0 + || $.inArray(loaded.order.id_carrier, carriers_mondialrelay) >= 0 ) && $.inArray(parseInt(loaded.delivery_address.id_country), [1, 2, 3, 6, 8, 10, 12, 13, 17, 26, 40, 148, 245]) != -1) { content += \'
'; } + /* @Mondial relay */ + $this->_html .= '

+ + + + -