diff --git a/.gitignore b/.gitignore index 06453c77..f0e2fc33 100644 --- a/.gitignore +++ b/.gitignore @@ -79,4 +79,5 @@ maj.php 1_index_sitemap.xml adm/export/* adm/import/* -themes/toutpratique/cache/* \ No newline at end of file +themes/toutpratique/cache/* +modules/blocknewsletter/*.csv \ No newline at end of file diff --git a/google4923b609d4e89885.html b/google4923b609d4e89885.html new file mode 100644 index 00000000..0338331b --- /dev/null +++ b/google4923b609d4e89885.html @@ -0,0 +1 @@ +google-site-verification: google4923b609d4e89885.html \ No newline at end of file diff --git a/modules/atos/certif.fr.039956369100050 b/modules/atos/certif.fr.039956369100050 new file mode 100644 index 00000000..f0f8f3bf --- /dev/null +++ b/modules/atos/certif.fr.039956369100050 @@ -0,0 +1,44 @@ +b30MJgmq7yax9WBJfmoyYqmULRtauX1bJriHYgSbCeDP6SOIBfPIIg0CD1vtdwSQPe +OIVl0BGqbt1aEvBZuWKwj67ObfcsKuB9Rkctfv9F73ngOjWUrguYRBJVZijcOStHoQ +UwUIdt8OzxIYPTlk0yJih2zVtUeiweQYOKbkb22m0OiNveHPP6LlnqpzXSiUikHNlU +nZdAUOZuoGUQeaJWJ9zUsUCdmbUGU40gZPFTEvlkMwU3G6ZaZ84Omq7GLIvPtAdx1U +DTGgO6ngDP8Si47NT0zedwssyMZYafqDvc2POFpXiq25q1kydSw7WaGBW9CZcWPF4m +6r28c7M63Tg3mb1lrAKhkl3pwVC4qx5djhrLcDp3oobdDrjey0pZx5bpoOSfl7N5xR +uFB0oDKEABFkuJKgjAeBEXfXYbvZlkyS7jNCOhsks9JmEJ1to8lkb1SUZLsnkagZMd +gyyMIzZBOJM21BUg5ytjFKq2WZjVXoXh79RWMTXzL51ytHEbmhRHFnLDxYfUv3wDHx +CBErWTYJB1bXoL18JopV3s6C62XO0kbFcjBY2CZs5wuGU21648JrZcBRKQAzDqojEk +eT7VDAHIwSTn3VE7rfIVeLvQBqeJ6GmvaiORk9hs1SBWpt9G5JYv4t1EWI7SzqrTJw +7o7iw4sC9Bm5Ff7CPcfPZ3yWa5LEaSQOPUGcZVdqAlRTAbenCimkOreXx6aEjEoEzf +Wk02Hd24xkqhiuuG6EagZP1Of0BlGCnSXbXUROBbUhcjNOJoQjQumBA56qYY780VKc +dXFEyydNIYo8F2wXD2BdcKefMsDc7Zb5D5NnuWxYuinwLyYcAzMPfjIzSPYVnAuaQK +0X9nUVm3UErfpb4pTOGzBXttdKW5K5f2qXu1Or7egCZO79HkTpqpu55Vk7a4b4eYOF +ORymq6wrP3hFymKTSD8dwNVInmiQDhDnAJfaNSxMFIrulVu8bRQTsixtlNDW5b024G +KwARP8bECbggsUplObcEKGPVcLgqnyVil1rXhjCybGKVTfekATWyJKIrtYcuPAcNvp +Lyc5dMqpJMehh4aI2ZCBx7JlDvkw0TIqIxfZvTGzxSY2lrz0yJmBEE7XQVL6HaMGlK +tDuYFgPFgOZbvpCNLdtiq06XNNIiHdruPHgqfOmsD3cOqhEE0cj1BSssAN5xDlL7da +qJYgwhTZ2jZfOJhbmofqBkoWAGshBGu4Oi7IncEV9B7K2wsVw6DI4YTHhbaEJZqLd8 +T4PwkShegr4HwxPue8EMwQxmmauFf5gcqK6sURirdszEMAK4R1yih4VPurXxT39dUr +rMkMqyk86ouJK9AwbPfI1lm0bkkjOwvU97J3FeNPwK8knUv4ewbVjcZSxzOtTY0oFY +1gULoac8gq5NLo6ZOZXNzQsXQghFUlYIRf2oiUtriCQnznPTLrAWXd9IBSlyUPmDug +QlUeCbXBCKbhgYzDWxHqlbG702g1nBg6tDI0vMZvaiS7Ins1292ljny1Z5vnN9TO5q +z0WhSplzhm1yw4j7n5pl0YuTyzKxzsfS3D3I74G496wdAmpLpvYJtYerY1aFdWNioR +rvonaTEJoe4MPvv2YwdgCMCa7833frbYYjoWucAz6av1dTyNABlUsx10gsGFRS5Gz0 +1282280B4B18B4C33FB82341D1D0F69D920299F1CCEA73D8D7148F8A217F0B7241 +F20F53592906B75D6279E1AD680F5614C275EA2D65C2AD47CAF0B236E329DEB18C +YhZYW3QiL6OW9eXqQr1zR6dLlJOiMDbG6OGmKSYrbRLjNxgYF6O0LOphKqjcTtEjC4 +qRYApJkYmWXLLANZn46w0I65L63PlBVrpYPSvFAu25aUMaSwcELNUKcpgFq5tsI1wG +112F26EAF22B941D68296122852EE412A24D0C95E1DF3B8E8C2E7C169D1BDB5041 +718B1F38845381DE26A6D7299C7E7F68EF0659C29A0F2C8D91eFcB1ZxNnOK4rRiC +YhZYW3QiL6OW9eXqQr1zR6dLlJOiMDbG6OGmKSYrbRLjNxgYF6O0LOphKqjcTtEjC4 +qRYApJkYmWXLLANZn46w0I65L63PlBVrpYPSvFAu25aUMaSwcELNUKcpgFq5tsI1wG +1282280B4B18B4C33FB82341D1D0F69D920299F1CCEA73D8D7148F8A217F0B7241 +F20F53592906B75D6279E1AD680F5614C275EA2D65C2AD47CAF0B236E329DEB18C +YhZYW3QiL6OW9eXqQr1zR6dLlJOiMDbG6OGmKSYrbRLjNxgYF6O0LOphKqjcTtEjC4 +qRYApJkYmWXLLANZn46w0I65L63PlBVrpYPSvFAu25aUMaSwcELNUKcpgFq5tsI1wG +1123D43D4C4E67A6ECC25D50435673612FCD517E79E35AAE9BF0BA809CB73BECB9 +89C2045BB2189707D639BC1BE7CEFBF4D1AFA1485FD19FB881eFcB1ZxNnOK4rRiC +YhZYW3QiL6OW9eXqQr1zR6dLlJOiMDbG6OGmKSYrbRLjNxgYF6O0LOphKqjcTtEjC4 +qRYApJkYmWXLLANZn46w0I65L63PlBVrpYPSvFAu25aUMaSwcELNUKcpgFq5tsI1wG +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +SIPSATIS_TOUTPRATIQUE,20/01/2016,V4,SOGENACTIF,PROD+++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++END diff --git a/modules/atos/parmcom.039956369100050 b/modules/atos/parmcom.039956369100050 new file mode 100644 index 00000000..0ea36c80 --- /dev/null +++ b/modules/atos/parmcom.039956369100050 @@ -0,0 +1,2 @@ + +ADVERT!logo.jpg! diff --git a/modules/atos/pathfile b/modules/atos/pathfile index 418d9d8a..25e3a98c 100644 --- a/modules/atos/pathfile +++ b/modules/atos/pathfile @@ -2,4 +2,4 @@ DEBUG!NO! D_LOGO!/modules/atos/img/logos/! F_CERTIFICATE!/home/www/toutpratique.com/www/modules/atos/certif! F_PARAM!/home/www/toutpratique.com/www/modules/atos/parmcom! -F_DEFAULT!/home/www/toutpratique.com/www/modules/atos/parmcom.elysnet! \ No newline at end of file +F_DEFAULT!/home/www/toutpratique.com/www/modules/atos/parmcom.sogenactif! \ No newline at end of file diff --git a/modules/gls/AdminGls.gif b/modules/gls/AdminGls.gif new file mode 100644 index 00000000..7550096d Binary files /dev/null and b/modules/gls/AdminGls.gif differ diff --git a/modules/gls/AdminGls.php b/modules/gls/AdminGls.php new file mode 100644 index 00000000..b25d2637 --- /dev/null +++ b/modules/gls/AdminGls.php @@ -0,0 +1,133 @@ + +* @copyright 2007-2014 Addonline +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +*/ + +require_once(dirname(__FILE__).'/gls.php'); + +class AdminGls extends AdminTab +{ + private $gls = NULL; + + public $post_errors = array(); + + public function __construct() + { + $this->gls = new Gls(); + + parent::__construct(); + $this->context = Context::getContext(); + } + + private function displayOrdersTable() + { + $order_state = new OrderState((int)(Configuration::get('GLS_ORDER_STATE')), $this->context->language->id); + $orders = Gls::getOrders(array(), Gls::NO_FILTER); //, $this->gls->account_shop['GLS_WEIGHT_COEFFICIENT']); + + foreach($orders as &$order) + { + $order['display_total_price'] = Tools::displayPrice($order['total'], new Currency($order['id_currency'])); + $order['display_shipping_price'] = Tools::displayPrice($order['shipping'], new Currency($order['id_currency'])); + $order['display_date'] = Tools::displayDate($order['date'], $order['id_lang']); + $order['weight'] = (!empty($order['gls_weight']) && $order['gls_weight'] > 0) ? $order['gls_weight'] : $order['order_weight']; + } + + $controller = (_PS_VERSION_ < '1.5') ? 'AdminContact' : 'AdminStores'; + + $this->context->smarty->assign(array( + 'GLS_token_admin_module' => Tools::getAdminToken('AdminModules'.(int)(Tab::getIdFromClassName('AdminModules')).(int)$this->context->employee->id), + 'GLS_token_admin_contact' => array( + 'controller_name' => $controller, + 'token' => Tools::getAdminToken($controller.(int)(Tab::getIdFromClassName($controller)).(int)$this->context->employee->id)), + 'GLS_token_admin_orders' => Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)$this->context->employee->id), + 'GLS_order_state_name' => $order_state->name, + 'GLS_orders' => $orders, + 'GLS_PS_IMG_DIR_' => _PS_IMG_DIR_, + //'GLS_errors_type' => $GLSCreateTicket->checkPreValidation() + ) + ); + + unset($order_state); + echo $this->gls->fetchTemplate('/tpl/admintab/', 'export_orders'); + } + + public function displaySettings($post_action) + { + $curr_order_state = new OrderState((int)$this->gls->account_shop['GLS_ORDER_STATE']); + $order_state = array( + 'id_order_state' => $this->gls->account_shop['GLS_ORDER_STATE'], + 'name' => $curr_order_state->name[$this->context->language->id] + ); + + $order_state_import = array( + 'id_order_state' => $this->gls->account_shop['GLS_ORDER_STATE_IMPORT'], + 'name' => $curr_order_state->name[$this->context->language->id] + ); + + $this->context->smarty->assign(array( + 'GLS_token_admin_gls' => Tools::getAdminToken('AdminGls'.(int)(Tab::getIdFromClassName('AdminGls')).(int)$this->context->employee->id), + 'GLS_account_set' => Gls::isAccountSet(), + 'GLS_order_state' => $order_state, + 'GLS_order_state_import' => Configuration::get('GLS_ORDER_STATE_IMPORT'), + 'GLS_orders_states_list' => OrderState::getOrderStates($this->context->language->id), + 'GLS_form_action' => $post_action, + 'GLS_error_list' => $this->post_errors + )); + + echo $this->gls->fetchTemplate('/tpl/admintab/', 'settings'); + } + + public function postProcess() + { + $post_action = array( + 'type' => Tools::getValue('GLS_action_name'), + 'message_success' => $this->l('Action Succeed'), + 'had_errors' => false + ); + + parent::postProcess(); + + if (Tools::isSubmit('submit_order_state')) + if (($order_state = (int)Tools::getValue('id_order_state'))) + { + $this->gls->account_shop['GLS_ORDER_STATE'] = $order_state; + + if ($this->gls->updateAccountShop()) + $post_action['message_success'] = $this->l('Order State has been updated'); + else + $this->post_errors[] = $this->l('Cannot Update the account shop'); + } + + if (count($this->post_errors)) + $post_action['had_errors'] = true; + + return $post_action; + } + + public function display() + { + + $post_action = count($_POST) ? $this->postProcess() : NULL; + + $this->displaySettings($post_action); + + if (Gls::isAccountSet() && (int)$this->gls->account_shop['GLS_ORDER_STATE']) + { + $this->displayOrdersTable(); + } + } +} diff --git a/modules/gls/ajax.php b/modules/gls/ajax.php new file mode 100644 index 00000000..bd613650 --- /dev/null +++ b/modules/gls/ajax.php @@ -0,0 +1,137 @@ + +* @copyright 2007-2014 Addonline +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +*/ + + +/* + * File called by ajax. It's like a controller, you have to send the + * method name of the webservice and implement it. + * Each Name method allow to instanciate an object containing + * methods to manage correctly the data and name fields + */ + +header('Access-Control-Allow-Origin: *'); + +// Clean displayed content for Admin ajax query +if (ob_get_contents()) ob_clean(); + +// Front Ajax query, need the front cookie and GLS class +// When it's back query, the PS core made the work +if (!defined('_PS_ADMIN_DIR_')) +{ + require_once(realpath(dirname(__FILE__).'/../../config/config.inc.php')); + require_once(realpath(dirname(__FILE__).'/../../init.php')); + require_once(dirname(__FILE__).'/gls.php'); +} + +$gls = new Gls(); + +require_once(dirname(__FILE__).'/classes/GLSManagement.php'); + +// Can't use Tools at this time... Need to know if _PS_ADMIN_DIR_ has to be defined +$method = Tools::getValue('method'); +$token = Tools::getValue('glstoken'); +// Access page List liable to the generated token +$accessPageList = array( + Gls::getToken('front') => array( + 'GLSGetRelayPoint', + 'addSelectedCarrierToDB' + ), + Gls::getToken('back') => array( + 'GLSexportToWinExpe', + 'GLSImportFromWinExpe', + 'GLSCreateTickets', + 'GLSDeleteHistory', + 'uninstallDetail', + 'DeleteHistory' + ) +); + +$params = array(); +$result = array(); + +// If the method name associated to the token received doesn't match with +// the list, then we kill the request +if (!isset($accessPageList[$token]) || !in_array($method, $accessPageList[$token])) + exit(); + +// Method name allow to instanciate his object to properly call the +// implemented interface method and do his job +switch($method) +{ + case 'GLSexportToWinExpe': + $params['orderIdList'] = Tools::getValue('order_id_list'); + $params['totalOrder'] = Tools::getValue('numSelected'); + $params['weightList'] = Tools::getValue('weight_list'); + break; + case 'GLSImportFromWinExpe': + $params['orderStateImport'] = Tools::getValue('id_order_state'); + break; + case 'GLSGetTickets': + $params['detailedExpeditionList'] = Tools::getValue('detailedExpeditionList'); + break; + case 'uninstallDetail': + $params['action'] = Tools::getValue('action'); + break; + case 'GLSGetRelayPoint': + $params['id_carrier'] = Tools::getValue('id_carrier'); + $params['weight'] = Context::getContext()->cart->getTotalWeight(); + $params['id_address_delivery'] = Context::getContext()->cart->id_address_delivery; + break; + case 'addSelectedCarrierToDB': + $params['id_carrier'] = Tools::getValue('id_carrier'); + $params['id_cart'] = Context::getContext()->cart->id; + $params['id_customer'] = Context::getContext()->customer->id; + $params['id_gls_method'] = Tools::getValue('id_gls_method'); + $params['relayPointInfo'] = Tools::getValue('relayPointInfo'); + break; + default: +} + +// Try to instanciate the method object name and call the necessaries method +try +{ + if (class_exists($method, false)) + { + // $this is the current mondialrelay object loaded when use in BO. Use for perf + $obj = new $method($params, $mondialrelay); + + // Verify that the class implement correctly the interface + // Else use a Management class to do some ajax stuff + if (($obj instanceof IMondialRelayWSMethod)) + { + $obj->init(); + $obj->send(); + $result = $obj->getResult(); + } + unset($obj); + } + else if (($management = new GlsManagement($params)) && + method_exists($management, $method)) + $result = $management->{$method}(); + else + throw new Exception('Method Class : '.$method.' can\'t be found'); + unset($management); +} +catch(Exception $e) +{ + echo GLSTools::jsonEncode(array('other' => array('error' => array($e->getMessage())))); + exit(-1); +} +echo GLSTools::jsonEncode($result); +exit(0); diff --git a/modules/gls/ajaxFront.php b/modules/gls/ajaxFront.php new file mode 100644 index 00000000..e8eaf297 --- /dev/null +++ b/modules/gls/ajaxFront.php @@ -0,0 +1,93 @@ + +* @copyright 2007-2014 Addonline +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +*/ + + +/* + * File called by ajax. It's like a controller, you have to send the + * method name of the webservice and implement it. + * Each Name method allow to instanciate an object containing + * methods to manage correctly the data and name fields + */ + +// Clean displayed content for Admin ajax query +if (ob_get_contents()) ob_clean(); + +// Front Ajax query, need the front cookie and GLS class +// When it's back query, the PS core made the work +if (!defined('_PS_ADMIN_DIR_')) +{ + require_once(realpath(dirname(__FILE__).'/../../config/config.inc.php')); + require_once(realpath(dirname(__FILE__).'/../../init.php')); + require_once(dirname(__FILE__).'/gls.php'); +} + +$gls = new Gls(); + +// Can't use Tools at this time... Need to know if _PS_ADMIN_DIR_ has to be defined +$method = Tools::getValue('method'); + +$params = array(); +$result = array(); + +// Method name allow to instanciate his object to properly call the +// implemented interface method and do his job +switch($method) +{ + case 'getGLSRelayCarrierId': + break; + case 'getGLSRelayPointsForZipCode': + $params['zipcode'] = Tools::getValue('zipcode'); + $params['street'] = Tools::getValue('street'); + $params['city'] = Tools::getValue('city'); + break; + case 'getDefaultZipCode': + break; + case 'saveDeliveryDetails': + $params['name'] = Tools::getValue('name'); + $params['address'] = Tools::getValue('address'); + $params['city'] = Tools::getValue('city'); + $params['zipcode'] = Tools::getValue('zipcode'); + $params['relayId'] = Tools::getValue('relayId'); + $params['phone'] = Tools::getValue('phone'); + $params['warnbyphone'] = Tools::getValue('warnbyphone'); + break; + case 'getChoosenRelay': + break; + case 'resetDeliveryDetails': + break; + default: + exit; +} + +// Try to instanciate the method object name and call the necessaries method +try +{ + if (method_exists($gls,$method)) + { + $result = call_user_func(array($gls,$method),$params); + } +} +catch(Exception $e) +{ + echo GLSTools::jsonEncode(array('other' => array('error' => array($e->getMessage())))); + exit(-1); +} + +echo GLSTools::jsonEncode($result); +exit(0); diff --git a/modules/gls/changelog.txt b/modules/gls/changelog.txt new file mode 100644 index 00000000..abb8f949 --- /dev/null +++ b/modules/gls/changelog.txt @@ -0,0 +1,89 @@ +version 1.1.2 +14/07/2015 : - Ajout du test d'existence de la table avant l'import des agences + - Correction de l'affichage d'erreurs avec ajout pour les points relais + +version 1.1.1 +29/05/2015 : - Mise en place du contact lors de l'export des commandes livrées en Express + +27/05/2015 : - Ajout du mode de transport Express + - Corrections de standards prestashop + +01/04/2015 : - Gestion de la creation de la table d'export, pour les mises à jour par écrasement de dossier + - Gestion de l'export lors d'installation prestashop en sous dossier + +version 1.1.0 +04/03/2015 : - Suppression de jQuery tools au profit de popupoverlay + +version 1.0.16 +30/12/2014 : - Ajout des messages d'erreurs du webservices + +version 1.0.15 +19/11/2014 : - Ajout du champ « société » dans l'export vers WINEXPE6 + - Mise en place de l'automatisation par cron + - Ajout du service « Livraison à domicile premium » + +version 1.0.14 +27/10/2014 : Utilisation de la version 3 de la google map + +version 1.0.13 +09/09/2014 : Correction de compatibilité avec la commande rapide +15/09/2014 : Envoi d'email de suivi lors de la mise à jour des commandes par import +16/09/2014 : prise en compte des chagement de poids de commande avant l'export +17/09/2014 : changement de l'unité de poids des commande exportées + +version 1.0.12 +23/07/2014 : Correction de compatibilité avec le module Mondial Relay + changement javascript des fonction live en on. + +version 1.0.11 +23/07/2014 : bug javascript, lorsqu'on est pas connecté en mode one page checkout + +version 1.0.10 +09/07/2014 : message de warning +09/07/2014 : template de configuration pour suppression d'une notice + +version 1.0.9 +12/06/2014 : poids sur les exports de commande ayant plusieurs fois le même produit + +version 1.0.8 +09/06/2014 : nom du module +09/06/2014 : Obligation de mettre un numéro de téléphone pourla livraison en point relais + +version 1.0.7 +02/06/2014 : Gestion de la répartition des caractères de l'adresse sur plusieurs ligne de 35 caractères + +version 1.0.6 +21/05/2014 : Rajout de sécurités sur le chargement de la carte Google +20/05/2014 : Correction d'un bug aléatoire sur la carte sous FF +16/05/2014 : Adaptation pour la compatibilité avec le module de point de fidélité +13/05/2014 : Placement de la société dans le champs street 1 + +version 1.0.5 +28/04/2014 : Correction de l'export des commandes à la racine du module +28/04/2014 : Correction du non blocage du tunnel lors de la non sélection d'un relais GLS + +version 1.0.4 +24/04/2014 : Mise à jour de la documentation +22/04/2014 : Mise en place de la case à cocher pour la configuration des zones ou non à l'installation + +version 1.0.3 +11/04/2014 : Mise à jour pour la compatibilité prestashop 1.6 dans le BO +11/04/2014 : Suppression d'informations persistantes à la désinstallation du module +07/04/2014 : Correction d'un dysfontionnement de l'affichage du relais choisi + +version 1.0.2 +07/04/2014 : Correction d'un problème de structure de table GLS +01/04/2014 : Limitation du poids des relais XL + +version 1.0.1 +24/03/2014 : Correction du non ajout des transporteurs à la première installation +24/03/2014 : Correction de l'affichage du overlay GLS sur prestashop 1.6 +24/03/2014 : Gestion de la version 1.6 de prestashop dans le javascript du module GLS +20/03/2014 : Affichage du prix de la commande même non payé dans le module GLS + +version 1.0.0 +19/03/2014 : Mise en place du changement de status pour l'import des commandes +18/03/2014 : Enregistrement de plusieurs numéro de tracking pour la même commande +04/03/2014 : Suppression du Product number lorsde l'export des commande livré à domicile +04/03/2014 : Etre prévenu par SMS coché par défaut, et récupération du numéro de téléphone mobile de l'adresse de facturation +14/02/2014 : Implémentation de l'import des commandes +13/02/2014 : Implémentation de l'export des commandes \ No newline at end of file diff --git a/modules/gls/classes/GLSManagement.php b/modules/gls/classes/GLSManagement.php new file mode 100644 index 00000000..b93360c0 --- /dev/null +++ b/modules/gls/classes/GLSManagement.php @@ -0,0 +1,489 @@ + + * @copyright 2007-2014 Addonline + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +require_once(dirname(__FILE__) . '/../gls.php'); + +class GlsManagement extends Gls { + + private $_params = array(); + private $_filename = ''; + private $_resultList = array( + 'error' => array(), + 'success' => array()); + private $_aProductnoCorrespondance = array( + 'BP' => '02', + 'BP_international' => '01', + 'ADO' => '18', + 'ADO_international' => '19', + 'SHD' => '17', + 'EXP' => '16' + ); + + public function __construct($params) { + $this->_params = $params; + + parent::__construct(); + } + + public function __destruct() { + + } + + public function uninstallDetail() { + $html = ''; + + switch ($this->_params['action']) { + case 'showFancy': + $html .= ' +
+

' . $this->l('Uninstalling Gls') . '

+
+ ' . $this->l('You\'re about to uninstall the module, do you want to remove the database') . ' ? +

+ +
+ +
+ +
+

+
+
+ '; + $this->_resultList['html'] = $html; + break; + case 'backupAndUninstall': + + break; + default: + } + return $this->_resultList; + } + + public function GLSexportToWinExpe() { + + /* + * Csv export configuration + */ + $delimiter = ';'; + $encloser = '"'; + $this->_filename = 'GlsCmd_' . $this->udate('YmdHisu') . '.csv'; + + /* + * Get the export Folder + */ + $glsConfiguration = Gls::getAccountDetail(); + ($glsConfiguration['GLS_EXPORT_FOLDER']) ? $exportFolder = _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . $glsConfiguration['GLS_EXPORT_FOLDER'] : $exportFolder = dirname(__FILE__) . '/../export/'; + + (is_array($this->_params["orderIdList"])) ? $orderIdLists = implode(',', $this->_params["orderIdList"]) : $orderIdLists = ''; + + $aWeightList = array(); + if (is_array($this->_params["weightList"]) && count($this->_params["weightList"]) > 0) { + foreach ($this->_params["weightList"] as $weight) { + $aTemp = explode('-', $weight); + $aWeightList[$aTemp[1]] = $aTemp[0]; + } + } + + if ($orderIdLists && $orderIdLists != '') { + + $query = ' + SELECT o.id_order,daddress.lastname, daddress.firstname,daddress.address1,daddress.address2,daddress.postcode,daddress.city,daddress.phone,carrier.external_module_name,SUM(od.product_weight*od.product_quantity) as order_weight,customer.id_customer,customer.email,gls.relay_warnbyphone,gls.relay_phone,country.iso_code,gls.relay_id,daddress.company,daddress.phone_mobile + FROM `' . _DB_PREFIX_ . 'orders` o + LEFT JOIN `' . _DB_PREFIX_ . 'address` daddress ON (o.id_address_delivery = daddress.id_address) + LEFT JOIN `' . _DB_PREFIX_ . 'order_detail` od ON (o.id_order = od.id_order) + LEFT JOIN `' . _DB_PREFIX_ . 'carrier` carrier ON (o.id_carrier = carrier.id_carrier) + LEFT JOIN `' . _DB_PREFIX_ . 'customer` customer ON (o.id_customer = customer.id_customer) + LEFT JOIN `' . _DB_PREFIX_ . 'GLS_delivery_info` gls ON (o.id_customer = gls.id_customer AND o.id_cart = gls.id_cart) + LEFT JOIN `' . _DB_PREFIX_ . 'country` country ON (daddress.id_country = country.id_country) + WHERE o.id_order in(' . $orderIdLists . ') + GROUP BY o.id_order + ;'; + } else { + $query = ' + SELECT o.id_order,daddress.lastname, daddress.firstname,daddress.address1,daddress.address2,daddress.postcode,daddress.city,daddress.phone,carrier.external_module_name,SUM(od.product_weight*od.product_quantity) as order_weight,customer.id_customer,customer.email,gls.relay_warnbyphone,gls.relay_phone,country.iso_code,gls.relay_id,daddress.company,daddress.phone_mobile + FROM `' . _DB_PREFIX_ . 'orders` o + LEFT JOIN `' . _DB_PREFIX_ . 'address` daddress ON (o.id_address_delivery = daddress.id_address) + LEFT JOIN `' . _DB_PREFIX_ . 'order_detail` od ON (o.id_order = od.id_order) + LEFT JOIN `' . _DB_PREFIX_ . 'carrier` carrier ON (o.id_carrier = carrier.id_carrier) + LEFT JOIN `' . _DB_PREFIX_ . 'customer` customer ON (o.id_customer = customer.id_customer) + LEFT JOIN `' . _DB_PREFIX_ . 'GLS_delivery_info` gls ON (o.id_customer = gls.id_customer AND o.id_cart = gls.id_cart) + LEFT JOIN `' . _DB_PREFIX_ . 'GLS_orders_import_export` gls_ie ON (o.id_order = gls_ie.id_order) + LEFT JOIN `' . _DB_PREFIX_ . 'country` country ON (daddress.id_country = country.id_country) + WHERE gls_ie.exported IS NULL + GROUP BY o.id_order + ;'; + } + + //On teste la requete afin de créer la table si elle n'existe pas + $aOrdersToExport = Db::getInstance()->executeS($query); + + if (!$aOrdersToExport) { + //Test de la présence de la table + if ($this->tableExists(_DB_PREFIX_ . 'GLS_orders_import_export')) { + return false; + } else { + $sql = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'GLS_orders_import_export` ( + `id_order` int(10) NOT NULL, + `imported` tinyint(1) NULL, + `exported` tinyint(1) NULL, + PRIMARY KEY (`id_order`) + ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; + Db::getInstance()->execute($sql); + + $aOrdersToExport = Db::getInstance()->executeS($query); + } + } + + if (!is_array($aOrdersToExport)) + $aOrdersToExport = array(); + + if (count($aOrdersToExport) <= 0) { + return $this->l('Error : No order to export'); + } + + $aOrdersExported = array(); + + // HEADERS of the file + $aheaders = array('ORDERID', 'ORDERNAME', 'PRODUCTNO', 'ORDERWEIGHTTOT', 'CONSID', 'CONTACT', 'CONTACTMAIL', 'CONTACTMOBILE', 'CONTACTPHONE', 'STREET1', 'STREET2', 'STREET3', 'COUNTRYCODE', 'CITY', 'ZIPCODE', 'REFPR'); + $aOrdersExported[] = $aheaders; + + // Parsing of the orders + foreach ($aOrdersToExport as $order) { + $aRow = array(); + + // ORDERID + $aRow[] = $order['id_order']; + + //Test s'il y a un nom de société + if ($order['company']) { + $aRow[] = $order['company']; + } else { + $aRow[] = mb_strtoupper($order['firstname'] . ' ' . $order['lastname'], 'UTF-8'); + } + + // PRODUCTNO + if ($order['external_module_name'] == 'gls') { + $shippingMethod = 'EXP'; + } else { + $shippingMethod = mb_strtoupper(Tools::substr($order['external_module_name'], 4, 3), 'UTF-8'); + } + + if (mb_strtoupper($order['iso_code'], 'UTF-8') != 'FR') { + $aRow[] = $this->_aProductnoCorrespondance[$shippingMethod . '_international']; + } else { + $aRow[] = $this->_aProductnoCorrespondance[$shippingMethod]; + } + + // ORDERWEIGHTTOT + if ($order['order_weight'] != $aWeightList[$order['id_order']]) { + $aRow[] = str_pad(number_format($aWeightList[$order['id_order']] / 1000, 2, '.', ''), 5, "0", STR_PAD_LEFT); + } else { + $aRow[] = str_pad(number_format($order['order_weight'], 2, '.', ''), 5, "0", STR_PAD_LEFT); + } + + // CONSID + $aRow[] = $order['id_customer']; + + // CONTACT + if ($order['company']) { + $aRow[] = mb_strtoupper($order['firstname'] . ' ' . $order['lastname'], 'UTF-8'); + } else { + if ($shippingMethod == 'EXP') { + /* If Shipping method is express, CONTACT field is always FIRSTNAME - LASTNAME */ + $aRow[] = mb_strtoupper($order['firstname'] . ' ' . $order['lastname'], 'UTF-8'); + } else { + $aRow[] = ''; + } + } + + // CONTACTMAIL + $aRow[] = $order['email']; + + // CONTACTMOBILE + if ($shippingMethod != 'SHD') { + $aRow[] = $order['phone_mobile']; + } else { + $aRow[] = $order['relay_warnbyphone'] ? $order['relay_phone'] : ''; + } + + // CONTACTPHONE + if (!$order['phone']) { + $aRow[] = $order['phone_mobile']; + } else { + $aRow[] = $order['phone']; + } + + if ($order['address1'] > 35 || Tools::strlen($order['address2']) > 35) { + $street = $order['address1'] . ' ' . $order['address2']; + $street = wordwrap($street, 35, ';', true); + $aStreet = explode(';', $street); + + // STREET1 + $aRow[] = mb_strtoupper(isset($aStreet[0]) ? $aStreet[0] : null, 'UTF-8'); + // STREET2 + $aRow[] = mb_strtoupper(isset($aStreet[1]) ? $aStreet[1] : null, 'UTF-8'); + } else { + // STREET1 + $aRow[] = mb_strtoupper($order['address1'], 'UTF-8'); + + // STREET2 + $aRow[] = mb_strtoupper($order['address2'], 'UTF-8'); + } + + // STREET3 + $aRow[] = ''; + + // COUNTRYCODE + $aRow[] = mb_strtoupper($order['iso_code'], 'UTF-8'); + + // CITY + $aRow[] = mb_strtoupper($this->stripAccents($order['city']), 'UTF-8'); + + // ZIPCODE + $aRow[] = mb_strtoupper($order['postcode'], 'UTF-8'); + + // REFPR (identifiant du point relais) + $aRow[] = $order['relay_id']; + + // Adding the order to the export array + $aOrdersExported[] = $aRow; + + if (!$orderIdLists == '') { + + $query = 'DELETE FROM `' . _DB_PREFIX_ . 'GLS_orders_import_export` WHERE `id_order` = ' . $order['id_order'] . ';'; + if (!Db::getInstance()->execute($query)) { + if (!$this->tableExists(_DB_PREFIX_ . 'GLS_orders_import_export')) { + $sql = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'GLS_orders_import_export` ( + `id_order` int(10) NOT NULL, + `imported` tinyint(1) NULL, + `exported` tinyint(1) NULL, + PRIMARY KEY (`id_order`) + ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; + Db::getInstance()->execute($sql); + + $query = 'DELETE FROM `' . _DB_PREFIX_ . 'GLS_orders_import_export` WHERE `id_order` = ' . $order['id_order'] . ';'; + Db::getInstance()->execute($query); + } else { + return false; + } + } + } + + $query = 'INSERT INTO `' . _DB_PREFIX_ . 'GLS_orders_import_export` (`id_order`, + `imported`, + `exported`) + VALUES + (' . $order['id_order'] . ', + 0, + 1);'; + + if (!Db::getInstance()->execute($query)) + return false; + } + + /* + * Save the file + */ + $writeCsv = $this->array2csv($aOrdersExported, $this->_filename, $delimiter, $encloser, $exportFolder); + ($writeCsv) ? $return = $writeCsv : $return = count($aOrdersExported) - 1 . ' ' . $this->l('orders exported'); + + return _PS_BASE_URL_ . __PS_BASE_URI__ . DIRECTORY_SEPARATOR . $glsConfiguration['GLS_EXPORT_FOLDER'] . DIRECTORY_SEPARATOR . $this->_filename; + } + + private function udate($format = 'u', $utimestamp = null) { + if (is_null($utimestamp)) + $utimestamp = microtime(true); + + $timestamp = floor($utimestamp); + $milliseconds = round(($utimestamp - $timestamp) * 1000000); + $milliseconds = Tools::substr($milliseconds, 0, 2); + return date(preg_replace('`(?message()); + } + foreach ($array as $row) { + //WINEXPE attends de l'ISO-8859-1 + foreach (array_keys($row) as $key) { + $row[$key] = iconv('UTF-8', 'ISO-8859-9', $row[$key]); + } + + fputcsv($df, $row, $delimiter, $encloser); + } + fclose($df); + return ob_get_clean(); + } + + public function GLSImportFromWinExpe() { + + + Configuration::updateValue('GLS_ORDER_STATE_IMPORT', $this->_params["orderStateImport"]); + + /* + * Get the import Folder + */ + $glsConfiguration = Gls::getAccountDetail(); + ($glsConfiguration['GLS_IMPORT_FOLDER']) ? $importFolder = _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . $glsConfiguration['GLS_IMPORT_FOLDER'] : $importFolder = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'import' . DIRECTORY_SEPARATOR; + + if (!file_exists($importFolder) and ! is_dir($importFolder)) { + return $importFolder . ' ' . $this->l('does not exist'); + } + + $dir = opendir($importFolder); + $count = 0; + + //Parcour du dossier + while ($file = readdir($dir)) { + if ($file != '.' && $file != '..' && !is_dir($importFolder . $file) && strpos($file, 'GlsWinExpe6_') !== FALSE) { + $aOrdersUpdated = array(); + // Parcour du fichier + if (($handle = fopen($importFolder . DIRECTORY_SEPARATOR . $file, "r")) !== FALSE) { + $row = 0; + while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) { + $num = count($data); + $row++; + if ($row > 1 && isset($data[4]) && $data[4]) { + // On récupère le champ 5 qui contient le numéro de la commande + // chargement de la commande + $order = new Order($data[4]); + + $id_order_carrier = Db::getInstance()->getValue('SELECT `id_order_carrier` FROM `' . _DB_PREFIX_ . 'order_carrier` WHERE `id_order` = ' . (int) $data[4]); + + //Si la commande n'existe pas + if (!$id_order_carrier) + continue; + + $order_carrier = new OrderCarrier($id_order_carrier); + + if (strpos($order_carrier->tracking_number, $data[17]) === false) { + if ($order_carrier->tracking_number) { + $order_carrier->tracking_number = $order_carrier->tracking_number . ',' . pSQL($data[17]); + } else { + $order_carrier->tracking_number = pSQL($data[17]); + } + $order_carrier->update(); + } + + // On met à jour le trackid avec le champ 18 + try { + if (strpos($order->shipping_number, $data[17]) === false) { + if ($order->shipping_number) { + $order->shipping_number .= ',' . $data[17]; + } else { + $order->shipping_number = $data[17]; + } + + $order->update(); + } + } catch (Exception $e) { + return $this->l('Order ') . $data[4] . ' ' . $this->l('has no shipping number in the import file '); + } + + try { + // Changement du status de la commande + $new_order_state = new OrderState($this->_params["orderStateImport"]); + $current_order_state = $order->getCurrentOrderState(); + if ($current_order_state->id != $new_order_state->id) { + // Create new OrderHistory + $history = new OrderHistory(); + $history->id_order = $order->id; + $history->id_order_state = $new_order_state->id; + + //Sauvegarde dans la base de donnée de l'import + $query = 'UPDATE `' . _DB_PREFIX_ . 'GLS_orders_import_export` set imported = 1 WHERE `id_order` = ' . $data[4] . ';'; + if (!Db::getInstance()->execute($query)) { + if (!$this->tableExists(_DB_PREFIX_ . 'GLS_orders_import_export')) { + $sql = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'GLS_orders_import_export` ( + `id_order` int(10) NOT NULL, + `imported` tinyint(1) NULL, + `exported` tinyint(1) NULL, + PRIMARY KEY (`id_order`) + ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; + Db::getInstance()->execute($sql); + + $query = 'DELETE FROM `' . _DB_PREFIX_ . 'GLS_orders_import_export` WHERE `id_order` = ' . $order['id_order'] . ';'; + Db::getInstance()->execute($query); + } else { + return false; + } + } + + $use_existings_payment = false; + if (!$order->hasInvoice()) + $use_existings_payment = true; + $history->changeIdOrderState((int) $new_order_state->id, $order, $use_existings_payment); + $history->addWithemail(true); + $history->save(); + } + } catch (Exception $e) { + Logger::addLog($e->getMessage()); + return $this->l('Order ') . $data[4] . ' ' . $this->l('No change of status '); + } + + $count++; + } + } + fclose($handle); + + try { + unlink($importFolder . DIRECTORY_SEPARATOR . $file); + } catch (Exception $e) { + return ("Import : unable to delete file : " . $importFolder . $file); + } + } + } + } + + closedir($dir); + return $count . ' ' . $this->l('orders imported'); + } + + public function stripAccents($string) { + return strtr($string, 'àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ', 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY'); + } + + public function tableExists($tableName) { + $tables = Db::getInstance()->executeS('SHOW TABLES'); + foreach ($tables as $key => $table) { + if ($table == $tableName) { + return true; + } + } + return false; + } + +} diff --git a/modules/gls/classes/GLSTools.php b/modules/gls/classes/GLSTools.php new file mode 100644 index 00000000..632a77d6 --- /dev/null +++ b/modules/gls/classes/GLSTools.php @@ -0,0 +1,261 @@ + +* @copyright 2007-2014 Addonline +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +*/ + +/* +** Some tools using used in the module +*/ +class GLSTools +{ + const REGEX_CLEAN_ADDR = '/[^a-zA-Z0-9-\s\'\!\,\|\(\)\.\*\&\#\/\:]/'; + + const REGEX_CLEAN_PHONE = '/[^0-9+\(\)]*/'; + + /** + * Check if a string could be UTF8 one + * + * @static + * @param $str + * @return bool + */ + public static function seemsUTF8($str) + { + $length = Tools::strlen($str); + + for($i = 0; $i < $length; $i++) + { + $c = ord($str[$i]); + if ($c < 0x80) + $n = 0; # 0bbbbbbb + else if (($c & 0xE0) == 0xC0) + $n = 1; # 110bbbbb + else if (($c & 0xF0) == 0xE0) + $n=2; # 1110bbbb + else if (($c & 0xF8) == 0xF0) + $n = 3; # 11110bbb + else if (($c & 0xFC) == 0xF8) + $n = 4; # 111110bb + else if (($c & 0xFE) == 0xFC) + $n=5; # 1111110b + else + return false; # Does not match any model + for ($j = 0; $j < $n; $j++) + { + # n bytes matching 10bbbbbb follow ? + if ((++$i == $length) || ((ord($str[$i]) & 0xC0) != 0x80)) + return false; + } + } + return true; + } + + /** + * Converts all accent characters to ASCII characters. + * + * If there are no accent characters, then the string given is just returned. + * + * @param string $string Text that might have accent characters + * @return string Filtered string with replaced "nice" characters. + */ + public static function removeAccents($string) + { + if (!preg_match('/[\x80-\xff]/', $string)) + return $string; + + if (GLSTools::seemsUTF8($string)) + { + $chars = array( + // Decompositions for Latin-1 Supplement + chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', + chr(195).chr(130) => 'A', chr(195).chr(131) => 'A', + chr(195).chr(132) => 'A', chr(195).chr(133) => 'A', + chr(195).chr(135) => 'C', chr(195).chr(136) => 'E', + chr(195).chr(137) => 'E', chr(195).chr(138) => 'E', + chr(195).chr(139) => 'E', chr(195).chr(140) => 'I', + chr(195).chr(141) => 'I', chr(195).chr(142) => 'I', + chr(195).chr(143) => 'I', chr(195).chr(145) => 'N', + chr(195).chr(146) => 'O', chr(195).chr(147) => 'O', + chr(195).chr(148) => 'O', chr(195).chr(149) => 'O', + chr(195).chr(150) => 'O', chr(195).chr(153) => 'U', + chr(195).chr(154) => 'U', chr(195).chr(155) => 'U', + chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y', + chr(195).chr(159) => 's', chr(195).chr(160) => 'a', + chr(195).chr(161) => 'a', chr(195).chr(162) => 'a', + chr(195).chr(163) => 'a', chr(195).chr(164) => 'a', + chr(195).chr(165) => 'a', chr(195).chr(167) => 'c', + chr(195).chr(168) => 'e', chr(195).chr(169) => 'e', + chr(195).chr(170) => 'e', chr(195).chr(171) => 'e', + chr(195).chr(172) => 'i', chr(195).chr(173) => 'i', + chr(195).chr(174) => 'i', chr(195).chr(175) => 'i', + chr(195).chr(177) => 'n', chr(195).chr(178) => 'o', + chr(195).chr(179) => 'o', chr(195).chr(180) => 'o', + chr(195).chr(181) => 'o', chr(195).chr(182) => 'o', + chr(195).chr(182) => 'o', chr(195).chr(185) => 'u', + chr(195).chr(186) => 'u', chr(195).chr(187) => 'u', + chr(195).chr(188) => 'u', chr(195).chr(189) => 'y', + chr(195).chr(191) => 'y', + // Decompositions for Latin Extended-A + chr(196).chr(128) => 'A', chr(196).chr(129) => 'a', + chr(196).chr(130) => 'A', chr(196).chr(131) => 'a', + chr(196).chr(132) => 'A', chr(196).chr(133) => 'a', + chr(196).chr(134) => 'C', chr(196).chr(135) => 'c', + chr(196).chr(136) => 'C', chr(196).chr(137) => 'c', + chr(196).chr(138) => 'C', chr(196).chr(139) => 'c', + chr(196).chr(140) => 'C', chr(196).chr(141) => 'c', + chr(196).chr(142) => 'D', chr(196).chr(143) => 'd', + chr(196).chr(144) => 'D', chr(196).chr(145) => 'd', + chr(196).chr(146) => 'E', chr(196).chr(147) => 'e', + chr(196).chr(148) => 'E', chr(196).chr(149) => 'e', + chr(196).chr(150) => 'E', chr(196).chr(151) => 'e', + chr(196).chr(152) => 'E', chr(196).chr(153) => 'e', + chr(196).chr(154) => 'E', chr(196).chr(155) => 'e', + chr(196).chr(156) => 'G', chr(196).chr(157) => 'g', + chr(196).chr(158) => 'G', chr(196).chr(159) => 'g', + chr(196).chr(160) => 'G', chr(196).chr(161) => 'g', + chr(196).chr(162) => 'G', chr(196).chr(163) => 'g', + chr(196).chr(164) => 'H', chr(196).chr(165) => 'h', + chr(196).chr(166) => 'H', chr(196).chr(167) => 'h', + chr(196).chr(168) => 'I', chr(196).chr(169) => 'i', + chr(196).chr(170) => 'I', chr(196).chr(171) => 'i', + chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', + chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', + chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', + chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', + chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', + chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', + chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', + chr(196).chr(186) => 'l', chr(196).chr(187) => 'L', + chr(196).chr(188) => 'l', chr(196).chr(189) => 'L', + chr(196).chr(190) => 'l', chr(196).chr(191) => 'L', + chr(197).chr(128) => 'l', chr(197).chr(129) => 'L', + chr(197).chr(130) => 'l', chr(197).chr(131) => 'N', + chr(197).chr(132) => 'n', chr(197).chr(133) => 'N', + chr(197).chr(134) => 'n', chr(197).chr(135) => 'N', + chr(197).chr(136) => 'n', chr(197).chr(137) => 'N', + chr(197).chr(138) => 'n', chr(197).chr(139) => 'N', + chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', + chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', + chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', + chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', + chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', + chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', + chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', + chr(197).chr(154) => 'S',chr(197).chr(155) => 's', + chr(197).chr(156) => 'S',chr(197).chr(157) => 's', + chr(197).chr(158) => 'S',chr(197).chr(159) => 's', + chr(197).chr(160) => 'S', chr(197).chr(161) => 's', + chr(197).chr(162) => 'T', chr(197).chr(163) => 't', + chr(197).chr(164) => 'T', chr(197).chr(165) => 't', + chr(197).chr(166) => 'T', chr(197).chr(167) => 't', + chr(197).chr(168) => 'U', chr(197).chr(169) => 'u', + chr(197).chr(170) => 'U', chr(197).chr(171) => 'u', + chr(197).chr(172) => 'U', chr(197).chr(173) => 'u', + chr(197).chr(174) => 'U', chr(197).chr(175) => 'u', + chr(197).chr(176) => 'U', chr(197).chr(177) => 'u', + chr(197).chr(178) => 'U', chr(197).chr(179) => 'u', + chr(197).chr(180) => 'W', chr(197).chr(181) => 'w', + chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y', + chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z', + chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z', + chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z', + chr(197).chr(190) => 'z', chr(197).chr(191) => 's', + // Euro Sign + chr(226).chr(130).chr(172) => 'E', + // GBP (Pound) Sign + chr(194).chr(163) => ''); + + $string = strtr($string, $chars); + } + else + { + // Assume ISO-8859-1 if not UTF-8 + $chars['in'] = chr(128).chr(131).chr(138).chr(142).chr(154).chr(158) + .chr(159).chr(162).chr(165).chr(181).chr(192).chr(193).chr(194) + .chr(195).chr(196).chr(197).chr(199).chr(200).chr(201).chr(202) + .chr(203).chr(204).chr(205).chr(206).chr(207).chr(209).chr(210) + .chr(211).chr(212).chr(213).chr(214).chr(216).chr(217).chr(218) + .chr(219).chr(220).chr(221).chr(224).chr(225).chr(226).chr(227) + .chr(228).chr(229).chr(231).chr(232).chr(233).chr(234).chr(235) + .chr(236).chr(237).chr(238).chr(239).chr(241).chr(242).chr(243) + .chr(244).chr(245).chr(246).chr(248).chr(249).chr(250).chr(251) + .chr(252).chr(253).chr(255); + + $chars['out'] = "EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy"; + + $double_chars = Array(); + $string = strtr($string, $chars['in'], $chars['out']); + $double_chars['in'] = array(chr(140), chr(156), chr(198), chr(208), chr(222), chr(223), chr(230), chr(240), chr(254)); + $double_chars['out'] = array('OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th'); + $string = str_replace($double_chars['in'], $double_chars['out'], $string); + } + return $string; + } + + // Add for 1.3 compatibility and avoid duplicate code + public static function jsonEncode($result) + { + return Tools::jsonEncode($result); + } + + /* + ** Fix security and compatibility for PS < 1.4.5 + */ + public static function bqSQL($string) + { + return str_replace('`', '\`', pSQL($string)); + } + + /* + ** Check zip code by country + */ + static public function checkZipcodeByCountry($zipcode, $params) + { + $id_country = $params['id_country']; + + $zipcodeFormat = Db::getInstance()->getValue(' + SELECT `zip_code_format` + FROM `'._DB_PREFIX_.'country` + WHERE `id_country` = '.(int)$id_country); + + // -1 to warn user that no layout exist + if (!$zipcodeFormat) + return -1; + + $regxMask = str_replace( + array('N', 'C', 'L'), + array( + '[0-9]', + Country::getIsoById((int)$id_country), + '[a-zA-Z]'), + $zipcodeFormat); + if (preg_match('/'.$regxMask.'/', $zipcode)) + return true; + return false; + } + + static public function getFormatedPhone($phone_number) + { + $begin = Tools::substr($phone_number, 0, 3); + $pad_number = (strpos($begin, '+3') !== false) ? 12 : + (strpos($begin, '00') ? 13 : 10); + + return str_pad(Tools::substr(preg_replace(GLSTools::REGEX_CLEAN_PHONE, '', $phone_number), 0, $pad_number), $pad_number, '0'); + } +} + +?> diff --git a/modules/gls/classes/index.php b/modules/gls/classes/index.php new file mode 100644 index 00000000..dc7351df --- /dev/null +++ b/modules/gls/classes/index.php @@ -0,0 +1,28 @@ + +* @copyright 2007-2014 Addonline +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; \ No newline at end of file diff --git a/modules/gls/config.xml b/modules/gls/config.xml new file mode 100644 index 00000000..4a40be85 --- /dev/null +++ b/modules/gls/config.xml @@ -0,0 +1,12 @@ + + + gls + + + + + + 1 + 1 + + \ No newline at end of file diff --git a/modules/gls/config_fr.xml b/modules/gls/config_fr.xml new file mode 100644 index 00000000..8af729a7 --- /dev/null +++ b/modules/gls/config_fr.xml @@ -0,0 +1,12 @@ + + + gls + + + + + + 1 + 1 + + \ No newline at end of file diff --git a/modules/gls/cron.php b/modules/gls/cron.php new file mode 100644 index 00000000..a3ec342e --- /dev/null +++ b/modules/gls/cron.php @@ -0,0 +1,14 @@ +GLSexportToWinExpe(); +$oGlsManagement->GLSImportFromWinExpe(); diff --git a/modules/gls/docs/index.php b/modules/gls/docs/index.php new file mode 100644 index 00000000..dc7351df --- /dev/null +++ b/modules/gls/docs/index.php @@ -0,0 +1,28 @@ + +* @copyright 2007-2014 Addonline +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; \ No newline at end of file diff --git a/modules/gls/docs/install.pdf b/modules/gls/docs/install.pdf new file mode 100644 index 00000000..d153af4b Binary files /dev/null and b/modules/gls/docs/install.pdf differ diff --git a/modules/gls/gls.php b/modules/gls/gls.php new file mode 100644 index 00000000..d8da5f4f --- /dev/null +++ b/modules/gls/gls.php @@ -0,0 +1,1338 @@ + + * @copyright 2007-2014 Addonline + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +if (!defined('_PS_VERSION_')) + exit; + +require_once(_PS_MODULE_DIR_ . 'gls/classes/GLSTools.php'); + +class Gls extends Module { + + private $_postErrors; + public static $modulePath = ''; + public static $moduleURL = ''; + static public $GLSFrontToken = ''; + static public $GLSBackToken = ''; + private $_WebServiceWSDLPath = 'http://www.gls-group.eu/276-I-PORTAL-WEBSERVICE/services/ParcelShopSearch/wsdl/2010_01_ParcelShopSearch.wsdl'; + + // SQL FILTER ORDER + const NO_FILTER = 0; + const WITHOUT_HOME_DELIVERY = 1; + + // Contains the details of the current shop used + public $account_shop = array( + 'GLS_WEBSERVICE_LOGIN' => '', + 'GLS_WEBSERVICE_PASSWORD' => '', +// 'GLS_WEIGHT_COEFFICIENT' => '', + 'GLS_EXPORT_FOLDER' => '', + 'GLS_IMPORT_FOLDER' => '', + 'GLS_ZONE_CONFIGURATION' => '', + 'GLS_EXPRESS_DELIVERY_AGENCY' => '', + 'GLS_INTERNATIONAL' => '', + 'GLS_ORDER_STATE' => 3, + 'GLS_ORDER_STATE_IMPORT' => 4, + 'GLS_SHD_ONLYXL' => 0, + 'id_shop' => 1 + ); + public $gls_carriers = array('bp' => array('name' => 'GLS Chez vous', 'delay' => 'Livraison à domicile en 24/48H', 'external' => 'gls_bp'), + 'ado' => array('name' => 'GLS Chez vous+', 'delay' => 'Pour + de flexibilité, vous êtes prévenus de la livraison. En cas d\'absence, choisissez où et quand vous souhaitez être livré', 'external' => 'gls_ado'), + 'mid' => array('name' => 'GLS Avant 13h', 'delay' => 'Livraison Express en mains propres le lendemain avant 13H', 'external' => 'gls'), + 'shd' => array('name' => 'GLS Point Relais', 'delay' => 'Retrait en Point Relais de votre choix', 'external' => 'gls_shd') + ); + public $GLS_ftp_address = 'ftp.gls-france.com'; + public $GLS_ftp_login = 'addonline'; + public $GLS_ftp_password = '-mAfXmTqC'; + public $GLS_filename_pattern = '/^tbzipdeltimes_(\d{8}).csv$/i'; + + public function __construct() { + + $this->name = 'gls'; + $this->tab = 'shipping_logistics'; + $this->version = '1.1.2'; + $this->installed_version = ''; + $this->module_key = '20e6ab0adbab7496ea5c637c4731a4bf'; + $this->author = 'Jetpulp'; + + parent::__construct(); + + $this->displayName = $this->l('GLS'); + $this->description = $this->l('Deliver in Relay points'); + + self::initModuleAccess(); + + // Call everytime to prevent the change of the module by a recent one + $this->initAccount(); + + // Check if it's a gls ajax query + $this->checkAJAX(); + + //Vérifie si on a des nouveaux points de nouvelles agences + $this->importAgenciesZipcode(); + } + + public function install() { + if (!parent::install()) + return false; + + if (!$this->registerHookByVersion()) + return false; + + //ADMINTAB DESACTIVE + $result = Db::getInstance()->getRow(' + SELECT id_tab + FROM `' . _DB_PREFIX_ . 'tab` + WHERE class_name="AdminGls"'); + + if (!$result) { + $tab = new Tab(); + $languages = Language::getLanguages(false); + foreach ($languages as $language) + $tab->name[$language['id_lang']] = 'GLS'; + $tab->class_name = 'AdminGls'; + $tab->module = 'gls'; + $tab->id_parent = Tab::getIdFromClassName('AdminParentOrders'); + + if (!$tab->add()) + return false; + + if (is_dir(_PS_MODULE_DIR_ . 'gls/')) + @copy(_PS_MODULE_DIR_ . 'gls/AdminGls.gif', _PS_IMG_DIR_ . '/AdminGls.gif'); + } + + // If module isn't installed, set default value + if (!Configuration::get('GLS')) { + Configuration::updateValue('GLS', $this->version); + Configuration::updateValue('GLS_SECURE_KEY', md5(time() . rand(0, 10))); + } + + $result = $this->addShippingMethod('bp'); + $result = $this->addShippingMethod('ado'); + $result = $this->addShippingMethod('mid'); + $result = $this->addShippingMethod('shd'); + + //Creation des tables + $sql = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'GLS_delivery_info` ( + `id_cart` int(10) NOT NULL, + `id_customer` int(10) NOT NULL, + `relay_name` varchar(64) NOT NULL, + `relay_address` text NOT NULL, + `relay_zipcode` text(10) NOT NULL, + `relay_town` varchar(64) NOT NULL, + `relay_phone` varchar(25) NULL, + `relay_warnbyphone` tinyint(1) NULL, + `relay_id` VARCHAR(64) NOT NULL, + PRIMARY KEY (`id_cart`,`id_customer`) + ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; + + if (!Db::getInstance()->execute($sql)) + return false; + + $sql = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'GLS_orders_import_export` ( + `id_order` int(10) NOT NULL, + `imported` tinyint(1) NULL, + `exported` tinyint(1) NULL, + PRIMARY KEY (`id_order`) + ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; + + if (!Db::getInstance()->execute($sql)) + return false; + + return true; + } + + /* + * * Return the token depend of the type + */ + + static public function getToken($type = 'front') { + return ($type == 'front') ? Gls::$GLSFrontToken : (($type == 'back') ? + Gls::$GLSBackToken : NULL); + } + + /* + * * Register hook depending of the Prestashop version used + */ + + private function registerHookByVersion() { + if (_PS_VERSION_ >= '1.3' && + (!$this->registerHook('extraCarrier') || + !$this->registerHook('updateCarrier') || + !$this->registerHook('newOrder') || + !$this->registerHook('BackOfficeHeader') || + !$this->registerHook('newOrder') || + !$this->registerHook('header'))) + return false; + + if (_PS_VERSION_ >= '1.4' && + (!$this->registerHook('processCarrier') || + !$this->registerHook('orderDetail') || + !$this->registerHook('orderDetailDisplayed') || + !$this->registerHook('newOrder') || + !$this->registerHook('paymentTop'))) + return false; + + if (_PS_VERSION_ >= '1.5' && + (!$this->registerHook('beforeCarrier') || !$this->registerHook('displayMobileHeader'))) + return false; + + + return true; + } + + public function uninstallCommonData() { + //ADMINTAB DESACTIVE + // Tab uninstall + if (($id_tab = Tab::getIdFromClassName('AdminGls'))) { + $tab = new Tab($id_tab); + $tab->delete(); + } + + // Récupération des identifiants des transporteurs GLS + $query = 'SELECT * from ' . _DB_PREFIX_ . 'carrier WHERE external_module_name like \'gls_%\';'; + $carriers = Db::getInstance()->executeS($query); + + // Suppression des informations persistantes + if (is_array($carriers)) { + foreach ($carriers as $carrier) { + $query = 'DELETE FROM ' . _DB_PREFIX_ . 'range_price WHERE id_carrier = ' . $carrier["id_carrier"] . ';'; + Db::getInstance()->execute($query); + $query = 'DELETE FROM ' . _DB_PREFIX_ . 'carrier_group WHERE id_carrier = ' . $carrier["id_carrier"] . ';'; + Db::getInstance()->execute($query); + $query = 'DELETE FROM ' . _DB_PREFIX_ . 'carrier_zone WHERE id_carrier = ' . $carrier["id_carrier"] . ';'; + Db::getInstance()->execute($query); + + $oCarrier = new Carrier($carrier["id_carrier"]); + if (Validate::isLoadedObject($oCarrier)) { + /* Get configuration values */ + $shipping_method = $oCarrier->getShippingMethod(); + $rangeTable = $oCarrier->getRangeTable(); + + $oCarrier->deleteDeliveryPrice($rangeTable); + } + } + } + + if (!Db::getInstance()->execute(' + UPDATE ' . _DB_PREFIX_ . 'carrier c + SET c.`deleted` = 1 + WHERE external_module_name like \'gls_%\'')) + return false; + + return true; + } + + public function uninstall() { + if (!parent::uninstall()) + return false; + + // Uninstall data that doesn't need to be keep + if (!$this->uninstallCommonData()) + return false; + + if (Tools::getValue('keepDatabase')) + return true; + + Configuration::deleteByName('GLS_ACCOUNT_DETAIL'); + + $sql = 'DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'GLS_delivery_info`;'; + + if (!Db::getInstance()->execute($sql)) + return false; + + $sql = 'DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'GLS_orders_import_export`;'; + + if (!Db::getInstance()->execute($sql)) + return false; + + return true; + } + + /* + * * #TODO #TODELETE unused method + * * OnClick for input fields under the module list fields action + */ + + public function onclickOption($type, $href = false) { + $content = ''; + + switch ($type) { + case 'desactive': + break; + case 'reset': + break; + case 'delete': + break; + case 'uninstall': + break; + default: + } + return $content; + } + + /** + * Init the account_shop variable with the account detail for this shop + */ + public function initAccount() { + if (($account_shop_stored = Gls::getAccountDetail())) + $this->account_shop = $account_shop_stored; + } + + /* + * * Init the access directory module for URL and file system + * * Allow a compatibility for Presta < 1.4 + */ + + public static function initModuleAccess() { + Gls::$modulePath = _PS_MODULE_DIR_ . 'gls/'; + Gls::$GLSFrontToken = sha1('gls' . _COOKIE_KEY_ . 'Front'); + Gls::$GLSBackToken = sha1('gls' . _COOKIE_KEY_ . 'Back'); + Gls::$moduleURL = __PS_BASE_URI__ . 'modules/gls/'; + } + + public function fetchTemplate($path, $name) { + if (_PS_VERSION_ < '1.4') + $this->context->smarty->currentTemplate = $name; + + return $this->context->smarty->fetch(dirname(__FILE__) . $path . $name . '.tpl'); + } + + public function hookNewOrder($params) { + $GLS_relayCarrierId = $this->getGLSRelayCarrierId(); + + if ($params['order']->id_carrier != $GLS_relayCarrierId['id_carrier']) + return; + $order = $params['order']; + $order->id_address_delivery = $this->isSameAddress((int) ($order->id_address_delivery), (int) ($order->id_cart), (int) ($order->id_customer)); + $order->update(); + } + + public function hookBackOfficeHeader() { + $this->context->smarty->assign(array( + 'GLS_token' => Gls::$GLSBackToken, + 'GLS_jQuery_overload_type' => true, + 'new_gls_base_dir' => Gls::$moduleURL, + 'GLS_local_path' => Gls::$modulePath, + 'ps_version' => Gls::$modulePath, + 'GLS_account_set' => Gls::isAccountSet() + )); + + /* Load JS & CSS files from the context ressources stacks. + * It does not work on BackOffice 1.5. For this specific case + * we load these ressources from the tpl script. */ + + if (_PS_VERSION_ < '1.6') { + $this->context->smarty->assign(array('ps_version' => '1.5')); + } else { + /* Insert jQuery if not already loaded */ + $this->context->controller->addJquery(); + /* Load custom CSS Files */ + $this->context->controller->addCSS($this->_path . 'views/css/style.css'); + /* Load custom JS Files */ + $this->context->controller->addJS($this->_path . 'views/js/gls.js'); + } + + return $this->display(__FILE__, 'bo-header.tpl'); + } + + /* Authorize or not the 24h delivery according to agency code and postcode */ + /* Returns either false (delivery denied) OR the delivery's cost */ + /* [Franck] */ + + public function getOrderShippingCost($params, $cost) { + + /* Retrieve customer's delivery address */ + $customer = new Customer($params->id_customer); + + $addresses = $customer->getAddresses($this->context->language->id); + $postcode = ''; + for ($i = 0; isset($addresses[$i]); $i++) { + if ($addresses[$i]['id_address'] == $params->id_address_delivery) { + $country = $addresses[$i]['country']; + $postcode = $addresses[$i]['postcode']; + } + } + + /* Get current agency code */ + $accountDetail = $this->getAccountDetail(); + + /* If not current agency code, return false */ + if (empty($accountDetail['GLS_EXPRESS_DELIVERY_AGENCY'])) { + return false; + } + + /* If delivery addr is not France, return false */ + if (strpos(strtolower($country), 'france') === false) { + return false; + } + + /* Get addresses range */ + $agenciesList = Db::getInstance()->getRow(' + SELECT zipcode_start, zipcode_end + FROM `' . _DB_PREFIX_ . 'GLS_agency_list`' + . 'WHERE `agencycode` = "' . $accountDetail['GLS_EXPRESS_DELIVERY_AGENCY'] . '" + AND zipcode_start <= ' . $postcode . ' and zipcode_end >= ' . $postcode . ''); + + /* If current agency code */ + if ($postcode > $agenciesList['zipcode_start'] && $postcode < $agenciesList['zipcode_end']) { + return $cost; + } + + return false; + } + + public function hookOrderDetail($params) { + if (!Gls::isGls($params['order']->id_carrier)) + return; + + $order = $params['order']; + + if (!empty($order->shipping_number)) + $this->context->smarty->assign('followup', $this->get_followup($order->shipping_number)); + } + + public function hookOrderDetailDisplayed($params) {} + + /* + * * Added to be used properly with OPC + */ + + public function hookHeader($params) { + + if (!($file = basename(Tools::getValue('controller')))) + $file = str_replace('.php', '', basename($_SERVER['SCRIPT_NAME'])); + + Gls::$moduleURL = __PS_BASE_URI__ . 'modules/gls/'; + + if (in_array($file, array('order-opc', 'order', 'orderopc'))) { + $this->context->controller->addCSS($this->_path . 'views/css/style.css'); + $this->context->controller->addCSS($this->_path . 'views/css/gls.css'); + + $this->context->controller->addJS($this->_path . 'views/js/jquery.popupoverlay.js'); + $this->context->controller->addJS('https://maps.google.com/maps/api/js?sensor=false&v=3'); + $this->context->controller->addJS($this->_path . 'views/js/glsFront.js'); + $this->context->controller->addJS($this->_path . 'translations/translate_' . $this->context->language->iso_code . '.js'); + + $this->context->smarty->assign( + array( + 'one_page_checkout' => (Configuration::get('PS_ORDER_PROCESS_TYPE') ? Configuration::get('PS_ORDER_PROCESS_TYPE') : 0), + 'warning_message' => $this->l('You need to select a dropp-off point before going to the next step.'), + 'new_gls_base_dir' => Gls::$moduleURL, + 'GLS_local_path' => Gls::$modulePath, + 'GLSToken' => Gls::$GLSFrontToken, + 'GLS_overload_current_jquery' => false + ) + ); + return $this->display(__FILE__, 'header.tpl'); + } + return ''; + } + + public function hookDisplayMobileHeader($params) { + + if (!($file = basename(Tools::getValue('controller')))) + $file = str_replace('.php', '', basename($_SERVER['SCRIPT_NAME'])); + + if (in_array($file, array('order-opc', 'order', 'orderopc'))) { + $this->context->smarty->assign( + array( + 'one_page_checkout' => (Configuration::get('PS_ORDER_PROCESS_TYPE') ? Configuration::get('PS_ORDER_PROCESS_TYPE') : 0), + 'warning_message' => $this->l('You need to select a dropp-off point before going to the next step.'), + 'new_gls_base_dir' => Gls::$moduleURL, + 'GLS_local_path' => Gls::$modulePath, + 'GLSToken' => Gls::$GLSFrontToken, + 'GLS_overload_current_jquery' => false + ) + ); + return $this->display(__FILE__, 'header-mobile.tpl'); + } + return ''; + } + + public function hookExtraCarrier($params) { + + // TODO : Makes it work with multi-shipping + if (!Gls::isAccountSet()) + return $this->display(__FILE__, 'checkout_process_errors.tpl'); + + $id_carrier = false; + $address = new Address($this->context->cart->id_address_delivery); + $id_zone = Address::getZoneById((int) ($address->id)); + + + if (_PS_VERSION_ >= '1.5') + $id_carrier = (int) $this->context->cart->id_carrier; + + $this->context->smarty->assign( + array( + 'GLS_Data' => array( + 'PS_VERSION' => _PS_VERSION_ + ) + ) + ); + + return $this->display(__FILE__, 'checkout_process.tpl'); + } + + public function hookBeforeCarrier($params) { + + if (strpos(get_class($this->context->controller), 'Opc') !== false) { + return $this->hookExtraCarrier($params); + } else { + return false; + } + } + + /** + * Return the detailed account + * + * @static + * @return mixed + */ + public static function getAccountDetail() { + return unserialize(Configuration::get('GLS_ACCOUNT_DETAIL')); + } + + /** + * Check if the account is set + * + * @static + * @return bool + */ + public static function isAccountSet() { + $details = Gls::getAccountDetail(); + $accountDetailsExceptions = array('GLS_SHD_ONLYXL' => '1', 'GLS_EXPORT_FOLDER' => '1', 'GLS_IMPORT_FOLDER' => '1', 'GLS_ZONE_CONFIGURATION' => '1', 'GLS_INTERNATIONAL' => '1', 'GLS_ORDER_STATE_IMPORT' => '1', 'GLS_EXPRESS_DELIVERY_AGENCY' => '1'); + + if (!$details || !count($details)) { + return false; + } + + foreach ($details as $name => $value) { + if (empty($value) && !isset($accountDetailsExceptions[$name])) { + return false; + } + } + return true; + } + + /** + * Check any submitted form + */ + private function _postValidation() { + // Account settings form validation + if (Tools::isSubmit('submit_account_detail')) { + if (Tools::getValue('GLS_webservice_login') == '') + $this->_postErrors[] = $this->l('Invalid Login'); + if (Tools::getValue('GLS_webservice_password') == '') + $this->_postErrors[] = $this->l('Invalid Password'); + } + + // Order state form validation + else if (Tools::isSubmit('submit_order_state')) { + if (!Validate::isUnsignedInt(Tools::getValue('id_order_state'))) + $this->_postErrors[] = $this->l('Invalid order state'); + } + } + + /** + * Update account shop + * + * @return bool + */ + public function updateAccountShop() { + return Configuration::updateValue('GLS_ACCOUNT_DETAIL', serialize($this->account_shop)); + } + + /** + * Post process + * + * @return array + */ + private function _postProcess() { + $post_action = array( + 'type' => Tools::getValue('GLS_tab_name'), + 'message_success' => $this->l('Action Succeed'), + 'had_errors' => false + ); + + if (Tools::isSubmit('submit_account_detail')) { + $this->account_shop = array( + 'GLS_WEBSERVICE_LOGIN' => Tools::getValue('GLS_webservice_login'), + 'GLS_WEBSERVICE_PASSWORD' => Tools::getValue('GLS_webservice_password'), + 'GLS_SHD_ONLYXL' => Tools::getValue('GLS_SHD_ONLYXL'), +// 'GLS_WEIGHT_COEFFICIENT' => Tools::getValue('GLS_weight_coefficient'), + 'GLS_EXPORT_FOLDER' => Tools::getValue('GLS_export_folder'), + 'GLS_IMPORT_FOLDER' => Tools::getValue('GLS_import_folder'), + 'GLS_ZONE_CONFIGURATION' => Tools::getValue('GLS_zone_configuration'), + 'GLS_EXPRESS_DELIVERY_AGENCY' => Tools::getValue('GLS_express_delivery_agency'), + 'GLS_INTERNATIONAL' => Tools::getValue('GLS_international'), + 'id_shop' => $this->context->shop->id, + 'GLS_ORDER_STATE' => (int) $this->account_shop['GLS_ORDER_STATE'], + 'GLS_ORDER_STATE_IMPORT' => (int) $this->account_shop['GLS_ORDER_STATE_IMPORT'], + ); + + if ($this->updateAccountShop()) { + //TODO : tester les identifiants (appel WS ?) et activer les transporteur si OK + if (Tools::getValue('GLS_zone_configuration')) { + $this->addDefaultCarrierValue($this->getIdCarrierFromMethod('bp'), 'bp'); + $this->addDefaultCarrierValue($this->getIdCarrierFromMethod('shd'), 'shd'); + $this->setFranceZoneToAllCarriers(); + + $sqlZone = 'SELECT id_zone FROM ' . _DB_PREFIX_ . 'zone WHERE name like \'%France%\''; + $zoneFranceId = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sqlZone); + + $this->addDeliveryPrices($this->getIdCarrierFromMethod('bp'), $zoneFranceId); + $this->addDeliveryPrices($this->getIdCarrierFromMethod('shd'), $zoneFranceId); + } + + if (Tools::getValue('GLS_express_delivery_agency')) { + + /* #Franck - Check if 24h delivery carrier exists */ + if (!$this->carrierExists('mid')) { + /* If not we add it */ + $this->addCarrier('mid'); + } + + //Creation de la table des agences pour la livraison express + if (!$this->tableExists(_DB_PREFIX_ . 'GLS_agency_list')) { + $sql = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'GLS_agency_list` ( + `id_agency_entry` int(10) NOT NULL AUTO_INCREMENT, + `agencycode` varchar(255) NULL, + `zipcode_start` int(5) NULL, + `zipcode_end` int(5) NULL, + `validity_date_start` varchar(20) NULL, + `validity_date_end` varchar(20) NULL, + `last_import_date` varchar(20) NULL, + `last_check_date` varchar(20) NULL, + PRIMARY KEY (`id_agency_entry`) + ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; + Db::getInstance()->execute($sql); + } + + //Déclenchement de la récupération des codes postaux par agence en force update + $this->importAgenciesZipcode(); + } + + $post_action['message_success'] = $this->l('Account detail has been updated'); + } else { + $this->_postErrors[] = $this->l('Cannot Update the account shop'); + } + } else if (Tools::isSubmit('submit_order_state')) { + Configuration::updateValue('GLS_ORDER_STATE', Tools::getValue('id_order_state')); + $post_action['message_success'] = $this->l('Order state properly changed'); + } + + if (count($this->_postErrors)) + $post_action['had_errors'] = true; + + return $post_action; + } + + public function getContent() { + $post_action = NULL; + if (!empty($_POST)) { + $this->_postValidation(); + if (!sizeof($this->_postErrors)) + $post_action = $this->_postProcess(); + } + + $controller = (_PS_VERSION_ < '1.5') ? 'AdminContact' : 'AdminStores'; + + // TODO : Fill an array with admi controller name + $this->context->smarty->assign(array( + 'GLS_token_admin_performance' => Tools::getAdminToken('AdminPerformance' . (int) (Tab::getIdFromClassName('AdminPerformance')) . (int) ($this->context->cookie->id_employee)), + 'GLS_token_admin_carriers' => Tools::getAdminToken('AdminCarriers' . (int) (Tab::getIdFromClassName('AdminCarriers')) . (int) $this->context->employee->id), + 'GLS_token_admin_contact' => array( + 'controller_name' => $controller, + 'token' => Tools::getAdminToken($controller . (int) (Tab::getIdFromClassName($controller)) . (int) $this->context->employee->id)), + 'GLS_token_admin_gls' => Tools::getAdminToken('AdminGls' . (int) (Tab::getIdFromClassName('AdminGls')) . (int) $this->context->employee->id), + 'GLS_token_admin_module' => Tools::getAdminToken('AdminModules' . (int) (Tab::getIdFromClassName('AdminModules')) . (int) $this->context->employee->id), + 'GLS_webservice_login' => Tools::getValue('GLS_webservice_login') ? Tools::getValue('GLS_webservice_login') : $this->account_shop['GLS_WEBSERVICE_LOGIN'], + 'GLS_webservice_password' => Tools::getValue('GLS_webservice_password') ? Tools::getValue('GLS_webservice_password') : $this->account_shop['GLS_WEBSERVICE_PASSWORD'], + 'GLS_SHD_ONLYXL' => Tools::getValue('GLS_SHD_ONLYXL') ? Tools::getValue('GLS_SHD_ONLYXL') : $this->account_shop['GLS_SHD_ONLYXL'], + //'GLS_weight_coefficient' => Tools::getValue('GLS_weight_coefficient') ? Tools::getValue('GLS_weight_coefficient') : $this->account_shop['GLS_WEIGHT_COEFFICIENT']?$this->account_shop['GLS_WEIGHT_COEFFICIENT']:'1000', + 'GLS_export_folder' => Tools::getValue('GLS_export_folder') ? Tools::getValue('GLS_export_folder') : $this->account_shop['GLS_EXPORT_FOLDER'] ? $this->account_shop['GLS_EXPORT_FOLDER'] : 'modules/gls/export', + 'GLS_import_folder' => Tools::getValue('GLS_import_folder') ? Tools::getValue('GLS_import_folder') : $this->account_shop['GLS_IMPORT_FOLDER'] ? $this->account_shop['GLS_IMPORT_FOLDER'] : 'modules/gls/import', + 'GLS_zone_configuration' => Tools::getValue('GLS_zone_configuration') ? Tools::getValue('GLS_zone_configuration') : $this->account_shop['GLS_ZONE_CONFIGURATION'] ? $this->account_shop['GLS_ZONE_CONFIGURATION'] : '0', + 'GLS_express_delivery_agency' => Tools::getValue('GLS_express_delivery_agency') ? Tools::getValue('GLS_express_delivery_agency') : $this->account_shop['GLS_EXPRESS_DELIVERY_AGENCY'], + 'GLS_international' => Tools::getValue('GLS_international') ? Tools::getValue('GLS_international') : $this->account_shop['GLS_INTERNATIONAL'] ? $this->account_shop['GLS_INTERNATIONAL'] : '0', + 'GLS_PS_WEIGHT_UNIT' => Configuration::get('PS_WEIGHT_UNIT'), + 'GLS_order_states_list' => OrderState::getOrderStates($this->context->language->id), + 'GLS_ORDER_STATE' => (int) $this->account_shop['GLS_ORDER_STATE'], + 'GLS_ORDER_STATE_IMPORT' => (int) $this->account_shop['GLS_ORDER_STATE_IMPORT'], + 'GLS_CRON_URL' => Tools::getHttpHost(true, true) . _MODULE_DIR_ . $this->name . '/cron.php?secure_key=' . Configuration::get('GLS_SECURE_KEY'), + 'GLS_name' => Tools::getValue('GLS_name') ? Tools::getValue('GLS_name') : '', + 'GLS_error_list' => $this->_postErrors, + 'GLS_form_action' => $post_action, + 'GLS_PS_ADMIN_IMG_' => _PS_ADMIN_IMG_, + 'GLS_delay' => Tools::getValue('GLS_delay') ? Tools::getValue('GLS_delay') : '', + 'GLS_local_path' => Gls::$modulePath, + 'GLS_unit_weight_used' => Configuration::get('PS_WEIGHT_UNIT'), + 'GLS_account_set' => Gls::isAccountSet(), + 'GLS_base_dir' => Gls::$moduleURL) + ); + + return $this->display(__FILE__, 'configure.tpl'); + } + + /** + * #Franck - Check if carrier already exists + */ + private function carrierExists($id_gls_method) { + $carriers = Db::getInstance()->executeS(' + SELECT * FROM ' . _DB_PREFIX_ . 'carrier + WHERE `deleted`="0" AND `external_module_name`="' . $this->gls_carriers[$id_gls_method]['external'] . '"'); + + if (isset($carriers[0]['id_carrier'])) { + return true; + } + + return false; + } + + /** + * Add new carrier + * + * @param $name + * @param $delay + * @return bool|int + */ + private function addCarrier($id_gls_method) { + $ret = false; + + $name = $this->gls_carriers[$id_gls_method]['name']; + $delay = $this->gls_carriers[$id_gls_method]['delay']; + $external = $this->gls_carriers[$id_gls_method]['external']; + + if (($carrier = new Carrier())) { + $delay_lang = array(); + foreach (Language::getLanguages(false) as $lang) + $delay_lang[$lang['id_lang']] = $delay; + + $carrier->name = $name; + $carrier->active = 0; + $carrier->delay = $delay_lang; + $carrier->grade = 5; + $carrier->url = 'https://gls-group.eu/FR/fr/suivi-colis?match=@'; + $carrier->shipping_method = 2; //Choix de la tranche en fonction du prix + $carrier->range_behavior = 1; //comportement hors tranche : désactiver + /* Set Shipping_external true ONLY for 24h delivery */ + $carrier->shipping_external = !empty($external) && $external == 'gls' ? 1 : 0; + $carrier->max_weight = 30; //Poids maximum des paquets de 30kg + + $carrier->need_range = 1; + $carrier->external_module_name = $external; + $carrier->is_module = (_PS_VERSION_ < '1.4') ? 0 : 1; + + $ret = $carrier->add(); + } + return $ret ? $carrier->id : false; + } + + public function displayInfoByCart($id_cart) {} + + /** + * Set necessaries values to the created carrier + * + * @param $id_carrier + * @param $dlv_mode + * @return bool + */ + private function addDefaultCarrierValue($id_carrier, $id_gls_method) { + + // Set a range price + if (!Db::getInstance()->execute( + 'INSERT INTO `' . _DB_PREFIX_ . 'range_price` + (`id_carrier`, `delimiter1`, `delimiter2`) + VALUES (' . (int) $id_carrier . ', 0.000000, 10000.000000)')) { + $this->_postErrors[] = $this->l('Range price can\'t be added') . (int) $id_carrier; + return false; + } + + $range_price_id = Db::getInstance()->Insert_ID(); + + $groups = Group::getGroups(Configuration::get('PS_LANG_DEFAULT')); + foreach ($groups as $group) + if (!Db::getInstance()->execute( + 'INSERT INTO `' . _DB_PREFIX_ . 'carrier_group` + (id_carrier, id_group) + VALUES(' . (int) $id_carrier . ', ' . (int) ($group['id_group']) . ')')) { + $this->_postErrors[] = $this->l('Default zone can\'t be added'); + return false; + } + + // Set default zone FRANCE + $sqlZone = 'SELECT id_zone FROM ' . _DB_PREFIX_ . 'zone WHERE name like \'%France%\''; + $zoneFranceId = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sqlZone); + + if (!$zoneFranceId) { + //If This zone doesn't exits, we create it + if (!Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'zone` (name, active) VALUES (\'France\', 1)')) { + $this->_postErrors[] = $this->l('Carrier zone or delivery data can\'t be added'); + return false; + } + $zoneFranceId = Db::getInstance()->Insert_ID(); + if (!Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'zone_shop` VALUES (' . $zoneFranceId . ', ' . $this->context->shop->id . ')')) { + $this->_postErrors[] = $this->l('Carrier zone or delivery data can\'t be added'); + return false; + } + $countryFranceId = Country::getIdByName(null, 'France'); + if (!Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'country` SET id_zone = ' . $zoneFranceId . ' WHERE id_country = ' . $countryFranceId)) { + $this->_postErrors[] = $this->l('Carrier zone or delivery data can\'t be added'); + return false; + } + } + + // Set default zone + $zones = array(); + if ($id_gls_method != 'bp') { + $zones[] = array('id_zone' => $zoneFranceId); + } else { + $zones = Zone::getZones(); + } + foreach ($zones as $zone) { + if (!Db::getInstance()->execute( + 'INSERT INTO `' . _DB_PREFIX_ . 'carrier_zone` + (id_carrier, id_zone) + VALUES(' . (int) $id_carrier . ', ' . (int) ($zone['id_zone']) . ')') || + !Db::getInstance()->execute( + 'INSERT INTO `' . _DB_PREFIX_ . 'delivery` + (id_carrier, id_range_price, id_range_weight, id_zone, price) + VALUES(' . (int) $id_carrier . ', ' . (int) ($range_price_id) . ', NULL,' . (int) ($zone['id_zone']) . ', 0.00)')) { + $this->_postErrors[] = $this->l('Carrier zone or delivery data can\'t be added'); + return false; + } + } + + return true; + } + + /** + * Add new shipping method + * + * @return bool + */ + private function addShippingMethod($id_gls_method) { + if (!$id_gls_method && !isset($this->gls_carriers[$id_gls_method])) { + return false; + } + + if (!($id_carrier = Db::getInstance()->getValue( + 'SELECT `id_carrier` + FROM `' . _DB_PREFIX_ . 'carrier` + WHERE `external_module_name` = \'gls_' . $id_gls_method . '\''))) { + + // Insert new carrier for under Prestashop + if (!($id_carrier = $this->addCarrier($id_gls_method))) { + $this->_postErrors[] = $this->l('Carrier can\'t be created in PrestaShop'); + return false; + } + + // ajouter le logo, copier le logo (modules\gls\images\picto_toyou.png) dans le répertoire img/s avec comme non l'id du carrier + ImageManager::resize(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'gls' . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 'picto_' . $id_gls_method . '.png', _PS_IMG_DIR_ . 's' . DIRECTORY_SEPARATOR . $id_carrier . '.jpg', null, null, 'png'); + +// $this->addDefaultCarrierValue($id_carrier, $id_gls_method); + } else { + + // ajouter le logo, copier le logo (modules\gls\images\picto_toyou.png) dans le répertoire img/s avec comme non l'id du carrier + ImageManager::resize(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'gls' . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 'picto_' . $id_gls_method . '.png', _PS_IMG_DIR_ . 's' . DIRECTORY_SEPARATOR . $id_carrier . '.jpg', null, null, 'png'); + + Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'carrier` SET deleted=0 + WHERE `id_carrier` = ' . $id_carrier); +// $this->addDefaultCarrierValue($id_carrier, $id_gls_method); + } + + Configuration::updateValue('GLS_ID_CARRIER_' . $id_gls_method, $id_carrier); + + return; + } + + private function getIdCarrierFromMethod($id_gls_method) { + $id_carrier = Db::getInstance()->getValue( + 'SELECT `id_carrier` + FROM `' . _DB_PREFIX_ . 'carrier` + WHERE `external_module_name` = \'gls_' . $id_gls_method . '\''); + return $id_carrier; + } + + private function setFranceZoneToAllCarriers() { + // Récupération des identifiants des transporteurs non GLS + $query = 'SELECT * from ' . _DB_PREFIX_ . 'carrier WHERE external_module_name not like \'gls_%\' AND deleted = 0;'; + $carriers = Db::getInstance()->executeS($query); + + // Set default zone FRANCE + $sqlZone = 'SELECT id_zone FROM ' . _DB_PREFIX_ . 'zone WHERE name like \'%France%\''; + $zoneFranceId = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sqlZone); + + if ($zoneFranceId) { + foreach ($carriers as $carrier) { + $id_carrier_zone = Db::getInstance()->getValue( + 'SELECT `id_carrier` + FROM `' . _DB_PREFIX_ . 'carrier_zone` + WHERE `id_zone` = \'' . $zoneFranceId . '\' AND id_carrier = \'' . $carrier["id_carrier"] . '\''); + + if (!$id_carrier_zone) { + Db::getInstance()->execute( + 'INSERT INTO `' . _DB_PREFIX_ . 'carrier_zone` + (id_carrier, id_zone) + VALUES(' . (int) $carrier["id_carrier"] . ', ' . (int) ($zoneFranceId) . ')'); + } + + $this->addDeliveryPrices($carrier["id_carrier"], (int) ($zoneFranceId)); + } + } + } + + /** + * Get the followup url + * + * @param $exp_number + * @return mixed + */ + public function get_followup($exp_number) {} + + /** + * Get the SQL query to fetch order with gls carrier + * + * @static + * @param $id_order_state + * @param $weight_coefficient + * @return string + */ + public static function getBaseOrdersSQLQuery($id_order_state, $weight_coefficient = 1000) { + return 'SELECT o.`id_address_delivery` as id_address_delivery, + o.`id_order` as id_order, + o.`id_customer` as id_customer, + o.`id_cart` as id_cart, + o.`id_lang` as id_lang, + CONCAT(c.`firstname`, " ", c.`lastname`) AS `customer`, + o.`total_paid_tax_incl` as total, + o.`total_shipping` as shipping, + o.`date_add` as date, o.`id_currency` as id_currency, o.`id_lang` as id_lang, + oc.`weight` as weight, + ROUND(oc.`weight` * ' . (int) $weight_coefficient . ') AS "order_weight", + gls_info.`relay_name` as gls_Name, + gls_info.`relay_id` as GLS_Selected_Num + FROM `' . _DB_PREFIX_ . 'orders` o + LEFT JOIN `' . _DB_PREFIX_ . 'GLS_delivery_info` gls_info ON (gls_info.`id_cart` = o.`id_cart` AND gls_info.`id_customer` = o.`id_customer`) + LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON (c.`id_customer` = o.`id_customer`) + LEFT JOIN `' . _DB_PREFIX_ . 'order_carrier` oc ON (o.`id_order` = oc.`id_order`) + LEFT JOIN `' . _DB_PREFIX_ . 'carrier` ca ON (o.`id_carrier` = ca.`id_carrier` AND `external_module_name` like \'gls%\' ) + WHERE + ca.id_carrier is not null + AND (SELECT moh.`id_order_state` FROM `' . _DB_PREFIX_ . 'order_history` moh WHERE moh.`id_order` = o.`id_order` ORDER BY moh.`date_add` DESC LIMIT 1) = ' . (int) ($id_order_state); + } + + /** + * Get orders details to create Tickets + * + * @static + * @param array $orderIdList + * @param int $filterEntries + * @param int $weight_coefficient + * @return array + */ + public static function getOrders($orderIdList = array(), $filterEntries = Gls::NO_FILTER, $weight_coefficient = 1000) { + $account_shop = Gls::getAccountDetail(); + $id_order_state = $account_shop['GLS_ORDER_STATE']; + $sql = Gls::getBaseOrdersSQLQuery($id_order_state, $weight_coefficient); + + if (count($orderIdList)) { + $sql .= ' AND o.id_order IN ('; + foreach ($orderIdList as $id_order) + $sql .= (int) $id_order . ', '; + $sql = rtrim($sql, ', ') . ')'; + } + switch ($filterEntries) { + case Gls::WITHOUT_HOME_DELIVERY: + $sql .= 'AND gls.gls_ModeLiv != "LD1" AND gls.gls_ModeLiv != "LDS"'; + break; + } + $sql .= ' + GROUP BY o.`id_order` + ORDER BY o.`id_order` DESC;'; + + return Db::getInstance()->executeS($sql); + } + + /** + * Get GLS error code + * + * @param $code + * @return string + */ + public function getErrorCodeDetail($code) { + global $statCode; + + if (isset($statCode[$code])) + return $statCode[$code]; + return $this->l('This error isn\'t referred : ') . $code; + } + + /** + * @param $id_carrier + * @return mixed + */ + public function isGls($id_carrier) { + + return Db::getInstance()->getRow(' + SELECT `id_carrier` + FROM `' . _DB_PREFIX_ . 'carrier` + WHERE `id_carrier` = ' . (int) $id_carrier . ' AND external_module_name like \'gls_%\''); + } + + public function checkAJAX() { + // Avoid loop inclusion + static $is_included = false; + + // TODO : Find a way to use it on front + if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && Tools::strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') + if (Tools::getValue('glstoken') && !$is_included) { + $is_included = true; + include(dirname(__FILE__) . '/ajax.php'); + exit(0); + } + } + + public function getGLSRelayCarrierId() { + return Db::getInstance()->getRow(' + SELECT `id_carrier` + FROM `' . _DB_PREFIX_ . 'carrier` + WHERE `active` = 1 AND `deleted` = 0 AND `external_module_name` = \'gls_shd\''); + } + + public function getGLSRelayPointsForZipCode($params, $country = 'FR') { + + + $details = Gls::getAccountDetail(); + $login = $details['GLS_WEBSERVICE_LOGIN']; + $mdp = $details['GLS_WEBSERVICE_PASSWORD']; + + try { + $pointsRelaisWSService = new SoapClient($this->_WebServiceWSDLPath, array('trace' => 1)); + + $aParameters = array('Credentials' => array('UserName' => $login, 'Password' => $mdp), 'Address' => array( + 'Name1' => '', + 'Name2' => '', + 'Name3' => '', + 'Street1' => $params['street'], + 'BlockNo1' => '', + 'Street2' => '', + 'BlockNo2' => '', + 'ZipCode' => $params['zipcode'], + 'City' => $params['city'], + 'Province' => '', + 'Country' => $country) + ); + + $result = $pointsRelaisWSService->GetParcelShops($aParameters); + + $aDays = array('0' => $this->l('Monday'), '1' => $this->l('Tuesday'), '2' => $this->l('Wednesday'), '3' => $this->l('Thursday'), '4' => $this->l('Friday'), '5' => $this->l('Saturday'), '6' => $this->l('Sunday')); + + $productMaxWeight = 0; + foreach ($this->context->cart->getProducts(true) as $product) { + $weight = 0; + if (!isset($product['weight_attribute']) || is_null($product['weight_attribute'])) + $weight = $product['weight']; + else + $weight = $product['weight_attribute']; + + $productMaxWeight = (($productMaxWeight > $weight) ? $productMaxWeight : $weight); + } + $onlyxlrelay = $details['GLS_SHD_ONLYXL'] || ($productMaxWeight > 20); + + $listRelais = array(); + + + //Erreur de login/mot de passe + if ($result->exitCode->ErrorCode != 0) { + $this->context->smarty->assign(array( + 'GLS_error' => $result->exitCode->ErrorCode, + )); + return $this->display(__FILE__, 'listRelais.tpl'); + } else { + $this->context->smarty->assign(array( + 'GLS_error' => '', + )); + } + + foreach ($result->SearchResults as $pointRelais) { + if ($onlyxlrelay && Tools::substr($pointRelais->Parcelshop->Address->Name1, Tools::strlen($pointRelais->Parcelshop->Address->Name1) - 2, Tools::strlen($pointRelais->Parcelshop->Address->Name1)) != 'XL') { + continue; + } + $listRelais[] = $pointRelais; + } + $this->context->smarty->assign(array( + 'GLS_relais' => $listRelais, + 'aCalendarDays' => $aDays, + )); + return $this->display(__FILE__, 'listRelais.tpl'); + return $result; + } catch (SoapFault $e) { + + //Erreur de WS + $this->context->smarty->assign(array( + 'GLS_error' => 9999, + )); + return $this->display(__FILE__, 'listRelais.tpl'); + } + } + + public function getDefaultZipCode() { + if ($this->context->cart->id_address_delivery) { + $return = array(); + $address = new Address($this->context->cart->id_address_delivery); + + $return['postcode'] = $address->postcode; + if ($address->address2) { + $return['street'] = $address->address1 . ' ' . $address->address2; + } else { + $return['street'] = $address->address1; + } + $return['city'] = $address->city; + $return['country'] = $address->country; + $return['phone_mobile'] = $address->phone_mobile; + $return['phone_number'] = $address->phone; + return $return; + } else { + return; + } + } + + public function isSameAddress($idAddress, $idCart, $idCustomer) { + + $return = Db::getInstance()->getRow('SELECT * FROM ' . _DB_PREFIX_ . 'GLS_delivery_info WHERE id_cart =\'' . (int) ($idCart) . '\' AND id_customer =\'' . (int) ($idCustomer) . '\''); + $psAddress = new Address((int) ($idAddress)); + $newAddress = new Address(); + + if ($this->upper($psAddress->lastname) != $this->upper($return['relay_name']) || $this->upper($psAddress->address1) != $this->upper($return['relay_address']) || $this->upper($psAddress->postcode) != $this->upper($return['relay_zipcode']) || $this->upper($psAddress->city) != $this->upper($return['relay_town']) || str_replace(array(' ', '.', '-', ',', ';', '+', '/', '\\', '+', '(', ')'), '', $psAddress->phone_mobile) != $return['relay_phone']) { + $newAddress->id_customer = (int) ($idCustomer); + $newAddress->lastname = $psAddress->lastname; + $newAddress->firstname = $psAddress->firstname; + $newAddress->company = Tools::substr($return['relay_name'], 0, 32); + $newAddress->postcode = $return['relay_zipcode']; + $newAddress->city = $return['relay_town']; + $newAddress->id_country = Country::getByIso('FR'); + $newAddress->phone = $psAddress->phone; + $newAddress->phone_mobile = ($return['relay_phone']) ? $return['relay_phone'] : $psAddress->phone_mobile; + $newAddress->alias = 'GLS Point Relay - ' . date('d-m-Y'); + $newAddress->active = 1; + $newAddress->deleted = 1; + $newAddress->address1 = $return['relay_address']; + + $errors = $newAddress->validateController(); + + try { + $newAddress->add(); + } catch (Exception $e) { + Logger::addLog($e->getMessage(), 1); + file_put_contents(dirname(__FILE__) . '/test.log', var_export($errors, true)); + } + + return (int) ($newAddress->id); + } + return (int) ($psAddress->id); + } + + public function saveDeliveryDetails($params) { + $idCart = $this->context->cart->id; + $idCustomer = $this->context->cart->id_customer; + $update = Db::getInstance()->getRow('SELECT count(*) FROM ' . _DB_PREFIX_ . 'GLS_delivery_info WHERE id_cart =\'' . (int) ($idCart) . '\' AND id_customer =\'' . (int) ($idCustomer) . '\''); + + if ($update) { + Db::getInstance()->execute('DELETE FROM ' . _DB_PREFIX_ . 'GLS_delivery_info WHERE id_cart =\'' . (int) ($idCart) . '\' AND id_customer =\'' . (int) ($idCustomer) . '\''); + } + + $sql = 'INSERT INTO ' . _DB_PREFIX_ . 'GLS_delivery_info + ( `id_cart`, `id_customer`, `relay_name`, `relay_address`,`relay_zipcode`, `relay_town`, `relay_phone`, `relay_warnbyphone`, `relay_id`) + VALUES (' . (int) ($idCart) . ',' . (int) ($idCustomer) . ',\'' . $params['name'] . '\',\'' . $params['address'] . '\',\'' . $params['zipcode'] . '\',\'' . $params['city'] . '\',\'' . $params['phone'] . '\',' . $params['warnbyphone'] . ',\'' . $params['relayId'] . '\');'; + return Db::getInstance()->execute($sql); + } + + public function resetDeliveryDetails() { + $idCart = $this->context->cart->id; + $idCustomer = $this->context->cart->id_customer; + $delete = Db::getInstance()->getRow('SELECT count(*) FROM ' . _DB_PREFIX_ . 'GLS_delivery_info WHERE id_cart =\'' . (int) ($idCart) . '\' AND id_customer =\'' . (int) ($idCustomer) . '\''); + + if ($delete) { + Db::getInstance()->execute('DELETE FROM ' . _DB_PREFIX_ . 'GLS_delivery_info WHERE id_cart =\'' . (int) ($idCart) . '\' AND id_customer =\'' . (int) ($idCustomer) . '\''); + } + } + + public function getChoosenRelay() { + $idCart = $this->context->cart->id; + $idCustomer = $this->context->cart->id_customer; + return Db::getInstance()->getRow('SELECT * FROM ' . _DB_PREFIX_ . 'GLS_delivery_info WHERE id_cart =\'' . (int) ($idCart) . '\' AND id_customer =\'' . (int) ($idCustomer) . '\''); + } + + public function upper($strIn) { + return Tools::strtoupper(str_replace('-', ' ', Tools::link_rewrite($strIn))); + } + + private function addDeliveryPrices($id_carrier, $id_zone, $price = 0) { + + $carrier = new Carrier($id_carrier); + if (Validate::isLoadedObject($carrier)) { + /* Get configuration values */ + $shipping_method = $carrier->getShippingMethod(); + $rangeTable = $carrier->getRangeTable(); + + $carrier->deleteDeliveryPrice($rangeTable); + $currentList = Carrier::getDeliveryPriceByRanges($rangeTable, $id_carrier); + + $sqlRange = 'SELECT id_' . $rangeTable . ' FROM ' . _DB_PREFIX_ . $rangeTable . ' WHERE id_carrier = \'' . $id_carrier . '\''; + $id_range = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sqlRange); + + /* Build prices list */ + $priceList = array(); { + $price = number_format(abs(str_replace(',', '.', $price)), 6, '.', ''); + $priceList[] = array( + 'id_range_price' => ($shipping_method == Carrier::SHIPPING_METHOD_PRICE) ? $id_range : null, + 'id_range_weight' => ($shipping_method == Carrier::SHIPPING_METHOD_WEIGHT) ? $id_range : null, + 'id_carrier' => (int) $carrier->id, + 'id_zone' => (int) $id_zone, + 'price' => $price, + ); + } + /* Update delivery prices */ + $carrier->addDeliveryPrice($priceList); + } + } + + public function tableExists($tableName) { + $tables = Db::getInstance()->executeS('SHOW TABLES'); + foreach ($tables as $key => $table) { + if ($table == $tableName) { + return true; + } + } + return false; + } + + public function importAgenciesZipcode($forceupdate = false) { + + // Get current agency code + $accountDetail = $this->getAccountDetail(); + + // If not current agency code, return false + if (empty($accountDetail['GLS_EXPRESS_DELIVERY_AGENCY'])) { + return false; + } + + //On récupère la dernière date de vérification + $lastCheckDate = Db::getInstance()->getRow(' + SELECT last_check_date + FROM `' . _DB_PREFIX_ . 'GLS_agency_list`'); + + //Si la vérification du fichier distant a déjà été faite et qu'on est pas en force update on ne fait rien + if ($lastCheckDate['last_check_date'] >= date('Ymd') && !$forceupdate) { + return true; + } + + //Récupération de la date du fichier distant + // Mise en place d'une connexion basique + $conn_id = ftp_connect($this->GLS_ftp_address); + + // Identification avec un nom d'utilisateur et un mot de passe + $login_result = ftp_login($conn_id, $this->GLS_ftp_login, $this->GLS_ftp_password); + + /* Use passive mode for downloads */ + ftp_pasv($conn_id, true); + + // Récupération du contenu d'un dossier + $contents = ftp_nlist($conn_id, "."); + + // Récupération de la date du fichier distant + $remoteFileDate = 0; + foreach ($contents as $key => $filename) { + if (preg_match($this->GLS_filename_pattern, $filename, $matches)) { + $local_file = $filename; + $remoteFileDate = ($matches[1]); + } + } + + //Récupération de la date déjà importé + $lastImportDate = 19000101; + $temp = Db::getInstance()->getRow(' + SELECT last_import_date + FROM `' . _DB_PREFIX_ . 'GLS_agency_list`'); + if (isset($temp['last_import_date'])) { + $lastImportDate = $temp['last_import_date']; + } + + //Si on est en force update ou qu'on a un nouveau fichier disponible + if ($forceupdate || $remoteFileDate > $lastImportDate) { + + //On récupère le dossier d'import + $glsConfiguration = Gls::getAccountDetail(); + ($glsConfiguration['GLS_IMPORT_FOLDER']) ? $importFolder = _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . $glsConfiguration['GLS_IMPORT_FOLDER'] : $importFolder = dirname(__FILE__) . DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR . 'import' . DIRECTORY_SEPARATOR; + + if (!file_exists($importFolder) and ! is_dir($importFolder)) { + echo $importFolder . ' ' . $this->l('does not exist'); + die(); + } + + //On télécharge le fichier dans une variable temporaire + ob_start(); + $result = ftp_get($conn_id, "php://output", $local_file, FTP_BINARY); + $data = ob_get_contents(); + $aAgencies = explode("\r\n", $data); + ob_end_clean(); + + + //Si le fichier n'est pas vide + if (count($aAgencies) > 1) { + + //On vide la table + $query = 'TRUNCATE ' . _DB_PREFIX_ . 'GLS_agency_list;'; + Db::getInstance()->execute($query); + + + //On remplit la table avec le nouveau fichier + foreach ($aAgencies as $key => $agency) { + + $aData = explode(';', $agency); + $insertQuery = 'INSERT INTO ' . _DB_PREFIX_ . 'GLS_agency_list + (`agencycode`, + `zipcode_start`, + `zipcode_end`, + `validity_date_start`, + `validity_date_end`, + `last_import_date`, + `last_check_date`) + VALUES + (\'' . $aData[0] . '\', + \'' . $aData[1] . '\', + \'' . $aData[2] . '\', + \'' . $aData[3] . '\', + \'' . $aData[4] . '\', + \'' . $remoteFileDate . '\', + \'' . date('Ymd') . '\');'; + Db::getInstance()->execute($insertQuery); + } + }//Fin du si le fichier n'est pas vide + } else { //Si on est pas en force update et qu'on a pas de nouveau fichier disponible + //On met à jour la check date + $query = 'UPDATE ' . _DB_PREFIX_ . 'GLS_agency_list SET last_check_date=\'' . date('Ymd') . '\';'; + Db::getInstance()->execute($query); + }//Fin du si on est en force update ou qu'on a un nouveau fichier disponible + } + +} + diff --git a/modules/gls/import/GlsWinExpe6_2016051117380679.csv b/modules/gls/import/GlsWinExpe6_2016051117380679.csv new file mode 100644 index 00000000..3483940b --- /dev/null +++ b/modules/gls/import/GlsWinExpe6_2016051117380679.csv @@ -0,0 +1,2 @@ +IDENTIFIANT;DATE;COLIS;CODE PRODUIT;REFERENCE 1;REF DESTINATAIRE;NOM ou RAISON SOCIALE;NOM DU CONTACT;ADRESSE 1;ADRESSE 2;ADRESSE 3;ZIPCODE;VILLE;CODE PAYS;REFERENCE 2;CHARGEUR;CHARGEUR SECONDAIRE;TRACKID +1;11/05/2016;1000001;FDBP;;TEST;TEST;;TEST;;;93100;TEST;FR;;2504846601;0;009H2388 \ No newline at end of file diff --git a/modules/gls/import/index.php b/modules/gls/import/index.php new file mode 100644 index 00000000..dc7351df --- /dev/null +++ b/modules/gls/import/index.php @@ -0,0 +1,28 @@ + +* @copyright 2007-2014 Addonline +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; \ No newline at end of file diff --git a/modules/gls/index.php b/modules/gls/index.php new file mode 100644 index 00000000..c5f57957 --- /dev/null +++ b/modules/gls/index.php @@ -0,0 +1,28 @@ + +* @copyright 2007-2014 Addonline +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; \ No newline at end of file diff --git a/modules/gls/logo.png b/modules/gls/logo.png new file mode 100644 index 00000000..5fc564ee Binary files /dev/null and b/modules/gls/logo.png differ diff --git a/modules/gls/tpl/admintab/export_orders.tpl b/modules/gls/tpl/admintab/export_orders.tpl new file mode 100644 index 00000000..5d2d28a4 --- /dev/null +++ b/modules/gls/tpl/admintab/export_orders.tpl @@ -0,0 +1,70 @@ +

+{l s='All orders which have the state' mod='gls'} "{$GLS_order_state.name}" {l s='will be available for creation of labels' mod='gls'} +

+
+ +
+ +
+ {l s='Export orders' mod='gls'} +
+ + + + + + + + + + + + + {foreach from=$GLS_orders key=case_num item=order} + + + + + + + + + + + + + + + + + + + + {/foreach} +
{l s='Order ID' mod='gls'}{l s='Customer' mod='gls'}{l s='Total price' mod='gls'}{l s='Total shipping costs' mod='gls'}{l s='Date' mod='gls'}{l s='Insert weight (grams)' mod='gls'}{l s='GLS Relay Id' mod='gls'}{l s='Detail' mod='gls'}
{$order.id_order}{$order.customer}{$order.display_total_price}{$order.display_shipping_price}{$order.display_date} + + {$order.GLS_Selected_Num} + + {l s='View' mod='gls'} + +
+ {if !$GLS_orders|count} +

{l s='No orders with this state.' mod='gls'}

+ {else} +
+
+ + +
+ +
+ {/if} +
+
+ +
\ No newline at end of file diff --git a/modules/gls/tpl/admintab/index.php b/modules/gls/tpl/admintab/index.php new file mode 100644 index 00000000..dc7351df --- /dev/null +++ b/modules/gls/tpl/admintab/index.php @@ -0,0 +1,28 @@ + +* @copyright 2007-2014 Addonline +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; \ No newline at end of file diff --git a/modules/gls/tpl/admintab/settings.tpl b/modules/gls/tpl/admintab/settings.tpl new file mode 100644 index 00000000..bbae1e91 --- /dev/null +++ b/modules/gls/tpl/admintab/settings.tpl @@ -0,0 +1,54 @@ +{include file="$GLS_local_path/views/templates/admin/post_action.tpl"} +
+
+ {l s='Import' mod='gls'} + +
+ +

+ {l s='Choose the order state after the import.' mod='gls'} +

+
+ +
+ +
+
+
+
+
+
+
+ {l s='Export Filter' mod='gls'} + +
+ +

+ {l s='Choose the order state for export.' mod='gls'} +

+
+ +
+
+ +
+
+ +
+
diff --git a/modules/gls/tpl/index.php b/modules/gls/tpl/index.php new file mode 100644 index 00000000..dc7351df --- /dev/null +++ b/modules/gls/tpl/index.php @@ -0,0 +1,28 @@ + +* @copyright 2007-2014 Addonline +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; \ No newline at end of file diff --git a/modules/gls/translations/en.php b/modules/gls/translations/en.php new file mode 100644 index 00000000..748f2883 --- /dev/null +++ b/modules/gls/translations/en.php @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/modules/gls/translations/fr.php b/modules/gls/translations/fr.php new file mode 100644 index 00000000..3ef248e2 --- /dev/null +++ b/modules/gls/translations/fr.php @@ -0,0 +1,103 @@ +admingls_e82faee1422140edd04b2f94c5051500'] = 'Opération effectuée'; +$_MODULE['<{gls}prestashop>admingls_3b2d373418745276ae6e207421245cdc'] = 'Le status de commande a été mis à jour'; +$_MODULE['<{gls}prestashop>admingls_b4ac3d3f15bc0984d0906aff1202e701'] = 'Impossible de mettre à jour le compte'; +$_MODULE['<{gls}prestashop>gls_07351bfe713bfebc506f0660ff44b7bf'] = 'GLS'; +$_MODULE['<{gls}prestashop>gls_ed4a3b96dc1f38c160775cac1f7bcd6d'] = 'Livrer dans un Point Relais GLS'; +$_MODULE['<{gls}prestashop>gls_1889ea20d1343f376f5d52b6b8dc7a3f'] = 'Vous devez choisir un Point Relais GLS avant de continuer.'; +$_MODULE['<{gls}prestashop>gls_29616e349017da1ff1b5423ed2ec4fe6'] = 'Login invalide'; +$_MODULE['<{gls}prestashop>gls_626295ee4555407394df3e9998e1fc19'] = 'Mot de passe invalide'; +$_MODULE['<{gls}prestashop>gls_4eb287cc225ba0e1bcfe9cc1b8315def'] = 'Coefficient de poids invalide'; +$_MODULE['<{gls}prestashop>gls_979c6094728c14aac1b66d544dc5cebd'] = 'Statut commande invalide'; +$_MODULE['<{gls}prestashop>gls_e82faee1422140edd04b2f94c5051500'] = 'Opération effectuée'; +$_MODULE['<{gls}prestashop>gls_672facd73d4aee44c116cfd95298db87'] = 'Les détails du compte ont été mis à jour'; +$_MODULE['<{gls}prestashop>gls_6f8522e0610541f1ef215a22ffa66ff6'] = 'Lundi'; +$_MODULE['<{gls}prestashop>gls_5792315f09a5d54fb7e3d066672b507f'] = 'Mardi'; +$_MODULE['<{gls}prestashop>gls_796c163589f295373e171842f37265d5'] = 'Mercredi'; +$_MODULE['<{gls}prestashop>gls_78ae6f0cd191d25147e252dc54768238'] = 'Jeudi'; +$_MODULE['<{gls}prestashop>gls_c33b138a163847cdb6caeeb7c9a126b4'] = 'Vendredi'; +$_MODULE['<{gls}prestashop>gls_8b7051187b9191cdcdae6ed5a10e5adc'] = 'Samedi'; +$_MODULE['<{gls}prestashop>gls_9d1a0949c39e66a0cd65240bc0ac9177'] = 'Dimanche'; +$_MODULE['<{gls}prestashop>glsmanagement_aae091010a465c8c8659aa968fa7470c'] = 'Désinstallation de GLS'; +$_MODULE['<{gls}prestashop>glsmanagement_a4691c957e81a6f0b6f0ed44f8f2dfe8'] = 'Vous êtes sur le point de désinstaller le module, voulez vous aussi supprimer les tables de la base de donnée'; +$_MODULE['<{gls}prestashop>glsmanagement_09c081633d484a62a2f6940c12a0de36'] = 'Désinstaller et garder'; +$_MODULE['<{gls}prestashop>glsmanagement_0b7f47fce1d82d53244771c64b1535c0'] = 'Désinstaller et supprimer'; +$_MODULE['<{gls}prestashop>glsmanagement_ea4788705e6873b424c65e91c2846b19'] = 'Annuler'; +$_MODULE['<{gls}prestashop>glsmanagement_cd27b6954c4fd7b1c515e6547a2593cc'] = 'Erreur : Aucune commande selectionnée'; +$_MODULE['<{gls}prestashop>glsmanagement_cd32007c09c15196f0ce210dc5b87fd5'] = 'Erreur : Aucune commande a exporter'; +$_MODULE['<{gls}prestashop>glsmanagement_f443ce35e79c75866f0e71b04918c6d6'] = 'commandes exportées'; +$_MODULE['<{gls}prestashop>glsmanagement_9416a531e05cf18f1c26b97263e3c96b'] = 'n\'existe pas'; +$_MODULE['<{gls}prestashop>glsmanagement_733154f7eeee6cd45162e766e22e47ee'] = 'La commande'; +$_MODULE['<{gls}prestashop>glsmanagement_0468a03fb862f0749fe5878a5c7c379a'] = 'n\'a pas de numéro de tracking dans le ficheir d\'import'; +$_MODULE['<{gls}prestashop>glsmanagement_5c7ef4234158a462e419f8ca5dff9ed9'] = 'commandes importées'; +$_MODULE['<{gls}prestashop>checkout_process_c23f39998a23292635cd98171fe5dc10'] = 'Aucun Point Relay GLS trouvé à cause d\'une erreur prestashop'; +$_MODULE['<{gls}prestashop>checkout_process_ba3c1e324bf9ba3e57b0dd9596455766'] = 'Sélectionnez votre Point Relais Mondial Relay'; +$_MODULE['<{gls}prestashop>checkout_process_46044ec3d69fc76832e4a905add3dfcb'] = 'Votre code postal'; +$_MODULE['<{gls}prestashop>checkout_process_181fdb8722fab09d30fa4adf37f40447'] = 'Votre adresse'; +$_MODULE['<{gls}prestashop>checkout_process_e02be3ef47965445137775a22d380f09'] = 'Votre ville'; +$_MODULE['<{gls}prestashop>checkout_process_13348442cc6a27032d2b4aa28b75a5d3'] = 'Rechercher'; +$_MODULE['<{gls}prestashop>checkout_process_c6b8e0184324765c9bb40aa07fa5a7ac'] = 'Être averti de ma livraison par SMS'; +$_MODULE['<{gls}prestashop>checkout_process_errors_c23f39998a23292635cd98171fe5dc10'] = 'Aucun Point Relay GLS trouvé à cause d\'une erreur prestashop'; +$_MODULE['<{gls}prestashop>configuration_041208f2c0a4b75a8e609028a46f7ca6'] = 'Configuration GLS'; +$_MODULE['<{gls}prestashop>configuration_8bc212f48680748479bbd322d4d73d3f'] = 'Détails du compte'; +$_MODULE['<{gls}prestashop>configuration_16ef6a19ec519dd2b75d69c899e789cf'] = 'Veuillez saisir vos identifiants GLS'; +$_MODULE['<{gls}prestashop>configuration_5a2355a42ba3ab265701183c914467f2'] = 'Essayer de désactiver le cache et de forcer la compilation'; +$_MODULE['<{gls}prestashop>configuration_3de769f9a81eed916583d5b35c58dbdd'] = 'Si vous avez des problèmes après l\'installation du module'; +$_MODULE['<{gls}prestashop>configuration_629af0fa024406b13acc1866406cea0a'] = 'Veuillez consulter la documentation ci-jointe pour configurer le module GLS'; +$_MODULE['<{gls}prestashop>configuration_78a04c7effa3fad263cfbcaed2c41386'] = 'Pour créer un Transporter'; +$_MODULE['<{gls}prestashop>configuration_002d34780fabbef5bc6f4fc81779e6a7'] = 'Saisissez et validez vos identifiants GLS'; +$_MODULE['<{gls}prestashop>configuration_2511254b702ea7f18356870188f09297'] = 'Allez dans Expédition > Transporteurs et activez les transporteurs GLS créés par le module '; +$_MODULE['<{gls}prestashop>configuration_8e04f3582757aca7016f30dc71284978'] = 'Gérez vos tranches de prix, tranches de poids et prix comme pour n\'importe quel transporteur Prestashop'; +$_MODULE['<{gls}prestashop>configuration_ca4047654a1e199977f8be3af20b2a76'] = 'Paramètres Compte GLS'; +$_MODULE['<{gls}prestashop>configuration_d7c8f854948258ef294cba421b615682'] = 'Ces informations vous sont fournies par GLS lors de votre inscription à leurs services'; +$_MODULE['<{gls}prestashop>configuration_ee0b97b8efd6a60f55e968e825a88f53'] = 'Login du webservice'; +$_MODULE['<{gls}prestashop>configuration_19406da4aeee621d8c9a475775ddd373'] = 'Mot de passe du webservice'; +$_MODULE['<{gls}prestashop>configuration_482720eb614b6ed888d79e8438754d7b'] = 'Uniquement les Point Relais XL'; +$_MODULE['<{gls}prestashop>configuration_a26329cba9723551cb8654deba32872b'] = 'Coefficient de poids'; +$_MODULE['<{gls}prestashop>configuration_de67367c06b155bdcb03ef5eeed7d7c8'] = 'Répertoire d\'export'; +$_MODULE['<{gls}prestashop>configuration_0bd19e2249444d89f74bb993548fbc68'] = 'Répertoire d\'import'; +$_MODULE['<{gls}prestashop>configuration_bd0c0b64d8cfc71bc9b1d63c05ec0925'] = 'Création de la zone de livraison'; +$_MODULE['<{gls}prestashop>configuration_b4fc8333f7df92e2fadbe30674a28cd3'] = 'En cochant cette case, le module va créer une zone France contenant uniquement le pays France afin de permettre la configuration des transporteurs GLS. Pour plus d\'information veuillez vous reporter à la documentation du module.'; +$_MODULE['<{gls}prestashop>configuration_61cbc2d26b4157292673c772ddd6c0f7'] = 'Mettre à jour'; +$_MODULE['<{gls}prestashop>configuration_70397c4b252a5168c5ec003931cea215'] = 'Champs requis'; +$_MODULE['<{gls}prestashop>header-mobile_1889ea20d1343f376f5d52b6b8dc7a3f'] = 'Vous devez choisir un Point Relais GLS avant de continuer.'; +$_MODULE['<{gls}prestashop>header-mobile_e0626222614bdee31951d84c64e5e9ff'] = 'Choisissez'; +$_MODULE['<{gls}prestashop>header-mobile_91b442d385b54e1418d81adc34871053'] = 'Choisi'; +$_MODULE['<{gls}prestashop>header-mobile_ef2a1f426c2c289ed5986c7636a5d696'] = 'Choisissez un Point Relais GLS'; +$_MODULE['<{gls}prestashop>header-mobile_80a0c205cd57b22fca7f174253870300'] = 'Voir les horaires'; +$_MODULE['<{gls}prestashop>header-mobile_2b56b60f878922093facd42284848a0c'] = 'Plus d\'informations'; +$_MODULE['<{gls}prestashop>header_1889ea20d1343f376f5d52b6b8dc7a3f'] = 'Vous devez choisir un Point Relais GLS avant de continuer.'; +$_MODULE['<{gls}prestashop>header_e0626222614bdee31951d84c64e5e9ff'] = 'Choisissez'; +$_MODULE['<{gls}prestashop>header_91b442d385b54e1418d81adc34871053'] = 'Choisi'; +$_MODULE['<{gls}prestashop>header_ef2a1f426c2c289ed5986c7636a5d696'] = 'Choisissez un Point Relais GLS'; +$_MODULE['<{gls}prestashop>header_80a0c205cd57b22fca7f174253870300'] = 'Voir les horaires'; +$_MODULE['<{gls}prestashop>header_2b56b60f878922093facd42284848a0c'] = 'Plus d\'informations'; +$_MODULE['<{gls}prestashop>listrelais_80a0c205cd57b22fca7f174253870300'] = 'Voir les horaires'; +$_MODULE['<{gls}prestashop>listrelais_2a6ec44c8ab2477c32eb8b2a74d707dc'] = 'Choisir ce lieu'; +$_MODULE['<{gls}prestashop>post_action_466ec9f29b485204ef53818459da48af'] = 'Erreur(s)'; +$_MODULE['<{gls}prestashop>export_orders_de21dc13e1ea638777fbfad49f88b332'] = 'Toutes les commandes qui ont le statut'; +$_MODULE['<{gls}prestashop>export_orders_378116486b5a90bb50fd4f1557698d96'] = 'seront disponibles pour l\'export'; +$_MODULE['<{gls}prestashop>export_orders_da8cbc8f80b433d3d2b6d13eea457873'] = 'Export des commandes'; +$_MODULE['<{gls}prestashop>export_orders_ce26601dac0dea138b7295f02b7620a7'] = 'Client'; +$_MODULE['<{gls}prestashop>export_orders_0eede552438475bdfe820c13f24c9399'] = 'Total'; +$_MODULE['<{gls}prestashop>export_orders_c28e0582276cb6747e37d948e1727929'] = 'Frais de ports'; +$_MODULE['<{gls}prestashop>export_orders_52150799c57e873360cca13c080a91b4'] = 'Poids (grammes)'; +$_MODULE['<{gls}prestashop>export_orders_059b186a7c30053792c99cc7e967eebe'] = 'Identifiant Relais GLS'; +$_MODULE['<{gls}prestashop>export_orders_a254c25adc7d10d7e9c4889484f875a5'] = 'Détail'; +$_MODULE['<{gls}prestashop>export_orders_4351cfebe4b61d8aa5efa1d020710005'] = 'Vue'; +$_MODULE['<{gls}prestashop>export_orders_2e01172e31495f41fcebcf3f831cc82c'] = 'Opération réussie'; +$_MODULE['<{gls}prestashop>export_orders_37c85a61df6352af7285c307022c4413'] = 'Aucune commandes avec ce statut'; +$_MODULE['<{gls}prestashop>export_orders_32b919d18cfaca89383f6000dcc9c031'] = 'Exporter'; +$_MODULE['<{gls}prestashop>export_orders_37b7d4154dd83425f82d211ae99c8c0e'] = 'Exporter localement'; +$_MODULE['<{gls}prestashop>settings_72d6d7a1885885bb55a565fd1070581a'] = 'Importer'; +$_MODULE['<{gls}prestashop>settings_d02bbc3cb147c272b0445ac5ca7d1a36'] = 'Statuts des commandes'; +$_MODULE['<{gls}prestashop>settings_4e446c09aaeb9b2dd36e6ff44c5b9093'] = 'Choisissez le status après import'; +$_MODULE['<{gls}prestashop>settings_c9cc8cce247e49bae79f15173ce97354'] = 'Sauvegarder'; +$_MODULE['<{gls}prestashop>settings_4ed2cbb99dd730ccef9d12a72a075984'] = 'Importer les commandes'; +$_MODULE['<{gls}prestashop>settings_9dd7fcad7dffd9b96b3ffee10299b56a'] = 'Filtre Export'; +$_MODULE['<{gls}prestashop>settings_7c00c3134810759bf0769f94b8093398'] = 'Choisissez le statut pour l\'export'; +$_MODULE['<{gls}prestashop>settings_d7778d0c64b6ba21494c97f77a66885a'] = 'Filtrer'; +$_MODULE['<{gls}prestashop>settings_f4f70727dc34561dfde1a3c529b6205c'] = 'Réglages'; diff --git a/modules/gls/translations/index.php b/modules/gls/translations/index.php new file mode 100644 index 00000000..dc7351df --- /dev/null +++ b/modules/gls/translations/index.php @@ -0,0 +1,28 @@ + +* @copyright 2007-2014 Addonline +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; \ No newline at end of file diff --git a/modules/gls/translations/translate_en.js b/modules/gls/translations/translate_en.js new file mode 100644 index 00000000..984d0d58 --- /dev/null +++ b/modules/gls/translations/translate_en.js @@ -0,0 +1,5 @@ +change_parcelshop = "Change the relay point"; +choose_this_parcel_shop = "Choose this location"; +orders_exported = "orders exported"; +error_label = "Error : "; +shipping_method_unavailable = "Shipping method unavailable"; \ No newline at end of file diff --git a/modules/gls/translations/translate_fr.js b/modules/gls/translations/translate_fr.js new file mode 100644 index 00000000..ba7f13c3 --- /dev/null +++ b/modules/gls/translations/translate_fr.js @@ -0,0 +1,5 @@ +change_parcelshop = "Modifier mon Point Relais"; +choose_this_parcel_shop = "Choisir ce lieu"; +orders_exported = "commandes exportées"; +error_label = "Erreur : "; +shipping_method_unavailable = "Mode de livraison non disponible"; \ No newline at end of file diff --git a/modules/gls/views/css/gls-mobile.css b/modules/gls/views/css/gls-mobile.css new file mode 100644 index 00000000..5cf6b774 --- /dev/null +++ b/modules/gls/views/css/gls-mobile.css @@ -0,0 +1,277 @@ +.gm-style { + font-family: Helvetica, Arial, sans-serif !important; +} +.delivery_option_logo img[alt^="GLS"] { + max-width: 150px; +} +#layer_gls, +#layer_gls_body { + position: fixed !important; + display: none; + top: 0 !important; + width: 100% !important; + height: 100% !important; + background: #fff; + z-index: 1000; + text-align: left; + font-family: Helvetica, Arial, sans-serif; +} +#layer_gls .close, +#layer_gls_body .close { + position: absolute; + top: 20px; + right: 10px; + cursor: pointer; + width: 22px; + height: 22px; + background: url(../img/btn_fermer.png); +} +#layer_gls h3, +#layer_gls_body h3 { + background: url(../img/title-repeat.png); + line-height: normal; + padding: 14px 75px 0 110px; + margin: 0; + height: 44px; + font-size: 15px; + font-weight: normal; + color: #fff; + position: relative; +} +#layer_gls h3:before, +#layer_gls_body h3:before { + content: ""; + width: 85px; + height: 43px; + position: absolute; + top: 8px; + left: 10px; + background: url(../img/picto_shd.png); +} +#layer_gls #gls_headers, +#layer_gls_body #gls_headers { + background: #ededed; + -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45); + -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45); + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45); + position: relative; + z-index: 2; +} +#layer_gls #gls_headers .left, +#layer_gls_body #gls_headers .left { + padding: 5px 10px; + background-color: #d9d9d9; + background-image: -webkit-linear-gradient(bottom, #d2d2d2, #ffffff); + background-image: -moz-linear-gradient(bottom, #d2d2d2, #ffffff); + background-image: -o-linear-gradient(bottom, #d2d2d2, #ffffff); + background-image: linear-gradient(to top, #d2d2d2, #ffffff); +} +#layer_gls #gls_headers .left span, +#layer_gls_body #gls_headers .left span { + font-size: 14px; + font-weight: bold; + color: #06187c; + margin-right: 16px; + vertical-align: middle; + display: block; +} +#layer_gls #gls_headers .left input, +#layer_gls_body #gls_headers .left input { + text-align: center; + padding: 0 10px; + width: 70px; + height: 23px; + font-size: 14px; + border-radius: 8px; + background-color: #fff; + -webkit-box-shadow: inset 0 3px 3px rgba(214, 214, 214, 0.75); + -moz-box-shadow: inset 0 3px 3px rgba(214, 214, 214, 0.75); + box-shadow: inset 0 3px 3px rgba(214, 214, 214, 0.75); + border: solid 1px #d2d2d2; + vertical-align: middle; + box-sizing: border-box; +} +#layer_gls #gls_headers .left input#cp_street, +#layer_gls_body #gls_headers .left input#cp_street { + width: 100%; +} +#layer_gls #gls_headers .left button, +#layer_gls_body #gls_headers .left button { + background: none; + border: none; + margin: 0 0 0 -10px; + padding: 0; + cursor: pointer; + font-size: 12px; + text-shadow: 0 -1px #112282; + color: #fff; + width: 92px; + height: 23px; + -webkit-border-radius: 0 8px 8px 0; + -moz-border-radius: 0 8px 8px 0; + border-radius: 0 8px 8px 0; + background-color: #06187c; + background-image: -webkit-linear-gradient(bottom, #06187c, #8b94c2); + background-image: -moz-linear-gradient(bottom, #06187c, #8b94c2); + background-image: -o-linear-gradient(bottom, #06187c, #8b94c2); + background-image: linear-gradient(to top, #06187c, #8b94c2); + vertical-align: middle; +} +#layer_gls #gls_headers .right, +#layer_gls_body #gls_headers .right { + padding: 5px 10px; + overflow: hidden; + border-top: 1px solid #aeb2be; +} +#layer_gls #gls_headers .right label, +#layer_gls_body #gls_headers .right label { + font-size: 12px; + color: #76798d; + vertical-align: middle; + width: 115px; + float: left; + line-height: 12px; + padding: 0 0 0 25px; + position: relative; +} +#layer_gls #gls_headers .right label input, +#layer_gls_body #gls_headers .right label input { + vertical-align: middle; + position: absolute; + top: 0; + left: 0; +} +#layer_gls #gls_headers .right #num_telephone, +#layer_gls_body #gls_headers .right #num_telephone { + text-align: center; + font-size: 14px; + vertical-align: middle; + padding: 0 10px; + width: 156px; + height: 23px; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + border-radius: 8px; + background-color: #fff; + -webkit-box-shadow: inset 0 3px 3px rgba(214, 214, 214, 0.75); + -moz-box-shadow: inset 0 3px 3px rgba(214, 214, 214, 0.75); + box-shadow: inset 0 3px 3px rgba(214, 214, 214, 0.75); + border: solid 1px #d2d2d2; + float: right; +} +#layer_gls #col_gauche_gls, +#layer_gls_body #col_gauche_gls { + position: absolute; + top: 126px; + bottom: 0; + left: 0; + right: 0; + z-index: 1; +} +#layer_gls #col_gauche_gls #map_gls, +#layer_gls_body #col_gauche_gls #map_gls { + height: 100%; +} +#layer_gls #col_gauche_gls #map_gls .info-window, +#layer_gls_body #col_gauche_gls #map_gls .info-window { + line-height: 1.35; + overflow: hidden; + white-space: nowrap; + width: 260px; +} +#layer_gls #col_gauche_gls #map_gls .info-window .store-name, +#layer_gls_body #col_gauche_gls #map_gls .info-window .store-name { + font-weight: bold; + font-size: 14px; + color: #06187c; + display: block; +} +#layer_gls #col_gauche_gls #map_gls .info-window table, +#layer_gls_body #col_gauche_gls #map_gls .info-window table { + width: 100%; + margin-top: 10px; +} +#layer_gls #col_gauche_gls #map_gls .info-window table .day, +#layer_gls_body #col_gauche_gls #map_gls .info-window table .day { + width: 80px; +} +#layer_gls #col_gauche_gls #map_gls .info-window .button-wrapper, +#layer_gls_body #col_gauche_gls #map_gls .info-window .button-wrapper { + text-align: center; + padding: 10px 0; + margin-right: -20px; +} +#layer_gls #col_gauche_gls #map_gls .info-window .choose-relay-point, +#layer_gls_body #col_gauche_gls #map_gls .info-window .choose-relay-point { + padding: 0 15px 0 25px; + height: 26px; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + border-radius: 8px; + background-color: #06187c; + background-image: -webkit-linear-gradient(bottom, #e8b402, #fcd83b); + background-image: -moz-linear-gradient(bottom, #e8b402, #fcd83b); + background-image: -o-linear-gradient(bottom, #e8b402, #fcd83b); + background-image: linear-gradient(to top, #e8b402, #fcd83b); + font-size: 12px; + color: #000; + text-shadow: 0 1px #f7e38b; + text-decoration: none; + line-height: 26px; + display: inline-block; + position: relative; +} +#layer_gls #col_gauche_gls #map_gls .info-window .choose-relay-point:before, +#layer_gls_body #col_gauche_gls #map_gls .info-window .choose-relay-point:before { + content: ""; + width: 7px; + height: 10px; + position: absolute; + top: 9px; + left: 12px; + background: url(../img/picto-arrow.png); +} +#layer_gls #col_droite_gls, +#layer_gls_body #col_droite_gls { + display: none; +} +#layer_gls .loader-wrapper, +#layer_gls_body .loader-wrapper { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 999; +} +#layer_gls .loader, +#layer_gls_body .loader { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 1000; + background: #000; + opacity: 0.2; +} +#layer_gls .loader-wheel, +#layer_gls_body .loader-wheel { + position: absolute; + top: 50%; + left: 50%; + margin: -50px 0 0 -16px; + width: 100px; + background: #fff; + border: 1px solid 000; + border-radius: 3px; + text-align: center; + z-index: 1001; + color: #878787; + font-style: italic; +} +#layer_gls .loader-wheel img, +#layer_gls_body .loader-wheel img { + display: block; + margin: auto; +} diff --git a/modules/gls/views/css/gls-mobile.less b/modules/gls/views/css/gls-mobile.less new file mode 100644 index 00000000..289282fb --- /dev/null +++ b/modules/gls/views/css/gls-mobile.less @@ -0,0 +1,286 @@ +.gm-style { + font-family: Helvetica,Arial,sans-serif !important; +} + +.delivery_option_logo img[alt^="GLS"] { + max-width:150px; +} + +#layer_gls,#layer_gls_body { + position: fixed !important; + display: none; + top: 0 !important; + width: 100% !important; + height: 100% !important; + background: #fff; + z-index: 1000; + text-align: left; + font-family: Helvetica,Arial,sans-serif; + + .close { + position: absolute; + top: 20px; + right: 10px; + cursor: pointer; + width: 22px; + height: 22px; + background: url(../images/btn_fermer.png); + } + + h3 { + background: url(../images/title-repeat.png); + line-height: normal; + padding: 14px 75px 0 110px; + margin: 0; + height: 44px; + font-size: 15px; + font-weight: normal; + color: #fff; + position: relative; + + &:before { + content: ""; + width: 85px; + height: 43px; + position: absolute; + top: 8px; + left: 10px; + background: url(../images/picto_shd.png); + } + } + + #gls_headers { + background: #ededed; + -webkit-box-shadow: 0 1px 3px rgba(0,0,0,.45); + -moz-box-shadow: 0 1px 3px rgba(0,0,0,.45); + box-shadow: 0 1px 3px rgba(0,0,0,.45); + position: relative; + z-index: 2; + + .left { + padding: 5px 10px; + background-color: #d9d9d9; + background-image: -webkit-linear-gradient(bottom, #d2d2d2, #fff); + background-image: -moz-linear-gradient(bottom, #d2d2d2, #fff); + background-image: -o-linear-gradient(bottom, #d2d2d2, #fff); + background-image: linear-gradient(to top, #d2d2d2, #fff); + + span { + font-size: 14px; + font-weight: bold; + color: #06187c; + margin-right: 16px; + vertical-align: middle; + display: block; + } + input { + text-align: center; + padding: 0 10px; + width: 70px; + height: 23px; + font-size: 14px; + border-radius: 8px; + background-color: #fff; + -webkit-box-shadow: inset 0 3px 3px rgba(214,214,214,.75); + -moz-box-shadow: inset 0 3px 3px rgba(214,214,214,.75); + box-shadow: inset 0 3px 3px rgba(214,214,214,.75); + border: solid 1px #d2d2d2; + vertical-align: middle; + box-sizing: border-box; + + &#cp_street { + width: 100%; + } + + } + button { + background: none; + border: none; + margin: 0 0 0 -10px; + padding: 0; + cursor: pointer; + font-size: 12px; + text-shadow: 0 -1px #112282; + color: #fff; + width: 92px; + height: 23px; + -webkit-border-radius: 0 8px 8px 0; + -moz-border-radius: 0 8px 8px 0; + border-radius: 0 8px 8px 0; + background-color: #06187c; + background-image: -webkit-linear-gradient(bottom, #06187c, #8b94c2); + background-image: -moz-linear-gradient(bottom, #06187c, #8b94c2); + background-image: -o-linear-gradient(bottom, #06187c, #8b94c2); + background-image: linear-gradient(to top, #06187c, #8b94c2); + vertical-align: middle; + } + } + + .right { + padding: 5px 10px; + overflow: hidden; + border-top: 1px solid #aeb2be; + + label { + font-size: 12px; + color: #76798d; + vertical-align: middle; + width: 115px; + float: left; + line-height: 12px; + padding: 0 0 0 25px; + position: relative; + input { + vertical-align: middle; + position: absolute; + top: 0; + left: 0; + } + } + #num_telephone { + text-align: center; + font-size: 14px; + vertical-align: middle; + padding: 0 10px; + width: 156px; + height: 23px; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + border-radius: 8px; + background-color: #fff; + -webkit-box-shadow: inset 0 3px 3px rgba(214,214,214,.75); + -moz-box-shadow: inset 0 3px 3px rgba(214,214,214,.75); + box-shadow: inset 0 3px 3px rgba(214,214,214,.75); + border: solid 1px #d2d2d2; + float: right; + } + } + + } + + #col_gauche_gls{ + position: absolute; + top: 126px; + bottom: 0; + left: 0; + right: 0; + z-index: 1; + + #map_gls { + height: 100%; + + .info-window { + line-height:1.35; + overflow:hidden; + white-space:nowrap; + width: 260px; + + .store-name { + font-weight: bold; + font-size: 14px; + color: #06187c; + display: block; + } + + table { + width: 100%; + margin-top: 10px; + + .day { + width: 80px; + } + } + + .button-wrapper { + text-align: center; + padding: 10px 0; + margin-right: -20px; + } + + .choose-relay-point { + padding: 0 15px 0 25px; + height: 26px; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + border-radius: 8px; + background-color: #06187c; + background-image: -webkit-linear-gradient(bottom, #e8b402, #fcd83b); + background-image: -moz-linear-gradient(bottom, #e8b402, #fcd83b); + background-image: -o-linear-gradient(bottom, #e8b402, #fcd83b); + background-image: linear-gradient(to top, #e8b402, #fcd83b); + + font-size: 12px; + color: #000; + text-shadow: 0 1px #f7e38b; + text-decoration: none; + line-height: 26px; + display: inline-block; + position: relative; + + &:before { + content: ""; + width: 7px; + height: 10px; + position: absolute; + top: 9px; + left: 12px; + background: url(../views/img/picto-arrow.png); + } + } + } + + } + } + + #col_droite_gls{ display: none; } + +} + + +.layer > div > div { + +} + +#layer_gls > div > div { + +} + +#layer_gls .loader-wrapper,#layer_gls_body .loader-wrapper { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 999; +} + +#layer_gls .loader,#layer_gls_body .loader { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 1000; + background: #000; + opacity: 0.2; +} + +#layer_gls .loader-wheel,#layer_gls_body .loader-wheel { + position: absolute; + top: 50%; + left: 50%; + margin: -50px 0 0 -16px; + width: 100px; + background: #fff; + border: 1px solid 000; + border-radius: 3px; + text-align: center; + z-index: 1001; + color: #878787; + font-style: italic; +} + +#layer_gls .loader-wheel img,#layer_gls_body .loader-wheel img { + display: block; + margin: auto; +} \ No newline at end of file diff --git a/modules/gls/views/css/gls.css b/modules/gls/views/css/gls.css new file mode 100644 index 00000000..6f844ccb --- /dev/null +++ b/modules/gls/views/css/gls.css @@ -0,0 +1 @@ +.gm-style{font-family:Helvetica,Arial,sans-serif !important}.delivery_option_logo img[alt^="GLS"]{height:40px}#layer_gls,#layer_gls_body{position:relative;display:none;width:950px;background:#fff;z-index:1000;text-align:left;border-radius:10px}#layer_gls .close,#layer_gls_body .close{position:absolute;top:15px;right:15px;cursor:pointer;width:22px;height:22px;background:url(../img/btn_fermer.png)}#layer_gls h3,#layer_gls_body h3{background:url(../img/title-repeat.png);line-height:58px;margin:0;padding:0;border-radius:10px 10px 0 0;font-size:24px;font-weight:normal;color:#fff;padding-left:110px;position:relative}#layer_gls h3:before,#layer_gls_body h3:before{content:"";width:85px;height:43px;position:absolute;top:8px;left:15px;background:url(../img/picto_shd.png)}#layer_gls #gls_headers,#layer_gls_body #gls_headers{background:url(../img/search-repeat.png) repeat-x 0 100%;margin:0 -15px 15px;padding:0 15px 0 15px;height:75px}#layer_gls #gls_headers .left,#layer_gls_body #gls_headers .left{margin-top:0px;float:left}#layer_gls #gls_headers .left span,#layer_gls_body #gls_headers .left span{padding:0 5px;font-size:14px;font-weight:bold;color:#06187c;margin-right:10px;vertical-align:middle}#layer_gls #gls_headers .left input,#layer_gls_body #gls_headers .left input{padding:0 10px;width:40px;height:23px;border-radius:8px;background-color:#fff;box-shadow:inset 0 3px 3px rgba(214,214,214,0.75);border:solid 1px #d2d2d2;vertical-align:middle;box-sizing:content-box}#layer_gls #gls_headers .left button,#layer_gls_body #gls_headers .left button{background:none;border:none;margin:0 0 0 -10px;padding:0;cursor:pointer;font-size:12px;text-shadow:0 -1px #112282;color:#fff;width:92px;height:25px;border-radius:0 8px 8px 0;filter:progid:DXImageTransform.Microsoft.gradient(startColorStr='#8b94c2', EndColorStr='#06187c');background-image:-webkit-linear-gradient(bottom, #06187c, #8b94c2);background-image:linear-gradient(to top, #06187c, #8b94c2);vertical-align:middle}#layer_gls #gls_headers .right,#layer_gls_body #gls_headers .right{margin-top:15px;float:right}#layer_gls #gls_headers .right label,#layer_gls_body #gls_headers .right label{font-size:14px;color:#06187c;margin-right:10px;vertical-align:middle}#layer_gls #gls_headers .right label input,#layer_gls_body #gls_headers .right label input{vertical-align:middle}#layer_gls #gls_headers .right #num_telephone,#layer_gls_body #gls_headers .right #num_telephone{vertical-align:middle;padding:0 10px;width:130px;height:23px;border-radius:8px;background-color:#fff;box-shadow:inset 0 3px 3px rgba(214,214,214,0.75);border:solid 1px #d2d2d2}#layer_gls #col_gauche_gls,#layer_gls_body #col_gauche_gls{width:646px;height:353px;float:left;border:1px solid #d6d8e9}#layer_gls #col_gauche_gls #map_gls,#layer_gls_body #col_gauche_gls #map_gls{height:100%}#layer_gls #col_gauche_gls #map_gls .info-window,#layer_gls_body #col_gauche_gls #map_gls .info-window{width:440px;line-height:1.35;overflow:hidden;white-space:nowrap}#layer_gls #col_gauche_gls #map_gls .info-window .store-name,#layer_gls_body #col_gauche_gls #map_gls .info-window .store-name{font-weight:bold;font-size:14px;color:#06187c;display:block}#layer_gls #col_gauche_gls #map_gls .info-window table,#layer_gls_body #col_gauche_gls #map_gls .info-window table{width:255px;margin-top:10px}#layer_gls #col_gauche_gls #map_gls .info-window table .day,#layer_gls_body #col_gauche_gls #map_gls .info-window table .day{width:80px}#layer_gls #col_gauche_gls #map_gls .info-window .choose-relay-point,#layer_gls_body #col_gauche_gls #map_gls .info-window .choose-relay-point{padding:0 15px 0 25px;height:26px;border-radius:8px;filter:progid:DXImageTransform.Microsoft.gradient(startColorStr='#fcd83b', EndColorStr='#e8b402');background-image:-webkit-linear-gradient(bottom, #e8b402, #fcd83b);background-image:linear-gradient(to top, #e8b402, #fcd83b);font-size:12px;color:#000;text-shadow:0 1px #f7e38b;text-decoration:none;line-height:26px;position:absolute;top:68px;right:0}#layer_gls #col_gauche_gls #map_gls .info-window .choose-relay-point:before,#layer_gls_body #col_gauche_gls #map_gls .info-window .choose-relay-point:before{content:"";width:7px;height:10px;position:absolute;top:9px;left:12px;background:url(../img/picto-arrow.png)}#layer_gls .gls_ws_error,#layer_gls_body .gls_ws_error{position:absolute;top:50px;right:0;bottom:0;left:0;padding-left:20px;padding-top:70px;z-index:9;color:red;text-align:left;font-size:14px}#layer_gls #col_droite_gls,#layer_gls_body #col_droite_gls{width:268px;height:353px;float:right;border:1px solid #d6d8e9;border-left:none;overflow:hidden;overflow-y:scroll;position:relative}#layer_gls #col_droite_gls .gls_point_relay,#layer_gls_body #col_droite_gls .gls_point_relay{padding:15px 15px 0 15px;border-bottom:1px solid #d6d8e9;line-height:normal}#layer_gls #col_droite_gls .gls_point_relay.current,#layer_gls_body #col_droite_gls .gls_point_relay.current{background:#eeeff7}#layer_gls #col_droite_gls .gls_point_relay .GLS_relay_name,#layer_gls_body #col_droite_gls .gls_point_relay .GLS_relay_name{font-weight:bold;font-size:14px;color:#06187c;display:block}#layer_gls #col_droite_gls .gls_point_relay .GLS_relay_address,#layer_gls_body #col_droite_gls .gls_point_relay .GLS_relay_address,#layer_gls #col_droite_gls .gls_point_relay .GLS_relay_zipcode,#layer_gls_body #col_droite_gls .gls_point_relay .GLS_relay_zipcode,#layer_gls #col_droite_gls .gls_point_relay .GLS_relay_city,#layer_gls_body #col_droite_gls .gls_point_relay .GLS_relay_city{color:#6a6a6a}#layer_gls #col_droite_gls .gls_point_relay .GLS_relay_address,#layer_gls_body #col_droite_gls .gls_point_relay .GLS_relay_address{display:block}#layer_gls #col_droite_gls .gls_point_relay div,#layer_gls_body #col_droite_gls .gls_point_relay div{margin-top:5px;overflow:hidden}#layer_gls #col_droite_gls .gls_point_relay .GLS_relay_horaires,#layer_gls_body #col_droite_gls .gls_point_relay .GLS_relay_horaires{float:left;color:#06187c;text-decoration:underline;cursor:pointer;margin-top:5px;margin-bottom:10px}#layer_gls #col_droite_gls .gls_point_relay .choose-relay-point,#layer_gls_body #col_droite_gls .gls_point_relay .choose-relay-point{border:none;background:none;cursor:pointer;float:right;padding:0 15px 0 25px;margin:0 0 15px 0;height:26px;border-radius:8px;filter:progid:DXImageTransform.Microsoft.gradient(startColorStr='#fcd83b', EndColorStr='#e8b402');background-image:-webkit-linear-gradient(bottom, #e8b402, #fcd83b);background-image:linear-gradient(to top, #e8b402, #fcd83b);font-size:12px;color:#000;text-shadow:0 1px #f7e38b;text-decoration:none;line-height:26px;position:relative}#layer_gls #col_droite_gls .gls_point_relay .choose-relay-point:before,#layer_gls_body #col_droite_gls .gls_point_relay .choose-relay-point:before{content:"";width:7px;height:10px;position:absolute;top:9px;left:12px;background:url(../img/picto-arrow.png)}#layer_gls #col_droite_gls .gls_point_relay .GLS_relay_latitude,#layer_gls_body #col_droite_gls .gls_point_relay .GLS_relay_latitude,#layer_gls #col_droite_gls .gls_point_relay .GLS_relay_longitude,#layer_gls_body #col_droite_gls .gls_point_relay .GLS_relay_longitude,#layer_gls #col_droite_gls .gls_point_relay .GLS_relay_hours,#layer_gls_body #col_droite_gls .gls_point_relay .GLS_relay_hours,#layer_gls #col_droite_gls .gls_point_relay .GLS_relay_id,#layer_gls_body #col_droite_gls .gls_point_relay .GLS_relay_id,#layer_gls #col_droite_gls .gls_point_relay .GLS_relay_index,#layer_gls_body #col_droite_gls .gls_point_relay .GLS_relay_index{display:none}.layer>div>div{overflow:auto}#layer_gls>div>div,#layer_gls_body>div>div{padding:15px;overflow:hidden}#layer_gls .loader-wrapper,#layer_gls_body .loader-wrapper{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999}#layer_gls .loader,#layer_gls_body .loader{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1000;background:#000;opacity:0.2}#layer_gls .loader-wheel,#layer_gls_body .loader-wheel{position:absolute;top:50%;left:50%;margin:-50px 0 0 -16px;width:100px;background:#fff;border:1px solid 000;border-radius:3px;text-align:center;z-index:1001;color:#878787;font-style:italic}#layer_gls .loader-wheel img,#layer_gls_body .loader-wheel img{display:block;margin:auto}#gls_relais_choisi{position:relative}#gls_relais_choisi .modifier_relay{position:absolute;top:0px;right:0;font-size:11px;color:#999;font-style:italic;text-decoration:underline;cursor:pointer}#gls_relais_choisi .modifier_relay:hover{color:#000}#sms_checkbox{margin-right:5px}#uniform-sms_checkbox{display:inline}#cp_street{width:270px !important}#cp_city{width:100px !important}#cp_recherche{box-sizing:content-box} \ No newline at end of file diff --git a/modules/gls/views/css/gls.less b/modules/gls/views/css/gls.less new file mode 100644 index 00000000..938b9c0f --- /dev/null +++ b/modules/gls/views/css/gls.less @@ -0,0 +1,406 @@ +.gm-style { + font-family: Helvetica,Arial,sans-serif !important; +} + +.delivery_option_logo img[alt^="GLS"] { + height:40px; +} + +#layer_gls,#layer_gls_body { + position: relative; + display: none; + width: 950px; + background: #fff; + z-index: 1000; + text-align: left; + border-radius: 10px; + + + .close { + position: absolute; + top: 15px; + right: 15px; + cursor: pointer; + width: 22px; + height: 22px; + background: url(../images/btn_fermer.png); + } + + h3 { + background: url(../images/title-repeat.png); + line-height: 58px; + margin: 0; + padding: 0; + border-radius: 10px 10px 0 0; + font-size: 24px; + font-weight: normal; + color: #fff; + padding-left: 110px; + position: relative; + + &:before { + content: ""; + width: 85px; + height: 43px; + position: absolute; + top: 8px; + left: 15px; + background: url(../images/picto_shd.png); + } + } + + #gls_headers { + background: url(../images/search-repeat.png) repeat-x 0 100%; + margin: 0 -15px 15px; + padding: 0 15px 0 15px; + height: 75px; + + .left { + margin-top: 0px; + float: left; + + span { + padding: 0 5px; + font-size: 14px; + font-weight: bold; + color: #06187c; + margin-right: 10px; + vertical-align: middle; + } + input { + padding: 0 10px; + width: 40px; + height: 23px; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + border-radius: 8px; + background-color: #fff; + -webkit-box-shadow: inset 0 3px 3px rgba(214,214,214,.75); + -moz-box-shadow: inset 0 3px 3px rgba(214,214,214,.75); + box-shadow: inset 0 3px 3px rgba(214,214,214,.75); + border: solid 1px #d2d2d2; + vertical-align: middle; + box-sizing:content-box; + } + button { + background: none; + border: none; + margin: 0 0 0 -10px; + padding: 0; + cursor: pointer; + font-size: 12px; + text-shadow: 0 -1px #112282; + color: #fff; + width: 92px; + height: 25px; + -webkit-border-radius: 0 8px 8px 0; + -moz-border-radius: 0 8px 8px 0; + border-radius: 0 8px 8px 0; + filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#8b94c2', EndColorStr='#06187c'); + background-image: -webkit-linear-gradient(bottom, #06187c, #8b94c2); + background-image: -moz-linear-gradient(bottom, #06187c, #8b94c2); + background-image: -o-linear-gradient(bottom, #06187c, #8b94c2); + background-image: linear-gradient(to top, #06187c, #8b94c2); + vertical-align: middle; + } + } + + .right { + margin-top: 15px; + float: right; + + label { + font-size: 14px; + color: #06187c; + margin-right: 10px; + vertical-align: middle; + input { + vertical-align: middle; + } + } + #num_telephone { + vertical-align: middle; + padding: 0 10px; + width: 130px; + height: 23px; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + border-radius: 8px; + background-color: #fff; + -webkit-box-shadow: inset 0 3px 3px rgba(214,214,214,.75); + -moz-box-shadow: inset 0 3px 3px rgba(214,214,214,.75); + box-shadow: inset 0 3px 3px rgba(214,214,214,.75); + border: solid 1px #d2d2d2; + } + } + + } + + #col_gauche_gls{ + width: 646px; + height: 353px; + float: left; + border: 1px solid #d6d8e9; + + #map_gls { + height: 100%; + + .info-window { + width: 440px; + line-height:1.35; + overflow:hidden; + white-space:nowrap; + + .store-name { + font-weight: bold; + font-size: 14px; + color: #06187c; + display: block; + } + + table { + width: 255px; + margin-top: 10px; + + .day { + width: 80px; + } + } + + .choose-relay-point { + padding: 0 15px 0 25px; + height: 26px; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + border-radius: 8px; + filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#fcd83b', EndColorStr='#e8b402'); + background-image: -webkit-linear-gradient(bottom, #e8b402, #fcd83b); + background-image: -moz-linear-gradient(bottom, #e8b402, #fcd83b); + background-image: -o-linear-gradient(bottom, #e8b402, #fcd83b); + background-image: linear-gradient(to top, #e8b402, #fcd83b); + + font-size: 12px; + color: #000; + text-shadow: 0 1px #f7e38b; + text-decoration: none; + line-height: 26px; + + position: absolute; + top: 68px; + right: 0; + + &:before { + content: ""; + width: 7px; + height: 10px; + position: absolute; + top: 9px; + left: 12px; + background: url(../images/picto-arrow.png); + } + } + } + + } + } + + .gls_ws_error{ + position: absolute; + top: 50px; + right: 0; + bottom: 0; + left: 0; + padding-left: 20px; + padding-top:70px; + z-index: 9; + color: red; + text-align: left; + font-size: 14px; + } + + #col_droite_gls{ + width: 268px; + height: 353px; + float:right; + border: 1px solid #d6d8e9; + border-left: none; + overflow: hidden; + overflow-y: scroll; + position: relative; + + .gls_point_relay { + padding: 15px 15px 0 15px; + border-bottom: 1px solid #d6d8e9; + line-height: normal; + + &.current { + background: #eeeff7; + } + + .GLS_relay_name { + font-weight: bold; + font-size: 14px; + color: #06187c; + display: block; + } + + .GLS_relay_address, .GLS_relay_zipcode,.GLS_relay_city { + color: #6a6a6a; + } + + .GLS_relay_address { + display: block; + } + + div { + margin-top: 5px; + overflow: hidden; + } + + .GLS_relay_horaires { + float: left; + color: #06187c; + text-decoration: underline; + cursor: pointer; + margin-top: 5px; + margin-bottom: 10px; + } + + .choose-relay-point { + border: none; + background: none; + cursor: pointer; + float: right; + + + padding: 0 15px 0 25px; + margin: 0 0 15px 0; + height: 26px; + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + border-radius: 8px; + filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#fcd83b', EndColorStr='#e8b402'); + background-image: -webkit-linear-gradient(bottom, #e8b402, #fcd83b); + background-image: -moz-linear-gradient(bottom, #e8b402, #fcd83b); + background-image: -o-linear-gradient(bottom, #e8b402, #fcd83b); + background-image: linear-gradient(to top, #e8b402, #fcd83b); + + font-size: 12px; + color: #000; + text-shadow: 0 1px #f7e38b; + text-decoration: none; + line-height: 26px; + + position: relative; + + &:before { + content: ""; + width: 7px; + height: 10px; + position: absolute; + top: 9px; + left: 12px; + background: url(../images/picto-arrow.png); + } + + } + + .GLS_relay_latitude, + .GLS_relay_longitude, + .GLS_relay_hours, + .GLS_relay_id, + .GLS_relay_index { + display: none; + } + + } + + } + +} + + +.layer > div > div { + overflow: auto; +} + +#layer_gls > div > div,#layer_gls_body > div > div { + padding: 15px; + overflow: hidden; +} + +#layer_gls .loader-wrapper,#layer_gls_body .loader-wrapper { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 999; +} + +#layer_gls .loader,#layer_gls_body .loader { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 1000; + background: #000; + opacity: 0.2; +} + +#layer_gls .loader-wheel,#layer_gls_body .loader-wheel { + position: absolute; + top: 50%; + left: 50%; + margin: -50px 0 0 -16px; + width: 100px; + background: #fff; + border: 1px solid 000; + border-radius: 3px; + text-align: center; + z-index: 1001; + color: #878787; + font-style: italic; +} + +#layer_gls .loader-wheel img,#layer_gls_body .loader-wheel img { + display: block; + margin: auto; +} + +#gls_relais_choisi { + position: relative; + + .modifier_relay { + position: absolute; + top: 0px; + right: 0; + font-size: 11px; + color: #999; + font-style: italic; + text-decoration: underline; + cursor: pointer; + + &:hover { + color: #000; + } + } +} + +#sms_checkbox{ + margin-right:5px; +} +#uniform-sms_checkbox{ + display:inline; +} + +#cp_street{ + width:270px !important; +} +#cp_city{ + width:100px !important; +} +#cp_recherche{ + box-sizing:content-box; +} \ No newline at end of file diff --git a/modules/gls/views/css/index.php b/modules/gls/views/css/index.php new file mode 100644 index 00000000..dc7351df --- /dev/null +++ b/modules/gls/views/css/index.php @@ -0,0 +1,28 @@ + +* @copyright 2007-2014 Addonline +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; \ No newline at end of file diff --git a/modules/gls/views/css/prepros.cfg b/modules/gls/views/css/prepros.cfg new file mode 100644 index 00000000..ab9dfff4 --- /dev/null +++ b/modules/gls/views/css/prepros.cfg @@ -0,0 +1,307 @@ +[ + { + "About This File": "This is Prepros config file, https://prepros.io . Please do not edit this file, doing so can crash Prepros." + }, + { + "data": { + "id": "", + "cfgVersion": 2, + "name": "CSS GLS prestashop 1611", + "path": "", + "files": { + "d57c4315": { + "id": "d57c4315", + "path": "gls-mobile.css", + "output": "gls-mobile-dist.css", + "name": "gls-mobile.css", + "category": "CSS", + "autoCompile": false, + "sourceMaps": false, + "compress": true, + "cssnext": false, + "autoprefixer": false, + "customOutput": false, + "imported": false, + "parents": [], + "type": "css" + }, + "cfcd6a6a": { + "id": "cfcd6a6a", + "path": "gls-mobile.less", + "output": "gls-mobile.css", + "name": "gls-mobile.less", + "category": "CSS", + "autoCompile": true, + "autoprefixer": false, + "compress": false, + "sourceMaps": false, + "strictMath": false, + "strictUnits": false, + "customOutput": false, + "imported": false, + "parents": [], + "type": "less" + }, + "c1177281": { + "id": "c1177281", + "path": "gls.css", + "output": "gls-dist.css", + "name": "gls.css", + "category": "CSS", + "autoCompile": false, + "sourceMaps": false, + "compress": true, + "cssnext": false, + "autoprefixer": false, + "customOutput": false, + "imported": false, + "parents": [], + "type": "css" + }, + "c68ca203": { + "id": "c68ca203", + "path": "gls.less", + "output": "gls.css", + "name": "gls.less", + "category": "CSS", + "autoCompile": true, + "autoprefixer": true, + "compress": true, + "sourceMaps": false, + "strictMath": false, + "strictUnits": false, + "customOutput": false, + "imported": false, + "parents": [], + "type": "less" + }, + "b8f3bc1b": { + "id": "b8f3bc1b", + "path": "index.php", + "output": "index.php", + "name": "index.php", + "category": "JUST_WATCH", + "customOutput": false, + "imported": false, + "parents": [], + "type": "php" + }, + "aa810382": { + "id": "aa810382", + "path": "style.css", + "output": "style-dist.css", + "name": "style.css", + "category": "CSS", + "autoCompile": false, + "sourceMaps": false, + "compress": true, + "cssnext": false, + "autoprefixer": false, + "customOutput": false, + "imported": false, + "parents": [], + "type": "css" + } + }, + "deploymentHistory": {}, + "config": { + "watch": "", + "liveRefresh": true, + "useCustomServer": false, + "port": 0, + "useCustomPort": false, + "customServerUrl": "", + "watchedFileExtensions": "less, sass, scss, styl, md, markdown, coffee, js, jade, haml, slim, ls, html,htm, css, rb, php, asp, aspx, cfm, chm, cms, do, erb, jsp, mhtml, mspx, pl, py, shtml, cshtml, cs,vb, vbs, tpl, ctp, kit, png, jpg, jpeg", + "excludePatterns": "Prepros Build, node_modules, .git, .idea, .sass-cache, .hg, .svn, .cache, config.rb, prepros.cfg, .DS_Store, bower_components", + "autoprefixerBrowsers": "last 4 versions", + "liveRefreshDelay": 0, + "disableImportAutoCompile": true, + "browserFlow": { + "mouseSync": true, + "scrollSync": true, + "keyboardSync": true, + "animateCss": true + }, + "deployment": { + "ftpHost": "", + "ftpPort": "21", + "ftpUsePrivateKey": false, + "ftpPrivateKey": "", + "ftpRemotePath": "", + "ftpUserName": "", + "ftpPassword": "", + "ftpType": "FTP", + "ftpSecure": false, + "ftpUploadOnModify": false, + "ftpRefreshAfterUpload": false, + "ignorePreprocessableFiles": true, + "copyPath": "Prepros Build", + "excludePatterns": ".map, Prepros Build, config.rb, prepros.cfg, node_modules, .git, .idea, .sass-cache, .hg, .svn, .cache, .DS_Store, bower_components" + }, + "css": { + "path": "css/", + "outputType": "REPLACE_SEGMENT", + "segmentToReplace": "less, sass, stylus, scss, styl", + "segmentToReplaceWith": "css", + "preprocessableFilesDirs": "less/\nsass/\nstylus/\nscss/\nstyl/\n" + }, + "minCss": { + "path": "", + "outputType": "RELATIVE_FILEDIR", + "segmentToReplace": "", + "segmentToReplaceWith": "", + "types": "", + "preprocessableFilesDirs": "", + "filePrefix": "-dist" + }, + "html": { + "segmentToReplace": "jade, haml, slim, markdown, md, kit", + "segmentToReplaceWith": "html", + "path": "html/", + "extension": ".html", + "outputType": "REPLACE_SEGMENT", + "preprocessableFilesDirs": "jade/\nhaml/\nslim/\nmarkdown/\nmd/\nkit" + }, + "js": { + "segmentToReplace": "coffee, coffeescript, coffeescripts, ls, livescript, livescripts", + "segmentToReplaceWith": "html", + "extension": ".html", + "outputType": "REPLACE_SEGMENT", + "preprocessableFilesDirs": "coffee/\ncoffeescript/\ncoffeescripts/\nls/\nlivescript/\nlivescripts", + "path": "js/" + }, + "minJs": { + "path": "", + "outputType": "RELATIVE_FILEDIR", + "segmentToReplace": "", + "segmentToReplaceWith": "", + "types": "", + "preprocessableFilesDirs": "", + "filePrefix": "-dist" + }, + "compilers": { + "less": { + "autoCompile": true, + "autoprefixer": false, + "compress": false, + "sourceMaps": false, + "strictMath": false, + "strictUnits": false + }, + "sass": { + "autoCompile": true, + "autoprefixer": false, + "sourceMaps": false, + "libSass": true, + "nodeSassCompress": true, + "compass": false, + "fullCompass": false, + "outputStyle": "expanded" + }, + "stylus": { + "autoCompile": true, + "sourceMaps": false, + "autoprefixer": false, + "nib": false, + "compress": false + }, + "markdown": { + "autoCompile": true, + "sanitize": false, + "gfm": true, + "wrapWithHtml": false + }, + "coffee": { + "autoCompile": true, + "bare": false, + "uglify": false, + "mangle": true, + "iced": false, + "sourceMaps": false + }, + "livescript": { + "autoCompile": true, + "bare": false, + "uglify": false, + "mangle": true + }, + "javascript": { + "autoCompile": false, + "uglify": true, + "mangle": true, + "sourceMaps": false + }, + "jade": { + "autoCompile": true, + "pretty": true + }, + "haml": { + "autoCompile": true, + "pretty": true, + "doubleQuotes": false + }, + "kit": { + "autoCompile": true + }, + "slim": { + "autoCompile": true, + "pretty": true, + "indent": "default" + }, + "css": { + "autoCompile": false, + "sourceMaps": false, + "compress": true, + "cssnext": false, + "autoprefixer": false + }, + "uglify": { + "compress": { + "sequences": true, + "properties": true, + "dead_code": true, + "drop_debugger": true, + "unsafe": false, + "unsafe_comps": false, + "conditionals": true, + "comparisons": true, + "evaluate": true, + "booleans": true, + "loops": true, + "unused": true, + "hoist_funs": true, + "keep_fargs": false, + "hoist_vars": false, + "if_return": true, + "join_vars": true, + "cascade": true, + "side_effects": true, + "pure_getters": false, + "negate_iife": true, + "screw_ie8": false, + "drop_console": false, + "angular": false, + "warnings": true, + "pure_funcs": null, + "global_defs": null + }, + "output": { + "quote_keys": false, + "space_colon": true, + "ascii_only": false, + "unescape_regexps": false, + "inline_script": false, + "beautify": false, + "bracketize": false, + "semicolons": true, + "comments": false, + "preserve_line": false, + "screw_ie8": false, + "preamble": null + } + } + } + } + } + } +] \ No newline at end of file diff --git a/modules/gls/views/css/style.css b/modules/gls/views/css/style.css new file mode 100644 index 00000000..3aa48478 --- /dev/null +++ b/modules/gls/views/css/style.css @@ -0,0 +1,559 @@ +div.PS_GLSFormType +{ + width:100%; + margin-top:20px; +} + +div.PS_GLSFormType fieldset > ul +{ + list-style-type: none; +} + +div.PS_GLSFormType fieldset > ul > li +{ + margin-top:10px; +} + +div.PS_GLSFormType fieldset > ul > li > span.indication +{ + font-style:italic; + font-size:11px; + margin-left:5px; +} + +div.PS_GLSFormType fieldset > ul > li.PS_GLSSubmit +{ + text-align:center; +} + +div.PS_GLSSubmitButton +{ + text-align:center; + margin-top:20px; +} + +.PS_GLSRequireFields +{ + display:inline; + padding:2px 10px; +} + +tr.PS_GLSErrorList td +{ + border: 1px solid #EC9B9B; + background-color: #FFE2E3; + color: #383838; + font-weight: 700; + line-height: 18px; + text-align:center; +} + +tr.PS_GLSSuccessList td +{ + border: 1px solid #72CB67; + background-color: #DFFAD3; + color: #383838; + font-weight: 700; + line-height: 18px; + text-align:center; +} + +table#PS_GLSHistoriqueTableList +{ + text-align:center; +} + +table#PS_GLSHistoriqueTableList tr > td > img +{ + margin-bottom:5px; +} + +table#PS_GLSHistoriqueTableList +{ + width:100%; +} + +table#PS_GLSHistoriqueTableList tr +{ + height:30px; +} + +div#otherErrors +{ + display:none; +} + +div#otherErrors span +{ + text-align:left; +} + +div#PS_GLSUnRemovedItem +{ + display:none; + color:#FF0000; +} + +.shippingList { + +} +.shippingList li { + margin: 5px; + display: block; + clear: both; +} +.shipLabel { + width: 230px; + float: left; + text-align: left; +} +.selectShipping { + width: 100px; +} +.settingsList { + width: 400px; + float: left; + margin-right: 10px; +} +.settingsList li { + display: block; + padding: 5px; + clear: both; +} +.upsLabel { + width: 170px; + float: left; + text-align: left; +} +.upsInput { + float: left; +} +.upsSubmit { + text-align: center; +} +.addMethodForm { + margin-bottom: 10px; +} + +table#orders +{ + width:100%; +} + +table#orders td +{ + text-align:center; + height: 30px; +} + +table#orders th +{ + text-align:center; + height: 40px; +} + +table#orders th.fixed +{ + width:70px; +} + +table#orders tr +{ + text-align:center; +} + +div.submit_button +{ + margin-top:10px; + text-align:center; +} + +div.PS_GLSLoader +{ + display:none; +} + +.GLS_form_admintab h3 +{ + margin: 10px; + margin-bottom: .5em; + line-height: 1.4em; +} + +div#PS_GLSAskBackupContent +{ + border:1px solid #000; + background: url(../logo_hd.png) no-repeat 10px 50px #BEBEBE; + line-height:18px; + font-size:14px; + height:190px; +} + +div#PS_GLSAskBackupContent div +{ + width:290px; + float:right; + margin-right:20px; + text-align: center; +} + +div#PS_GLSAskBackupContent div > p +{ + line-height: 30px; +} + +div#PS_GLSAskBackupContent h2 +{ + padding-top:10px; +} + +tr.PS_GLSSelectedCarrier > td +{ + text-align: center; + border-bottom: 1px black; +} + +.PS_GLSWarn +{ + border: 1px solid #D3C200; + background-color: #FFFAC6; + line-height: 20px; +} + +.PS_GLSRelayPointInfo +{ + text-align: left; + vertical-align: top; + margin: 10px 0; + cursor: pointer; +} + +.PS_GLSRelayPointInfo:hover +{ + background-color: #f4f4f4; +} + +.PS_GLSRelayPointInfo img +{ + height: 40px; + float:left; + padding: 0 10px; +} + +.PS_GLSRelayPointInfo p +{ + float:left; + width:360px; + text-align: justify; +} + +.PS_GLSFloatRelayPointSelecteIt +{ + display:block; +} + +.PS_GLSRelayPointInfo:hover .PS_GLSFloatRelayPointSelecteIt +{ + display:block; +} + +.PS_GLSRelayPointInfo .PS_GLSFloatRelayPointSelected +{ + color:#333333; + background:url(../images/selectRelayPoint.png) no-repeat 0px -25px; +} + +.PS_GLSFloatRelayPointSelected +{ + display:block; +} + +.PS_GLSFloatRelayPointSelecteIt a.PS_GLSSelectRelayPointButton +{ + float:right; + display: block; + width: 60px; + height: 20px; + padding: 5px 20px 0px 25px; + color:#666666; + text-decoration: none; + margin-top: 8px; + background:url(../images/selectRelayPoint.png) no-repeat 0px 0px; +} + +.PS_GLSFloatRelayPointSelected a.PS_GLSSelectRelayPointButton +{ + font-size: 10px; + float:right; + display: block; + width: 60px; + height: 20px; + padding: 7px 20px 0px 25px; + text-decoration: none; + margin-top: 8px; + color:#333333; + background:url(../images/selectRelayPoint.png) no-repeat 0px -25px; +} + +a.PS_GLSSelectRelayPointButton:hover +{ + color:#333333; + background:url(../images/selectRelayPoint.png) no-repeat 0px -25px; +} + +.PS_GLSGmapDefaultPosition +{ + display:none; +} + +div.PS_GLSGmapStyle +{ + width: 550px; + height:250px; + display: none; +} + +div#PS_GLSPersonalizedFields +{ + display:none; +} + +.clearfix:before, +.clearfix:after +{ + content: "."; + display: block; + height: 0; + overflow: hidden +} +.clearfix:after {clear: both} +.clearfix {zoom: 1} + +.PS_GLSGmapBulbe +{ + width:405px; + height:66px; + overflow: hidden; +} + +.GLS_date {width:450px;position:relative;float:right; line-height: 9px;} +.GLS_date span.titre {margin-left:50px;font-weight:bold;} +.GLS_date span.vacances {margin-left:5px;color:Red; } +.GLS_date table {border-spacing:3px;font-size:11pt; border: solid 1px #eee;} +.GLS_date tr.p {background-color:#e9e9e9; height:9px;} +.GLS_date td.g {font-weight:bold;} +.GLS_date td.d {} + +/* 1.3 compatibility*/ +.GLS_warn +{ + border: 1px solid #D3C200; + background-color: #FFFAC6; + color: #383838; + font-weight: 700; + margin: 0 0 10px 0; + line-height: 20px; + padding: 10px 0px; + text-align: center; +} + +/* 1.3 compatibility*/ +.GLS_error +{ + border: 1px solid #EC9B9B; + background-color: #FAE2E3; + color: #383838; + font-weight: 700; + margin: 0 0 10px 0; + line-height: 20px; + padding: 10px 0px; + text-align: center; +} + +.GLS_error ul > li, .GLS_warn ul > li +{ + list-style: none; + text-align: left; +} + +/* 1.3 - 1.4 compatibility*/ +.GLS_hint +{ + margin-top: 4px; + margin-bottom: 2px; + border: 1px solid #268CCD; + padding: 8px 6px 8px 34px; + color: #383838; + background: #F1F9FF; + border-radius: 3px; +} + +#GLS_config_menu +{ + background-color: #F8F8F8; + border: 1px solid #CCC; + margin-bottom: 10px; + padding: 10px 0; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-image: initial; + height: 110px; +} + +#GLS_config_menu ul +{ + margin: 0 auto; + padding: 0; + width:100%; +} + +#GLS_config_menu ul > li +{ + color: #666; + float: left; + list-style: none outside none; + padding: 10px 40px; + text-align: center; +} + +#GLS_config_menu ul > li.selected +{ + color: #383838; + font-weight: bolder; + border: 1px solid #CCC; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + background-color: #EBEDF4; +} + +#GLS_config_menu ul > li.selected > a +{ + color: #383838; + font-weight: bolder; +} + +#GLS_error_account +{ + text-align: center; +} + +.send_disable_carrier_form { + cursor: pointer; +} + +.nobootstrap .alert.alert-danger, .nobootstrap #carrier_wizard .wizard_error { + padding-left: 50px; + position: relative; + border: none; + border-left: solid 3px #e17875; +} + +.nobootstrap .alert-danger, .nobootstrap #carrier_wizard .wizard_error { +background-color: #f2dede; +border-color: #ebccd1; +color: #a94442; +} + +.nobootstrap .alert, .nobootstrap #carrier_wizard .wizard_error { +padding: 15px; +margin-bottom: 17px; +border: 1px solid transparent; +border-radius: 3px; +} + +.nobootstrap .alert.alert-danger:before, .nobootstrap #carrier_wizard .wizard_error:before { +position: absolute; +top: 6px; +left: 7px; +display: block; +height: 25px; +width: 25px; +color: #e17875; +} + +.icon-warning:before, .icon-exclamation-triangle:before, .icon-warning-sign:before, .nobootstrap .alert.alert-danger:before, .nobootstrap #carrier_wizard .wizard_error:before { +content: "\f071"; +} + +.icon-3x, .nobootstrap .alert.alert-warning:before, .nobootstrap .alert.alert-danger:before, .nobootstrap #carrier_wizard .wizard_error:before, .nobootstrap .alert.alert-success:before, .nobootstrap .alert.alert-info:before, .nobootstrap .alert.alert-addons:before, .nobootstrap .alert.alert-message:before { +font-size: 3em; +} + +.icon, .page-sidebar-closed:not(.nav-topbar):not(.mobile-nav) .searchtab:before, [class^="icon-"], [class^="process-icon-"], .nobootstrap .alert.alert-warning:before, .nobootstrap .alert.alert-danger:before, .nobootstrap #carrier_wizard .wizard_error:before, .nobootstrap .alert.alert-success:before, .nobootstrap .alert.alert-info:before, .nobootstrap .alert.alert-addons:before, .nobootstrap .alert.alert-message:before, .nobootstrap .table td.dragHandle .dragGroup:before, .nobootstrap #dashboard .loading .data_value:before, .nobootstrap #employee-thumbnail:before, .mce-ico, .chosen-container-single .chosen-single div b, .chosen-container-single .chosen-search:before { +display: inline-block; +font-family: FontAwesome; +font-style: normal; +font-weight: normal; +line-height: 1; +-webkit-font-smoothing: antialiased; +-moz-osx-font-smoothing: grayscale; +} + +.nobootstrap *:before, .nobootstrap *:after { +-webkit-box-sizing: border-box; +-moz-box-sizing: border-box; +box-sizing: border-box; +} + +.nobootstrap .alert.alert-success, .nobootstrap #carrier_wizard .alert-success.wizard_error { +padding-left: 50px; +position: relative; +border: none; +border-left: solid 3px #7cc67c; +} + +.nobootstrap .alert-success { +background-color: #dff0d8; +border-color: #d6e9c6; +color: #3c763d; +} + +.nobootstrap .alert, .nobootstrap #carrier_wizard .wizard_error { +padding: 15px; +margin-bottom: 17px; +border: 1px solid transparent; +border-radius: 3px; +} + +.nobootstrap .alert.alert-success:before, .nobootstrap #carrier_wizard .alert-success.wizard_error:before { +position: absolute; +top: 6px; +left: 7px; +display: block; +height: 25px; +width: 25px; +color: #7cc67c; +} + +.icon-check-circle:before, .icon-ok-sign:before, .nobootstrap .alert.alert-success:before, .nobootstrap #carrier_wizard .alert-success.wizard_error:before { +content: "\f058"; +} + +.icon-3x, .nobootstrap .alert.alert-warning:before, .nobootstrap .alert.alert-danger:before, .nobootstrap #carrier_wizard .wizard_error:before, .nobootstrap .alert.alert-success:before, .nobootstrap .alert.alert-info:before, .nobootstrap .alert.alert-addons:before, .nobootstrap .alert.alert-message:before { +font-size: 3em; +} + +.icon, .page-sidebar-closed:not(.nav-topbar):not(.mobile-nav) .searchtab:before, [class^="icon-"], [class^="process-icon-"], .nobootstrap .alert.alert-warning:before, .nobootstrap .alert.alert-danger:before, .nobootstrap #carrier_wizard .wizard_error:before, .nobootstrap .alert.alert-success:before, .nobootstrap .alert.alert-info:before, .nobootstrap .alert.alert-addons:before, .nobootstrap .alert.alert-message:before, .nobootstrap .table td.dragHandle .dragGroup:before, .nobootstrap #dashboard .loading .data_value:before, .nobootstrap #employee-thumbnail:before, .mce-ico, .chosen-container-single .chosen-single div b, .chosen-container-single .chosen-search:before { +display: inline-block; +font-family: FontAwesome; +font-style: normal; +font-weight: normal; +line-height: 1; +-webkit-font-smoothing: antialiased; +-moz-osx-font-smoothing: grayscale; +} + +.nobootstrap *:before, .nobootstrap *:after { +-webkit-box-sizing: border-box; +-moz-box-sizing: border-box; +box-sizing: border-box; +} + +.gls_legend{ + width: 500px; + margin-left: 46px; + font-style: italic; + text-align: justify; +} \ No newline at end of file diff --git a/modules/gls/views/img/btn_fermer.png b/modules/gls/views/img/btn_fermer.png new file mode 100644 index 00000000..72a946b7 Binary files /dev/null and b/modules/gls/views/img/btn_fermer.png differ diff --git a/modules/gls/views/img/details.gif b/modules/gls/views/img/details.gif new file mode 100644 index 00000000..95eaaa9a Binary files /dev/null and b/modules/gls/views/img/details.gif differ diff --git a/modules/gls/views/img/getTickets.gif b/modules/gls/views/img/getTickets.gif new file mode 100644 index 00000000..b4c8c376 Binary files /dev/null and b/modules/gls/views/img/getTickets.gif differ diff --git a/modules/gls/views/img/icones/account_detail.png b/modules/gls/views/img/icones/account_detail.png new file mode 100644 index 00000000..f939bbdc Binary files /dev/null and b/modules/gls/views/img/icones/account_detail.png differ diff --git a/modules/gls/views/img/icones/index.php b/modules/gls/views/img/icones/index.php new file mode 100644 index 00000000..dc7351df --- /dev/null +++ b/modules/gls/views/img/icones/index.php @@ -0,0 +1,28 @@ + +* @copyright 2007-2014 Addonline +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; \ No newline at end of file diff --git a/modules/gls/views/img/icones/info.png b/modules/gls/views/img/icones/info.png new file mode 100644 index 00000000..ea00799b Binary files /dev/null and b/modules/gls/views/img/icones/info.png differ diff --git a/modules/gls/views/img/icones/settings.png b/modules/gls/views/img/icones/settings.png new file mode 100644 index 00000000..81160c93 Binary files /dev/null and b/modules/gls/views/img/icones/settings.png differ diff --git a/modules/gls/views/img/icones/supplier.png b/modules/gls/views/img/icones/supplier.png new file mode 100644 index 00000000..8f2f4d1c Binary files /dev/null and b/modules/gls/views/img/icones/supplier.png differ diff --git a/modules/gls/views/img/index.php b/modules/gls/views/img/index.php new file mode 100644 index 00000000..dc7351df --- /dev/null +++ b/modules/gls/views/img/index.php @@ -0,0 +1,28 @@ + +* @copyright 2007-2014 Addonline +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; \ No newline at end of file diff --git a/modules/gls/views/img/logo.png b/modules/gls/views/img/logo.png new file mode 100644 index 00000000..3be04e96 Binary files /dev/null and b/modules/gls/views/img/logo.png differ diff --git a/modules/gls/views/img/marker.png b/modules/gls/views/img/marker.png new file mode 100644 index 00000000..b59bd4cc Binary files /dev/null and b/modules/gls/views/img/marker.png differ diff --git a/modules/gls/views/img/marker_current.png b/modules/gls/views/img/marker_current.png new file mode 100644 index 00000000..4da68966 Binary files /dev/null and b/modules/gls/views/img/marker_current.png differ diff --git a/modules/gls/views/img/pdf_icon.jpg b/modules/gls/views/img/pdf_icon.jpg new file mode 100644 index 00000000..81712ce7 Binary files /dev/null and b/modules/gls/views/img/pdf_icon.jpg differ diff --git a/modules/gls/views/img/picto-arrow.png b/modules/gls/views/img/picto-arrow.png new file mode 100644 index 00000000..25005476 Binary files /dev/null and b/modules/gls/views/img/picto-arrow.png differ diff --git a/modules/gls/views/img/picto_ado.png b/modules/gls/views/img/picto_ado.png new file mode 100644 index 00000000..de7f4e38 Binary files /dev/null and b/modules/gls/views/img/picto_ado.png differ diff --git a/modules/gls/views/img/picto_bp.png b/modules/gls/views/img/picto_bp.png new file mode 100644 index 00000000..0812441a Binary files /dev/null and b/modules/gls/views/img/picto_bp.png differ diff --git a/modules/gls/views/img/picto_mid.png b/modules/gls/views/img/picto_mid.png new file mode 100644 index 00000000..e7d45248 Binary files /dev/null and b/modules/gls/views/img/picto_mid.png differ diff --git a/modules/gls/views/img/picto_shd.png b/modules/gls/views/img/picto_shd.png new file mode 100644 index 00000000..3cff7afd Binary files /dev/null and b/modules/gls/views/img/picto_shd.png differ diff --git a/modules/gls/views/img/search-repeat.png b/modules/gls/views/img/search-repeat.png new file mode 100644 index 00000000..4c844104 Binary files /dev/null and b/modules/gls/views/img/search-repeat.png differ diff --git a/modules/gls/views/img/title-repeat.png b/modules/gls/views/img/title-repeat.png new file mode 100644 index 00000000..8b2f60c6 Binary files /dev/null and b/modules/gls/views/img/title-repeat.png differ diff --git a/modules/gls/views/index.php b/modules/gls/views/index.php new file mode 100644 index 00000000..dc7351df --- /dev/null +++ b/modules/gls/views/index.php @@ -0,0 +1,28 @@ + +* @copyright 2007-2014 Addonline +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; \ No newline at end of file diff --git a/modules/gls/views/js/gls.js b/modules/gls/views/js/gls.js new file mode 100644 index 00000000..63f62ffa --- /dev/null +++ b/modules/gls/views/js/gls.js @@ -0,0 +1,1164 @@ +var PS_GLSObject = (function($, undefined) { + + var selected_id_carrier = 0; + var selected_relay_point = 0; + var toggle_status_order_list = false; + var toggle_history_order_list = false; + var relay_point_max = 10; + var last_gmap_info_clicked = ''; + +// /!\ All the following list data could be store into the same variable +// But for a better reading of the code, there are separated + +// List of the supplier id which the user trying to fetch the relay + var fetchingRelayPoint = new Array(); + +// List of the relay point object + var relayPointDataContainers = new Array(); + +// List of the google map object + var GmapList = new Object(); + +// List the marker liable to the relay pint + var markerList = new Object(); + + var selected = false; + + /** + * Toggle selected orders + */ + function toggleOrderListSelection() + { + toggle_status_order_list = !toggle_status_order_list; + $('input[name="order_id_list[]"]').attr('checked', toggle_status_order_list); + } + + /** + * Toggle selected histories + */ + function toggleHistoryListSelection() + { + toggle_history_order_list = !toggle_history_order_list; + $('input[name="history_id_list[]"]').attr('checked', toggle_history_order_list); + } + + /** + * Request Ajax call to get tickets + * + * @param detailedExpeditionList + */ + function getTickets(detailedExpeditionList) + { + $.ajax( + { + type : 'POST', + url : window.location.href, + data : {'detailedExpeditionList':detailedExpeditionList, 'method':'GLSGetTickets', 'glstoken':glstoken}, + dataType: 'json', + success: function(json) + { + if (json && json.success) + { + $('#GLS_error_histories').remove(); + for (id_order in json.success) + if (json.success[id_order]) + { + $('#URLA4_' + id_order).html('\ + download pdf'); + $('#URLA5_' + id_order).html('\ + download pdf'); + $('#expeditionNumber_' + id_order).html(json.success[id_order].expeditionNumber); + $('#detailHistory_' + id_order).children('td').children('input').attr('value', json.success[id_order].id_gls_history); + $('#detailHistory_' + id_order).children('td').children('input').attr('id', 'PS_GLSHistoryId_' + json.success[id_order].id_gls_history); + } + } + displayBackGenerateSubmitButton(); + displayBackHistoriesSubmitButton(); + }, + error: function(xhr, ajaxOptions, thrownError) + { + displayBackGenerateSubmitButton(); + } + }); + } + + /** + * Check error for the generated tickets + * @param json + */ + function checkErrorGeneratedTickets(json) + { + i = 0; + $('.PS_GLSErrorList').fadeOut('fast', function() + { + if ((++i >= $('.PS_GLSErrorList').length) && json && json.error) + for (id_order in json.error) + if (json.error[id_order] && json.error[id_order].length) + { + $('#errorCreatingTicket_' + id_order).children('td').children('span').html(''); + $('#errorCreatingTicket_' + id_order).fadeOut('slow'); + $('#errorCreatingTicket_' + id_order).fadeIn('slow'); + for (numError in json.error[id_order]) + $('#errorCreatingTicket_' + id_order).children('td').children('span').append(json.error[id_order][numError] + '
'); + } + }); + checkOtherErrors(json); + } + + /** + * Check Errors code + * @param json + */ + function checkOtherErrors(json) + { + $('#otherErrors').fadeOut('fast', function() + { + if (json && json.other && json.other.error) + for (numError in json.other.error) + if (json.other.error[numError]) + { + $('#otherErrors').fadeIn('slow'); + $('#otherErrors').children('span').html(''); + $('#otherErrors').children('span').append(json.other.error[numError]); + } + }); + } + + /** + * Check anything about generated tickets + * @param json + */ + function checkSucceedGenerateTickets(json) + { + detailedExpeditionList = new Array(); + + i = 0; + $('.PS_GLSSuccessList').fadeOut('fast', function() + { + if ((++i >= $('.PS_GLSSuccessList').length) && json && json.success) + { + for (id_order in json.success) + if (json.success[id_order] && json.success[id_order].expeditionNumber) + { + $('#successCreatingTicket_' + id_order).children('td').children('span').html(''); + $('#PS_GLSLineOrderInformation-' + id_order).remove(); + $('#successCreatingTicket_' + id_order).fadeIn('slow'); + detailedExpeditionList.push({'id_order':id_order, 'expeditionNumber':json.success[id_order].expeditionNumber}); + + if (!$('#detailHistory_' + id_order).length) + { + $('#PS_GLSHistoriqueTableList').append('\ + \ + \ + ' + id_order + '\ + \ + \ + \ + '); + } + else + { + $('#detailHistory_' + id_order).children('#URLA4_' + id_order).html(''); + $('#detailHistory_' + id_order).children('#URLA5_' + id_order).html(''); + $('#detailHistory_' + id_order).children('#expeditionNumber_' + id_order).html(''); + } + } + } + }); + return detailedExpeditionList; + } + + /** + * Display the button to generate tickets + */ + function displayBackGenerateSubmitButton() + { + $('#PS_GLSSubmitGenerateLoader').css('display', 'none'); + if ($('.order_id_list').length) + $('#PS_GLSSubmitButtonGenerateTicket').fadeIn('slow'); + } + + /** + * Display the button to delete histories + */ + function displayBackHistoriesSubmitButton() + { + $('#PS_GLSSubmitDeleteHistoriesLoader').css('display', 'none'); + if ($('.history_id_list').length) + $('#PS_GLSSubmitButtonDeleteHistories').fadeIn('slow'); + } + + /** + * Request an ajax call to generate the tickets + */ + function exportOrdersAjax(param) + { + + var order_id_list = new Array(); + var weight_list = new Array(); + + $('#PS_GLSSubmitButtonGenerateTicket').css('display', 'none'); + $('#PS_GLSSubmitGenerateLoader').fadeIn('slow'); + $('.PS_GLSLoader').css('display', 'block'); + + numSelected = $('input[name="order_id_list[]"]:checked').length; + $('input[name="order_id_list[]"]:checked').each(function() + { + order_id_list.push($(this).val()); + weight_list.push(($('#weight_' + $(this).val()).val()) + '-' + $(this).val()); + }); + + $.ajax( + { + type : 'POST', + url: _PS_GLS_MODULE_DIR_ + 'ajax.php', + data : {'order_id_list' : order_id_list, + 'numSelected' : numSelected, + 'weight_list' : weight_list, + 'method' : 'GLSexportToWinExpe', + 'glstoken' : glstoken}, + dataType: 'json', + success: function(json) + { + jQuery(".confirm").remove(); + jQuery(".error").remove(); + jQuery(".alert-success").remove(); + jQuery(".alert-danger").remove(); + /* if(json.substr(0,1)>0){ + jQuery(".path_bar").after('
'+json+'
'); + jQuery("#content").find('.bootstrap').after('
'+json+'
'); + }else{ + jQuery(".path_bar").after('
'+json+'
'); + jQuery("#content").find('.bootstrap').after('
'+json+'
'); + } */ + + if(param == 'local' && json != 'Error : No order to export'){ + document.location=json; + }else if(param == 'local' && json == 'Error : No order to export'){ + alert(json); + } + + + detailedExpeditionList = new Array(); + + checkErrorGeneratedTickets(json); + detailedExpeditionList = checkSucceedGenerateTickets(json); + $('.PS_GLSLoader').css('display', 'none'); + if (detailedExpeditionList.length) + getTickets(detailedExpeditionList); + else + displayBackGenerateSubmitButton(); + }, + error: function(xhr, ajaxOptions, thrownError) + { + display_generate_button = true; + displayBackGenerateSubmitButton(); + } + }); + delete(order_id_list); + delete(weight_list); + } + + + function importOrdersAjax(){ + + id_order_state = $('#id_order_state_import option:selected').val(); + + $.ajax( + { + type : 'POST', + url: _PS_GLS_MODULE_DIR_ + 'ajax.php', + data : {'method' : 'GLSImportFromWinExpe', + 'glstoken' : glstoken, + 'id_order_state' : id_order_state}, + dataType: 'json', + success: function(json) + { + jQuery(".confirm").remove(); + jQuery(".error").remove(); + jQuery(".alert-success").remove(); + jQuery(".alert-danger").remove(); + if(json.substr(0,1)>=1){ + jQuery(".path_bar").after('
'+json+'
'); + jQuery("#content").find('.bootstrap').after('
'+json+'
'); + }else{ + jQuery(".path_bar").after('
'+json+'
'); + jQuery("#content").find('.bootstrap').after('
'+json+'
'); + } + }, + error: function(xhr, ajaxOptions, thrownError) + { + + } + }); + } + + /** + * Display deleted history details + */ + function displayDeletedHistoryInformation() + { + $('input[name="history_id_list[]"]:checked').each(function() + { + $(this).parent().parent().css('background-color', '#FFE2E3'); + }); + displayBackHistoriesSubmitButton(); + } + + /** + * Manage the removed histories id + * + * @param json + */ + function checkDeletedHistoriesId(json) + { + if (json && json.success) + { + // Allow to wait the end of the loop to manage unremoved item + i = 0; + for (numberHistoryId in json.success.deletedListId) + { + $('#PS_GLSHistoryId_' + json.success.deletedListId[numberHistoryId]).parent().parent().fadeOut('fast', function() { + $(this).remove(); + // Fadeout is asynchome verify everytime the number element + if (++i == json.success.deletedListId.length) + displayDeletedHistoryInformation(json.success.deletedListId.length); + }); + } + // Use if none element exist in the list + if (i == json.success.deletedListId.length) + displayDeletedHistoryInformation(); + } + else + displayBackHistoriesSubmitButton(); + } + + /** + * Delete the histories selected by the merchant + */ + function deleteSelectedHistories() + { + var history_id_list = new Array(); + + $('#PS_GLSSubmitButtonDeleteHistories').css('display', 'none'); + $('#PS_GLSSubmitDeleteHistoriesLoader').fadeIn('slow'); + + numSelected = $('input[name="order_id_list[]"]:checked').length; + $('input[name="history_id_list[]"]:checked').each(function() + { + history_id_list.push($(this).val()); + }); + + $.ajax( + { + type : 'POST', + url : window.location.href, + data : {'history_id_list' : history_id_list, + 'numSelected' : numSelected, + 'method' : 'DeleteHistory', + 'glstoken' : glstoken}, + dataType: 'json', + success: function(json) + { + checkOtherErrors(json); + checkDeletedHistoriesId(json); + }, + error: function(xhr, ajaxOptions, thrownError) + { + display_generate_button = true; + displayBackHistoriesSubmitButton(); + } + }); + } + + /** + * Display a fancy box displaying details about the + * backup of the database + */ + function PS_GLSGetUninstallDetail(url) + { + $.ajax( + { + type: 'POST', + url: window.location.href, + data: {'method' : 'uninstallDetail', + 'action' : 'showFancy', + 'href' : url, + 'glstoken' : glstoken}, + dataType: 'json', + success: function(json) + { + ((json.html.length) ? + $.fancybox(json.html, + { + 'autoDimensions' : false, + 'width' : 450, + 'height' : 'auto', + 'transitionIn' : 'none', + 'transitionOut' : 'none', + 'onComplete' : function() + { + PS_GLSHandleUninstallButton(url); + + // Rewrite some css properties of Fancybox + $('#fancybox-wrap').css('width', ''); + $('#fancybox-content').css('background-color', ''); + $('#fancybox-content').css('border', ''); + } + }) + : ''); + }, + error: function(xhr, ajaxOptions, thrownError) + { + // Put debug to see error detail + } + }); + return false; + } + + /** + * Handle the button when a user clicked on the uninstall button + */ + function PS_GLSHandleUninstallButton(url) + { + $('#PS_GLS_BackupAction').click(function() + { + $.fancybox.close(); + PS_GLSBackupDatabase(url); + }); + + $('#PS_GLS_UninstallAction').click(function() + { + window.location.href = url; + $.fancybox.close(); + return true; + }); + + $('#PS_GLS_StopUninstall').click(function() + { + $.fancybox.close(); + return false; + }); + } + + /** + * Ajax call to keep the database of the module safe + */ + function PS_GLSBackupDatabase(url) + { + $.ajax( + { + type: 'POST', + url: window.location.href, + data: {'method' : 'uninstallDetail', + 'action' : 'backupAndUninstall', + 'glstoken' : glstoken}, + dataType: 'json', + success: function(json) + { + url += '&keepDatabase=true'; + window.location.href = url; + }, + error: function(xhr, ajaxOptions, thrownError) + { + // Put debug to see error detail + } + }); + } + + /** + * Handle function when an user click on a shipping + * + * @param carrierSelected + * @param id_carrier + * @param GLSLivraisonType + */ + function PS_GLSCarrierSelectedProcess(carrierSelected, id_carrier, GLSLivraisonType) + { + // Reset for any carrier changement + if (GLSLivraisonType != 'LD1' && GLSLivraisonType != 'LDS') + { + // Seek Relay point if it doesn't a home delivery mode + PS_GLSGetRelayPoint(carrierSelected); + } + else + { + // Simply add the selected carrier to the db, relay information will be empty + PS_GLSAddSelectedCarrierInDB(id_carrier); + + // Won't have any relay points + PS_GLSSelectedRelayPoint['relayPointNum'] = -1; + } + } + + /** + * Hide the last displayed relay point list + */ + function PS_GLSHideLastRelayPointList() + { + var value = 0; + + if (PS_GLSData.PS_VERSION < '1.5') + value = $('.id_carrier:checked').val(); + else if (PS_GLSData.PS_VERSION >= '1.5') + value = $('.delivery_option_radio:checked').val().replace(',', ''); + + if (value != selected_id_carrier) { + selected_id_carrier = value; + $('.PS_GLSSelectedCarrier').fadeOut('fast'); + } + } + + /** + * Check if the user select a carrier and a relay point if exist + */ + function PS_GLSCheckSelectedRelayPoint() + { + var input; + + // Check if the input is linked to the module and look into + // a temporary variable if a relay point has been selected + if ((input = $('input[name=id_carrier]:checked')).length && + PS_GLSCarrierMethodList[input.val()] != undefined && + PS_GLSSelectedRelayPoint['relayPointNum'] == 0) + { + //$('#PS_GLSSelectCarrierError').fadeIn('fast'); + alert(PS_GLSTranslationList['errorSelection']); + return false; + } + return true; + } + + /** + * Link the generated relay point to an handle click + * Allow to add the selected relay point in the database + */ + function PS_GLSHandleSelectedRelayPoint() + { + // Link all new generated relay point Selected button to an action + $('.PS_GLSSelectRelayPointButton').click(function() + { + // Unselect all previous selection (normaly juste one) + $('.PS_GLSFloatRelayPointSelected').each(function() + { + $(this).attr('class', 'PS_GLSFloatRelayPointSelecteIt'); + $(this).children('a').text(PS_GLSTranslationList['Select']); + }); + // Make the Selection + $(this).html(PS_GLSTranslationList['Selected']); + $(this).parent().attr('class', 'PS_GLSFloatRelayPointSelected'); + + // Get the info about the relay point (relayPoint_RelayPointNumber_IdCarrier) + var tab = $(this).parent().parent().attr('id').split('_'); + + // Store Separated data for the ajax query + if (tab.length == 3) + { + var relayPointNumber = selected_relay_point = tab[1]; + var id_carrier = tab[2]; + PS_GLSAddSelectedRelayPointInDB(relayPointNumber, id_carrier); + } + }); + } + + + /** + * Display the relay point fetched + * + * @param json + * @param blockContent + * @param carrier_id + */ + function PS_GLSDisplayRelayPoint(json, blockContent, carrier_id) + { + if (typeof json != 'undefined' && typeof blockContent != 'undefined') + { + numberDisplayed = 0; + + // Disable Gmap for IE user + // if (!$.browser.msie) + PS_GLSCreateGmap(carrier_id); + blockContent.fadeOut('fast', function() + { + $(this).children('td').html(''); + for (relayPoint in json.success) + { + // Check if the the content wasn't already displayed + contentBlockid = 'relayPoint_' + json.success[relayPoint].Num + '_' + carrier_id; + if (!$('#' + contentBlockid).size()) + { + // Set translation if a preselection exist + var BtTranslation = (PS_GLSSelectedRelayPoint['relayPointNum'] == json.success[relayPoint].Num) ? + PS_GLSTranslationList['Selected'] : PS_GLSTranslationList['Select']; + + var classSelection = (PS_GLSSelectedRelayPoint['relayPointNum'] == json.success[relayPoint].Num) ? + 'PS_GLSFloatRelayPointSelected' : 'PS_GLSFloatRelayPointSelecteIt'; + + $('
' + + '' + + '

' + json.success[relayPoint].LgAdr1 + '
' + json.success[relayPoint].LgAdr3 + + ' - ' + json.success[relayPoint].CP + ' - ' + json.success[relayPoint].Ville + + ' ' + json.success[relayPoint].Pays + '

' + + '
' + + '' + BtTranslation + '' + + '
\ +
').appendTo($(this).children('td')); + + // Store all the object content to prevent an ajax request + relayPointDataContainers[json.success[relayPoint].Num] = json.success[relayPoint]; + ++numberDisplayed; + // Display popup for IE user + //if (!$.browser.msie) + PS_GLSAddGMapMarker(carrier_id, json.success[relayPoint].Num, contentBlockid); + /* else + $('#' + contentBlockid).children('p').click(function() { + PS_GLSOpenPopupDetail(json.success[relayPoint].permaLinkDetail); + });*/ + } + } + PS_GLSHandleSelectedRelayPoint(); + $(this).fadeIn('fast'); + }); + } + } + + /** + * Display error about the fetch of the relay point + * + * @param errorList + * @param blockContent + */ + function PS_GLSDisplayErrorRelayPoint(errorList, blockContent) + { + + blockContent.fadeOut('fast', function() + { + $(this).children('td').html(''); + for (numError in errorList) + { + $('
' + errorList[numError] + '
').appendTo($(this).children('td')); + } + $(this).fadeIn('fast'); + }); + } + + /** + * Fetch the relay point + * + * @param carrierSelected + */ + function PS_GLSFetchRelayPoint(carrierSelected) + { + carrier_id = carrierSelected.val(); + + // Block is an input, we need the 'tr' element + blockTR = carrierSelected.parent().parent(); + // Add a new line to the table after the clicked parent element + blockTR.after(' \ + \ +
\ + \ +
\ + '); + + fetchingRelayPoint[carrier_id] = $('#PS_GLSSelectedCarrier_' + carrier_id); + GLSjQuery.ajax( + { + type: 'POST', + url: _PS_GLS_MODULE_DIR_ + 'ajax.php', + data: {'method' : 'GLSGetRelayPoint', + 'id_carrier' : carrier_id, + 'ajax' : true, + 'step' : 2, + 'glstoken' : glstoken}, + dataType: 'json', + success: function(json) + { + if (json && json.error && json.error.length) + PS_GLSDisplayErrorRelayPoint(json.error, $('#PS_GLSSelectedCarrier_' + carrier_id)); + else if (json && json.success) + PS_GLSDisplayRelayPoint(json, $('#PS_GLSSelectedCarrier_' + carrier_id), carrier_id); + }, + error: function(xhr, ajaxOptions, thrownError) + { + // Put debug to see error detail + } + }); + } + + /** + * Display the relay point of a selected Carrier and keep fetched data + * in the html page (cache) + * + * @param carrierSelected + */ + function PS_GLSGetRelayPoint(carrierSelected) + { + carrier_id = carrierSelected.val(); + + // Init back the inital view, hide existing element, (keep cached) + element = 0; + totalElement = $('.PS_GLSSelectedCarrier').size(); + + // Check if the element has already been fetched + if (totalElement) + // It Works like a foreach + $('.PS_GLSSelectedCarrier').fadeOut('fast', function() + { + if ((element + 1) >= totalElement) + { + // Check if the user already clicked and if the process is done + if (typeof fetchingRelayPoint[carrier_id] != 'undefined') + { + fetchingRelayPoint[carrier_id].fadeIn('fast'); + return ; + } + // If the element isn't cached, we fetch it + PS_GLSFetchRelayPoint(carrierSelected); + } + ++element; + }); + else + PS_GLSFetchRelayPoint(carrierSelected); + } + + /** + * Create the Gmap Block and cache the js object for the carrier + * + * @param id_carrier + */ + function PS_GLSCreateGmap(id_carrier) + { + // This has been written this way because it needed to have a known block + // present everytime in the page. Body is the only one sure. + // It's an hidden block which will be put in the right block when user select his + // own carrier + $('body').prepend('\ + \ + \ +
\ +
'); + $('#PS_GLSGmap_' + id_carrier).gmap3( + { + action: 'init', + callback: function(result) + { + GmapList[id_carrier] = $(this); + // Can't set the display to none by default (bug due to + // navigator that tell to google that the content size = 0 + //$(this).toggle('fast'); + } + } + ); + } + + /** + * Resize the map when the div got changement about dimension / position and displaying + * + * @param $map + */ + function PS_GLSGmapResizeEvent($map) + { + gmap = $map.gmap3({action:'get'}); + google.maps.event.trigger(gmap, 'resize'); + } + + /** + * Move the view of the gmap to a marker + * liable to the relay point + * + * @param $map + * @param marker + * @param relayNum + */ + function PS_GLSGmapPlaceViewOnMarker($map, marker, relayNum) + { + $map.gmap3( + { + action:'panTo', + args:[marker.position], + callback: function() + { + PS_GLSDisplayClickedGmapWindow(marker, relayNum, $map); + + // Make dancing markers in Firefox / IE will use the CPU to 50 to 100 % about + if (!$.browser.msie && !$.browser.mozilla) + (function(m) + { + setTimeout(function() + { + m.setAnimation(google.maps.Animation.BOUNCE); + }, 200); + })(marker); + // marker.setAnimation(google.maps.Animation.BOUNCE); + } + }); + } + + /** + * Stop all dancing marker of the current selected carrier + * + * @param currentMarkerList + */ + function PS_GLSStopDancingMarkers(currentMarkerList) + { + for (markerNumber in currentMarkerList) + if (currentMarkerList[markerNumber] != undefined) + if (currentMarkerList[markerNumber].getAnimation() != null) + currentMarkerList[markerNumber].setAnimation(null); + } + + /** + * Display the Gmap of the selected relay point + * + * @param contentBlockid + * @param $map + */ + function PS_GLSDisplayGmap(contentBlockid, $map) + { + var tab = contentBlockid.split('_'); + var relayPointNumber = tab[1]; + var id_carrier = tab[2]; + + // Stop the dancing marker of the current carrier + PS_GLSStopDancingMarkers(markerList[id_carrier]); + if ($('#PS_GLSGmap_' + id_carrier).css('display') == 'none') + { + $('#' + contentBlockid).after($('#PS_GLSGmap_' + id_carrier)); + $('#PS_GLSGmap_' + id_carrier).slideDown('fast', function() + { + PS_GLSGmapResizeEvent($map); + PS_GLSGmapPlaceViewOnMarker($map, markerList[id_carrier][relayPointNumber], relayPointNumber); + }); + } + else + { + previousElem = $('#PS_GLSGmap_' + id_carrier).prev(); + //$('#' + contentBlockid).after($('#PS_GLSGmap_' + id_carrier)); + $('#PS_GLSGmap_' + id_carrier).toggle('fast', function() + { + if (previousElem.attr('id') != contentBlockid) + { + $('#' + contentBlockid).after($(this)); + $('#PS_GLSGmap_' + id_carrier).slideDown('fast', function() + { + PS_GLSGmapPlaceViewOnMarker($map, markerList[id_carrier][relayPointNumber], relayPointNumber); + }); + } + }); + } + } + + /** + * Generate an html block to display the opening hours details + * + * @param relayInfo + */ + function PS_GLSGetTimeRelayDetail(relayInfo) + { + onClick = 'onClick="PS_GLSOpenPopupDetail(\'' + relayInfo.permaLinkDetail + '\')"'; + + var html = ' \ +
\ + \ +

' + relayInfo.LgAdr1 + '
' + relayInfo.LgAdr3 + + ' - ' + relayInfo.CP + ' - ' + relayInfo.Ville + + ' ' + relayInfo.Pays + '

\ + ' + PS_GLSTranslationList['moreDetails'] + ' \ +
'; + return html; + } + + /** + * Call a GLS page into a popup + * + * @param url + */ + function PS_GLSOpenPopupDetail(url) + { + window.open(url, 'GLS', + 'height=200, width=400, top=100, left=100, toolbar=no, menubar=yes, \ + location=no, resizable=yes, scrollbars=no, status=no'); + } + + /** + * Display the gmap windows selected by the user + * + * @param marker + * @param relayNum + * @param mapObject + */ + function PS_GLSDisplayClickedGmapWindow(marker, relayNum, mapObject) + { + if (last_gmap_info_clicked.length) + { + // Close the last opening window in gmap + if ((lastWin = mapObject.gmap3({action:'get', name:'infowindow', tag:last_gmap_info_clicked}))) + lastWin.close(); + } + + // Open the selected detail window + map = mapObject.gmap3('get'); + if ((currentWindow = mapObject.gmap3({action:'get', name:'infowindow', tag:relayNum}))) + currentWindow.open(map, marker); + last_gmap_info_clicked = relayNum; + } + + /** + * Add a new Marker to a Gmap for a carrier using the + * relay point information + * + * @param id_carrier + * @param relayPointNumber + * @param contentBlockid + */ + function PS_GLSAddGMapMarker(id_carrier, relayPointNumber, contentBlockid) + { + // Check if the gmap has been properly created + if (GmapList[id_carrier] == undefined) + return ; + var relayInfo = relayPointDataContainers[relayPointNumber]; + var detailContentHtml = PS_GLSGetTimeRelayDetail(relayInfo); + + // Add Marker to the map + var fullFormatedAddress = relayInfo.LgAdr1 + ' ' + relayInfo.LgAdr3 + ' ' + + relayInfo.CP + ' ' + relayInfo.Ville + ' ' + relayInfo.Pays; + GmapList[id_carrier].gmap3( + { + action: 'addMarker', + address: fullFormatedAddress, + tag:relayInfo.Num, + map: + { + center: true, + zoom: 14 + }, + marker: { + events: + { + click:function(marker, event, data) + { + PS_GLSDisplayClickedGmapWindow(marker, relayInfo.Num, $(this)); + } + }, + callback: function(marker) + { + if (marker) + { + // Check if the a marker list exist for the carrier, + if (markerList[id_carrier] == undefined) + markerList[id_carrier] = new Object(); + + // Store the marker in the markerList of the carrier + markerList[id_carrier][relayPointNumber] = marker; + + // Link all relay point line info to an action + $('#' + contentBlockid).children('p').click(function() + { + PS_GLSDisplayGmap($(this).parent().attr('id'), GmapList[id_carrier]); + }); + return true; + } + else + $('#' + contentBlockid).children('p').click(function() + { + PS_GLSOpenPopupDetail(relayInfo.permaLinkDetail); + }); + } + }, + infowindow: + { + options: {content:detailContentHtml}, + tag:relayInfo.Num, + callback: function(infowindow) { + + var windowList = $(this).gmap3({action:'get', name:'infowindow', all:true}); + $.each(windowList, function(i, elem) { + elem.close(); + }); + } + } + }); + return false; + } + + /** + * Display the selected form block for the configuration page + * @param block_id + */ + function PS_GLSDisplayConfigurationForm(block_id) + { + var block_form_id = block_id + '_block'; + var total_form = $('.PS_GLSFormType').length; + var i = 0; + + $('.PS_GLSFormType').each(function() + { + if ($(this).attr('id') != block_form_id) + $(this).css('display', 'none'); + if ((i + 1) == total_form) + { + $('#' + block_form_id).fadeIn('fast'); + $('#' + block_id).parents('ul').children('li').attr('class', ''); + $('#' + block_id).parent().attr('class', 'selected'); + } + ++i; + }); + + } + + function checkToDisplayRelayList() + { + if (typeof PS_GLSData != 'undefined') + { + PS_GLSSelectedRelayPoint['relayPointNum'] = selected_relay_point = PS_GLSData.pre_selected_relay; + // PS_VERSION < '1.5' + if (PS_GLSData.PS_VERSION < '1.5') + { + selected_id_carrier = $('input[name=id_carrier]:checked').val(); + // Bind id_carrierX to an ajax call + $.each(PS_GLSData.carrier_list, function(i, carrier) { + $('#id_carrier' + carrier.id_carrier).click(function(){ + PS_GLSCarrierSelectedProcess($(this), carrier.id_carrier, carrier.dlv_mode); + }); + PS_GLSCarrierMethodList[carrier.id_carrier] = carrier.id_gls_method; + if ($('#id_carrier' + carrier.id_carrier).attr('checked')){ + PS_GLSCarrierSelectedProcess($('#id_carrier' + carrier.id_carrier), carrier.id_carrier, carrier.dlv_mode); + } + }); + } + else if (PS_GLSData.PS_VERSION >= '1.5' && PS_GLSData.carrier) + { // 1.5 way + selected_id_carrier = $('input[class=delivery_option_radio]:checked').val().replace(',', ''); + var carrier_block = $('input[class=delivery_option_radio]:checked').parent('div.delivery_option'); + + PS_GLSCarrierMethodList[PS_GLSData.carrier.id] = PS_GLSData.carrier.id_gls_method; + PS_GLSSelectedRelayPoint['carrier_id'] = PS_GLSData.carrier.id; + // Simulate 1.4 table to store the relay point fetched + $(carrier_block).append( + '
' + +'' + +'' + + '' + + '' + +'
' + +'
'); + + PS_GLSCarrierMethodList[PS_GLSData.carrier.id_carrier] = PS_GLSData.carrier.id_gls_method; + PS_GLSCarrierSelectedProcess($('#id_carrier' + PS_GLSData.carrier.id), PS_GLSData.carrier.id, PS_GLSData.carrier.gls_dlv_mode); + } + + // Handle input click of the other input to hide the previous relay point list displayed + $('input[name=id_carrier], .delivery_option_radio').click(function(){ + // Hide GLS input if one of them is not selected + if (PS_GLSCarrierMethodList[$(this).val()] == undefined){ + PS_GLSHideLastRelayPointList(); + } + }); + + // 1.5 OPC Validation - Warn user to select a relay point + $('.payment_module a').live('click', function() { + if (PS_GLSData.PS_VERSION >= '1.5' && PS_GLSData.carrier) + { + var _return = !(!PS_GLSSelectedRelayPoint['carrier_id'] || !PS_GLSSelectedRelayPoint['relayPointNum']); + if (!_return) + alert(PS_GLSTranslationList['errorSelection']); + return _return; + } + }); + } + } + + $(document).ready(function() + { + $('#form').submit(function() + { + return PS_GLSCheckSelectedRelayPoint(); + }); + $('#toggleStatusOrderList').click(function() + { + toggleOrderListSelection(); + }); + $('#toggleStatusHistoryList').click(function() + { + toggleHistoryListSelection(); + }); + $('#generate').click(function() + { + exportOrdersAjax(); + }); + $('#generate-local').click(function() + { + exportOrdersAjax('local'); + }); + $('#importOrders').click(function() + { + importOrdersAjax(); + }); + $('#PS_GLSSubmitButtonDeleteHistories').click(function() + { + deleteSelectedHistories(); + }); + + // Shipping method list + $('.send_disable_carrier_form').click(function() { + $(this).parent('form').submit(); + }); + + // Configuration form page + $('#GLS_config_menu a').each(function() { + $(this).click(function() { + PS_GLSDisplayConfigurationForm($(this).attr('id')); + }); + }) + + $('input[name="processCarrier"]').click(function() { + if (PS_GLSData != 'undefined' && PS_GLSData.carrier != null) { + var result = false; + $.each(PS_GLSData.carrier_list, function(key, value) { + if (value.id_carrier == selected_id_carrier && selected_relay_point > 0) + result = true; + }); + if (result == true) + return true; + alert(PS_GLSWarningMessage); + return false; + } + return true; + }); + + if (typeof(PS_GLS_SELECTED_TAB ) != 'undefined') + $('#GLS_' + PS_GLS_SELECTED_TAB + '_block').fadeIn('fast'); + + // Have the
  • elements centered (TODO: Change it using css if possible) + if ($('#GLS_config_menu').size()) + { + var width = $('#GLS_config_menu').width(); + + // Take directly the ul width woudln't work + var ul_width = 0; + + $('#GLS_config_menu').find('ul > li').each(function() { + + var padding_left = parseInt($(this).css('padding-left').replace(/[^-\d\.]/g, '')); + var padding_right = parseInt($(this).css('padding-right').replace(/[^-\d\.]/g, '')); + + ul_width += parseInt($(this).width()) + padding_left + padding_right; + }); + + width = ((width - ul_width) / 2); + $('#GLS_config_menu').children('ul').css('margin-left', width + 'px'); + } + }); + + // To have public method access for this closure + return { + initFront : function() { + checkToDisplayRelayList(); + }, + uninstall : function(url) + { + return PS_GLSGetUninstallDetail(url); + } + }; +})(jQuery); diff --git a/modules/gls/views/js/glsFront.js b/modules/gls/views/js/glsFront.js new file mode 100644 index 00000000..d5b41d44 --- /dev/null +++ b/modules/gls/views/js/glsFront.js @@ -0,0 +1,608 @@ +/* + * Cette fonction n'est pas définie dans le cas du thème mobile + * et provoque une erreur au clic sur un transporteur + * @see themes/default/js/cartt-summary.js + */ +if (typeof updateExtraCarrier != "function") { + function updateExtraCarrier(id_delivery_option, id_address) + { + /* + * Si l'on met ici le code de la fonction + * le layer gls est dupliqué au clic sur le transporteur + * => on laisse vide + */ + } +} + +/** + * Fonction startWith sur l'objet String de javascript + */ +String.prototype.startWith = function(t, i) { + if (i == false) { + return + (t == this.substring(0, t.length)); + } else { + return (t.toLowerCase() + == this.substring(0, t.length).toLowerCase()); + } +} + +/** + * Variables globales + */ + +var glsMyPosition; +var glsListRelais = new Array(); +var glsRelayMap; +var glsOpenedInfowindow; +var glsRelaisChoisi; +var glsCarrierRelayId = false; +var defaultZipCode = '75001'; +var prestashop1_6 = false; + +/* Liste des markers */ +var glsMarkersArray = []; + +/* + * Suppression des markers + */ +function clearMarkers() { + for (var i = 0; i < glsMarkersArray.length; i++) { + glsMarkersArray[i].setMap(null); + } + glsMarkersArray.length = 0; + glsMarkersArray = []; + jQuery('.gls_point_relay').remove(); +} + +/** + * Initialisation au chargement de la page + */ +jQuery(function($) { + + //Récupération en ajax de l'identifiant du transporteur relais GLS + $.ajax( + { + type: 'POST', + url: baseDir + 'modules/gls/ajaxFront.php', + data: {'method': 'getGLSRelayCarrierId'}, + dataType: 'json', + success: function(json) + { + //Ajout de l'identifiant à la page + $('#gls_carrier_id').remove(); + $(".order_carrier_content").append(""); + glsCarrierRelayId = json.id_carrier; + getPreviouslyChoosenRelay(); + } + }); + + //Récupération en ajax du code postal de facturation + //Fonction déplacée pour faire fonctionner sur la version mobile, car les champs ne sont pas chargé au début du tunnel de commande + /* $.ajax( + { + type : 'POST', + url : baseDir+'modules/gls/ajaxFront.php', + data : {'method' : 'getDefaultZipCode'}, + dataType: 'json', + success: function(json) + { + if(json){ + defaultZipCode = json.postcode; + $("#cp_street").val(json.street); + $("#cp_city").val(json.city); + if(json.phone_mobile){ + $('#num_telephone').val(json.phone_mobile); + }else{ + $('#num_telephone').val(json.phone_number); + } + } + } + }); + */ + + /** + * Sur l'événement change des radios boutons de choix de mode de livraison + */ + if ($("body").hasClass("ui-mobile-viewport")) { + $(document).on("change", "input.delivery_option_radio", function() { + shippingGLSRadioCheck(this); + }); + } else { + $(document).on("click", "input.delivery_option_radio", function() { + shippingGLSRadioCheck(this); + }); + } + + /* + * Bouton fermer la popup + */ + jQuery(document).on("click", "#layer_gls_body .close", function() { + jQuery("#layer_gls_body").popup('hide'); + }); + + /* + * Sur l'évènement de choix de relay + */ + $('.choose-relay-point').live("click", function(e) { + e.preventDefault(); + choisirRelaisGLS($(this).data('relayindex')); + }); + /* + * Sur la validation du transporteur + */ + $('button[name="processCarrier"]').click(function() { + if ($('#gls_relais_choisi').size() < 1 && $('.delivery_option_radio[value="' + glsCarrierRelayId + ',"]').attr('checked')) { + if ($('.cart_navigation').length > 0) { + if ($('.GLSWarning').length == 0) { + $('.cart_navigation').prepend('
    ' + PS_GLSWarningNoRelay + '
    '); + } + } else { + alert(PS_GLSWarningNoRelay); + } + return false; + } else { + return true; + } + }); + $('input[name="processCarrier"]').click(function() { + if (!$('.delivery_option_radio[value="' + glsCarrierRelayId + ',"]').attr('checked') && $('#gls_relais_choisi').size() > 0) { + resetPointRelay(); + } + + if ($('#gls_relais_choisi').size() < 1 && $('.delivery_option_radio[value="' + glsCarrierRelayId + ',"]').attr('checked')) { + alert(PS_GLSWarningNoRelay); + return false; + } else { + return true; + } + }); + + /* Seules les saisies numériques sont autorisées dans les champs textes */ + $("#layer_gls_wrapper #cp_recherche").keypress(function(e) { + var charCode = (e.which) ? e.which : e.keyCode; + if (charCode > 31 && (charCode < 48 || charCode > 57)) { + return false; + } + return true; + }); + + jQuery(document).on('click', '.modifier_relay', function(e) { + jQuery('.delivery_option_radio[value="' + glsCarrierRelayId + ',"]').click(); + if (jQuery.uniform) { + jQuery.uniform.update(); + } + }); + + + /* + * Initialsation des popup + */ + if ($('.delivery_option_radio[value="' + glsCarrierRelayId + ',"]').next().find('.delivery_option_title').size() > 0) { + prestashop1_6 = false; + } else { + prestashop1_6 = true; + } + + if (prestashop1_6) { + + //Initialisation du plugin + jQuery("#layer_gls_body").popup({ + beforeopen: function() { + glsRelayMap = new google.maps.Map(document.getElementById('map_gls'), mapOptions); + }, + onclose: function() { + resetGLSShippingMethod(); + }, + transition: 'all 0.3s', + }); + } else { + jQuery("#layer_gls_body").popup({ + transition: 'all 0.3s', + beforeopen: function() { + glsRelayMap = new google.maps.Map(document.getElementById('map_gls'), mapOptions); + }, + onclose: function() { + resetGLSShippingMethod(); + } + }); + } + +}); + +function shippingGLSRadioCheck(element) { + var idCarrierSelected = $(element).val().slice(0, -1); + console.log('enter shippingGLSRadioCheck : ' + glsCarrierRelayId); + + if (idCarrierSelected == glsCarrierRelayId) { + geocoder = new google.maps.Geocoder(); + + console.log('TRY cp_street'); + if (!$("#cp_street").val()) { + console.log('TRY ajaxFront'); + //Récupération en ajax du code postal de facturation + $.ajax( + { + type: 'POST', + url: baseDir + 'modules/gls/ajaxFront.php', + data: {'method': 'getDefaultZipCode'}, + dataType: 'json', + success: function(json) + { + console.log('SUCCESS ajaxFront'); + if (json) { + defaultZipCode = json.postcode; + $("#cp_street").val(json.street); + $("#cp_city").val(json.city); + if (json.phone_mobile) { + $('#num_telephone').val(json.phone_mobile); + } else { + $('#num_telephone').val(json.phone_number); + } + } + + geocodeGLSAdresse(); + } + }); + } else { + geocodeGLSAdresse(); + } + + } +} + +function resetGLSShippingMethod() { + if (jQuery('#gls_relais_choisi').size() == 0) { + console.log('TEST 1'); + jQuery("input[class='delivery_option_radio']:checked").prop("checked", ""); + console.log('TEST 2'); + jQuery("input[name='shipping_method']:checked").prop("checked", ""); + console.log('TEST 3'); + if (jQuery.uniform) { + console.log('TEST 3.1'); + jQuery.uniform.update(); + } + } +} + +function geocodeGLSAdresse() { + + var searchAdress = jQuery('#cp_recherche').val(); + if (searchAdress == '' || !searchAdress) { + jQuery('#cp_recherche').val(defaultZipCode); + searchAdress = defaultZipCode; + } + + if ((typeof google) != "undefined") { + var geocoder = new google.maps.Geocoder(); + geocoder.geocode({'address': searchAdress}, function(results, status) { + if (status == google.maps.GeocoderStatus.OK) { + glsMyPosition = results[0].geometry.location; + //on met à jour la carte avec cette position + loadMap(); + loadListePointRelais(); + } else { + alert('Adresse invalide : ' + searchAdress); + } + }); + } else { + alert("Géolocalisation de l'adresse impossible, vérifiez votre connexion internet (Google inaccessible)."); + } +} + +function changeMap() { + if (glsMyPosition != undefined) { + loadListePointRelais(); + } +} + +function loadListePointRelais() { + var searchAdress = jQuery('#cp_recherche').val(); + if (searchAdress == '' || !searchAdress) { + jQuery('#cp_recherche').val(defaultZipCode); + searchAdress = defaultZipCode; + } + + if (searchAdress) { + $.ajax( + { + type: 'POST', + url: baseDir + 'modules/gls/ajaxFront.php', + data: {'method': 'getGLSRelayPointsForZipCode', 'zipcode': jQuery("#cp_recherche").val(), 'street': jQuery("#cp_street").val(), 'city': jQuery("#cp_city").val()}, + dataType: 'json', + success: function(json) + { + if (!json) { + alert(shipping_method_unavailable); + } else { + if (json.indexOf("gls_ws_error") <= 0) { + clearMarkers(); + jQuery("#col_droite_gls").html(json); + showGLSMap(); + } else { + jQuery("#layer_gls_body .contenu").append(json); + } + } + } + }); + } +} + +function loadMap() { + + mapOptions = { + zoom: 10, + center: glsMyPosition, + mapTypeId: google.maps.MapTypeId.ROADMAP, + disableDefaultUI: true, + zoomControlOptions: { + position: google.maps.ControlPosition.RIGHT_TOP + } + } + + + jQuery('#layer_gls').appendTo('body').attr("id", "layer_gls_body"); + if (jQuery('#layer_gls').size()) { + jQuery('#layer_gls').remove(); + } + + //if( jQuery("#layer_gls_body").data("overlay") == null ) { + +// if(prestashop1_6){ +// jQuery('#layer_gls_body').css('left','25%'); +// } + if (jQuery('html').attr('class')) { + if (jQuery('html').attr('class').indexOf("mobile")) { + jQuery('#layer_gls_body').css('left', '0'); + } + } + //} + //Ouverture de la popup + jQuery("#layer_gls_body").popup('show'); + console.log('SHOWING'); + jQuery("#shipping-method-please-wait").hide(); + +} + +function showGLSMap() { + if ((typeof google) != "undefined") { + var init = false; + //google.maps.event.addListener(glsRelayMap, 'tilesloaded', function () { + + // création de bornes vides... + var bounds = new google.maps.LatLngBounds(); + + if (!init) { + + jQuery('.gls_point_relay').each(function(index, element) { + + var relayPosition = new google.maps.LatLng(jQuery(this).find('.GLS_relay_latitude').text(), jQuery(this).find('.GLS_relay_longitude').text()); + markerGLS = new google.maps.Marker({ + map: glsRelayMap, + position: relayPosition, + title: jQuery(this).find('.GLS_relay_name').text(), + icon: (glsRelaisChoisi == jQuery(this).find('.GLS_relay_id').text()) ? baseDir + 'modules/gls/views/img/marker_current.png' : baseDir + 'modules/gls/views/img/marker.png' + }); + infowindowGLS = infoGLSBulleGenerator(jQuery(this)); + + if (glsRelaisChoisi == jQuery(this).find('.GLS_relay_id').text()) { + jQuery("#layer_gls_body .gls_point_relay").removeClass("current").eq(index).addClass("current"); + jQuery("#col_droite_gls").scrollTop(0).scrollTop(jQuery(".gls_point_relay").eq(index).position().top); + } + + // Ajout à la liste des markers + glsMarkersArray.push(markerGLS); + + attachGLSClick(markerGLS, infowindowGLS, index); + + // ...étendues à chaque point... + bounds.extend(relayPosition); + + }); + + // ...pour voir tous les points + if (glsRelayMap) { + if (bounds) { + glsRelayMap.fitBounds(bounds); + } + } else { + unlockMapLoading(); + } + } + init = true; + //}); + } + + if (jQuery('#layer_gls_body').find('#map_gls').children().size() <= 0) { + unlockMapLoading(); + } +} + +//générateur d'infobulle +function infoGLSBulleGenerator(relay) { + + contentString = '
    ' + + contentString += '' + relay.find('.GLS_relay_name').text() + ''; + + contentString += '' + + relay.find('.GLS_relay_address').text() + '
    ' + + relay.find('.GLS_relay_zipcode').text() + ' ' + relay.find('.GLS_relay_city').text(); + + contentString += relay.find('.GLS_relay_hours').html(); + + contentString += ""; + + contentString += "
    "; + + infowindow = new google.maps.InfoWindow({ + content: contentString + }); + + return infowindow; +} + + +function attachGLSClick(markerGLS, infowindowGLS, index) { + //Clic sur le relais dans la colonne de gauche + jQuery("#gls_point_relay_" + index).on("click", function() { + clickHandler(markerGLS, infowindowGLS, index); + }); + + //Clic sur le marqueur du relais dans la carte + google.maps.event.addListener(markerGLS, 'click', function() { + clickHandler(markerGLS, infowindowGLS, index); + }); + +} + +function clickHandler(markerGLS, infowindowGLS, index) { + //fermer la derniere infobulle ouverte + if (glsOpenedInfowindow) { + glsOpenedInfowindow.close(); + jQuery("#layer_gls_body .gls_point_relay").removeClass("current"); + } + //ouvrir l'infobulle + infowindowGLS.open(glsRelayMap, markerGLS); + glsOpenedInfowindow = infowindowGLS; + + // Mise en évidence du relais dans la liste + jQuery("#layer_gls_body .gls_point_relay").removeClass("current").eq(index).addClass("current"); + jQuery("#col_droite_gls").scrollTop(0).scrollTop(jQuery(".gls_point_relay").eq(index).position().top); + +} + +function choisirRelaisGLS(index) { + + //resetShippingMethod(); + jQuery("select[name='shipping_address_id']").prop('selectedIndex', 0); + jQuery("select[name='shipping_address_id'] option[value='']").prop('selectedIndex', 0); + + if (jQuery("#sms_checkbox").is(":checked")) { + v = document.getElementById("num_telephone").value; + //if (!(/^0(6|7)\d{8}$/.test(v)) || (/^0(6|7)(0{8}|1{8}|2{8}|3{8}|4{8}|5{8}|6{8}|7{8}|8{8}|9{8}|12345678)$/.test(v)) ) { + if (!v) { + alert("Veuillez saisir un numéro de téléphone valide (portable de préférence)."); + return; + } + } + var contenu_html = "
    " + jQuery('#gls_point_relay_' + index).find('.GLS_relay_name').text() + "" + " " + change_parcelshop + "" + "
    " + jQuery('#gls_point_relay_' + index).find('.GLS_relay_address').text() + "
    " + jQuery('#gls_point_relay_' + index).find('.GLS_relay_zipcode').text() + " " + jQuery('#gls_point_relay_' + index).find('.GLS_relay_city').text() + "
    "; + jQuery('#gls_relais_choisi').remove(); + + if (prestashop1_6) { + if (jQuery('.delivery_option_radio[value="' + glsCarrierRelayId + ',"]').parent().parent().parent().next().next().size() < 1) { + jQuery('body').find('.delivery_option_radio[value="' + glsCarrierRelayId + ',"]').parent().parent().find('.delivery_option_title').append(contenu_html); + } else { + jQuery('.delivery_option_radio[value="' + glsCarrierRelayId + ',"]').parent().parent().parent().next().next().append(contenu_html); + } + } else { + if (jQuery('.delivery_option_radio[value="' + glsCarrierRelayId + ',"]').next().size()) { + jQuery('.delivery_option_radio[value="' + glsCarrierRelayId + ',"]').next().find('.delivery_option_title').parent().append(contenu_html); + } else { + jQuery('body').find('.delivery_option_radio[value="' + glsCarrierRelayId + ',"]').parent().parent().find('.delivery_option_title').append(contenu_html); + } + } + /* On stock en session les informations du relais */ + + if (jQuery("#sms_checkbox").is(":checked") && jQuery("#num_telephone").val() != "") { + var warnbyphone = 1; + } else { + var warnbyphone = 0; + } + + glsRelaisChoisi = jQuery('#gls_point_relay_' + index).find('.GLS_relay_id').text(); + + // On fait la sauvegarde de la méthode de livraison + jQuery.ajax({ + type: 'POST', + url: baseDir + 'modules/gls/ajaxFront.php', + data: { + 'method': 'saveDeliveryDetails', // <-- just pass an object + name: jQuery('#gls_point_relay_' + index).find('.GLS_relay_name').text(), + address: jQuery('#gls_point_relay_' + index).find('.GLS_relay_address').text(), + city: jQuery('#gls_point_relay_' + index).find('.GLS_relay_city').text(), + zipcode: jQuery('#gls_point_relay_' + index).find('.GLS_relay_zipcode').text(), + relayId: jQuery('#gls_point_relay_' + index).find('.GLS_relay_id').text(), + phone: jQuery("#num_telephone").val(), + warnbyphone: warnbyphone, + }, + dataType: 'json', + success: function() { + // On cache le layer + jQuery("#layer_gls_body").popup('hide'); + } + }); +} + +function resetPointRelay() { + jQuery.ajax({ + type: 'POST', + url: baseDir + 'modules/gls/ajaxFront.php', + data: { + 'method': 'resetDeliveryDetails' + }, + dataType: 'json', + success: function() { + + } + }); +} + +//Récupération du relais eventuellement déjà choisi +function getPreviouslyChoosenRelay() { + + if ($('.delivery_option_radio[value="' + glsCarrierRelayId + ',"]').next().find('.delivery_option_title').size() > 0) { + prestashop1_6 = false; + } else { + prestashop1_6 = true; + } + + $.ajax( + { + type: 'POST', + url: baseDir + 'modules/gls/ajaxFront.php', + data: {'method': 'getChoosenRelay'}, + dataType: 'json', + success: function(json) + { + if (json.relay_name != 'undefined' && json.relay_name != undefined && json.relay_name != "undefined ") { + var contenu_html = "
    " + json.relay_name + "" + " " + change_parcelshop + "" + "
    " + json.relay_address + "
    " + json.relay_zipcode + " " + json.relay_town + "
    "; + jQuery('#gls_relais_choisi').remove(); + if (prestashop1_6) { + if (jQuery('.delivery_option_radio[value="' + glsCarrierRelayId + ',"]').parent().parent().parent().next().next().size() < 1) { + jQuery('body').find('.delivery_option_radio[value="' + glsCarrierRelayId + ',"]').parent().parent().find('.delivery_option_title').append(contenu_html); + } else { + jQuery('.delivery_option_radio[value="' + glsCarrierRelayId + ',"]').parent().parent().parent().next().next().append(contenu_html); + } + } else { + if (jQuery('.delivery_option_radio[value="' + glsCarrierRelayId + ',"]').next().size()) { + jQuery('.delivery_option_radio[value="' + glsCarrierRelayId + ',"]').next().find('.delivery_option_title').parent().append(contenu_html); + } else { + jQuery('body').find('.delivery_option_radio[value="' + glsCarrierRelayId + ',"]').parent().parent().find('.delivery_option_title').append(contenu_html); + } + } + } else { + jQuery('#gls_relais_choisi').remove(); + } + } + }); +} + +function unlockMapLoading() { + + mapOptions = { + zoom: 10, + center: glsMyPosition, + mapTypeId: google.maps.MapTypeId.ROADMAP, + disableDefaultUI: true, + zoomControlOptions: { + position: google.maps.ControlPosition.RIGHT_TOP + } + } + + glsRelayMap = new google.maps.Map(document.getElementById('map_gls'), mapOptions); + geocodeGLSAdresse(); +} + + + diff --git a/modules/gls/views/js/index.php b/modules/gls/views/js/index.php new file mode 100644 index 00000000..dc7351df --- /dev/null +++ b/modules/gls/views/js/index.php @@ -0,0 +1,28 @@ + +* @copyright 2007-2014 Addonline +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; \ No newline at end of file diff --git a/modules/gls/views/js/jquery.popupoverlay.js b/modules/gls/views/js/jquery.popupoverlay.js new file mode 100644 index 00000000..ce932555 --- /dev/null +++ b/modules/gls/views/js/jquery.popupoverlay.js @@ -0,0 +1,786 @@ +/*! + * jQuery Popup Overlay + * + * @version 1.7.6 + * @requires jQuery v1.7.1+ + * @link http://vast-engineering.github.com/jquery-popup-overlay/ + */ +;(function ($) { + + var $window = $(window); + var options = {}; + var zindexvalues = []; + var lastclicked = []; + var scrollbarwidth; + var bodymarginright = null; + var opensuffix = '_open'; + var closesuffix = '_close'; + var stack = []; + var transitionsupport = null; + var opentimer; + var iOS = /(iPad|iPhone|iPod)/g.test(navigator.userAgent); + + var methods = { + + _init: function (el) { + var $el = $(el); + var options = $el.data('popupoptions'); + lastclicked[el.id] = false; + zindexvalues[el.id] = 0; + + if (!$el.data('popup-initialized')) { + $el.attr('data-popup-initialized', 'true'); + methods._initonce(el); + } + + if (options.autoopen) { + setTimeout(function() { + methods.show(el, 0); + }, 0); + } + }, + + _initonce: function (el) { + var $el = $(el); + var $body = $('body'); + var $wrapper; + var options = $el.data('popupoptions'); + var css; + + bodymarginright = parseInt($body.css('margin-right'), 10); + transitionsupport = document.body.style.webkitTransition !== undefined || + document.body.style.MozTransition !== undefined || + document.body.style.msTransition !== undefined || + document.body.style.OTransition !== undefined || + document.body.style.transition !== undefined; + + if (options.type == 'tooltip') { + options.background = false; + options.scrolllock = false; + } + + if (options.backgroundactive) { + options.background = false; + options.blur = false; + options.scrolllock = false; + } + + if (options.scrolllock) { + // Calculate the browser's scrollbar width dynamically + var parent; + var child; + if (typeof scrollbarwidth === 'undefined') { + parent = $('
    ').appendTo('body'); + child = parent.children(); + scrollbarwidth = child.innerWidth() - child.height(99).innerWidth(); + parent.remove(); + } + } + + if (!$el.attr('id')) { + $el.attr('id', 'j-popup-' + parseInt((Math.random() * 100000000), 10)); + } + + $el.addClass('popup_content'); + + $body.prepend(el); + + $el.wrap('