From 27a4d1e8cbb33254d96d5bcfe0394cee03f915c8 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Thu, 19 Jan 2017 17:36:29 +0100 Subject: [PATCH] changement for dev and for dom carrier --- modules/logistics/AdminLogistics.php | 2 +- .../carriers/mondialrelay/cron_shipping.php | 52 +++++++++---------- .../carriers/mondialrelay/mondialrelay.php | 4 +- modules/mondialrelay/mondialrelay.php | 17 +++++- 4 files changed, 44 insertions(+), 31 deletions(-) diff --git a/modules/logistics/AdminLogistics.php b/modules/logistics/AdminLogistics.php index 1866de14..131552de 100644 --- a/modules/logistics/AdminLogistics.php +++ b/modules/logistics/AdminLogistics.php @@ -368,7 +368,7 @@ class AdminLogistics extends AdminTab { } elseif($render === 'route_error') { $this->_html .= '

'.$this->l('Route not found').'


'; } elseif($render !== FALSE) { - $this->printLabel($render); + //$this->printLabel($render); // comment in dev $this->_html .= '

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


'; diff --git a/modules/logistics/carriers/mondialrelay/cron_shipping.php b/modules/logistics/carriers/mondialrelay/cron_shipping.php index 30299049..831983cd 100755 --- a/modules/logistics/carriers/mondialrelay/cron_shipping.php +++ b/modules/logistics/carriers/mondialrelay/cron_shipping.php @@ -112,12 +112,12 @@ $sql = ' ON d.`id_order` = o.`id_order` LEFT JOIN `'._DB_PREFIX_.'customer` c ON c.`id_customer` = o.`id_customer` - WHERE p.`date_add` > "'.pSQL($last_sync).'" - AND d.`id_order_detail` IS NOT NULL + WHERE -- p.`date_add` > "'.pSQL($last_sync).'" + d.`id_order_detail` IS NOT NULL AND o.`id_order` IS NOT NULL GROUP BY p.`shipping_number` '; -$lines = Db::getInstance()->ExecuteQ($sql); +$lines = Db::getInstance()->ExecuteS($sql); if(count($lines)) { $mr_account_details = unserialize(Configuration::get('MR_ACCOUNT_DETAIL')); @@ -402,7 +402,7 @@ if(count($lines)) { // ."\n"; $i = 0; - foreach(Db::getInstance()->ExecuteQ(' + foreach(Db::getInstance()->ExecuteS(' SELECT d.*, p.`quantity` FROM `'._DB_PREFIX_.'mondialrelay_parcel` p LEFT JOIN `'._DB_PREFIX_.'order_detail` d @@ -553,28 +553,28 @@ $mr_ftp_conf = Configuration::getMultiple(array( 'MONDIALRELAYWS_FTP_PASSWORD' )); -$id_ftp = ftp_connect($mr_ftp_conf['MONDIALRELAYWS_FTP_HOST']); +// $id_ftp = ftp_connect($mr_ftp_conf['MONDIALRELAYWS_FTP_HOST']); -if (!ftp_login($id_ftp, $mr_ftp_conf['MONDIALRELAYWS_FTP_LOGIN'], $mr_ftp_conf['MONDIALRELAYWS_FTP_PASSWORD'])) - die('erreur lors de l\'identification FTP'.chr(10).chr(10)); +// if (!ftp_login($id_ftp, $mr_ftp_conf['MONDIALRELAYWS_FTP_LOGIN'], $mr_ftp_conf['MONDIALRELAYWS_FTP_PASSWORD'])) +// die('erreur lors de l\'identification FTP'.chr(10).chr(10)); -//activation du mode passif -// if (!ftp_pasv($id_ftp, true)) -// die('erreur lors de l\'activation du mode passif'.chr(10).chr(10)); +// //activation du mode passif +// // if (!ftp_pasv($id_ftp, true)) +// // die('erreur lors de l\'activation du mode passif'.chr(10).chr(10)); -$repo_dpc = dirname(__FILE__) . '/dpc/'; -$mr_repo_in = 'versmrelay/'; -//envoie du fichier -$list = scandir($repo_dpc); -foreach($list as $file) -{ - if (!preg_match('/^dpc\..+\.txt$/', $file)) - continue; - if ($file == '.' || $file == '..') - continue; - if (!ftp_put ($id_ftp, $mr_repo_in . $file, $repo_dpc . $file, FTP_BINARY)) - print('erreur lors de l\'ouverture du fichier : ' . $file . chr(10)); - else - unlink($repo_dpc . $file); -} -ftp_close($id_ftp); \ No newline at end of file +// $repo_dpc = dirname(__FILE__) . '/dpc/'; +// $mr_repo_in = 'versmrelay/'; +// //envoie du fichier +// $list = scandir($repo_dpc); +// foreach($list as $file) +// { +// if (!preg_match('/^dpc\..+\.txt$/', $file)) +// continue; +// if ($file == '.' || $file == '..') +// continue; +// if (!ftp_put ($id_ftp, $mr_repo_in . $file, $repo_dpc . $file, FTP_BINARY)) +// print('erreur lors de l\'ouverture du fichier : ' . $file . chr(10)); +// else +// unlink($repo_dpc . $file); +// } +// ftp_close($id_ftp); \ No newline at end of file diff --git a/modules/logistics/carriers/mondialrelay/mondialrelay.php b/modules/logistics/carriers/mondialrelay/mondialrelay.php index c697e0b1..1a5e79b6 100755 --- a/modules/logistics/carriers/mondialrelay/mondialrelay.php +++ b/modules/logistics/carriers/mondialrelay/mondialrelay.php @@ -699,10 +699,10 @@ class MondialrelayCarrier { } } - public function addOrderHistory($shipping_data, $order, $products_sent) { + public function __addOrderHistory($shipping_data, $order, $products_sent) { } - public function __addOrderHistory($shipping_data, $order, $products_sent) { + public function addOrderHistory($shipping_data, $order, $products_sent) { global $cookie; // $MONDIALRELAY_carrier_id = unserialize(Configuration::get('MONDIALRELAY_CARRIERS')); diff --git a/modules/mondialrelay/mondialrelay.php b/modules/mondialrelay/mondialrelay.php index f73c55ae..7cd70f1b 100755 --- a/modules/mondialrelay/mondialrelay.php +++ b/modules/mondialrelay/mondialrelay.php @@ -628,11 +628,11 @@ class MondialRelay extends Module // CHECK MR_SELECTED if ((int) Tools::getValue('step') == 3){ global $cookie, $cart; - if (isset($cart->id_carrier) && $this->isMondialRelayCarrier($cart->id_carrier)){ + if (isset($cart->id_carrier) && $this->isMondialRelayNoDomCarrier($cart->id_carrier)){ $mr_selected = Db::getInstance()->getRow('SELECT * FROM `' . _DB_PREFIX_ . 'mr_selected` WHERE `id_cart` = ' . (int) $cart->id); if (!$mr_selected || !$mr_selected['MR_Selected_Num']) { - Tools::redirect('order.php?step=1&no_mr_selected=1'); + Tools::redirect('order.php?step=2&no_mr_selected=1'); } } return ''; @@ -1360,6 +1360,19 @@ class MondialRelay extends Module WHERE `id_carrier` = '.(int)$id_carrier); } + /** + * @param $id_carrier + * @return mixed + */ + public function isMondialRelayNoDomCarrier($id_carrier) + { + return Db::getInstance()->getRow(' + SELECT m.`id_mr_method` + FROM `'._DB_PREFIX_.'mr_method` m + WHERE `dlv_mode` NOT IN ("LD1","LDS","HOM") + AND `id_carrier` = '.(int)$id_carrier); + } + public function getMethodValueByIdCarier($id_carrier, $key) { $content = Db::getInstance()->executeS(