Version Notes
RAS
Download this release
Release Info
Developer | Addonline |
Extension | Addonline_Gls |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Addonline/Gls/Block/Adminhtml/System/Config/Form/Field/Config.php +131 -0
- app/code/community/Addonline/Gls/Block/Adminhtml/System/Config/Form/Field/Informations.php +50 -0
- app/code/community/Addonline/Gls/Block/Export/Orders.php +40 -0
- app/code/community/Addonline/Gls/Block/Export/Orders/Grid.php +228 -0
- app/code/community/Addonline/Gls/Block/Import/Form.php +37 -0
- app/code/community/Addonline/Gls/Block/Listrelay.php +60 -0
- app/code/community/Addonline/Gls/Block/Selector.php +89 -0
- app/code/community/Addonline/Gls/Helper/Data.php +202 -0
- app/code/community/Addonline/Gls/Helper/OneStepCheckout/Checkout.php +55 -0
- app/code/community/Addonline/Gls/Model/Carrier/Abstract.php +262 -0
- app/code/community/Addonline/Gls/Model/Carrier/ShippingMethod.php +58 -0
- app/code/community/Addonline/Gls/Model/Export.php +219 -0
- app/code/community/Addonline/Gls/Model/Import.php +195 -0
- app/code/community/Addonline/Gls/Model/Observer.php +114 -0
- app/code/community/Addonline/Gls/Model/Os2/Data/Abstract.php +77 -0
- app/code/community/Addonline/Gls/Model/Os2/Data/AbstractWithAttributes.php +67 -0
- app/code/community/Addonline/Gls/Model/Os2/Data/Address.php +35 -0
- app/code/community/Addonline/Gls/Model/Os2/Data/AddressFilter.php +110 -0
- app/code/community/Addonline/Gls/Model/Os2/Data/AttributeSet.php +36 -0
- app/code/community/Addonline/Gls/Model/Os2/Data/Billto.php +37 -0
- app/code/community/Addonline/Gls/Model/Os2/Data/Cart.php +146 -0
- app/code/community/Addonline/Gls/Model/Os2/Data/CartItem.php +153 -0
- app/code/community/Addonline/Gls/Model/Os2/Data/Category.php +33 -0
- app/code/community/Addonline/Gls/Model/Os2/Data/Customer.php +42 -0
- app/code/community/Addonline/Gls/Model/Os2/Data/CustomerGroup.php +81 -0
- app/code/community/Addonline/Gls/Model/Os2/Data/Customvar.php +35 -0
- app/code/community/Addonline/Gls/Model/Os2/Data/Date.php +50 -0
- app/code/community/Addonline/Gls/Model/Os2/Data/Info.php +26 -0
- app/code/community/Addonline/Gls/Model/Os2/Data/Product.php +119 -0
- app/code/community/Addonline/Gls/Model/Os2/Data/Quote.php +30 -0
- app/code/community/Addonline/Gls/Model/Os2/Data/Selection.php +29 -0
- app/code/community/Addonline/Gls/Model/Os2/Data/StockItem.php +39 -0
- app/code/community/Addonline/Gls/Model/Os2/Data/Store.php +52 -0
- app/code/community/Addonline/Gls/Model/Sales/Quote/Address.php +88 -0
- app/code/community/Addonline/Gls/Model/Service.php +82 -0
- app/code/community/Addonline/Gls/Model/System/Config/Source/LoadOnParent.php +38 -0
- app/code/community/Addonline/Gls/Model/System/Config/Source/ProcessChildren.php +38 -0
- app/code/community/Addonline/Gls/Model/Webservice/PointsRelaisWSService.php +56 -0
- app/code/community/Addonline/Gls/controllers/AjaxController.php +119 -0
- app/code/community/Addonline/Gls/controllers/ExportController.php +73 -0
- app/code/community/Addonline/Gls/controllers/ImportController.php +64 -0
- app/code/community/Addonline/Gls/etc/adminhtml.xml +84 -0
- app/code/community/Addonline/Gls/etc/config.xml +254 -0
- app/code/community/Addonline/Gls/etc/system.xml +356 -0
- app/code/community/Addonline/Gls/owebia_includes/OS2_AddressFilter.php +539 -0
- app/code/community/Addonline/Gls/owebia_includes/OS2_AddressFilterParser_GLS.php +119 -0
- app/code/community/Addonline/Gls/owebia_includes/OS2_CustomerGroup.php +96 -0
- app/code/community/Addonline/Gls/owebia_includes/OwebiaShippingHelper_GLS.php +1473 -0
- app/code/community/Addonline/Gls/owebia_includes/cache/countries +1 -0
- app/code/community/Addonline/Gls/sql/gls_setup/mysql4-install-1.0.0.php +45 -0
- app/design/adminhtml/default/default/template/gls/import/form.phtml +56 -0
- app/design/frontend/base/default/layout/gls.xml +105 -0
- app/design/frontend/base/default/template/gls/additional.phtml +87 -0
- app/design/frontend/base/default/template/gls/listrelais.phtml +68 -0
- app/design/frontend/base/default/template/gls/selector.phtml +47 -0
- app/etc/modules/Addonline_Gls.xml +31 -0
- app/locale/en_US/Addonline_Gls.csv +4 -0
- app/locale/fr_FR/Addonline_Gls.csv +172 -0
- js/jquery/jquery-1.7.1.min.js +4 -0
- js/jquery/jquery.noconflict.js +7 -0
- js/jquery/jquery.tools.min.js +19 -0
- package.xml +47 -0
- skin/frontend/base/default/css/gls.css +1 -0
- skin/frontend/base/default/images/gls/btn_fermer.png +0 -0
- skin/frontend/base/default/images/gls/marker.png +0 -0
- skin/frontend/base/default/images/gls/marker_current.png +0 -0
- skin/frontend/base/default/images/gls/picto-arrow.png +0 -0
- skin/frontend/base/default/images/gls/picto_relay.png +0 -0
- skin/frontend/base/default/images/gls/picto_tohome.png +0 -0
- skin/frontend/base/default/images/gls/picto_toyou.png +0 -0
- skin/frontend/base/default/images/gls/search-repeat.png +0 -0
- skin/frontend/base/default/images/gls/title-repeat.png +0 -0
- skin/frontend/base/default/js/gls.js +412 -0
app/code/community/Addonline/Gls/Block/Adminhtml/System/Config/Form/Field/Config.php
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2008-13 Owebia
|
4 |
+
*
|
5 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
6 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
7 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
8 |
+
*
|
9 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
10 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
11 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
12 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
13 |
+
* IN THE SOFTWARE.
|
14 |
+
*
|
15 |
+
* @website http://www.owebia.com/
|
16 |
+
* @project Magento Owebia Shipping 2 module
|
17 |
+
*
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
*/
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Addonline_Gls
|
24 |
+
*
|
25 |
+
* @category Addonline
|
26 |
+
* @package Addonline_Gls
|
27 |
+
* @copyright Copyright (c) 2014 GLS
|
28 |
+
* @author Addonline (http://www.addonline.fr)
|
29 |
+
*/
|
30 |
+
class Addonline_Gls_Block_Adminhtml_System_Config_Form_Field_Config extends Mage_Adminhtml_Block_System_Config_Form_Field
|
31 |
+
{
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @var boolean
|
35 |
+
*/
|
36 |
+
private static $JS_INCLUDED = false;
|
37 |
+
|
38 |
+
/* (non-PHPdoc)
|
39 |
+
* @see Mage_Core_Block_Abstract::__()
|
40 |
+
*/
|
41 |
+
public function __()
|
42 |
+
{
|
43 |
+
$args = func_get_args();
|
44 |
+
return Mage::helper('gls')->__($args);
|
45 |
+
}
|
46 |
+
|
47 |
+
/* (non-PHPdoc)
|
48 |
+
* @see Mage_Core_Block_Abstract::_prepareLayout()
|
49 |
+
*/
|
50 |
+
protected function _prepareLayout()
|
51 |
+
{
|
52 |
+
$layout = $this->getLayout();
|
53 |
+
$head = $layout->getBlock('head');
|
54 |
+
// $head->addJs('gls/owebia_shipping2/jquery-1.8.2.min.js');
|
55 |
+
// $head->addJs('gls/owebia_shipping2/jquery.noconflict.js');
|
56 |
+
// $head->addJs('gls/owebia_shipping2/jquery-ui-1.8.23.custom/js/jquery-ui-1.8.23.custom.min.js');
|
57 |
+
// $head->addJs('gls/owebia_shipping2/jquery.layout-1.3.0-rc30.6.min.js');
|
58 |
+
// $head->addJs('gls/owebia_shipping2/colorbox/jquery.colorbox-min.js');
|
59 |
+
// $head->addJs('gls/owebia_shipping2/jquery.caret.1.02.min.js');
|
60 |
+
// $head->addJs('gls/owebia_shipping2/os2editor.js');
|
61 |
+
// //$head->addItem('js_css', 'gls/owebia_/jquery-ui-1.8.23.custom/css/ui-lightness/jquery-ui-1.8.23.custom.css');
|
62 |
+
// $head->addItem('js_css', 'gls/owebia_shipping2/colorbox/colorbox.css', 'media="all"');
|
63 |
+
// $head->addItem('js_css', 'gls/owebia_shipping2/os2editor.css', 'media="all"');
|
64 |
+
// $head->addItem('other', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js');
|
65 |
+
// $head->append($block);
|
66 |
+
|
67 |
+
parent::_prepareLayout();
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* tradution et echappement
|
72 |
+
* @param string $input
|
73 |
+
*/
|
74 |
+
private function label__($input)
|
75 |
+
{
|
76 |
+
return str_replace(array(
|
77 |
+
"\r\n",
|
78 |
+
"\r",
|
79 |
+
"\n",
|
80 |
+
"'"
|
81 |
+
), array(
|
82 |
+
"\\n",
|
83 |
+
"\\n",
|
84 |
+
"\\n",
|
85 |
+
"\\'"
|
86 |
+
), $this->__($input));
|
87 |
+
}
|
88 |
+
|
89 |
+
/* (non-PHPdoc)
|
90 |
+
* @see Mage_Adminhtml_Block_System_Config_Form_Field::_getElementHtml()
|
91 |
+
*/
|
92 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
93 |
+
{
|
94 |
+
$output = '';
|
95 |
+
// if (!self::$JS_INCLUDED) {
|
96 |
+
// $output = "<script type=\"text/javascript\">\n"
|
97 |
+
// ."//<![CDATA[\n"
|
98 |
+
// ."jQuery.noConflict();\n"
|
99 |
+
// ."var os2editor = new OS2Editor({\n"
|
100 |
+
// ."ajax_url: '".$this->getUrl('adminhtml/gls_ajax/index')."?isAjax=true',\n"
|
101 |
+
// ."form_key: FORM_KEY,\n"
|
102 |
+
// ."apply_btn_label: '".$this->label__('Apply')."',\n"
|
103 |
+
// ."cancel_btn_label: '".$this->label__('Cancel')."',\n"
|
104 |
+
// ."menu_item_dissociate_label: '".$this->label__('Dissociate')."',\n"
|
105 |
+
// ."menu_item_remove_label: '".$this->label__('Remove')."',\n"
|
106 |
+
// ."menu_item_edit_label: '".$this->label__('Edit')."',\n"
|
107 |
+
// ."prompt_new_value_label: '".$this->label__('Enter the new value:')."',\n"
|
108 |
+
// ."default_row_label: '".$this->label__('[No label]')."',\n"
|
109 |
+
// ."loading_label: '".$this->label__('Loading...')."'\n"
|
110 |
+
// ."});\n"
|
111 |
+
// ."
|
112 |
+
// "
|
113 |
+
// ."//]]>\n"
|
114 |
+
// ."</script>\n"
|
115 |
+
// ;
|
116 |
+
// self::$JS_INCLUDED = true;
|
117 |
+
// }
|
118 |
+
|
119 |
+
$shipping_code = preg_replace('/^groups\[([^\]]*)\].*$/', '\1', $element->getName());
|
120 |
+
return <<<EOD
|
121 |
+
{$output}
|
122 |
+
<!--<div style="margin-bottom:1px;">
|
123 |
+
<button type="button" class="scalable" onclick="os2editor.init(this, '{$shipping_code}').page('source');"><span>{$this->__('Source & Correction')}</span></button>
|
124 |
+
<button type="button" class="scalable" onclick="os2editor.init(this, '{$shipping_code}').help('summary');"><span>{$this->__('Help')}</span></button>
|
125 |
+
<a href="{$this->getUrl('adminhtml/os2_ajax/doc')}">doc</a>
|
126 |
+
</div>-->
|
127 |
+
{$element->getElementHtml()}<br/>
|
128 |
+
<a href="http://www.owebia.com/os2/fr/doc" target="_blank">{$this->__('Help')}</a>
|
129 |
+
EOD;
|
130 |
+
}
|
131 |
+
}
|
app/code/community/Addonline/Gls/Block/Adminhtml/System/Config/Form/Field/Informations.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2008-13 Owebia
|
4 |
+
*
|
5 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
6 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
7 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
8 |
+
*
|
9 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
10 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
11 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
12 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
13 |
+
* IN THE SOFTWARE.
|
14 |
+
*
|
15 |
+
* @website http://www.owebia.com/
|
16 |
+
* @project Magento Owebia Shipping 2 module
|
17 |
+
* @author Antoine Lemoine
|
18 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
19 |
+
*/
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Addonline_Gls
|
23 |
+
*
|
24 |
+
* @category Addonline
|
25 |
+
* @package Addonline_Gls
|
26 |
+
* @copyright Copyright (c) 2014 GLS
|
27 |
+
* @author Addonline (http://www.addonline.fr)
|
28 |
+
*/
|
29 |
+
class Addonline_Gls_Block_Adminhtml_System_Config_Form_Field_Informations extends Mage_Adminhtml_Block_System_Config_Form_Field
|
30 |
+
{
|
31 |
+
|
32 |
+
/* (non-PHPdoc)
|
33 |
+
* @see Mage_Core_Block_Abstract::__()
|
34 |
+
*/
|
35 |
+
public function __()
|
36 |
+
{
|
37 |
+
$args = func_get_args();
|
38 |
+
// return Mage::helper('owebia-shipping2')->__($args);
|
39 |
+
return false;
|
40 |
+
}
|
41 |
+
|
42 |
+
/* (non-PHPdoc)
|
43 |
+
* @see Mage_Adminhtml_Block_System_Config_Form_Field::_getElementHtml()
|
44 |
+
*/
|
45 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
46 |
+
{
|
47 |
+
$version = Mage::getConfig()->getNode('modules/Addonline_Gls/version');
|
48 |
+
return 'Version: ' . $version;
|
49 |
+
}
|
50 |
+
}
|
app/code/community/Addonline/Gls/Block/Export/Orders.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 GLS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Addonline_Gls
|
13 |
+
* @copyright Copyright (c) 2014 GLS
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Addonline_Gls
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Addonline_Gls
|
23 |
+
* @copyright Copyright (c) 2014 GLS
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Addonline_Gls_Block_Export_Orders extends Mage_Adminhtml_Block_Widget_Grid_Container
|
27 |
+
{
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Enter Description here
|
31 |
+
*/
|
32 |
+
public function __construct()
|
33 |
+
{
|
34 |
+
$this->_blockGroup = 'gls';
|
35 |
+
$this->_controller = 'export_orders';
|
36 |
+
$this->_headerText = Mage::helper('gls')->__('Export');
|
37 |
+
parent::__construct();
|
38 |
+
$this->_removeButton('add');
|
39 |
+
}
|
40 |
+
}
|
app/code/community/Addonline/Gls/Block/Export/Orders/Grid.php
ADDED
@@ -0,0 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 GLS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Addonline_Gls
|
13 |
+
* @copyright Copyright (c) 2014 GLS
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Addonline_Gls
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Addonline_Gls
|
23 |
+
* @copyright Copyright (c) 2014 GLS
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Addonline_Gls_Block_Export_Orders_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
27 |
+
{
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Constructor
|
31 |
+
*/
|
32 |
+
public function __construct()
|
33 |
+
{
|
34 |
+
parent::__construct();
|
35 |
+
$this->setId('gls_export_order_grid');
|
36 |
+
$this->setDefaultSort('created_at');
|
37 |
+
$this->setDefaultDir('DESC');
|
38 |
+
$this->setSaveParametersInSession(true);
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Prepare order collection (for different Magento versions)
|
43 |
+
*
|
44 |
+
* @return Addonline_Gls_Block_Export_Orders_Grid
|
45 |
+
*/
|
46 |
+
protected function _prepareCollection()
|
47 |
+
{
|
48 |
+
if (version_compare(Mage::getVersion(), '1.4', '>=')) {
|
49 |
+
$collection = Mage::getResourceModel('sales/order_grid_collection')->join('order', 'main_table.entity_id = order.entity_id', array(
|
50 |
+
'shipping_method'
|
51 |
+
))->addAttributeToFilter('shipping_method', array(
|
52 |
+
'like' => 'gls_%'
|
53 |
+
));
|
54 |
+
} else {
|
55 |
+
$collection = Mage::getResourceModel('sales/order_collection')->addAttributeToSelect(array(
|
56 |
+
'status',
|
57 |
+
'shipping_method'
|
58 |
+
))
|
59 |
+
->joinAttribute('billing_firstname', 'order_address/firstname', 'billing_address_id', null, 'left')
|
60 |
+
->joinAttribute('billing_lastname', 'order_address/lastname', 'billing_address_id', null, 'left')
|
61 |
+
->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left')
|
62 |
+
->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left')
|
63 |
+
->addExpressionAttributeToSelect('billing_name', 'CONCAT({{billing_firstname}}, " ", {{billing_lastname}})', array(
|
64 |
+
'billing_firstname',
|
65 |
+
'billing_lastname'
|
66 |
+
))
|
67 |
+
->addExpressionAttributeToSelect('shipping_name', 'CONCAT({{shipping_firstname}}, " ", {{shipping_lastname}})', array(
|
68 |
+
'shipping_firstname',
|
69 |
+
'shipping_lastname'
|
70 |
+
))
|
71 |
+
->addAttributeToFilter('shipping_method', array(
|
72 |
+
'like' => 'gls_%'
|
73 |
+
));
|
74 |
+
}
|
75 |
+
|
76 |
+
$this->setCollection($collection);
|
77 |
+
return parent::_prepareCollection();
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Prepare grid columns (for different Magento versions)
|
82 |
+
*
|
83 |
+
* @return Addonline_Gls_Block_Export_Orders_Grid
|
84 |
+
*/
|
85 |
+
protected function _prepareColumns()
|
86 |
+
{
|
87 |
+
$columnData = array(
|
88 |
+
'header' => Mage::helper('sales')->__('Order #'),
|
89 |
+
'width' => '80px',
|
90 |
+
'type' => 'text',
|
91 |
+
'index' => 'increment_id'
|
92 |
+
);
|
93 |
+
if (version_compare(Mage::getVersion(), '1.4', '>=')) {
|
94 |
+
$columnData['filter_index'] = 'main_table.' . $columnData['index'];
|
95 |
+
}
|
96 |
+
$this->addColumn('real_order_id', $columnData);
|
97 |
+
|
98 |
+
if (! Mage::app()->isSingleStoreMode()) {
|
99 |
+
$this->addColumn('store_id', array(
|
100 |
+
'header' => Mage::helper('sales')->__('Purchased from (store)'),
|
101 |
+
'index' => 'store_id',
|
102 |
+
'type' => 'store',
|
103 |
+
'store_view' => true,
|
104 |
+
'display_deleted' => true
|
105 |
+
));
|
106 |
+
}
|
107 |
+
|
108 |
+
$columnData = array(
|
109 |
+
'header' => Mage::helper('sales')->__('Purchased On'),
|
110 |
+
'index' => 'created_at',
|
111 |
+
'type' => 'datetime',
|
112 |
+
'width' => '100px'
|
113 |
+
);
|
114 |
+
if (version_compare(Mage::getVersion(), '1.4', '>=')) {
|
115 |
+
$columnData['filter_index'] = 'main_table.' . $columnData['index'];
|
116 |
+
}
|
117 |
+
$this->addColumn('created_at', $columnData);
|
118 |
+
|
119 |
+
$this->addColumn('billing_name', array(
|
120 |
+
'header' => Mage::helper('sales')->__('Bill to Name'),
|
121 |
+
'index' => 'billing_name'
|
122 |
+
));
|
123 |
+
|
124 |
+
$this->addColumn('shipping_name', array(
|
125 |
+
'header' => Mage::helper('sales')->__('Ship to Name'),
|
126 |
+
'index' => 'shipping_name'
|
127 |
+
));
|
128 |
+
|
129 |
+
$columnData = array(
|
130 |
+
'header' => Mage::helper('sales')->__('G.T. (Base)'),
|
131 |
+
'index' => 'base_grand_total',
|
132 |
+
'type' => 'currency',
|
133 |
+
'currency' => 'base_currency_code'
|
134 |
+
);
|
135 |
+
if (version_compare(Mage::getVersion(), '1.4', '>=')) {
|
136 |
+
$columnData['filter_index'] = 'main_table.' . $columnData['index'];
|
137 |
+
}
|
138 |
+
$this->addColumn('base_grand_total', $columnData);
|
139 |
+
|
140 |
+
$this->addColumn('carrier', array(
|
141 |
+
'header' => Mage::helper('sales')->__('Carrier'),
|
142 |
+
'index' => 'shipping_method'
|
143 |
+
));
|
144 |
+
|
145 |
+
$columnData = array(
|
146 |
+
'header' => Mage::helper('sales')->__('Status'),
|
147 |
+
'index' => 'status',
|
148 |
+
'type' => 'options',
|
149 |
+
'options' => Mage::getSingleton('sales/order_config')->getStatuses()
|
150 |
+
);
|
151 |
+
if (version_compare(Mage::getVersion(), '1.4', '>=')) {
|
152 |
+
$columnData['filter_index'] = 'main_table.' . $columnData['index'];
|
153 |
+
}
|
154 |
+
$this->addColumn('status', $columnData);
|
155 |
+
|
156 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
157 |
+
$this->addColumn('action', array(
|
158 |
+
'header' => Mage::helper('sales')->__('Action'),
|
159 |
+
'width' => '50px',
|
160 |
+
'type' => 'action',
|
161 |
+
'getter' => 'getId',
|
162 |
+
'actions' => array(
|
163 |
+
array(
|
164 |
+
'caption' => Mage::helper('sales')->__('View'),
|
165 |
+
'url' => array(
|
166 |
+
'base' => 'adminhtml/sales_order/view'
|
167 |
+
),
|
168 |
+
'field' => 'order_id'
|
169 |
+
)
|
170 |
+
),
|
171 |
+
'filter' => false,
|
172 |
+
'sortable' => false,
|
173 |
+
'index' => 'stores',
|
174 |
+
'is_system' => true
|
175 |
+
));
|
176 |
+
}
|
177 |
+
|
178 |
+
return parent::_prepareColumns();
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Prepare mass action (for different Magento versions)
|
183 |
+
*
|
184 |
+
* @return Addonline_Gls_Block_Export_Orders_Grid
|
185 |
+
*/
|
186 |
+
protected function _prepareMassaction()
|
187 |
+
{
|
188 |
+
$this->setMassactionIdField('entity_id');
|
189 |
+
$this->getMassactionBlock()->setFormFieldName('order_ids');
|
190 |
+
if (Mage::getVersion() >= '1.4.1') {
|
191 |
+
$this->getMassactionBlock()->setUseSelectAll(false);
|
192 |
+
}
|
193 |
+
|
194 |
+
$this->getMassactionBlock()->addItem('export_order', array(
|
195 |
+
'label' => Mage::helper('gls')->__('Export'),
|
196 |
+
'url' => $this->getUrl('*/*/export')
|
197 |
+
));
|
198 |
+
|
199 |
+
return $this;
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Get url called when user click on a grid row
|
204 |
+
*
|
205 |
+
* @return string boolean
|
206 |
+
*/
|
207 |
+
public function getRowUrl($row)
|
208 |
+
{
|
209 |
+
if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
|
210 |
+
return $this->getUrl('adminhtml/sales_order/view', array(
|
211 |
+
'order_id' => $row->getId()
|
212 |
+
));
|
213 |
+
}
|
214 |
+
return false;
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Get grid url
|
219 |
+
*
|
220 |
+
* @return string
|
221 |
+
*/
|
222 |
+
public function getGridUrl()
|
223 |
+
{
|
224 |
+
return $this->getUrl('*/*/*', array(
|
225 |
+
'_current' => true
|
226 |
+
));
|
227 |
+
}
|
228 |
+
}
|
app/code/community/Addonline/Gls/Block/Import/Form.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 GLS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Addonline_Gls
|
13 |
+
* @copyright Copyright (c) 2014 GLS
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Addonline_Gls
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Addonline_Gls
|
23 |
+
* @copyright Copyright (c) 2014 GLS
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Addonline_Gls_Block_Import_Form extends Mage_Adminhtml_Block_Widget
|
27 |
+
{
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Constructor
|
31 |
+
*/
|
32 |
+
public function __construct()
|
33 |
+
{
|
34 |
+
parent::__construct();
|
35 |
+
$this->setTemplate('gls/import/form.phtml');
|
36 |
+
}
|
37 |
+
}
|
app/code/community/Addonline/Gls/Block/Listrelay.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 GLS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Addonline_Gls
|
13 |
+
* @copyright Copyright (c) 2014 GLS
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Addonline_Gls
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Addonline_Gls
|
23 |
+
* @copyright Copyright (c) 2014 GLS
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Addonline_Gls_Block_Listrelay extends Mage_Core_Block_Template
|
27 |
+
{
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @var array
|
31 |
+
*/
|
32 |
+
private $_listRelay = array();
|
33 |
+
|
34 |
+
/**
|
35 |
+
* getter listRelay
|
36 |
+
* @return array
|
37 |
+
*/
|
38 |
+
public function getListRelay()
|
39 |
+
{
|
40 |
+
return $this->_listRelay;
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* setter listRelay
|
45 |
+
* @param array $list
|
46 |
+
*/
|
47 |
+
public function setListRelay($list)
|
48 |
+
{
|
49 |
+
$this->_listRelay = $list;
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Constructor
|
54 |
+
*/
|
55 |
+
public function __construct()
|
56 |
+
{
|
57 |
+
parent::__construct();
|
58 |
+
$this->setTemplate('gls/listrelais.phtml');
|
59 |
+
}
|
60 |
+
}
|
app/code/community/Addonline/Gls/Block/Selector.php
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 GLS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Addonline_Gls
|
13 |
+
* @copyright Copyright (c) 2014 GLS
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Addonline_Gls
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Addonline_Gls
|
23 |
+
* @copyright Copyright (c) 2014 GLS
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Addonline_Gls_Block_Selector extends Mage_Core_Block_Template
|
27 |
+
{
|
28 |
+
|
29 |
+
/**
|
30 |
+
* adresse de livraison
|
31 |
+
*/
|
32 |
+
private function _getShippingAddress()
|
33 |
+
{
|
34 |
+
return Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress();
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* methode de livraison
|
39 |
+
* @return string
|
40 |
+
*/
|
41 |
+
public function getAddressShippingMethod()
|
42 |
+
{
|
43 |
+
if ($adress = $this->_getShippingAddress()) {
|
44 |
+
return $adress->getShippingMethod();
|
45 |
+
} else {
|
46 |
+
return '';
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* rue
|
52 |
+
*/
|
53 |
+
public function getShippingStreet()
|
54 |
+
{
|
55 |
+
return $this->_getShippingAddress()->getStreetFull();
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* code postal
|
60 |
+
*/
|
61 |
+
public function getShippingPostcode()
|
62 |
+
{
|
63 |
+
return $this->_getShippingAddress()->getPostcode();
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* ville
|
68 |
+
*/
|
69 |
+
public function getShippingCity()
|
70 |
+
{
|
71 |
+
return $this->_getShippingAddress()->getCity();
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* pays
|
76 |
+
*/
|
77 |
+
public function getShippingCountry()
|
78 |
+
{
|
79 |
+
return $this->_getShippingAddress()->getCountry();
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* telephone
|
84 |
+
*/
|
85 |
+
public function getTelephone()
|
86 |
+
{
|
87 |
+
return $this->_getShippingAddress()->getTelephone();
|
88 |
+
}
|
89 |
+
}
|
app/code/community/Addonline/Gls/Helper/Data.php
ADDED
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 GLS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Addonline_Gls
|
13 |
+
* @copyright Copyright (c) 2014 GLS
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Addonline_Gls
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Addonline_Gls
|
23 |
+
* @copyright Copyright (c) 2014 GLS
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Addonline_Gls_Helper_Data extends Mage_Core_Helper_Data
|
27 |
+
{
|
28 |
+
|
29 |
+
/**
|
30 |
+
* seulement les relay XL configuré en BO
|
31 |
+
*/
|
32 |
+
public function isOnlyXLRelay()
|
33 |
+
{
|
34 |
+
return Mage::getStoreConfig('carriers/gls/relay_xl_only');
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* répertoire d'export configuré en BO
|
39 |
+
*/
|
40 |
+
public function getExportFolder()
|
41 |
+
{
|
42 |
+
return Mage::getStoreConfig('carriers/gls/export_folder');
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* répertoire d'import configuré en BO
|
47 |
+
*/
|
48 |
+
public function getImportFolder()
|
49 |
+
{
|
50 |
+
return Mage::getStoreConfig('carriers/gls/import_folder');
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* @var $_translate_inline
|
55 |
+
*/
|
56 |
+
protected $_translate_inline;
|
57 |
+
|
58 |
+
/* (non-PHPdoc)
|
59 |
+
* @see Mage_Core_Helper_Abstract::__()
|
60 |
+
*/
|
61 |
+
public function __()
|
62 |
+
{
|
63 |
+
$args = func_get_args();
|
64 |
+
if (isset($args[0]) && is_array($args[0]) && count($args) == 1) {
|
65 |
+
$args = $args[0];
|
66 |
+
}
|
67 |
+
$message = array_shift($args);
|
68 |
+
if ($message instanceof OS_Message) {
|
69 |
+
$args = $message->args;
|
70 |
+
$message = $message->message;
|
71 |
+
}
|
72 |
+
|
73 |
+
$output = parent::__($message);
|
74 |
+
|
75 |
+
/*
|
76 |
+
* if (true) { $translations = @file_get_contents('translations.os2'); $translations = eval('return '.$translations.';'); if (!is_array($translations)) $translations = array(); $file = 'NC'; $line = 'NC'; $backtrace = debug_backtrace(); foreach ($backtrace as $trace) { if (!isset($trace['function'])) continue; if (substr($trace['function'], strlen($trace['function'])-2, strlen($trace['function']))=='__') { $file = ltrim(str_replace(Mage::getBaseDir(), '', $trace['file']), '/'); $line = $trace['line']; continue; } //$file = ltrim(str_replace(Mage::getBaseDir(), '', $trace['file']), '/'); //echo $file.', '.$trace['function'].'(), '.$line.', '.$message.'<br/>'; break; } $translations[Mage::app()->getLocale()->getLocaleCode()][$file][$message] = $output; ksort($translations[Mage::app()->getLocale()->getLocaleCode()]); file_put_contents('translations.os2', var_export($translations, true)); }
|
77 |
+
*/
|
78 |
+
|
79 |
+
if (count($args) == 0) {
|
80 |
+
$result = $output;
|
81 |
+
} else {
|
82 |
+
if (! isset($this->_translate_inline))
|
83 |
+
$this->_translate_inline = Mage::getSingleton('core/translate')->getTranslateInline();
|
84 |
+
if ($this->_translate_inline) {
|
85 |
+
$parts = explode('}}{{', $output);
|
86 |
+
$parts[0] = vsprintf($parts[0], $args);
|
87 |
+
$result = implode('}}{{', $parts);
|
88 |
+
} else {
|
89 |
+
$result = vsprintf($output, $args);
|
90 |
+
}
|
91 |
+
}
|
92 |
+
return $result;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Construit le nom de la méthode de livraison affiché
|
97 |
+
* @param unknown $helper
|
98 |
+
* @param unknown $process
|
99 |
+
* @param unknown $row
|
100 |
+
* @param unknown $property
|
101 |
+
* @return string
|
102 |
+
*/
|
103 |
+
public function getMethodText($helper, $process, $row, $property)
|
104 |
+
{
|
105 |
+
if (! isset($row[$property]))
|
106 |
+
return '';
|
107 |
+
|
108 |
+
$output = '';
|
109 |
+
$cart = $process['data']['cart'];
|
110 |
+
return $helper->evalInput($process, $row, $property, str_replace(array(
|
111 |
+
'{cart.weight}',
|
112 |
+
'{cart.price-tax+discount}',
|
113 |
+
'{cart.price-tax-discount}',
|
114 |
+
'{cart.price+tax+discount}',
|
115 |
+
'{cart.price+tax-discount}'
|
116 |
+
), array(
|
117 |
+
$cart->weight . $cart->weight_unit,
|
118 |
+
$this->currency($cart->price_including_tax),
|
119 |
+
$this->currency($cart->price_excluding_tax),
|
120 |
+
$this->currency($cart->{'price-tax+discount'}),
|
121 |
+
$this->currency($cart->{'price-tax-discount'}),
|
122 |
+
$this->currency($cart->{'price+tax+discount'}),
|
123 |
+
$this->currency($cart->{'price+tax-discount'})
|
124 |
+
), $helper->getRowProperty($row, $property)));
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Construit la mpa de données
|
129 |
+
* @param unknown $helper
|
130 |
+
* @param unknown $carrier_code
|
131 |
+
* @param unknown $request
|
132 |
+
* @return multitype:NULL
|
133 |
+
*/
|
134 |
+
public function getDataModelMap($helper, $carrier_code, $request)
|
135 |
+
{
|
136 |
+
$mage_config = Mage::getConfig();
|
137 |
+
return array(
|
138 |
+
'info' => Mage::getModel('gls/Os2_Data_Info', array_merge($helper->getInfos(), array(
|
139 |
+
'magento_version' => Mage::getVersion(),
|
140 |
+
'module_version' => (string) $mage_config->getNode('modules/Addonline_Gls/version'),
|
141 |
+
'carrier_code' => $carrier_code
|
142 |
+
))),
|
143 |
+
'cart' => Mage::getModel('gls/Os2_Data_Cart', array(
|
144 |
+
'request' => $request,
|
145 |
+
'options' => array(
|
146 |
+
'bundle' => array(
|
147 |
+
'process_children' => (boolean) Mage::getStoreConfig('gls/bundle_product/process_children'),
|
148 |
+
'load_item_options_on_parent' => (boolean) Mage::getStoreConfig('gls/bundle_product/load_item_options_on_parent'),
|
149 |
+
'load_item_data_on_parent' => (boolean) Mage::getStoreConfig('gls/bundle_product/load_item_data_on_parent'),
|
150 |
+
'load_product_data_on_parent' => (boolean) Mage::getStoreConfig('gls/bundle_product/load_product_data_on_parent')
|
151 |
+
),
|
152 |
+
'configurable' => array(
|
153 |
+
'load_item_options_on_parent' => (boolean) Mage::getStoreConfig('gls/configurable_product/load_item_options_on_parent'),
|
154 |
+
'load_item_data_on_parent' => (boolean) Mage::getStoreConfig('gls/configurable_product/load_item_data_on_parent'),
|
155 |
+
'load_product_data_on_parent' => (boolean) Mage::getStoreConfig('gls/configurable_product/load_product_data_on_parent')
|
156 |
+
)
|
157 |
+
)
|
158 |
+
)),
|
159 |
+
'quote' => Mage::getModel('gls/Os2_Data_Quote'),
|
160 |
+
'selection' => Mage::getModel('gls/Os2_Data_Selection'),
|
161 |
+
'customer' => Mage::getModel('gls/Os2_Data_Customer'),
|
162 |
+
'customer_group' => Mage::getModel('gls/Os2_Data_CustomerGroup'),
|
163 |
+
'customvar' => Mage::getModel('gls/Os2_Data_Customvar'),
|
164 |
+
'date' => Mage::getModel('gls/Os2_Data_Date'),
|
165 |
+
'address_filter' => Mage::getModel('gls/Os2_Data_AddressFilter'),
|
166 |
+
'origin' => Mage::getModel('gls/Os2_Data_Address', $this->_extract($request->getData(), array(
|
167 |
+
'country_id' => 'country_id',
|
168 |
+
'region_id' => 'region_id',
|
169 |
+
'postcode' => 'postcode',
|
170 |
+
'city' => 'city'
|
171 |
+
))),
|
172 |
+
'shipto' => Mage::getModel('gls/Os2_Data_Address', $this->_extract($request->getData(), array(
|
173 |
+
'country_id' => 'dest_country_id',
|
174 |
+
'region_id' => 'dest_region_id',
|
175 |
+
'region_code' => 'dest_region_code',
|
176 |
+
'street' => 'dest_street',
|
177 |
+
'city' => 'dest_city',
|
178 |
+
'postcode' => 'dest_postcode'
|
179 |
+
))),
|
180 |
+
'billto' => Mage::getModel('gls/Os2_Data_Billto'),
|
181 |
+
'store' => Mage::getModel('gls/Os2_Data_Store', array(
|
182 |
+
'id' => $request->getData('store_id')
|
183 |
+
)),
|
184 |
+
'request' => Mage::getModel('gls/Os2_Data_Abstract', $request->getData())
|
185 |
+
);
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* extrait les données du tableau
|
190 |
+
* @param unknown $data
|
191 |
+
* @param unknown $attributes
|
192 |
+
* @return multitype:Ambigous <NULL, unknown>
|
193 |
+
*/
|
194 |
+
protected function _extract($data, $attributes)
|
195 |
+
{
|
196 |
+
$extract = array();
|
197 |
+
foreach ($attributes as $to => $from) {
|
198 |
+
$extract[$to] = isset($data[$from]) ? $data[$from] : null;
|
199 |
+
}
|
200 |
+
return $extract;
|
201 |
+
}
|
202 |
+
}
|
app/code/community/Addonline/Gls/Helper/OneStepCheckout/Checkout.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 GLS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Addonline_Gls
|
13 |
+
* @copyright Copyright (c) 2014 GLS
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
if ((string) Mage::getConfig()->getModuleConfig('Idev_OneStepCheckout')->active != 'true') {
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Addonline_Gls
|
22 |
+
*
|
23 |
+
* @category Addonline
|
24 |
+
* @package Addonline_Gls
|
25 |
+
* @copyright Copyright (c) 2014 GLS
|
26 |
+
* @author Addonline (http://www.addonline.fr)
|
27 |
+
*/
|
28 |
+
class Idev_OneStepCheckout_Helper_Checkout extends Mage_Core_Helper_Abstract
|
29 |
+
{
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Addonline_Gls
|
35 |
+
*
|
36 |
+
* @category Addonline
|
37 |
+
* @package Addonline_Gls
|
38 |
+
* @copyright Copyright (c) 2014 GLS
|
39 |
+
* @author Addonline (http://www.addonline.fr)
|
40 |
+
*/
|
41 |
+
class Addonline_Gls_Helper_OneStepCheckout_Checkout extends Idev_OneStepCheckout_Helper_Checkout
|
42 |
+
{
|
43 |
+
|
44 |
+
/* (non-PHPdoc)
|
45 |
+
* @see Idev_OneStepCheckout_Helper_Checkout::saveShipping()
|
46 |
+
*/
|
47 |
+
public function saveShipping($data, $customerAddressId)
|
48 |
+
{
|
49 |
+
$shipping_data = Mage::getSingleton('checkout/session')->getData('gls_shipping_relay_data');
|
50 |
+
if ($shipping_data)
|
51 |
+
return array();
|
52 |
+
else
|
53 |
+
return parent::saveShipping($data, $customerAddressId);
|
54 |
+
}
|
55 |
+
}
|
app/code/community/Addonline/Gls/Model/Carrier/Abstract.php
ADDED
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
|
22 |
+
// if compilation
|
23 |
+
if (file_exists(dirname(__FILE__).'/Addonline_Gls_Model_owebia_includes_OwebiaShippingHelper_GLS.php')) {
|
24 |
+
include_once 'Addonline_Gls_Model_owebia_includes_OS2_AddressFilterParser_GLS.php';
|
25 |
+
include_once 'Addonline_Gls_Model_owebia_includes_OwebiaShippingHelper_GLS.php';
|
26 |
+
} else {
|
27 |
+
include_once Mage::getBaseDir('code').'/community/Addonline/Gls/owebia_includes/OS2_AddressFilterParser_GLS.php';
|
28 |
+
include_once Mage::getBaseDir('code').'/community/Addonline/Gls/owebia_includes/OwebiaShippingHelper_GLS.php';
|
29 |
+
}
|
30 |
+
|
31 |
+
abstract class Addonline_Gls_Model_Carrier_Abstract extends Mage_Shipping_Model_Carrier_Abstract
|
32 |
+
{
|
33 |
+
protected $_config;
|
34 |
+
protected $_helper;
|
35 |
+
protected $_data_models = array();
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Collect rates for this shipping method based on information in $request
|
39 |
+
*
|
40 |
+
* @param Mage_Shipping_Model_Rate_Request $data
|
41 |
+
* @return Mage_Shipping_Model_Rate_Result
|
42 |
+
*/
|
43 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
44 |
+
{
|
45 |
+
//setlocale(LC_NUMERIC, 'fr_FR');
|
46 |
+
if (!$this->__getConfigData('active')) return false; // skip if not enabled
|
47 |
+
//$this->display($request->_data);
|
48 |
+
$process = $this->__getProcess($request);
|
49 |
+
return $this->getRates($process);
|
50 |
+
}
|
51 |
+
|
52 |
+
public function display($var)
|
53 |
+
{
|
54 |
+
$i = 0;
|
55 |
+
foreach ($var as $name => $value) {
|
56 |
+
//if ($i>20)
|
57 |
+
echo "{$name} => {$value}<br/>";
|
58 |
+
//$this->_helper->debug($name.' => '.$value.'<br/>');
|
59 |
+
$i++;
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
public function getRates($process)
|
64 |
+
{
|
65 |
+
$this->_process($process);
|
66 |
+
return $process['result'];
|
67 |
+
}
|
68 |
+
|
69 |
+
public function getAllowedMethods()
|
70 |
+
{
|
71 |
+
$process = array();
|
72 |
+
$config = $this->_getConfig();
|
73 |
+
$allowed_methods = array();
|
74 |
+
if (count($config)>0) {
|
75 |
+
foreach ($config as $row) $allowed_methods[$row['*id']] = isset($row['label']) ? $row['label']['value'] : 'No label';
|
76 |
+
}
|
77 |
+
return $allowed_methods;
|
78 |
+
}
|
79 |
+
|
80 |
+
public function isTrackingAvailable()
|
81 |
+
{
|
82 |
+
return true;
|
83 |
+
}
|
84 |
+
|
85 |
+
public function getTrackingInfo($tracking_number)
|
86 |
+
{
|
87 |
+
$original_tracking_number = $tracking_number;
|
88 |
+
$global_tracking_url = $this->__getConfigData('tracking_view_url');
|
89 |
+
$tracking_url = $global_tracking_url;
|
90 |
+
$parts = explode(':', $tracking_number);
|
91 |
+
if (count($parts)>=2) {
|
92 |
+
$tracking_number = $parts[1];
|
93 |
+
|
94 |
+
$process = array();
|
95 |
+
$config = $this->_getConfig();
|
96 |
+
|
97 |
+
if (isset($config[$parts[0]]['tracking_url'])) {
|
98 |
+
$row = $config[$parts[0]];
|
99 |
+
$tmp_tracking_url = $this->_helper->getRowProperty($row, 'tracking_url');
|
100 |
+
if (isset($tmp_tracking_url)) $tracking_url = $tmp_tracking_url;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
$tracking_status = Mage::getModel('shipping/tracking_result_status')
|
105 |
+
->setCarrier($this->_code)
|
106 |
+
->setCarrierTitle($this->__getConfigData('title'))
|
107 |
+
->setTracking($tracking_number)
|
108 |
+
->addData(
|
109 |
+
array(
|
110 |
+
'status'=> $tracking_url ? '<a target="_blank" href="' . str_replace('{tracking_number}', $tracking_number, $tracking_url) . '">' . $this->__('track the package') . '</a>' : "suivi non disponible pour le colis {$tracking_number} (original_tracking_number='{$original_tracking_number}', global_tracking_url='{$global_tracking_url}'" . (isset($row) ? ", tmp_tracking_url='{$tmp_tracking_url}'" : '') . ")"
|
111 |
+
)
|
112 |
+
)
|
113 |
+
;
|
114 |
+
$tracking_result = Mage::getModel('shipping/tracking_result')
|
115 |
+
->append($tracking_status)
|
116 |
+
;
|
117 |
+
|
118 |
+
if ($trackings = $tracking_result->getAllTrackings()) return $trackings[0];
|
119 |
+
return false;
|
120 |
+
}
|
121 |
+
|
122 |
+
/***************************************************************************************************************************/
|
123 |
+
|
124 |
+
protected function _process(&$process)
|
125 |
+
{
|
126 |
+
$debug = (bool)(isset($_GET['debug']) ? $_GET['debug'] : $this->__getConfigData('debug'));
|
127 |
+
|
128 |
+
if ($debug) $this->_helper->initDebug($this->_code, $process);
|
129 |
+
|
130 |
+
$value_found = false;
|
131 |
+
foreach ($process['config'] as $row) {
|
132 |
+
$result = $this->_helper->processRow($process, $row);
|
133 |
+
if ($result->success) {
|
134 |
+
$value_found = true;
|
135 |
+
$this->__appendMethod($process, $row, $result->result);
|
136 |
+
if ($process['options']->stop_to_first_match) break;
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
$http_request = Mage::app()->getFrontController()->getRequest();
|
141 |
+
if ($debug && $this->__checkRequest($http_request, 'checkout/cart/index')) {
|
142 |
+
Mage::getSingleton('core/session')
|
143 |
+
->addNotice('DEBUG'.$this->_helper->getDebug());
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
protected function _getConfig()
|
148 |
+
{
|
149 |
+
if (!isset($this->_config)) {
|
150 |
+
//ADDONLINE : regrouper les 3 configs GLS dans une seule variable :
|
151 |
+
$allConfigurations = '';
|
152 |
+
if($this->__getConfigData('livraisontohome')){
|
153 |
+
$allConfigurations .= $this->__getConfigData('configtohome');
|
154 |
+
}
|
155 |
+
// if($this->__getConfigData('livraisontoyou')){
|
156 |
+
// $allConfigurations .= ($allConfigurations?',':'').$this->__getConfigData('configtoyou');
|
157 |
+
// }
|
158 |
+
if($this->__getConfigData('livraisonrelay')){
|
159 |
+
$allConfigurations .= ($allConfigurations?',':'').$this->__getConfigData('configrelay');
|
160 |
+
}
|
161 |
+
Mage::log($allConfigurations);
|
162 |
+
$this->_helper = new OwebiaShippingHelper_GLS(
|
163 |
+
$allConfigurations,
|
164 |
+
true
|
165 |
+
);
|
166 |
+
// $this->_helper = new OwebiaShippingHelper(
|
167 |
+
// $this->__getConfigData('config'),
|
168 |
+
// (boolean)$this->__getConfigData('auto_correction')
|
169 |
+
// );
|
170 |
+
//FIN ADDONLINE
|
171 |
+
$this->_config = $this->_helper->getConfig();
|
172 |
+
}
|
173 |
+
return $this->_config;
|
174 |
+
}
|
175 |
+
|
176 |
+
protected function _getMethodText($process, $row, $property)
|
177 |
+
{
|
178 |
+
if (!isset($row[$property])) return '';
|
179 |
+
|
180 |
+
$output = '';
|
181 |
+
$cart = $process['data']['cart'];
|
182 |
+
return $output . ' ' . $this->_helper->evalInput($process, $row, $property, str_replace(
|
183 |
+
array(
|
184 |
+
'{cart.weight}',
|
185 |
+
'{cart.price-tax+discount}',
|
186 |
+
'{cart.price-tax-discount}',
|
187 |
+
'{cart.price+tax+discount}',
|
188 |
+
'{cart.price+tax-discount}',
|
189 |
+
),
|
190 |
+
array(
|
191 |
+
$cart->weight.$cart->weight_unit,
|
192 |
+
$this->__formatPrice($cart->price_including_tax),
|
193 |
+
$this->__formatPrice($cart->price_excluding_tax),
|
194 |
+
$this->__formatPrice($cart->{'price-tax+discount'}),
|
195 |
+
$this->__formatPrice($cart->{'price-tax-discount'}),
|
196 |
+
$this->__formatPrice($cart->{'price+tax+discount'}),
|
197 |
+
$this->__formatPrice($cart->{'price+tax-discount'}),
|
198 |
+
),
|
199 |
+
$this->_helper->getRowProperty($row, $property)
|
200 |
+
));
|
201 |
+
}
|
202 |
+
|
203 |
+
/***************************************************************************************************************************/
|
204 |
+
|
205 |
+
protected function __checkRequest($http_request, $path)
|
206 |
+
{
|
207 |
+
list($router, $controller, $action) = explode('/', $path);
|
208 |
+
return $http_request->getRouteName()==$router && $http_request->getControllerName()==$controller && $http_request->getActionName()==$action;
|
209 |
+
}
|
210 |
+
|
211 |
+
protected function __getProcess($request)
|
212 |
+
{
|
213 |
+
$mage_config = Mage::getConfig();
|
214 |
+
$os2_config = $this->_getConfig();
|
215 |
+
$data = Mage::helper('gls')->getDataModelMap($this->_helper, $this->_code, $request);
|
216 |
+
$process = array(
|
217 |
+
'data' => $data,
|
218 |
+
'cart.items' => array(),
|
219 |
+
'config' => $os2_config,
|
220 |
+
'result' => Mage::getModel('shipping/rate_result'),
|
221 |
+
'options' => (object)array(
|
222 |
+
'auto_escaping' => (boolean)$this->__getConfigData('auto_escaping'),
|
223 |
+
'auto_correction' => (boolean)$this->__getConfigData('auto_correction'),
|
224 |
+
'stop_to_first_match' => (boolean)$this->__getConfigData('stop_to_first_match'),
|
225 |
+
),
|
226 |
+
);
|
227 |
+
return $process;
|
228 |
+
}
|
229 |
+
|
230 |
+
public function addDataModel($name, $model)
|
231 |
+
{
|
232 |
+
$this->_data_models[$name] = $model;
|
233 |
+
}
|
234 |
+
|
235 |
+
protected function __getConfigData($key)
|
236 |
+
{
|
237 |
+
return $this->getConfigData($key);
|
238 |
+
}
|
239 |
+
|
240 |
+
protected function __appendMethod(&$process, $row, $fees)
|
241 |
+
{
|
242 |
+
$helper = Mage::helper('gls');
|
243 |
+
$method = Mage::getModel('shipping/rate_result_method')
|
244 |
+
->setCarrier($this->_code)
|
245 |
+
->setCarrierTitle($this->__getConfigData('title'))
|
246 |
+
->setMethod($row['*id'])
|
247 |
+
->setMethodTitle($helper->getMethodText($this->_helper, $process, $row, 'label'))
|
248 |
+
->setMethodDescription($helper->getMethodText($this->_helper, $process, $row, 'description'))
|
249 |
+
->setPrice($fees)
|
250 |
+
->setCost($fees)
|
251 |
+
;
|
252 |
+
|
253 |
+
$process['result']->append($method);
|
254 |
+
}
|
255 |
+
|
256 |
+
protected function __()
|
257 |
+
{
|
258 |
+
$args = func_get_args();
|
259 |
+
return Mage::helper('gls')->__($args);
|
260 |
+
}
|
261 |
+
}
|
262 |
+
|
app/code/community/Addonline/Gls/Model/Carrier/ShippingMethod.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Addonline_Gls
|
5 |
+
*
|
6 |
+
* @category Addonline
|
7 |
+
* @package Addonline_Gls
|
8 |
+
* @copyright Copyright (c) 2014 GLS
|
9 |
+
* @author Addonline (http://www.addonline.fr)
|
10 |
+
*/
|
11 |
+
/**
|
12 |
+
* Copyright (c) 2008-13 Owebia
|
13 |
+
*
|
14 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
15 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
16 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
17 |
+
*
|
18 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
19 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
22 |
+
* IN THE SOFTWARE.
|
23 |
+
*
|
24 |
+
* @website http://www.owebia.com/
|
25 |
+
* @project Magento Owebia Shipping 2 module
|
26 |
+
* @author Antoine Lemoine
|
27 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
28 |
+
**/
|
29 |
+
|
30 |
+
|
31 |
+
class Addonline_Gls_Model_Carrier_ShippingMethod extends Addonline_Gls_Model_Carrier_Abstract
|
32 |
+
{
|
33 |
+
|
34 |
+
protected $_code = 'gls';
|
35 |
+
|
36 |
+
// public function getTrackingInfo($tracking_number) {
|
37 |
+
// $tracking_url = $this->__getConfigData('tracking_view_url').$tracking_number;
|
38 |
+
|
39 |
+
// $tracking_status = Mage::getModel('shipping/tracking_result_status')
|
40 |
+
// ->setCarrier($this->_code)
|
41 |
+
// ->setCarrierTitle($this->__getConfigData('title'))
|
42 |
+
// ->setTracking($tracking_number)
|
43 |
+
// ->addData(
|
44 |
+
// array(
|
45 |
+
// 'status'=>'<a target="_blank" href="'.str_replace('{tracking_number}',$tracking_number,$tracking_url).'">'.__('track the package').'</a>'
|
46 |
+
// )
|
47 |
+
// )
|
48 |
+
// ;
|
49 |
+
// $tracking_result = Mage::getModel('shipping/tracking_result')
|
50 |
+
// ->append($tracking_status)
|
51 |
+
// ;
|
52 |
+
|
53 |
+
// if ($trackings = $tracking_result->getAllTrackings()) return $trackings[0];
|
54 |
+
// return false;
|
55 |
+
// }
|
56 |
+
|
57 |
+
|
58 |
+
}
|
app/code/community/Addonline/Gls/Model/Export.php
ADDED
@@ -0,0 +1,219 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 GLS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Addonline_Gls
|
13 |
+
* @copyright Copyright (c) 2014 GLS
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Addonline_Gls
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Addonline_Gls
|
23 |
+
* @copyright Copyright (c) 2014 GLS
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Addonline_Gls_Model_Export
|
27 |
+
{
|
28 |
+
|
29 |
+
const LOG_FILE = 'gls_export.log';
|
30 |
+
|
31 |
+
public $filename;
|
32 |
+
|
33 |
+
public $content;
|
34 |
+
|
35 |
+
public $fileMimeType;
|
36 |
+
|
37 |
+
public $fileCharset;
|
38 |
+
|
39 |
+
public function run()
|
40 |
+
{
|
41 |
+
Mage::log('run GLS export', null, self::LOG_FILE);
|
42 |
+
if (! Mage::getStoreConfig('carrier/gls/export')) {
|
43 |
+
return;
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
public function export($collection)
|
48 |
+
{
|
49 |
+
if ($collection->getSize() > 0) {
|
50 |
+
|
51 |
+
/*
|
52 |
+
* Csv export configuration
|
53 |
+
*/
|
54 |
+
$delimiter = ';';
|
55 |
+
$encloser = '"';
|
56 |
+
$this->filename = 'GlsCmd_' . $this->udate('YmdHisu') . '.csv';
|
57 |
+
|
58 |
+
/*
|
59 |
+
* Get the export Folder
|
60 |
+
*/
|
61 |
+
$exportFolder = Mage::helper('gls')->getExportFolder();
|
62 |
+
|
63 |
+
/*
|
64 |
+
* Populate orders array
|
65 |
+
*/
|
66 |
+
$aOrdersToExport = array();
|
67 |
+
|
68 |
+
// HEADERS of the file
|
69 |
+
$aheaders = array(
|
70 |
+
'ORDERID',
|
71 |
+
'ORDERNAME',
|
72 |
+
'PRODUCTNO',
|
73 |
+
'ORDERWEIGHTTOT',
|
74 |
+
'CONSID',
|
75 |
+
'CONTACTMAIL',
|
76 |
+
'CONTACTMOBILE',
|
77 |
+
'CONTACTPHONE',
|
78 |
+
'STREET1',
|
79 |
+
'STREET2',
|
80 |
+
'STREET3',
|
81 |
+
'COUNTRYCODE',
|
82 |
+
'CITY',
|
83 |
+
'ZIPCODE',
|
84 |
+
'REFPR'
|
85 |
+
);
|
86 |
+
$aOrdersToExport[] = $aheaders;
|
87 |
+
|
88 |
+
// Parsing of the orders
|
89 |
+
foreach ($collection as $order) {
|
90 |
+
$aRow = array();
|
91 |
+
|
92 |
+
// Getting the addresses of the order
|
93 |
+
$billingAddress = $order->getBillingAddress();
|
94 |
+
$shippingAddress = $order->getShippingAddress();
|
95 |
+
|
96 |
+
// ORDERID
|
97 |
+
$aRow[] = $order->getIncrementId();
|
98 |
+
|
99 |
+
// ORDERNAME
|
100 |
+
$aRow[] = mb_strtoupper($shippingAddress->getFirstname() . ' ' . $shippingAddress->getLastname(), 'UTF-8');
|
101 |
+
|
102 |
+
// PRODUCTNO
|
103 |
+
$shipping_method = $order->getShippingMethod();
|
104 |
+
$shipping_code = $shipping_method;
|
105 |
+
if (strpos($shipping_method, 'ls_tohome') > 0) {
|
106 |
+
// $shipping_code = 'BP';
|
107 |
+
$shipping_code = ''; // le bon code sera déterminé par winExpé, selon le pays de destination
|
108 |
+
}
|
109 |
+
// if (strpos($shipping_method, 'ls_toyou') > 0) {
|
110 |
+
// $shipping_code = 'ADO';
|
111 |
+
// }
|
112 |
+
if (strpos($shipping_method, 'ls_relay') > 0) {
|
113 |
+
$shipping_code = 'SHD';
|
114 |
+
}
|
115 |
+
$aRow[] = $shipping_code;
|
116 |
+
|
117 |
+
// ORDERWEIGHTTOT
|
118 |
+
$total_weight = 0;
|
119 |
+
$items = $order->getAllItems();
|
120 |
+
foreach ($items as $item) {
|
121 |
+
$total_weight += $item->getRowWeight();
|
122 |
+
}
|
123 |
+
$aRow[] = $total_weight;
|
124 |
+
|
125 |
+
// CONSID
|
126 |
+
$aRow[] = $order->getCustomerId();
|
127 |
+
|
128 |
+
// CONTACTMAIL
|
129 |
+
$aRow[] = $shippingAddress->getEmail();
|
130 |
+
|
131 |
+
// CONTACTMOBILE
|
132 |
+
$aRow[] = $order->getGlsWarnByPhone() ? $shippingAddress->getTelephone() : '';
|
133 |
+
|
134 |
+
// CONTACTPHONE
|
135 |
+
$aRow[] = $shippingAddress->getTelephone();
|
136 |
+
|
137 |
+
// Repartition de l'adresse en fonction des tailles.
|
138 |
+
if (strlen($shippingAddress->getStreet(1)) > 35 || strlen($shippingAddress->getStreet(2)) > 35 || strlen($shippingAddress->getStreet(3)) > 35) {
|
139 |
+
$street = $shippingAddress->getStreet(1) . ' ' . $shippingAddress->getStreet(2) . ' ' . $shippingAddress->getStreet(3);
|
140 |
+
$street = wordwrap($street, 35, ';', true);
|
141 |
+
$aStreet = explode(';', $street);
|
142 |
+
|
143 |
+
// STREET1
|
144 |
+
$aRow[] = mb_strtoupper($aStreet[0], 'UTF-8');
|
145 |
+
// STREET2
|
146 |
+
$aRow[] = mb_strtoupper($aStreet[1], 'UTF-8');
|
147 |
+
// STREET3
|
148 |
+
$aRow[] = mb_strtoupper($aStreet[2], 'UTF-8');
|
149 |
+
} else {
|
150 |
+
// STREET1
|
151 |
+
$aRow[] = mb_strtoupper($shippingAddress->getStreet(1), 'UTF-8');
|
152 |
+
|
153 |
+
// STREET2
|
154 |
+
$aRow[] = mb_strtoupper($shippingAddress->getStreet(2), 'UTF-8');
|
155 |
+
|
156 |
+
// STREET3
|
157 |
+
$aRow[] = mb_strtoupper($shippingAddress->getStreet(3), 'UTF-8');
|
158 |
+
}
|
159 |
+
|
160 |
+
// COUNTRYCODE
|
161 |
+
$aRow[] = mb_strtoupper($shippingAddress->getCountry(), 'UTF-8');
|
162 |
+
|
163 |
+
// CITY
|
164 |
+
$aRow[] = mb_strtoupper($shippingAddress->getCity(), 'UTF-8');
|
165 |
+
|
166 |
+
// ZIPCODE
|
167 |
+
$aRow[] = mb_strtoupper($shippingAddress->getPostcode(), 'UTF-8');
|
168 |
+
|
169 |
+
// REFPR (identifiant du point relais)
|
170 |
+
$aRow[] = $order->getGlsRelayPointId();
|
171 |
+
|
172 |
+
// Adding the order to the export array
|
173 |
+
$aOrdersToExport[] = $aRow;
|
174 |
+
}
|
175 |
+
|
176 |
+
/*
|
177 |
+
* Save the file
|
178 |
+
*/
|
179 |
+
$this->array2csv($aOrdersToExport, $this->filename, $delimiter, $encloser, $exportFolder);
|
180 |
+
} else {
|
181 |
+
Mage::log("Export : " . Mage::helper('gls')->__('No Order has been selected'), null, self::LOG_FILE);
|
182 |
+
}
|
183 |
+
}
|
184 |
+
|
185 |
+
private function udate($format = 'u', $utimestamp = null)
|
186 |
+
{
|
187 |
+
if (is_null($utimestamp))
|
188 |
+
$utimestamp = microtime(true);
|
189 |
+
|
190 |
+
$timestamp = floor($utimestamp);
|
191 |
+
$milliseconds = round(($utimestamp - $timestamp) * 1000000);
|
192 |
+
$milliseconds = substr($milliseconds, 0, 2);
|
193 |
+
return date(preg_replace('`(?<!\\\\)u`', $milliseconds, $format), $timestamp);
|
194 |
+
}
|
195 |
+
|
196 |
+
private function array2csv(array &$array, $filename, $delimiter = ';', $encloser = '"', $folder = 'var/export/gls/')
|
197 |
+
{
|
198 |
+
if (count($array) == 0) {
|
199 |
+
return null;
|
200 |
+
}
|
201 |
+
|
202 |
+
if (! file_exists($folder) and ! is_dir($folder)) {
|
203 |
+
mkdir($folder);
|
204 |
+
}
|
205 |
+
|
206 |
+
ob_start();
|
207 |
+
$df = fopen($folder . $filename, 'w+');
|
208 |
+
foreach ($array as $row) {
|
209 |
+
// WINEXPE attends de l'ISO-8859-1
|
210 |
+
foreach (array_keys($row) as $key) {
|
211 |
+
$row[$key] = iconv('UTF-8', 'ISO-8859-9', $row[$key]);
|
212 |
+
}
|
213 |
+
|
214 |
+
fputcsv($df, $row, $delimiter, $encloser);
|
215 |
+
}
|
216 |
+
fclose($df);
|
217 |
+
return ob_get_clean();
|
218 |
+
}
|
219 |
+
}
|
app/code/community/Addonline/Gls/Model/Import.php
ADDED
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 GLS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Addonline_Gls
|
13 |
+
* @copyright Copyright (c) 2014 GLS
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Addonline_Gls
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Addonline_Gls
|
23 |
+
* @copyright Copyright (c) 2014 GLS
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Addonline_Gls_Model_Import
|
27 |
+
{
|
28 |
+
|
29 |
+
const LOG_FILE = 'gls_import.log';
|
30 |
+
|
31 |
+
public $filename;
|
32 |
+
|
33 |
+
public $content;
|
34 |
+
|
35 |
+
public $fileMimeType;
|
36 |
+
|
37 |
+
public $fileCharset;
|
38 |
+
|
39 |
+
public function run()
|
40 |
+
{
|
41 |
+
Mage::log('run GLS import', null, self::LOG_FILE);
|
42 |
+
|
43 |
+
if (! Mage::getStoreConfig('carrier/gls/export')) {
|
44 |
+
return;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
public function import()
|
49 |
+
{
|
50 |
+
$importFolder = Mage::helper('gls')->getImportFolder();
|
51 |
+
if (! is_dir($importFolder)) {
|
52 |
+
mkdir($importFolder);
|
53 |
+
}
|
54 |
+
$dir = opendir($importFolder);
|
55 |
+
$count = 0;
|
56 |
+
|
57 |
+
// Parcour du dossier
|
58 |
+
while ($file = readdir($dir)) {
|
59 |
+
if ($file != '.' && $file != '..' && ! is_dir($importFolder . $file) && strpos($file, 'GlsWinExpe6_') !== FALSE) {
|
60 |
+
$aOrdersUpdated = array();
|
61 |
+
// Parcour du fichier
|
62 |
+
if (($handle = fopen($importFolder . DS . $file, "r")) !== FALSE) {
|
63 |
+
$row = 0;
|
64 |
+
while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {
|
65 |
+
$num = count($data);
|
66 |
+
$row ++;
|
67 |
+
if ($row > 1 && isset($data[4]) && $data[4]) {
|
68 |
+
|
69 |
+
// On récupère le champ 5 qui contient le numéro de la commande
|
70 |
+
$order = Mage::getModel('sales/order')->getCollection()
|
71 |
+
->addAttributeToFilter('increment_id', $data[4])
|
72 |
+
->getFirstItem();
|
73 |
+
|
74 |
+
// On met à jour le trackid avec le champ 18
|
75 |
+
if ($order && ! isset($aOrdersUpdated[$data[4]])) {
|
76 |
+
$order->setGlsTrackid($data[17]);
|
77 |
+
$order->save();
|
78 |
+
$aOrdersUpdated[$data[4]] = 1;
|
79 |
+
$count ++;
|
80 |
+
continue;
|
81 |
+
}
|
82 |
+
|
83 |
+
if ($order && $aOrdersUpdated[$data[4]]) {
|
84 |
+
$order->setGlsTrackid($order->getGlsTrackid() . ',' . $data[17]);
|
85 |
+
$order->save();
|
86 |
+
}
|
87 |
+
}
|
88 |
+
}
|
89 |
+
fclose($handle);
|
90 |
+
|
91 |
+
// Creation des expedition
|
92 |
+
foreach ($aOrdersUpdated as $key => $orderToShip) {
|
93 |
+
try {
|
94 |
+
$orderShipped = Mage::getModel('sales/order')->loadByIncrementId($key);
|
95 |
+
if ($this->_createShipment($orderShipped, $orderShipped->getGlsTrackid()) == 0) {
|
96 |
+
$count --;
|
97 |
+
}
|
98 |
+
} catch (Exception $e) {
|
99 |
+
Mage::log(Mage::helper('gls')->__('Shipment creation error for Order %s : %s', $key, $e->getMessage()), null, self::LOG_FILE);
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
try {
|
104 |
+
unlink($importFolder . $file);
|
105 |
+
} catch (Exception $e) {
|
106 |
+
Mage::log("Import : unable to delete file : " . $importFolder . $file, null, self::LOG_FILE);
|
107 |
+
}
|
108 |
+
}
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
closedir($dir);
|
113 |
+
return $count;
|
114 |
+
}
|
115 |
+
|
116 |
+
private function _createShipment($order, $trackcode)
|
117 |
+
{
|
118 |
+
if ($order->canShip()) {
|
119 |
+
/**
|
120 |
+
* Initialize the Mage_Sales_Model_Order_Shipment object
|
121 |
+
*/
|
122 |
+
$convertor = Mage::getModel('sales/convert_order');
|
123 |
+
$shipment = $convertor->toShipment($order);
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Add the items to send
|
127 |
+
*/
|
128 |
+
foreach ($order->getAllItems() as $orderItem) {
|
129 |
+
if (! $orderItem->getQtyToShip()) {
|
130 |
+
continue;
|
131 |
+
}
|
132 |
+
if ($orderItem->getIsVirtual()) {
|
133 |
+
continue;
|
134 |
+
}
|
135 |
+
|
136 |
+
$item = $convertor->itemToShipmentItem($orderItem);
|
137 |
+
$qty = $orderItem->getQtyToShip();
|
138 |
+
$item->setQty($qty);
|
139 |
+
|
140 |
+
$shipment->addItem($item);
|
141 |
+
} // foreach
|
142 |
+
|
143 |
+
$shipment->register();
|
144 |
+
|
145 |
+
$arrTracking = array(
|
146 |
+
'carrier_code' => $order->getShippingCarrier()->getCarrierCode(),
|
147 |
+
'title' => $order->getShippingCarrier()->getConfigData('title'),
|
148 |
+
'number' => $trackcode
|
149 |
+
);
|
150 |
+
|
151 |
+
$track = Mage::getModel('sales/order_shipment_track')->addData($arrTracking);
|
152 |
+
$shipment->addTrack($track);
|
153 |
+
|
154 |
+
// Sauvegarde de l'expedition
|
155 |
+
$this->_saveShipment($shipment, $order);
|
156 |
+
|
157 |
+
// Finally, Save the Order
|
158 |
+
$this->_saveOrder($order);
|
159 |
+
return 1;
|
160 |
+
} else {
|
161 |
+
$this->addError(Mage::helper('gls')->__('Order %s can not be shipped or has already been shipped', $order->getRealOrderId()));
|
162 |
+
return 0;
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
protected function _saveShipment(Mage_Sales_Model_Order_Shipment $shipment, Mage_Sales_Model_Order $order, $customerEmailComments = '')
|
167 |
+
{
|
168 |
+
$shipment->getOrder()->setIsInProcess(true);
|
169 |
+
$transactionSave = Mage::getModel('core/resource_transaction')->addObject($shipment)
|
170 |
+
->addObject($order)
|
171 |
+
->save();
|
172 |
+
|
173 |
+
// $emailSentStatus = $shipment->getData('email_sent');
|
174 |
+
// if (!is_null($customerEmail) && !$emailSentStatus) {
|
175 |
+
// $shipment->sendEmail(true, $customerEmailComments);
|
176 |
+
// $shipment->setEmailSent(true);
|
177 |
+
// }
|
178 |
+
|
179 |
+
return $this;
|
180 |
+
}
|
181 |
+
|
182 |
+
protected function _saveOrder(Mage_Sales_Model_Order $order)
|
183 |
+
{
|
184 |
+
// $order->setData('state', Mage_Sales_Model_Order::STATE_COMPLETE);
|
185 |
+
// $order->setData('status', Mage_Sales_Model_Order::STATE_COMPLETE);
|
186 |
+
$order->save();
|
187 |
+
|
188 |
+
return $this;
|
189 |
+
}
|
190 |
+
|
191 |
+
protected function addError($message)
|
192 |
+
{
|
193 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
194 |
+
}
|
195 |
+
}
|
app/code/community/Addonline/Gls/Model/Observer.php
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 GLS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Addonline_Gls
|
13 |
+
* @copyright Copyright (c) 2014 GLS
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Addonline_Gls
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Addonline_Gls
|
23 |
+
* @copyright Copyright (c) 2014 GLS
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Addonline_Gls_Model_Observer extends Varien_Object
|
27 |
+
{
|
28 |
+
|
29 |
+
public function __construct()
|
30 |
+
{}
|
31 |
+
|
32 |
+
public function checkoutEventGlsdata($observer)
|
33 |
+
{
|
34 |
+
$quote = $observer->getEvent()->getQuote();
|
35 |
+
$request = Mage::app()->getRequest();
|
36 |
+
|
37 |
+
// si on n'a pas le paramètre shipping_method c'est qu'on n'est pas sur la requête de mise à jour du mode de livraison
|
38 |
+
// dans ce cas on ne change rien
|
39 |
+
if (! $request->getParam('shipping_method')) {
|
40 |
+
return $this;
|
41 |
+
}
|
42 |
+
|
43 |
+
$shippingAddress = $quote->getShippingAddress();
|
44 |
+
$shippingMethod = $shippingAddress->getShippingMethod();
|
45 |
+
|
46 |
+
return $this;
|
47 |
+
}
|
48 |
+
|
49 |
+
public function setShippingRelayAddress($observer)
|
50 |
+
{
|
51 |
+
$shipping_data = Mage::getSingleton('checkout/session')->getData('gls_shipping_relay_data');
|
52 |
+
$quote = $observer->getEvent()->getQuote();
|
53 |
+
$shippingAddress = $quote->getShippingAddress();
|
54 |
+
$billingAddress = $quote->getBillingAddress();
|
55 |
+
$shippingMethod = $shippingAddress->getShippingMethod();
|
56 |
+
if (strpos($shippingMethod, 'gls_relay') !== false) {
|
57 |
+
$request = Mage::app()->getRequest();
|
58 |
+
// si on a le paramètre shipping_method c'est qu'on n'est pas sur la requête de mise à jour du mode de livraison :
|
59 |
+
// il faut mettre à jour l'addresse de livraison si on a le mode de livraison relais
|
60 |
+
if ($shipping_data && $request->getParam('shipping_method')) {
|
61 |
+
Mage::getSingleton('checkout/session')->setData('gls_shipping_warnbyphone', $shipping_data['warnbyphone']);
|
62 |
+
Mage::getSingleton('checkout/session')->setData('gls_relay_id', $shipping_data['relayId']);
|
63 |
+
$shippingAddress->setData('company', $shipping_data['name']);
|
64 |
+
$shippingAddress->setData('street', $shipping_data['address']);
|
65 |
+
$shippingAddress->setData('city', $shipping_data['city']);
|
66 |
+
$shippingAddress->setData('postcode', $shipping_data['zipcode']);
|
67 |
+
$shippingAddress->setData('save_in_address_book', 0);
|
68 |
+
if ($shipping_data['phone']) {
|
69 |
+
$shippingAddress->setData('telephone', $shipping_data['phone']);
|
70 |
+
} else {
|
71 |
+
$shippingAddress->setData('telephone', $shippingAddress->getData('telephone'));
|
72 |
+
}
|
73 |
+
}
|
74 |
+
} else {
|
75 |
+
if ($shipping_data) {
|
76 |
+
// Si l'adresse était une adresse de relais colis (on a les données en session) :
|
77 |
+
// on réinitialise l'adresse de livraison avec l'adresse de facturation
|
78 |
+
$shippingAddress->setData('prefix', $billingAddress->getData('prefix'));
|
79 |
+
$shippingAddress->setData('firstname', $billingAddress->getData('firstname'));
|
80 |
+
$shippingAddress->setData('company', $billingAddress->getData('company'));
|
81 |
+
$shippingAddress->setData('lastname', $billingAddress->getData('lastname'));
|
82 |
+
$shippingAddress->setData('street', $billingAddress->getData('street'));
|
83 |
+
$shippingAddress->setData('city', $billingAddress->getData('city'));
|
84 |
+
$shippingAddress->setData('postcode', $billingAddress->getData('postcode'));
|
85 |
+
$shippingAddress->setData('telephone', $billingAddress->getData('telephone'));
|
86 |
+
$shippingAddress->setData('save_in_address_book', 0);
|
87 |
+
}
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
public function addGlsInformationsToOrder($observer)
|
92 |
+
{
|
93 |
+
try {
|
94 |
+
// puis on vide les données en session
|
95 |
+
Mage::getSingleton('checkout/session')->setData('gls_shipping_relay_data', null);
|
96 |
+
$quote = $observer->getEvent()->getQuote();
|
97 |
+
$shippingAddress = $quote->getShippingAddress();
|
98 |
+
$shippingMethod = $shippingAddress->getShippingMethod();
|
99 |
+
if (strpos($shippingMethod, 'gls_relay') !== false) {
|
100 |
+
$observer->getEvent()
|
101 |
+
->getOrder()
|
102 |
+
->setGlsRelayPointId(Mage::getSingleton('checkout/session')->getData('gls_relay_id'));
|
103 |
+
$observer->getEvent()
|
104 |
+
->getOrder()
|
105 |
+
->setGlsWarnByPhone(Mage::getSingleton('checkout/session')->getData('gls_shipping_warnbyphone'));
|
106 |
+
$observer->getEvent()
|
107 |
+
->getOrder()
|
108 |
+
->save();
|
109 |
+
}
|
110 |
+
} catch (Exception $e) {
|
111 |
+
Mage::Log('Failed to save GLS data : ' . print_r($shippingData, true));
|
112 |
+
}
|
113 |
+
}
|
114 |
+
}
|
app/code/community/Addonline/Gls/Model/Os2/Data/Abstract.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
|
22 |
+
class Addonline_Gls_Model_Os2_Data_Abstract
|
23 |
+
{
|
24 |
+
protected $additional_attributes = array();
|
25 |
+
protected $_attributes;
|
26 |
+
protected $_loaded_object = false;
|
27 |
+
protected $_data;
|
28 |
+
|
29 |
+
public function __construct($arguments=null) {
|
30 |
+
$this->_data = (array)$arguments;
|
31 |
+
//echo '<pre>Addonline_Gls_Model_Os2_Data_Abstract::__construct<br/>';foreach ($this->_data as $n => $v){echo "\t$n => ".(is_object($v) ? get_class($v) : (is_array($v) ? 'array' : $v))."<br/>";}
|
32 |
+
}
|
33 |
+
|
34 |
+
protected function _loadObject() {
|
35 |
+
return null;
|
36 |
+
}
|
37 |
+
|
38 |
+
protected function _getObject() {
|
39 |
+
if ($this->_loaded_object===false) $this->_loaded_object = $this->_loadObject();
|
40 |
+
//foreach ($this->_loaded_object->getData() as $index => $value) echo "$index = $value<br/>";
|
41 |
+
return $this->_loaded_object;
|
42 |
+
}
|
43 |
+
|
44 |
+
protected function _load($name) {
|
45 |
+
$object = $this->_getObject();
|
46 |
+
if (!$object) return null;
|
47 |
+
/*echo get_class($this).'.getData('.$name.')'.$object->getData($name).'<br/>';
|
48 |
+
foreach ($object->getData() as $index => $value) echo "$index = $value<br/>";*/
|
49 |
+
return $object->getData($name);
|
50 |
+
}
|
51 |
+
|
52 |
+
public function __sleep() {
|
53 |
+
if (isset($this->_attributes)) return $this->_attributes;
|
54 |
+
$this->_attributes = array_unique(array_merge(array_keys($this->_data), $this->additional_attributes));
|
55 |
+
/*usort($this->_attributes, function($v1, $v2){
|
56 |
+
if ($v1=='id') return -1;
|
57 |
+
if ($v2=='id') return 1;
|
58 |
+
if ($v2=='*') return -1;
|
59 |
+
if ($v1=='*') return 1;
|
60 |
+
return $v1==$v2 ? 0 : ($v1<$v2 ? -1 : 1);
|
61 |
+
});*/
|
62 |
+
return $this->_attributes;
|
63 |
+
}
|
64 |
+
|
65 |
+
public function __get($name) {
|
66 |
+
/*$name2 = str_replace('.', '_', $name);
|
67 |
+
if (isset($this->_data[$name2])) return $this->_data[$name2];*/
|
68 |
+
//if (isset($this->_data[$name])) return $this->_data[$name]; // pb if id is null
|
69 |
+
if (!is_array($this->_data)) $this->_data = array();
|
70 |
+
if (array_key_exists($name, $this->_data)) return $this->_data[$name];
|
71 |
+
//if (in_array($name, $this->additional_attributes)) $this->_data[$name] = $this->_load($name);
|
72 |
+
$this->_data[$name] = $this->_load($name);
|
73 |
+
return $this->_data[$name];
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
?>
|
app/code/community/Addonline/Gls/Model/Os2/Data/AbstractWithAttributes.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
|
22 |
+
class Addonline_Gls_Model_Os2_Data_AbstractWithAttributes extends Addonline_Gls_Model_Os2_Data_Abstract
|
23 |
+
{
|
24 |
+
protected function _load($name) {
|
25 |
+
$elems = explode('.', $name, $limit=2);
|
26 |
+
$count = count($elems);
|
27 |
+
$last_index = $count-1;
|
28 |
+
if ($count==2) {
|
29 |
+
switch ($elems[0]) {
|
30 |
+
case 'a':
|
31 |
+
case 'attribute':
|
32 |
+
$name = $elems[1];
|
33 |
+
return $this->_getAttribute($name);
|
34 |
+
}
|
35 |
+
}
|
36 |
+
//return parent::_load($name);
|
37 |
+
return $this->_getAttribute($name);
|
38 |
+
}
|
39 |
+
|
40 |
+
protected function _getAttribute($attribute_name) {
|
41 |
+
$get_value = false;
|
42 |
+
if (substr($attribute_name, strlen($attribute_name)-6, 6)=='.value') {
|
43 |
+
$get_value = true;
|
44 |
+
$attribute_name = substr($attribute_name, 0, strlen($attribute_name)-6);
|
45 |
+
}
|
46 |
+
|
47 |
+
$object = $this->_getObject();
|
48 |
+
if (!$object) return null;
|
49 |
+
$attribute = $object->getResource()->getAttribute($attribute_name);
|
50 |
+
if (!$attribute) return null;
|
51 |
+
|
52 |
+
$attribute_frontend = $attribute->getFrontend();
|
53 |
+
$input_type = $attribute_frontend->getInputType();
|
54 |
+
switch ($input_type) {
|
55 |
+
case 'select' :
|
56 |
+
//echo 'attribute_name:'.$object->getData($attribute_name).', '.$attribute_frontend->getValue($object).';<br/>';
|
57 |
+
$value = !$get_value ? $object->getData($attribute_name) : $attribute_frontend->getValue($object);
|
58 |
+
break;
|
59 |
+
default :
|
60 |
+
$value = $object->getData($attribute_name);
|
61 |
+
break;
|
62 |
+
}
|
63 |
+
return $value;
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
?>
|
app/code/community/Addonline/Gls/Model/Os2/Data/Address.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
|
22 |
+
class Addonline_Gls_Model_Os2_Data_Address extends Addonline_Gls_Model_Os2_Data_Abstract
|
23 |
+
{
|
24 |
+
protected $additional_attributes = array('country_id', 'country_name', 'postcode');
|
25 |
+
|
26 |
+
protected function _load($name) {
|
27 |
+
switch ($name) {
|
28 |
+
case 'country_name':
|
29 |
+
return Mage::getModel('directory/country')->load($this->country_id)->getName();
|
30 |
+
}
|
31 |
+
return parent::_load($name);
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
?>
|
app/code/community/Addonline/Gls/Model/Os2/Data/AddressFilter.php
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
|
22 |
+
class Addonline_Gls_Model_Os2_Data_AddressFilter extends Addonline_Gls_Model_Os2_Data_Abstract
|
23 |
+
{
|
24 |
+
protected static $_countries = null;
|
25 |
+
|
26 |
+
// source : geonames.org, 2012-09-26
|
27 |
+
protected static $_shortcuts = array(
|
28 |
+
// continents
|
29 |
+
'AF' => array(
|
30 |
+
'label' => 'Africa',
|
31 |
+
'replace' => 'AO,BF,BI,BJ,BW,CD,CF,CG,CI,CM,CV,DJ,DZ,EG,EH,ER,ET,GA,GH,GM,GN,GQ,GW,KE,KM,LR,LS,LY,MA,MG,ML,MR,MU,MW,MZ,NA,NE,NG,RE,RW,SC,SD,SS,SH,SL,SN,SO,ST,SZ,TD,TG,TN,TZ,UG,YT,ZA,ZM,ZW',
|
32 |
+
),
|
33 |
+
'AS' => array(
|
34 |
+
'label' => 'Asia',
|
35 |
+
'replace' => 'AE,AF,AM,AZ,BD,BH,BN,BT,CC,CN,CX,GE,HK,ID,IL,IN,IO,IQ,IR,JO,JP,KG,KH,KP,KR,KW,KZ,LA,LB,LK,MM,MN,MO,MV,MY,NP,OM,PH,PK,PS,QA,SA,SG,SY,TH,TJ,TM,TR,TW,UZ,VN,YE',
|
36 |
+
),
|
37 |
+
'EU' => array(
|
38 |
+
'label' => 'Europa',
|
39 |
+
'replace' => 'AD,AL,AT,AX,BA,BE,BG,BY,CH,CY,CZ,DE,DK,EE,ES,FI,FO,FR,GB,GG,GI,GR,HR,HU,IE,IM,IS,IT,JE,XK,LI,LT,LU,LV,MC,MD,ME,MK,MT,NL,NO,PL,PT,RO,RS,RU,SE,SI,SJ,SK,SM,UA,VA,CS',
|
40 |
+
),
|
41 |
+
'NA' => array(
|
42 |
+
'label' => 'North America',
|
43 |
+
'replace' => 'AG,AI,AW,BB,BL,BM,BQ,BS,BZ,CA,CR,CU,CW,DM,DO,GD,GL,GP,GT,HN,HT,JM,KN,KY,LC,MF,MQ,MS,MX,NI,PA,PM,PR,SV,SX,TC,TT,US,VC,VG,VI,AN',
|
44 |
+
),
|
45 |
+
'SA' => array(
|
46 |
+
'label' => 'South America',
|
47 |
+
'replace' => 'AR,BO,BR,CL,CO,EC,FK,GF,GY,PE,PY,SR,UY,VE',
|
48 |
+
),
|
49 |
+
'OC' => array(
|
50 |
+
'label' => 'Oceania',
|
51 |
+
'replace' => 'AS,AU,CK,FJ,FM,GU,KI,MH,MP,NC,NF,NR,NU,NZ,PF,PG,PN,PW,SB,TK,TL,TO,TV,UM,VU,WF,WS',
|
52 |
+
),
|
53 |
+
'AN' => array(
|
54 |
+
'label' => 'Antartica',
|
55 |
+
'replace' => 'AQ,BV,GS,HM,TF',
|
56 |
+
),
|
57 |
+
/*UK=>GB*/
|
58 |
+
'EU-27' => array(
|
59 |
+
'label' => 'European Union',
|
60 |
+
'replace' => 'AT,BE,BG,CY,CZ,DE,DK,EE,EL,ES,FI,FR,HU,IE,IT,LT,LU,LV,MT,NL,PL,PT,RO,SI,SK,SE,GB',
|
61 |
+
),
|
62 |
+
/* Guadeloupe, Martinique, Guyane, Réunion, Mayotte */
|
63 |
+
'DOM' => array(
|
64 |
+
'label' => "Département d'Outre-Mer",
|
65 |
+
'replace' => 'GP,MQ,GF,RE,YT',
|
66 |
+
),
|
67 |
+
/* Polynésie française, Saint-Pierre-et-Miquelon, Wallis-et-Futuna, Saint-Martin, Saint-Barthélemy */
|
68 |
+
'COM' => array(
|
69 |
+
'label' => "Collectivités d'Outre-Mer",
|
70 |
+
'replace' => 'PF,PM,WF,MF,BL',
|
71 |
+
),
|
72 |
+
);
|
73 |
+
|
74 |
+
public static function readable($input) {
|
75 |
+
if (!self::$_countries) {
|
76 |
+
$collection = Mage::getModel('directory/country')->getCollection();
|
77 |
+
$countries = array();
|
78 |
+
foreach ($collection as $country) {
|
79 |
+
$countries[$country->getId()] = $country->getName();
|
80 |
+
}
|
81 |
+
self::$_countries = $countries;
|
82 |
+
}
|
83 |
+
|
84 |
+
$elems = preg_split('/\b/', $input);
|
85 |
+
$output = '';
|
86 |
+
foreach ($elems as $elem) {
|
87 |
+
if (isset(self::$_countries[$elem])) {
|
88 |
+
$output .= self::$_countries[$elem];
|
89 |
+
} else {
|
90 |
+
$output .= $elem;
|
91 |
+
}
|
92 |
+
}
|
93 |
+
while (preg_match('/{address_filter\.([^}]+)}/', $output, $result)) {
|
94 |
+
$name = $result[1];
|
95 |
+
$replacement = isset(self::$_shortcuts[$name]) ? self::$_shortcuts[$name]['label'] : 'unknown';
|
96 |
+
$replacement = Mage::helper('gls')->__($replacement);
|
97 |
+
$output = str_replace($result[0], $replacement, $output);
|
98 |
+
}
|
99 |
+
return $output;
|
100 |
+
}
|
101 |
+
|
102 |
+
protected function _load($name) {
|
103 |
+
if (isset(self::$_shortcuts[$name])) {
|
104 |
+
return self::$_shortcuts[$name]['replace'];
|
105 |
+
}
|
106 |
+
return parent::_load($name);
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
?>
|
app/code/community/Addonline/Gls/Model/Os2/Data/AttributeSet.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
|
22 |
+
class Addonline_Gls_Model_Os2_Data_AttributeSet extends Addonline_Gls_Model_Os2_Data_Abstract
|
23 |
+
{
|
24 |
+
protected function _loadObject() {
|
25 |
+
return Mage::getModel('eav/entity_attribute_set')->load($this->id);
|
26 |
+
}
|
27 |
+
|
28 |
+
protected function _load($name) {
|
29 |
+
switch ($name) {
|
30 |
+
case 'name': return $this->{'attribute_set_name'};
|
31 |
+
default: return parent::_load($name);
|
32 |
+
}
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
?>
|
app/code/community/Addonline/Gls/Model/Os2/Data/Billto.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
|
22 |
+
class Addonline_Gls_Model_Os2_Data_Billto extends Addonline_Gls_Model_Os2_Data_Address
|
23 |
+
{
|
24 |
+
protected function _load($name) {
|
25 |
+
switch ($name) {
|
26 |
+
}
|
27 |
+
return parent::_load($name);
|
28 |
+
}
|
29 |
+
|
30 |
+
protected function _loadObject() {
|
31 |
+
$quote = Mage::getModel('checkout/cart')->getQuote();
|
32 |
+
$address = $quote->getBillingAddress();
|
33 |
+
return $address;
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
?>
|
app/code/community/Addonline/Gls/Model/Os2/Data/Cart.php
ADDED
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
|
22 |
+
class Addonline_Gls_Model_Os2_Data_Cart extends Addonline_Gls_Model_Os2_Data_Abstract
|
23 |
+
{
|
24 |
+
protected $additional_attributes = array('coupon_code', 'weight_unit', 'weight_for_charge', 'free_shipping');
|
25 |
+
protected $_free_shipping;
|
26 |
+
protected $_items;
|
27 |
+
protected $_options;
|
28 |
+
|
29 |
+
public function __construct($arguments)
|
30 |
+
{
|
31 |
+
parent::__construct();
|
32 |
+
$request = $arguments['request'];
|
33 |
+
$this->_options = $arguments['options'];
|
34 |
+
|
35 |
+
$quote = Mage::getModel('checkout/session')->getQuote();
|
36 |
+
$this->_data = array(
|
37 |
+
'price-tax+discount' => (double)$quote->getData('subtotal_with_discount'), //$request->getData('package_value_with_discount'),
|
38 |
+
'price-tax-discount' => (double)$quote->getData('subtotal'), //$request->getData('package_value'),
|
39 |
+
'price+tax+discount' => (double)$quote->getData('grand_total'),
|
40 |
+
'price+tax-discount' => null,
|
41 |
+
'weight' => $request->getData('package_weight'),
|
42 |
+
'qty' => $request->getData('package_qty'),
|
43 |
+
'free_shipping' => $request->getData('free_shipping'),
|
44 |
+
);
|
45 |
+
|
46 |
+
$cart_items = array();
|
47 |
+
$items = $request->getAllItems();
|
48 |
+
$quote_total_collected = false;
|
49 |
+
$bundle_process_children = isset($this->_options['bundle']['process_children']) && $this->_options['bundle']['process_children'];
|
50 |
+
foreach ($items as $item) {
|
51 |
+
$product = $item->getProduct();
|
52 |
+
if ($product instanceof Mage_Catalog_Model_Product) {
|
53 |
+
$key = null;
|
54 |
+
if ($item instanceof Mage_Sales_Model_Quote_Address_Item) { // Multishipping
|
55 |
+
$key = $item->getQuoteItemId();
|
56 |
+
} else if ($item instanceof Mage_Sales_Model_Quote_Item) { // Onepage checkout
|
57 |
+
$key = $item->getId();
|
58 |
+
}
|
59 |
+
$cart_items[$key] = $item;
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
$tax_amount = 0;
|
64 |
+
$full_price = 0;
|
65 |
+
$this->_items = array();
|
66 |
+
foreach ($cart_items as $item) {
|
67 |
+
$type = $item->getProduct()->getTypeId();
|
68 |
+
//echo $item->getProduct()->getTypeId().', '.$item->getQty().'<br/>';
|
69 |
+
$parent_item_id = $item->getData('parent_item_id');
|
70 |
+
$parent_item = isset($cart_items[$parent_item_id]) ? $cart_items[$parent_item_id] : null;
|
71 |
+
$parent_type = isset($parent_item) ? $parent_item->getProduct()->getTypeId() : null;
|
72 |
+
if ($type!='configurable') {
|
73 |
+
if ($type=='bundle' && $bundle_process_children) {
|
74 |
+
$this->_data['qty'] -= $item->getQty();
|
75 |
+
continue;
|
76 |
+
}
|
77 |
+
if ($parent_type=='bundle') {
|
78 |
+
if (!$bundle_process_children) continue;
|
79 |
+
else $this->_data['qty'] += $item->getQty();
|
80 |
+
}
|
81 |
+
$this->_items[] = Mage::getModel('gls/Os2_Data_CartItem', array('item' => $item, 'parent_item' => $parent_item, 'options' => $this->_options));
|
82 |
+
}
|
83 |
+
//$tax_amount += $item->getData('tax_amount');
|
84 |
+
$full_price += Mage::helper('checkout')->getSubtotalInclTax($item); // ok
|
85 |
+
}
|
86 |
+
//$this->_data['price+tax+discount'] = $tax_amount+$this->_data['price-tax+discount'];
|
87 |
+
$this->_data['price+tax-discount'] = $full_price;
|
88 |
+
|
89 |
+
//echo '<pre>Addonline_Gls_Model_Os2_Data_Abstract::__construct<br/>';foreach ($this->_data as $n => $v){echo "\t$n => ".(is_object($v) ? get_class($v) : (is_array($v) ? 'array' : $v))."<br/>";}echo '</pre>';
|
90 |
+
}
|
91 |
+
|
92 |
+
protected function _load($name)
|
93 |
+
{
|
94 |
+
switch ($name) {
|
95 |
+
case 'weight_for_charge':
|
96 |
+
$weight_for_charge = $this->weight;
|
97 |
+
foreach ($this->_items as $item) {
|
98 |
+
if ($item->free_shipping) $weight_for_charge -= $item->weight;
|
99 |
+
}
|
100 |
+
return $weight_for_charge;
|
101 |
+
case 'coupon_code':
|
102 |
+
$coupon_code = null;
|
103 |
+
$session = Mage::getSingleton('checkout/session');
|
104 |
+
if ($session && ($quote = $session->getQuote()) && $quote->hasCouponCode() && $quote->getCouponCode()) {
|
105 |
+
$coupon_code = $quote->getCouponCode();
|
106 |
+
} else { // Pour les commandes depuis Adminhtml
|
107 |
+
$session = Mage::getSingleton('adminhtml/session_quote');
|
108 |
+
if ($session && ($quote = $session->getQuote()) && $quote->hasCouponCode() && $quote->getCouponCode()) {
|
109 |
+
$coupon_code = $quote->getCouponCode();
|
110 |
+
}
|
111 |
+
}
|
112 |
+
return $coupon_code;
|
113 |
+
case 'weight_unit':
|
114 |
+
return Mage::getStoreConfig('gls/general/weight_unit');
|
115 |
+
}
|
116 |
+
return parent::_load($name);
|
117 |
+
}
|
118 |
+
|
119 |
+
public function __set($name, $value)
|
120 |
+
{
|
121 |
+
switch ($name) {
|
122 |
+
case 'items':
|
123 |
+
return $this->_items = $value;
|
124 |
+
}
|
125 |
+
return parent::__set($name, $value);
|
126 |
+
}
|
127 |
+
|
128 |
+
public function __get($name)
|
129 |
+
{
|
130 |
+
switch ($name) {
|
131 |
+
case 'items':
|
132 |
+
return $this->_items;
|
133 |
+
case 'free_shipping':
|
134 |
+
if (isset($this->_free_shipping)) return $this->_free_shipping;
|
135 |
+
$free_shipping = parent::__get('free_shipping');
|
136 |
+
if (!$free_shipping) {
|
137 |
+
foreach ($this->_items as $item) {
|
138 |
+
$free_shipping = $item->free_shipping;
|
139 |
+
if (!$free_shipping) break;
|
140 |
+
}
|
141 |
+
}
|
142 |
+
return $this->_free_shipping = $free_shipping;
|
143 |
+
}
|
144 |
+
return parent::__get($name);
|
145 |
+
}
|
146 |
+
}
|
app/code/community/Addonline/Gls/Model/Os2/Data/CartItem.php
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
|
22 |
+
class Addonline_Gls_Model_Os2_Data_CartItem extends Addonline_Gls_Model_Os2_Data_Abstract
|
23 |
+
{
|
24 |
+
private $parent_cart_item;
|
25 |
+
private $cart_product;
|
26 |
+
private $loaded_product;
|
27 |
+
private $quantity;
|
28 |
+
private $categories;
|
29 |
+
|
30 |
+
protected $_product;
|
31 |
+
protected $_item;
|
32 |
+
protected $_parent_item;
|
33 |
+
protected $_type;
|
34 |
+
protected $_options;
|
35 |
+
protected $_get_options;
|
36 |
+
|
37 |
+
public function __construct($arguments) {
|
38 |
+
parent::__construct();
|
39 |
+
$this->_item = $item = $arguments['item'];
|
40 |
+
$this->_parent_item = $parent_item = $arguments['parent_item'];
|
41 |
+
$this->_get_options = $options = $arguments['options'];
|
42 |
+
$this->_product = null;
|
43 |
+
$this->_type = $parent_item ? $parent_item->getProduct()->getTypeId() : $item->getProduct()->getTypeId();
|
44 |
+
$this->_loaded_object = $this->_getItem('load_item_data_on_parent');
|
45 |
+
|
46 |
+
if (false) {
|
47 |
+
echo '---------------------------------<br/>';
|
48 |
+
foreach ($this->_item->getData() as $index => $value) {
|
49 |
+
$value = is_object($value) ? get_class($value) : (is_array($value) ? 'array' : $value);
|
50 |
+
echo "$index = $value<br/>";
|
51 |
+
}
|
52 |
+
if ($parent_item) {
|
53 |
+
echo '----- parent -----<br/>';
|
54 |
+
foreach ($parent_item->getData() as $index => $value) echo "$index = $value<br/>";
|
55 |
+
}
|
56 |
+
echo 'type:'.$this->_type.'<br/>';
|
57 |
+
echo 'sku:'.$this->sku.'<br/>';
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
public function getProduct() {
|
62 |
+
if (!isset($this->_product)) {
|
63 |
+
//echo $this->_loaded_object->getData('product_id').', '.$this->_getItem('load_product_data_on_parent')->getData('product_id').'<br/>';
|
64 |
+
$product_id = $this->_getItem('load_product_data_on_parent')->getData('product_id');
|
65 |
+
$this->_product = Mage::getModel('gls/Os2_Data_Product', array('id' => $product_id));
|
66 |
+
}
|
67 |
+
return $this->_product;
|
68 |
+
}
|
69 |
+
|
70 |
+
protected function _load($name) {
|
71 |
+
$elems = explode('.', $name, $limit=2);
|
72 |
+
$count = count($elems);
|
73 |
+
$last_index = $count-1;
|
74 |
+
if ($count==2) {
|
75 |
+
switch ($elems[0]) {
|
76 |
+
case 'o':
|
77 |
+
case 'option':
|
78 |
+
return $this->_getOption($elems[1]);
|
79 |
+
}
|
80 |
+
}
|
81 |
+
switch ($name) {
|
82 |
+
case 'price-tax+discount': return (double)$this->base_original_price-$this->discount_amount/$this->qty;
|
83 |
+
case 'price-tax-discount': return (double)$this->base_original_price;
|
84 |
+
case 'price+tax+discount':
|
85 |
+
/*echo 'base_original_price '.$this->base_original_price.'';
|
86 |
+
echo ' + (tax_amount '.$this->tax_amount.'';
|
87 |
+
echo ' - discount_amount '.$this->discount_amount.')';
|
88 |
+
echo '/ '.$this->qty.'<br>';
|
89 |
+
echo ' ::: = '.($this->base_original_price+($this->tax_amount-$this->discount_amount)/$this->qty).'<br>';*/
|
90 |
+
return (double)$this->base_original_price+($this->tax_amount-$this->discount_amount)/$this->qty;
|
91 |
+
case 'price+tax-discount': return (double)$this->price_incl_tax;
|
92 |
+
case 'weight':
|
93 |
+
if ($this->_type=='bundle' && $this->getProduct()->weight_type==0) {
|
94 |
+
return (double)parent::_load($name);
|
95 |
+
}
|
96 |
+
return $this->qty*$this->getProduct()->weight;
|
97 |
+
default:
|
98 |
+
return parent::_load($name);
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
public function __toString() {
|
103 |
+
return $this->name.' (id:'.$this->product_id.', sku:'.$this->sku.')';
|
104 |
+
}
|
105 |
+
|
106 |
+
protected function _getOption($option_name, $get_by_id=false) {
|
107 |
+
$options = $this->_getOptions();
|
108 |
+
if (isset($options[$option_name])) return $get_by_id ? $options[$option_name]['value_id'] : $options[$option_name]['value'];
|
109 |
+
else return null;
|
110 |
+
}
|
111 |
+
|
112 |
+
protected function _getItem($what) {
|
113 |
+
$get_parent = isset($this->_get_options[$this->_type][$what]) && $this->_get_options[$this->_type][$what]==true;
|
114 |
+
/*echo 'getItem('.$what.')['.$this->_type.'] = '.($get_parent ? 'parent' : 'self').'<br/>';
|
115 |
+
print_r($this->_get_options[$this->_type]);*/
|
116 |
+
return $get_parent ? $this->_parent_item : $this->_item;
|
117 |
+
}
|
118 |
+
|
119 |
+
protected function _getOptions() {
|
120 |
+
if (isset($this->_options)) return $this->_options;
|
121 |
+
$item = $this->_getItem('load_item_option_on_parent');
|
122 |
+
$options = array();
|
123 |
+
if ($optionIds = $item->getOptionByCode('option_ids')) {
|
124 |
+
foreach (explode(',', $optionIds->getValue()) as $optionId) {
|
125 |
+
if ($option = $item->getProduct()->getOptionById($optionId)) {
|
126 |
+
$quoteItemOption = $item->getOptionByCode('option_' . $option->getId());
|
127 |
+
|
128 |
+
$group = $option->groupFactory($option->getType())
|
129 |
+
->setOption($option)
|
130 |
+
->setQuoteItemOption($quoteItemOption);
|
131 |
+
|
132 |
+
$label = $option->getTitle();
|
133 |
+
$options[$label] = array(
|
134 |
+
'label' => $label,
|
135 |
+
'value' => $group->getFormattedOptionValue($quoteItemOption->getValue()),
|
136 |
+
'print_value' => $group->getPrintableOptionValue($quoteItemOption->getValue()),
|
137 |
+
'value_id' => $quoteItemOption->getValue(),
|
138 |
+
'option_id' => $option->getId(),
|
139 |
+
'option_type' => $option->getType(),
|
140 |
+
'custom_view' => $group->isCustomizedView()
|
141 |
+
);
|
142 |
+
}
|
143 |
+
}
|
144 |
+
}
|
145 |
+
if ($addOptions = $item->getOptionByCode('additional_options')) {
|
146 |
+
$options = array_merge($options, unserialize($addOptions->getValue()));
|
147 |
+
}
|
148 |
+
$this->_options = $options;
|
149 |
+
return $this->_options;
|
150 |
+
}
|
151 |
+
}
|
152 |
+
|
153 |
+
?>
|
app/code/community/Addonline/Gls/Model/Os2/Data/Category.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
|
22 |
+
class Addonline_Gls_Model_Os2_Data_Category extends Addonline_Gls_Model_Os2_Data_Abstract
|
23 |
+
{
|
24 |
+
protected function _loadObject() {
|
25 |
+
return Mage::getModel('catalog/category')->load($this->id);
|
26 |
+
}
|
27 |
+
|
28 |
+
public function __toString() {
|
29 |
+
return $this->name.' (id:'.$this->id.', url_key:'.$this->url_key.')';
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
?>
|
app/code/community/Addonline/Gls/Model/Os2/Data/Customer.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
|
22 |
+
class Addonline_Gls_Model_Os2_Data_Customer extends Addonline_Gls_Model_Os2_Data_AbstractWithAttributes
|
23 |
+
{
|
24 |
+
protected $additional_attributes = array('*');
|
25 |
+
|
26 |
+
public function __construct($arguments=null)
|
27 |
+
{
|
28 |
+
parent::__construct(array(
|
29 |
+
'id' => Mage::getSingleton('customer/session')->getCustomerId(),
|
30 |
+
));
|
31 |
+
}
|
32 |
+
|
33 |
+
protected function _loadObject()
|
34 |
+
{
|
35 |
+
return Mage::getModel('customer/customer')->load($this->id);
|
36 |
+
}
|
37 |
+
|
38 |
+
public function __toString()
|
39 |
+
{
|
40 |
+
return $this->firstname.' '.$this->lastname.' (id:'.$this->id.')';
|
41 |
+
}
|
42 |
+
}
|
app/code/community/Addonline/Gls/Model/Os2/Data/CustomerGroup.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
|
22 |
+
class Addonline_Gls_Model_Os2_Data_CustomerGroup extends Addonline_Gls_Model_Os2_Data_Abstract
|
23 |
+
{
|
24 |
+
protected static $_customer_groups = null;
|
25 |
+
|
26 |
+
public static function getCollection()
|
27 |
+
{
|
28 |
+
if (!self::$_customer_groups) {
|
29 |
+
$collection = Mage::getModel('customer/group')->getCollection();
|
30 |
+
$customer_groups = array();
|
31 |
+
foreach ($collection as $customer_group) {
|
32 |
+
$customer_groups[$customer_group->getId()] = $customer_group->getCustomerGroupCode();
|
33 |
+
}
|
34 |
+
self::$_customer_groups = $customer_groups;
|
35 |
+
}
|
36 |
+
return self::$_customer_groups;
|
37 |
+
}
|
38 |
+
|
39 |
+
public static function readable($input)
|
40 |
+
{
|
41 |
+
$customer_groups = self::getCollection();
|
42 |
+
$elems = preg_split('/\b/', $input);
|
43 |
+
$output = '';
|
44 |
+
foreach ($elems as $elem) {
|
45 |
+
$output .= isset($customer_groups[$elem]) ? $customer_groups[$elem] : $elem;
|
46 |
+
}
|
47 |
+
return $output;
|
48 |
+
}
|
49 |
+
|
50 |
+
protected $additional_attributes = array('*');
|
51 |
+
|
52 |
+
public function __construct($arguments=null)
|
53 |
+
{
|
54 |
+
$customer_group_id = Mage::getSingleton('customer/session')->getCustomerGroupId();
|
55 |
+
if ($customer_group_id==0) { // Pour les commandes depuis Adminhtml
|
56 |
+
$customer_group_id2 = Mage::getSingleton('adminhtml/session_quote')->getQuote()->getCustomerGroupId();
|
57 |
+
if (isset($customer_group_id2)) $customer_group_id = $customer_group_id2;
|
58 |
+
}
|
59 |
+
parent::__construct(array(
|
60 |
+
'id' => $customer_group_id,
|
61 |
+
));
|
62 |
+
}
|
63 |
+
|
64 |
+
protected function _load($name)
|
65 |
+
{
|
66 |
+
switch ($name) {
|
67 |
+
case 'code': return $this->customer_group_code;
|
68 |
+
default: return parent::_load($name);
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
protected function _loadObject()
|
73 |
+
{
|
74 |
+
return Mage::getSingleton('customer/group')->load($this->id);
|
75 |
+
}
|
76 |
+
|
77 |
+
public function __toString()
|
78 |
+
{
|
79 |
+
return $this->code.' (id:'.$this->id.')';
|
80 |
+
}
|
81 |
+
}
|
app/code/community/Addonline/Gls/Model/Os2/Data/Customvar.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
|
22 |
+
class Addonline_Gls_Model_Os2_Data_Customvar extends Addonline_Gls_Model_Os2_Data_Abstract
|
23 |
+
{
|
24 |
+
public function __sleep() {
|
25 |
+
return array('*');
|
26 |
+
}
|
27 |
+
|
28 |
+
protected function _load($name) {
|
29 |
+
return Mage::getModel('core/variable')
|
30 |
+
->setStoreId(Mage::app()->getStore()->getId()) // to get store value
|
31 |
+
->loadByCode($name)->getValue('text');
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
?>
|
app/code/community/Addonline/Gls/Model/Os2/Data/Date.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
|
22 |
+
class Addonline_Gls_Model_Os2_Data_Date extends Addonline_Gls_Model_Os2_Data_Abstract
|
23 |
+
{
|
24 |
+
private $_timestamp;
|
25 |
+
|
26 |
+
public function __construct() {
|
27 |
+
parent::__construct();
|
28 |
+
$this->_timestamp = (int)Mage::getModel('core/date')->timestamp();
|
29 |
+
}
|
30 |
+
|
31 |
+
public function __sleep() {
|
32 |
+
return array('timestamp', 'year', 'month', 'day', 'hour', 'minute', 'second', 'weekday');
|
33 |
+
}
|
34 |
+
|
35 |
+
protected function _load($name) {
|
36 |
+
switch ($name) {
|
37 |
+
case 'timestamp': return $this->_timestamp;
|
38 |
+
case 'year': return (int)date('Y', $this->_timestamp);
|
39 |
+
case 'month': return (int)date('m', $this->_timestamp);
|
40 |
+
case 'day': return (int)date('d', $this->_timestamp);
|
41 |
+
case 'hour': return (int)date('H', $this->_timestamp);
|
42 |
+
case 'minute': return (int)date('i', $this->_timestamp);
|
43 |
+
case 'second': return (int)date('s', $this->_timestamp);
|
44 |
+
case 'weekday': return (int)date('w', $this->_timestamp);
|
45 |
+
}
|
46 |
+
return null;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
?>
|
app/code/community/Addonline/Gls/Model/Os2/Data/Info.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
|
22 |
+
class Addonline_Gls_Model_Os2_Data_Info extends Addonline_Gls_Model_Os2_Data_Abstract
|
23 |
+
{
|
24 |
+
}
|
25 |
+
|
26 |
+
?>
|
app/code/community/Addonline/Gls/Model/Os2/Data/Product.php
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
|
22 |
+
class Addonline_Gls_Model_Os2_Data_Product extends Addonline_Gls_Model_Os2_Data_AbstractWithAttributes
|
23 |
+
{
|
24 |
+
protected $_categories;
|
25 |
+
protected $_attribute_set;
|
26 |
+
protected $_stock_item;
|
27 |
+
|
28 |
+
protected function _loadObject() {
|
29 |
+
return Mage::getModel('catalog/product')->load($this->id);
|
30 |
+
}
|
31 |
+
|
32 |
+
protected function _load($name) {
|
33 |
+
$elems = explode('.', $name, $limit=2);
|
34 |
+
$count = count($elems);
|
35 |
+
$last_index = $count-1;
|
36 |
+
if ($count==2) {
|
37 |
+
switch ($elems[0]) {
|
38 |
+
case 'attribute_set':
|
39 |
+
return $this->getAttributeSet()->{$elems[1]};
|
40 |
+
case 'stock':
|
41 |
+
return $this->_getStockItem()->{$elems[1]};
|
42 |
+
case 'category':
|
43 |
+
$category = $this->_getCategory();
|
44 |
+
return $category ? $category->{$elems[1]} : null;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
switch ($name) {
|
48 |
+
case 'attribute_set': return $this->getAttributeSet()->name; // Compatibility
|
49 |
+
case 'category': // Compatibility
|
50 |
+
$category = $this->_getCategory();
|
51 |
+
return $category ? $category->name : null;
|
52 |
+
case 'categories': // Compatibility
|
53 |
+
$categories = $this->getCategories();
|
54 |
+
$output = array();
|
55 |
+
foreach ($categories as $category) {
|
56 |
+
$output[] = $category->name;
|
57 |
+
}
|
58 |
+
return $output;
|
59 |
+
case 'categories.id': // Compatibility
|
60 |
+
$categories = $this->getCategories();
|
61 |
+
$output = array();
|
62 |
+
foreach ($categories as $category) {
|
63 |
+
$output[] = $category->id;
|
64 |
+
}
|
65 |
+
return $output;
|
66 |
+
default: return parent::_load($name);
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
public function getAttributeSet() {
|
71 |
+
if (isset($this->_attribute_set)) return $this->_attribute_set;
|
72 |
+
return $this->_attribute_set = Mage::getModel('gls/Os2_Data_AttributeSet', array('id' => (int)$this->attribute_set_id));
|
73 |
+
}
|
74 |
+
|
75 |
+
protected function _getStockItem() {
|
76 |
+
//foreach ($this->_loaded_object->getData() as $index => $value) echo "$index = $value<br/>";
|
77 |
+
if (isset($this->_stock_item)) return $this->_stock_item;
|
78 |
+
return $this->_stock_item = Mage::getModel('gls/Os2_Data_StockItem', array('product_id' => (int)$this->id));
|
79 |
+
}
|
80 |
+
|
81 |
+
protected function _getCategory() {
|
82 |
+
$categories = $this->getCategories();
|
83 |
+
return $categories ? $categories[0] : null;
|
84 |
+
}
|
85 |
+
|
86 |
+
public function getCategories() {
|
87 |
+
if (isset($this->_categories)) return $this->_categories;
|
88 |
+
$product = $this->_loadObject();
|
89 |
+
$ids = $product->getCategoryIds();
|
90 |
+
$this->_categories = array();
|
91 |
+
foreach ($ids as $id) {
|
92 |
+
$this->_categories[] = Mage::getModel('gls/Os2_Data_Category', array('id' => (int)$id));
|
93 |
+
}
|
94 |
+
return $this->_categories;
|
95 |
+
}
|
96 |
+
|
97 |
+
protected function _getAttribute($attribute_name) {
|
98 |
+
switch ($attribute_name) {
|
99 |
+
case 'weight': return (double)parent::_getAttribute($attribute_name);
|
100 |
+
default: return parent::_getAttribute($attribute_name);
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
/*public function _getAttribute($attribute_name) {
|
105 |
+
return parent::_getAttribute($attribute_name);
|
106 |
+
|
107 |
+
// Dynamic weight for bundle product
|
108 |
+
if ($this->type=='bundle' && $attribute_name=='weight' && $product->getData('weight_type')==0) {
|
109 |
+
// !!! Use cart_product and not product
|
110 |
+
return $this->cart_product->getTypeInstance(true)->getWeight($this->cart_product);
|
111 |
+
}
|
112 |
+
}*/
|
113 |
+
|
114 |
+
public function __toString() {
|
115 |
+
return $this->name.' (id:'.$this->id.', sku:'.$this->sku.')';
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
?>
|
app/code/community/Addonline/Gls/Model/Os2/Data/Quote.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
|
22 |
+
class Addonline_Gls_Model_Os2_Data_Quote extends Addonline_Gls_Model_Os2_Data_Abstract
|
23 |
+
{
|
24 |
+
protected $additional_attributes = array('subtotal', 'subtotal_with_discount', 'grand_total', 'base_subtotal', 'base_subtotal_with_discount', 'base_grand_total', '*');
|
25 |
+
|
26 |
+
protected function _loadObject()
|
27 |
+
{
|
28 |
+
return Mage::getModel('checkout/session')->getQuote();
|
29 |
+
}
|
30 |
+
}
|
app/code/community/Addonline/Gls/Model/Os2/Data/Selection.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
|
22 |
+
class Addonline_Gls_Model_Os2_Data_Selection extends Addonline_Gls_Model_Os2_Data_Abstract
|
23 |
+
{
|
24 |
+
public function set($name, $value) {
|
25 |
+
$this->_data[$name] = $value;
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
?>
|
app/code/community/Addonline/Gls/Model/Os2/Data/StockItem.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
|
22 |
+
class Addonline_Gls_Model_Os2_Data_StockItem extends Addonline_Gls_Model_Os2_Data_Abstract
|
23 |
+
{
|
24 |
+
protected function _loadObject() {
|
25 |
+
return Mage::getModel('cataloginventory/stock_item')->loadByProduct($this->product_id);
|
26 |
+
}
|
27 |
+
|
28 |
+
protected function _load($name) {
|
29 |
+
switch ($name) {
|
30 |
+
case 'is_in_stock': return (bool)parent::_load($name);
|
31 |
+
case 'qty':
|
32 |
+
$qty = parent::_load($name);
|
33 |
+
return $this->is_qty_decimal ? (float)$qty : (int)$qty;
|
34 |
+
default: return parent::_load($name);
|
35 |
+
}
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
?>
|
app/code/community/Addonline/Gls/Model/Os2/Data/Store.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
|
22 |
+
class Addonline_Gls_Model_Os2_Data_Store extends Addonline_Gls_Model_Os2_Data_Abstract
|
23 |
+
{
|
24 |
+
private $_store;
|
25 |
+
|
26 |
+
public function __construct($arguments=null)
|
27 |
+
{
|
28 |
+
parent::__construct();
|
29 |
+
if ($arguments && isset($argument['id'])) $this->_store = Mage::app()->getStore((int)$argument['id']);
|
30 |
+
else $this->_store = Mage::app()->getStore();
|
31 |
+
}
|
32 |
+
|
33 |
+
public function __sleep()
|
34 |
+
{
|
35 |
+
return array('id', 'code', 'name', 'address', 'phone');
|
36 |
+
}
|
37 |
+
|
38 |
+
protected function _load($name)
|
39 |
+
{
|
40 |
+
switch ($name) {
|
41 |
+
case 'id':
|
42 |
+
return $this->_store->getId();
|
43 |
+
case 'code':
|
44 |
+
return $this->_store->getData($name);
|
45 |
+
case 'name':
|
46 |
+
case 'address':
|
47 |
+
case 'phone':
|
48 |
+
return $this->_store->getConfig('general/store_information/'.$name);
|
49 |
+
}
|
50 |
+
return null;
|
51 |
+
}
|
52 |
+
}
|
app/code/community/Addonline/Gls/Model/Sales/Quote/Address.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 GLS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Addonline_Gls
|
13 |
+
* @copyright Copyright (c) 2014 GLS
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Addonline_Gls
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Addonline_Gls
|
23 |
+
* @copyright Copyright (c) 2014 GLS
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Addonline_Gls_Model_Sales_Quote_Address extends Mage_Sales_Model_Quote_Address
|
27 |
+
{
|
28 |
+
|
29 |
+
/* (non-PHPdoc)
|
30 |
+
* @see Mage_Sales_Model_Quote_Address::getGroupedAllShippingRates()
|
31 |
+
*/
|
32 |
+
public function getGroupedAllShippingRates()
|
33 |
+
{
|
34 |
+
$rates = array();
|
35 |
+
foreach ($this->getShippingRatesCollection() as $rate) {
|
36 |
+
if (! $rate->isDeleted() && $rate->getCarrierInstance()) {
|
37 |
+
if (! isset($rates[$rate->getCarrier()])) {
|
38 |
+
$rates[$rate->getCarrier()] = array();
|
39 |
+
}
|
40 |
+
|
41 |
+
$rates[$rate->getCarrier()][] = $rate;
|
42 |
+
$rates[$rate->getCarrier()][0]->carrier_sort_order = $rate->getCarrierInstance()->getSortOrder();
|
43 |
+
}
|
44 |
+
}
|
45 |
+
uasort($rates, array(
|
46 |
+
$this,
|
47 |
+
'_sortRates'
|
48 |
+
));
|
49 |
+
|
50 |
+
/*
|
51 |
+
* On tri selon les paramètres du Back office
|
52 |
+
*/
|
53 |
+
$aOrderRatesGLS = array();
|
54 |
+
if (isset($rates['gls'])) {
|
55 |
+
$carrier = $rates['gls'][0]->getCarrierInstance();
|
56 |
+
$aOrderRatesGLS['ordertohome'] = $carrier->getConfigData('ordertohome');
|
57 |
+
// $aOrderRatesGLS['ordertoyou'] = $carrier->getConfigData('ordertoyou');
|
58 |
+
$aOrderRatesGLS['orderrelay'] = $carrier->getConfigData('orderrelay');
|
59 |
+
}
|
60 |
+
|
61 |
+
if (count($aOrderRatesGLS)) {
|
62 |
+
$aOrderedRatesGLS = array();
|
63 |
+
foreach ($rates['gls'] as $key => $orderedRate) {
|
64 |
+
$aOrderedRatesGLS[$orderedRate->getData('code')] = $orderedRate;
|
65 |
+
}
|
66 |
+
|
67 |
+
foreach ($rates['gls'] as $key => $orderedRate) {
|
68 |
+
$sCode = $orderedRate->getData('code');
|
69 |
+
if (strpos($sCode, 'ls_relay') > 0) {
|
70 |
+
$rates['gls'][$aOrderRatesGLS['orderrelay']] = $orderedRate;
|
71 |
+
}
|
72 |
+
// if(strpos($sCode,'ls_toyou') > 0){
|
73 |
+
// $rates['gls'][$aOrderRatesGLS['ordertoyou']] = $orderedRate;
|
74 |
+
// }
|
75 |
+
if (strpos($sCode, 'ls_tohome') > 0) {
|
76 |
+
$rates['gls'][$aOrderRatesGLS['ordertohome']] = $orderedRate;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
unset($rates['gls'][0]);
|
81 |
+
}
|
82 |
+
/*
|
83 |
+
* Fin du tri
|
84 |
+
*/
|
85 |
+
|
86 |
+
return $rates;
|
87 |
+
}
|
88 |
+
}
|
app/code/community/Addonline/Gls/Model/Service.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 GLS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Addonline_Gls
|
13 |
+
* @copyright Copyright (c) 2014 GLS
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Addonline_Gls
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Addonline_Gls
|
23 |
+
* @copyright Copyright (c) 2014 GLS
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Addonline_Gls_Model_Service
|
27 |
+
{
|
28 |
+
|
29 |
+
protected $_urlWsdl;
|
30 |
+
|
31 |
+
public function getUrlWsdl()
|
32 |
+
{
|
33 |
+
if (! $this->_urlWsdl) {
|
34 |
+
$this->_urlWsdl = "http://www.gls-group.eu/276-I-PORTAL-WEBSERVICE/services/ParcelShopSearch/wsdl/2010_01_ParcelShopSearch.wsdl";
|
35 |
+
}
|
36 |
+
return $this->_urlWsdl;
|
37 |
+
}
|
38 |
+
|
39 |
+
public function getRelayPointsForZipCode($zipcode, $country)
|
40 |
+
{
|
41 |
+
$login = Mage::getStoreConfig('carriers/gls/usernamews');
|
42 |
+
$mdp = Mage::getStoreConfig('carriers/gls/passws');
|
43 |
+
|
44 |
+
if (file_exists(dirname(__FILE__) . DS . 'Webservice' . DS . 'PointsRelaisWSService.php'))
|
45 |
+
require_once dirname(__FILE__) . DS . 'Webservice' . DS . 'PointsRelaisWSService.php';
|
46 |
+
else
|
47 |
+
require_once dirname(__FILE__) . DS . 'Addonline_Gls_Model_Webservice_PointsRelaisWSService.php';
|
48 |
+
|
49 |
+
$pointsRelaisWSService = new PointsRelaisWSService(array(
|
50 |
+
'trace' => TRUE
|
51 |
+
), $this->getUrlWsdl());
|
52 |
+
// $aParameters = array('UserName' =>$login,'Password' =>$mdp,'ZipCode' => $zipcode,'Country' => $country);
|
53 |
+
|
54 |
+
$aParameters = array(
|
55 |
+
'Credentials' => array(
|
56 |
+
'UserName' => $login,
|
57 |
+
'Password' => $mdp
|
58 |
+
),
|
59 |
+
'Address' => array(
|
60 |
+
'Name1' => '',
|
61 |
+
'Name2' => '',
|
62 |
+
'Name3' => '',
|
63 |
+
'Street1' => '',
|
64 |
+
'BlockNo1' => '',
|
65 |
+
'Street2' => '',
|
66 |
+
'BlockNo2' => '',
|
67 |
+
'ZipCode' => $zipcode,
|
68 |
+
'City' => '',
|
69 |
+
'Province' => '',
|
70 |
+
'Country' => $country
|
71 |
+
)
|
72 |
+
);
|
73 |
+
|
74 |
+
try {
|
75 |
+
$result = $pointsRelaisWSService->findRelayPoints($aParameters);
|
76 |
+
return $result;
|
77 |
+
} catch (SoapFault $fault) {
|
78 |
+
var_dump($fault);
|
79 |
+
return false;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
}
|
app/code/community/Addonline/Gls/Model/System/Config/Source/LoadOnParent.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
class Addonline_Gls_Model_System_Config_Source_LoadOnParent extends Mage_Adminhtml_Model_System_Config_Source_Category
|
22 |
+
{
|
23 |
+
|
24 |
+
public function toOptionArray($addEmpty = true)
|
25 |
+
{
|
26 |
+
$options = array(
|
27 |
+
array(
|
28 |
+
'label' => Mage::helper('gls')->__('Self'),
|
29 |
+
'value' => '0'
|
30 |
+
),
|
31 |
+
array(
|
32 |
+
'label' => Mage::helper('gls')->__('Parent'),
|
33 |
+
'value' => '1'
|
34 |
+
)
|
35 |
+
);
|
36 |
+
return $options;
|
37 |
+
}
|
38 |
+
}
|
app/code/community/Addonline/Gls/Model/System/Config/Source/ProcessChildren.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
class Addonline_Gls_Model_System_Config_Source_ProcessChildren extends Mage_Adminhtml_Model_System_Config_Source_Category
|
22 |
+
{
|
23 |
+
|
24 |
+
public function toOptionArray($addEmpty = true)
|
25 |
+
{
|
26 |
+
$options = array(
|
27 |
+
array(
|
28 |
+
'label' => Mage::helper('gls')->__('Self'),
|
29 |
+
'value' => '0'
|
30 |
+
),
|
31 |
+
array(
|
32 |
+
'label' => Mage::helper('gls')->__('Children'),
|
33 |
+
'value' => '1'
|
34 |
+
)
|
35 |
+
);
|
36 |
+
return $options;
|
37 |
+
}
|
38 |
+
}
|
app/code/community/Addonline/Gls/Model/Webservice/PointsRelaisWSService.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 GLS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Addonline_Gls
|
13 |
+
* @copyright Copyright (c) 2014 GLS
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
if (! class_exists("PointsRelaisWSService", false)) {
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Addonline_Gls
|
22 |
+
*
|
23 |
+
* @category Addonline
|
24 |
+
* @package Addonline_Gls
|
25 |
+
* @copyright Copyright (c) 2014 GLS
|
26 |
+
* @author Addonline (http://www.addonline.fr)
|
27 |
+
*/
|
28 |
+
class PointsRelaisWSService extends SoapClient
|
29 |
+
{
|
30 |
+
|
31 |
+
/**
|
32 |
+
*
|
33 |
+
* @param array $config
|
34 |
+
* A array of config values
|
35 |
+
* @param string $wsdl
|
36 |
+
* The wsdl file to use
|
37 |
+
* @access public
|
38 |
+
*/
|
39 |
+
public function __construct(array $options = array(), $wsdl = 'http://www.gls-group.eu/276-I-PORTAL-WEBSERVICE/services/ParcelShopSearch/wsdl/2010_01_ParcelShopSearch.wsdl')
|
40 |
+
{
|
41 |
+
parent::__construct($wsdl, $options);
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
*
|
46 |
+
* @param findRelayPoints $parameters
|
47 |
+
* @access public
|
48 |
+
*/
|
49 |
+
public function findRelayPoints($parameters)
|
50 |
+
{
|
51 |
+
return $this->__soapCall('GetParcelShops', array(
|
52 |
+
$parameters
|
53 |
+
));
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
app/code/community/Addonline/Gls/controllers/AjaxController.php
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 GLS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Addonline_Gls
|
13 |
+
* @copyright Copyright (c) 2014 GLS
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Addonline_Gls
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Addonline_Gls
|
23 |
+
* @copyright Copyright (c) 2014 GLS
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Addonline_Gls_AjaxController extends Mage_Core_Controller_Front_Action
|
27 |
+
{
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Affiche le bloc selector
|
31 |
+
*/
|
32 |
+
public function selectorAction()
|
33 |
+
{
|
34 |
+
// Creation du block
|
35 |
+
$this->loadLayout();
|
36 |
+
$block = $this->getLayout()->createBlock('Addonline_Gls_Block_Selector', 'root', array(
|
37 |
+
'template' => 'gls/selector.phtml'
|
38 |
+
));
|
39 |
+
$this->getLayout()
|
40 |
+
->getBlock('content')
|
41 |
+
->append($block);
|
42 |
+
$this->renderLayout();
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* affiche la liste des Point relais
|
47 |
+
*/
|
48 |
+
public function listPointsRelaisAction()
|
49 |
+
{
|
50 |
+
$aPointsRelais = array();
|
51 |
+
$response = new Varien_Object();
|
52 |
+
|
53 |
+
$zipcode = $this->getRequest()->getParam('zipcode', false);
|
54 |
+
$country = $this->getRequest()->getParam('country', false);
|
55 |
+
|
56 |
+
$listrelais = Mage::getSingleton('gls/service')->getRelayPointsForZipCode($zipcode, $country);
|
57 |
+
if (! isset($listrelais->SearchResults)) {
|
58 |
+
echo $this->__('Your parameters for GSL Webservice might be wrong, or the webservice is down');
|
59 |
+
Mage::log($listrelais, null, 'gls.log');
|
60 |
+
} else {
|
61 |
+
|
62 |
+
$productMaxWeight = 0;
|
63 |
+
$items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
|
64 |
+
foreach ($items as $item) {
|
65 |
+
$productMaxWeight = (($productMaxWeight > $item->getWeight()) ? $productMaxWeight : $item->getWeight());
|
66 |
+
}
|
67 |
+
|
68 |
+
$onlyxlrelay = Mage::getStoreConfig('carriers/gls/onlyxlrelay') || ($productMaxWeight > Mage::getStoreConfig('carriers/gls/maxrelayweight'));
|
69 |
+
foreach ($listrelais->SearchResults as $key => $pointRelais) {
|
70 |
+
|
71 |
+
if ($onlyxlrelay && substr($pointRelais->Parcelshop->Address->Name1, strlen($pointRelais->Parcelshop->Address->Name1) - 2, strlen($pointRelais->Parcelshop->Address->Name1)) != 'XL') {
|
72 |
+
continue;
|
73 |
+
}
|
74 |
+
$aRelay = array();
|
75 |
+
$aRelay['relayId'] = $pointRelais->Parcelshop->ParcelShopId;
|
76 |
+
$aRelay['relayName'] = $pointRelais->Parcelshop->Address->Name1 . ' ' . $pointRelais->Parcelshop->Address->Name2 . ' ' . $pointRelais->Parcelshop->Address->Name3;
|
77 |
+
$aRelay['relayAddress'] = $pointRelais->Parcelshop->Address->Street1 . ' ' . $pointRelais->Parcelshop->Address->BlockNo1 . ' ' . $pointRelais->Parcelshop->Address->Street2 . ' ' . $pointRelais->Parcelshop->Address->BlockNo2;
|
78 |
+
$aRelay['relayZipCode'] = $pointRelais->Parcelshop->Address->ZipCode;
|
79 |
+
$aRelay['relayCity'] = $pointRelais->Parcelshop->Address->City;
|
80 |
+
$aRelay['relayCountry'] = $pointRelais->Parcelshop->Address->Country;
|
81 |
+
$aRelay['relayLatitude'] = $pointRelais->Parcelshop->GLSCoordinates->Latitude;
|
82 |
+
$aRelay['relayLongitude'] = $pointRelais->Parcelshop->GLSCoordinates->Longitude;
|
83 |
+
|
84 |
+
$relayWorkingDays = array();
|
85 |
+
for ($i = 0; $i < 7; $i ++) {
|
86 |
+
if (isset($pointRelais->Parcelshop->GLSWorkingDay[$i])) {
|
87 |
+
$relayWorkingDays[$i]['hours']['from'] = $pointRelais->Parcelshop->GLSWorkingDay[$i]->OpeningHours->Hours->From;
|
88 |
+
$relayWorkingDays[$i]['hours']['to'] = $pointRelais->Parcelshop->GLSWorkingDay[$i]->OpeningHours->Hours->To;
|
89 |
+
$relayWorkingDays[$i]['breaks']['from'] = $pointRelais->Parcelshop->GLSWorkingDay[$i]->Breaks->Hours->From;
|
90 |
+
$relayWorkingDays[$i]['breaks']['to'] = $pointRelais->Parcelshop->GLSWorkingDay[$i]->Breaks->Hours->To;
|
91 |
+
}
|
92 |
+
}
|
93 |
+
$aRelay['relayWorkingDays'] = $relayWorkingDays;
|
94 |
+
$aPointsRelais[$pointRelais->Parcelshop->ParcelShopId] = $aRelay;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
// Creation du block
|
99 |
+
$this->loadLayout();
|
100 |
+
$block = $this->getLayout()->createBlock('Addonline_Gls_Block_Listrelay', 'root', array(
|
101 |
+
'template' => 'gls/listrelais.phtml'
|
102 |
+
));
|
103 |
+
$block->setListRelay($aPointsRelais);
|
104 |
+
$this->getLayout()
|
105 |
+
->getBlock('content')
|
106 |
+
->append($block);
|
107 |
+
$this->renderLayout();
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* enregsitre en session
|
112 |
+
*/
|
113 |
+
public function saveInSessionRelayInformationsAction()
|
114 |
+
{
|
115 |
+
if (count($_GET)) {
|
116 |
+
Mage::getSingleton('checkout/session')->setData('gls_shipping_relay_data', $_GET);
|
117 |
+
}
|
118 |
+
}
|
119 |
+
}
|
app/code/community/Addonline/Gls/controllers/ExportController.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 GLS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Addonline_Gls
|
13 |
+
* @copyright Copyright (c) 2014 GLS
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Addonline_Gls
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Addonline_Gls
|
23 |
+
* @copyright Copyright (c) 2014 GLS
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Addonline_Gls_ExportController extends Mage_Adminhtml_Controller_Action
|
27 |
+
{
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Constructor
|
31 |
+
*/
|
32 |
+
protected function _construct()
|
33 |
+
{
|
34 |
+
$this->setUsedModuleName('Addonline_Gls');
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Main action : show orders list
|
39 |
+
*/
|
40 |
+
public function indexAction()
|
41 |
+
{
|
42 |
+
$this->loadLayout()
|
43 |
+
->_setActiveMenu('gls/export')
|
44 |
+
->_addContent($this->getLayout()
|
45 |
+
->createBlock('gls/export_orders'))
|
46 |
+
->renderLayout();
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Export Action : Generates a CSV file to download
|
51 |
+
*/
|
52 |
+
public function exportAction()
|
53 |
+
{
|
54 |
+
/* get the orders */
|
55 |
+
$orderIds = $this->getRequest()->getPost('order_ids');
|
56 |
+
|
57 |
+
if (isset($orderIds) && ($orderIds[0] != "")) {
|
58 |
+
|
59 |
+
$collection = Mage::getResourceModel('sales/order_collection');
|
60 |
+
$collection->addAttributeToFilter('entity_id', $orderIds);
|
61 |
+
|
62 |
+
$export = Mage::getModel('gls/export');
|
63 |
+
$export->export($collection);
|
64 |
+
|
65 |
+
/* download the file */
|
66 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Orders have been exported'));
|
67 |
+
$this->_redirect('*/*/');
|
68 |
+
} else {
|
69 |
+
$this->_getSession()->addError($this->__('No Order has been selected'));
|
70 |
+
$this->_redirect('*/*/');
|
71 |
+
}
|
72 |
+
}
|
73 |
+
}
|
app/code/community/Addonline/Gls/controllers/ImportController.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 GLS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Addonline_Gls
|
13 |
+
* @copyright Copyright (c) 2014 GLS
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Addonline_Gls
|
20 |
+
*
|
21 |
+
* @category Addonline
|
22 |
+
* @package Addonline_Gls
|
23 |
+
* @copyright Copyright (c) 2014 GLS
|
24 |
+
* @author Addonline (http://www.addonline.fr)
|
25 |
+
*/
|
26 |
+
class Addonline_Gls_ImportController extends Mage_Adminhtml_Controller_Action
|
27 |
+
{
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Constructor
|
31 |
+
*/
|
32 |
+
protected function _construct()
|
33 |
+
{
|
34 |
+
$this->setUsedModuleName('Addonline_Gls');
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Main action : show import form
|
39 |
+
*/
|
40 |
+
public function indexAction()
|
41 |
+
{
|
42 |
+
$this->loadLayout()
|
43 |
+
->_setActiveMenu('gls/import')
|
44 |
+
->_addContent($this->getLayout()
|
45 |
+
->createBlock('gls/import_form'))
|
46 |
+
->renderLayout();
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Import Action
|
51 |
+
*/
|
52 |
+
public function importAction()
|
53 |
+
{
|
54 |
+
$import = Mage::getModel('gls/import');
|
55 |
+
$nbr_imported = $import->import();
|
56 |
+
|
57 |
+
if ($nbr_imported) {
|
58 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($nbr_imported . ' ' . $this->__('Orders have been imported'));
|
59 |
+
} else {
|
60 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('No orders to import in the folder ') . Mage::helper('gls')->getImportFolder());
|
61 |
+
}
|
62 |
+
$this->_redirect('*/*/');
|
63 |
+
}
|
64 |
+
}
|
app/code/community/Addonline/Gls/etc/adminhtml.xml
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2014 GLS
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* It is available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category Addonline
|
13 |
+
* @package Addonline_Gls
|
14 |
+
* @copyright Copyright (c) 2014 GLS
|
15 |
+
* @author Addonline (http://www.addonline.fr)
|
16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
+
**/
|
18 |
+
-->
|
19 |
+
<!-- Magento 1.4.0 and upper -->
|
20 |
+
<config>
|
21 |
+
<translate>
|
22 |
+
<modules>
|
23 |
+
<Addonline_Gls>
|
24 |
+
<files>
|
25 |
+
<shipping>Mage_Shipping.csv</shipping>
|
26 |
+
<gls>Addonline_Gls.csv</gls>
|
27 |
+
</files>
|
28 |
+
</Addonline_Gls>
|
29 |
+
</modules>
|
30 |
+
</translate>
|
31 |
+
<menu>
|
32 |
+
<gls module="gls">
|
33 |
+
<title>GLS Import/Export</title>
|
34 |
+
<sort_order>99</sort_order>
|
35 |
+
<children>
|
36 |
+
<export translate="title" module="gls">
|
37 |
+
<title>Export orders</title>
|
38 |
+
<sort_order>0</sort_order>
|
39 |
+
<action>gls/export</action>
|
40 |
+
</export>
|
41 |
+
<import translate="title" module="gls">
|
42 |
+
<title>Import tracking</title>
|
43 |
+
<sort_order>1</sort_order>
|
44 |
+
<action>gls/import</action>
|
45 |
+
</import>
|
46 |
+
</children>
|
47 |
+
<depends>
|
48 |
+
<config>carriers/gls/importexport</config>
|
49 |
+
</depends>
|
50 |
+
</gls>
|
51 |
+
</menu>
|
52 |
+
<acl>
|
53 |
+
<resources>
|
54 |
+
<admin>
|
55 |
+
<children>
|
56 |
+
<system>
|
57 |
+
<children>
|
58 |
+
<config>
|
59 |
+
<children>
|
60 |
+
<gls>
|
61 |
+
<title>GLS Section</title>
|
62 |
+
<sort_order>100</sort_order>
|
63 |
+
</gls>
|
64 |
+
</children>
|
65 |
+
</config>
|
66 |
+
</children>
|
67 |
+
</system>
|
68 |
+
<gls translate="title" module="gls">
|
69 |
+
<title>GLS Import/Export</title>
|
70 |
+
<sort_order>200</sort_order>
|
71 |
+
<children>
|
72 |
+
<export translate="title">
|
73 |
+
<title>Export orders</title>
|
74 |
+
</export>
|
75 |
+
<import translate="title">
|
76 |
+
<title>Import tracking</title>
|
77 |
+
</import>
|
78 |
+
</children>
|
79 |
+
</gls>
|
80 |
+
</children>
|
81 |
+
</admin>
|
82 |
+
</resources>
|
83 |
+
</acl>
|
84 |
+
</config>
|
app/code/community/Addonline/Gls/etc/config.xml
ADDED
@@ -0,0 +1,254 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2014 GLS
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* It is available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category Addonline
|
13 |
+
* @package Addonline_Gls
|
14 |
+
* @copyright Copyright (c) 2014 GLS
|
15 |
+
* @author Addonline (http://www.addonline.fr)
|
16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
+
**/
|
18 |
+
-->
|
19 |
+
<config>
|
20 |
+
<modules>
|
21 |
+
<Addonline_Gls>
|
22 |
+
<version>1.0.0</version>
|
23 |
+
<depends>
|
24 |
+
<Mage_Shipping />
|
25 |
+
</depends>
|
26 |
+
</Addonline_Gls>
|
27 |
+
</modules>
|
28 |
+
|
29 |
+
<global>
|
30 |
+
<blocks>
|
31 |
+
<gls>
|
32 |
+
<class>Addonline_Gls_Block</class>
|
33 |
+
</gls>
|
34 |
+
</blocks>
|
35 |
+
<helpers>
|
36 |
+
<gls>
|
37 |
+
<class>Addonline_Gls_Helper</class>
|
38 |
+
</gls>
|
39 |
+
<onestepcheckout>
|
40 |
+
<rewrite>
|
41 |
+
<checkout>Addonline_Gls_Helper_OneStepCheckout_Checkout</checkout>
|
42 |
+
</rewrite>
|
43 |
+
</onestepcheckout>
|
44 |
+
</helpers>
|
45 |
+
<!-- <resources> <gls_setup> <setup> <module>Addonline_Gls</module> <class>Mage_Sales_Model_Mysql4_Setup</class>
|
46 |
+
</setup> </gls_setup> </resources> -->
|
47 |
+
<models>
|
48 |
+
<gls>
|
49 |
+
<class>Addonline_Gls_Model</class>
|
50 |
+
</gls>
|
51 |
+
<sales>
|
52 |
+
<rewrite>
|
53 |
+
<quote_address>Addonline_Gls_Model_Sales_Quote_Address</quote_address>
|
54 |
+
</rewrite>
|
55 |
+
</sales>
|
56 |
+
</models>
|
57 |
+
<resources>
|
58 |
+
<gls_setup>
|
59 |
+
<setup>
|
60 |
+
<module>Addonline_Gls</module>
|
61 |
+
<class>Mage_Sales_Model_Mysql4_Setup</class>
|
62 |
+
</setup>
|
63 |
+
</gls_setup>
|
64 |
+
</resources>
|
65 |
+
<events>
|
66 |
+
<!-- <sales_quote_collect_totals_before> <observers> <Addonline_Gls_Model_Observer>
|
67 |
+
<type>singleton</type> <class>gls/observer</class> <method>checkoutEventGlsdata</method>
|
68 |
+
</Addonline_Gls_Model_Observer> </observers> </sales_quote_collect_totals_before> -->
|
69 |
+
<sales_quote_collect_totals_before>
|
70 |
+
<observers>
|
71 |
+
<Addonline_Gls_Model_Observer>
|
72 |
+
<type>singleton</type>
|
73 |
+
<class>gls/observer</class>
|
74 |
+
<method>setShippingRelayAddress</method>
|
75 |
+
</Addonline_Gls_Model_Observer>
|
76 |
+
</observers>
|
77 |
+
</sales_quote_collect_totals_before>
|
78 |
+
<checkout_type_onepage_save_order_after>
|
79 |
+
<observers>
|
80 |
+
<Addonline_Gls_Model_Observer>
|
81 |
+
<type>singleton</type>
|
82 |
+
<class>gls/observer</class>
|
83 |
+
<method>addGlsInformationsToOrder</method>
|
84 |
+
</Addonline_Gls_Model_Observer>
|
85 |
+
</observers>
|
86 |
+
</checkout_type_onepage_save_order_after>
|
87 |
+
</events>
|
88 |
+
</global>
|
89 |
+
<frontend>
|
90 |
+
<layout>
|
91 |
+
<updates>
|
92 |
+
<gls module="Addonline_Gls">
|
93 |
+
<file>gls.xml</file>
|
94 |
+
</gls>
|
95 |
+
</updates>
|
96 |
+
</layout>
|
97 |
+
<secure_url>
|
98 |
+
<gls>/gls/ajax/</gls>
|
99 |
+
</secure_url>
|
100 |
+
<translate>
|
101 |
+
<modules>
|
102 |
+
<Addonline_Gls>
|
103 |
+
<files>
|
104 |
+
<shipping>Mage_Shipping.csv</shipping>
|
105 |
+
<default>Addonline_Gls.csv</default>
|
106 |
+
</files>
|
107 |
+
</Addonline_Gls>
|
108 |
+
</modules>
|
109 |
+
</translate>
|
110 |
+
</frontend>
|
111 |
+
<admin>
|
112 |
+
<routers>
|
113 |
+
<gls>
|
114 |
+
<use>admin</use>
|
115 |
+
<args>
|
116 |
+
<module>Addonline_Gls</module>
|
117 |
+
<frontName>gls</frontName>
|
118 |
+
</args>
|
119 |
+
</gls>
|
120 |
+
</routers>
|
121 |
+
</admin>
|
122 |
+
<adminhtml>
|
123 |
+
<!-- Magento lower than 1.4.0 -->
|
124 |
+
<translate>
|
125 |
+
<modules>
|
126 |
+
<Addonline_Gls>
|
127 |
+
<files>
|
128 |
+
<shipping>Mage_Shipping.csv</shipping>
|
129 |
+
<gls>Addonline_Gls.csv</gls>
|
130 |
+
</files>
|
131 |
+
</Addonline_Gls>
|
132 |
+
</modules>
|
133 |
+
</translate>
|
134 |
+
<menu>
|
135 |
+
<gls module="gls">
|
136 |
+
<title>GLS Import/Export</title>
|
137 |
+
<sort_order>99</sort_order>
|
138 |
+
<children>
|
139 |
+
<export translate="title" module="gls">
|
140 |
+
<title>Export orders</title>
|
141 |
+
<sort_order>0</sort_order>
|
142 |
+
<action>gls/export</action>
|
143 |
+
</export>
|
144 |
+
<import translate="title" module="gls">
|
145 |
+
<title>Import tracking</title>
|
146 |
+
<sort_order>1</sort_order>
|
147 |
+
<action>gls/import</action>
|
148 |
+
</import>
|
149 |
+
</children>
|
150 |
+
<depends>
|
151 |
+
<config>carriers/gls/importexport</config>
|
152 |
+
</depends>
|
153 |
+
</gls>
|
154 |
+
</menu>
|
155 |
+
<acl>
|
156 |
+
<resources>
|
157 |
+
<admin>
|
158 |
+
<children>
|
159 |
+
<system>
|
160 |
+
<children>
|
161 |
+
<config>
|
162 |
+
<children>
|
163 |
+
<gls>
|
164 |
+
<title>GLS Section</title>
|
165 |
+
<sort_order>100</sort_order>
|
166 |
+
</gls>
|
167 |
+
</children>
|
168 |
+
</config>
|
169 |
+
</children>
|
170 |
+
</system>
|
171 |
+
<gls translate="title" module="gls">
|
172 |
+
<title>GLS Import/Export</title>
|
173 |
+
<sort_order>200</sort_order>
|
174 |
+
<children>
|
175 |
+
<export translate="title">
|
176 |
+
<title>Export orders</title>
|
177 |
+
</export>
|
178 |
+
<import translate="title">
|
179 |
+
<title>Import tracking</title>
|
180 |
+
</import>
|
181 |
+
</children>
|
182 |
+
</gls>
|
183 |
+
</children>
|
184 |
+
</admin>
|
185 |
+
</resources>
|
186 |
+
</acl>
|
187 |
+
</adminhtml>
|
188 |
+
<default>
|
189 |
+
<gls>
|
190 |
+
<general>
|
191 |
+
<weight_unit>kg</weight_unit>
|
192 |
+
</general>
|
193 |
+
<bundle_product>
|
194 |
+
<process_children>0</process_children>
|
195 |
+
<load_item_options_on_parent>1</load_item_options_on_parent>
|
196 |
+
<load_item_data_on_parent>0</load_item_data_on_parent>
|
197 |
+
<load_product_data_on_parent>0</load_product_data_on_parent>
|
198 |
+
</bundle_product>
|
199 |
+
<configurable_product>
|
200 |
+
<load_item_options_on_parent>1</load_item_options_on_parent>
|
201 |
+
<load_item_data_on_parent>1</load_item_data_on_parent>
|
202 |
+
<load_product_data_on_parent>0</load_product_data_on_parent>
|
203 |
+
</configurable_product>
|
204 |
+
</gls>
|
205 |
+
<carriers>
|
206 |
+
<gls>
|
207 |
+
<title>GLS</title>
|
208 |
+
<active>0</active>
|
209 |
+
<livraisontohome>1</livraisontohome>
|
210 |
+
<configtohome><![CDATA[
|
211 |
+
{
|
212 |
+
"label": "Livraison à domicile",
|
213 |
+
"code": "tohome_fr",
|
214 |
+
"shipto": "FR",
|
215 |
+
"fees": "!{free_shipping}*{table {cart.price+tax+discount} in 150.00:5.00, 160.00:3.00, 100000.00:00.00}"
|
216 |
+
},
|
217 |
+
{
|
218 |
+
"label": "Livraison à domicile",
|
219 |
+
"code": "tohome_eu",
|
220 |
+
"shipto": "{address_filter.EU}",
|
221 |
+
"fees": "!{free_shipping}*{table {cart.price+tax+discount} in 150.00:5.00, 160.00:3.00, 100000.00:00.00}"
|
222 |
+
},
|
223 |
+
{
|
224 |
+
"label": "Livraison à domicile",
|
225 |
+
"code": "tohome_ue",
|
226 |
+
"shipto": "{address_filter.AF},{address_filter.AS},{address_filter.NA},{address_filter.SA},{address_filter.OC},{address_filter.AN},{address_filter.DOM},{address_filter.COM}",
|
227 |
+
"fees": "!{free_shipping}*{table {cart.price+tax+discount} in 150.00:5.00, 160.00:3.00, 100000.00:00.00}"
|
228 |
+
}]]></configtohome>
|
229 |
+
<ordertohome>1</ordertohome>
|
230 |
+
<livraisonrelay>1</livraisonrelay>
|
231 |
+
<configrelay><![CDATA[
|
232 |
+
{
|
233 |
+
"label": "Livraison en Point Relais",
|
234 |
+
"code": "relay_fr",
|
235 |
+
"shipto": "FR",
|
236 |
+
"fees": "!{free_shipping}*{table {cart.price+tax+discount} in 150.00:5.00, 160.00:3.00, 100000.00:00.00}"
|
237 |
+
}]]></configrelay>
|
238 |
+
<orderrelay>2</orderrelay>
|
239 |
+
<maxrelayweight>20</maxrelayweight>
|
240 |
+
<maxxlrelayweight>30</maxxlrelayweight>
|
241 |
+
<onlyxlrelay>0</onlyxlrelay>
|
242 |
+
<model>Addonline_Gls_Model_Carrier_ShippingMethod</model>
|
243 |
+
<tracking_view_url>https://gls-group.eu/EU/en/parcel-tracking?match={tracking_number}</tracking_view_url>
|
244 |
+
<export_folder>var/export/gls/</export_folder>
|
245 |
+
<import_folder>var/import/gls/</import_folder>
|
246 |
+
<debug>0</debug>
|
247 |
+
<auto_escaping>0</auto_escaping>
|
248 |
+
<auto_correction>1</auto_correction>
|
249 |
+
<stop_to_first_match>0</stop_to_first_match>
|
250 |
+
<sort_order>1</sort_order>
|
251 |
+
</gls>
|
252 |
+
</carriers>
|
253 |
+
</default>
|
254 |
+
</config>
|
app/code/community/Addonline/Gls/etc/system.xml
ADDED
@@ -0,0 +1,356 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2014 GLS
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* It is available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category Addonline
|
13 |
+
* @package Addonline_Gls
|
14 |
+
* @copyright Copyright (c) 2014 GLS
|
15 |
+
* @author Addonline (http://www.addonline.fr)
|
16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
+
**/
|
18 |
+
-->
|
19 |
+
<config>
|
20 |
+
<sections>
|
21 |
+
<carriers>
|
22 |
+
<groups>
|
23 |
+
<gls translate="label" module="gls">
|
24 |
+
<label>GLS</label>
|
25 |
+
<frontend_type>text</frontend_type>
|
26 |
+
<sort_order>18</sort_order>
|
27 |
+
<show_in_default>1</show_in_default>
|
28 |
+
<show_in_website>1</show_in_website>
|
29 |
+
<show_in_store>1</show_in_store>
|
30 |
+
<fields>
|
31 |
+
<informations translate="label">
|
32 |
+
<label>Informations</label>
|
33 |
+
<frontend_model>gls/adminhtml_system_config_form_field_informations</frontend_model>
|
34 |
+
<sort_order>0</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
</informations>
|
39 |
+
<title translate="label">
|
40 |
+
<label>Title</label>
|
41 |
+
<frontend_type>text</frontend_type>
|
42 |
+
<sort_order>0</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>1</show_in_store>
|
46 |
+
</title>
|
47 |
+
<active translate="label">
|
48 |
+
<label>Enabled</label>
|
49 |
+
<frontend_type>select</frontend_type>
|
50 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
51 |
+
<sort_order>1</sort_order>
|
52 |
+
<show_in_default>1</show_in_default>
|
53 |
+
<show_in_website>1</show_in_website>
|
54 |
+
<show_in_store>1</show_in_store>
|
55 |
+
</active>
|
56 |
+
<usernamews translate="label">
|
57 |
+
<label>GLS webservice Login</label>
|
58 |
+
<frontend_type>text</frontend_type>
|
59 |
+
<sort_order>2</sort_order>
|
60 |
+
<show_in_default>1</show_in_default>
|
61 |
+
<show_in_website>1</show_in_website>
|
62 |
+
<show_in_store>1</show_in_store>
|
63 |
+
</usernamews>
|
64 |
+
<passws translate="label">
|
65 |
+
<label>GLS Webservice password</label>
|
66 |
+
<frontend_type>text</frontend_type>
|
67 |
+
<sort_order>3</sort_order>
|
68 |
+
<show_in_default>1</show_in_default>
|
69 |
+
<show_in_website>1</show_in_website>
|
70 |
+
<show_in_store>1</show_in_store>
|
71 |
+
</passws>
|
72 |
+
<livraisontohome translate="label">
|
73 |
+
<label>Delivery at home</label>
|
74 |
+
<frontend_type>select</frontend_type>
|
75 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
76 |
+
<sort_order>4</sort_order>
|
77 |
+
<show_in_default>1</show_in_default>
|
78 |
+
<show_in_website>1</show_in_website>
|
79 |
+
<show_in_store>1</show_in_store>
|
80 |
+
</livraisontohome>
|
81 |
+
<configtohome translate="label">
|
82 |
+
<label>Delivery at home setup</label>
|
83 |
+
<frontend_model>gls/adminhtml_system_config_form_field_config</frontend_model>
|
84 |
+
<frontend_type>textarea</frontend_type>
|
85 |
+
<sort_order>5</sort_order>
|
86 |
+
<show_in_default>1</show_in_default>
|
87 |
+
<show_in_website>1</show_in_website>
|
88 |
+
<show_in_store>1</show_in_store>
|
89 |
+
<depends>
|
90 |
+
<livraisontohome>1</livraisontohome>
|
91 |
+
</depends>
|
92 |
+
</configtohome>
|
93 |
+
<ordertohome translate="label">
|
94 |
+
<label>Delivery at home order</label>
|
95 |
+
<frontend_type>text</frontend_type>
|
96 |
+
<sort_order>6</sort_order>
|
97 |
+
<show_in_default>1</show_in_default>
|
98 |
+
<show_in_website>1</show_in_website>
|
99 |
+
<show_in_store>1</show_in_store>
|
100 |
+
<depends>
|
101 |
+
<livraisontohome>1</livraisontohome>
|
102 |
+
</depends>
|
103 |
+
</ordertohome>
|
104 |
+
<livraisonrelay translate="label">
|
105 |
+
<label>Shop Delivery</label>
|
106 |
+
<frontend_type>select</frontend_type>
|
107 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
108 |
+
<sort_order>10</sort_order>
|
109 |
+
<show_in_default>1</show_in_default>
|
110 |
+
<show_in_website>1</show_in_website>
|
111 |
+
<show_in_store>1</show_in_store>
|
112 |
+
</livraisonrelay>
|
113 |
+
<configrelay translate="label">
|
114 |
+
<label>Shop Delivery setup</label>
|
115 |
+
<frontend_model>gls/adminhtml_system_config_form_field_config</frontend_model>
|
116 |
+
<frontend_type>textarea</frontend_type>
|
117 |
+
<sort_order>11</sort_order>
|
118 |
+
<show_in_default>1</show_in_default>
|
119 |
+
<show_in_website>1</show_in_website>
|
120 |
+
<show_in_store>1</show_in_store>
|
121 |
+
<depends>
|
122 |
+
<livraisonrelay>1</livraisonrelay>
|
123 |
+
</depends>
|
124 |
+
</configrelay>
|
125 |
+
<orderrelay translate="label">
|
126 |
+
<label>Shop Delivery order</label>
|
127 |
+
<frontend_type>text</frontend_type>
|
128 |
+
<sort_order>12</sort_order>
|
129 |
+
<show_in_default>1</show_in_default>
|
130 |
+
<show_in_website>1</show_in_website>
|
131 |
+
<show_in_store>1</show_in_store>
|
132 |
+
<depends>
|
133 |
+
<livraisonrelay>1</livraisonrelay>
|
134 |
+
</depends>
|
135 |
+
</orderrelay>
|
136 |
+
<!-- Ces données sont stockées mais ne sont pas éditables via le BO
|
137 |
+
<maxrelayweight translate="label"> <label>Maximum weight for articles in
|
138 |
+
standard relays</label> <frontend_type>text</frontend_type> <sort_order>13</sort_order>
|
139 |
+
<show_in_default>1</show_in_default> <show_in_website>1</show_in_website>
|
140 |
+
<show_in_store>1</show_in_store> </maxrelayweight> <maxxlrelayweight translate="label">
|
141 |
+
<label>Maximum weight for articles in XL relays</label> <frontend_type>text</frontend_type>
|
142 |
+
<sort_order>14</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website>
|
143 |
+
<show_in_store>1</show_in_store> </maxxlrelayweight> -->
|
144 |
+
<onlyxlrelay translate="label">
|
145 |
+
<label>Only XL shop search</label>
|
146 |
+
<frontend_type>select</frontend_type>
|
147 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
148 |
+
<sort_order>15</sort_order>
|
149 |
+
<show_in_default>1</show_in_default>
|
150 |
+
<show_in_website>1</show_in_website>
|
151 |
+
<show_in_store>1</show_in_store>
|
152 |
+
</onlyxlrelay>
|
153 |
+
<tracking_view_url translate="label">
|
154 |
+
<label>Tracking URL</label>
|
155 |
+
<frontend_type>text</frontend_type>
|
156 |
+
<sort_order>16</sort_order>
|
157 |
+
<show_in_default>1</show_in_default>
|
158 |
+
<show_in_website>1</show_in_website>
|
159 |
+
<show_in_store>1</show_in_store>
|
160 |
+
</tracking_view_url>
|
161 |
+
<importexport translate="label">
|
162 |
+
<label>Import/Export functionalities</label>
|
163 |
+
<frontend_type>select</frontend_type>
|
164 |
+
<comment>{importexport_help}</comment>
|
165 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
166 |
+
<sort_order>17</sort_order>
|
167 |
+
<show_in_default>1</show_in_default>
|
168 |
+
<show_in_website>1</show_in_website>
|
169 |
+
<show_in_store>1</show_in_store>
|
170 |
+
</importexport>
|
171 |
+
<export_folder translate="label">
|
172 |
+
<label>Export folder</label>
|
173 |
+
<frontend_type>text</frontend_type>
|
174 |
+
<sort_order>18</sort_order>
|
175 |
+
<show_in_default>1</show_in_default>
|
176 |
+
<show_in_website>1</show_in_website>
|
177 |
+
<show_in_store>1</show_in_store>
|
178 |
+
<depends>
|
179 |
+
<importexport>1</importexport>
|
180 |
+
</depends>
|
181 |
+
</export_folder>
|
182 |
+
<import_folder translate="label">
|
183 |
+
<label>Import folder</label>
|
184 |
+
<frontend_type>text</frontend_type>
|
185 |
+
<sort_order>19</sort_order>
|
186 |
+
<show_in_default>1</show_in_default>
|
187 |
+
<show_in_website>1</show_in_website>
|
188 |
+
<show_in_store>1</show_in_store>
|
189 |
+
<depends>
|
190 |
+
<importexport>1</importexport>
|
191 |
+
</depends>
|
192 |
+
</import_folder>
|
193 |
+
<debug translate="label comment">
|
194 |
+
<label>Debug</label>
|
195 |
+
<comment>{debug_help}</comment>
|
196 |
+
<frontend_type>select</frontend_type>
|
197 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
198 |
+
<sort_order>20</sort_order>
|
199 |
+
<show_in_default>1</show_in_default>
|
200 |
+
<show_in_website>1</show_in_website>
|
201 |
+
<show_in_store>1</show_in_store>
|
202 |
+
</debug>
|
203 |
+
<!-- Non visibles <compression translate="label"> <label>Compression</label>
|
204 |
+
<frontend_type>select</frontend_type> <source_model>adminhtml/system_config_source_yesno</source_model>
|
205 |
+
<comment>{compression_help}</comment> <sort_order>21</sort_order> <show_in_default>1</show_in_default>
|
206 |
+
<show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </compression>
|
207 |
+
<auto_escaping translate="label"> <label>Auto-escaping</label> <frontend_type>select</frontend_type>
|
208 |
+
<source_model>adminhtml/system_config_source_yesno</source_model> <comment>{auto_escaping_help}</comment>
|
209 |
+
<sort_order>22</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website>
|
210 |
+
<show_in_store>1</show_in_store> </auto_escaping> <auto_correction translate="label">
|
211 |
+
<label>Auto-correction</label> <frontend_type>select</frontend_type> <source_model>adminhtml/system_config_source_yesno</source_model>
|
212 |
+
<comment>{auto_correction_help}</comment> <sort_order>23</sort_order> <show_in_default>1</show_in_default>
|
213 |
+
<show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </auto_correction>
|
214 |
+
<stop_to_first_match translate="label"> <label>Stop to first match</label>
|
215 |
+
<frontend_type>select</frontend_type> <source_model>adminhtml/system_config_source_yesno</source_model>
|
216 |
+
<sort_order>24</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website>
|
217 |
+
<show_in_store>1</show_in_store> </stop_to_first_match> -->
|
218 |
+
<sort_order translate="label">
|
219 |
+
<label>GLS module order</label>
|
220 |
+
<frontend_type>text</frontend_type>
|
221 |
+
<sort_order>100</sort_order>
|
222 |
+
<show_in_default>1</show_in_default>
|
223 |
+
<show_in_website>1</show_in_website>
|
224 |
+
<show_in_store>1</show_in_store>
|
225 |
+
</sort_order>
|
226 |
+
</fields>
|
227 |
+
</gls>
|
228 |
+
</groups>
|
229 |
+
</carriers>
|
230 |
+
</sections>
|
231 |
+
<sections>
|
232 |
+
<gls translate="label">
|
233 |
+
<label>GLS Advanced Setup</label>
|
234 |
+
<tab>sales</tab>
|
235 |
+
<frontend_type>text</frontend_type>
|
236 |
+
<sort_order>330</sort_order>
|
237 |
+
<show_in_default>1</show_in_default>
|
238 |
+
<show_in_website>1</show_in_website>
|
239 |
+
<show_in_store>1</show_in_store>
|
240 |
+
<groups>
|
241 |
+
<general translate="label">
|
242 |
+
<label>General Configuration</label>
|
243 |
+
<frontend_type>text</frontend_type>
|
244 |
+
<sort_order>2</sort_order>
|
245 |
+
<show_in_default>1</show_in_default>
|
246 |
+
<show_in_website>1</show_in_website>
|
247 |
+
<show_in_store>1</show_in_store>
|
248 |
+
<fields>
|
249 |
+
<weight_unit translate="label">
|
250 |
+
<label>Weight unit</label>
|
251 |
+
<frontend_type>text</frontend_type>
|
252 |
+
<sort_order>1</sort_order>
|
253 |
+
<show_in_default>1</show_in_default>
|
254 |
+
<show_in_website>1</show_in_website>
|
255 |
+
<show_in_store>1</show_in_store>
|
256 |
+
</weight_unit>
|
257 |
+
</fields>
|
258 |
+
</general>
|
259 |
+
<bundle_product translate="label">
|
260 |
+
<label>Bundle Product Management</label>
|
261 |
+
<frontend_type>text</frontend_type>
|
262 |
+
<sort_order>10</sort_order>
|
263 |
+
<show_in_default>1</show_in_default>
|
264 |
+
<show_in_website>1</show_in_website>
|
265 |
+
<show_in_store>1</show_in_store>
|
266 |
+
<fields>
|
267 |
+
<process_children translate="label">
|
268 |
+
<label>Item processing</label>
|
269 |
+
<comment>If "Self" is selected, options bellow are ignored</comment>
|
270 |
+
<frontend_type>select</frontend_type>
|
271 |
+
<source_model>gls/system_config_source_ProcessChildren</source_model>
|
272 |
+
<sort_order>10</sort_order>
|
273 |
+
<show_in_default>1</show_in_default>
|
274 |
+
<show_in_website>1</show_in_website>
|
275 |
+
<show_in_store>1</show_in_store>
|
276 |
+
</process_children>
|
277 |
+
<load_item_options_on_parent
|
278 |
+
translate="label">
|
279 |
+
<label>Item options on</label>
|
280 |
+
<comment>item.option.*</comment>
|
281 |
+
<frontend_type>select</frontend_type>
|
282 |
+
<source_model>gls/system_config_source_LoadOnParent</source_model>
|
283 |
+
<sort_order>20</sort_order>
|
284 |
+
<show_in_default>1</show_in_default>
|
285 |
+
<show_in_website>1</show_in_website>
|
286 |
+
<show_in_store>1</show_in_store>
|
287 |
+
</load_item_options_on_parent>
|
288 |
+
<load_item_data_on_parent translate="label">
|
289 |
+
<label>Item data on</label>
|
290 |
+
<comment>item.*</comment>
|
291 |
+
<frontend_type>select</frontend_type>
|
292 |
+
<source_model>gls/system_config_source_LoadOnParent</source_model>
|
293 |
+
<sort_order>21</sort_order>
|
294 |
+
<show_in_default>1</show_in_default>
|
295 |
+
<show_in_website>1</show_in_website>
|
296 |
+
<show_in_store>1</show_in_store>
|
297 |
+
</load_item_data_on_parent>
|
298 |
+
<load_product_data_on_parent
|
299 |
+
translate="label">
|
300 |
+
<label>Product data on</label>
|
301 |
+
<comment>product.*</comment>
|
302 |
+
<frontend_type>select</frontend_type>
|
303 |
+
<source_model>gls/system_config_source_LoadOnParent</source_model>
|
304 |
+
<sort_order>22</sort_order>
|
305 |
+
<show_in_default>1</show_in_default>
|
306 |
+
<show_in_website>1</show_in_website>
|
307 |
+
<show_in_store>1</show_in_store>
|
308 |
+
</load_product_data_on_parent>
|
309 |
+
</fields>
|
310 |
+
</bundle_product>
|
311 |
+
<configurable_product translate="label">
|
312 |
+
<label>Configurable Product Management</label>
|
313 |
+
<frontend_type>text</frontend_type>
|
314 |
+
<sort_order>20</sort_order>
|
315 |
+
<show_in_default>1</show_in_default>
|
316 |
+
<show_in_website>1</show_in_website>
|
317 |
+
<show_in_store>1</show_in_store>
|
318 |
+
<fields>
|
319 |
+
<load_item_options_on_parent
|
320 |
+
translate="label">
|
321 |
+
<label>Item options on</label>
|
322 |
+
<comment>item.option.*</comment>
|
323 |
+
<frontend_type>select</frontend_type>
|
324 |
+
<source_model>gls/system_config_source_LoadOnParent</source_model>
|
325 |
+
<sort_order>20</sort_order>
|
326 |
+
<show_in_default>1</show_in_default>
|
327 |
+
<show_in_website>1</show_in_website>
|
328 |
+
<show_in_store>1</show_in_store>
|
329 |
+
</load_item_options_on_parent>
|
330 |
+
<load_item_data_on_parent translate="label">
|
331 |
+
<label>Item data on</label>
|
332 |
+
<comment>item.*</comment>
|
333 |
+
<frontend_type>select</frontend_type>
|
334 |
+
<source_model>gls/system_config_source_LoadOnParent</source_model>
|
335 |
+
<sort_order>21</sort_order>
|
336 |
+
<show_in_default>1</show_in_default>
|
337 |
+
<show_in_website>1</show_in_website>
|
338 |
+
<show_in_store>1</show_in_store>
|
339 |
+
</load_item_data_on_parent>
|
340 |
+
<load_product_data_on_parent
|
341 |
+
translate="label">
|
342 |
+
<label>Product data on</label>
|
343 |
+
<comment>product.*</comment>
|
344 |
+
<frontend_type>select</frontend_type>
|
345 |
+
<source_model>gls/system_config_source_LoadOnParent</source_model>
|
346 |
+
<sort_order>23</sort_order>
|
347 |
+
<show_in_default>1</show_in_default>
|
348 |
+
<show_in_website>1</show_in_website>
|
349 |
+
<show_in_store>1</show_in_store>
|
350 |
+
</load_product_data_on_parent>
|
351 |
+
</fields>
|
352 |
+
</configurable_product>
|
353 |
+
</groups>
|
354 |
+
</gls>
|
355 |
+
</sections>
|
356 |
+
</config>
|
app/code/community/Addonline/Gls/owebia_includes/OS2_AddressFilter.php
ADDED
@@ -0,0 +1,539 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2008-13 Owebia
|
4 |
+
*
|
5 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
6 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
7 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
8 |
+
*
|
9 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
10 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
11 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
12 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
13 |
+
* IN THE SOFTWARE.
|
14 |
+
*
|
15 |
+
* @website http://www.owebia.com/
|
16 |
+
* @project Magento Owebia Shipping 2 module
|
17 |
+
* @author Antoine Lemoine
|
18 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
19 |
+
**/
|
20 |
+
|
21 |
+
class Country
|
22 |
+
{
|
23 |
+
private static $LOADED = false;
|
24 |
+
private static $COUNTRIES = array(
|
25 |
+
'code2name' => array(
|
26 |
+
'AF' => 'Afghanistan',
|
27 |
+
'ZA' => 'Afrique du Sud',
|
28 |
+
'AX' => 'Åland',
|
29 |
+
'AL' => 'Albanie',
|
30 |
+
'DZ' => 'Algérie',
|
31 |
+
'DE' => 'Allemagne',
|
32 |
+
'AD' => 'Andorre',
|
33 |
+
'AO' => 'Angola',
|
34 |
+
'AI' => 'Anguilla',
|
35 |
+
'AQ' => 'Antarctique',
|
36 |
+
'AG' => 'Antigua-et-Barbuda',
|
37 |
+
'AN' => 'Antilles néerlandaises',
|
38 |
+
'SA' => 'Arabie saoudite',
|
39 |
+
'AR' => 'Argentine',
|
40 |
+
'AM' => 'Arménie',
|
41 |
+
'AW' => 'Aruba',
|
42 |
+
'AU' => 'Australie',
|
43 |
+
'AT' => 'Autriche',
|
44 |
+
'AZ' => 'Azerbaïdjan',
|
45 |
+
'BS' => 'Bahamas',
|
46 |
+
'BH' => 'Bahreïn',
|
47 |
+
'BD' => 'Bangladesh',
|
48 |
+
'BB' => 'Barbade',
|
49 |
+
'BY' => 'Biélorussie',
|
50 |
+
'BE' => 'Belgique',
|
51 |
+
'BZ' => 'Belize',
|
52 |
+
'BJ' => 'Bénin',
|
53 |
+
'BM' => 'Bermudes',
|
54 |
+
'BT' => 'Bhoutan',
|
55 |
+
'BO' => 'Bolivie',
|
56 |
+
'BA' => 'Bosnie-Herzégovine',
|
57 |
+
'BW' => 'Botswana',
|
58 |
+
'BV' => 'Île Bouvet',
|
59 |
+
'BR' => 'Brésil',
|
60 |
+
'BN' => 'Brunei',
|
61 |
+
'BG' => 'Bulgarie',
|
62 |
+
'BF' => 'Burkina Faso',
|
63 |
+
'BI' => 'Burundi',
|
64 |
+
'KY' => 'Îles Caïmans',
|
65 |
+
'KH' => 'Cambodge',
|
66 |
+
'CM' => 'Cameroun',
|
67 |
+
'CA' => 'Canada',
|
68 |
+
'CV' => 'Cap-Vert',
|
69 |
+
'CF' => 'République centrafricaine',
|
70 |
+
'CL' => 'Chili',
|
71 |
+
'CN' => 'Chine',
|
72 |
+
'CX' => 'Île Christmas',
|
73 |
+
'CY' => 'Chypre',
|
74 |
+
'CC' => 'Îles Cocos',
|
75 |
+
'CO' => 'Colombie',
|
76 |
+
'KM' => 'Comores',
|
77 |
+
'CG' => 'Congo',
|
78 |
+
'CD' => 'République démocratique du Congo',
|
79 |
+
'CK' => 'Îles Cook',
|
80 |
+
'KR' => 'Corée du Sud',
|
81 |
+
'KP' => 'Corée du Nord',
|
82 |
+
'CR' => 'Costa Rica',
|
83 |
+
'CI' => "Côte d'Ivoire",
|
84 |
+
'HR' => 'Croatie',
|
85 |
+
'CU' => 'Cuba',
|
86 |
+
'DK' => 'Danemark',
|
87 |
+
'DJ' => 'Djibouti',
|
88 |
+
'DO' => 'République dominicaine',
|
89 |
+
'DM' => 'Dominique',
|
90 |
+
'EG' => 'Égypte',
|
91 |
+
'SV' => 'Salvador',
|
92 |
+
'AE' => 'Émirats arabes unis',
|
93 |
+
'EC' => 'Équateur',
|
94 |
+
'ER' => 'Érythrée',
|
95 |
+
'ES' => 'Espagne',
|
96 |
+
'EE' => 'Estonie',
|
97 |
+
'US' => 'États-Unis',
|
98 |
+
'ET' => 'Éthiopie',
|
99 |
+
'FK' => 'Îles Malouines',
|
100 |
+
'FO' => 'Îles Féroé',
|
101 |
+
'FJ' => 'Fidji',
|
102 |
+
'FI' => 'Finlande',
|
103 |
+
'FR' => 'France',
|
104 |
+
'GA' => 'Gabon',
|
105 |
+
'GM' => 'Gambie',
|
106 |
+
'GE' => 'Géorgie',
|
107 |
+
'GS' => 'Géorgie du Sud-et-les Îles Sandwich du Sud',
|
108 |
+
'GH' => 'Ghana',
|
109 |
+
'GI' => 'Gibraltar',
|
110 |
+
'GR' => 'Grèce',
|
111 |
+
'GD' => 'Grenade',
|
112 |
+
'GL' => 'Groenland',
|
113 |
+
'GP' => 'Guadeloupe',
|
114 |
+
'GU' => 'Guam',
|
115 |
+
'GT' => 'Guatemala',
|
116 |
+
'GG' => 'Guernesey',
|
117 |
+
'GN' => 'Guinée',
|
118 |
+
'GW' => 'Guinée-Bissau',
|
119 |
+
'GQ' => 'Guinée équatoriale',
|
120 |
+
'GY' => 'Guyana',
|
121 |
+
'GF' => 'Guyane Française',
|
122 |
+
'HT' => 'Haïti',
|
123 |
+
'HM' => 'Îles Heard-et-MacDonald',
|
124 |
+
'HN' => 'Honduras',
|
125 |
+
'HK' => 'Hong Kong',
|
126 |
+
'HU' => 'Hongrie',
|
127 |
+
'IM' => 'Île de Man',
|
128 |
+
'UM' => 'Îles mineures éloignées des États-Unis',
|
129 |
+
'VG' => 'Îles Vierges britanniques',
|
130 |
+
'VI' => 'Îles Vierges américaines',
|
131 |
+
'IN' => 'Inde',
|
132 |
+
'ID' => 'Indonésie',
|
133 |
+
'IR' => 'Iran',
|
134 |
+
'IQ' => 'Irak',
|
135 |
+
'IE' => 'Irlande',
|
136 |
+
'IS' => 'Islande',
|
137 |
+
'IL' => 'Israël',
|
138 |
+
'IT' => 'Italie',
|
139 |
+
'JM' => 'Jamaïque',
|
140 |
+
'JP' => 'Japon',
|
141 |
+
'JE' => 'Jersey',
|
142 |
+
'JO' => 'Jordanie',
|
143 |
+
'KZ' => 'Kazakhstan',
|
144 |
+
'KE' => 'Kenya',
|
145 |
+
'KG' => 'Kirghizistan',
|
146 |
+
'KI' => 'Kiribati',
|
147 |
+
'KW' => 'Koweït',
|
148 |
+
'LA' => 'Laos',
|
149 |
+
'LS' => 'Lesotho',
|
150 |
+
'LV' => 'Lettonie',
|
151 |
+
'LB' => 'Liban',
|
152 |
+
'LR' => 'Libéria',
|
153 |
+
'LY' => 'Libye',
|
154 |
+
'LI' => 'Liechtenstein',
|
155 |
+
'LT' => 'Lituanie',
|
156 |
+
'LU' => 'Luxembourg',
|
157 |
+
'MO' => 'Macao',
|
158 |
+
'MK' => 'Macédoine',
|
159 |
+
'MG' => 'Madagascar',
|
160 |
+
'MY' => 'Malaisie',
|
161 |
+
'MW' => 'Malawi',
|
162 |
+
'MV' => 'Maldives',
|
163 |
+
'ML' => 'Mali',
|
164 |
+
'MT' => 'Malte',
|
165 |
+
'MP' => 'Îles Mariannes du Nord',
|
166 |
+
'MA' => 'Maroc',
|
167 |
+
'MH' => 'Îles Marshall',
|
168 |
+
'MQ' => 'Martinique',
|
169 |
+
'MU' => 'Île Maurice',
|
170 |
+
'MR' => 'Mauritanie',
|
171 |
+
'YT' => 'Mayotte',
|
172 |
+
'MX' => 'Mexique',
|
173 |
+
'FM' => 'Micronésie',
|
174 |
+
'MD' => 'Moldavie',
|
175 |
+
'MC' => 'Monaco',
|
176 |
+
'MN' => 'Mongolie',
|
177 |
+
'ME' => 'Monténégro',
|
178 |
+
'MS' => 'Montserrat',
|
179 |
+
'MZ' => 'Mozambique',
|
180 |
+
'MM' => 'Birmanie',
|
181 |
+
'NA' => 'Namibie',
|
182 |
+
'NR' => 'Nauru',
|
183 |
+
'NP' => 'Népal',
|
184 |
+
'NI' => 'Nicaragua',
|
185 |
+
'NE' => 'Niger',
|
186 |
+
'NG' => 'Nigéria',
|
187 |
+
'NU' => 'Niué',
|
188 |
+
'NF' => 'Île Norfolk',
|
189 |
+
'NO' => 'Norvège',
|
190 |
+
'NC' => 'Nouvelle-Calédonie',
|
191 |
+
'NZ' => 'Nouvelle-Zélande',
|
192 |
+
'IO' => "Territoire britannique de l'océan Indien",
|
193 |
+
'OM' => 'Oman',
|
194 |
+
'UG' => 'Ouganda',
|
195 |
+
'UZ' => 'Ouzbékistan',
|
196 |
+
'PK' => 'Pakistan',
|
197 |
+
'PW' => 'Palaos',
|
198 |
+
'PS' => 'Palestine',
|
199 |
+
'PA' => 'Panamá',
|
200 |
+
'PG' => 'Papouasie-Nouvelle-Guinée',
|
201 |
+
'PY' => 'Paraguay',
|
202 |
+
'NL' => 'Pays-Bas',
|
203 |
+
'PE' => 'Pérou',
|
204 |
+
'PH' => 'Philippines',
|
205 |
+
'PN' => 'Îles Pitcairn',
|
206 |
+
'PL' => 'Pologne',
|
207 |
+
'PF' => 'Polynésie Française',
|
208 |
+
'PR' => 'Porto Rico',
|
209 |
+
'PT' => 'Portugal',
|
210 |
+
'QA' => 'Qatar',
|
211 |
+
'RE' => 'La Réunion',
|
212 |
+
'RO' => 'Roumanie',
|
213 |
+
'GB' => 'Royaume-Uni',
|
214 |
+
'RU' => 'Russie',
|
215 |
+
'RW' => 'Rwanda',
|
216 |
+
'EH' => 'Sahara occidental',
|
217 |
+
'BL' => 'Saint-Barthélemy',
|
218 |
+
'KN' => 'Saint-Christophe-et-Niévès',
|
219 |
+
'SM' => 'Saint-Marin',
|
220 |
+
'MF' => 'Saint-Martin',
|
221 |
+
'PM' => 'Saint-Pierre-et-Miquelon',
|
222 |
+
'VA' => 'Vatican',
|
223 |
+
'VC' => 'Saint-Vincent-et-les Grenadines',
|
224 |
+
'SH' => 'Sainte-Hélène',
|
225 |
+
'LC' => 'Sainte-Lucie',
|
226 |
+
'SB' => 'Îles Salomon',
|
227 |
+
'WS' => 'Samoa',
|
228 |
+
'AS' => 'Samoa américaines',
|
229 |
+
'ST' => 'São Tomé-et-Principe',
|
230 |
+
'SN' => 'Sénégal',
|
231 |
+
'RS' => 'Serbie',
|
232 |
+
'SC' => 'Seychelles',
|
233 |
+
'SL' => 'Sierra Leone',
|
234 |
+
'SG' => 'Singapour',
|
235 |
+
'SK' => 'Slovaquie',
|
236 |
+
'SI' => 'Slovénie',
|
237 |
+
'SO' => 'Somalie',
|
238 |
+
'SD' => 'Soudan',
|
239 |
+
'LK' => 'Sri Lanka',
|
240 |
+
'SE' => 'Suède',
|
241 |
+
'CH' => 'Suisse',
|
242 |
+
'SR' => 'Suriname',
|
243 |
+
'SJ' => 'Svalbard et île Jan Mayen',
|
244 |
+
'SZ' => 'Swaziland',
|
245 |
+
'SY' => 'Syrie',
|
246 |
+
'TJ' => 'Tadjikistan',
|
247 |
+
'TW' => 'Taïwan',
|
248 |
+
'TZ' => 'Tanzanie',
|
249 |
+
'TD' => 'Tchad',
|
250 |
+
'CZ' => 'République tchèque',
|
251 |
+
'TF' => 'Terres Australes et Antarctiques Françaises',
|
252 |
+
'TH' => 'Thaïlande',
|
253 |
+
'TL' => 'Timor oriental',
|
254 |
+
'TG' => 'Togo',
|
255 |
+
'TK' => 'Tokelau',
|
256 |
+
'TO' => 'Tonga',
|
257 |
+
'TT' => 'Trinité-et-Tobago',
|
258 |
+
'TN' => 'Tunisie',
|
259 |
+
'TM' => 'Turkménistan',
|
260 |
+
'TC' => 'Îles Turques-et-Caïques',
|
261 |
+
'TR' => 'Turquie',
|
262 |
+
'TV' => 'Tuvalu',
|
263 |
+
'UA' => 'Ukraine',
|
264 |
+
'UY' => 'Uruguay',
|
265 |
+
'VU' => 'Vanuatu',
|
266 |
+
'VE' => 'Venezuela',
|
267 |
+
'VN' => 'Viêt Nam',
|
268 |
+
'WF' => 'Wallis-et-Futuna',
|
269 |
+
'YE' => 'Yémen',
|
270 |
+
'ZM' => 'Zambie',
|
271 |
+
'ZW' => 'Zimbabwe',
|
272 |
+
),
|
273 |
+
'code2soft-cleaned-name' => null,
|
274 |
+
'code2hard-cleaned-name' => null,
|
275 |
+
'replacement' => array(
|
276 |
+
'reunion' => 'RE',
|
277 |
+
'france-metropolitaine' => 'FR',
|
278 |
+
'guyane' => 'GF',
|
279 |
+
'taaf' => 'TF',
|
280 |
+
'terres-australes-francaises' => 'TF',
|
281 |
+
'usa' => 'US',
|
282 |
+
'hollande' => 'NL',
|
283 |
+
'grande-bretagne' => 'GB',
|
284 |
+
'vietnam' => 'VN',
|
285 |
+
'belarus' => 'BY',
|
286 |
+
'brunei-darussalam' => 'BN',
|
287 |
+
'cayman' => 'KY',
|
288 |
+
'caiman' => 'KY',
|
289 |
+
'caimanes' => 'KY',
|
290 |
+
'cocos-keeling' => 'CC',
|
291 |
+
'keeling' => 'CC',
|
292 |
+
'centrafrique' => 'CF',
|
293 |
+
'congo-brazzaville' => 'CG',
|
294 |
+
'congo-kinshasa' => 'CD',
|
295 |
+
'zaire' => 'CD',
|
296 |
+
'san-marin' => 'SM',
|
297 |
+
'surinam' => 'SR',
|
298 |
+
'myanmar' => 'MM',
|
299 |
+
'saint-christophe-nevis' => 'KN',
|
300 |
+
'saint-kitts-nevis' => 'KN',
|
301 |
+
'falkland' => 'FK',
|
302 |
+
'el-salvador' => 'SV',
|
303 |
+
'lithuanie' => 'LT',
|
304 |
+
'turks-caiques' => 'TC',
|
305 |
+
'vierges-des-etats-unis' => 'VI',
|
306 |
+
'etat-de-la-cite-du-vatican' => 'VA',
|
307 |
+
'etats-federes-de-micronesie' => 'FM',
|
308 |
+
'r-a-s-chinoise-de-hong-kong' => 'HK',
|
309 |
+
'r-a-s-chinoise-de-macao' => 'MO',
|
310 |
+
),
|
311 |
+
);
|
312 |
+
|
313 |
+
public static function loadCache() {
|
314 |
+
$filename = 'cache/countries';
|
315 |
+
if (!file_exists($filename)) {
|
316 |
+
self::$COUNTRIES['code2soft-cleaned-name'] = array();
|
317 |
+
self::$COUNTRIES['code2hard-cleaned-name'] = array();
|
318 |
+
foreach (self::$COUNTRIES['code2name'] as $_code => $_name) {
|
319 |
+
$soft_cleaned = self::softClean($_name);
|
320 |
+
self::$COUNTRIES['code2soft-cleaned-name'][$_code] = $soft_cleaned;
|
321 |
+
self::$COUNTRIES['code2hard-cleaned-name'][$_code] = self::hardClean($soft_cleaned);
|
322 |
+
}
|
323 |
+
file_put_contents('cache/countries',serialize(self::$COUNTRIES));
|
324 |
+
} else {
|
325 |
+
self::$COUNTRIES = unserialize(file_get_contents('cache/countries'));
|
326 |
+
}
|
327 |
+
}
|
328 |
+
|
329 |
+
public static function getCountryNameByCode($code) {
|
330 |
+
return isset(self::$COUNTRIES['code2name'][$code]) ? self::$COUNTRIES['code2name'][$code] : null;
|
331 |
+
}
|
332 |
+
|
333 |
+
public static function getCountryCodeByName($name, $name_type=null) {
|
334 |
+
$suffix = isset($name_type) ? $name_type.'-' : '';
|
335 |
+
if (!self::$LOADED) self::loadCache();
|
336 |
+
$code = array_search($name, self::$COUNTRIES['code2'.$suffix.'name']);
|
337 |
+
return $code!==false ? $code : null;
|
338 |
+
}
|
339 |
+
|
340 |
+
public static function getCountryCodeByReplacedName($cleaned_name) {
|
341 |
+
if (isset(self::$COUNTRIES['replacement'][$cleaned_name])) return self::$COUNTRIES['replacement'][$cleaned_name];
|
342 |
+
return null;
|
343 |
+
}
|
344 |
+
|
345 |
+
public static function softClean($input) {
|
346 |
+
$input = mb_strtolower($input,'UTF-8');
|
347 |
+
$input = preg_replace('/[ -\.]+/','-',trim($input));
|
348 |
+
//echo '"'.$input.'" => ';
|
349 |
+
$input = str_replace(
|
350 |
+
array(' ','ç','é','è','ê','ë','à','á','â','ä','ã','å','ô','ö','ù','û','ü','î','ï','ÿ'),
|
351 |
+
array('-','c','e','e','e','e','a','a','a','a','a','a','o','o','u','u','u','i','i','y'),
|
352 |
+
$input
|
353 |
+
);
|
354 |
+
//echo '"'.$input.'", ';
|
355 |
+
$input = preg_replace("/^st-/",'saint-',$input);
|
356 |
+
$input = preg_replace("/^ste-/",'sainte-',$input);
|
357 |
+
$input = preg_replace("/-&-/",'-et-',$input);
|
358 |
+
return $input;
|
359 |
+
}
|
360 |
+
|
361 |
+
public static function hardClean($input) {
|
362 |
+
//$output = preg_match('/ivoire/',$input);
|
363 |
+
//if ($output) echo '"'.$input.'" => ';
|
364 |
+
$input = preg_replace("/^(?:les|le|la|l'|ile|iles)-/",'',$input);
|
365 |
+
$input = preg_replace("/-(?:ile|iles)$/",'',$input);
|
366 |
+
$input = preg_replace("/-(?:(?:et|les)-)+/",'-',$input);
|
367 |
+
$input = preg_replace("/(?:[^a-z0-9]+)/",'-',$input);
|
368 |
+
//if ($output) echo '"'.$input.'",<br/>';
|
369 |
+
return $input;
|
370 |
+
}
|
371 |
+
|
372 |
+
}
|
373 |
+
|
374 |
+
class AddressFilter extends Country
|
375 |
+
{
|
376 |
+
private $data;
|
377 |
+
private $code;
|
378 |
+
private $name;
|
379 |
+
private $classes;
|
380 |
+
private $label;
|
381 |
+
private $arranged;
|
382 |
+
private $address_filters_list;
|
383 |
+
|
384 |
+
public function AddressFilter($data) {
|
385 |
+
$this->data = $data;
|
386 |
+
$this->classes = array();
|
387 |
+
$this->address_filters_list = null;
|
388 |
+
$this->parse();
|
389 |
+
}
|
390 |
+
|
391 |
+
public function parse($recursive=true) {
|
392 |
+
if (strlen($this->data['country_code'])==2) {
|
393 |
+
$code = strtoupper($this->data['country_code']);
|
394 |
+
$name = Country::getCountryNameByCode($code);
|
395 |
+
|
396 |
+
if (isset($name)) {
|
397 |
+
$this->code = $code;
|
398 |
+
$this->name = $name;
|
399 |
+
$this->classes[] = 'known';
|
400 |
+
}
|
401 |
+
}
|
402 |
+
if (!isset($this->name)) {
|
403 |
+
$code = Country::getCountryCodeByName($this->data['country_code']);
|
404 |
+
if (!isset($code)) {
|
405 |
+
$this->classes[] = 'soft-cleaned';
|
406 |
+
$cleaned_name = Country::softClean($this->data['country_code']);
|
407 |
+
$code = Country::getCountryCodeByName($cleaned_name,'soft-cleaned');
|
408 |
+
}
|
409 |
+
if (!isset($code)) {
|
410 |
+
$this->classes[] = 'replaced';
|
411 |
+
$code = Country::getCountryCodeByReplacedName($cleaned_name);
|
412 |
+
}
|
413 |
+
if (!isset($code)) {
|
414 |
+
$this->classes[] = 'hard-cleaned';
|
415 |
+
$cleaned_name = Country::hardClean($cleaned_name);
|
416 |
+
$code = Country::getCountryCodeByName($cleaned_name,'hard-cleaned');
|
417 |
+
}
|
418 |
+
if (!isset($code)) {
|
419 |
+
$this->classes[] = 'replaced';
|
420 |
+
$code = Country::getCountryCodeByReplacedName($cleaned_name);
|
421 |
+
}
|
422 |
+
if (isset($code)) {
|
423 |
+
$this->code = $code;
|
424 |
+
$this->name = Country::getCountryNameByCode($code);
|
425 |
+
$this->classes[] = 'known';
|
426 |
+
} else {
|
427 |
+
$this->classes[] = 'unknown';
|
428 |
+
}
|
429 |
+
}
|
430 |
+
|
431 |
+
if ($recursive && $this->hasClass('unknown')) {
|
432 |
+
if (!isset($cleaned_name)) $cleaned_name = Country::hardClean(Country::softClean($this->data['original']));
|
433 |
+
switch ($cleaned_name) {
|
434 |
+
case 'corse':
|
435 |
+
$this->data = array(
|
436 |
+
'exclusion' => false,
|
437 |
+
'country_code' => 'FR',
|
438 |
+
'region_codes' => '2A,2B',
|
439 |
+
'original' => $this->data['original'],
|
440 |
+
);
|
441 |
+
$this->classes = array('replaced');
|
442 |
+
$this->parse(false);
|
443 |
+
break;
|
444 |
+
case 'uk':
|
445 |
+
$this->data = array(
|
446 |
+
'exclusion' => false,
|
447 |
+
'country_code' => 'GB',
|
448 |
+
'region_codes' => '',
|
449 |
+
'original' => $this->data['original'],
|
450 |
+
);
|
451 |
+
$this->classes = array('replaced');
|
452 |
+
$this->parse(false);
|
453 |
+
break;
|
454 |
+
case 'union-europeenne':
|
455 |
+
case 'ue':
|
456 |
+
$this->createAddressFilterGroup(
|
457 |
+
array('DE','AT','BE','BG','CY','DK','ES','EE','FI','FR','GR','HU','IE','IT','LV','LT','LU','MT','NL','PL','PT','CZ','RO','GB','SK','SI','SE'),
|
458 |
+
$code = 'UE',
|
459 |
+
$name = 'Union européenne'
|
460 |
+
);
|
461 |
+
break;
|
462 |
+
case 'dom':
|
463 |
+
$this->createAddressFilterGroup(
|
464 |
+
array('GP','MQ','GF','RE'),
|
465 |
+
$code = 'DOM',
|
466 |
+
$name = "Département d'Outre-Mer"
|
467 |
+
);
|
468 |
+
break;
|
469 |
+
case 'com':
|
470 |
+
$this->createAddressFilterGroup(
|
471 |
+
array('PF','PM','WF','YT','MF','BL'),
|
472 |
+
$code = 'COM',
|
473 |
+
$name = "Collectivités d'Outre-Mer"
|
474 |
+
);
|
475 |
+
break;
|
476 |
+
case 'outre-mer':
|
477 |
+
$this->createAddressFilterGroup(
|
478 |
+
array('DOM','COM','NC','TF'),
|
479 |
+
$code = "Outre-Mer",
|
480 |
+
$name = "Outre-Mer"
|
481 |
+
);
|
482 |
+
break;
|
483 |
+
}
|
484 |
+
}
|
485 |
+
|
486 |
+
if ($this->hasClass('known')) {
|
487 |
+
if ($this->hasClass('replaced') || $this->hasClass('hard-cleaned')) $this->label = '<span class="bad">'.$this->data['original'].'</span> '.$this->name;
|
488 |
+
else $this->label = $this->name;
|
489 |
+
if (isset($this->data['region_codes']) && $this->data['region_codes']!='') {
|
490 |
+
$this->label .= ' ('.$this->data['region_codes'].')';
|
491 |
+
}
|
492 |
+
} else {
|
493 |
+
$this->label = $this->data['original'];
|
494 |
+
}
|
495 |
+
}
|
496 |
+
|
497 |
+
public function createAddressFilterGroup($countries, $code, $name) {
|
498 |
+
$this->address_filters_list = array();
|
499 |
+
foreach ($countries as $country_code) {
|
500 |
+
$this->address_filters_list[] = new AddressFilter(array('country_code' => $country_code, 'original' => $country_code));
|
501 |
+
}
|
502 |
+
$this->classes = array('known');
|
503 |
+
$this->code = $code;
|
504 |
+
$this->name = $name;
|
505 |
+
}
|
506 |
+
|
507 |
+
public function hasClass($class) {
|
508 |
+
return in_array($class,$this->classes);
|
509 |
+
}
|
510 |
+
|
511 |
+
public function __toString() {
|
512 |
+
$output = '';
|
513 |
+
if (isset($this->address_filters_list)) {
|
514 |
+
$compact_value = $this->code;
|
515 |
+
$full_value = $this->name;
|
516 |
+
$output .= '<span class="preview-item address-filter preview-item-group"'
|
517 |
+
.' full-value="'.$full_value.'" compact-value="'.$compact_value.'" original-value="'.$this->data['original'].'"><span class="preview-item-group-label">'.$this->label.'</span>';
|
518 |
+
foreach ($this->address_filters_list as $address_filter) {
|
519 |
+
$output .= $address_filter;
|
520 |
+
}
|
521 |
+
$output .= '</span>';
|
522 |
+
} else {
|
523 |
+
if (isset($this->code)) {
|
524 |
+
$compact_value = $this->code.(isset($this->data['region_codes']) && $this->data['region_codes']!='' ? '('.$this->data['region_codes'].')' : '');
|
525 |
+
$full_value = $this->name.(isset($this->data['region_codes']) && $this->data['region_codes']!='' ? ' ('.$this->data['region_codes'].')' : '');
|
526 |
+
} else {
|
527 |
+
$compact_value = $this->data['original'];
|
528 |
+
$full_value = $this->data['original'];
|
529 |
+
}
|
530 |
+
$output .= '<span class="preview-item address-filter country-'.$this->code.' '.implode(' ',$this->classes)
|
531 |
+
.'" country-code="'.$this->code.'" full-value="'.$full_value.'" compact-value="'.$compact_value.'" original-value="'.$this->data['original'].'">'
|
532 |
+
.$this->label.'</span>';
|
533 |
+
}
|
534 |
+
return $output;
|
535 |
+
}
|
536 |
+
}
|
537 |
+
|
538 |
+
|
539 |
+
?>
|
app/code/community/Addonline/Gls/owebia_includes/OS2_AddressFilterParser_GLS.php
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
|
22 |
+
class OS2_AddressFilterParser_GLS
|
23 |
+
{
|
24 |
+
protected $input = null;
|
25 |
+
protected $position = null;
|
26 |
+
protected $buffer_start = null;
|
27 |
+
|
28 |
+
protected $output = '';
|
29 |
+
protected $level = null;
|
30 |
+
protected $parent_level = null;
|
31 |
+
protected $regexp = false;
|
32 |
+
protected $case_insensitive = false;
|
33 |
+
|
34 |
+
public function parse($input) {
|
35 |
+
$this->current = array();
|
36 |
+
|
37 |
+
$this->input = $input;
|
38 |
+
$this->length = strlen($this->input);
|
39 |
+
// look at each character
|
40 |
+
$join = ' && ';
|
41 |
+
for ($this->position=0; $this->position < $this->length; $this->position++) {
|
42 |
+
switch ($this->input[$this->position]) {
|
43 |
+
case ')':
|
44 |
+
if ($this->regexp) break;
|
45 |
+
$this->push($this->buffer().')');
|
46 |
+
$this->parent_level = null;
|
47 |
+
break;
|
48 |
+
case ' ':
|
49 |
+
if ($this->regexp) break;
|
50 |
+
$this->push($this->buffer());
|
51 |
+
break;
|
52 |
+
case '-':
|
53 |
+
if ($this->regexp) break;
|
54 |
+
$this->push($this->buffer());
|
55 |
+
$join = ' && !';
|
56 |
+
break;
|
57 |
+
case ',':
|
58 |
+
if ($this->regexp) break;
|
59 |
+
$this->push($this->buffer());
|
60 |
+
$this->push(' || ');
|
61 |
+
break;
|
62 |
+
case '(':
|
63 |
+
if ($this->regexp) break;
|
64 |
+
$this->push($this->buffer());
|
65 |
+
$this->push($join, $only_if_not_empty = true);
|
66 |
+
$this->push('(');
|
67 |
+
$this->parent_level = $this->level;
|
68 |
+
$join = ' && ';
|
69 |
+
break;
|
70 |
+
case '/':
|
71 |
+
$this->regexp = !$this->regexp;
|
72 |
+
default:
|
73 |
+
if ($this->buffer_start === null) {
|
74 |
+
$this->buffer_start = $this->position;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
}
|
78 |
+
$this->push($this->buffer());
|
79 |
+
return $this->output;
|
80 |
+
}
|
81 |
+
|
82 |
+
protected function buffer() {
|
83 |
+
if ($this->buffer_start !== null) {
|
84 |
+
// extract string from buffer start to current position
|
85 |
+
$buffer = substr($this->input, $this->buffer_start, $this->position - $this->buffer_start);
|
86 |
+
// clean buffer
|
87 |
+
$this->buffer_start = null;
|
88 |
+
// throw token into current scope
|
89 |
+
|
90 |
+
if ($buffer=='*') {
|
91 |
+
$buffer = 1;
|
92 |
+
} else if ($this->parent_level=='country') {
|
93 |
+
if (preg_match('/^[A-Z]{2}$/', $buffer)) {
|
94 |
+
$buffer = "{{c}}==='{$buffer}'";
|
95 |
+
$this->level = 'country';
|
96 |
+
} else if (substr($buffer, 0, 1)=='/' && (substr($buffer, strlen($buffer)-1, 1)=='/' || substr($buffer, strlen($buffer)-2, 2)=='/i')) {
|
97 |
+
$case_insensitive = substr($buffer, strlen($buffer)-2, 2)=='/i';
|
98 |
+
$buffer = "preg_match('".str_replace("'", "\\'", $buffer)."', '{p}')";
|
99 |
+
} else if (strpos($buffer, '*')!==false) {
|
100 |
+
$buffer = "preg_match('/^".str_replace(array("'", '*'), array("\\'", '(?:.*)'), $buffer)."$/', '{p}')";
|
101 |
+
} else {
|
102 |
+
$buffer = "({{p}}==='{$buffer}' || {{r}}==='{$buffer}')";
|
103 |
+
}
|
104 |
+
} else if (preg_match('/^[A-Z]{2}$/', $buffer)) {
|
105 |
+
$buffer = "{{c}}==='{$buffer}'";
|
106 |
+
$this->level = 'country';
|
107 |
+
}
|
108 |
+
return $buffer;
|
109 |
+
}
|
110 |
+
return null;
|
111 |
+
}
|
112 |
+
|
113 |
+
protected function push($text, $only_if_not_empty = false) {
|
114 |
+
if (isset($text)) {
|
115 |
+
if (!$only_if_not_empty || $this->output) $this->output .= $text;
|
116 |
+
//echo "\"$this->output\"<br/>";
|
117 |
+
}
|
118 |
+
}
|
119 |
+
}
|
app/code/community/Addonline/Gls/owebia_includes/OS2_CustomerGroup.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2008-13 Owebia
|
4 |
+
*
|
5 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
6 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
7 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
8 |
+
*
|
9 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
10 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
11 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
12 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
13 |
+
* IN THE SOFTWARE.
|
14 |
+
*
|
15 |
+
* @website http://www.owebia.com/
|
16 |
+
* @project Magento Owebia Shipping 2 module
|
17 |
+
* @author Antoine Lemoine
|
18 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
19 |
+
**/
|
20 |
+
|
21 |
+
class CustomerGroup
|
22 |
+
{
|
23 |
+
private static $CUSTOMER_GROUP_COLLECTION;
|
24 |
+
|
25 |
+
private $input;
|
26 |
+
private $customer_group;
|
27 |
+
private $classes;
|
28 |
+
private $label;
|
29 |
+
|
30 |
+
public static function getCustomerGroups() {
|
31 |
+
if (isset(self::$CUSTOMER_GROUP_COLLECTION)) return self::$CUSTOMER_GROUP_COLLECTION;
|
32 |
+
else return self::$CUSTOMER_GROUP_COLLECTION = Mage::getResourceModel('customer/group_collection');
|
33 |
+
}
|
34 |
+
|
35 |
+
public function CustomerGroup($input) {
|
36 |
+
$this->input = $input;
|
37 |
+
$this->label = null;
|
38 |
+
$this->classes = array();
|
39 |
+
$this->customer_group = null;
|
40 |
+
$this->parse();
|
41 |
+
}
|
42 |
+
|
43 |
+
private function setCustomerGroup($customer_group) {
|
44 |
+
$this->customer_group = $customer_group;
|
45 |
+
$this->classes = array('known');
|
46 |
+
$this->label = $customer_group->getCode();
|
47 |
+
}
|
48 |
+
|
49 |
+
public function parse() {
|
50 |
+
$input = trim($this->input);
|
51 |
+
$customer_groups = self::getCustomerGroups();
|
52 |
+
if (ctype_digit($input)) {
|
53 |
+
$customer_id = (int)$input;
|
54 |
+
foreach ($customer_groups as $group) {
|
55 |
+
if ($group->getId()==$customer_id) {
|
56 |
+
$this->setCustomerGroup($group);
|
57 |
+
break;
|
58 |
+
}
|
59 |
+
}
|
60 |
+
}
|
61 |
+
if (!isset($this->customer_group)) {
|
62 |
+
$customer_code = $input;
|
63 |
+
foreach ($customer_groups as $group) {
|
64 |
+
if ($group->getCode()==$customer_code) {
|
65 |
+
$this->setCustomerGroup($group);
|
66 |
+
break;
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}
|
70 |
+
if (!isset($this->customer_group)) {
|
71 |
+
$this->classes = array('unknown');
|
72 |
+
$this->label = $this->input;
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
public function hasClass($class) {
|
77 |
+
return in_array($class,$this->classes);
|
78 |
+
}
|
79 |
+
|
80 |
+
public function __toString() {
|
81 |
+
$output = '';
|
82 |
+
if (isset($this->customer_group)) {
|
83 |
+
$compact_value = $this->customer_group->getId();
|
84 |
+
$full_value = $this->customer_group->getCode();
|
85 |
+
} else {
|
86 |
+
$compact_value = $this->input;
|
87 |
+
$full_value = $this->input;
|
88 |
+
}
|
89 |
+
$output .= '<span class="preview-item customer-group '.implode(' ',$this->classes)
|
90 |
+
.'" full-value="'.$full_value.'" compact-value="'.$compact_value.'" original-value="'.$this->input.'">'
|
91 |
+
.$this->label.'</span>';
|
92 |
+
return $output;
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
?>
|
app/code/community/Addonline/Gls/owebia_includes/OwebiaShippingHelper_GLS.php
ADDED
@@ -0,0 +1,1473 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2008-13 Owebia
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
7 |
+
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
8 |
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
9 |
+
*
|
10 |
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
11 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
12 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
13 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
14 |
+
* IN THE SOFTWARE.
|
15 |
+
*
|
16 |
+
* @website http://www.owebia.com/
|
17 |
+
* @project Magento Owebia Shipping 2 module
|
18 |
+
* @author Antoine Lemoine
|
19 |
+
* @license http://www.opensource.org/licenses/MIT The MIT License (MIT)
|
20 |
+
**/
|
21 |
+
|
22 |
+
// moved in app/code/community/Owebia/Shipping2/Model/Carrier/Abstract.php
|
23 |
+
//require_once dirname(__FILE__).'/OS2_AddressFilterParser.php';
|
24 |
+
|
25 |
+
class OwebiaShippingHelper_GLS
|
26 |
+
{
|
27 |
+
const FLOAT_REGEX = '[-]?\d+(?:[.]\d+)?';
|
28 |
+
const COUPLE_REGEX = '(?:[0-9.]+|\*) *(?:\[|\])? *\: *[0-9.]+';
|
29 |
+
|
30 |
+
public static $DEBUG_INDEX_COUNTER = 0;
|
31 |
+
public static $UNCOMPRESSED_STRINGS = array(
|
32 |
+
' product.attribute.',
|
33 |
+
' item.option.',
|
34 |
+
'{product.attribute.',
|
35 |
+
'{item.option.',
|
36 |
+
'{product.',
|
37 |
+
'{cart.',
|
38 |
+
'{selection.',
|
39 |
+
);
|
40 |
+
public static $COMPRESSED_STRINGS = array(
|
41 |
+
' p.a.',
|
42 |
+
' item.o.',
|
43 |
+
'{p.a.',
|
44 |
+
'{item.o.',
|
45 |
+
'{p.',
|
46 |
+
'{c.',
|
47 |
+
'{s.',
|
48 |
+
);
|
49 |
+
|
50 |
+
public static function esc($input)
|
51 |
+
{
|
52 |
+
$input = htmlspecialchars($input, ENT_NOQUOTES, 'UTF-8');
|
53 |
+
return preg_replace('/<(\/?)span([^&]*)>/', '<\1span\2>', $input);
|
54 |
+
}
|
55 |
+
|
56 |
+
public static function toString($value)
|
57 |
+
{
|
58 |
+
if (!isset($value)) return 'null';
|
59 |
+
else if (is_bool($value)) return $value ? 'true' : 'false';
|
60 |
+
else if (is_float($value)) return str_replace(',', '.', (string)$value); // To avoid locale problems
|
61 |
+
else if (is_array($value)) return 'array(size:'.count($value).')';
|
62 |
+
else if (is_object($value)) return get_class($value).'';
|
63 |
+
else return $value;
|
64 |
+
}
|
65 |
+
|
66 |
+
public static function parseSize($size)
|
67 |
+
{
|
68 |
+
$size = trim($size);
|
69 |
+
$last = strtolower($size[strlen($size)-1]);
|
70 |
+
switch ($last) {
|
71 |
+
case 'g': $size *= 1024;
|
72 |
+
case 'm': $size *= 1024;
|
73 |
+
case 'k': $size *= 1024;
|
74 |
+
}
|
75 |
+
return (float)$size;
|
76 |
+
}
|
77 |
+
|
78 |
+
public static function formatSize($size)
|
79 |
+
{
|
80 |
+
$unit = array('B', 'KB', 'MB', 'GB', 'TB', 'PB');
|
81 |
+
return self::toString(@round($size/pow(1024, ($i=floor(log($size, 1024)))), 2)).' '.$unit[$i];
|
82 |
+
}
|
83 |
+
|
84 |
+
public static function getInfos()
|
85 |
+
{
|
86 |
+
$properties = array(
|
87 |
+
'server_os' => PHP_OS,
|
88 |
+
'server_software' => $_SERVER['SERVER_SOFTWARE'],
|
89 |
+
'php_version' => PHP_VERSION,
|
90 |
+
'memory_limit' => self::formatSize(self::parseSize(ini_get('memory_limit'))),
|
91 |
+
'memory_usage' => self::formatSize(memory_get_usage(true)),
|
92 |
+
);
|
93 |
+
return $properties;
|
94 |
+
}
|
95 |
+
|
96 |
+
public static function getDefaultProcessData()
|
97 |
+
{
|
98 |
+
return array(
|
99 |
+
'info' => new OS2_Data_GLS(self::getInfos()),
|
100 |
+
'cart' => new OS2_Data_GLS(),
|
101 |
+
'quote' => new OS2_Data_GLS(),
|
102 |
+
'selection' => new OS2_Data_GLS(),
|
103 |
+
'customer' => new OS2_Data_GLS(),
|
104 |
+
'customer_group' => new OS2_Data_GLS(),
|
105 |
+
'customvar' => new OS2_Data_GLS(),
|
106 |
+
'date' => new OS2_Data_GLS(),
|
107 |
+
'origin' => new OS2_Data_GLS(),
|
108 |
+
'shipto' => new OS2_Data_GLS(),
|
109 |
+
'billto' => new OS2_Data_GLS(),
|
110 |
+
'store' => new OS2_Data_GLS(),
|
111 |
+
'request' => new OS2_Data_GLS(),
|
112 |
+
'address_filter' => new OS2_Data_GLS(),
|
113 |
+
);
|
114 |
+
}
|
115 |
+
|
116 |
+
public static function jsonEncode($data, $beautify = false, $html = false, $level = 0, $current_indent = '')
|
117 |
+
{
|
118 |
+
//$html = true;
|
119 |
+
$indent = "\t";//$html ? ' ' : "\t";//
|
120 |
+
$line_break = $html ? '<br/>' : "\n";
|
121 |
+
$new_indent = $current_indent.$indent;
|
122 |
+
switch ($type = gettype($data)) {
|
123 |
+
case 'NULL':
|
124 |
+
return ($html ? '<span class=json-reserved>' : '').'null'.($html ? '</span>' : '');
|
125 |
+
case 'boolean':
|
126 |
+
return ($html ? '<span class=json-reserved>' : '').($data ? 'true' : 'false').($html ? '</span>' : '');
|
127 |
+
case 'integer':
|
128 |
+
case 'double':
|
129 |
+
case 'float':
|
130 |
+
return ($html ? '<span class=json-numeric>' : '').$data.($html ? '</span>' : '');
|
131 |
+
case 'string':
|
132 |
+
return ($html ? '<span class=json-string>' : '').'"'.str_replace(array("\\", '"', "\n", "\r"), array("\\\\", '\"', "\\n", "\\r"), $html ? htmlspecialchars($data, ENT_COMPAT, 'UTF-8') : $data).'"'.($html ? '</span>' : '');
|
133 |
+
case 'object':
|
134 |
+
$data = (array)$data;
|
135 |
+
case 'array':
|
136 |
+
$output_index_count = 0;
|
137 |
+
$output = array();
|
138 |
+
foreach ($data as $key => $value) {
|
139 |
+
if ($output_index_count!==null && $output_index_count++!==$key) {
|
140 |
+
$output_index_count = null;
|
141 |
+
}
|
142 |
+
}
|
143 |
+
$is_associative = $output_index_count===null;
|
144 |
+
foreach ($data as $key => $value) {
|
145 |
+
if ($is_associative) {
|
146 |
+
$classes = array();
|
147 |
+
if ($key=='about') $classes[] = 'json-about';
|
148 |
+
if ($key=='conditions' || $key=='fees') $classes[] = 'json-formula';
|
149 |
+
$property_classes = array('json-property');
|
150 |
+
if ($level==0) $property_classes[] = 'json-id';
|
151 |
+
$output[] = ($html && $classes ? '<span class="'.implode(' ', $classes).'">' : '')
|
152 |
+
.($html ? '<span class="'.implode(' ', $property_classes).'">' : '')
|
153 |
+
.self::jsonEncode((string)$key)
|
154 |
+
.($html ? '</span>' : '').':'
|
155 |
+
.($beautify ? ' ' : '')
|
156 |
+
.self::jsonEncode($value, $beautify, $html, $level+1, $new_indent)
|
157 |
+
.($html && $classes ? '</span>' : '');
|
158 |
+
} else {
|
159 |
+
$output[] = self::jsonEncode($value, $beautify, $html, $level+1, $current_indent);
|
160 |
+
}
|
161 |
+
}
|
162 |
+
if ($is_associative) {
|
163 |
+
$classes = array();
|
164 |
+
if (isset($data['type']) && $data['type']=='meta') $classes[] = 'json-meta';
|
165 |
+
$output = ($html && $classes ? '<span class="'.implode(' ', $classes).'">' : '')
|
166 |
+
.'{'
|
167 |
+
.($beautify ? "{$line_break}{$new_indent}" : '')
|
168 |
+
.implode(','.($beautify ? "{$line_break}{$new_indent}" : ''), $output)
|
169 |
+
.($beautify ? "{$line_break}{$current_indent}" : '')
|
170 |
+
.'}'
|
171 |
+
.($html && $classes ? '</span>' : '');
|
172 |
+
//echo $output;
|
173 |
+
return $output;
|
174 |
+
} else {
|
175 |
+
return '['.implode(','.($beautify ? ' ' : ''), $output).']';
|
176 |
+
}
|
177 |
+
default:
|
178 |
+
return ''; // Not supported
|
179 |
+
}
|
180 |
+
}
|
181 |
+
|
182 |
+
protected static function json_decode($input)
|
183 |
+
{
|
184 |
+
if (function_exists('json_decode')) { // PHP >= 5.2.0
|
185 |
+
$output = json_decode($input);
|
186 |
+
if (function_exists('json_last_error')) { // PHP >= 5.3.0
|
187 |
+
$error = json_last_error();
|
188 |
+
if ($error!=JSON_ERROR_NONE) throw new Exception($error);
|
189 |
+
}
|
190 |
+
return $output;
|
191 |
+
} else {
|
192 |
+
return Zend_Json::decode($input);
|
193 |
+
}
|
194 |
+
}
|
195 |
+
|
196 |
+
protected static function json_encode($input)
|
197 |
+
{
|
198 |
+
if (function_exists('json_encode')) {
|
199 |
+
return json_encode($input);
|
200 |
+
} else {
|
201 |
+
return Zend_Json::encode($input);
|
202 |
+
}
|
203 |
+
}
|
204 |
+
|
205 |
+
protected $_input;
|
206 |
+
protected $_config = array();
|
207 |
+
protected $_messages = array();
|
208 |
+
protected $_formula_cache = array();
|
209 |
+
protected $_expression_cache = array();
|
210 |
+
public $debug_code = null;
|
211 |
+
public $debug_output = '';
|
212 |
+
public $debug_header = null;
|
213 |
+
protected $debug_prefix = '';
|
214 |
+
|
215 |
+
public function __construct($input, $auto_correction)
|
216 |
+
{
|
217 |
+
$this->_input = $input;
|
218 |
+
$this->_parseInput($auto_correction);
|
219 |
+
}
|
220 |
+
|
221 |
+
public function addDebugIndent()
|
222 |
+
{
|
223 |
+
$this->debug_prefix .= ' ';
|
224 |
+
}
|
225 |
+
|
226 |
+
public function removeDebugIndent()
|
227 |
+
{
|
228 |
+
$this->debug_prefix = substr($this->debug_prefix, 0, strlen($this->debug_prefix)-3);
|
229 |
+
}
|
230 |
+
|
231 |
+
public function debug($text)
|
232 |
+
{
|
233 |
+
$this->debug_output .= "<p>{$this->debug_prefix}{$text}</p>";
|
234 |
+
}
|
235 |
+
|
236 |
+
public function getDebug()
|
237 |
+
{
|
238 |
+
$index = $this->debug_code.'-'.self::$DEBUG_INDEX_COUNTER++;
|
239 |
+
$output = "<style rel=stylesheet type=\"text/css\">"
|
240 |
+
.".osh-debug{background:#000;color:#bbb;-webkit-opacity:0.9;-moz-opacity:0.9;opacity:0.9;text-align:left;white-space:pre-wrap;overflow:auto;}"
|
241 |
+
.".osh-debug p{margin:2px 0;}"
|
242 |
+
.".osh-formula{color:#f90;} .osh-key{color:#0099f7;} .osh-loop{color:#ff0;}"
|
243 |
+
.".osh-error{color:#f00;} .osh-warning{color:#ff0;} .osh-info{color:#7bf700;}"
|
244 |
+
.".osh-debug-content{padding:10px;font-family:monospace}"
|
245 |
+
.".osh-replacement{color:#ff3000;}"
|
246 |
+
."</style>"
|
247 |
+
."<div id=osh-debug-{$index} class=osh-debug><div class=osh-debug-content><span class=osh-close style=\"float:right;cursor:pointer;\" onclick=\"document.getElementById('osh-debug-{$index}').style.display = 'none';\">[<span style=\"padding:0 5px;color:#f00;\">X</span>]</span>"
|
248 |
+
."<p>{$this->debug_header}</p>{$this->debug_output}</div></div>";
|
249 |
+
return $output;
|
250 |
+
}
|
251 |
+
|
252 |
+
public function initDebug($code, $process)
|
253 |
+
{
|
254 |
+
$header = 'DEBUG OwebiaShippingHelper_GLS.php<br/>';
|
255 |
+
foreach ($process as $index => $process_option) {
|
256 |
+
if (in_array($index, array('data', 'options'))) {
|
257 |
+
$header .= ' <span class=osh-key>'.self::esc(str_replace('.', '</span>.<span class=osh-key>', $index)).'</span> >><br/>';
|
258 |
+
foreach ($process_option as $object_name => $data) {
|
259 |
+
if (is_object($data) || is_array($data)) {
|
260 |
+
$header .= ' <span class=osh-key>'.self::esc(str_replace('.', '</span>.<span class=osh-key>', $object_name)).'</span> >><br/>';
|
261 |
+
$children = array();
|
262 |
+
if (is_object($data)) $children = $data->__sleep();
|
263 |
+
else if (is_array($data)) $children = array_keys($data);
|
264 |
+
foreach ($children as $name) {
|
265 |
+
$key = $name;
|
266 |
+
if ($key=='*') {
|
267 |
+
$header .= ' .<span class=osh-key>'.self::esc(str_replace('.', '</span>.<span class=osh-key>', $key)).'</span> = …<br/>';
|
268 |
+
} else {
|
269 |
+
if (is_object($data)) $value = $data->{$name};
|
270 |
+
else if (is_array($data)) $children = $data[$name];
|
271 |
+
$header .= ' .<span class=osh-key>'.self::esc(str_replace('.', '</span>.<span class=osh-key>', $key)).'</span> = <span class=osh-formula>'.self::esc(self::toString($value)).'</span> ('.gettype($value).')<br/>';
|
272 |
+
}
|
273 |
+
}
|
274 |
+
} else {
|
275 |
+
$header .= ' .<span class=osh-key>'.self::esc(str_replace('.', '</span>.<span class=osh-key>', $object_name)).'</span> = <span class=osh-formula>'.self::esc(self::toString($data)).'</span> ('.gettype($data).')<br/>';
|
276 |
+
}
|
277 |
+
}
|
278 |
+
} else {
|
279 |
+
$header .= ' <span class=osh-key>'.self::esc(str_replace('.', '</span>.<span class=osh-key>', $index)).'</span> = <span class=osh-formula>'.self::esc(self::toString($process_option)).'</span> ('.gettype($process_option).')<br/>';
|
280 |
+
}
|
281 |
+
}
|
282 |
+
$this->debug_code = $code;
|
283 |
+
$this->debug_header = $header;
|
284 |
+
}
|
285 |
+
|
286 |
+
public function getConfig()
|
287 |
+
{
|
288 |
+
return $this->_config;
|
289 |
+
}
|
290 |
+
|
291 |
+
public function getConfigRow($id)
|
292 |
+
{
|
293 |
+
return isset($this->_config[$id]) ? $this->_config[$id] : null;
|
294 |
+
}
|
295 |
+
|
296 |
+
public function setConfig($config)
|
297 |
+
{
|
298 |
+
return $this->_config = $config;
|
299 |
+
}
|
300 |
+
|
301 |
+
public function getMessages()
|
302 |
+
{
|
303 |
+
$messages = $this->_messages;
|
304 |
+
$this->_messages = array();
|
305 |
+
return $messages;
|
306 |
+
}
|
307 |
+
|
308 |
+
public function sortProperties($k1, $k2)
|
309 |
+
{
|
310 |
+
$i1 = isset($this->properties_sort[$k1]) ? $this->properties_sort[$k1] : 1000;
|
311 |
+
$i2 = isset($this->properties_sort[$k2]) ? $this->properties_sort[$k2] : 1000;
|
312 |
+
return $i1==$i2 ? strcmp($k1, $k2) : $i1-$i2;
|
313 |
+
}
|
314 |
+
|
315 |
+
public function formatConfig($compress, $keys_to_remove=array(), $html = false)
|
316 |
+
{
|
317 |
+
$object_array = array();
|
318 |
+
$this->properties_sort = array_flip(array(
|
319 |
+
'type',
|
320 |
+
'about',
|
321 |
+
'enabled',
|
322 |
+
'label',
|
323 |
+
'description',
|
324 |
+
'shipto',
|
325 |
+
'billto',
|
326 |
+
'origin',
|
327 |
+
'conditions',
|
328 |
+
'fees',
|
329 |
+
'tracking_url',
|
330 |
+
));
|
331 |
+
foreach ($this->_config as $code => $row) {
|
332 |
+
$object = array();
|
333 |
+
foreach ($row as $key => $property) {
|
334 |
+
if (substr($key, 0, 1)!='*' && !in_array($key, $keys_to_remove)) {
|
335 |
+
$object[$key] = $property['value'];
|
336 |
+
}
|
337 |
+
}
|
338 |
+
uksort($object, array($this, 'sortProperties'));
|
339 |
+
$object_array[$code] = $object;
|
340 |
+
}
|
341 |
+
$output = self::jsonEncode($object_array, $beautify = !$compress, $html);
|
342 |
+
return $compress ? $this->compress($output) : $this->uncompress($output);
|
343 |
+
}
|
344 |
+
|
345 |
+
public function checkConfig()
|
346 |
+
{
|
347 |
+
$timestamp = time();
|
348 |
+
$process = array(
|
349 |
+
'config' => $this->_config,
|
350 |
+
'data' => self::getDefaultProcessData(),
|
351 |
+
'result' => null,
|
352 |
+
);
|
353 |
+
foreach ($this->_config as $code => &$row) {
|
354 |
+
$this->processRow($process, $row, $check_all_conditions=true);
|
355 |
+
foreach ($row as $property_name => $property_value) {
|
356 |
+
if (substr($property_name, 0, 1)!='*') {
|
357 |
+
$this->debug(' check '.$property_name);
|
358 |
+
$this->getRowProperty($row, $property_name);
|
359 |
+
}
|
360 |
+
}
|
361 |
+
}
|
362 |
+
}
|
363 |
+
|
364 |
+
public function processRow($process, &$row, $is_checking=false)
|
365 |
+
{
|
366 |
+
if (!isset($row['*id'])) {
|
367 |
+
$this->debug('skip row with unknown id');
|
368 |
+
return new OS_Result_GLS(false);
|
369 |
+
}
|
370 |
+
$this->debug('process row <span class=osh-key>'.self::esc($row['*id']).'</span>');
|
371 |
+
|
372 |
+
if (isset($row['about'])) { // Display on debug
|
373 |
+
$about = $this->getRowProperty($row, 'about');
|
374 |
+
}
|
375 |
+
|
376 |
+
$type = $this->getRowProperty($row, 'type');
|
377 |
+
if ($type=='data') {
|
378 |
+
foreach ($row as $key => $data) {
|
379 |
+
if (in_array($key, array('*id', 'code', 'type'))) continue;
|
380 |
+
$value = isset($data['value']) ? $data['value'] : $data;
|
381 |
+
$this->debug(' .<span class=osh-key>'.self::esc($key).'</span> = <span class=osh-formula>'.self::esc(self::toString($value)).'</span> ('.gettype($value).')');
|
382 |
+
}
|
383 |
+
return new OS_Result_GLS(false);
|
384 |
+
}
|
385 |
+
if (isset($type) && $type!='method') return new OS_Result_GLS(false);
|
386 |
+
|
387 |
+
if (!isset($row['label']['value'])) $row['label']['value'] = '***';
|
388 |
+
|
389 |
+
$enabled = $this->getRowProperty($row, 'enabled');
|
390 |
+
if (isset($enabled)) {
|
391 |
+
if (!$is_checking && !$enabled) {
|
392 |
+
$this->addMessage('info', $row, 'enabled', 'Configuration disabled');
|
393 |
+
return new OS_Result_GLS(false);
|
394 |
+
}
|
395 |
+
}
|
396 |
+
|
397 |
+
$conditions = $this->getRowProperty($row, 'conditions');
|
398 |
+
//ADDONLINE : on exclu la livraison GLS si un article dépasse le point max XL (30kg)
|
399 |
+
$code = $row['*id'];
|
400 |
+
$conditionGLS = '({count items where item.weight > '.Mage::getStoreConfig('carriers/gls/maxxlrelayweight').'} == 0)';
|
401 |
+
if (isset($conditions)) {
|
402 |
+
$conditions .= ' && '.$conditionGLS;
|
403 |
+
} else {
|
404 |
+
$conditions .= $conditionGLS;
|
405 |
+
}
|
406 |
+
//FIN ADDONLINE
|
407 |
+
if (isset($conditions)) {
|
408 |
+
$result = $this->processFormula($process, $row, 'conditions', $conditions, $is_checking);
|
409 |
+
if (!$is_checking) {
|
410 |
+
if (!$result->success) return $result;
|
411 |
+
if (!$result->result) {
|
412 |
+
$this->addMessage('info', $row, 'conditions', "The cart doesn't match conditions");
|
413 |
+
return new OS_Result_GLS(false);
|
414 |
+
}
|
415 |
+
}
|
416 |
+
}
|
417 |
+
|
418 |
+
$address_properties = array(
|
419 |
+
'shipto' => "Shipping zone not allowed",
|
420 |
+
'billto' => "Billing zone not allowed",
|
421 |
+
'origin' => "Shipping origin not allowed",
|
422 |
+
);
|
423 |
+
foreach ($address_properties as $property_name => $failure_message) {
|
424 |
+
$property_value = $this->getRowProperty($row, $property_name);
|
425 |
+
if (isset($property_value)) {
|
426 |
+
$match = $this->_addressMatch($process, $row, $property_name, $property_value, $process['data'][$property_name]);
|
427 |
+
if (!$is_checking && !$match) {
|
428 |
+
$this->addMessage('info', $row, $property_name, $failure_message);
|
429 |
+
return new OS_Result_GLS(false);
|
430 |
+
}
|
431 |
+
}
|
432 |
+
}
|
433 |
+
|
434 |
+
$customer_groups = $this->getRowProperty($row, 'customer_groups');
|
435 |
+
if (isset($customer_groups)) {
|
436 |
+
$groups = explode(',', $customer_groups);
|
437 |
+
$group_match = false;
|
438 |
+
$customer_group = $process['data']['customer_group'];
|
439 |
+
foreach ($groups as $group) {
|
440 |
+
$group = trim($group);
|
441 |
+
if ($group=='*' || $group==$customer_group->code || ctype_digit($group) && $group==$customer_group->id) {
|
442 |
+
$this->debug(' group <span class=osh-replacement>'.self::esc($customer_group->code).'</span> (id:<span class=osh-replacement>'.self::esc($customer_group->id).'</span>) matches');
|
443 |
+
$group_match = true;
|
444 |
+
break;
|
445 |
+
}
|
446 |
+
}
|
447 |
+
if (!$is_checking && !$group_match) {
|
448 |
+
$this->addMessage('info', $row, 'customer_groups', "Customer group not allowed (%s)", $customer_group->code);
|
449 |
+
return new OS_Result_GLS(false);
|
450 |
+
}
|
451 |
+
}
|
452 |
+
|
453 |
+
$fees = $this->getRowProperty($row, 'fees');
|
454 |
+
if (isset($fees)) {
|
455 |
+
$result = $this->processFormula($process, $row, 'fees', $fees, $is_checking);
|
456 |
+
if (!$result->success) return $result;
|
457 |
+
$this->debug(' » <span class=osh-info>result</span> = <span class=osh-formula>'.self::esc(self::toString($result->result)).'</span>');
|
458 |
+
return new OS_Result_GLS(true, (float)$result->result);
|
459 |
+
}
|
460 |
+
return new OS_Result_GLS(false);
|
461 |
+
}
|
462 |
+
|
463 |
+
public function getRowProperty(&$row, $key, $original_row=null, $original_key=null)
|
464 |
+
{
|
465 |
+
$property = null;
|
466 |
+
$output = null;
|
467 |
+
if (isset($original_row) && isset($original_key) && $original_row['*id']==$row['*id'] && $original_key==$key) {
|
468 |
+
$this->addMessage('error', $row, $key, 'Infinite loop %s', "<span class=\"code\">{{$row['*id']}.{$key}}</span>");
|
469 |
+
return array('error' => 'Infinite loop');
|
470 |
+
}
|
471 |
+
if (isset($row[$key]['value'])) {
|
472 |
+
$property = $row[$key]['value'];
|
473 |
+
if ($key == 'label' || $key == 'description' ) {
|
474 |
+
Mage::log('getRowProperty '.$property);
|
475 |
+
$property = Mage::helper('gls')->__($property);
|
476 |
+
}
|
477 |
+
$output = $property;
|
478 |
+
$this->debug(' get <span class=osh-key>'.self::esc($row['*id']).'</span>.<span class=osh-key>'.self::esc($key).'</span> = <span class=osh-formula>'.self::esc(self::toString($property)).'</span>');
|
479 |
+
preg_match_all('/{([a-z0-9_]+)\.([a-z0-9_]+)}/i', $output, $result_set, PREG_SET_ORDER);
|
480 |
+
foreach ($result_set as $result) {
|
481 |
+
list($original, $ref_code, $ref_key) = $result;
|
482 |
+
if ($ref_code==$row['*id'] && $ref_key==$key) {
|
483 |
+
$this->addMessage('error', $row, $key, 'Infinite loop %s', "<span class=\"code\">{$original}</span>");
|
484 |
+
return null;
|
485 |
+
}
|
486 |
+
if (isset($this->_config[$ref_code][$ref_key]['value'])) {
|
487 |
+
$replacement = $this->getRowProperty($this->_config[$ref_code], $ref_key,
|
488 |
+
isset($original_row) ? $original_row : $row, isset($original_key) ? $original_key : $key);
|
489 |
+
if (is_array($replacement) && isset($replacement['error'])) {
|
490 |
+
return isset($original_row) ? $replacement : 'false';
|
491 |
+
}
|
492 |
+
} else {
|
493 |
+
$replacement = $original;
|
494 |
+
}
|
495 |
+
$output = $this->replace('{'.$original.'}', $this->_autoescapeStrings($replacement), $output);
|
496 |
+
$output = $this->replace($original, $replacement, $output);
|
497 |
+
//$this->addMessage('error', $row, $key, $original.' => '.$replacement.' = '.$output);
|
498 |
+
}
|
499 |
+
} else {
|
500 |
+
$this->debug(' get <span class=osh-key>'.self::esc($row['*id']).'</span>.<span class=osh-key>'.self::esc($key).'</span> = <span class=osh-formula>null</span>');
|
501 |
+
}
|
502 |
+
return $output;
|
503 |
+
}
|
504 |
+
|
505 |
+
public function evalInput($process, $row, $property_name, $input)
|
506 |
+
{
|
507 |
+
$result = $this->_prepareFormula($process, $row, $property_name, $input, $is_checking=false, $use_cache=true);
|
508 |
+
return $result->success ? $result->result : $input;
|
509 |
+
}
|
510 |
+
|
511 |
+
public function compress($input)
|
512 |
+
{
|
513 |
+
$input = str_replace(
|
514 |
+
self::$UNCOMPRESSED_STRINGS,
|
515 |
+
self::$COMPRESSED_STRINGS,
|
516 |
+
$input
|
517 |
+
);
|
518 |
+
if (function_exists('gzcompress') && function_exists('base64_encode')) {
|
519 |
+
$input = 'gz64'.base64_encode(gzcompress($input));
|
520 |
+
}
|
521 |
+
return '$$'.$input;
|
522 |
+
}
|
523 |
+
|
524 |
+
public function uncompress($input)
|
525 |
+
{
|
526 |
+
if (substr($input, 0, 4)=='gz64' && function_exists('gzuncompress') && function_exists('base64_decode')) {
|
527 |
+
$input = gzuncompress(base64_decode(substr($input, 4, strlen($input))));
|
528 |
+
}
|
529 |
+
return str_replace(
|
530 |
+
self::$COMPRESSED_STRINGS,
|
531 |
+
self::$UNCOMPRESSED_STRINGS,
|
532 |
+
$input
|
533 |
+
);
|
534 |
+
}
|
535 |
+
|
536 |
+
public function parseProperty($input)
|
537 |
+
{
|
538 |
+
if ($input==='false') return false;
|
539 |
+
if ($input==='true') return true;
|
540 |
+
if ($input==='null') return null;
|
541 |
+
if (is_numeric($input)) return (double)$input;
|
542 |
+
$value = str_replace('\"', '"', preg_replace('/^(?:"|\')(.*)(?:"|\')$/s', '$1', $input));
|
543 |
+
return $value==='' ? null : $value;
|
544 |
+
}
|
545 |
+
|
546 |
+
protected function replace($from, $to, $input, $class_name=null, $message='replace')
|
547 |
+
{
|
548 |
+
if ($from===$to) return $input;
|
549 |
+
if (mb_strpos($input, $from)===false) return $input;
|
550 |
+
$to = self::toString($to);
|
551 |
+
$to = preg_replace('/[\r\n\t]+/', ' ', $to);
|
552 |
+
$this->debug(' '
|
553 |
+
.($class_name ? '<span class="osh-'.$class_name.'">' : '')
|
554 |
+
.$message.' <span class=osh-replacement>'.self::esc(self::toString($from)).'</span> by <span class=osh-replacement>'.self::esc($to).'</span>'
|
555 |
+
.' => <span class=osh-formula>'.self::esc(str_replace($from, '<span class=osh-replacement>'.$to.'</span>', $input)).'</span>'
|
556 |
+
.($class_name ? '</span>' : ''));
|
557 |
+
return str_replace($from, $to, $input);
|
558 |
+
}
|
559 |
+
|
560 |
+
protected function _min()
|
561 |
+
{
|
562 |
+
$args = func_get_args();
|
563 |
+
$min = null;
|
564 |
+
foreach ($args as $arg) {
|
565 |
+
if (isset($arg) && (!isset($min) || $min>$arg)) $min = $arg;
|
566 |
+
}
|
567 |
+
return $min;
|
568 |
+
}
|
569 |
+
|
570 |
+
protected function _max()
|
571 |
+
{
|
572 |
+
$args = func_get_args();
|
573 |
+
$max = null;
|
574 |
+
foreach ($args as $arg) {
|
575 |
+
if (isset($arg) && (!isset($max) || $max<$arg)) $max = $arg;
|
576 |
+
}
|
577 |
+
return $max;
|
578 |
+
}
|
579 |
+
|
580 |
+
protected function _range($value=-1, $min_value=0, $max_value=1, $include_min_value=true, $include_max_value=true)
|
581 |
+
{
|
582 |
+
return ($value>$min_value || $include_min_value && $value==$min_value) && ($value<$max_value || $include_max_value && $value==$max_value);
|
583 |
+
}
|
584 |
+
|
585 |
+
protected function _array_match_any()
|
586 |
+
{
|
587 |
+
$args = func_get_args();
|
588 |
+
$result = call_user_func_array('array_intersect', $args);
|
589 |
+
return (bool)$result;
|
590 |
+
}
|
591 |
+
|
592 |
+
protected function _array_match_all()
|
593 |
+
{
|
594 |
+
$args = func_get_args();
|
595 |
+
if (!isset($args[0])) return false;
|
596 |
+
$result = call_user_func_array('array_intersect', $args);
|
597 |
+
return count($result)==count($args[0]);
|
598 |
+
}
|
599 |
+
|
600 |
+
public function processFormula($process, &$row, $property_name, $formula_string, $is_checking, $use_cache=true)
|
601 |
+
{
|
602 |
+
$result = $this->_prepareFormula($process, $row, $property_name, $formula_string, $is_checking, $use_cache);
|
603 |
+
if (!$result->success) return $result;
|
604 |
+
|
605 |
+
$eval_result = $this->_evalFormula($result->result, $row, $property_name, $is_checking);
|
606 |
+
if (!$is_checking && !isset($eval_result)) {
|
607 |
+
$this->addMessage('error', $row, $property_name, 'Empty result');
|
608 |
+
$result = new OS_Result_GLS(false);
|
609 |
+
if ($use_cache) $this->_setCache($formula_string, $result);
|
610 |
+
return $result;
|
611 |
+
}
|
612 |
+
$result = new OS_Result_GLS(true, $eval_result);
|
613 |
+
if ($use_cache) $this->_setCache($formula_string, $result);
|
614 |
+
return $result;
|
615 |
+
}
|
616 |
+
|
617 |
+
protected function _setCache($expression, $value)
|
618 |
+
{
|
619 |
+
if ($value instanceof OS_Result_GLS) {
|
620 |
+
$this->_formula_cache[$expression] = $value;
|
621 |
+
$this->debug(' cache <span class=osh-replacement>'.self::esc($expression).'</span> = <span class=osh-formula>'.self::esc(self::toString($value->result)).'</span> ('.gettype($value->result).')');
|
622 |
+
} else {
|
623 |
+
$this->_expression_cache[$expression] = $value; //self::toString($value); // In order to make isset work
|
624 |
+
$this->debug(' cache <span class=osh-replacement>'.self::esc($expression).'</span> = <span class=osh-formula>'.self::esc(self::toString($value)).'</span> ('.gettype($value).')');
|
625 |
+
}
|
626 |
+
}
|
627 |
+
|
628 |
+
protected function _getCachedExpression($original)
|
629 |
+
{
|
630 |
+
$replacement = $this->_expression_cache[$original];
|
631 |
+
$this->debug(' get cached expression <span class=osh-replacement>'.self::esc($original).'</span> = <span class=osh-formula>'.self::esc(self::toString($replacement)).'</span> ('.gettype($replacement).')');
|
632 |
+
return $replacement;
|
633 |
+
}
|
634 |
+
|
635 |
+
protected function _prepare_regexp($regexp)
|
636 |
+
{
|
637 |
+
if (!isset($this->constants)) {
|
638 |
+
$reflector = new ReflectionClass(get_class($this));
|
639 |
+
$this->constants = $reflector->getConstants();
|
640 |
+
}
|
641 |
+
foreach ($this->constants as $name => $value) {
|
642 |
+
$regexp = str_replace('{'.$name.'}', $value, $regexp);
|
643 |
+
}
|
644 |
+
return $regexp;
|
645 |
+
}
|
646 |
+
|
647 |
+
protected function _preg_match($regexp, $input, &$result, $debug=false)
|
648 |
+
{
|
649 |
+
$regexp = $this->_prepare_regexp($regexp);
|
650 |
+
if ($debug) $this->debug(' preg_match <span class=osh-replacement>'.self::esc($regexp).'</span>');
|
651 |
+
return preg_match($regexp, $input, $result);
|
652 |
+
}
|
653 |
+
|
654 |
+
protected function _preg_match_all($regexp, $input, &$result, $debug=false)
|
655 |
+
{
|
656 |
+
$regexp = $this->_prepare_regexp($regexp);
|
657 |
+
if ($debug) $this->debug(' preg_match_all <span class=osh-replacement>'.self::esc($regexp).'</span>');
|
658 |
+
$return = preg_match_all($regexp, $input, $result, PREG_SET_ORDER);
|
659 |
+
}
|
660 |
+
|
661 |
+
protected function _loadValue($process, $object_name, $attribute)
|
662 |
+
{
|
663 |
+
switch ($object_name) {
|
664 |
+
case 'item': return isset($process['data']['cart']->items[0]) ? $process['data']['cart']->items[0]->{$attribute} : null;
|
665 |
+
case 'product': return isset($process['data']['cart']->items[0]) ? $process['data']['cart']->items[0]->getProduct()->{$attribute} : null;
|
666 |
+
default: return isset($process['data'][$object_name]) ? $process['data'][$object_name]->{$attribute} : null;
|
667 |
+
}
|
668 |
+
}
|
669 |
+
|
670 |
+
protected function _prepareFormula($process, $row, $property_name, $formula_string, $is_checking, $use_cache=true)
|
671 |
+
{
|
672 |
+
if ($use_cache && isset($this->_formula_cache[$formula_string])) {
|
673 |
+
$result = $this->_formula_cache[$formula_string];
|
674 |
+
$this->debug(' get cached formula <span class=osh-replacement>'.self::esc($formula_string).'</span> = <span class=osh-formula>'.self::esc(self::toString($result->result)).'</span>');
|
675 |
+
return $result;
|
676 |
+
}
|
677 |
+
|
678 |
+
$formula = $formula_string;
|
679 |
+
//$this->debug(' formula = <span class=osh-formula>'.self::esc($formula).'</span>');
|
680 |
+
|
681 |
+
// foreach
|
682 |
+
while ($this->_preg_match("#{foreach ((?:item|product|p)\.[a-z0-9_\+\-\.]+)}(.*){/foreach}#iU", $formula, $result)) { // ungreedy
|
683 |
+
$original = $result[0];
|
684 |
+
if ($use_cache && array_key_exists($original, $this->_expression_cache)) {
|
685 |
+
$replacement = $this->_getCachedExpression($original);
|
686 |
+
} else {
|
687 |
+
$replacement = 0;
|
688 |
+
$loop_var = $result[1];
|
689 |
+
$selections = array();
|
690 |
+
$this->debug(' foreach <span class=osh-key>'.self::esc($loop_var).'</span>');
|
691 |
+
$this->addDebugIndent();
|
692 |
+
$items = $process['data']['cart']->items;
|
693 |
+
if ($items) {
|
694 |
+
foreach ($items as $item) {
|
695 |
+
$tmp_value = $this->_getItemProperty($item, $loop_var);
|
696 |
+
$values = (array)$tmp_value;
|
697 |
+
foreach ($values as $value_i) {
|
698 |
+
$key = self::_autoEscapeStrings($value_i);
|
699 |
+
$sel = isset($selections[$key]) ? $selections[$key] : null;
|
700 |
+
$selections[$key]['items'][] = $item;
|
701 |
+
}
|
702 |
+
$this->debug(' items[<span class=osh-formula>'.self::esc((string)$item).'</span>].<span class=osh-key>'.self::esc($loop_var).'</span> = [<span class=osh-formula>'.self::esc(implode('</span>, <span class=osh-formula>', $values)).'</span>]');
|
703 |
+
}
|
704 |
+
}
|
705 |
+
$this->removeDebugIndent();
|
706 |
+
$this->debug(' <span class=osh-loop>start foreach</span>');
|
707 |
+
$this->addDebugIndent();
|
708 |
+
foreach ($selections as $key => $selection) {
|
709 |
+
$this->debug(' <span class=osh-loop>• value</span> = <span class=osh-formula>'.self::esc($key).'</span>');
|
710 |
+
$this->addDebugIndent();
|
711 |
+
$this->debug(' #### count '.count($process['data']['cart']->items));
|
712 |
+
$process2 = $process;
|
713 |
+
$process2['data']['cart'] = clone $process2['data']['cart']; // Important to not override previous items
|
714 |
+
$process2['data']['cart']->items = $selection['items'];
|
715 |
+
$selection['qty'] = 0;
|
716 |
+
$selection['weight'] = 0;
|
717 |
+
foreach ($selection['items'] as $item) {
|
718 |
+
$selection['qty'] += $item->qty;
|
719 |
+
$selection['weight'] += $item->weight;
|
720 |
+
}
|
721 |
+
if (isset($process2['data']['selection'])) {
|
722 |
+
$process2['data']['selection']->set('qty', $selection['qty']);
|
723 |
+
$process2['data']['selection']->set('weight', $selection['weight']);
|
724 |
+
}
|
725 |
+
$process_result = $this->processFormula($process2, $row, $property_name, $result[2], $is_checking, $tmp_use_cache=false);
|
726 |
+
$replacement += $process_result->result;
|
727 |
+
$this->debug(' » <span class=osh-info>foreach sum result</span> = <span class=osh-formula>'.self::esc(self::toString($replacement)).'</span>');
|
728 |
+
$this->removeDebugIndent();
|
729 |
+
}
|
730 |
+
$this->removeDebugIndent();
|
731 |
+
$this->debug(' <span class=osh-loop>end</span>');
|
732 |
+
if ($use_cache) $this->_setCache($original, $replacement);
|
733 |
+
}
|
734 |
+
$formula = $this->replace($original, $replacement, $formula);
|
735 |
+
}
|
736 |
+
|
737 |
+
if (isset($process['data']['selection'])) {
|
738 |
+
if ($process['data']['selection']->weight==null) $process['data']['selection']->set('weight', $process['data']['cart']->weight);
|
739 |
+
if ($process['data']['selection']->qty==null) $process['data']['selection']->set('qty', $process['data']['cart']->qty);
|
740 |
+
}
|
741 |
+
|
742 |
+
// data
|
743 |
+
$aliases = array(
|
744 |
+
'p' => 'product',
|
745 |
+
'c' => 'cart',
|
746 |
+
's' => 'selection',
|
747 |
+
);
|
748 |
+
$formula = $this->_replaceData($process, $formula, 'item|product|p|c|s', $aliases);
|
749 |
+
|
750 |
+
// count, sum, min, max
|
751 |
+
//while ($this->_preg_match("/{(count) products(?: where ([^}]+))?}/i", $formula, $result)
|
752 |
+
// || $this->_preg_match("/{(sum|min|max|count distinct) {PRODUCT_REGEX}\.({ATTRIBUTE_REGEX}|{OPTION_REGEX}|stock)\.([a-z0-9_+-]+)(?: where ([^}]+))?}/i", $formula, $result)
|
753 |
+
// || $this->_preg_match("/{(sum|min|max|count distinct) {PRODUCT_REGEX}\.(quantity)()(?: where ([^}]+))?}/i", $formula, $result)
|
754 |
+
while ($this->_preg_match("/{(count) items(?: where ([^}]+))?}/i", $formula, $result)
|
755 |
+
|| $this->_preg_match("/{(sum|min|max|count distinct) ((?:item|product|p)\.[a-z0-9_\+\-\.]+)(?: where ([^}]+))?}/i", $formula, $result)
|
756 |
+
) {
|
757 |
+
$original = $result[0];
|
758 |
+
if ($use_cache && array_key_exists($original, $this->_expression_cache)) {
|
759 |
+
$replacement = $this->_getCachedExpression($original);
|
760 |
+
} else {
|
761 |
+
$replacement = $this->_processProduct($process['data']['cart']->items, $result, $row, $property_name, $is_checking);
|
762 |
+
if ($use_cache) $this->_setCache($result[0], $replacement);
|
763 |
+
}
|
764 |
+
$formula = $this->replace($original, $replacement, $formula);
|
765 |
+
}
|
766 |
+
|
767 |
+
// switch
|
768 |
+
while (preg_match("/{switch ([^}]+) in ([^}]+)}/i", $formula, $result)) {
|
769 |
+
$original = $result[0];
|
770 |
+
if ($use_cache && array_key_exists($original, $this->_expression_cache)) {
|
771 |
+
$replacement = $this->_getCachedExpression($original);
|
772 |
+
} else {
|
773 |
+
$reference_value = $this->_evalFormula($result[1], $row, $property_name, $is_checking);
|
774 |
+
$fees_table_string = $result[2];
|
775 |
+
|
776 |
+
$couple_regex = '[^}:]+ *\: *[0-9.]+ *';
|
777 |
+
if (!preg_match('#^ *'.$couple_regex.'(?:, *'.$couple_regex.')*$#', $fees_table_string)) {
|
778 |
+
$this->addMessage('error', $row, $property_name, 'Error in switch %s', '<span class=osh-formula>'.self::esc($result[0]).'</span>');
|
779 |
+
$result = new OS_Result_GLS(false);
|
780 |
+
if ($use_cache) $this->_setCache($formula_string, $result);
|
781 |
+
return $result;
|
782 |
+
}
|
783 |
+
$fees_table = explode(',', $fees_table_string);
|
784 |
+
|
785 |
+
$replacement = null;
|
786 |
+
foreach ($fees_table as $item) {
|
787 |
+
$fee_data = explode(':', $item);
|
788 |
+
|
789 |
+
$fee = trim($fee_data[1]);
|
790 |
+
$value = trim($fee_data[0]);
|
791 |
+
$value = $value=='*' ? '*' : $this->_evalFormula($fee_data[0], $row, $property_name, $is_checking);
|
792 |
+
|
793 |
+
if ($value=='*' || $reference_value===$value) {
|
794 |
+
$replacement = $fee;
|
795 |
+
$this->debug(' compare <span class=osh-formula>'.self::esc($this->_autoescapeStrings($reference_value)).'</span> == <span class=osh-formula>'.self::esc($this->_autoescapeStrings($value)).'</span>');
|
796 |
+
break;
|
797 |
+
}
|
798 |
+
$this->debug(' compare <span class=osh-formula>'.self::esc($this->_autoescapeStrings($reference_value)).'</span> != <span class=osh-formula>'.self::esc($this->_autoescapeStrings($value)).'</span>');
|
799 |
+
}
|
800 |
+
//$replacement = self::toString($replacement);
|
801 |
+
if ($use_cache) $this->_setCache($original, $replacement);
|
802 |
+
}
|
803 |
+
$formula = $this->replace($original, $replacement, $formula);
|
804 |
+
}
|
805 |
+
|
806 |
+
// range table
|
807 |
+
while (preg_match("/{table ([^}]+) in ([0-9\.:,\*\[\] ]+)}/i", $formula, $result)) {
|
808 |
+
$original = $result[0];
|
809 |
+
if ($use_cache && array_key_exists($original, $this->_expression_cache)) {
|
810 |
+
$replacement = $this->_getCachedExpression($original);
|
811 |
+
} else {
|
812 |
+
$reference_value = $this->_evalFormula($result[1], $row, $property_name, $is_checking);
|
813 |
+
$replacement = null;
|
814 |
+
if (isset($reference_value)) {
|
815 |
+
$fees_table_string = $result[2];
|
816 |
+
|
817 |
+
if (!preg_match('#^'.self::COUPLE_REGEX.'(?:, *'.self::COUPLE_REGEX.')*$#', $fees_table_string)) {
|
818 |
+
$this->addMessage('error', $row, $property_name, 'Error in table %s', '<span class=osh-formula>'.self::esc($result[0]).'</span>');
|
819 |
+
$result = new OS_Result_GLS(false);
|
820 |
+
if ($use_cache) $this->_setCache($formula_string, $result);
|
821 |
+
return $result;
|
822 |
+
}
|
823 |
+
$fees_table = explode(',', $fees_table_string);
|
824 |
+
foreach ($fees_table as $item) {
|
825 |
+
$fee_data = explode(':', $item);
|
826 |
+
|
827 |
+
$fee = trim($fee_data[1]);
|
828 |
+
$max_value = trim($fee_data[0]);
|
829 |
+
|
830 |
+
$last_char = $max_value{strlen($max_value)-1};
|
831 |
+
if ($last_char=='[') $including_max_value = false;
|
832 |
+
else if ($last_char==']') $including_max_value = true;
|
833 |
+
else $including_max_value = true;
|
834 |
+
|
835 |
+
$max_value = str_replace(array('[', ']'), '', $max_value);
|
836 |
+
|
837 |
+
if ($max_value=='*' || $including_max_value && $reference_value<=$max_value || !$including_max_value && $reference_value<$max_value) {
|
838 |
+
$replacement = $fee;
|
839 |
+
break;
|
840 |
+
}
|
841 |
+
}
|
842 |
+
}
|
843 |
+
//$replacement = self::toString($replacement);
|
844 |
+
if ($use_cache) $this->_setCache($original, $replacement);
|
845 |
+
}
|
846 |
+
$formula = $this->replace($original, $replacement, $formula);
|
847 |
+
}
|
848 |
+
$result = new OS_Result_GLS(true, $formula);
|
849 |
+
return $result;
|
850 |
+
}
|
851 |
+
|
852 |
+
protected function _evalFormula($formula, &$row, $property_name=null, $is_checking=false)
|
853 |
+
{
|
854 |
+
if (is_bool($formula)) return $formula;
|
855 |
+
if (!preg_match('/^(?:'
|
856 |
+
.'(?:'
|
857 |
+
.'E|int|float|array|true|false|null|and|or|in'
|
858 |
+
.'|floor|ceil|round|rand|pow|pi|sqrt|log|exp|abs|substr|strtolower|preg_match|in_array'
|
859 |
+
.'|max|min|range|array_match_any|array_match_all'
|
860 |
+
.')'
|
861 |
+
.'|\'[^\']*\'|[0-9,\'\.\-\(\)\*\/\?\:\+\<\>\=\&\|%!]|\s)*$/', $formula)) {
|
862 |
+
$errors = array(
|
863 |
+
PREG_NO_ERROR => 'PREG_NO_ERROR',
|
864 |
+
PREG_INTERNAL_ERROR => 'PREG_INTERNAL_ERROR',
|
865 |
+
PREG_BACKTRACK_LIMIT_ERROR => 'PREG_BACKTRACK_LIMIT_ERROR',
|
866 |
+
PREG_RECURSION_LIMIT_ERROR => 'PREG_RECURSION_LIMIT_ERROR',
|
867 |
+
PREG_BAD_UTF8_ERROR => 'PREG_BAD_UTF8_ERROR',
|
868 |
+
defined('PREG_BAD_UTF8_OFFSET_ERROR') ? PREG_BAD_UTF8_OFFSET_ERROR : 'PREG_BAD_UTF8_OFFSET_ERROR' => 'PREG_BAD_UTF8_OFFSET_ERROR',
|
869 |
+
);
|
870 |
+
$error = preg_last_error();
|
871 |
+
if (isset($errors[$error])) $error = $errors[$error];
|
872 |
+
if ($is_checking) $this->addMessage('error', $row, $property_name, $error.' ('.$formula.')');
|
873 |
+
$this->debug(' eval <span class=osh-formula>'.self::esc($formula).'</span>');
|
874 |
+
$this->debug(' doesn\'t match ('.self::esc($error).')');
|
875 |
+
return null;
|
876 |
+
}
|
877 |
+
$formula = str_replace(
|
878 |
+
array('min', 'max', 'range', 'array_match_any', 'array_match_all'),
|
879 |
+
array('$this->_min', '$this->_max', '$this->_range', '$this->_array_match_any', '$this->_array_match_all'),
|
880 |
+
$formula
|
881 |
+
);
|
882 |
+
$eval_result = null;
|
883 |
+
//echo $formula.'<br/>';
|
884 |
+
@eval('$eval_result = ('.$formula.');');
|
885 |
+
$this->debug(' evaluate <span class=osh-formula>'.self::esc($formula).'</span> = <span class=osh-replacement>'.self::esc($this->_autoescapeStrings($eval_result)).'</span>');
|
886 |
+
return $eval_result;
|
887 |
+
}
|
888 |
+
|
889 |
+
protected function _parseInput($auto_correction)
|
890 |
+
{
|
891 |
+
$config_string = str_replace(
|
892 |
+
array('>', '<', '“', '”', utf8_encode(chr(147)), utf8_encode(chr(148)), '«', '»', "\r\n", "\t"),
|
893 |
+
array('>', '<', '"', '"', '"', '"', '"', '"', "\n", ' '),
|
894 |
+
$this->_input
|
895 |
+
);
|
896 |
+
|
897 |
+
if (substr($config_string, 0, 2)=='$$') $config_string = $this->uncompress(substr($config_string, 2, strlen($config_string)));
|
898 |
+
|
899 |
+
//echo ini_get('pcre.backtrack_limit');
|
900 |
+
//exit;
|
901 |
+
|
902 |
+
$this->debug('parse config (auto correction = '.self::esc(self::toString($auto_correction)).')');
|
903 |
+
$config = null;
|
904 |
+
$last_json_error = null;
|
905 |
+
try {
|
906 |
+
$config = self::json_decode($config_string);
|
907 |
+
} catch (Exception $e) {
|
908 |
+
$last_json_error = $e;
|
909 |
+
}
|
910 |
+
$auto_correction_warnings = array();
|
911 |
+
$missing_enquote_of_property_name = array();
|
912 |
+
if ($config) {
|
913 |
+
foreach ($config as $code => $object) {
|
914 |
+
if (!is_object($object)) {
|
915 |
+
$config = null;
|
916 |
+
break;
|
917 |
+
}
|
918 |
+
}
|
919 |
+
}
|
920 |
+
if ($auto_correction && !$config && $config_string!='[]') {
|
921 |
+
if (preg_match_all('/((?:#+[^{\\n]*\\s+)+)\\s*{/s', $config_string, $result, PREG_SET_ORDER)) {
|
922 |
+
$auto_correction_warnings[] = 'JSON: usage of incompatible comments';
|
923 |
+
foreach ($result as $set) {
|
924 |
+
$comment_lines = explode("\n", $set[1]);
|
925 |
+
foreach ($comment_lines as $i => $line) {
|
926 |
+
$comment_lines[$i] = preg_replace('/^#+\\s/', '', $line);
|
927 |
+
}
|
928 |
+
$comment = trim(implode("\n", $comment_lines));
|
929 |
+
$config_string = str_replace($set[0], '{"about": "'.str_replace('"', '\\"', $comment).'",', $config_string);
|
930 |
+
}
|
931 |
+
}
|
932 |
+
$property_regex = '\\s*(?<property_name>"?[a-z0-9_]+"?)\\s*:\\s*(?<property_value>"(?:(?:[^"]|\\\\")*[^\\\\])?"|'.self::FLOAT_REGEX.'|false|true|null)\\s*(?<property_separator>,)?\\s*(?:\\n)?';
|
933 |
+
$object_regex = '(?:(?<object_name>"?[a-z0-9_]+"?)\\s*:\\s*)?{\\s*('.$property_regex.')+\\s*}\\s*(?<object_separator>,)?\\s*';
|
934 |
+
preg_match_all('/('.$object_regex.')/is', $config_string, $object_set, PREG_SET_ORDER);
|
935 |
+
//print_r($object_set);
|
936 |
+
$json = array();
|
937 |
+
$objects_count = count($object_set);
|
938 |
+
$to_ignore_counter = -1;
|
939 |
+
foreach ($object_set as $i => $object) {
|
940 |
+
$pos = strpos($config_string, $object[0]);
|
941 |
+
$to_ignore = trim(substr($config_string, 0, $pos));
|
942 |
+
if ($to_ignore) {
|
943 |
+
$to_ignore_counter++;
|
944 |
+
if ($to_ignore_counter==0) {
|
945 |
+
$bracket_pos = strpos($to_ignore, '{');
|
946 |
+
if ($bracket_pos!==false) {
|
947 |
+
$to_ignore = explode('{', $to_ignore, 2);
|
948 |
+
}
|
949 |
+
}
|
950 |
+
$to_ignore = (array)$to_ignore;
|
951 |
+
foreach ($to_ignore as $to_ignore_i) {
|
952 |
+
$to_ignore_i = trim($to_ignore_i);
|
953 |
+
if (!$to_ignore_i) continue;
|
954 |
+
$auto_correction_warnings[] = 'JSON: ignored lines (<span class=osh-formula>'.self::toString($to_ignore_i).'</span>)';
|
955 |
+
$n = 0;
|
956 |
+
do {
|
957 |
+
$key = 'meta'.$n;
|
958 |
+
$n++;
|
959 |
+
} while(isset($json[$key]));
|
960 |
+
$json[$key] = array(
|
961 |
+
'type' => 'meta',
|
962 |
+
'ignored' => $to_ignore_i,
|
963 |
+
);
|
964 |
+
}
|
965 |
+
$config_string = substr($config_string, $pos, strlen($config_string));
|
966 |
+
}
|
967 |
+
$config_string = str_replace($object[0], '', $config_string);
|
968 |
+
$object_name = isset($object['object_name']) ? $object['object_name'] : null;
|
969 |
+
$object_separator = isset($object['object_separator']) ? $object['object_separator'] : null;
|
970 |
+
$is_last_object = ($i==$objects_count-1);
|
971 |
+
if (!$is_last_object && $object_separator!=',') {
|
972 |
+
$auto_correction_warnings[] = 'JSON: missing object separator (comma)';
|
973 |
+
} else if ($is_last_object && $object_separator==',') {
|
974 |
+
$auto_correction_warnings[] = 'JSON: no trailing object separator (comma) allowed';
|
975 |
+
}
|
976 |
+
$json_object = array();
|
977 |
+
preg_match_all('/'.$property_regex.'/i', $object[0], $property_set, PREG_SET_ORDER);
|
978 |
+
$properties_count = count($property_set);
|
979 |
+
foreach ($property_set as $j => $property) {
|
980 |
+
$name = $property['property_name'];
|
981 |
+
if ($name{0}!='"' || $name{strlen($name)-1}!='"') {
|
982 |
+
$auto_correction_warnings['missing_enquote_of_property_name'] = 'JSON: missing enquote of property name: %s';
|
983 |
+
$missing_enquote_of_property_name[] = self::toString(trim($name, '"'));
|
984 |
+
}
|
985 |
+
$property_separator = isset($property['property_separator']) ? $property['property_separator'] : null;
|
986 |
+
$is_last_property = ($j==$properties_count-1);
|
987 |
+
if (!$is_last_property && $property_separator!=',') {
|
988 |
+
$auto_correction_warnings[] = 'JSON: missing property separator (comma)';
|
989 |
+
} else if ($is_last_property && $property_separator==',') {
|
990 |
+
$auto_correction_warnings[] = 'JSON: no trailing property separator (comma) allowed';
|
991 |
+
}
|
992 |
+
$json_object[trim($name, '"')] = $this->parseProperty($property['property_value']);
|
993 |
+
}
|
994 |
+
if ($object_name) $json[trim($object_name, '"')] = $json_object;
|
995 |
+
else if (isset($json_object['code'])) {
|
996 |
+
$code = $json_object['code'];
|
997 |
+
unset($json_object['code']);
|
998 |
+
$json[$code] = $json_object;
|
999 |
+
} else $json[] = $json_object;
|
1000 |
+
}
|
1001 |
+
$to_ignore = trim($config_string);
|
1002 |
+
if ($to_ignore) {
|
1003 |
+
$bracket_pos = strpos($to_ignore, '}');
|
1004 |
+
if ($bracket_pos!==false) {
|
1005 |
+
$to_ignore = explode('}', $to_ignore, 2);
|
1006 |
+
}
|
1007 |
+
$to_ignore = (array)$to_ignore;
|
1008 |
+
foreach ($to_ignore as $to_ignore_i) {
|
1009 |
+
$to_ignore_i = trim($to_ignore_i);
|
1010 |
+
if (!$to_ignore_i) continue;
|
1011 |
+
$auto_correction_warnings[] = 'JSON: ignored lines (<span class=osh-formula>'.self::toString($to_ignore_i).'</span>)';
|
1012 |
+
$n = 0;
|
1013 |
+
do {
|
1014 |
+
$key = 'meta'.$n;
|
1015 |
+
$n++;
|
1016 |
+
} while(isset($json[$key]));
|
1017 |
+
$json[$key] = array(
|
1018 |
+
'type' => 'meta',
|
1019 |
+
'ignored' => $to_ignore_i,
|
1020 |
+
);
|
1021 |
+
}
|
1022 |
+
}
|
1023 |
+
$config_string = $this->jsonEncode($json);//'['.$config_string2.']';
|
1024 |
+
$config_string = str_replace(array("\n"), array("\\n"), $config_string);
|
1025 |
+
//echo $config_string;
|
1026 |
+
|
1027 |
+
$last_json_error = null;
|
1028 |
+
try {
|
1029 |
+
$config = self::json_decode($config_string);
|
1030 |
+
} catch (Exception $e) {
|
1031 |
+
$last_json_error = $e;
|
1032 |
+
}
|
1033 |
+
}
|
1034 |
+
if ($last_json_error) {
|
1035 |
+
$auto_correction_warnings[] = 'JSON: unable to parse config ('.$last_json_error->getMessage().')';
|
1036 |
+
}
|
1037 |
+
|
1038 |
+
$row = null;
|
1039 |
+
$auto_correction_warnings = array_unique($auto_correction_warnings);
|
1040 |
+
foreach ($auto_correction_warnings as $key => $warning) {
|
1041 |
+
if ($key=='missing_enquote_of_property_name') {
|
1042 |
+
$missing_enquote_of_property_name = array_unique($missing_enquote_of_property_name);
|
1043 |
+
$warning = str_replace('%s', '<span class=osh-key>'.self::esc(implode('</span>, <span class=osh-key>', $missing_enquote_of_property_name)).'</span>', $warning);
|
1044 |
+
}
|
1045 |
+
$this->addMessage('warning', $row, null, $warning);
|
1046 |
+
}
|
1047 |
+
$config = (array)$config;
|
1048 |
+
|
1049 |
+
$this->_config = array();
|
1050 |
+
$available_keys = array('type', 'about', 'label', 'enabled', 'description', 'fees', 'conditions', 'shipto', 'billto', 'origin', 'customer_groups', 'tracking_url');
|
1051 |
+
$reserved_keys = array('*id');
|
1052 |
+
if ($auto_correction) {
|
1053 |
+
$available_keys = array_merge($available_keys, array(
|
1054 |
+
'destination', 'code',
|
1055 |
+
));
|
1056 |
+
}
|
1057 |
+
|
1058 |
+
$deprecated_properties = array();
|
1059 |
+
$unknown_properties = array();
|
1060 |
+
|
1061 |
+
foreach ($config as $code => $object) {
|
1062 |
+
$object = (array)$object;
|
1063 |
+
if ($auto_correction) {
|
1064 |
+
if (isset($object['destination'])) {
|
1065 |
+
if (!in_array('destination', $deprecated_properties)) $deprecated_properties[] = 'destination';
|
1066 |
+
$object['shipto'] = $object['destination'];
|
1067 |
+
unset($object['destination']);
|
1068 |
+
}
|
1069 |
+
if (isset($object['code'])) {
|
1070 |
+
if (!in_array('code', $deprecated_properties)) $deprecated_properties[] = 'code';
|
1071 |
+
$code = $object['code'];
|
1072 |
+
unset($object['code']);
|
1073 |
+
}
|
1074 |
+
}
|
1075 |
+
|
1076 |
+
$row = array();
|
1077 |
+
$i = 1;
|
1078 |
+
foreach ($object as $property_name => $property_value) {
|
1079 |
+
if (in_array($property_name, $reserved_keys)) {
|
1080 |
+
continue;
|
1081 |
+
}
|
1082 |
+
if (in_array($property_name, $available_keys)
|
1083 |
+
|| substr($property_name, 0, 1)=='_'
|
1084 |
+
|| in_array($object['type'], array('data', 'meta'))) {
|
1085 |
+
if (isset($property_value)) {
|
1086 |
+
$row[$property_name] = array('value' => $property_value, 'original_value' => $property_value);
|
1087 |
+
if ($auto_correction) $this->cleanProperty($row, $property_name);
|
1088 |
+
}
|
1089 |
+
} else {
|
1090 |
+
if (!in_array($property_name, $unknown_properties)) $unknown_properties[] = $property_name;
|
1091 |
+
}
|
1092 |
+
$i++;
|
1093 |
+
}
|
1094 |
+
$this->addRow($code, $row);
|
1095 |
+
}
|
1096 |
+
$row = null;
|
1097 |
+
if (count($unknown_properties)>0) $this->addMessage('error', $row, null, 'Usage of unknown properties %s', ': <span class=osh-key>'.implode('</span>, <span class=osh-key>', $unknown_properties).'</span>');
|
1098 |
+
if (count($deprecated_properties)>0) $this->addMessage('warning', $row, null, 'Usage of deprecated properties %s', ': <span class=osh-key>'.implode('</span>, <span class=osh-key>', $deprecated_properties).'</span>');
|
1099 |
+
}
|
1100 |
+
|
1101 |
+
public function addRow($code, &$row)
|
1102 |
+
{
|
1103 |
+
if ($code) {
|
1104 |
+
if (isset($this->_config[$code])) $this->addMessage('error', $row, 'code', 'The id must be unique, `%s` has been found twice', $code);
|
1105 |
+
while (isset($this->_config[$code])) $code .= rand(0, 9);
|
1106 |
+
}
|
1107 |
+
$row['*id'] = $code;
|
1108 |
+
$this->_config[$code] = $row;
|
1109 |
+
}
|
1110 |
+
|
1111 |
+
public function addMessage($type, &$row, $property)
|
1112 |
+
{
|
1113 |
+
$args = func_get_args();
|
1114 |
+
array_shift($args);
|
1115 |
+
array_shift($args);
|
1116 |
+
array_shift($args);
|
1117 |
+
$message = new OS_Message_GLS($type, $args);
|
1118 |
+
if (isset($row)) {
|
1119 |
+
if (isset($property)) {
|
1120 |
+
$row[$property]['messages'][] = $message;
|
1121 |
+
} else {
|
1122 |
+
$row['*messages'][] = $message;
|
1123 |
+
}
|
1124 |
+
}
|
1125 |
+
$this->_messages[] = $message;
|
1126 |
+
$this->debug(' => <span class=osh-'.$message->type.'>'.self::esc((string)$message).'</span>');
|
1127 |
+
}
|
1128 |
+
|
1129 |
+
protected function _replaceVariable(&$process, $input, $original, $replacement)
|
1130 |
+
{
|
1131 |
+
if (mb_strpos($input, '{'.$original.'}')!==false) {
|
1132 |
+
$input = $this->replace('{'.$original.'}', $this->_autoEscapeStrings($replacement), $input);
|
1133 |
+
}
|
1134 |
+
if (mb_strpos($input, $original)!==false) {
|
1135 |
+
if (!isset($process['options']->auto_escaping) || $process['options']->auto_escaping) {
|
1136 |
+
$input = $this->replace($original, $this->_autoEscapeStrings($replacement), $input);
|
1137 |
+
} else {
|
1138 |
+
$input = $this->replace($original, $replacement, $input);
|
1139 |
+
}
|
1140 |
+
}
|
1141 |
+
return $input;
|
1142 |
+
}
|
1143 |
+
|
1144 |
+
protected function _replaceData(&$process, $input, $keys = '', $aliases = array())
|
1145 |
+
{
|
1146 |
+
$keys = ($keys ? $keys.'|' : '').implode('|', array_keys($process['data']));
|
1147 |
+
$keys = preg_replace('/[^a-z_\|]/', '_', $keys);
|
1148 |
+
// data
|
1149 |
+
while ($this->_preg_match("#{({$keys})\.([a-z0-9_\+\-\.]+)}#i", $input, $result)) {
|
1150 |
+
$original = $result[0];
|
1151 |
+
$object_name = isset($aliases[$result[1]]) ? $aliases[$result[1]] : $result[1];
|
1152 |
+
$replacement = $this->_loadValue($process, $object_name, $result[2]);
|
1153 |
+
$input = $this->_replaceVariable($process, $input, $original, $replacement);
|
1154 |
+
}
|
1155 |
+
return $input;
|
1156 |
+
}
|
1157 |
+
|
1158 |
+
protected function _addressMatch(&$process, &$row, $property_name, $address_filter, $address)
|
1159 |
+
{
|
1160 |
+
//$address_filter = '(* - ( europe (FR-(25,26),DE(40,42) ))';
|
1161 |
+
//echo '<pre>';
|
1162 |
+
$address_filter = $this->_replaceData($process, $address_filter);
|
1163 |
+
$parser = new OS2_AddressFilterParser_GLS();
|
1164 |
+
$address_filter = $parser->parse($address_filter);
|
1165 |
+
|
1166 |
+
$this->debug(' address filter = <span class=osh-formula>'.self::esc($address_filter).'</span>');
|
1167 |
+
$data = array(
|
1168 |
+
'{c}' => $address->country_id,
|
1169 |
+
'{p}' => $address->postcode,
|
1170 |
+
'{r}' => $address->region_code,
|
1171 |
+
);
|
1172 |
+
foreach ($data as $original => $replacement) {
|
1173 |
+
$address_filter = $this->_replaceVariable($process, $address_filter, $original, $replacement);
|
1174 |
+
}
|
1175 |
+
return (bool)$this->_evalFormula($address_filter, $row, $property_name, $is_checking=false);
|
1176 |
+
}
|
1177 |
+
|
1178 |
+
protected function _getItemProperty($item, $property_name)
|
1179 |
+
{
|
1180 |
+
$elems = explode('.', $property_name, $limit=2);
|
1181 |
+
switch ($elems[0]) {
|
1182 |
+
case 'p':
|
1183 |
+
case 'product': return $item->getProduct()->{$elems[1]};
|
1184 |
+
case 'item': return $item->{$elems[1]};
|
1185 |
+
}
|
1186 |
+
return null;
|
1187 |
+
}
|
1188 |
+
|
1189 |
+
protected function _autoEscapeStrings($input)
|
1190 |
+
{
|
1191 |
+
if (is_array($input)) {
|
1192 |
+
$items = array();
|
1193 |
+
foreach ($input as $v) {
|
1194 |
+
$items[] = isset($v) && (is_string($v) || empty($v)) ? "'{$v}'" : self::toString($v);
|
1195 |
+
}
|
1196 |
+
return 'array('.join(',', $items).')';
|
1197 |
+
} else {
|
1198 |
+
return isset($input) && (is_string($input)/* || empty($input)*/) ? "'{$input}'" : self::toString($input);
|
1199 |
+
}
|
1200 |
+
}
|
1201 |
+
|
1202 |
+
protected function _processProduct($items, $regex_result, &$row, $property_name, $is_checking)
|
1203 |
+
{
|
1204 |
+
// count, sum, min, max, count distinct
|
1205 |
+
$operation = strtolower($regex_result[1]);
|
1206 |
+
$return_value = null;
|
1207 |
+
$reference = 'items';
|
1208 |
+
switch ($operation) {
|
1209 |
+
case 'sum':
|
1210 |
+
case 'min':
|
1211 |
+
case 'max':
|
1212 |
+
case 'count distinct':
|
1213 |
+
$reference = $regex_result[2];
|
1214 |
+
$conditions = isset($regex_result[3]) ? $regex_result[3] : null;
|
1215 |
+
break;
|
1216 |
+
case 'count':
|
1217 |
+
$conditions = isset($regex_result[2]) ? $regex_result[2] : null;
|
1218 |
+
break;
|
1219 |
+
}
|
1220 |
+
switch ($operation) {
|
1221 |
+
case 'sum':
|
1222 |
+
case 'count distinct':
|
1223 |
+
case 'count':
|
1224 |
+
$return_value = 0;
|
1225 |
+
break;
|
1226 |
+
}
|
1227 |
+
|
1228 |
+
$this->debug(' <span class=osh-loop>start <span class=osh-replacement>'.self::esc($operation).'</span> '
|
1229 |
+
.'<span class=osh-key>'.self::esc($reference).'</span>'
|
1230 |
+
.(isset($conditions) ? ' where <span class=osh-replacement>'.self::esc($conditions).'</span></span>' : '')
|
1231 |
+
);
|
1232 |
+
$this->addDebugIndent();
|
1233 |
+
|
1234 |
+
$properties = array();
|
1235 |
+
$this->_preg_match_all('#(?:item|product|p)\.([a-z0-9_\+\-\.]+)#i', $conditions, $properties_regex_result);
|
1236 |
+
foreach ($properties_regex_result as $property_regex_result) {
|
1237 |
+
if (!isset($properties[$property_regex_result[0]])) $properties[$property_regex_result[0]] = $property_regex_result;
|
1238 |
+
}
|
1239 |
+
krsort($properties); // To avoid shorter replace
|
1240 |
+
|
1241 |
+
if ($items) {
|
1242 |
+
foreach ($items as $item) {
|
1243 |
+
$this->debug(' <span class=osh-loop>• item</span> = <span class=osh-formula>'.self::esc((string)$item).'</span>');
|
1244 |
+
$this->addDebugIndent();
|
1245 |
+
if (isset($conditions) && $conditions!='') {
|
1246 |
+
$formula = $conditions;
|
1247 |
+
foreach ($properties as $property) {
|
1248 |
+
$value = $this->_getItemProperty($item, $property[0]);
|
1249 |
+
$from = $property[0];
|
1250 |
+
$to = $this->_autoEscapeStrings($value);
|
1251 |
+
$this->debug(' replace <span class=osh-replacement>'.self::esc($from).'</span> by <span class=osh-replacement>'.self::esc($to).'</span> => <span class=osh-formula>'.self::esc(str_replace($from, '<span class=osh-replacement>'.$to.'</span>', $formula)).'</span>');
|
1252 |
+
$formula = str_replace($from, $to, $formula);
|
1253 |
+
}
|
1254 |
+
$eval_result = $this->_evalFormula($formula, $row, $property_name, $is_checking);
|
1255 |
+
if (!isset($eval_result)) $return_value = 'null';
|
1256 |
+
}
|
1257 |
+
else $eval_result = true;
|
1258 |
+
|
1259 |
+
if ($eval_result==true) {
|
1260 |
+
if ($operation=='count') {
|
1261 |
+
$return_value = (isset($return_value) ? $return_value : 0) + $item->qty;
|
1262 |
+
} else {
|
1263 |
+
$value = $this->_getItemProperty($item, $reference);
|
1264 |
+
$this->debug(' » <span class=osh-key>'.self::esc($reference).'</span> = <span class=osh-formula>'.self::esc($value).'</span>'
|
1265 |
+
.($operation=='sum' ? ' x <span class=osh-formula>'.$item->qty.'</span>' : ''));
|
1266 |
+
switch ($operation) {
|
1267 |
+
case 'min': if (!isset($return_value) || $value<$return_value) $return_value = $value; break;
|
1268 |
+
case 'max': if (!isset($return_value) || $value>$return_value) $return_value = $value; break;
|
1269 |
+
case 'sum':
|
1270 |
+
//$this->debug(self::esc($item->getProduct()->sku).'.'.self::esc($reference).' = "'.self::esc($value).'" x '.self::esc($item->qty));
|
1271 |
+
$return_value = (isset($return_value) ? $return_value : 0) + $value*$item->qty;
|
1272 |
+
break;
|
1273 |
+
case 'count distinct':
|
1274 |
+
if (!isset($return_value)) $return_value = 0;
|
1275 |
+
if (!isset($distinct_values)) $distinct_values = array();
|
1276 |
+
if (!in_array($value, $distinct_values)) {
|
1277 |
+
$distinct_values[] = $value;
|
1278 |
+
$return_value++;
|
1279 |
+
}
|
1280 |
+
break;
|
1281 |
+
}
|
1282 |
+
}
|
1283 |
+
}
|
1284 |
+
$this->debug(' » <span class=osh-info>'.self::esc($operation).' result</span> = <span class=osh-formula>'.self::esc($return_value).'</span>');
|
1285 |
+
$this->removeDebugIndent();
|
1286 |
+
}
|
1287 |
+
}
|
1288 |
+
|
1289 |
+
$this->removeDebugIndent();
|
1290 |
+
$this->debug(' <span class=osh-loop>end</span>');
|
1291 |
+
|
1292 |
+
return $return_value;
|
1293 |
+
}
|
1294 |
+
|
1295 |
+
/* For auto correction */
|
1296 |
+
public function cleanProperty(&$row, $key)
|
1297 |
+
{
|
1298 |
+
$input = $row[$key]['value'];
|
1299 |
+
if (is_string($input)) {
|
1300 |
+
while (preg_match('/{{customVar code=([a-zA-Z0-9_-]+)}}/', $input, $resi)) {
|
1301 |
+
$input = $this->replace($resi[0], '{customvar.'.$resi[1].'}', $input, 'warning', 'replace deprecated');
|
1302 |
+
}
|
1303 |
+
|
1304 |
+
$regex = "{(weight|products_quantity|price_including_tax|price_excluding_tax|country)}";
|
1305 |
+
if (preg_match('/'.$regex.'/', $input, $resi)) {
|
1306 |
+
$this->addMessage('warning', $row, $key, 'Usage of deprecated syntax %s', '<span class=osh-formula>'.$resi[0].'</span>');
|
1307 |
+
while (preg_match('/'.$regex.'/', $input, $resi)) {
|
1308 |
+
switch ($resi[1]) {
|
1309 |
+
case 'price_including_tax': $to = "{cart.price+tax+discount}"; break;
|
1310 |
+
case 'price_excluding_tax': $to = "{cart.price-tax+discount}"; break;
|
1311 |
+
case 'weight': $to = "{cart.{$resi[1]}}"; break;
|
1312 |
+
case 'products_quantity': $to = "{cart.qty}"; break;
|
1313 |
+
case 'country': $to = "{shipto.country_name}"; break;
|
1314 |
+
}
|
1315 |
+
$input = str_replace($resi[0], $to, $input);
|
1316 |
+
}
|
1317 |
+
}
|
1318 |
+
|
1319 |
+
$regex1 = "{copy '([a-zA-Z0-9_]+)'\.'([a-zA-Z0-9_]+)'}";
|
1320 |
+
if (preg_match('/'.$regex1.'/', $input, $resi)) {
|
1321 |
+
$this->addMessage('warning', $row, $key, 'Usage of deprecated syntax %s', '<span class=osh-formula>'.$resi[0].'</span>');
|
1322 |
+
while (preg_match('/'.$regex1.'/', $input, $resi)) $input = str_replace($resi[0], '{'.$resi[1].'.'.$resi[2].'}', $input);
|
1323 |
+
}
|
1324 |
+
|
1325 |
+
$regex1 = "{(count|all|any) (attribute|option) '([^'\)]+)' ?((?:==|<=|>=|<|>|!=) ?(?:".self::FLOAT_REGEX."|true|false|'[^'\)]*'))}";
|
1326 |
+
$regex2 = "{(sum) (attribute|option) '([^'\)]+)'}";
|
1327 |
+
if (preg_match('/'.$regex1.'/', $input, $resi) || preg_match('/'.$regex2.'/', $input, $resi)) {
|
1328 |
+
$this->addMessage('warning', $row, $key, 'Usage of deprecated syntax %s', '<span class=osh-formula>'.$resi[0].'</span>');
|
1329 |
+
while (preg_match('/'.$regex1.'/', $input, $resi) || preg_match('/'.$regex2.'/', $input, $resi)) {
|
1330 |
+
switch ($resi[1]) {
|
1331 |
+
case 'count': $to = "{count items where product.{$resi[2]}.{$resi[3]}{$resi[4]}}"; break;
|
1332 |
+
case 'all': $to = "{count items where product.{$resi[2]}.{$resi[3]}{$resi[4]}}=={cart.qty}"; break;
|
1333 |
+
case 'any': $to = "{count items where product.{$resi[2]}.{$resi[3]}{$resi[4]}}>0"; break;
|
1334 |
+
case 'sum': $to = "{sum product.{$resi[2]}.{$resi[3]}}"; break;
|
1335 |
+
}
|
1336 |
+
$input = str_replace($resi[0], $to, $input);
|
1337 |
+
}
|
1338 |
+
}
|
1339 |
+
|
1340 |
+
$regex = "((?:{| )product.(?:attribute|option))s.";
|
1341 |
+
if (preg_match('/'.$regex.'/', $input, $resi)) {
|
1342 |
+
$this->addMessage('warning', $row, $key, 'Usage of deprecated syntax %s', '<span class=osh-formula>'.$resi[0].'</span>');
|
1343 |
+
while (preg_match('/'.$regex.'/', $input, $resi)) {
|
1344 |
+
$input = str_replace($resi[0], $resi[1].'.', $input);
|
1345 |
+
}
|
1346 |
+
}
|
1347 |
+
|
1348 |
+
$regex = "{table '([^']+)' (".self::COUPLE_REGEX."(?:, *".self::COUPLE_REGEX.")*)}";
|
1349 |
+
if (preg_match('/'.$regex.'/', $input, $resi)) {
|
1350 |
+
$this->addMessage('warning', $row, $key, 'Usage of deprecated syntax %s', '<span class=osh-formula>'.$resi[0].'</span>');
|
1351 |
+
while (preg_match('/'.$regex.'/', $input, $resi)) {
|
1352 |
+
switch ($resi[1]) {
|
1353 |
+
case 'products_quantity':
|
1354 |
+
$input = str_replace($resi[0], "{table {cart.weight} in {$resi[2]}}*{cart.qty}", $input);
|
1355 |
+
break;
|
1356 |
+
default:
|
1357 |
+
$input = str_replace($resi[0], "{table {cart.{$resi[1]}} in {$resi[2]}}", $input);
|
1358 |
+
break;
|
1359 |
+
}
|
1360 |
+
}
|
1361 |
+
}
|
1362 |
+
|
1363 |
+
$aliases = array(
|
1364 |
+
'{destination.country.code}' => '{shipto.country_id}',
|
1365 |
+
'{destination.country.name}' => '{shipto.country_name}',
|
1366 |
+
'{destination.region.code}' => '{shipto.region_code}',
|
1367 |
+
'{destination.postcode}' => '{shipto.postcode}',
|
1368 |
+
'.destination}' => '.shipto}',
|
1369 |
+
'{cart.price_excluding_tax}' => '{cart.price-tax+discount}',
|
1370 |
+
'{cart.price_including_tax}' => '{cart.price+tax+discount}',
|
1371 |
+
'{cart.weight.unit}' => '{cart.weight_unit}',
|
1372 |
+
'{cart.coupon}' => '{cart.coupon_code}',
|
1373 |
+
'{cart.weight.for-charge}' => '{cart.weight_for_charge}',
|
1374 |
+
'{c.price_excluding_tax}' => '{c.price-tax+discount}',
|
1375 |
+
'{c.price_including_tax}' => '{c.price+tax+discount}',
|
1376 |
+
'{c.weight.unit}' => '{c.weight_unit}',
|
1377 |
+
'{c.coupon}' => '{c.coupon_code}',
|
1378 |
+
'{free_shipping}' => '{cart.free_shipping}',
|
1379 |
+
'{c.weight.for-charge}' => '{c.weight_for_charge}',
|
1380 |
+
'{customer.group.id}' => '{customer_group.id}',
|
1381 |
+
'{customer.group.code}' => '{customer_group.code}',
|
1382 |
+
'{origin.country.code}' => '{origin.country_id}',
|
1383 |
+
'{origin.country.name}' => '{origin.country_name}',
|
1384 |
+
'{origin.region.code}' => '{origin.region_id}',
|
1385 |
+
'{selection.quantity}' => '{selection.qty}',
|
1386 |
+
'product.quantity' => 'item.qty',
|
1387 |
+
'product.stock.quantity' => 'product.stock.qty',
|
1388 |
+
'product.options.' => 'item.option.',
|
1389 |
+
'product.option.' => 'item.option.',
|
1390 |
+
'product.o.' => 'item.o.',
|
1391 |
+
'p.quantity' => 'item.qty',
|
1392 |
+
'p.stock.quantity' => 'p.stock.qty',
|
1393 |
+
'p.options.' => 'item.option.',
|
1394 |
+
'p.option.' => 'item.option.',
|
1395 |
+
'p.o.' => 'item.o.',
|
1396 |
+
'count products ' => 'count items ',
|
1397 |
+
'product.attribute.price+tax+discount' => 'item.price+tax+discount',
|
1398 |
+
'product.attribute.price+tax-discount' => 'item.price+tax-discount',
|
1399 |
+
'product.attribute.price-tax+discount' => 'item.price-tax+discount',
|
1400 |
+
'product.attribute.price-tax-discount' => 'item.price-tax-discount',
|
1401 |
+
);
|
1402 |
+
foreach ($aliases as $from => $to) {
|
1403 |
+
if (mb_strpos($input, $from)!==false) {
|
1404 |
+
$input = $this->replace($from, $to, $input, 'warning', 'replace deprecated');
|
1405 |
+
}
|
1406 |
+
}
|
1407 |
+
}
|
1408 |
+
$row[$key]['value'] = $input;
|
1409 |
+
}
|
1410 |
+
|
1411 |
+
}
|
1412 |
+
|
1413 |
+
class OS2_Data_GLS
|
1414 |
+
{
|
1415 |
+
protected $_data;
|
1416 |
+
|
1417 |
+
public function __construct($data=null)
|
1418 |
+
{
|
1419 |
+
$this->_data = (array)$data;
|
1420 |
+
}
|
1421 |
+
|
1422 |
+
public function __sleep()
|
1423 |
+
{
|
1424 |
+
return array_keys($this->_data);
|
1425 |
+
}
|
1426 |
+
|
1427 |
+
public function __get($name)
|
1428 |
+
{
|
1429 |
+
return isset($this->_data[$name]) ? $this->_data[$name] : null;
|
1430 |
+
}
|
1431 |
+
|
1432 |
+
public function set($name, $value)
|
1433 |
+
{
|
1434 |
+
$this->_data[$name] = $value;
|
1435 |
+
}
|
1436 |
+
}
|
1437 |
+
|
1438 |
+
class OS_Message_GLS
|
1439 |
+
{
|
1440 |
+
public $type;
|
1441 |
+
public $message;
|
1442 |
+
public $args;
|
1443 |
+
|
1444 |
+
public function __construct($type, $args)
|
1445 |
+
{
|
1446 |
+
$this->type = $type;
|
1447 |
+
$this->message = array_shift($args);
|
1448 |
+
$this->args = $args;
|
1449 |
+
}
|
1450 |
+
|
1451 |
+
public function __toString()
|
1452 |
+
{
|
1453 |
+
return vsprintf($this->message, $this->args);
|
1454 |
+
}
|
1455 |
+
}
|
1456 |
+
|
1457 |
+
class OS_Result_GLS
|
1458 |
+
{
|
1459 |
+
public $success;
|
1460 |
+
public $result;
|
1461 |
+
|
1462 |
+
public function __construct($success, $result=null)
|
1463 |
+
{
|
1464 |
+
$this->success = $success;
|
1465 |
+
$this->result = $result;
|
1466 |
+
}
|
1467 |
+
|
1468 |
+
public function __toString()
|
1469 |
+
{
|
1470 |
+
return OwebiaShippingHelper_GLS::toString($this->result);
|
1471 |
+
}
|
1472 |
+
}
|
1473 |
+
|
app/code/community/Addonline/Gls/owebia_includes/cache/countries
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
a:4:{s:9:"code2name";a:246:{s:2:"AF";s:11:"Afghanistan";s:2:"ZA";s:14:"Afrique du Sud";s:2:"AX";s:6:"Åland";s:2:"AL";s:7:"Albanie";s:2:"DZ";s:8:"Algérie";s:2:"DE";s:9:"Allemagne";s:2:"AD";s:7:"Andorre";s:2:"AO";s:6:"Angola";s:2:"AI";s:8:"Anguilla";s:2:"AQ";s:11:"Antarctique";s:2:"AG";s:18:"Antigua-et-Barbuda";s:2:"AN";s:23:"Antilles néerlandaises";s:2:"SA";s:15:"Arabie saoudite";s:2:"AR";s:9:"Argentine";s:2:"AM";s:8:"Arménie";s:2:"AW";s:5:"Aruba";s:2:"AU";s:9:"Australie";s:2:"AT";s:8:"Autriche";s:2:"AZ";s:12:"Azerbaïdjan";s:2:"BS";s:7:"Bahamas";s:2:"BH";s:8:"Bahreïn";s:2:"BD";s:10:"Bangladesh";s:2:"BB";s:7:"Barbade";s:2:"BY";s:12:"Biélorussie";s:2:"BE";s:8:"Belgique";s:2:"BZ";s:6:"Belize";s:2:"BJ";s:6:"Bénin";s:2:"BM";s:8:"Bermudes";s:2:"BT";s:7:"Bhoutan";s:2:"BO";s:7:"Bolivie";s:2:"BA";s:19:"Bosnie-Herzégovine";s:2:"BW";s:8:"Botswana";s:2:"BV";s:11:"Île Bouvet";s:2:"BR";s:7:"Brésil";s:2:"BN";s:6:"Brunei";s:2:"BG";s:8:"Bulgarie";s:2:"BF";s:12:"Burkina Faso";s:2:"BI";s:7:"Burundi";s:2:"KY";s:14:"Îles Caïmans";s:2:"KH";s:8:"Cambodge";s:2:"CM";s:8:"Cameroun";s:2:"CA";s:6:"Canada";s:2:"CV";s:8:"Cap-Vert";s:2:"CF";s:26:"République centrafricaine";s:2:"CL";s:5:"Chili";s:2:"CN";s:5:"Chine";s:2:"CX";s:14:"Île Christmas";s:2:"CY";s:6:"Chypre";s:2:"CC";s:11:"Îles Cocos";s:2:"CO";s:8:"Colombie";s:2:"KM";s:7:"Comores";s:2:"CG";s:5:"Congo";s:2:"CD";s:34:"République démocratique du Congo";s:2:"CK";s:10:"Îles Cook";s:2:"KR";s:13:"Corée du Sud";s:2:"KP";s:14:"Corée du Nord";s:2:"CR";s:10:"Costa Rica";s:2:"CI";s:14:"Côte d'Ivoire";s:2:"HR";s:7:"Croatie";s:2:"CU";s:4:"Cuba";s:2:"DK";s:8:"Danemark";s:2:"DJ";s:8:"Djibouti";s:2:"DO";s:23:"République dominicaine";s:2:"DM";s:9:"Dominique";s:2:"EG";s:7:"Égypte";s:2:"SV";s:8:"Salvador";s:2:"AE";s:20:"Émirats arabes unis";s:2:"EC";s:9:"Équateur";s:2:"ER";s:10:"Érythrée";s:2:"ES";s:7:"Espagne";s:2:"EE";s:7:"Estonie";s:2:"US";s:11:"États-Unis";s:2:"ET";s:9:"Éthiopie";s:2:"FK";s:15:"Îles Malouines";s:2:"FO";s:13:"Îles Féroé";s:2:"FJ";s:5:"Fidji";s:2:"FI";s:8:"Finlande";s:2:"FR";s:6:"France";s:2:"GA";s:5:"Gabon";s:2:"GM";s:6:"Gambie";s:2:"GE";s:8:"Géorgie";s:2:"GS";s:44:"Géorgie du Sud-et-les Îles Sandwich du Sud";s:2:"GH";s:5:"Ghana";s:2:"GI";s:9:"Gibraltar";s:2:"GR";s:6:"Grèce";s:2:"GD";s:7:"Grenade";s:2:"GL";s:9:"Groenland";s:2:"GP";s:10:"Guadeloupe";s:2:"GU";s:4:"Guam";s:2:"GT";s:9:"Guatemala";s:2:"GG";s:9:"Guernesey";s:2:"GN";s:7:"Guinée";s:2:"GW";s:14:"Guinée-Bissau";s:2:"GQ";s:20:"Guinée équatoriale";s:2:"GY";s:6:"Guyana";s:2:"GF";s:17:"Guyane Française";s:2:"HT";s:6:"Haïti";s:2:"HM";s:24:"Îles Heard-et-MacDonald";s:2:"HN";s:8:"Honduras";s:2:"HK";s:9:"Hong Kong";s:2:"HU";s:7:"Hongrie";s:2:"IM";s:11:"Île de Man";s:2:"UM";s:42:"Îles mineures éloignées des États-Unis";s:2:"VG";s:26:"Îles Vierges britanniques";s:2:"VI";s:26:"Îles Vierges américaines";s:2:"IN";s:4:"Inde";s:2:"ID";s:10:"Indonésie";s:2:"IR";s:4:"Iran";s:2:"IQ";s:4:"Irak";s:2:"IE";s:7:"Irlande";s:2:"IS";s:7:"Islande";s:2:"IL";s:7:"Israël";s:2:"IT";s:6:"Italie";s:2:"JM";s:9:"Jamaïque";s:2:"JP";s:5:"Japon";s:2:"JE";s:6:"Jersey";s:2:"JO";s:8:"Jordanie";s:2:"KZ";s:10:"Kazakhstan";s:2:"KE";s:5:"Kenya";s:2:"KG";s:12:"Kirghizistan";s:2:"KI";s:8:"Kiribati";s:2:"KW";s:7:"Koweït";s:2:"LA";s:4:"Laos";s:2:"LS";s:7:"Lesotho";s:2:"LV";s:8:"Lettonie";s:2:"LB";s:5:"Liban";s:2:"LR";s:8:"Libéria";s:2:"LY";s:5:"Libye";s:2:"LI";s:13:"Liechtenstein";s:2:"LT";s:8:"Lituanie";s:2:"LU";s:10:"Luxembourg";s:2:"MO";s:5:"Macao";s:2:"MK";s:10:"Macédoine";s:2:"MG";s:10:"Madagascar";s:2:"MY";s:8:"Malaisie";s:2:"MW";s:6:"Malawi";s:2:"MV";s:8:"Maldives";s:2:"ML";s:4:"Mali";s:2:"MT";s:5:"Malte";s:2:"MP";s:23:"Îles Mariannes du Nord";s:2:"MA";s:5:"Maroc";s:2:"MH";s:14:"Îles Marshall";s:2:"MQ";s:10:"Martinique";s:2:"MU";s:12:"Île Maurice";s:2:"MR";s:10:"Mauritanie";s:2:"YT";s:7:"Mayotte";s:2:"MX";s:7:"Mexique";s:2:"FM";s:11:"Micronésie";s:2:"MD";s:8:"Moldavie";s:2:"MC";s:6:"Monaco";s:2:"MN";s:8:"Mongolie";s:2:"ME";s:12:"Monténégro";s:2:"MS";s:10:"Montserrat";s:2:"MZ";s:10:"Mozambique";s:2:"MM";s:8:"Birmanie";s:2:"NA";s:7:"Namibie";s:2:"NR";s:5:"Nauru";s:2:"NP";s:6:"Népal";s:2:"NI";s:9:"Nicaragua";s:2:"NE";s:5:"Niger";s:2:"NG";s:8:"Nigéria";s:2:"NU";s:5:"Niué";s:2:"NF";s:12:"Île Norfolk";s:2:"NO";s:8:"Norvège";s:2:"NC";s:19:"Nouvelle-Calédonie";s:2:"NZ";s:17:"Nouvelle-Zélande";s:2:"IO";s:41:"Territoire britannique de l'océan Indien";s:2:"OM";s:4:"Oman";s:2:"UG";s:7:"Ouganda";s:2:"UZ";s:12:"Ouzbékistan";s:2:"PK";s:8:"Pakistan";s:2:"PW";s:6:"Palaos";s:2:"PS";s:9:"Palestine";s:2:"PA";s:7:"Panamá";s:2:"PG";s:26:"Papouasie-Nouvelle-Guinée";s:2:"PY";s:8:"Paraguay";s:2:"NL";s:8:"Pays-Bas";s:2:"PE";s:6:"Pérou";s:2:"PH";s:11:"Philippines";s:2:"PN";s:14:"Îles Pitcairn";s:2:"PL";s:7:"Pologne";s:2:"PF";s:21:"Polynésie Française";s:2:"PR";s:10:"Porto Rico";s:2:"PT";s:8:"Portugal";s:2:"QA";s:5:"Qatar";s:2:"RE";s:11:"La Réunion";s:2:"RO";s:8:"Roumanie";s:2:"GB";s:11:"Royaume-Uni";s:2:"RU";s:6:"Russie";s:2:"RW";s:6:"Rwanda";s:2:"EH";s:17:"Sahara occidental";s:2:"BL";s:17:"Saint-Barthélemy";s:2:"KN";s:28:"Saint-Christophe-et-Niévès";s:2:"SM";s:11:"Saint-Marin";s:2:"MF";s:12:"Saint-Martin";s:2:"PM";s:24:"Saint-Pierre-et-Miquelon";s:2:"VA";s:7:"Vatican";s:2:"VC";s:31:"Saint-Vincent-et-les Grenadines";s:2:"SH";s:15:"Sainte-Hélène";s:2:"LC";s:12:"Sainte-Lucie";s:2:"SB";s:13:"Îles Salomon";s:2:"WS";s:5:"Samoa";s:2:"AS";s:18:"Samoa américaines";s:2:"ST";s:22:"São Tomé-et-Principe";s:2:"SN";s:9:"Sénégal";s:2:"RS";s:6:"Serbie";s:2:"SC";s:10:"Seychelles";s:2:"SL";s:12:"Sierra Leone";s:2:"SG";s:9:"Singapour";s:2:"SK";s:9:"Slovaquie";s:2:"SI";s:9:"Slovénie";s:2:"SO";s:7:"Somalie";s:2:"SD";s:6:"Soudan";s:2:"LK";s:9:"Sri Lanka";s:2:"SE";s:6:"Suède";s:2:"CH";s:6:"Suisse";s:2:"SR";s:8:"Suriname";s:2:"SJ";s:26:"Svalbard et île Jan Mayen";s:2:"SZ";s:9:"Swaziland";s:2:"SY";s:5:"Syrie";s:2:"TJ";s:11:"Tadjikistan";s:2:"TW";s:7:"Taïwan";s:2:"TZ";s:8:"Tanzanie";s:2:"TD";s:5:"Tchad";s:2:"CZ";s:20:"République tchèque";s:2:"TF";s:44:"Terres Australes et Antarctiques Françaises";s:2:"TH";s:10:"Thaïlande";s:2:"TL";s:14:"Timor oriental";s:2:"TG";s:4:"Togo";s:2:"TK";s:7:"Tokelau";s:2:"TO";s:5:"Tonga";s:2:"TT";s:18:"Trinité-et-Tobago";s:2:"TN";s:7:"Tunisie";s:2:"TM";s:13:"Turkménistan";s:2:"TC";s:25:"Îles Turques-et-Caïques";s:2:"TR";s:7:"Turquie";s:2:"TV";s:6:"Tuvalu";s:2:"UA";s:7:"Ukraine";s:2:"UY";s:7:"Uruguay";s:2:"VU";s:7:"Vanuatu";s:2:"VE";s:9:"Venezuela";s:2:"VN";s:9:"Viêt Nam";s:2:"WF";s:16:"Wallis-et-Futuna";s:2:"YE";s:6:"Yémen";s:2:"ZM";s:6:"Zambie";s:2:"ZW";s:8:"Zimbabwe";}s:22:"code2soft-cleaned-name";a:246:{s:2:"AF";s:11:"afghanistan";s:2:"ZA";s:14:"afrique-du-sud";s:2:"AX";s:5:"aland";s:2:"AL";s:7:"albanie";s:2:"DZ";s:7:"algerie";s:2:"DE";s:9:"allemagne";s:2:"AD";s:7:"andorre";s:2:"AO";s:6:"angola";s:2:"AI";s:8:"anguilla";s:2:"AQ";s:11:"antarctique";s:2:"AG";s:18:"antigua-et-barbuda";s:2:"AN";s:22:"antilles-neerlandaises";s:2:"SA";s:15:"arabie-saoudite";s:2:"AR";s:9:"argentine";s:2:"AM";s:7:"armenie";s:2:"AW";s:5:"aruba";s:2:"AU";s:9:"australie";s:2:"AT";s:8:"autriche";s:2:"AZ";s:11:"azerbaidjan";s:2:"BS";s:7:"bahamas";s:2:"BH";s:7:"bahrein";s:2:"BD";s:10:"bangladesh";s:2:"BB";s:7:"barbade";s:2:"BY";s:11:"bielorussie";s:2:"BE";s:8:"belgique";s:2:"BZ";s:6:"belize";s:2:"BJ";s:5:"benin";s:2:"BM";s:8:"bermudes";s:2:"BT";s:7:"bhoutan";s:2:"BO";s:7:"bolivie";s:2:"BA";s:18:"bosnie-herzegovine";s:2:"BW";s:8:"botswana";s:2:"BV";s:10:"ile-bouvet";s:2:"BR";s:6:"bresil";s:2:"BN";s:6:"brunei";s:2:"BG";s:8:"bulgarie";s:2:"BF";s:12:"burkina-faso";s:2:"BI";s:7:"burundi";s:2:"KY";s:12:"iles-caimans";s:2:"KH";s:8:"cambodge";s:2:"CM";s:8:"cameroun";s:2:"CA";s:6:"canada";s:2:"CV";s:8:"cap-vert";s:2:"CF";s:25:"republique-centrafricaine";s:2:"CL";s:5:"chili";s:2:"CN";s:5:"chine";s:2:"CX";s:13:"ile-christmas";s:2:"CY";s:6:"chypre";s:2:"CC";s:10:"iles-cocos";s:2:"CO";s:8:"colombie";s:2:"KM";s:7:"comores";s:2:"CG";s:5:"congo";s:2:"CD";s:32:"republique-democratique-du-congo";s:2:"CK";s:9:"iles-cook";s:2:"KR";s:12:"coree-du-sud";s:2:"KP";s:13:"coree-du-nord";s:2:"CR";s:10:"costa-rica";s:2:"CI";s:13:"cote-d-ivoire";s:2:"HR";s:7:"croatie";s:2:"CU";s:4:"cuba";s:2:"DK";s:8:"danemark";s:2:"DJ";s:8:"djibouti";s:2:"DO";s:22:"republique-dominicaine";s:2:"DM";s:9:"dominique";s:2:"EG";s:6:"egypte";s:2:"SV";s:8:"salvador";s:2:"AE";s:19:"emirats-arabes-unis";s:2:"EC";s:8:"equateur";s:2:"ER";s:8:"erythree";s:2:"ES";s:7:"espagne";s:2:"EE";s:7:"estonie";s:2:"US";s:10:"etats-unis";s:2:"ET";s:8:"ethiopie";s:2:"FK";s:14:"iles-malouines";s:2:"FO";s:10:"iles-feroe";s:2:"FJ";s:5:"fidji";s:2:"FI";s:8:"finlande";s:2:"FR";s:6:"france";s:2:"GA";s:5:"gabon";s:2:"GM";s:6:"gambie";s:2:"GE";s:7:"georgie";s:2:"GS";s:42:"georgie-du-sud-et-les-iles-sandwich-du-sud";s:2:"GH";s:5:"ghana";s:2:"GI";s:9:"gibraltar";s:2:"GR";s:5:"grece";s:2:"GD";s:7:"grenade";s:2:"GL";s:9:"groenland";s:2:"GP";s:10:"guadeloupe";s:2:"GU";s:4:"guam";s:2:"GT";s:9:"guatemala";s:2:"GG";s:9:"guernesey";s:2:"GN";s:6:"guinee";s:2:"GW";s:13:"guinee-bissau";s:2:"GQ";s:18:"guinee-equatoriale";s:2:"GY";s:6:"guyana";s:2:"GF";s:16:"guyane-francaise";s:2:"HT";s:5:"haiti";s:2:"HM";s:23:"iles-heard-et-macdonald";s:2:"HN";s:8:"honduras";s:2:"HK";s:9:"hong-kong";s:2:"HU";s:7:"hongrie";s:2:"IM";s:10:"ile-de-man";s:2:"UM";s:38:"iles-mineures-eloignees-des-etats-unis";s:2:"VG";s:25:"iles-vierges-britanniques";s:2:"VI";s:24:"iles-vierges-americaines";s:2:"IN";s:4:"inde";s:2:"ID";s:9:"indonesie";s:2:"IR";s:4:"iran";s:2:"IQ";s:4:"irak";s:2:"IE";s:7:"irlande";s:2:"IS";s:7:"islande";s:2:"IL";s:6:"israel";s:2:"IT";s:6:"italie";s:2:"JM";s:8:"jamaique";s:2:"JP";s:5:"japon";s:2:"JE";s:6:"jersey";s:2:"JO";s:8:"jordanie";s:2:"KZ";s:10:"kazakhstan";s:2:"KE";s:5:"kenya";s:2:"KG";s:12:"kirghizistan";s:2:"KI";s:8:"kiribati";s:2:"KW";s:6:"koweit";s:2:"LA";s:4:"laos";s:2:"LS";s:7:"lesotho";s:2:"LV";s:8:"lettonie";s:2:"LB";s:5:"liban";s:2:"LR";s:7:"liberia";s:2:"LY";s:5:"libye";s:2:"LI";s:13:"liechtenstein";s:2:"LT";s:8:"lituanie";s:2:"LU";s:10:"luxembourg";s:2:"MO";s:5:"macao";s:2:"MK";s:9:"macedoine";s:2:"MG";s:10:"madagascar";s:2:"MY";s:8:"malaisie";s:2:"MW";s:6:"malawi";s:2:"MV";s:8:"maldives";s:2:"ML";s:4:"mali";s:2:"MT";s:5:"malte";s:2:"MP";s:22:"iles-mariannes-du-nord";s:2:"MA";s:5:"maroc";s:2:"MH";s:13:"iles-marshall";s:2:"MQ";s:10:"martinique";s:2:"MU";s:11:"ile-maurice";s:2:"MR";s:10:"mauritanie";s:2:"YT";s:7:"mayotte";s:2:"MX";s:7:"mexique";s:2:"FM";s:10:"micronesie";s:2:"MD";s:8:"moldavie";s:2:"MC";s:6:"monaco";s:2:"MN";s:8:"mongolie";s:2:"ME";s:10:"montenegro";s:2:"MS";s:10:"montserrat";s:2:"MZ";s:10:"mozambique";s:2:"MM";s:8:"birmanie";s:2:"NA";s:7:"namibie";s:2:"NR";s:5:"nauru";s:2:"NP";s:5:"nepal";s:2:"NI";s:9:"nicaragua";s:2:"NE";s:5:"niger";s:2:"NG";s:7:"nigeria";s:2:"NU";s:4:"niue";s:2:"NF";s:11:"ile-norfolk";s:2:"NO";s:7:"norvege";s:2:"NC";s:18:"nouvelle-caledonie";s:2:"NZ";s:16:"nouvelle-zelande";s:2:"IO";s:40:"territoire-britannique-de-l-ocean-indien";s:2:"OM";s:4:"oman";s:2:"UG";s:7:"ouganda";s:2:"UZ";s:11:"ouzbekistan";s:2:"PK";s:8:"pakistan";s:2:"PW";s:6:"palaos";s:2:"PS";s:9:"palestine";s:2:"PA";s:6:"panama";s:2:"PG";s:25:"papouasie-nouvelle-guinee";s:2:"PY";s:8:"paraguay";s:2:"NL";s:8:"pays-bas";s:2:"PE";s:5:"perou";s:2:"PH";s:11:"philippines";s:2:"PN";s:13:"iles-pitcairn";s:2:"PL";s:7:"pologne";s:2:"PF";s:19:"polynesie-francaise";s:2:"PR";s:10:"porto-rico";s:2:"PT";s:8:"portugal";s:2:"QA";s:5:"qatar";s:2:"RE";s:10:"la-reunion";s:2:"RO";s:8:"roumanie";s:2:"GB";s:11:"royaume-uni";s:2:"RU";s:6:"russie";s:2:"RW";s:6:"rwanda";s:2:"EH";s:17:"sahara-occidental";s:2:"BL";s:16:"saint-barthelemy";s:2:"KN";s:26:"saint-christophe-et-nieves";s:2:"SM";s:11:"saint-marin";s:2:"MF";s:12:"saint-martin";s:2:"PM";s:24:"saint-pierre-et-miquelon";s:2:"VA";s:7:"vatican";s:2:"VC";s:31:"saint-vincent-et-les-grenadines";s:2:"SH";s:13:"sainte-helene";s:2:"LC";s:12:"sainte-lucie";s:2:"SB";s:12:"iles-salomon";s:2:"WS";s:5:"samoa";s:2:"AS";s:17:"samoa-americaines";s:2:"ST";s:20:"sao-tome-et-principe";s:2:"SN";s:7:"senegal";s:2:"RS";s:6:"serbie";s:2:"SC";s:10:"seychelles";s:2:"SL";s:12:"sierra-leone";s:2:"SG";s:9:"singapour";s:2:"SK";s:9:"slovaquie";s:2:"SI";s:8:"slovenie";s:2:"SO";s:7:"somalie";s:2:"SD";s:6:"soudan";s:2:"LK";s:9:"sri-lanka";s:2:"SE";s:5:"suede";s:2:"CH";s:6:"suisse";s:2:"SR";s:8:"suriname";s:2:"SJ";s:25:"svalbard-et-ile-jan-mayen";s:2:"SZ";s:9:"swaziland";s:2:"SY";s:5:"syrie";s:2:"TJ";s:11:"tadjikistan";s:2:"TW";s:6:"taiwan";s:2:"TZ";s:8:"tanzanie";s:2:"TD";s:5:"tchad";s:2:"CZ";s:18:"republique-tcheque";s:2:"TF";s:43:"terres-australes-et-antarctiques-francaises";s:2:"TH";s:9:"thailande";s:2:"TL";s:14:"timor-oriental";s:2:"TG";s:4:"togo";s:2:"TK";s:7:"tokelau";s:2:"TO";s:5:"tonga";s:2:"TT";s:17:"trinite-et-tobago";s:2:"TN";s:7:"tunisie";s:2:"TM";s:12:"turkmenistan";s:2:"TC";s:23:"iles-turques-et-caiques";s:2:"TR";s:7:"turquie";s:2:"TV";s:6:"tuvalu";s:2:"UA";s:7:"ukraine";s:2:"UY";s:7:"uruguay";s:2:"VU";s:7:"vanuatu";s:2:"VE";s:9:"venezuela";s:2:"VN";s:8:"viet-nam";s:2:"WF";s:16:"wallis-et-futuna";s:2:"YE";s:5:"yemen";s:2:"ZM";s:6:"zambie";s:2:"ZW";s:8:"zimbabwe";}s:22:"code2hard-cleaned-name";a:246:{s:2:"AF";s:11:"afghanistan";s:2:"ZA";s:14:"afrique-du-sud";s:2:"AX";s:5:"aland";s:2:"AL";s:7:"albanie";s:2:"DZ";s:7:"algerie";s:2:"DE";s:9:"allemagne";s:2:"AD";s:7:"andorre";s:2:"AO";s:6:"angola";s:2:"AI";s:8:"anguilla";s:2:"AQ";s:11:"antarctique";s:2:"AG";s:15:"antigua-barbuda";s:2:"AN";s:22:"antilles-neerlandaises";s:2:"SA";s:15:"arabie-saoudite";s:2:"AR";s:9:"argentine";s:2:"AM";s:7:"armenie";s:2:"AW";s:5:"aruba";s:2:"AU";s:9:"australie";s:2:"AT";s:8:"autriche";s:2:"AZ";s:11:"azerbaidjan";s:2:"BS";s:7:"bahamas";s:2:"BH";s:7:"bahrein";s:2:"BD";s:10:"bangladesh";s:2:"BB";s:7:"barbade";s:2:"BY";s:11:"bielorussie";s:2:"BE";s:8:"belgique";s:2:"BZ";s:6:"belize";s:2:"BJ";s:5:"benin";s:2:"BM";s:8:"bermudes";s:2:"BT";s:7:"bhoutan";s:2:"BO";s:7:"bolivie";s:2:"BA";s:18:"bosnie-herzegovine";s:2:"BW";s:8:"botswana";s:2:"BV";s:6:"bouvet";s:2:"BR";s:6:"bresil";s:2:"BN";s:6:"brunei";s:2:"BG";s:8:"bulgarie";s:2:"BF";s:12:"burkina-faso";s:2:"BI";s:7:"burundi";s:2:"KY";s:7:"caimans";s:2:"KH";s:8:"cambodge";s:2:"CM";s:8:"cameroun";s:2:"CA";s:6:"canada";s:2:"CV";s:8:"cap-vert";s:2:"CF";s:25:"republique-centrafricaine";s:2:"CL";s:5:"chili";s:2:"CN";s:5:"chine";s:2:"CX";s:9:"christmas";s:2:"CY";s:6:"chypre";s:2:"CC";s:5:"cocos";s:2:"CO";s:8:"colombie";s:2:"KM";s:7:"comores";s:2:"CG";s:5:"congo";s:2:"CD";s:32:"republique-democratique-du-congo";s:2:"CK";s:4:"cook";s:2:"KR";s:12:"coree-du-sud";s:2:"KP";s:13:"coree-du-nord";s:2:"CR";s:10:"costa-rica";s:2:"CI";s:13:"cote-d-ivoire";s:2:"HR";s:7:"croatie";s:2:"CU";s:4:"cuba";s:2:"DK";s:8:"danemark";s:2:"DJ";s:8:"djibouti";s:2:"DO";s:22:"republique-dominicaine";s:2:"DM";s:9:"dominique";s:2:"EG";s:6:"egypte";s:2:"SV";s:8:"salvador";s:2:"AE";s:19:"emirats-arabes-unis";s:2:"EC";s:8:"equateur";s:2:"ER";s:8:"erythree";s:2:"ES";s:7:"espagne";s:2:"EE";s:7:"estonie";s:2:"US";s:10:"etats-unis";s:2:"ET";s:8:"ethiopie";s:2:"FK";s:9:"malouines";s:2:"FO";s:5:"feroe";s:2:"FJ";s:5:"fidji";s:2:"FI";s:8:"finlande";s:2:"FR";s:6:"france";s:2:"GA";s:5:"gabon";s:2:"GM";s:6:"gambie";s:2:"GE";s:7:"georgie";s:2:"GS";s:35:"georgie-du-sud-iles-sandwich-du-sud";s:2:"GH";s:5:"ghana";s:2:"GI";s:9:"gibraltar";s:2:"GR";s:5:"grece";s:2:"GD";s:7:"grenade";s:2:"GL";s:9:"groenland";s:2:"GP";s:10:"guadeloupe";s:2:"GU";s:4:"guam";s:2:"GT";s:9:"guatemala";s:2:"GG";s:9:"guernesey";s:2:"GN";s:6:"guinee";s:2:"GW";s:13:"guinee-bissau";s:2:"GQ";s:18:"guinee-equatoriale";s:2:"GY";s:6:"guyana";s:2:"GF";s:16:"guyane-francaise";s:2:"HT";s:5:"haiti";s:2:"HM";s:15:"heard-macdonald";s:2:"HN";s:8:"honduras";s:2:"HK";s:9:"hong-kong";s:2:"HU";s:7:"hongrie";s:2:"IM";s:6:"de-man";s:2:"UM";s:33:"mineures-eloignees-des-etats-unis";s:2:"VG";s:20:"vierges-britanniques";s:2:"VI";s:19:"vierges-americaines";s:2:"IN";s:4:"inde";s:2:"ID";s:9:"indonesie";s:2:"IR";s:4:"iran";s:2:"IQ";s:4:"irak";s:2:"IE";s:7:"irlande";s:2:"IS";s:7:"islande";s:2:"IL";s:6:"israel";s:2:"IT";s:6:"italie";s:2:"JM";s:8:"jamaique";s:2:"JP";s:5:"japon";s:2:"JE";s:6:"jersey";s:2:"JO";s:8:"jordanie";s:2:"KZ";s:10:"kazakhstan";s:2:"KE";s:5:"kenya";s:2:"KG";s:12:"kirghizistan";s:2:"KI";s:8:"kiribati";s:2:"KW";s:6:"koweit";s:2:"LA";s:4:"laos";s:2:"LS";s:7:"lesotho";s:2:"LV";s:8:"lettonie";s:2:"LB";s:5:"liban";s:2:"LR";s:7:"liberia";s:2:"LY";s:5:"libye";s:2:"LI";s:13:"liechtenstein";s:2:"LT";s:8:"lituanie";s:2:"LU";s:10:"luxembourg";s:2:"MO";s:5:"macao";s:2:"MK";s:9:"macedoine";s:2:"MG";s:10:"madagascar";s:2:"MY";s:8:"malaisie";s:2:"MW";s:6:"malawi";s:2:"MV";s:8:"maldives";s:2:"ML";s:4:"mali";s:2:"MT";s:5:"malte";s:2:"MP";s:17:"mariannes-du-nord";s:2:"MA";s:5:"maroc";s:2:"MH";s:8:"marshall";s:2:"MQ";s:10:"martinique";s:2:"MU";s:7:"maurice";s:2:"MR";s:10:"mauritanie";s:2:"YT";s:7:"mayotte";s:2:"MX";s:7:"mexique";s:2:"FM";s:10:"micronesie";s:2:"MD";s:8:"moldavie";s:2:"MC";s:6:"monaco";s:2:"MN";s:8:"mongolie";s:2:"ME";s:10:"montenegro";s:2:"MS";s:10:"montserrat";s:2:"MZ";s:10:"mozambique";s:2:"MM";s:8:"birmanie";s:2:"NA";s:7:"namibie";s:2:"NR";s:5:"nauru";s:2:"NP";s:5:"nepal";s:2:"NI";s:9:"nicaragua";s:2:"NE";s:5:"niger";s:2:"NG";s:7:"nigeria";s:2:"NU";s:4:"niue";s:2:"NF";s:7:"norfolk";s:2:"NO";s:7:"norvege";s:2:"NC";s:18:"nouvelle-caledonie";s:2:"NZ";s:16:"nouvelle-zelande";s:2:"IO";s:40:"territoire-britannique-de-l-ocean-indien";s:2:"OM";s:4:"oman";s:2:"UG";s:7:"ouganda";s:2:"UZ";s:11:"ouzbekistan";s:2:"PK";s:8:"pakistan";s:2:"PW";s:6:"palaos";s:2:"PS";s:9:"palestine";s:2:"PA";s:6:"panama";s:2:"PG";s:25:"papouasie-nouvelle-guinee";s:2:"PY";s:8:"paraguay";s:2:"NL";s:8:"pays-bas";s:2:"PE";s:5:"perou";s:2:"PH";s:11:"philippines";s:2:"PN";s:8:"pitcairn";s:2:"PL";s:7:"pologne";s:2:"PF";s:19:"polynesie-francaise";s:2:"PR";s:10:"porto-rico";s:2:"PT";s:8:"portugal";s:2:"QA";s:5:"qatar";s:2:"RE";s:7:"reunion";s:2:"RO";s:8:"roumanie";s:2:"GB";s:11:"royaume-uni";s:2:"RU";s:6:"russie";s:2:"RW";s:6:"rwanda";s:2:"EH";s:17:"sahara-occidental";s:2:"BL";s:16:"saint-barthelemy";s:2:"KN";s:23:"saint-christophe-nieves";s:2:"SM";s:11:"saint-marin";s:2:"MF";s:12:"saint-martin";s:2:"PM";s:21:"saint-pierre-miquelon";s:2:"VA";s:7:"vatican";s:2:"VC";s:24:"saint-vincent-grenadines";s:2:"SH";s:13:"sainte-helene";s:2:"LC";s:12:"sainte-lucie";s:2:"SB";s:7:"salomon";s:2:"WS";s:5:"samoa";s:2:"AS";s:17:"samoa-americaines";s:2:"ST";s:17:"sao-tome-principe";s:2:"SN";s:7:"senegal";s:2:"RS";s:6:"serbie";s:2:"SC";s:10:"seychelles";s:2:"SL";s:12:"sierra-leone";s:2:"SG";s:9:"singapour";s:2:"SK";s:9:"slovaquie";s:2:"SI";s:8:"slovenie";s:2:"SO";s:7:"somalie";s:2:"SD";s:6:"soudan";s:2:"LK";s:9:"sri-lanka";s:2:"SE";s:5:"suede";s:2:"CH";s:6:"suisse";s:2:"SR";s:8:"suriname";s:2:"SJ";s:22:"svalbard-ile-jan-mayen";s:2:"SZ";s:9:"swaziland";s:2:"SY";s:5:"syrie";s:2:"TJ";s:11:"tadjikistan";s:2:"TW";s:6:"taiwan";s:2:"TZ";s:8:"tanzanie";s:2:"TD";s:5:"tchad";s:2:"CZ";s:18:"republique-tcheque";s:2:"TF";s:40:"terres-australes-antarctiques-francaises";s:2:"TH";s:9:"thailande";s:2:"TL";s:14:"timor-oriental";s:2:"TG";s:4:"togo";s:2:"TK";s:7:"tokelau";s:2:"TO";s:5:"tonga";s:2:"TT";s:14:"trinite-tobago";s:2:"TN";s:7:"tunisie";s:2:"TM";s:12:"turkmenistan";s:2:"TC";s:15:"turques-caiques";s:2:"TR";s:7:"turquie";s:2:"TV";s:6:"tuvalu";s:2:"UA";s:7:"ukraine";s:2:"UY";s:7:"uruguay";s:2:"VU";s:7:"vanuatu";s:2:"VE";s:9:"venezuela";s:2:"VN";s:8:"viet-nam";s:2:"WF";s:13:"wallis-futuna";s:2:"YE";s:5:"yemen";s:2:"ZM";s:6:"zambie";s:2:"ZW";s:8:"zimbabwe";}s:11:"replacement";a:34:{s:7:"reunion";s:2:"RE";s:21:"france-metropolitaine";s:2:"FR";s:6:"guyane";s:2:"GF";s:4:"taaf";s:2:"TF";s:27:"terres-australes-francaises";s:2:"TF";s:3:"usa";s:2:"US";s:8:"hollande";s:2:"NL";s:15:"grande-bretagne";s:2:"GB";s:7:"vietnam";s:2:"VN";s:7:"belarus";s:2:"BY";s:17:"brunei-darussalam";s:2:"BN";s:6:"cayman";s:2:"KY";s:6:"caiman";s:2:"KY";s:8:"caimanes";s:2:"KY";s:13:"cocos-keeling";s:2:"CC";s:7:"keeling";s:2:"CC";s:12:"centrafrique";s:2:"CF";s:17:"congo-brazzaville";s:2:"CG";s:14:"congo-kinshasa";s:2:"CD";s:5:"zaire";s:2:"CD";s:9:"san-marin";s:2:"SM";s:7:"surinam";s:2:"SR";s:7:"myanmar";s:2:"MM";s:22:"saint-christophe-nevis";s:2:"KN";s:17:"saint-kitts-nevis";s:2:"KN";s:8:"falkland";s:2:"FK";s:11:"el-salvador";s:2:"SV";s:9:"lithuanie";s:2:"LT";s:13:"turks-caiques";s:2:"TC";s:22:"vierges-des-etats-unis";s:2:"VI";s:26:"etat-de-la-cite-du-vatican";s:2:"VA";s:27:"etats-federes-de-micronesie";s:2:"FM";s:27:"r-a-s-chinoise-de-hong-kong";s:2:"HK";s:23:"r-a-s-chinoise-de-macao";s:2:"MO";}}
|
app/code/community/Addonline/Gls/sql/gls_setup/mysql4-install-1.0.0.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 GLS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Addonline_Gls
|
13 |
+
* @copyright Copyright (c) 2014 GLS
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
$installer = $this;
|
18 |
+
|
19 |
+
$installer->startSetup();
|
20 |
+
|
21 |
+
$this->addAttribute('order', 'gls_relay_point_id', array(
|
22 |
+
'type' => 'varchar',
|
23 |
+
'label' => 'Id du point relay GLS',
|
24 |
+
'visible' => true,
|
25 |
+
'required' => false,
|
26 |
+
'input' => 'text'
|
27 |
+
));
|
28 |
+
|
29 |
+
$this->addAttribute('order', 'gls_warn_by_phone', array(
|
30 |
+
'type' => 'varchar',
|
31 |
+
'label' => 'Prévenir par téléphone',
|
32 |
+
'visible' => true,
|
33 |
+
'required' => false,
|
34 |
+
'input' => 'text'
|
35 |
+
));
|
36 |
+
|
37 |
+
$this->addAttribute('order', 'gls_trackid', array(
|
38 |
+
'type' => 'varchar',
|
39 |
+
'label' => 'Trackid',
|
40 |
+
'visible' => true,
|
41 |
+
'required' => false,
|
42 |
+
'input' => 'text'
|
43 |
+
));
|
44 |
+
|
45 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/template/gls/import/form.phtml
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--
|
2 |
+
/**
|
3 |
+
* GLS
|
4 |
+
*
|
5 |
+
* @category Addonline
|
6 |
+
* @package Addonline_GLS
|
7 |
+
* @copyright Copyright (c) 2013 GLS
|
8 |
+
* @author Addonline (http://www.addonline.fr)
|
9 |
+
*/
|
10 |
+
-->
|
11 |
+
<div class="content-header">
|
12 |
+
<table cellspacing="0">
|
13 |
+
<tr>
|
14 |
+
<td><h3 class="icon-head head-tax-rate-importExport"><?php echo Mage::helper('gls')->__('Import orders') ?></h3></td>
|
15 |
+
</tr>
|
16 |
+
</table>
|
17 |
+
</div>
|
18 |
+
<div class="entry-edit">
|
19 |
+
<div class="box-left">
|
20 |
+
<form id="import_form" action="<?php echo $this->getUrl('*/*/import') ?>" method="post" enctype="multipart/form-data">
|
21 |
+
<?php echo $this->getBlockHtml('formkey')?>
|
22 |
+
<div class="entry-edit-head">
|
23 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('gls')->__('Import orders') ?></h4>
|
24 |
+
</div>
|
25 |
+
|
26 |
+
<fieldset>
|
27 |
+
<table class="form-list" cellspacing="0">
|
28 |
+
<colgroup class="label"/>
|
29 |
+
<colgroup class="value"/>
|
30 |
+
<tbody>
|
31 |
+
<tr>
|
32 |
+
<td> </td>
|
33 |
+
<td class="value">
|
34 |
+
<?php $button_label = Mage::helper('gls')->__('Import'); ?>
|
35 |
+
<?php echo $this->getButtonHtml($button_label, "this.form.submit();displayLoadingMask();") ?>
|
36 |
+
</td>
|
37 |
+
</tr>
|
38 |
+
</tbody>
|
39 |
+
</table>
|
40 |
+
</fieldset>
|
41 |
+
|
42 |
+
</form>
|
43 |
+
<script type="text/javascript">
|
44 |
+
var importForm = new varienForm('import_form');
|
45 |
+
|
46 |
+
function displayLoadingMask()
|
47 |
+
{
|
48 |
+
var loaderArea = $$('#html-body .wrapper')[0]; // Blocks all page
|
49 |
+
Position.clone($(loaderArea), $('loading-mask'), {offsetLeft:-2});
|
50 |
+
toggleSelectsUnderBlock($('loading-mask'), false);
|
51 |
+
Element.show('loading-mask');
|
52 |
+
}
|
53 |
+
</script>
|
54 |
+
</div>
|
55 |
+
<div class="clear"></div>
|
56 |
+
</div>
|
app/design/frontend/base/default/layout/gls.xml
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2014 GLS
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* It is available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
*
|
12 |
+
* @category Addonline
|
13 |
+
* @package Addonline_Gls
|
14 |
+
* @copyright Copyright (c) 2014 GLS
|
15 |
+
* @author Addonline (http://www.addonline.fr)
|
16 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
17 |
+
*/
|
18 |
+
-->
|
19 |
+
<layout version="0.1.0">
|
20 |
+
<checkout_onepage_index>
|
21 |
+
<reference name="head">
|
22 |
+
<action method="addCss">
|
23 |
+
<stylesheet>css/gls.css</stylesheet>
|
24 |
+
</action>
|
25 |
+
|
26 |
+
<action method="addJs">
|
27 |
+
<script>jquery/jquery-1.7.1.min.js</script>
|
28 |
+
</action>
|
29 |
+
<action method="addJs">
|
30 |
+
<script>jquery/jquery.noconflict.js</script>
|
31 |
+
</action>
|
32 |
+
<action method="addJs">
|
33 |
+
<script>jquery/jquery.tools.min.js</script>
|
34 |
+
</action>
|
35 |
+
<action method="addItem">
|
36 |
+
<type>skin_js</type>
|
37 |
+
<script>js/gls.js</script>
|
38 |
+
</action>
|
39 |
+
|
40 |
+
<block type="core/text" name="map.js">
|
41 |
+
<action method="setText">
|
42 |
+
<text><![CDATA[<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false®ion=FR"></script>]]></text>
|
43 |
+
</action>
|
44 |
+
</block>
|
45 |
+
|
46 |
+
</reference>
|
47 |
+
|
48 |
+
<reference name="before_body_end">
|
49 |
+
<block type="core/template" name="gls_additional" after="-"
|
50 |
+
template="gls/additional.phtml" />
|
51 |
+
</reference>
|
52 |
+
|
53 |
+
</checkout_onepage_index>
|
54 |
+
|
55 |
+
<onestepcheckout_index_index>
|
56 |
+
<reference name="head">
|
57 |
+
<action method="addCss">
|
58 |
+
<stylesheet>css/gls.css</stylesheet>
|
59 |
+
</action>
|
60 |
+
|
61 |
+
<action method="addJs">
|
62 |
+
<script>jquery/jquery-1.7.1.min.js</script>
|
63 |
+
</action>
|
64 |
+
<action method="addJs">
|
65 |
+
<script>jquery/jquery.noconflict.js</script>
|
66 |
+
</action>
|
67 |
+
<action method="addJs">
|
68 |
+
<script>jquery/jquery.tools.min.js</script>
|
69 |
+
</action>
|
70 |
+
|
71 |
+
<action method="addItem">
|
72 |
+
<type>skin_js</type>
|
73 |
+
<script>js/gls.js</script>
|
74 |
+
</action>
|
75 |
+
<block type="core/text" name="map.js">
|
76 |
+
<action method="setText">
|
77 |
+
<text><![CDATA[<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false®ion=FR"></script>]]></text>
|
78 |
+
</action>
|
79 |
+
</block>
|
80 |
+
</reference>
|
81 |
+
|
82 |
+
<reference name="before_body_end">
|
83 |
+
<block type="core/template" name="gls_additional" after="-"
|
84 |
+
template="gls/additional.phtml" />
|
85 |
+
</reference>
|
86 |
+
|
87 |
+
</onestepcheckout_index_index>
|
88 |
+
|
89 |
+
<gls_ajax_selector>
|
90 |
+
<remove name="right" />
|
91 |
+
<remove name="left" />
|
92 |
+
|
93 |
+
<block type="gls/selector" name="root" output="toHtml"
|
94 |
+
template="gls/selector.phtml" />
|
95 |
+
</gls_ajax_selector>
|
96 |
+
|
97 |
+
<gls_ajax_listrelais>
|
98 |
+
<remove name="right" />
|
99 |
+
<remove name="left" />
|
100 |
+
|
101 |
+
<block type="gls/listrelais" name="root" output="toHtml"
|
102 |
+
template="gls/listrelais.phtml" />
|
103 |
+
</gls_ajax_listrelais>
|
104 |
+
|
105 |
+
</layout>
|
app/design/frontend/base/default/template/gls/additional.phtml
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 GLS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Addonline_Gls
|
13 |
+
* @copyright Copyright (c) 2014 GLS
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
?>
|
18 |
+
<div id="layer_gls" class="layer"></div>
|
19 |
+
<?php if ($shipping_data = Mage::getSingleton('checkout/session')->getData('gls_shipping_relay_data')) : ?>
|
20 |
+
<div id='gls_relais_choisi_init'>
|
21 |
+
<span><?php echo $shipping_data['name'] ?></span> <span
|
22 |
+
class='modifier_relay'><?php echo __("Change ParcelShop"); ?></span><br />
|
23 |
+
<?php echo $shipping_data['address'] ?><br />
|
24 |
+
<?php echo $shipping_data['zipcode'] ?> <?php echo $shipping_data['city'] ?></div>
|
25 |
+
<?php endif; ?>
|
26 |
+
<script type="text/javascript">
|
27 |
+
//<![CDATA[
|
28 |
+
|
29 |
+
Translator.add('Choose this ParcelShop','<?php echo __("Choose this ParcelShop"); ?>');
|
30 |
+
Translator.add('Change ParcelShop','<?php echo __("Change ParcelShop"); ?>');
|
31 |
+
Translator.add('Please provide a valide mobile phone number.','<?php echo __("Please provide a valide mobile phone number."); ?>');
|
32 |
+
|
33 |
+
var glsBaseUrl = '<?php echo $this->getUrl('gls/ajax/') ?>';
|
34 |
+
|
35 |
+
if (aoGoToShippingMethodHooks == undefined) {
|
36 |
+
var aoGoToShippingMethodHooks = new Array();
|
37 |
+
}
|
38 |
+
// initGlsLogos : fonction définie dans gls.js, appellée dans le hokk ci-dessous, pour charger les logos GLS
|
39 |
+
aoGoToShippingMethodHooks[aoGoToShippingMethodHooks.length] = initGlsLogos;
|
40 |
+
if ((typeof Checkout) != "undefined") {
|
41 |
+
<?php if (version_compare(Mage::getVersion(), '1.8', '>=')) : ?>
|
42 |
+
//On surchage la methode gotoSection de Checkout (voir opcheckout.js) : surcharge identique dans les modules addonline : socolissimo, GLS pour être compatible si on utilise les deux modules
|
43 |
+
Checkout.prototype.gotoSection = function (section, reloadProgressBlock)
|
44 |
+
{
|
45 |
+
if (reloadProgressBlock) {
|
46 |
+
this.reloadProgressBlock(this.currentStep);
|
47 |
+
}
|
48 |
+
//HOOK pour modules de livraison
|
49 |
+
if (section == 'shipping_method') {
|
50 |
+
for (i=0;i<aoGoToShippingMethodHooks.length;i++){
|
51 |
+
aoGoToShippingMethodHooks[i]();
|
52 |
+
}
|
53 |
+
}
|
54 |
+
//Après le choix du mode de livraison il faut aussi recharger l'adresse de livraison car on a pu choisir un relais
|
55 |
+
if (section == 'payment') {
|
56 |
+
this.reloadProgressBlock('shipping');
|
57 |
+
}
|
58 |
+
this.currentStep = section;
|
59 |
+
var sectionElement = $('opc-' + section);
|
60 |
+
sectionElement.addClassName('allow');
|
61 |
+
this.accordion.openSection('opc-' + section);
|
62 |
+
if(!reloadProgressBlock) {
|
63 |
+
this.resetPreviousSteps();
|
64 |
+
}
|
65 |
+
}
|
66 |
+
<?php else : ?>
|
67 |
+
Checkout.prototype.gotoSection = function (section)
|
68 |
+
{
|
69 |
+
//HOOK pour modules de livraison
|
70 |
+
if (section == 'shipping_method') {
|
71 |
+
for (i=0;i<aoGoToShippingMethodHooks.length;i++){
|
72 |
+
aoGoToShippingMethodHooks[i]();
|
73 |
+
}
|
74 |
+
}
|
75 |
+
//Après le choix du mode de livraison il faut aussi recharger l'adresse de livraison car on a pu choisir un relais
|
76 |
+
if (section == 'payment') {
|
77 |
+
this.reloadProgressBlock('shipping');
|
78 |
+
}
|
79 |
+
var sectionElement = $('opc-'+section);
|
80 |
+
sectionElement.addClassName('allow');
|
81 |
+
this.accordion.openSection('opc-'+section);
|
82 |
+
this.reloadProgressBlock(section);
|
83 |
+
}
|
84 |
+
<?php endif; ?>
|
85 |
+
}
|
86 |
+
//]]>
|
87 |
+
</script>
|
app/design/frontend/base/default/template/gls/listrelais.phtml
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 GLS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Addonline_Gls
|
13 |
+
* @copyright Copyright (c) 2014 GLS
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
if ($this->getListRelay()) :
|
18 |
+
$i = 0;
|
19 |
+
foreach ($this->getListRelay() as $relais) :
|
20 |
+
?>
|
21 |
+
<div class="gls_point_relay" id="gls_point_relay_<?php echo $i; ?>">
|
22 |
+
<span class="GLS_relay_index"><?php echo $i; ?></span> <span
|
23 |
+
class="GLS_relay_id"><?php echo $relais['relayId']; ?></span> <span
|
24 |
+
class="GLS_relay_name"><?php echo $relais['relayName']; ?></span> <span
|
25 |
+
class="GLS_relay_address"><?php echo $relais['relayAddress']; ?></span>
|
26 |
+
<span class="GLS_relay_zipcode"><?php echo $relais['relayZipCode']; ?></span>
|
27 |
+
<span class="GLS_relay_city"><?php echo $relais['relayCity']; ?></span>
|
28 |
+
<span class="GLS_relay_latitude"><?php echo $relais['relayLatitude']; ?></span>
|
29 |
+
<span class="GLS_relay_longitude"><?php echo $relais['relayLongitude']; ?></span>
|
30 |
+
<div>
|
31 |
+
<span class="GLS_relay_horaires"><?php echo __("Opening hours")?></span>
|
32 |
+
<a href="#" class='choose-relay-point'
|
33 |
+
data-relayindex="<?php echo $i; ?>"><?php echo __("Choose this ParcelShop")?></a>
|
34 |
+
</div>
|
35 |
+
<span class="GLS_relay_hours">
|
36 |
+
<table cellpadding="0" cellspacing="0">
|
37 |
+
<?php
|
38 |
+
$aDays = array(
|
39 |
+
'0' => __("Monday"),
|
40 |
+
'1' => __("Tuesday"),
|
41 |
+
'2' => __("Wednesday"),
|
42 |
+
'3' => __("Thursday"),
|
43 |
+
'4' => __("Friday"),
|
44 |
+
'5' => __("Saturday"),
|
45 |
+
'6' => __("Sunday")
|
46 |
+
);
|
47 |
+
foreach ($relais['relayWorkingDays'] as $day => $openHours) {
|
48 |
+
echo '<tr>';
|
49 |
+
echo '<td class="day">' . $aDays[$day] . '</td>';
|
50 |
+
$hours = '';
|
51 |
+
if ($openHours['breaks']['from']) {
|
52 |
+
$hours = '<td>' . substr_replace(substr($openHours['hours']['from'], 0, 4), 'h' . $openHours['hours']['from'][2], 2, 1) . ' - ' . substr_replace(substr($openHours['breaks']['from'], 0, 4), 'h' . $openHours['breaks']['from'][2], 2, 1) . ' / ' . substr_replace(substr($openHours['breaks']['to'], 0, 4), 'h' . $openHours['breaks']['to'][2], 2, 1) . ' - ' . substr_replace(substr($openHours['hours']['to'], 0, 4), 'h' . $openHours['hours']['to'][2], 2, 1) . '</td>';
|
53 |
+
} else {
|
54 |
+
$hours = '<td>' . substr_replace(substr($openHours['hours']['from'], 0, 4), 'h' . $openHours['hours']['from'][2], 2, 1) . ' - ' . substr_replace(substr($openHours['hours']['to'], 0, 4), 'h' . $openHours['hours']['to'][2], 2, 1) . '</td>';
|
55 |
+
}
|
56 |
+
echo $hours;
|
57 |
+
echo '</tr>';
|
58 |
+
}
|
59 |
+
?>
|
60 |
+
</table>
|
61 |
+
</span>
|
62 |
+
</div>
|
63 |
+
<?php
|
64 |
+
$i ++;
|
65 |
+
endforeach
|
66 |
+
;
|
67 |
+
|
68 |
+
endif;?>
|
app/design/frontend/base/default/template/gls/selector.phtml
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2014 GLS
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* It is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Addonline
|
12 |
+
* @package Addonline_Gls
|
13 |
+
* @copyright Copyright (c) 2014 GLS
|
14 |
+
* @author Addonline (http://www.addonline.fr)
|
15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
16 |
+
*/
|
17 |
+
?>
|
18 |
+
<div id="layer_gls_wrapper">
|
19 |
+
<div>
|
20 |
+
<h3><?php echo __("Choose Mondial Relay ParcelShop")?></h3>
|
21 |
+
<a class="close"></a>
|
22 |
+
<div class="contenu">
|
23 |
+
<div id="gls_headers">
|
24 |
+
<div class="left">
|
25 |
+
<span><?php echo __("Your zipcode")?></span> <input type="text"
|
26 |
+
id="cp_recherche"
|
27 |
+
value="<?php echo $this->getShippingPostcode() ?>" />
|
28 |
+
<button id="cp_recherche_bouton" onclick="geocodeGLSAdresse()"><?php echo $this->helper('gls')->__("Search")?></button>
|
29 |
+
</div>
|
30 |
+
<div class="right">
|
31 |
+
<?php
|
32 |
+
$smsNotification = strpos($this->getTelephone(), "06") === 0 || strpos($this->getTelephone(), "07") === 0;
|
33 |
+
?>
|
34 |
+
<label><input type="checkbox" id="sms_checkbox"
|
35 |
+
<?php if($smsNotification) {?> checked="checked" <?php }?> /> <?php echo __("To receive an sms when delivery is done")?></label>
|
36 |
+
<input type="text" id="num_telephone"
|
37 |
+
class="valid-telephone-portable" <?php if($smsNotification) {?>
|
38 |
+
value="<?php echo $this->getTelephone(); ?><?php }?>" />
|
39 |
+
</div>
|
40 |
+
</div>
|
41 |
+
<div id="col_gauche_gls">
|
42 |
+
<div id="map_gls"></div>
|
43 |
+
</div>
|
44 |
+
<div id="col_droite_gls"></div>
|
45 |
+
</div>
|
46 |
+
</div>
|
47 |
+
</div>
|
app/etc/modules/Addonline_Gls.xml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/** * Copyright (c) 2014 GLS * * Permission is hereby granted, free
|
4 |
+
of charge, to any person obtaining a copy of this software and associated
|
5 |
+
documentation files (the "Software"), * to deal in the Software without restriction,
|
6 |
+
including without limitation the rights to use, copy, modify, merge, publish,
|
7 |
+
distribute, sublicense, * and/or sell copies of the Software, and to permit
|
8 |
+
persons to whom the Software is furnished to do so, subject to the following
|
9 |
+
conditions: * * The above copyright notice and this permission notice shall
|
10 |
+
be included in all copies or substantial portions of the Software. * THE
|
11 |
+
SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
12 |
+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS
|
13 |
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
14 |
+
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY,
|
15 |
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
16 |
+
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE
|
17 |
+
SOFTWARE. * * @category Addonline * @package Addonline_Gls * @copyright Copyright
|
18 |
+
(c) 2014 GLS * @author Addonline (http://www.addonline.fr) * @license http://www.opensource.org/licenses/MIT
|
19 |
+
The MIT License (MIT) **/
|
20 |
+
-->
|
21 |
+
<config>
|
22 |
+
<modules>
|
23 |
+
<Addonline_Gls>
|
24 |
+
<active>true</active>
|
25 |
+
<codePool>community</codePool>
|
26 |
+
<depends>
|
27 |
+
<Mage_Shipping />
|
28 |
+
</depends>
|
29 |
+
</Addonline_Gls>
|
30 |
+
</modules>
|
31 |
+
</config>
|
app/locale/en_US/Addonline_Gls.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
#traductions utilisées dans les champs config type owebia pour traduire le label
|
2 |
+
"Livraison à domicile","Delivery at home"
|
3 |
+
"Livraison à domicile garantie","Delivery guaranteed at home"
|
4 |
+
"Livraison en Point Relais","Shop Delivery"
|
app/locale/fr_FR/Addonline_Gls.csv
ADDED
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"GLS webservice Login","Login du Webservice GLS"
|
2 |
+
"GLS Webservice password","Mot de passe du Webservice GLS"
|
3 |
+
"Delivery at home","Livraison à domicile"
|
4 |
+
"Delivery at home setup","Configuration livraison à domicile"
|
5 |
+
"Delivery at home order","Ordre de tri livraison à domicile"
|
6 |
+
"Delivery guaranteed at home","Livraison à domicile garantie"
|
7 |
+
"Delivery guaranteed at home setup","Configuration livraison à domicile garantie"
|
8 |
+
"Delivery guaranteed at home order","Ordre de tri livraison à domicile garantie"
|
9 |
+
"Shop Delivery","Livraison en Point Relais"
|
10 |
+
"Shop Delivery setup","Configuration livraison en Point Relais"
|
11 |
+
"Shop Delivery order","Ordre de tri livraison en Point Relais"
|
12 |
+
"Maximum weight for articles in standard relays","Poids maximum des articles en Point Relais"
|
13 |
+
"Maximum weight for articles in XL relays","Poids maximum des articles en Point Relais XL"
|
14 |
+
"Only XL shop search","Uniquement les Points Relais XL"
|
15 |
+
"Tracking URL","URL de suivi"
|
16 |
+
"Import/Export functionalities","Activer les fonctions d'import export"
|
17 |
+
"Export folder","Dossier d'export"
|
18 |
+
"Import folder","Dossier d'import"
|
19 |
+
"Stop to first match","Arrêt à la première correspondance trouvée"
|
20 |
+
"GLS module order","Ordre de tri"
|
21 |
+
"Choose Mondial Relay ParcelShop","Sélectionnez votre Point Relais Mondial Relay"
|
22 |
+
"Your zipcode","Votre code postal"
|
23 |
+
"Search","Rechercher"
|
24 |
+
"To receive an sms when delivery is done","Être averti de ma livraison par SMS"
|
25 |
+
"Opening hours","Voir les horaires"
|
26 |
+
"Choose this ParcelShop","Choisir ce lieu"
|
27 |
+
"Monday","Lundi"
|
28 |
+
"Tuesday","Mardi"
|
29 |
+
"Wednesday","Mercredi"
|
30 |
+
"Thursday","Jeudi"
|
31 |
+
"Friday","Vendredi"
|
32 |
+
"Saturday","Samedi"
|
33 |
+
"Sunday","Dimanche"
|
34 |
+
"closed","fermé"
|
35 |
+
"Change ParcelShop","Modifier mon Point Relais"
|
36 |
+
"Please provide a valide mobile phone number.","Veuillez saisir un numéro de téléphone portable valide."
|
37 |
+
"Please provide a valide phone number.","Veuillez saisir un numéro de téléphone valide (portable de préférence)."
|
38 |
+
"Export orders","Exporter les commandes"
|
39 |
+
"Import tracking","Importer les numéros de suivi"
|
40 |
+
"{debug_help}","Affichage du debug sur le panier lors d'une estimation de livraison"
|
41 |
+
"{importexport_help}","Après enregistrement du changement de valeur, il faut se déconnecter et se reconnecter afin de faire apparaitre le nouveau menu"
|
42 |
+
"Your parameters for GSL Webservice might be wrong, or the webservice is down","Vos paramètres pour le webservice GSL sont éronnés, ou alors le webservice ne répond pas"
|
43 |
+
|
44 |
+
# app/code/local/Addonline/Gls/Block/Adminhtml/Os2/Editor.php
|
45 |
+
"New shipping method","Nouvelle méthode de livraison"
|
46 |
+
"Remove","Supprimer"
|
47 |
+
"[meta] %s","[meta] %s"
|
48 |
+
"[data] %s","[data] %s"
|
49 |
+
# Tools
|
50 |
+
"Insert","Insérer"
|
51 |
+
"Tools","Outils"
|
52 |
+
"Shipping country","Pays de livraison"
|
53 |
+
"Cart weight","Poids du panier"
|
54 |
+
"Products quantity","Quantité d'articles"
|
55 |
+
"Price incl. tax","Prix TTC"
|
56 |
+
"Price excl. tax","Prix HT"
|
57 |
+
"Weight","Poids"
|
58 |
+
"Tracking number","Numéro de suivi"
|
59 |
+
"Human readable version","Version lisible"
|
60 |
+
# Fields
|
61 |
+
"ID","ID"
|
62 |
+
"Type","Type"
|
63 |
+
"Shipping Method (default)","Méthode de livraison (par défaut)"
|
64 |
+
"Data","Données"
|
65 |
+
"Meta","Méta"
|
66 |
+
"About","À propos"
|
67 |
+
"Enabled","Activé"
|
68 |
+
"Enabled (default)","Activé (par défaut)"
|
69 |
+
"Disabled","Désactivé"
|
70 |
+
"Label","Libellé"
|
71 |
+
"Description","Description"
|
72 |
+
"Shipping address","Adresse de livraison"
|
73 |
+
"Billing address","Adresse de facturation"
|
74 |
+
"Origin address","Adresse d'envoi"
|
75 |
+
"Conditions","Conditions"
|
76 |
+
"Fees","Coûts"
|
77 |
+
"Customer groups","Groupes utilisateur"
|
78 |
+
"Tracking url","URL de suivi"
|
79 |
+
|
80 |
+
# app/code/local/Addonline/Gls/Block/Adminhtml/Os2/Help.php
|
81 |
+
"Refresh","Rafraîchir"
|
82 |
+
"Previous page","Page précédente"
|
83 |
+
"Summary","Sommaire"
|
84 |
+
|
85 |
+
# app/code/local/Addonline/Gls/Block/Adminhtml/System/Config/Form/Field/Config.php
|
86 |
+
"Help","Aide"
|
87 |
+
"Apply","Appliquer"
|
88 |
+
"Cancel","Annuler"
|
89 |
+
"Source & Correction","Source & Correction"
|
90 |
+
"Download configuration templates","Télécharger des modèles de configuration"
|
91 |
+
# JS
|
92 |
+
"Dissociate","Dissocier"
|
93 |
+
"Remove","Supprimer"
|
94 |
+
"Edit","Modifier"
|
95 |
+
"Enter the new value:","Veuillez saisir la nouvelle valeur :"
|
96 |
+
"[No label]","[Pas de libellé]"
|
97 |
+
"Loading...","En cours de chargement..."
|
98 |
+
|
99 |
+
# app/code/local/Addonline/Gls/Block/Adminhtml/System/Config/Form/Field/Config.php
|
100 |
+
"Version: %s","Version : %s"
|
101 |
+
|
102 |
+
# app/code/local/Addonline/Gls/Controller/Abstract.php
|
103 |
+
"Owebia Shipping 2 Editor","Éditeur Owebia Shipping 2"
|
104 |
+
"Source & Correction","Source & Correction"
|
105 |
+
"Help","Aide"
|
106 |
+
"Donate","Faire un don"
|
107 |
+
"Close","Fermer"
|
108 |
+
|
109 |
+
# app/code/local/Addonline/Gls/controllers/Adminhtml/Os2/AjaxController.php
|
110 |
+
"Editor","Éditeur"
|
111 |
+
"Source","Source"
|
112 |
+
"Correction","Correction"
|
113 |
+
"Debug","Debug"
|
114 |
+
"Apply","Appliquer"
|
115 |
+
"Export","Exporter"
|
116 |
+
"Add a shipping method","Ajouter une méthode de livraison"
|
117 |
+
"New shipping method","Nouvelle méthode de livraison"
|
118 |
+
"You appreciate this extension and would like to help?","Vous appréciez cette extension et vous aimeriez apporter votre soutien ?"
|
119 |
+
"{os2editor.donate-page.content}","<p>L'extension Owebia Shipping 2 est développée bénévolement par l'entreprise Owebia (<a href=""http://www.owebia.com/"">http://www.owebia.com/</a>).<br/>Si vous souhaitez soutenir financièrement le développement de l'extension, vous pouvez faire un « don ».</p><p>En France, seules certaines associations peuvent recevoir des dons, c'est pourquoi nous ne pouvons recevoir une somme d'argent sans qu'elle soit déclarée.<br/>Pour cela, nous enverrons à chaque « donateur » une facture (acquitée) du montant du « don ».</p><p>Cela permettra à chacun de garder une trace de ces « dons ».</p><p><strong>Pour effectuer un « don », merci d'envoyer un chèque à l'adresse suivante :</strong></p><p class=""owebia-address"">Owebia<br/>4, Rue du Collège<br/>25500 Morteau (France)</p><p><strong>N'oubliez pas de joindre à ce chèque les coordonnées qui doivent figurer sur la facture qui vous sera envoyée.</strong></p><p>Merci à tous les donateurs.</p>"
|
120 |
+
|
121 |
+
# app/code/local/Addonline/Gls/etc/system.xml
|
122 |
+
"Tracking URL","URL de suivi"
|
123 |
+
"Debug","Debug"
|
124 |
+
"{debug_help}","Affichage du debug sur le panier lors d'une estimation de livraison"
|
125 |
+
"Compression","Compression"
|
126 |
+
"{compression_help}","Compression gz + base64 pour que la configuration prenne moins de place (utile avec certaines configurations). C'est l'éditeur qui effectue la compression/décompression."
|
127 |
+
"Auto-escaping","Auto-échappement"
|
128 |
+
"{auto_escaping_help}","Active l'auto-échappement systématique des variables"
|
129 |
+
"Auto-correction","Auto-correction"
|
130 |
+
"{auto_correction_help}","Cette option permet la compatibilité rétroactive mais elle consommme des ressources"
|
131 |
+
"Stop to first match","Arrêt à la première correspondance trouvée"
|
132 |
+
"GLS Advanced Setup","GLS configuration avancée"
|
133 |
+
"General Configuration","Configuration générale"
|
134 |
+
"Weight unit","Unité de poids"
|
135 |
+
"Bundle Product Management","Gestion des produits packagés (Bundle Product)"
|
136 |
+
"Configurable Product Management","Gestion des produits configurables (Configurable Product)"
|
137 |
+
"If ""Self"" is selected, options bellow are ignored","Si ""Lui-même"" est sélectionné, les options ci-dessous sont ignorées"
|
138 |
+
"Item processing","Traitement d'un article"
|
139 |
+
"Item options on","Options de l'article sur"
|
140 |
+
"Item data on","Données de l'article sur"
|
141 |
+
"Product data on","Données du produit sur"
|
142 |
+
|
143 |
+
|
144 |
+
# app/code/local/Addonline/Gls/owebia_includes/OwebiaShippingHelper.php
|
145 |
+
"Configuration disabled","Configuration désactivée"
|
146 |
+
"The cart doesn't match conditions","Le panier ne correspond pas aux conditions"
|
147 |
+
"Infinite loop %s","Boucle infinie %s"
|
148 |
+
"Error in table %s","Erreur dans la table %s"
|
149 |
+
"Usage of deprecated syntax %s","Utilisation d'une syntaxe obsolète %s"
|
150 |
+
"Usage of unknown properties %s","Utilisation de propriétés non reconnues %s"
|
151 |
+
"Usage of deprecated properties %s","Utilisation de propriétés obsolètes %s"
|
152 |
+
|
153 |
+
# app/code/local/Addonline/Gls/Model/Carrier/Abstract.php
|
154 |
+
"track the package","suivre le colis"
|
155 |
+
|
156 |
+
# app/code/local/Addonline/Gls/Model/Os2/Data/AddressFilter.php
|
157 |
+
"Africa","Afrique"
|
158 |
+
"Asia","Asie"
|
159 |
+
"Europa","Europe"
|
160 |
+
"North America","Amérique du Nord"
|
161 |
+
"South America","Amérique du Sud"
|
162 |
+
"Oceania","Océanie"
|
163 |
+
"Antartica","Antartique"
|
164 |
+
"European Union","Union Européenne"
|
165 |
+
|
166 |
+
# app/code/local/Addonline/Gls/Model/System/Config/Source/LoadOnParent.php
|
167 |
+
"Self","Lui-même"
|
168 |
+
"Parent","Parent"
|
169 |
+
|
170 |
+
# app/code/local/Addonline/Gls/Model/System/Config/Source/ProcessChildren.php
|
171 |
+
"Self","Lui-même"
|
172 |
+
"Children","Enfants"
|
js/jquery/jquery-1.7.1.min.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
/*! jQuery v1.7.1 jquery.com | jquery.org/license */
|
2 |
+
(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function cb(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function ca(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bE.test(a)?d(a,e):ca(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)ca(a+"["+e+"]",b[e],c,d);else d(a,b)}function b_(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function b$(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bT,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=b$(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=b$(a,c,d,e,"*",g));return l}function bZ(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bP),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bC(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bx:by,g=0,h=e.length;if(d>0){if(c!=="border")for(;g<h;g++)c||(d-=parseFloat(f.css(a,"padding"+e[g]))||0),c==="margin"?d+=parseFloat(f.css(a,c+e[g]))||0:d-=parseFloat(f.css(a,"border"+e[g]+"Width"))||0;return d+"px"}d=bz(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0;if(c)for(;g<h;g++)d+=parseFloat(f.css(a,"padding"+e[g]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+e[g]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+e[g]))||0);return d+"px"}function bp(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c+(i[c][d].namespace?".":"")+i[c][d].namespace,i[c][d],i[c][d].data)}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?m(g):h==="function"&&(!a.unique||!o.has(g))&&c.push(g)},n=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,l=j||0,j=0,k=c.length;for(;c&&l<k;l++)if(c[l].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}i=!1,c&&(a.once?e===!0?o.disable():c=[]:d&&d.length&&(e=d.shift(),o.fireWith(e[0],e[1])))},o={add:function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){i&&f<=k&&(k--,f<=l&&l--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&o.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(i?a.once||d.push([b,c]):(!a.once||!e)&&n(b,c));return this},fire:function(){o.fireWith(this,arguments);return this},fired:function(){return!!e}};return o};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p,q=c.createElement("div"),r=c.documentElement;q.setAttribute("className","t"),q.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="<div "+n+"><div></div></div>"+"<table "+n+" cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="<div style='width:4px;'></div>",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h=null;if(typeof a=="undefined"){if(this.length){h=f.data(this[0]);if(this[0].nodeType===1&&!f._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var i=0,j=e.length;i<j;i++)g=e[i].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),l(this[0],g,h[g]));f._data(this[0],"parsedAttrs",!0)}}return h}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split("."),d[1]=d[1]?"."+d[1]:"";if(c===b){h=this.triggerHandler("getData"+d[1]+"!",[d[0]]),h===b&&this.length&&(h=f.data(this[0],a),h=l(this[0],a,h));return h===b&&d[1]?this.data(d[0]):h}return this.each(function(){var b=f(this),e=[d[0],c];b.triggerHandler("setData"+d[1]+"!",e),f.data(this,a,c),b.triggerHandler("changeData"+d[1]+"!",e)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise()}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h<g;h++)e=d[h],e&&(c=f.propFix[e]||e,f.attr(a,e,""),a.removeAttribute(v?e:c),u.test(e)&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};
|
3 |
+
f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=[],j,k,l,m,n,o,p,q,r,s,t;g[0]=c,c.delegateTarget=this;if(e&&!c.target.disabled&&(!c.button||c.type!=="click")){m=f(this),m.context=this.ownerDocument||this;for(l=c.target;l!=this;l=l.parentNode||this){o={},q=[],m[0]=l;for(j=0;j<e;j++)r=d[j],s=r.selector,o[s]===b&&(o[s]=r.quick?H(l,r.quick):m.is(s)),o[s]&&q.push(r);q.length&&i.push({elem:l,matches:q})}}d.length>e&&i.push({elem:this,matches:d.slice(e)});for(j=0;j<i.length&&!c.isPropagationStopped();j++){p=i[j],c.currentTarget=p.elem;for(k=0;k<p.matches.length&&!c.isImmediatePropagationStopped();k++){r=p.matches[k];if(h||!c.namespace&&!r.namespace||c.namespace_re&&c.namespace_re.test(r.namespace))c.data=r.data,c.handleObj=r,n=((f.event.special[r.origType]||{}).handle||r.handler).apply(p.elem,g),n!==b&&(c.result=n,n===!1&&(c.preventDefault(),c.stopPropagation()))}}return c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0)}),d._submit_attached=!0)})},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on.call(this,a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.type+"."+e.namespace:e.type,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.POS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp("<(?:"+V+")","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function()
|
4 |
+
{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bp)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1></$2>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bn(k[i]);else bn(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||be.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bq=/alpha\([^)]*\)/i,br=/opacity=([^)]*)/,bs=/([A-Z]|^ms)/g,bt=/^-?\d+(?:px)?$/i,bu=/^-?\d/,bv=/^([\-+])=([\-+.\de]+)/,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Left","Right"],by=["Top","Bottom"],bz,bA,bB;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bz(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bv.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bz)return bz(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return bC(a,b,d);f.swap(a,bw,function(){e=bC(a,b,d)});return e}},set:function(a,b){if(!bt.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cv(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cu("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cu("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cv(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cn.test(h)?(o=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),o?(f._data(this,"toggle"+i,o==="show"?"hide":"show"),j[o]()):j[h]()):(k=co.exec(h),l=j.cur(),k?(m=parseFloat(k[2]),n=k[3]||(f.cssNumber[i]?"":"px"),n!=="px"&&(f.style(this,i,(m||1)+n),l=(m||1)/j.cur()*l,f.style(this,i,l+n)),k[1]&&(m=(k[1]==="-="?-1:1)*m+l),j.custom(l,m,n)):j.custom(l,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:cu("show",1),slideUp:cu("hide",1),slideToggle:cu("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cr||cs(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){e.options.hide&&f._data(e.elem,"fxshow"+e.prop)===b&&f._data(e.elem,"fxshow"+e.prop,e.start)},h()&&f.timers.push(h)&&!cp&&(cp=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,"fxshow"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=cr||cs(),g=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cp),cp=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),f.each(["width","height"],function(a,b){f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now)+a.unit)}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cy(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.support.fixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cw.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.support.fixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window);
|
js/jquery/jquery.noconflict.js
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Ce fichier centralise les scripts ajoutés et nécessaires
|
3 |
+
* au fonctionnement du site.
|
4 |
+
*/
|
5 |
+
|
6 |
+
/* Compatiblité avec prototype */
|
7 |
+
jQuery.noConflict();
|
js/jquery/jquery.tools.min.js
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* jQuery Tools v1.2.7 - The missing UI library for the Web
|
3 |
+
*
|
4 |
+
* overlay/overlay.js
|
5 |
+
* scrollable/scrollable.js
|
6 |
+
* scrollable/scrollable.autoscroll.js
|
7 |
+
* scrollable/scrollable.navigator.js
|
8 |
+
* toolbox/toolbox.expose.js
|
9 |
+
*
|
10 |
+
* NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
|
11 |
+
*
|
12 |
+
* http://flowplayer.org/tools/
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
(function(a){a.tools=a.tools||{version:"v1.2.7"},a.tools.overlay={addEffect:function(a,b,d){c[a]=[b,d]},conf:{close:null,closeOnClick:!0,closeOnEsc:!0,closeSpeed:"fast",effect:"default",fixed:!a.browser.msie||a.browser.version>6,left:"center",load:!1,mask:null,oneInstance:!0,speed:"normal",target:null,top:"10%"}};var b=[],c={};a.tools.overlay.addEffect("default",function(b,c){var d=this.getConf(),e=a(window);d.fixed||(b.top+=e.scrollTop(),b.left+=e.scrollLeft()),b.position=d.fixed?"fixed":"absolute",this.getOverlay().css(b).fadeIn(d.speed,c)},function(a){this.getOverlay().fadeOut(this.getConf().closeSpeed,a)});function d(d,e){var f=this,g=d.add(f),h=a(window),i,j,k,l=a.tools.expose&&(e.mask||e.expose),m=Math.random().toString().slice(10);l&&(typeof l=="string"&&(l={color:l}),l.closeOnClick=l.closeOnEsc=!1);var n=e.target||d.attr("rel");j=n?a(n):null||d;if(!j.length)throw"Could not find Overlay: "+n;d&&d.index(j)==-1&&d.click(function(a){f.load(a);return a.preventDefault()}),a.extend(f,{load:function(d){if(f.isOpened())return f;var i=c[e.effect];if(!i)throw"Overlay: cannot find effect : \""+e.effect+"\"";e.oneInstance&&a.each(b,function(){this.close(d)}),d=d||a.Event(),d.type="onBeforeLoad",g.trigger(d);if(d.isDefaultPrevented())return f;k=!0,l&&a(j).expose(l);var n=e.top,o=e.left,p=j.outerWidth({margin:!0}),q=j.outerHeight({margin:!0});typeof n=="string"&&(n=n=="center"?Math.max((h.height()-q)/2,0):parseInt(n,10)/100*h.height()),o=="center"&&(o=Math.max((h.width()-p)/2,0)),i[0].call(f,{top:n,left:o},function(){k&&(d.type="onLoad",g.trigger(d))}),l&&e.closeOnClick&&a.mask.getMask().one("click",f.close),e.closeOnClick&&a(document).on("click."+m,function(b){a(b.target).parents(j).length||f.close(b)}),e.closeOnEsc&&a(document).on("keydown."+m,function(a){a.keyCode==27&&f.close(a)});return f},close:function(b){if(!f.isOpened())return f;b=b||a.Event(),b.type="onBeforeClose",g.trigger(b);if(!b.isDefaultPrevented()){k=!1,c[e.effect][1].call(f,function(){b.type="onClose",g.trigger(b)}),a(document).off("click."+m+" keydown."+m),l&&a.mask.close();return f}},getOverlay:function(){return j},getTrigger:function(){return d},getClosers:function(){return i},isOpened:function(){return k},getConf:function(){return e}}),a.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","),function(b,c){a.isFunction(e[c])&&a(f).on(c,e[c]),f[c]=function(b){b&&a(f).on(c,b);return f}}),i=j.find(e.close||".close"),!i.length&&!e.close&&(i=a("<a class=\"close\"></a>"),j.prepend(i)),i.click(function(a){f.close(a)}),e.load&&f.load()}a.fn.overlay=function(c){var e=this.data("overlay");if(e)return e;a.isFunction(c)&&(c={onBeforeLoad:c}),c=a.extend(!0,{},a.tools.overlay.conf,c),this.each(function(){e=new d(a(this),c),b.push(e),a(this).data("overlay",e)});return c.api?e:this}})(jQuery);
|
16 |
+
(function(a){a.tools=a.tools||{version:"v1.2.7"},a.tools.scrollable={conf:{activeClass:"active",circular:!1,clonedClass:"cloned",disabledClass:"disabled",easing:"swing",initialIndex:0,item:"> *",items:".items",keyboard:!0,mousewheel:!1,next:".next",prev:".prev",size:1,speed:400,vertical:!1,touch:!0,wheelSpeed:0}};function b(a,b){var c=parseInt(a.css(b),10);if(c)return c;var d=a[0].currentStyle;return d&&d.width&&parseInt(d.width,10)}function c(b,c){var d=a(c);return d.length<2?d:b.parent().find(c)}var d;function e(b,e){var f=this,g=b.add(f),h=b.children(),i=0,j=e.vertical;d||(d=f),h.length>1&&(h=a(e.items,b)),e.size>1&&(e.circular=!1),a.extend(f,{getConf:function(){return e},getIndex:function(){return i},getSize:function(){return f.getItems().size()},getNaviButtons:function(){return n.add(o)},getRoot:function(){return b},getItemWrap:function(){return h},getItems:function(){return h.find(e.item).not("."+e.clonedClass)},move:function(a,b){return f.seekTo(i+a,b)},next:function(a){return f.move(e.size,a)},prev:function(a){return f.move(-e.size,a)},begin:function(a){return f.seekTo(0,a)},end:function(a){return f.seekTo(f.getSize()-1,a)},focus:function(){d=f;return f},addItem:function(b){b=a(b),e.circular?(h.children().last().before(b),h.children().first().replaceWith(b.clone().addClass(e.clonedClass))):(h.append(b),o.removeClass("disabled")),g.trigger("onAddItem",[b]);return f},seekTo:function(b,c,k){b.jquery||(b*=1);if(e.circular&&b===0&&i==-1&&c!==0)return f;if(!e.circular&&b<0||b>f.getSize()||b<-1)return f;var l=b;b.jquery?b=f.getItems().index(b):l=f.getItems().eq(b);var m=a.Event("onBeforeSeek");if(!k){g.trigger(m,[b,c]);if(m.isDefaultPrevented()||!l.length)return f}var n=j?{top:-l.position().top}:{left:-l.position().left};i=b,d=f,c===undefined&&(c=e.speed),h.animate(n,c,e.easing,k||function(){g.trigger("onSeek",[b])});return f}}),a.each(["onBeforeSeek","onSeek","onAddItem"],function(b,c){a.isFunction(e[c])&&a(f).on(c,e[c]),f[c]=function(b){b&&a(f).on(c,b);return f}});if(e.circular){var k=f.getItems().slice(-1).clone().prependTo(h),l=f.getItems().eq(1).clone().appendTo(h);k.add(l).addClass(e.clonedClass),f.onBeforeSeek(function(a,b,c){if(!a.isDefaultPrevented()){if(b==-1){f.seekTo(k,c,function(){f.end(0)});return a.preventDefault()}b==f.getSize()&&f.seekTo(l,c,function(){f.begin(0)})}});var m=b.parents().add(b).filter(function(){if(a(this).css("display")==="none")return!0});m.length?(m.show(),f.seekTo(0,0,function(){}),m.hide()):f.seekTo(0,0,function(){})}var n=c(b,e.prev).click(function(a){a.stopPropagation(),f.prev()}),o=c(b,e.next).click(function(a){a.stopPropagation(),f.next()});e.circular||(f.onBeforeSeek(function(a,b){setTimeout(function(){a.isDefaultPrevented()||(n.toggleClass(e.disabledClass,b<=0),o.toggleClass(e.disabledClass,b>=f.getSize()-1))},1)}),e.initialIndex||n.addClass(e.disabledClass)),f.getSize()<2&&n.add(o).addClass(e.disabledClass),e.mousewheel&&a.fn.mousewheel&&b.mousewheel(function(a,b){if(e.mousewheel){f.move(b<0?1:-1,e.wheelSpeed||50);return!1}});if(e.touch){var p={};h[0].ontouchstart=function(a){var b=a.touches[0];p.x=b.clientX,p.y=b.clientY},h[0].ontouchmove=function(a){if(a.touches.length==1&&!h.is(":animated")){var b=a.touches[0],c=p.x-b.clientX,d=p.y-b.clientY;f[j&&d>0||!j&&c>0?"next":"prev"](),a.preventDefault()}}}e.keyboard&&a(document).on("keydown.scrollable",function(b){if(!(!e.keyboard||b.altKey||b.ctrlKey||b.metaKey||a(b.target).is(":input"))){if(e.keyboard!="static"&&d!=f)return;var c=b.keyCode;if(j&&(c==38||c==40)){f.move(c==38?-1:1);return b.preventDefault()}if(!j&&(c==37||c==39)){f.move(c==37?-1:1);return b.preventDefault()}}}),e.initialIndex&&f.seekTo(e.initialIndex,0,function(){})}a.fn.scrollable=function(b){var c=this.data("scrollable");if(c)return c;b=a.extend({},a.tools.scrollable.conf,b),this.each(function(){c=new e(a(this),b),a(this).data("scrollable",c)});return b.api?c:this}})(jQuery);
|
17 |
+
(function(a){var b=a.tools.scrollable;b.autoscroll={conf:{autoplay:!0,interval:3e3,autopause:!0}},a.fn.autoscroll=function(c){typeof c=="number"&&(c={interval:c});var d=a.extend({},b.autoscroll.conf,c),e;this.each(function(){var b=a(this).data("scrollable"),c=b.getRoot(),f,g=!1;function h(){f&&clearTimeout(f),f=setTimeout(function(){b.next()},d.interval)}b&&(e=b),b.play=function(){f||(g=!1,c.on("onSeek",h),h())},b.pause=function(){f=clearTimeout(f),c.off("onSeek",h)},b.resume=function(){g||b.play()},b.stop=function(){g=!0,b.pause()},d.autopause&&c.add(b.getNaviButtons()).hover(b.pause,b.resume),d.autoplay&&b.play()});return d.api?e:this}})(jQuery);
|
18 |
+
(function(a){var b=a.tools.scrollable;b.navigator={conf:{navi:".navi",naviItem:null,activeClass:"active",indexed:!1,idPrefix:null,history:!1}};function c(b,c){var d=a(c);return d.length<2?d:b.parent().find(c)}a.fn.navigator=function(d){typeof d=="string"&&(d={navi:d}),d=a.extend({},b.navigator.conf,d);var e;this.each(function(){var b=a(this).data("scrollable"),f=d.navi.jquery?d.navi:c(b.getRoot(),d.navi),g=b.getNaviButtons(),h=d.activeClass,i=d.history&&history.pushState,j=b.getConf().size;b&&(e=b),b.getNaviButtons=function(){return g.add(f)},i&&(history.pushState({i:0},""),a(window).on("popstate",function(a){var c=a.originalEvent.state;c&&b.seekTo(c.i)}));function k(a,c,d){b.seekTo(c),d.preventDefault(),i&&history.pushState({i:c},"")}function l(){return f.find(d.naviItem||"> *")}function m(b){var c=a("<"+(d.naviItem||"a")+"/>").click(function(c){k(a(this),b,c)});b===0&&c.addClass(h),d.indexed&&c.text(b+1),d.idPrefix&&c.attr("id",d.idPrefix+b);return c.appendTo(f)}l().length?l().each(function(b){a(this).click(function(c){k(a(this),b,c)})}):a.each(b.getItems(),function(a){a%j==0&&m(a)}),b.onBeforeSeek(function(a,b){setTimeout(function(){if(!a.isDefaultPrevented()){var c=b/j,d=l().eq(c);d.length&&l().removeClass(h).eq(c).addClass(h)}},1)}),b.onAddItem(function(a,c){var d=b.getItems().index(c);d%j==0&&m(d)})});return d.api?e:this}})(jQuery);
|
19 |
+
(function(a){a.tools=a.tools||{version:"v1.2.7"};var b;b=a.tools.expose={conf:{maskId:"exposeMask",loadSpeed:"slow",closeSpeed:"fast",closeOnClick:!0,closeOnEsc:!0,zIndex:9998,opacity:.8,startOpacity:0,color:"#fff",onLoad:null,onClose:null}};function c(){if(a.browser.msie){var b=a(document).height(),c=a(window).height();return[window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,b-c<20?c:b]}return[a(document).width(),a(document).height()]}function d(b){if(b)return b.call(a.mask)}var e,f,g,h,i;a.mask={load:function(j,k){if(g)return this;typeof j=="string"&&(j={color:j}),j=j||h,h=j=a.extend(a.extend({},b.conf),j),e=a("#"+j.maskId),e.length||(e=a("<div/>").attr("id",j.maskId),a("body").append(e));var l=c();e.css({position:"absolute",top:0,left:0,width:l[0],height:l[1],display:"none",opacity:j.startOpacity,zIndex:j.zIndex}),j.color&&e.css("backgroundColor",j.color);if(d(j.onBeforeLoad)===!1)return this;j.closeOnEsc&&a(document).on("keydown.mask",function(b){b.keyCode==27&&a.mask.close(b)}),j.closeOnClick&&e.on("click.mask",function(b){a.mask.close(b)}),a(window).on("resize.mask",function(){a.mask.fit()}),k&&k.length&&(i=k.eq(0).css("zIndex"),a.each(k,function(){var b=a(this);/relative|absolute|fixed/i.test(b.css("position"))||b.css("position","relative")}),f=k.css({zIndex:Math.max(j.zIndex+1,i=="auto"?0:i)})),e.css({display:"block"}).fadeTo(j.loadSpeed,j.opacity,function(){a.mask.fit(),d(j.onLoad),g="full"}),g=!0;return this},close:function(){if(g){if(d(h.onBeforeClose)===!1)return this;e.fadeOut(h.closeSpeed,function(){d(h.onClose),f&&f.css({zIndex:i}),g=!1}),a(document).off("keydown.mask"),e.off("click.mask"),a(window).off("resize.mask")}return this},fit:function(){if(g){var a=c();e.css({width:a[0],height:a[1]})}},getMask:function(){return e},isLoaded:function(a){return a?g=="full":g},getConf:function(){return h},getExposed:function(){return f}},a.fn.mask=function(b){a.mask.load(b);return this},a.fn.expose=function(b){a.mask.load(b,this);return this}})(jQuery);
|
package.xml
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Addonline_Gls</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>mode le livraison GLS France</summary>
|
10 |
+
<description>GLS France : donnez le choix à vos clients du mode de livraison qui leur convient.
|
11 |
+
• Des solutions adaptées pour tous vos envois de colis de 30 kg au plus en France, en Europe ou dans le Monde
|
12 |
+
• Une offre de livraison à domicile ou dans l’un des 4300 Points Relais
|
13 |
+
• Des tarifs très compétitifs sur toutes nos offres
|
14 |
+
• Un enlèvement quotidien de vos colis sur votre site
|
15 |
+
• Des colis tracés en permanence par notre système Track&Trace,
|
16 |
+
• La re-programmation de la livraison par le destinataire en cas d’absence lors de la 1ère tentative de livraison
|
17 |
+
• Un transport de qualité s’inscrivant dans une démarche globale de développement durable
|
18 |
+

|
19 |
+
L’extension GLS France est disponible gratuitement sur Magento.
|
20 |
+

|
21 |
+
GLS France propose à vos clients de choisir parmi les deux solutions de livraison suivantes :
|
22 |
+

|
23 |
+
• Livraison à domicile : notre offre BusinessParcel pour vos livraisons en France, EuroBusinessParcel pour vos livraisons en Europe et GlobalBusinessParcel pour vos livraisons dans le Monde.
|
24 |
+
Votre colis est livré contre émargement au domicile du destinataire, ou en cas d’absence déposé chez un voisin. En cas d’impossibilité de livraison, le colis est retourné à l’agence GLS de livraison en attente de vos instructions de livraison.
|
25 |
+

|
26 |
+
• Livraison en Points Relais : notre offre ShopDeliveryService pour vos livraisons en France
|
27 |
+
Votre colis livré en 24h suivant l’enlèvement dans l’un des 4300 Points Relais Mondial Relay.
|
28 |
+

|
29 |
+
Les fonctionnalités du module GLS Magento.
|
30 |
+

|
31 |
+
• Paramétrage des modes de livraison GLS sur votre site internet
|
32 |
+
• Chargement des Points Relais en temps réel grâce au webservice GLS
|
33 |
+
• Export des commandes GLS pour intégration automatique dans la solution d’étiquetage Winexpé 
|
34 |
+
• Import des Url Track&Trace pour que vos destinataires suivent l’acheminement des colis 
|
35 |
+
• Ces fonctionnalités sont disponibles également pour vos applications smartphone.
|
36 |
+

|
37 |
+
Ce module ne peut être utilisé que par les clients GLS France, 
|
38 |
+
Vous n’êtes pas encore client GLS, prenez vite contact avec nous : gls-group.eu 
|
39 |
+
</description>
|
40 |
+
<notes>RAS</notes>
|
41 |
+
<authors><author><name>Addonline</name><user>addonline</user><email>contact@addonline.fr</email></author></authors>
|
42 |
+
<date>2014-06-16</date>
|
43 |
+
<time>08:19:18</time>
|
44 |
+
<contents><target name="magecommunity"><dir name="Addonline"><dir name="Gls"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Config.php" hash="a750ce8ef1b7fbd2d62522a3aaa67558"/><file name="Informations.php" hash="65c57e09789aaf4d5c4709454562aecb"/></dir></dir></dir></dir></dir><dir name="Export"><dir name="Orders"><file name="Grid.php" hash="2568ec9989581f838c4cd08c01d87990"/></dir><file name="Orders.php" hash="c6908c1a3cbac803c3a6e99ebded26ee"/></dir><dir name="Import"><file name="Form.php" hash="8613ec23ed5ddebcb374c5e44c91c849"/></dir><file name="Listrelay.php" hash="237194045d2c765dea49fe004bc045b5"/><file name="Selector.php" hash="ddb7d8305db1c6eeb91a46a30e20b7ef"/></dir><dir name="Helper"><file name="Data.php" hash="02b210e8fb1206c4bc3b76011015cc0c"/><dir name="OneStepCheckout"><file name="Checkout.php" hash="43611a7a485d700e815dd83538a1da5c"/></dir></dir><dir name="Model"><dir name="Carrier"><file name="Abstract.php" hash="e186b3d2f1279bee67f032bdc9fa13e2"/><file name="ShippingMethod.php" hash="7b03a4f9a6d198bfbe7a80ab48343afc"/></dir><file name="Export.php" hash="9537985c9b08dc787f608c8ae8295d48"/><file name="Import.php" hash="307f0d2265fb3889ac206c1338663575"/><file name="Observer.php" hash="1aa00f2011884049e7e515f32cb1c31c"/><dir name="Os2"><dir name="Data"><file name="Abstract.php" hash="cf7d7d51c0908e9b5cc08224ee399636"/><file name="AbstractWithAttributes.php" hash="1aa1eb14f97aa3add7a0b64ef73bfe3b"/><file name="Address.php" hash="7c890ba9f1c53124857afbe6ae2c9f15"/><file name="AddressFilter.php" hash="dd42df6d750b32fd7cd7ac76ce08e3e8"/><file name="AttributeSet.php" hash="5d9c06b56ee855da5489991342b1eca2"/><file name="Billto.php" hash="3244e2dd918527f68ea29433c1c02eaf"/><file name="Cart.php" hash="72c3d3c57a7f366d97a4b4957a34272e"/><file name="CartItem.php" hash="b2067067bbb396d3f7c311d2b023a975"/><file name="Category.php" hash="c140772d71740330fbe66f8f79c7a3a5"/><file name="Customer.php" hash="9a2185b18922472a235fc69f022f00b8"/><file name="CustomerGroup.php" hash="c713d2f93ebbe1208b7d94b0a433b45e"/><file name="Customvar.php" hash="badab1052f9156aef76d5c1a0919348e"/><file name="Date.php" hash="3f93564d011f3f2b7d0caba6a1eddf28"/><file name="Info.php" hash="f2a9302fa56e58c027e7df18e6666ffa"/><file name="Product.php" hash="a48c5d512cc87950c25194fc1fdb27a9"/><file name="Quote.php" hash="9804f0da7dd9255b21d240ff59beed0b"/><file name="Selection.php" hash="b61d47ae7048ee2e86b622f4fb473236"/><file name="StockItem.php" hash="02252936341dd9ed77fa6e7205d43c14"/><file name="Store.php" hash="3d9b4033ff9689d9ed07d5c5fa5b68ad"/></dir></dir><dir name="Sales"><dir name="Quote"><file name="Address.php" hash="a5deb3b930b1559d9da755e6a8597aea"/></dir></dir><file name="Service.php" hash="95c888f5c9cda0def7dbec6c53e2e584"/><dir name="System"><dir name="Config"><dir name="Source"><file name="LoadOnParent.php" hash="9dd7fc02abf059f724220b8dc4559110"/><file name="ProcessChildren.php" hash="5fb9c1cf8600e9ead938869f95016267"/></dir></dir></dir><dir name="Webservice"><file name="PointsRelaisWSService.php" hash="e5d9ee0793a35ef36b110ca07d9701aa"/></dir></dir><dir name="controllers"><file name="AjaxController.php" hash="b1ad9fb42874d6b6fa4680989e74837e"/><file name="ExportController.php" hash="eb64ed12688832c6e6958b0a606c0834"/><file name="ImportController.php" hash="a9800848348b9fb21f6cf869b0588405"/></dir><dir name="etc"><file name="adminhtml.xml" hash="a250aa03bbef4cb0e2016a23d8797eb5"/><file name="config.xml" hash="fe5f6e26dd34ce1aa61f2d0d2e39dcf6"/><file name="system.xml" hash="8e75323226a7bebdba3f876af3cf0dbe"/></dir><dir name="owebia_includes"><file name="OS2_AddressFilter.php" hash="9a436fe014d55491a416adb0d8478d7e"/><file name="OS2_AddressFilterParser_GLS.php" hash="8f53f491dee35100dccfb6769577317d"/><file name="OS2_CustomerGroup.php" hash="55a9f08487bdbb310d0123737e0a7e9c"/><file name="OwebiaShippingHelper_GLS.php" hash="ba24243d0d9c91bcff554b2f625af73d"/><dir name="cache"><file name="countries" hash="6b1a5494b6dddcc65f2946dbf0226c29"/></dir></dir><dir name="sql"><dir name="gls_setup"><file name="mysql4-install-1.0.0.php" hash="f6fc56f69d25c888f2d43ab2cf325660"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="gls.xml" hash="f21000e0cebbd7dc2e41269ca5e26055"/></dir><dir name="template"><dir name="gls"><file name="additional.phtml" hash="0418b6448ee50a094e0611cc6161b5ca"/><file name="listrelais.phtml" hash="435226bbece90126c407c4ff3252ac88"/><file name="selector.phtml" hash="6e5f50efeadad01fc87c23b823c38971"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="gls"><dir name="import"><file name="form.phtml" hash="6881f6dfac3b32fcf2385d517fed80c1"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Addonline_Gls.xml" hash="db260e73c2dad1f28966032a661336bf"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Addonline_Gls.csv" hash="52ac05581936df49399cc5f29cda7eb0"/></dir><dir name="en_US"><file name="Addonline_Gls.csv" hash="96e4b64437cb483e3010ad9c7aa1eb19"/></dir></target><target name="mageweb"><dir name="js"><dir name="jquery"><file name="jquery-1.7.1.min.js" hash="ddb84c1587287b2df08966081ef063bf"/><file name="jquery.noconflict.js" hash="47bba3ca4c65f94846c39e145bed446f"/><file name="jquery.tools.min.js" hash="b0d4ed5c2edf5bcb74cd615ee46feb79"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="gls.css" hash="597cb48748bf3cc24b787dad0eeebb6d"/></dir><dir name="images"><dir name="gls"><file name="btn_fermer.png" hash="58a433ef56074381c61a3bc416605b8b"/><file name="marker.png" hash="4c52822636e198d8e407b143af2eb4b3"/><file name="marker_current.png" hash="9aad92afa544f45be79dd49977c71c54"/><file name="picto-arrow.png" hash="e6c75a88103b56cde0c8f2f5db1abba2"/><file name="picto_relay.png" hash="f80a398509e93b7077b166ddaa755abc"/><file name="picto_tohome.png" hash="42abf1332ac5dcd16673d3b216a2a121"/><file name="picto_toyou.png" hash="066908bd4639344eed0396950bd77895"/><file name="search-repeat.png" hash="ddf661a783afc11958972a86278c818b"/><file name="title-repeat.png" hash="ffc9c726e21a9dc862c29283500aa271"/></dir></dir><dir name="js"><file name="gls.js" hash="37595afc951c0e8bc31803884c57f2a0"/></dir></dir></dir></dir></target></contents>
|
45 |
+
<compatible/>
|
46 |
+
<dependencies><required><php><min>5.2.0</min><max>5.4.0</max></php></required></dependencies>
|
47 |
+
</package>
|
skin/frontend/base/default/css/gls.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
dd.s_method_gls li{position:relative;margin-bottom:20px}dd.s_method_gls li img{position:absolute;top:-8px;left:25px}dd.s_method_gls li input{margin-right:65px}dd.s_method_gls li span.price{color:#f18200}dd.s_method_gls #gls_relais_choisi{margin:0 0 0 82px;border-left:1px solid #d4d4d4;padding:0 0 0 10px;position:relative;line-height:normal;color:#666666}dd.s_method_gls #gls_relais_choisi span{font-weight:bold}dd.s_method_gls #gls_relais_choisi .modifier_relay{color:#1e7ec8;font-weight:normal;text-decoration:underline;cursor:pointer}#layer_gls{position:relative;display:none;width:950px;background:#fff;z-index:1000;text-align:left;border-radius:10px}#layer_gls .close{position:absolute;top:15px;right:15px;cursor:pointer;width:22px;height:22px;background:url(../images/gls/btn_fermer.png)}#layer_gls h3{background:url(../images/gls/title-repeat.png);line-height:58px;margin:-15px -15px 0 -15px;border-radius:10px 10px 0 0;font-size:24px;font-weight:normal;color:#fff;padding-left:70px;position:relative}#layer_gls h3:before{content:"";width:43px;height:32px;position:absolute;top:12px;left:15px;background:url(../images/gls/picto_relay.png)}#layer_gls #gls_headers{background:url(../images/gls/search-repeat.png) repeat-x;margin:0 -15px 15px;padding:0 15px 0 15px;height:57px}#layer_gls #gls_headers .left{margin-top:15px}#layer_gls #gls_headers .left span{font-size:14px;font-weight:bold;color:#06187c;margin-right:10px;vertical-align:middle}#layer_gls #gls_headers .left input{padding:0 10px;width:78px;height:23px;-webkit-border-radius:8px;-moz-border-radius:8px;border-radius:8px 0 0 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}#layer_gls #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;-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}#layer_gls #gls_headers .right{margin-top:15px}#layer_gls #gls_headers .right label{font-size:14px;color:#06187c;margin-right:10px;vertical-align:middle}#layer_gls #gls_headers .right label input{vertical-align:middle}#layer_gls #gls_headers .right #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,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}#layer_gls #col_gauche_gls{width:646px;height:353px;float:left;border:1px solid #d6d8e9}#layer_gls #col_gauche_gls #map_gls{height:100%}#layer_gls #col_gauche_gls #map_gls .info-window{width:415px;line-height:1.35;overflow:hidden;white-space:nowrap}#layer_gls #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{width:255px;margin-top:10px}#layer_gls #col_gauche_gls #map_gls .info-window table .day{width:80px}#layer_gls #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;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}#layer_gls #col_gauche_gls #map_gls .info-window .choose-relay-point:before{content:"";width:7px;height:10px;position:absolute;top:9px;left:12px;background:url(../images/gls/picto-arrow.png)}#layer_gls #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{padding:15px;border-bottom:1px solid #d6d8e9;line-height:normal}#layer_gls #col_droite_gls .gls_point_relay.current{background:#eeeff7}#layer_gls #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 #col_droite_gls .gls_point_relay .GLS_relay_zipcode,#layer_gls #col_droite_gls .gls_point_relay .GLS_relay_city{color:#6a6a6a}#layer_gls #col_droite_gls .gls_point_relay .GLS_relay_address{display:block}#layer_gls #col_droite_gls .gls_point_relay div{margin-top:5px;overflow:hidden}#layer_gls #col_droite_gls .gls_point_relay .GLS_relay_horaires{float:left;color:#06187c;text-decoration:underline;cursor:pointer;margin-top:5px}#layer_gls #col_droite_gls .gls_point_relay .choose-relay-point{border:none;background:none;cursor:pointer;float:right;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:relative}#layer_gls #col_droite_gls .gls_point_relay .choose-relay-point:before{content:"";width:7px;height:10px;position:absolute;top:9px;left:12px;background:url(../images/gls/picto-arrow.png)}#layer_gls #col_droite_gls .gls_point_relay .GLS_relay_latitude,#layer_gls #col_droite_gls .gls_point_relay .GLS_relay_longitude,#layer_gls #col_droite_gls .gls_point_relay .GLS_relay_hours,#layer_gls #col_droite_gls .gls_point_relay .GLS_relay_id,#layer_gls #col_droite_gls .gls_point_relay .GLS_relay_index{display:none}.layer>div>div{overflow:auto}#layer_gls>div>div{padding:15px}#layer_gls .loader-wrapper{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999}#layer_gls .loader{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1000;background:#000;opacity:0.2}#layer_gls .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{display:block;margin:auto}
|
skin/frontend/base/default/images/gls/btn_fermer.png
ADDED
Binary file
|
skin/frontend/base/default/images/gls/marker.png
ADDED
Binary file
|
skin/frontend/base/default/images/gls/marker_current.png
ADDED
Binary file
|
skin/frontend/base/default/images/gls/picto-arrow.png
ADDED
Binary file
|
skin/frontend/base/default/images/gls/picto_relay.png
ADDED
Binary file
|
skin/frontend/base/default/images/gls/picto_tohome.png
ADDED
Binary file
|
skin/frontend/base/default/images/gls/picto_toyou.png
ADDED
Binary file
|
skin/frontend/base/default/images/gls/search-repeat.png
ADDED
Binary file
|
skin/frontend/base/default/images/gls/title-repeat.png
ADDED
Binary file
|
skin/frontend/base/default/js/gls.js
ADDED
@@ -0,0 +1,412 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Copyright (c) 2014 GLS
|
3 |
+
*
|
4 |
+
* NOTICE OF LICENSE
|
5 |
+
*
|
6 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
7 |
+
* It is available through the world-wide-web at this URL:
|
8 |
+
* http://opensource.org/licenses/osl-3.0.php
|
9 |
+
*
|
10 |
+
* @category Addonline
|
11 |
+
* @package Addonline_Gls
|
12 |
+
* @copyright Copyright (c) 2014 GLS
|
13 |
+
* @author Addonline (http://www.addonline.fr)
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
15 |
+
*/
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Fonction startWith sur l'objet String de javascript
|
19 |
+
*/
|
20 |
+
String.prototype.startWith = function(t, i) { if (i==false) { return
|
21 |
+
(t == this.substring(0, t.length)); } else { return (t.toLowerCase()
|
22 |
+
== this.substring(0, t.length).toLowerCase()); } }
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Variables globales
|
26 |
+
*/
|
27 |
+
|
28 |
+
var glsMyPosition;
|
29 |
+
var glsListRelais=new Array();
|
30 |
+
var glsRelayMap;
|
31 |
+
var glsOpenedInfowindow;
|
32 |
+
var glsRelaisChoisi;
|
33 |
+
|
34 |
+
/* Liste des markers */
|
35 |
+
var glsMarkersArray = [];
|
36 |
+
|
37 |
+
/*
|
38 |
+
* Suppression des markers
|
39 |
+
*/
|
40 |
+
function clearMarkers() {
|
41 |
+
for (var i = 0; i < glsMarkersArray.length; i++ ) {
|
42 |
+
glsMarkersArray[i].setMap(null);
|
43 |
+
}
|
44 |
+
glsMarkersArray.length = 0;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Initialisation au chargement de la page
|
49 |
+
*/
|
50 |
+
jQuery(function($) {
|
51 |
+
|
52 |
+
|
53 |
+
// Cas du onestep checkout, si on change l'adresse de livraison après avoir
|
54 |
+
// choisi gls
|
55 |
+
jQuery('.onestepcheckout-index-index .address-select').on("change", function() {
|
56 |
+
if(jQuery('#gls-location').size() <= 0 ){
|
57 |
+
$("#attentionSoColissimo").remove();
|
58 |
+
$("label[for=\"billing-address-select\"]").parent().before('<p id="attentionSoColissimo" style="font-weight:bold;color:red;text-align:justify; padding-right:5px;">Suite à la modification de votre adresse et si votre mode de livraison est So Colissimo, veuillez séléctionner votre point de retrait en cliquant sur le mode de livraison.</p>');
|
59 |
+
}
|
60 |
+
});
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Sur l'événement change des radios boutons de choix de mode de livraison
|
64 |
+
*/
|
65 |
+
$("input[id^=\"s_method_gls\"]").live("click", function() {
|
66 |
+
shippingGLSRadioCheck(this);
|
67 |
+
});
|
68 |
+
|
69 |
+
/*
|
70 |
+
* Evenement sur la modification du point relais
|
71 |
+
*/
|
72 |
+
$(".modifier_relay").live("click", function() {
|
73 |
+
$("input[id^=\"s_method_gls\"]").click();
|
74 |
+
});
|
75 |
+
|
76 |
+
/*
|
77 |
+
* Sur l'évènement de choix de relay
|
78 |
+
*/
|
79 |
+
$('.choose-relay-point').live("click",function(e){
|
80 |
+
e.preventDefault();
|
81 |
+
choisirRelaisGLS($(this).data('relayindex'));
|
82 |
+
});
|
83 |
+
|
84 |
+
/* Seules les saisies numériques sont autorisées dans les champs textes */
|
85 |
+
$("#layer_gls_wrapper #cp_recherche").keypress(function(e) {
|
86 |
+
var charCode = (e.which) ? e.which : e.keyCode;
|
87 |
+
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
|
88 |
+
return false;
|
89 |
+
}
|
90 |
+
return true;
|
91 |
+
});
|
92 |
+
|
93 |
+
initGlsLogos();
|
94 |
+
|
95 |
+
});
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Initialise les logos, descriptions, style sur le radio bouttons gls ceci est
|
99 |
+
* fait en javascript pour ne pas surcharger le template available.phtml et
|
100 |
+
* ainsi éviter des conflits avec d'autres modules. (appelé au chargement du DOM
|
101 |
+
* mais aussi au rechargement ajax (voir Checkout.prototype.setStepResponse dans
|
102 |
+
* gls\additional.phtml)
|
103 |
+
*/
|
104 |
+
function initGlsLogos() {
|
105 |
+
|
106 |
+
jQuery("input[id^=\"s_method_gls\"]").each(function(index, element){
|
107 |
+
|
108 |
+
if(!jQuery("body").hasClass("onestepcheckout-index-index")) {
|
109 |
+
jQuery(element).parents("dd").addClass("s_method_gls");
|
110 |
+
} else {
|
111 |
+
jQuery("input[id^=\"s_method_gls\"]").parents("dt").addClass("s_method_gls");
|
112 |
+
var dd = jQuery("input[id^=\"s_method_gls\"]").eq(0).parents("dt").prev().addClass("s_method_gls-title");
|
113 |
+
}
|
114 |
+
|
115 |
+
var typeGls = getTypeGlsFromRadio(jQuery(element), false);
|
116 |
+
if (typeGls) {
|
117 |
+
var radioParent = jQuery(element).parent();
|
118 |
+
if (radioParent.children('img').size() == 0) {
|
119 |
+
radioParent.prepend('<img src="/skin/frontend/base/default/images/gls/picto_'+typeGls+'.png" >');
|
120 |
+
}
|
121 |
+
|
122 |
+
if (typeGls=='relay') {
|
123 |
+
// si le relais choisi est en session (voir additionnal.phtml),
|
124 |
+
// on l'affiche sous le radio
|
125 |
+
if (jQuery('#gls_relais_choisi_init').size()>0) {
|
126 |
+
jQuery('#gls_relais_choisi_init').appendTo(radioParent).attr('id', 'gls_relais_choisi');
|
127 |
+
} else {
|
128 |
+
// sinon,et si aucun relais n'a été choisi, on décoche le
|
129 |
+
// mode de livraison relais pour forcer à choisir un relais
|
130 |
+
if (jQuery('#gls_relais_choisi').size()==0) {
|
131 |
+
jQuery(element).prop("checked", "");
|
132 |
+
}
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
}
|
137 |
+
});
|
138 |
+
|
139 |
+
}
|
140 |
+
|
141 |
+
function getTypeGlsFromRadio(radio, forDescription) {
|
142 |
+
var shippingMethod = radio.attr("value");
|
143 |
+
var typeGls = shippingMethod.replace("gls_","");
|
144 |
+
if (typeGls.startWith("tohome")) {
|
145 |
+
return 'tohome';
|
146 |
+
} else if (typeGls.startWith("toyou")) {
|
147 |
+
return 'toyou';
|
148 |
+
} else if (typeGls.startWith("relay")){
|
149 |
+
return 'relay';
|
150 |
+
} else {
|
151 |
+
// Sinon c'est un type de livraison inconnu
|
152 |
+
alert("Mauvaise configuration du module GLS : dans le champ configuration le code doit commencer par tohome, toyou ou relay");
|
153 |
+
return false;
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
function shippingGLSRadioCheck(element) {
|
158 |
+
var glsRadio = jQuery(element);
|
159 |
+
var typeGls = getTypeGlsFromRadio(glsRadio, false);
|
160 |
+
if(typeGls == "relay"){
|
161 |
+
// on affiche le picto de chargement étape suivante du opc
|
162 |
+
jQuery("#shipping-method-please-wait").show();
|
163 |
+
glsurl = glsBaseUrl + "selector/"
|
164 |
+
jQuery.ajax({
|
165 |
+
url: glsurl,
|
166 |
+
success: function(data){
|
167 |
+
jQuery("#layer_gls").html(data);
|
168 |
+
jQuery('#gls_relais_choisi').remove();
|
169 |
+
geocoder = new google.maps.Geocoder();
|
170 |
+
geocodeGLSAdresse();
|
171 |
+
}
|
172 |
+
});
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
function resetGLSShippingMethod() {
|
177 |
+
if (jQuery('#gls_relais_choisi').size()==0) {
|
178 |
+
jQuery("input[name='shipping_method']:checked").prop("checked","");
|
179 |
+
}
|
180 |
+
}
|
181 |
+
|
182 |
+
function geocodeGLSAdresse() {
|
183 |
+
|
184 |
+
var searchAdress = jQuery('#cp_recherche').val();
|
185 |
+
if ((typeof google) != "undefined") {
|
186 |
+
var geocoder = new google.maps.Geocoder();
|
187 |
+
geocoder.geocode({'address': searchAdress}, function(results, status) {
|
188 |
+
if (status == google.maps.GeocoderStatus.OK) {
|
189 |
+
glsMyPosition = results[0].geometry.location;
|
190 |
+
// on met à jour la carte avec cette position
|
191 |
+
loadMap();
|
192 |
+
loadListePointRelais();
|
193 |
+
} else {
|
194 |
+
alert('Adresse invalide '+searchAdress);
|
195 |
+
}
|
196 |
+
});
|
197 |
+
} else {
|
198 |
+
alert("Géolocalisation de l'adresse impossible, vérifiez votre connexion internet (Google inaccessible).");
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
function changeMap() {
|
203 |
+
if (glsMyPosition!=undefined) {
|
204 |
+
loadListePointRelais();
|
205 |
+
}
|
206 |
+
}
|
207 |
+
|
208 |
+
function loadListePointRelais() {
|
209 |
+
if(jQuery("#cp_recherche").val()){
|
210 |
+
glsurl = glsBaseUrl + "listPointsRelais"
|
211 |
+
glsurl = glsurl + "/zipcode/" + jQuery("#cp_recherche").val() + "/country/" + "FR";
|
212 |
+
jQuery.ajax({
|
213 |
+
url: glsurl,
|
214 |
+
success: function(data){
|
215 |
+
jQuery("#col_droite_gls").html(data);
|
216 |
+
showGLSMap();
|
217 |
+
}
|
218 |
+
});
|
219 |
+
}
|
220 |
+
}
|
221 |
+
|
222 |
+
function loadMap(){
|
223 |
+
|
224 |
+
mapOptions = {
|
225 |
+
/* zoom: 10, */
|
226 |
+
/* center: glsMyPosition, */
|
227 |
+
mapTypeId: google.maps.MapTypeId.ROADMAP,
|
228 |
+
disableDefaultUI: true,
|
229 |
+
zoomControlOptions: {
|
230 |
+
position: google.maps.ControlPosition.RIGHT_TOP
|
231 |
+
}
|
232 |
+
}
|
233 |
+
|
234 |
+
if( jQuery("#layer_gls").data("overlay") == null ) {
|
235 |
+
jQuery("#layer_gls").overlay({
|
236 |
+
mask: {
|
237 |
+
color: '#000',
|
238 |
+
loadSpeed: 200,
|
239 |
+
opacity: 0.5
|
240 |
+
},
|
241 |
+
load: true,
|
242 |
+
onLoad: function(){ glsRelayMap = new google.maps.Map(document.getElementById('map_gls'), mapOptions); },
|
243 |
+
closeOnClick: false,
|
244 |
+
top: "center",
|
245 |
+
fixed: false,
|
246 |
+
onClose: function(){ jQuery("#layer_gls").html(''); jQuery("#layer_gls").data("overlay",null); resetGLSShippingMethod()}
|
247 |
+
});
|
248 |
+
} else {
|
249 |
+
// glsRelayMap.setCenter(glsMyPosition);
|
250 |
+
}
|
251 |
+
|
252 |
+
jQuery("#shipping-method-please-wait").hide();
|
253 |
+
|
254 |
+
}
|
255 |
+
|
256 |
+
function showGLSMap() {
|
257 |
+
if ((typeof google)!="undefined") {
|
258 |
+
var init = false;
|
259 |
+
// google.maps.event.addListener(glsRelayMap, 'tilesloaded', function ()
|
260 |
+
// {
|
261 |
+
|
262 |
+
// création de bornes vides...
|
263 |
+
var bounds = new google.maps.LatLngBounds();
|
264 |
+
|
265 |
+
if (!init){
|
266 |
+
|
267 |
+
clearMarkers();
|
268 |
+
|
269 |
+
jQuery('.gls_point_relay').each(function(index,element){
|
270 |
+
|
271 |
+
var relayPosition = new google.maps.LatLng(jQuery(this).find('.GLS_relay_latitude').text(), jQuery(this).find('.GLS_relay_longitude').text());
|
272 |
+
markerGLS = new google.maps.Marker({
|
273 |
+
map: glsRelayMap,
|
274 |
+
position: relayPosition,
|
275 |
+
title : jQuery(this).find('.GLS_relay_name').text(),
|
276 |
+
icon : (glsRelaisChoisi == jQuery(this).find('.GLS_relay_id').text())? '/skin/frontend/base/default/images/gls/marker_current.png' : '/skin/frontend/base/default/images/gls/marker.png'
|
277 |
+
});
|
278 |
+
infowindowGLS=infoGLSBulleGenerator(jQuery(this));
|
279 |
+
|
280 |
+
if(glsRelaisChoisi == jQuery(this).find('.GLS_relay_id').text()) {
|
281 |
+
jQuery("#layer_gls .gls_point_relay").removeClass("current").eq(index).addClass("current");
|
282 |
+
jQuery("#col_droite_gls").scrollTop(0).scrollTop(jQuery(".gls_point_relay").eq(index).position().top);
|
283 |
+
}
|
284 |
+
|
285 |
+
// Ajout à la liste des markers
|
286 |
+
glsMarkersArray.push(markerGLS);
|
287 |
+
|
288 |
+
attachGLSClick(markerGLS,infowindowGLS, index);
|
289 |
+
|
290 |
+
// ...étendues à chaque point...
|
291 |
+
bounds.extend(relayPosition);
|
292 |
+
|
293 |
+
});
|
294 |
+
|
295 |
+
// ...pour voir tous les points
|
296 |
+
glsRelayMap.fitBounds(bounds);
|
297 |
+
|
298 |
+
}
|
299 |
+
init=true;
|
300 |
+
// });
|
301 |
+
}
|
302 |
+
}
|
303 |
+
|
304 |
+
// générateur d'infobulle
|
305 |
+
function infoGLSBulleGenerator(relay) {
|
306 |
+
|
307 |
+
contentString = '<div class="info-window">'
|
308 |
+
|
309 |
+
contentString += '<span class="store-name">' + relay.find('.GLS_relay_name').text() + '</span>';
|
310 |
+
|
311 |
+
contentString += '' +
|
312 |
+
relay.find('.GLS_relay_address').text() + '<br/>' +
|
313 |
+
relay.find('.GLS_relay_zipcode').text() + ' ' + relay.find('.GLS_relay_city').text();
|
314 |
+
|
315 |
+
contentString += relay.find('.GLS_relay_hours').html();
|
316 |
+
|
317 |
+
contentString += "<div class='button-wrapper'><a href='#' class='choose-relay-point' data-relayindex="+relay.find('.GLS_relay_index').text()+" data-relayid="+relay.find('.GLS_relay_id').text()+">"+ Translator.translate("Choose this ParcelShop") +"</a></div>";
|
318 |
+
|
319 |
+
contentString += "</div>";
|
320 |
+
|
321 |
+
infowindow = new google.maps.InfoWindow({
|
322 |
+
content: contentString
|
323 |
+
});
|
324 |
+
|
325 |
+
return infowindow;
|
326 |
+
}
|
327 |
+
|
328 |
+
|
329 |
+
function attachGLSClick(markerGLS,infowindowGLS, index){
|
330 |
+
// Clic sur le relais dans la colonne de gauche
|
331 |
+
jQuery("#gls_point_relay_"+index).live("click",function() {
|
332 |
+
clickHandler(markerGLS,infowindowGLS, index);
|
333 |
+
});
|
334 |
+
|
335 |
+
// Clic sur le marqueur du relais dans la carte
|
336 |
+
google.maps.event.addListener(markerGLS, 'click', function() {
|
337 |
+
clickHandler(markerGLS,infowindowGLS, index);
|
338 |
+
});
|
339 |
+
|
340 |
+
}
|
341 |
+
|
342 |
+
function clickHandler(markerGLS,infowindowGLS, index){
|
343 |
+
// fermer la derniere infobulle ouverte
|
344 |
+
if(glsOpenedInfowindow) {
|
345 |
+
glsOpenedInfowindow.close();
|
346 |
+
jQuery("#layer_gls .gls_point_relay").removeClass("current");
|
347 |
+
}
|
348 |
+
// ouvrir l'infobulle
|
349 |
+
infowindowGLS.open(glsRelayMap,markerGLS);
|
350 |
+
glsOpenedInfowindow=infowindowGLS;
|
351 |
+
|
352 |
+
// Mise en évidence du relais dans la liste
|
353 |
+
jQuery("#layer_gls .gls_point_relay").removeClass("current").eq(index).addClass("current");
|
354 |
+
console.log(jQuery(".gls_point_relay").eq(index).position().top);
|
355 |
+
jQuery("#col_droite_gls").scrollTop(0).scrollTop(jQuery(".gls_point_relay").eq(index).position().top);
|
356 |
+
|
357 |
+
}
|
358 |
+
|
359 |
+
function choisirRelaisGLS(index) {
|
360 |
+
|
361 |
+
// resetShippingMethod();
|
362 |
+
jQuery("select[name='shipping_address_id']").prop('selectedIndex',0);
|
363 |
+
jQuery("select[name='shipping_address_id'] option[value='']").prop('selectedIndex',0);
|
364 |
+
|
365 |
+
// if(jQuery("#sms_checkbox").is(":checked")) {
|
366 |
+
v= jQuery("#num_telephone").val();
|
367 |
+
// if (!(/^0(6|7)\d{8}$/.test(v)) ||
|
368 |
+
// (/^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))
|
369 |
+
// ) {
|
370 |
+
if(!v){
|
371 |
+
alert( Translator.translate("Please provide a valide phone number.") );
|
372 |
+
return;
|
373 |
+
}
|
374 |
+
// }
|
375 |
+
var contenu_html = "<div id='gls_relais_choisi'><span>"+jQuery('#gls_point_relay_'+index).find('.GLS_relay_name').text()+"</span>" +" <span class='modifier_relay'>" + Translator.translate("Change ParcelShop") + "</span>" + "<br/>"+jQuery('#gls_point_relay_'+index).find('.GLS_relay_address').text()+"<br/>"+jQuery('#gls_point_relay_'+index).find('.GLS_relay_zipcode').text()+" "+jQuery('#gls_point_relay_'+index).find('.GLS_relay_city').text() + "</div>";
|
376 |
+
jQuery("input[id^=\"s_method_gls_relay_\"]").each(function(index, element){
|
377 |
+
jQuery(element).parent().append(contenu_html);
|
378 |
+
});
|
379 |
+
/* On stock en session les informations du relais */
|
380 |
+
|
381 |
+
if(jQuery("#sms_checkbox").is(":checked") && jQuery("#num_telephone").val() != ""){
|
382 |
+
var warnbyphone = 1;
|
383 |
+
}else{
|
384 |
+
var warnbyphone = 0;
|
385 |
+
}
|
386 |
+
|
387 |
+
glsRelaisChoisi = jQuery('#gls_point_relay_'+index).find('.GLS_relay_id').text();
|
388 |
+
|
389 |
+
// On cache le layer
|
390 |
+
jQuery("#layer_gls").data("overlay").close();
|
391 |
+
|
392 |
+
glsurl = glsBaseUrl + "saveInSessionRelayInformations/"
|
393 |
+
jQuery.ajax({
|
394 |
+
url: glsurl,
|
395 |
+
data: { // <-- just pass an object
|
396 |
+
name: jQuery('#gls_point_relay_'+index).find('.GLS_relay_name').text(),
|
397 |
+
address: jQuery('#gls_point_relay_'+index).find('.GLS_relay_address').text(),
|
398 |
+
city : jQuery('#gls_point_relay_'+index).find('.GLS_relay_city').text(),
|
399 |
+
zipcode : jQuery('#gls_point_relay_'+index).find('.GLS_relay_zipcode').text(),
|
400 |
+
relayId : jQuery('#gls_point_relay_'+index).find('.GLS_relay_id').text(),
|
401 |
+
phone : jQuery("#num_telephone").val(),
|
402 |
+
warnbyphone : warnbyphone,
|
403 |
+
},
|
404 |
+
dataType: 'json',
|
405 |
+
success: function(){
|
406 |
+
// On fait la sauvegarde de la méthode de livraison
|
407 |
+
shippingMethod.save();
|
408 |
+
}
|
409 |
+
});
|
410 |
+
}
|
411 |
+
|
412 |
+
|