MondialRelay_Pointsrelais - Version 1.3.0

Version Notes

version spécifique a magento >= 1.4.1
ajout de colisDrive
ajout d'une option fdp gratuit a partir d'un certain montant.

Download this release

Release Info

Developer Magento Core Team
Extension MondialRelay_Pointsrelais
Version 1.3.0
Comparing to
See all releases


Code changes from version 1.2.3 to 1.3.0

Files changed (26) hide show
  1. app/code/community/MondialRelay/Pointsrelais/Block/Sales/Order/Shipment/View.php +1 -1
  2. app/code/community/MondialRelay/Pointsrelais/Block/Sales/Shipment/Grid.php +46 -34
  3. app/code/community/MondialRelay/Pointsrelais/Block/Sales/Shipment/Grid.php.old +175 -0
  4. app/code/community/MondialRelay/Pointsrelais/Block/System/Config/Form.php +1 -0
  5. app/code/community/MondialRelay/Pointsrelais/Block/System/Config/Form/Field/Exportpointsrelaiscd.php +54 -0
  6. app/code/community/MondialRelay/Pointsrelais/Helper/Data.php +108 -1
  7. app/code/community/MondialRelay/Pointsrelais/Model/Carrier/Pointsrelais.php +16 -17
  8. app/code/community/MondialRelay/Pointsrelais/Model/Carrier/Pointsrelaiscd.php +176 -0
  9. app/code/community/MondialRelay/Pointsrelais/Model/Carrier/Pointsrelaisld1.php +18 -11
  10. app/code/community/MondialRelay/Pointsrelais/Model/Carrier/Pointsrelaislds.php +18 -11
  11. app/code/community/MondialRelay/Pointsrelais/Model/Mysql4/Carrier/Pointsrelaiscd.php +374 -0
  12. app/code/community/MondialRelay/Pointsrelais/Model/Mysql4/Carrier/Pointsrelaiscd/Collection.php +48 -0
  13. app/code/community/MondialRelay/Pointsrelais/Model/System/Config/Backend/Shipping/Pointsrelaiscd.php +8 -0
  14. app/code/community/MondialRelay/Pointsrelais/Model/System/Config/Source/Shipping/Pointsrelaiscd.php +18 -0
  15. app/code/community/MondialRelay/Pointsrelais/controllers/Sales/ImpressionController.php +2 -2
  16. app/code/community/MondialRelay/Pointsrelais/controllers/Sales/Order/ShipmentController.php +77 -1
  17. app/code/community/MondialRelay/Pointsrelais/controllers/System/ConfigController.php +5 -0
  18. app/code/community/MondialRelay/Pointsrelais/etc/config.xml +76 -2
  19. app/code/community/MondialRelay/Pointsrelais/etc/system.xml +338 -1
  20. app/code/community/MondialRelay/Pointsrelais/sql/pointsrelais_setup/{mysql4-update-1.0.4.php → mysql4-upgrade-0.1.0-1.0.4.php} +0 -0
  21. app/code/community/MondialRelay/Pointsrelais/sql/pointsrelais_setup/{mysql4-update-1.2.0.php → mysql4-upgrade-1.0.4-1.2.0.php} +0 -0
  22. app/code/community/MondialRelay/Pointsrelais/sql/pointsrelais_setup/mysql4-upgrade-1.2.4-1.3.0.php +54 -0
  23. app/design/adminhtml/default/mondialrelay/template/sales/order/invoice/create/form.phtml +111 -0
  24. app/design/adminhtml/default/mondialrelay/template/sales/order/invoice/create/tracking.phtml +116 -0
  25. app/design/adminhtml/default/mondialrelay/template/sales/order/shipment/create/form.phtml +88 -0
  26. package.xml +7 -5
app/code/community/MondialRelay/Pointsrelais/Block/Sales/Order/Shipment/View.php CHANGED
@@ -50,7 +50,7 @@ class MondialRelay_Pointsrelais_Block_Sales_Order_Shipment_View extends Mage_Adm
50
  //Ajout de l'impression de l'étiquette
51
  $_order = $this->getShipment()->getOrder();
52
  $_shippingMethod = explode("_",$_order->getShippingMethod());
53
- if (($_shippingMethod[0] == 'pointsrelais') || ($_shippingMethod[0] == 'pointsrelaisld1') || ($_shippingMethod[0] == 'pointsrelaislds')) {
54
  $this->_addButton('etiquette', array(
55
  'label' => Mage::helper('pointsrelais')->__('Etiquette Mondial Relay'),
56
  'class' => 'save',
50
  //Ajout de l'impression de l'étiquette
51
  $_order = $this->getShipment()->getOrder();
52
  $_shippingMethod = explode("_",$_order->getShippingMethod());
53
+ if (($_shippingMethod[0] == 'pointsrelais') || ($_shippingMethod[0] == 'pointsrelaiscd') || ($_shippingMethod[0] == 'pointsrelaisld1') || ($_shippingMethod[0] == 'pointsrelaislds')) {
54
  $this->_addButton('etiquette', array(
55
  'label' => Mage::helper('pointsrelais')->__('Etiquette Mondial Relay'),
56
  'class' => 'save',
app/code/community/MondialRelay/Pointsrelais/Block/Sales/Shipment/Grid.php CHANGED
@@ -36,23 +36,25 @@ class MondialRelay_Pointsrelais_Block_Sales_Shipment_Grid extends Mage_Adminhtml
36
  {
37
  parent::__construct();
38
  $this->setId('sales_shipment_grid');
39
- $this->setDefaultSort('created_at');
40
  $this->setDefaultDir('DESC');
41
  }
42
 
 
 
 
 
 
 
 
 
 
 
43
  protected function _prepareCollection()
44
  {
45
- $collection = Mage::getResourceModel('sales/order_shipment_collection')
46
- ->addAttributeToSelect('increment_id')
47
- ->addAttributeToSelect('created_at')
48
- ->addAttributeToSelect('total_qty')
49
- ->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left')
50
- ->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left')
51
- ->joinAttribute('order_increment_id', 'order/increment_id', 'order_id', null, 'left')
52
- ->joinAttribute('order_created_at', 'order/created_at', 'order_id', null, 'left')
53
- ->joinAttribute('shipping_carrier', 'order/shipping_method', 'order_id', null, 'left')
54
- ->addAttributeToFilter('shipping_carrier',array('like'=>'pointsrelais%'))
55
- ;
56
  $this->setCollection($collection);
57
  return parent::_prepareCollection();
58
  }
@@ -62,12 +64,12 @@ class MondialRelay_Pointsrelais_Block_Sales_Shipment_Grid extends Mage_Adminhtml
62
  $this->addColumn('increment_id', array(
63
  'header' => Mage::helper('sales')->__('Shipment #'),
64
  'index' => 'increment_id',
65
- 'type' => 'number',
66
  ));
67
 
68
- $this->addColumn('created_at', array(
69
  'header' => Mage::helper('sales')->__('Date Shipped'),
70
- 'index' => 'created_at',
71
  'type' => 'datetime',
72
  ));
73
 
@@ -83,14 +85,9 @@ class MondialRelay_Pointsrelais_Block_Sales_Shipment_Grid extends Mage_Adminhtml
83
  'type' => 'datetime',
84
  ));
85
 
86
- $this->addColumn('shipping_firstname', array(
87
- 'header' => Mage::helper('sales')->__('Ship to First name'),
88
- 'index' => 'shipping_firstname',
89
- ));
90
-
91
- $this->addColumn('shipping_lastname', array(
92
- 'header' => Mage::helper('sales')->__('Ship to Last name'),
93
- 'index' => 'shipping_lastname',
94
  ));
95
 
96
  $this->addColumn('total_qty', array(
@@ -98,30 +95,44 @@ class MondialRelay_Pointsrelais_Block_Sales_Shipment_Grid extends Mage_Adminhtml
98
  'index' => 'total_qty',
99
  'type' => 'number',
100
  ));
101
- $this->addColumn('download', array(
102
- 'header' => Mage::helper('pointsrelais')->__('Etiquettes'),
 
 
 
 
 
 
 
 
 
103
  'type' => 'action',
104
  'getter' => 'getId',
105
  'actions' => array(
106
  array(
107
- 'caption' => Mage::helper('pointsrelais')->__('Imprimer'),
108
- 'url' => array(
109
- 'base'=>'pointsrelais/sales_impression/print'
110
- ),
111
  'field' => 'shipment_id'
112
  )
113
  ),
114
  'filter' => false,
115
  'sortable' => false,
116
- 'index' => 'stores'
117
  ));
118
 
 
 
 
119
  return parent::_prepareColumns();
120
  }
121
 
122
  public function getRowUrl($row)
123
  {
124
- return $this->getUrl('adminhtml/sales_shipment/view',
 
 
 
 
125
  array(
126
  'shipment_id'=> $row->getId(),
127
  )
@@ -132,7 +143,8 @@ class MondialRelay_Pointsrelais_Block_Sales_Shipment_Grid extends Mage_Adminhtml
132
  {
133
  $this->setMassactionIdField('entity_id');
134
  $this->getMassactionBlock()->setFormFieldName('shipment_ids');
135
-
 
136
  // Impression des étiquettes
137
  $this->getMassactionBlock()->addItem('pdfshipments_order', array(
138
  'label'=> Mage::helper('sales')->__('Imprimer les étiquettes'),
@@ -144,7 +156,7 @@ class MondialRelay_Pointsrelais_Block_Sales_Shipment_Grid extends Mage_Adminhtml
144
 
145
  public function getGridUrl()
146
  {
147
- return $this->getUrl('adminhtml/sales_shipment/*', array('_current' => true));
148
  }
149
 
150
- }
36
  {
37
  parent::__construct();
38
  $this->setId('sales_shipment_grid');
39
+ $this->setDefaultSort('order_created_at');
40
  $this->setDefaultDir('DESC');
41
  }
42
 
43
+ /**
44
+ * Retrieve collection class
45
+ *
46
+ * @return string
47
+ */
48
+ protected function _getCollectionClass()
49
+ {
50
+ return 'sales/order_shipment_grid_collection';
51
+ }
52
+
53
  protected function _prepareCollection()
54
  {
55
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
56
+ $collection->getSelect()->columns(array('shipment_created_at' => 'main_table.created_at'));
57
+ $collection->getSelect()->joinInner(array('ost' => $collection->getTable('sales/shipment_track')), 'main_table.order_id = ost.parent_id');
 
 
 
 
 
 
 
 
58
  $this->setCollection($collection);
59
  return parent::_prepareCollection();
60
  }
64
  $this->addColumn('increment_id', array(
65
  'header' => Mage::helper('sales')->__('Shipment #'),
66
  'index' => 'increment_id',
67
+ 'type' => 'text',
68
  ));
69
 
70
+ $this->addColumn('shipment_created_at', array(
71
  'header' => Mage::helper('sales')->__('Date Shipped'),
72
+ 'index' => 'shipment_created_at',
73
  'type' => 'datetime',
74
  ));
75
 
85
  'type' => 'datetime',
86
  ));
87
 
88
+ $this->addColumn('shipping_name', array(
89
+ 'header' => Mage::helper('sales')->__('Ship to Name'),
90
+ 'index' => 'shipping_name',
 
 
 
 
 
91
  ));
92
 
93
  $this->addColumn('total_qty', array(
95
  'index' => 'total_qty',
96
  'type' => 'number',
97
  ));
98
+
99
+ $this->addColumn('title', array(
100
+ 'header' => Mage::helper('sales')->__('Mode de transport'),
101
+ 'index' => 'title',
102
+ 'type' => 'text',
103
+ ));
104
+
105
+ $this->addColumn('action',
106
+ array(
107
+ 'header' => Mage::helper('sales')->__('Action'),
108
+ 'width' => '50px',
109
  'type' => 'action',
110
  'getter' => 'getId',
111
  'actions' => array(
112
  array(
113
+ 'caption' => Mage::helper('sales')->__('View'),
114
+ 'url' => array('base'=>'*/sales_shipment/view'),
 
 
115
  'field' => 'shipment_id'
116
  )
117
  ),
118
  'filter' => false,
119
  'sortable' => false,
120
+ 'is_system' => true
121
  ));
122
 
123
+ $this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
124
+ $this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel'));
125
+
126
  return parent::_prepareColumns();
127
  }
128
 
129
  public function getRowUrl($row)
130
  {
131
+ if (!Mage::getSingleton('admin/session')->isAllowed('sales/order/shipment')) {
132
+ return false;
133
+ }
134
+
135
+ return $this->getUrl('*/sales_shipment/view',
136
  array(
137
  'shipment_id'=> $row->getId(),
138
  )
143
  {
144
  $this->setMassactionIdField('entity_id');
145
  $this->getMassactionBlock()->setFormFieldName('shipment_ids');
146
+ $this->getMassactionBlock()->setUseSelectAll(false);
147
+
148
  // Impression des étiquettes
149
  $this->getMassactionBlock()->addItem('pdfshipments_order', array(
150
  'label'=> Mage::helper('sales')->__('Imprimer les étiquettes'),
156
 
157
  public function getGridUrl()
158
  {
159
+ return $this->getUrl('*/*/*', array('_current' => true));
160
  }
161
 
162
+ }
app/code/community/MondialRelay/Pointsrelais/Block/Sales/Shipment/Grid.php.old ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Adminhtml
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adminhtml sales orders grid
29
+ *
30
+ * @author Magento Core Team <core@magentocommerce.com>
31
+ */
32
+ class MondialRelay_Pointsrelais_Block_Sales_Shipment_Grid extends Mage_Adminhtml_Block_Widget_Grid
33
+ {
34
+
35
+ public function __construct()
36
+ {
37
+ parent::__construct();
38
+ $this->setId('sales_shipment_grid');
39
+ $this->setDefaultSort('created_at');
40
+ $this->setDefaultDir('DESC');
41
+ }
42
+
43
+ // protected function _prepareCollection()
44
+ // {
45
+ // $collection = Mage::getResourceModel('sales/order_shipment_collection')
46
+ // ->addAttributeToSelect('increment_id')
47
+ // ->addAttributeToSelect('created_at')
48
+ // ->addAttributeToSelect('total_qty')
49
+ // ->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left')
50
+ // ->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left')
51
+ // ->joinAttribute('order_increment_id', 'order/increment_id', 'order_id', null, 'left')
52
+ // ->joinAttribute('order_created_at', 'order/created_at', 'order_id', null, 'left')
53
+ // ->joinAttribute('shipping_carrier', 'order/shipping_method', 'order_id', null, 'left')
54
+ // ->addAttributeToFilter('shipping_carrier',array('like'=>'pointsrelais%'))
55
+ // ;
56
+ // $this->setCollection($collection);
57
+ // return parent::_prepareCollection();
58
+ // }
59
+
60
+ /**
61
+ * Retrieve collection class
62
+ *
63
+ * @return string
64
+ */
65
+ protected function _getCollectionClass()
66
+ {
67
+ return 'sales/order_shipment_track_collection';
68
+ }
69
+
70
+ protected function _prepareCollection()
71
+ {
72
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
73
+ $collection->addAttributeToFilter('carrier_code',array('like'=>'pointsrelais%'))
74
+ ->joinAttribute('order_increment_id', 'order/increment_id', 'order_id', null, 'left')
75
+ ->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left')
76
+ ->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left');
77
+ $collection->load();
78
+ // $collection->addAttributeToSelect('shipping_method');
79
+ // Mage::Log($collection->getSelect());
80
+ $this->setCollection($collection);
81
+ return parent::_prepareCollection();
82
+ }
83
+
84
+ protected function _prepareColumns()
85
+ {
86
+ $this->addColumn('parent_id', array(
87
+ 'header' => Mage::helper('sales')->__('Shipment #'),
88
+ 'index' => 'parent_id',
89
+ 'type' => 'text',
90
+ ));
91
+
92
+ $this->addColumn('created_at', array(
93
+ 'header' => Mage::helper('sales')->__('Date Shipped'),
94
+ 'index' => 'created_at',
95
+ 'type' => 'datetime',
96
+ ));
97
+
98
+ $this->addColumn('order_increment_id', array(
99
+ 'header' => Mage::helper('sales')->__('Order #'),
100
+ 'index' => 'order_increment_id',
101
+ 'type' => 'text',
102
+ ));
103
+
104
+ $this->addColumn('order_created_at', array(
105
+ 'header' => Mage::helper('sales')->__('Order Date'),
106
+ 'index' => 'order_created_at',
107
+ 'type' => 'datetime',
108
+ ));
109
+
110
+ $this->addColumn('shipping_firstname', array(
111
+ 'header' => Mage::helper('sales')->__('Firstname'),
112
+ 'index' => 'shipping_firstname',
113
+ ));
114
+
115
+ $this->addColumn('shipping_lastname', array(
116
+ 'header' => Mage::helper('sales')->__('Lastname'),
117
+ 'index' => 'shipping_lastname',
118
+ ));
119
+
120
+ $this->addColumn('number', array(
121
+ 'header' => Mage::helper('sales')->__('Tracking'),
122
+ 'index' => 'number',
123
+ ));
124
+
125
+
126
+ $this->addColumn('download', array(
127
+ 'header' => Mage::helper('pointsrelais')->__('Etiquettes'),
128
+ 'type' => 'action',
129
+ 'getter' => 'getParentId',
130
+ 'actions' => array(
131
+ array(
132
+ 'caption' => Mage::helper('pointsrelais')->__('Imprimer'),
133
+ 'url' => array(
134
+ 'base'=>'pointsrelais/sales_impression/print'
135
+ ),
136
+ 'field' => 'shipment_id'
137
+ )
138
+ ),
139
+ 'filter' => false,
140
+ 'sortable' => false,
141
+ 'index' => 'stores'
142
+ ));
143
+
144
+ return parent::_prepareColumns();
145
+ }
146
+
147
+ public function getRowUrl($row)
148
+ {
149
+ return $this->getUrl('adminhtml/sales_shipment/view',
150
+ array(
151
+ 'shipment_id'=> $row->getParentId(),
152
+ )
153
+ );
154
+ }
155
+
156
+ protected function _prepareMassaction()
157
+ {
158
+ $this->setMassactionIdField('entity_id');
159
+ $this->getMassactionBlock()->setFormFieldName('shipment_ids');
160
+
161
+ // Impression des étiquettes
162
+ $this->getMassactionBlock()->addItem('pdfshipments_order', array(
163
+ 'label'=> Mage::helper('sales')->__('Imprimer les étiquettes'),
164
+ 'url' => $this->getUrl('pointsrelais/sales_impression/printMass'),
165
+ ));
166
+
167
+ return $this;
168
+ }
169
+
170
+ public function getGridUrl()
171
+ {
172
+ return $this->getUrl('adminhtml/sales_shipment/*', array('_current' => true));
173
+ }
174
+
175
+ }
app/code/community/MondialRelay/Pointsrelais/Block/System/Config/Form.php CHANGED
@@ -48,6 +48,7 @@ class MondialRelay_Pointsrelais_Block_System_Config_Form extends Mage_Adminhtml_
48
  'allowspecific' => Mage::getConfig()->getBlockClassName('adminhtml/system_config_form_field_select_allowspecific'),
49
  'image' => Mage::getConfig()->getBlockClassName('adminhtml/system_config_form_field_image'),
50
  'export_pointsrelais' => Mage::getConfig()->getBlockClassName('pointsrelais/system_config_form_field_exportpointsrelais'),
 
51
  'export_pointsrelaisld1' => Mage::getConfig()->getBlockClassName('pointsrelais/system_config_form_field_exportpointsrelaisld1'),
52
  'export_pointsrelaislds' => Mage::getConfig()->getBlockClassName('pointsrelais/system_config_form_field_exportpointsrelaislds')
53
  );
48
  'allowspecific' => Mage::getConfig()->getBlockClassName('adminhtml/system_config_form_field_select_allowspecific'),
49
  'image' => Mage::getConfig()->getBlockClassName('adminhtml/system_config_form_field_image'),
50
  'export_pointsrelais' => Mage::getConfig()->getBlockClassName('pointsrelais/system_config_form_field_exportpointsrelais'),
51
+ 'export_pointsrelaiscd' => Mage::getConfig()->getBlockClassName('pointsrelais/system_config_form_field_exportpointsrelaiscd'),
52
  'export_pointsrelaisld1' => Mage::getConfig()->getBlockClassName('pointsrelais/system_config_form_field_exportpointsrelaisld1'),
53
  'export_pointsrelaislds' => Mage::getConfig()->getBlockClassName('pointsrelais/system_config_form_field_exportpointsrelaislds')
54
  );
app/code/community/MondialRelay/Pointsrelais/Block/System/Config/Form/Field/Exportpointsrelaiscd.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Adminhtml
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Export CSV button for shipping table rates
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Adminhtml
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class MondialRelay_Pointsrelais_Block_System_Config_Form_Field_Exportpointsrelaiscd extends Varien_Data_Form_Element_Abstract
35
+ {
36
+ public function getElementHtml()
37
+ {
38
+ $buttonBlock = $this->getForm()->getParent()->getLayout()->createBlock('adminhtml/widget_button');
39
+
40
+ $params = array(
41
+ 'website' => $buttonBlock->getRequest()->getParam('website')
42
+ );
43
+
44
+ $data = array(
45
+ 'label' => Mage::helper('adminhtml')->__('Export CSV'),
46
+ 'onclick' => 'setLocation(\''.Mage::helper('adminhtml')->getUrl("pointsrelais/system_config/exportcd", $params) . 'conditionName/\' + $(\'carriers_pointsrelaiscd_condition_name\').value + \'/tablerates.csv\' )',
47
+ 'class' => '',
48
+ );
49
+
50
+ $html = $buttonBlock->setData($data)->toHtml();
51
+
52
+ return $html;
53
+ }
54
+ }
app/code/community/MondialRelay/Pointsrelais/Helper/Data.php CHANGED
@@ -5,4 +5,111 @@
5
 
6
  class MondialRelay_Pointsrelais_Helper_Data extends Mage_Core_Helper_Abstract
7
  {
8
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  class MondialRelay_Pointsrelais_Helper_Data extends Mage_Core_Helper_Abstract
7
  {
8
+
9
+ protected $_statArray = array(
10
+ "1"=>"Enseigne invalide",
11
+ "2"=>"Num�ro d'enseigne vide ou inexistant",
12
+ "3"=>"Num�ro de compte enseigne invalide",
13
+ "4"=>"",
14
+ "5"=>"Num�ro de dossier enseigne invalide",
15
+ "6"=>"",
16
+ "7"=>"Num�ro de client enseigne invalide",
17
+ "8"=>"",
18
+ "9"=>"Nom de ville non reconnu ou non unique",
19
+ "10"=>"Type de collecte invalide ou incorrect (1/D > Domicile -- 3/R > Relais)",
20
+ "11"=>"Num�ro de Point Relais de collecte invalide",
21
+ "12"=>"Pays du Point Relais de collecte invalide",
22
+ "13"=>"Type de livraison invalide ou incorrect (1/D > Domicile -- 3/R > Relais)",
23
+ "14"=>"Num�ro du Point Relais de livraison invalide",
24
+ "15"=>"Pays du Point Relais de livraison invalide",
25
+ "16"=>"Code pays invalide",
26
+ "17"=>"Adresse invalide",
27
+ "18"=>"Ville invalide",
28
+ "19"=>"Code postal invalide",
29
+ "20"=>"Poids du colis invalide",
30
+ "21"=>"Taille (Longueur + Hauteur) du colis invalide",
31
+ "22"=>"Taille du Colis invalide","23"=>"",
32
+ "24"=>"Num�ro de Colis Mondial Relay invalide",
33
+ "25"=>"",
34
+ "26"=>"",
35
+ "27"=>"",
36
+ "28"=>"Mode de collecte invalide",
37
+ "29"=>"Mode de livraison invalide",
38
+ "30"=>"Adresse (L1) de l'exp�diteur invalide",
39
+ "31"=>"Adresse (L2) de l'exp�diteur invalide",
40
+ "32"=>"",
41
+ "33"=>"Adresse (L3) de l'exp�diteur invalide",
42
+ "34"=>"Adresse (L4) de l'exp�diteur invalide",
43
+ "35"=>"Ville de l'exp�diteur invalide",
44
+ "36"=>"Code postal de l'exp�diteur invalide",
45
+ "37"=>"Pays de l'exp�diteur invalide",
46
+ "38"=>"Num�ro de t�l�phone de l'exp�diteur invalide",
47
+ "39"=>"Adresse e-mail de l'exp�diteur invalide",
48
+ "40"=>"Action impossible sans ville ni code postal",
49
+ "41"=>"Mode de livraison invalide",
50
+ "42"=>"Montant CRT invalide",
51
+ "43"=>"Devise CRT invalide",
52
+ "44"=>"Valeur du colis invalide",
53
+ "45"=>"Devise de la valeur du colis invalide",
54
+ "46"=>"Plage de num�ro d'exp�dition �puis�e",
55
+ "47"=>"Nombre de colis invalide",
56
+ "48"=>"Multi-colis en Point Relais Interdit",
57
+ "49"=>"Mode de collecte ou de livraison invalide",
58
+ "50"=>"Adresse (L1) du destinataire invalide",
59
+ "51"=>"Adresse (L2) du destinataire invalide",
60
+ "52"=>"",
61
+ "53"=>"Adresse (L3) du destinataire invalide",
62
+ "54"=>"Adresse (L4) du destinataire invalide",
63
+ "55"=>"Ville du destinataire invalide",
64
+ "56"=>"Code postal du destinataire invalide",
65
+ "57"=>"Pays du destinataire invalide",
66
+ "58"=>"Num�ro de t�l�phone du destinataire invalide",
67
+ "59"=>"Adresse e-mail du destinataire invalide",
68
+ "60"=>"Champ texte libre invalide",
69
+ "61"=>"Top avisage invalide",
70
+ "62"=>"Instruction de livraison invalide",
71
+ "63"=>"Assurance invalide ou incorrecte",
72
+ "64"=>"Temps de montage invalide",
73
+ "65"=>"Top rendez-vous invalide",
74
+ "66"=>"Top reprise invalide",
75
+ "67"=>"",
76
+ "68"=>"",
77
+ "69"=>"",
78
+ "70"=>"Num�ro de Point Relais invalide",
79
+ "71"=>"",
80
+ "72"=>"Langue exp�diteur invalide",
81
+ "73"=>"Langue destinataire invalide",
82
+ "74"=>"Langue invalide",
83
+ "75"=>"",
84
+ "76"=>"",
85
+ "77"=>"",
86
+ "78"=>"",
87
+ "79"=>"",
88
+ "80"=>"Code tracing : Colis enregistr�",
89
+ "81"=>"Code tracing : Colis en traitement chez Mondial Relay",
90
+ "82"=>"Code tracing : Colis livr�",
91
+ "83"=>"Code tracing : Anomalie",
92
+ "84"=>"(R�serv� Code Tracing)",
93
+ "85"=>"(R�serv� Code Tracing)",
94
+ "86"=>"(R�serv� Code Tracing)",
95
+ "87"=>"(R�serv� Code Tracing)",
96
+ "88"=>"(R�serv� Code Tracing)",
97
+ "89"=>"(R�serv� Code Tracing)",
98
+ "90"=>"AS400 indisponible",
99
+ "91"=>"Num�ro d'exp�dition invalide",
100
+ "92"=>"",
101
+ "93"=>"Aucun �l�ment retourn� par le plan de tri",
102
+ "94"=>"Colis Inexistant",
103
+ "95"=>"Compte Enseigne non activ�",
104
+ "96"=>"Type d'enseigne incorrect en Base",
105
+ "97"=>"Cl� de s�curit� invalide",
106
+ "98"=>"Service Indisponible",
107
+ "99"=>"Erreur g�n�rique du service"
108
+ );
109
+
110
+ public function convertStatToTxt($stat){
111
+ return $_statArray[$stat];
112
+ }
113
+
114
+ }
115
+
app/code/community/MondialRelay/Pointsrelais/Model/Carrier/Pointsrelais.php CHANGED
@@ -5,20 +5,19 @@ class MondialRelay_Pointsrelais_Model_Carrier_Pointsrelais extends Mage_Shipping
5
 
6
  public function collectRates(Mage_Shipping_Model_Rate_Request $request)
7
  {
8
- if (!$this->getConfigFlag('active')) {
9
- return false;
10
- }
11
 
12
- // Permet de désactiver le module pour le multi-shipping
13
 
14
- if (Mage::getSingleton('checkout/session')->getQuote()->getIsMultiShipping())
15
- {
16
- return false;
17
- }
 
 
 
 
 
18
 
19
  $request->setConditionName($this->getConfigData('condition_name') ? $this->getConfigData('condition_name') : $this->_default_condition_name);
20
-
21
- $result = Mage::getModel('shipping/rate_result');
22
 
23
  if($this->getConfigData('package_weight')){
24
  $request->_data['package_weight'] = $request->_data['package_weight']+($this->getConfigData('package_weight')/1000);
@@ -67,16 +66,16 @@ class MondialRelay_Pointsrelais_Model_Carrier_Pointsrelais extends Mage_Shipping
67
  $method->setMethod($point_relais->Num);
68
  $method->setMethodTitle($methodTitle);
69
 
70
- // if($cartTmp > 34 && $weghtTmp > 0.101){
71
- // $price = $rate['price'] = 0;
72
- // $rate['cost'] = 0;
73
- // $method->setPrice($price);
74
- // $method->setCost($rate['cost']);
75
- // }else{
76
  $price = $rate['price'];
77
  $method->setPrice($this->getFinalPriceWithHandlingFee($price));
78
  $method->setCost($rate['cost']);
79
- // }
80
 
81
  $result->append($method);
82
  }
5
 
6
  public function collectRates(Mage_Shipping_Model_Rate_Request $request)
7
  {
 
 
 
8
 
 
9
 
10
+ $result = Mage::getModel('shipping/rate_result');
11
+ if (!$this->getConfigData('active')) {
12
+ return $result;
13
+ }
14
+
15
+ $shipping_free_cart_price = null;
16
+ if ($this->getConfigData('free_active')) {
17
+ $shipping_free_cart_price = $this->getConfigData('free_price');
18
+ }
19
 
20
  $request->setConditionName($this->getConfigData('condition_name') ? $this->getConfigData('condition_name') : $this->_default_condition_name);
 
 
21
 
22
  if($this->getConfigData('package_weight')){
23
  $request->_data['package_weight'] = $request->_data['package_weight']+($this->getConfigData('package_weight')/1000);
66
  $method->setMethod($point_relais->Num);
67
  $method->setMethodTitle($methodTitle);
68
 
69
+ if($shipping_free_cart_price != null && ($cartTmp > $shipping_free_cart_price && $weghtTmp > 0.101)){
70
+ $price = $rate['price'] = 0;
71
+ $rate['cost'] = 0;
72
+ $method->setPrice($price);
73
+ $method->setCost($rate['cost']);
74
+ }else{
75
  $price = $rate['price'];
76
  $method->setPrice($this->getFinalPriceWithHandlingFee($price));
77
  $method->setCost($rate['cost']);
78
+ }
79
 
80
  $result->append($method);
81
  }
app/code/community/MondialRelay/Pointsrelais/Model/Carrier/Pointsrelaiscd.php ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MondialRelay_Pointsrelais_Model_Carrier_Pointsrelaiscd extends Mage_Shipping_Model_Carrier_Abstract
3
+ {
4
+ protected $_code = 'pointsrelaiscd';
5
+
6
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request)
7
+ {
8
+ $result = Mage::getModel('shipping/rate_result');
9
+ if (!$this->getConfigData('active')) {
10
+ return $result;
11
+ }
12
+
13
+ $shipping_free_cart_price = null;
14
+ if ($this->getConfigData('free_active')) {
15
+ $shipping_free_cart_price = $this->getConfigData('free_price');
16
+
17
+ }
18
+
19
+ $request->setConditionName($this->getConfigData('condition_name') ? $this->getConfigData('condition_name') : $this->_default_condition_name);
20
+
21
+ $result = Mage::getModel('shipping/rate_result');
22
+
23
+ if($this->getConfigData('package_weight')){
24
+ $request->_data['package_weight'] = $request->_data['package_weight']+($this->getConfigData('package_weight')/1000);
25
+ }
26
+ $rates = $this->getRate($request);
27
+ $cartTmp = $request->_data['package_value_with_discount'];
28
+ $weghtTmp = $request->_data['package_weight'];
29
+ foreach($rates as $rate)
30
+ {
31
+ if (!empty($rate) && $rate['price'] >= 0)
32
+ {
33
+
34
+ /*---------------------------------------- Liste des points relais -----------------------------------------*/
35
+
36
+ // On met en place les paramètres de la requète
37
+ $params = array(
38
+ 'Enseigne' => $this->getConfigData('enseigne'),
39
+ 'Pays' => $request->_data['dest_country_id'],
40
+ 'CP' => $request->_data['dest_postcode'],
41
+ 'Action' => 'DRI'
42
+ );
43
+
44
+ //On crée le code de sécurité
45
+ $code = implode("",$params);
46
+ $code .= $this->getConfigData('cle');
47
+
48
+ //On le rajoute aux paramètres
49
+ $params["Security"] = strtoupper(md5($code));
50
+
51
+ // On se connecte
52
+ $client = new SoapClient("http://www.mondialrelay.fr/WebService/Web_Services.asmx?WSDL");
53
+
54
+ // Et on effectue la requète
55
+ $points_relais = $client->WSI2_RecherchePointRelais($params)->WSI2_RecherchePointRelaisResult;
56
+
57
+ // On cr�e une m�thode de livraison par point relais
58
+ foreach( $points_relais as $point_relais ) {
59
+ if ( is_object($point_relais) && trim($point_relais->Num) != '' ) {
60
+
61
+ $method = Mage::getModel('shipping/rate_result_method');
62
+
63
+ $method->setCarrier('pointsrelaiscd');
64
+ $method->setCarrierTitle($this->getConfigData('title'));
65
+
66
+ $methodTitle = $point_relais->LgAdr1 . ' - ' . $point_relais->Ville . ' <a href="#" onclick="PointsRelais.showInfo(\'' . $point_relais->Num . '\'); return false;">Détails</a> - <span style="display:none;" id="pays">' . $request->_data['dest_country_id'] . '</span>';
67
+ $method->setMethod($point_relais->Num);
68
+ $method->setMethodTitle($methodTitle);
69
+
70
+ if($shipping_free_cart_price != null && ($cartTmp > $shipping_free_cart_price && $weghtTmp > 0.101)){
71
+ $price = $rate['price'] = 0;
72
+ $rate['cost'] = 0;
73
+ $method->setPrice($price);
74
+ $method->setCost($rate['cost']);
75
+ }else{
76
+ $price = $rate['price'];
77
+ $method->setPrice($this->getFinalPriceWithHandlingFee($price));
78
+ $method->setCost($rate['cost']);
79
+ }
80
+
81
+ $result->append($method);
82
+ }
83
+ }
84
+ }
85
+ }
86
+
87
+ return $result;
88
+ }
89
+
90
+ public function getRate(Mage_Shipping_Model_Rate_Request $request)
91
+ {
92
+ return Mage::getResourceModel('pointsrelais/carrier_pointsrelais')->getRate($request);
93
+ }
94
+
95
+ public function getCode($type, $code='')
96
+ {
97
+ $codes = array(
98
+
99
+ 'condition_name'=>array(
100
+ 'package_weight' => Mage::helper('shipping')->__('Weight vs. Destination'),
101
+ 'package_value' => Mage::helper('shipping')->__('Price vs. Destination'),
102
+ 'package_qty' => Mage::helper('shipping')->__('# of Items vs. Destination'),
103
+ ),
104
+
105
+ 'condition_name_short'=>array(
106
+ 'package_weight' => Mage::helper('shipping')->__('Poids'),
107
+ 'package_value' => Mage::helper('shipping')->__('Valeur du panier'),
108
+ 'package_qty' => Mage::helper('shipping')->__('Nombre d\'articles'),
109
+ ),
110
+
111
+ );
112
+
113
+ if (!isset($codes[$type])) {
114
+ throw Mage::exception('Mage_Shipping', Mage::helper('shipping')->__('Invalid Tablerate Rate code type: %s', $type));
115
+ }
116
+
117
+ if (''===$code) {
118
+ return $codes[$type];
119
+ }
120
+
121
+ if (!isset($codes[$type][$code])) {
122
+ throw Mage::exception('Mage_Shipping', Mage::helper('shipping')->__('Invalid Tablerate Rate code for type %s: %s', $type, $code));
123
+ }
124
+
125
+ return $codes[$type][$code];
126
+ }
127
+
128
+ public function getAllowedMethods()
129
+ {
130
+ return array('pointsrelais'=>$this->getConfigData('name'));
131
+ }
132
+
133
+ public function isTrackingAvailable()
134
+ {
135
+ return true;
136
+ }
137
+
138
+ public function getTrackingInfo($tracking_number)
139
+ {
140
+ $tracking_result = $this->getTracking($tracking_number);
141
+
142
+ if ($tracking_result instanceof Mage_Shipping_Model_Tracking_Result)
143
+ {
144
+ if ($trackings = $tracking_result->getAllTrackings())
145
+ {
146
+ return $trackings[0];
147
+ }
148
+ }
149
+ elseif (is_string($tracking_result) && !empty($tracking_result))
150
+ {
151
+ return $tracking_result;
152
+ }
153
+
154
+ return false;
155
+ }
156
+
157
+ protected function getTracking($tracking_number)
158
+ {
159
+ $key = '<' . $this->getConfigData('marque_url') .'>' . $tracking_number . '<' . $this->getConfigData('cle_url') . '>';
160
+ $key = md5($key);
161
+
162
+ $tracking_url = 'http://www.mondialrelay.fr/lg_fr/espaces/url/popup_exp_details.aspx?cmrq=' . strtoupper($this->getConfigData('marque_url')) .'&nexp=' . strtoupper($tracking_number) . '&crc=' . strtoupper($key) ;
163
+
164
+ $tracking_result = Mage::getModel('shipping/tracking_result');
165
+
166
+ $tracking_status = Mage::getModel('shipping/tracking_result_status');
167
+ $tracking_status->setCarrier($this->_code)
168
+ ->setCarrierTitle($this->getConfigData('title'))
169
+ ->setTracking($tracking_number)
170
+ ->setUrl($tracking_url);
171
+ $tracking_result->append($tracking_status);
172
+
173
+ return $tracking_result;
174
+ }
175
+
176
+ }
app/code/community/MondialRelay/Pointsrelais/Model/Carrier/Pointsrelaisld1.php CHANGED
@@ -5,16 +5,16 @@ class MondialRelay_Pointsrelais_Model_Carrier_Pointsrelaisld1 extends Mage_Shipp
5
 
6
  public function collectRates(Mage_Shipping_Model_Rate_Request $request)
7
  {
8
- if (!$this->getConfigFlag('active')) {
9
- return false;
 
 
 
 
 
 
10
  }
11
 
12
- // desactive multi-shipping
13
-
14
- if (Mage::getSingleton('checkout/session')->getQuote()->getIsMultiShipping())
15
- {
16
- return false;
17
- }
18
 
19
  $request->setConditionName($this->getConfigData('condition_name') ? $this->getConfigData('condition_name') : $this->_default_condition_name);
20
 
@@ -34,9 +34,16 @@ class MondialRelay_Pointsrelais_Model_Carrier_Pointsrelaisld1 extends Mage_Shipp
34
  $method->setCarrierTitle($this->getConfigData('title'));
35
  $method->setMethod('pointsrelaisld1');
36
  $method->setMethodTitle($this->getConfigData('description'));
37
- $price = $rate['price'];
38
- $method->setPrice($this->getFinalPriceWithHandlingFee($price));
39
- $method->setCost($rate['cost']);
 
 
 
 
 
 
 
40
  $result->append($method);
41
  }
42
  }
5
 
6
  public function collectRates(Mage_Shipping_Model_Rate_Request $request)
7
  {
8
+ $result = Mage::getModel('shipping/rate_result');
9
+ if (!$this->getConfigData('active')) {
10
+ return $result;
11
+ }
12
+
13
+ $shipping_free_cart_price = null;
14
+ if ($this->getConfigData('free_active')) {
15
+ $shipping_free_cart_price = $this->getConfigData('free_price');
16
  }
17
 
 
 
 
 
 
 
18
 
19
  $request->setConditionName($this->getConfigData('condition_name') ? $this->getConfigData('condition_name') : $this->_default_condition_name);
20
 
34
  $method->setCarrierTitle($this->getConfigData('title'));
35
  $method->setMethod('pointsrelaisld1');
36
  $method->setMethodTitle($this->getConfigData('description'));
37
+ if($shipping_free_cart_price != null && ($cartTmp > $shipping_free_cart_price && $weghtTmp > 0.101)){
38
+ $price = $rate['price'] = 0;
39
+ $rate['cost'] = 0;
40
+ $method->setPrice($price);
41
+ $method->setCost($rate['cost']);
42
+ }else{
43
+ $price = $rate['price'];
44
+ $method->setPrice($this->getFinalPriceWithHandlingFee($price));
45
+ $method->setCost($rate['cost']);
46
+ }
47
  $result->append($method);
48
  }
49
  }
app/code/community/MondialRelay/Pointsrelais/Model/Carrier/Pointsrelaislds.php CHANGED
@@ -5,16 +5,16 @@ class MondialRelay_Pointsrelais_Model_Carrier_Pointsrelaislds extends Mage_Shipp
5
 
6
  public function collectRates(Mage_Shipping_Model_Rate_Request $request)
7
  {
8
- if (!$this->getConfigFlag('active')) {
9
- return false;
 
 
 
 
 
 
10
  }
11
 
12
- // desactive multi-shipping
13
-
14
- if (Mage::getSingleton('checkout/session')->getQuote()->getIsMultiShipping())
15
- {
16
- return false;
17
- }
18
 
19
  $request->setConditionName($this->getConfigData('condition_name') ? $this->getConfigData('condition_name') : $this->_default_condition_name);
20
 
@@ -33,9 +33,16 @@ class MondialRelay_Pointsrelais_Model_Carrier_Pointsrelaislds extends Mage_Shipp
33
  $method->setCarrierTitle($this->getConfigData('title'));
34
  $method->setMethod('pointsrelaislds');
35
  $method->setMethodTitle($this->getConfigData('description'));
36
- $price = $rate['price'];
37
- $method->setPrice($this->getFinalPriceWithHandlingFee($price));
38
- $method->setCost($rate['cost']);
 
 
 
 
 
 
 
39
  $result->append($method);
40
  }
41
  }
5
 
6
  public function collectRates(Mage_Shipping_Model_Rate_Request $request)
7
  {
8
+ $result = Mage::getModel('shipping/rate_result');
9
+ if (!$this->getConfigData('active')) {
10
+ return $result;
11
+ }
12
+
13
+ $shipping_free_cart_price = null;
14
+ if ($this->getConfigData('free_active')) {
15
+ $shipping_free_cart_price = $this->getConfigData('free_price');
16
  }
17
 
 
 
 
 
 
 
18
 
19
  $request->setConditionName($this->getConfigData('condition_name') ? $this->getConfigData('condition_name') : $this->_default_condition_name);
20
 
33
  $method->setCarrierTitle($this->getConfigData('title'));
34
  $method->setMethod('pointsrelaislds');
35
  $method->setMethodTitle($this->getConfigData('description'));
36
+ if($shipping_free_cart_price != null && ($cartTmp > $shipping_free_cart_price && $weghtTmp > 0.101)){
37
+ $price = $rate['price'] = 0;
38
+ $rate['cost'] = 0;
39
+ $method->setPrice($price);
40
+ $method->setCost($rate['cost']);
41
+ }else{
42
+ $price = $rate['price'];
43
+ $method->setPrice($this->getFinalPriceWithHandlingFee($price));
44
+ $method->setCost($rate['cost']);
45
+ }
46
  $result->append($method);
47
  }
48
  }
app/code/community/MondialRelay/Pointsrelais/Model/Mysql4/Carrier/Pointsrelaiscd.php ADDED
@@ -0,0 +1,374 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MondialRelay_Pointsrelais_Model_Mysql4_Carrier_Pointsrelaiscd extends Mage_Core_Model_Mysql4_Abstract
3
+ {
4
+ protected function _construct()
5
+ {
6
+ $this->_init('shipping/pointsrelaiscd', 'pk');
7
+ }
8
+
9
+
10
+ public function getRate(Mage_Shipping_Model_Rate_Request $request)
11
+ {
12
+
13
+ Mage::Log('MondialRelay_Pointsrelais_Model_Mysql4_Carrier_Pointsrelaiscd getRate');
14
+ //if products cannot be send in one package
15
+
16
+ $read = $this->_getReadAdapter();
17
+
18
+ $table = Mage::getSingleton('core/resource')->getTableName('mondialrelay_pointsrelaiscd');
19
+
20
+ $select = $read->select()->from($table);
21
+
22
+ $select->where(
23
+ $read->quoteInto(" (dest_country_id=? ", $request->getDestCountryId()).
24
+ $read->quoteInto(" AND dest_region_id=? ", $request->getDestRegionId()).
25
+ $read->quoteInto(" AND dest_zip=?) ", $request->getDestPostcode()).
26
+
27
+ $read->quoteInto(" OR (dest_country_id=? ", $request->getDestCountryId()).
28
+ $read->quoteInto(" AND dest_region_id=? AND dest_zip='') ", $request->getDestRegionId()).
29
+
30
+ $read->quoteInto(" OR (dest_country_id=? AND dest_region_id='0' AND dest_zip='') ", $request->getDestCountryId()).
31
+
32
+ $read->quoteInto(" OR (dest_country_id=? AND dest_region_id='0' ", $request->getDestCountryId()).
33
+ $read->quoteInto(" AND dest_zip=?) ", $request->getDestPostcode()).
34
+
35
+ " OR (dest_country_id='0' AND dest_region_id='0' AND dest_zip='')"
36
+ );
37
+
38
+ if (is_array($request->getConditionName()))
39
+ {
40
+ $i = 0;
41
+
42
+ foreach ($request->getConditionName() as $conditionName)
43
+ {
44
+ if ($i == 0)
45
+ {
46
+ $select->where('condition_name=?', $conditionName);
47
+ }
48
+ else
49
+ {
50
+ $select->orWhere('condition_name=?', $conditionName);
51
+ }
52
+
53
+ $select->where('condition_value>=?', $request->getData($conditionName));
54
+ $i++;
55
+ }
56
+ }
57
+ else
58
+ {
59
+ $select->where('condition_name=?', $request->getConditionName());
60
+ $select->where('condition_value>=?', $request->getData($request->getConditionName()));
61
+ }
62
+
63
+ $select->where('website_id=?', $request->getWebsiteId());
64
+
65
+ $select->group('dest_zip');
66
+ $select->group('dest_region_id');
67
+ $select->group('dest_country_id');
68
+
69
+ $select->order('dest_zip DESC');
70
+ $select->order('dest_region_id DESC');
71
+ $select->order('dest_country_id DESC');
72
+
73
+ $select->order('condition_value ASC');
74
+
75
+ $rows = $read->fetchAll($select);
76
+
77
+ /*
78
+ * Check to see if any zip code or region specific rates exist.
79
+ */
80
+ $specific = array();
81
+ $failover = array();
82
+
83
+ $zipFound = $regionFound = false;
84
+
85
+ /*
86
+ * Most specific: Zip code.
87
+ * Check for any not null zip codes, which would mean that we have a specific shipping method for that zipcode
88
+ */
89
+ foreach($rows as $row)
90
+ {
91
+ if (!empty($row['dest_zip']))
92
+ {
93
+ $specific[] = $row;
94
+ $zipFound = true;
95
+ }
96
+ elseif (!empty($row['dest_region_id']) && $zipFound == false)
97
+ {
98
+ $specific[] = $row;
99
+ $regionFound = true;
100
+ }
101
+ elseif (!empty($row['dest_country_id']) && $zipFound == false && $regionFound == false)
102
+ {
103
+ $specific[] = $row;
104
+ }
105
+
106
+ if (empty($row['dest_country_id']) && empty($row['dest_region_id']) && empty($row['dest_zip']))
107
+ {
108
+ $failover[] = $row;
109
+ }
110
+ }
111
+
112
+ if (count($specific) > 0)
113
+ {
114
+ $rates = $specific;
115
+ }
116
+ else
117
+ {
118
+ $rates = $failover;
119
+ }
120
+
121
+ /*
122
+ * Great, we have something specific for the zip code or region, let's return just those
123
+ */
124
+
125
+ return $rates;
126
+ }
127
+
128
+ public function uploadAndImport(Varien_Object $object)
129
+ {
130
+ $csvFile = $_FILES["groups"]["tmp_name"]["pointsrelaiscd"]["fields"]["import"]["value"];
131
+
132
+ if (!empty($csvFile))
133
+ {
134
+ $csv = trim(file_get_contents($csvFile));
135
+
136
+ $table = Mage::getSingleton('core/resource')->getTableName('mondialrelay_pointsrelaiscd');
137
+ Mage::Log('uploadAndImport : '.$table);
138
+ $websiteId = $object->getScopeId();
139
+
140
+ if (isset($_POST['groups']['pointsrelaiscd']['fields']['condition_name']['inherit']))
141
+ {
142
+ $conditionName = (string)Mage::getConfig()->getNode('default/carriers/pointsrelaiscd/condition_name');
143
+ }
144
+ else
145
+ {
146
+ $conditionName = $_POST['groups']['pointsrelaiscd']['fields']['condition_name']['value'];
147
+ }
148
+
149
+ $conditionFullName = Mage::getModel('pointsrelais/carrier_pointsrelaiscd')->getCode('condition_name_short', $conditionName);
150
+
151
+ if (!empty($csv))
152
+ {
153
+ $exceptions = array();
154
+ $csvLines = explode("\n", $csv);
155
+ $csvLine = array_shift($csvLines);
156
+ $csvLine = $this->_getCsvValues($csvLine);
157
+
158
+ if (count($csvLine) < 5)
159
+ {
160
+ $exceptions[0] = Mage::helper('shipping')->__('Invalid Table Rates File Format');
161
+ }
162
+
163
+ $countryCodes = array();
164
+ $regionCodes = array();
165
+
166
+ foreach ($csvLines as $k => $csvLine)
167
+ {
168
+ $csvLine = $this->_getCsvValues($csvLine);
169
+
170
+ if (count($csvLine) > 0 && count($csvLine) < 5)
171
+ {
172
+ $exceptions[0] = Mage::helper('shipping')->__('Invalid Table Rates File Format');
173
+ }
174
+ else
175
+ {
176
+ $countryCodes[] = $csvLine[0];
177
+ $regionCodes[] = $csvLine[1];
178
+ }
179
+ }
180
+
181
+ if (empty($exceptions))
182
+ {
183
+ $data = array();
184
+ $countryCodesToIds = array();
185
+ $regionCodesToIds = array();
186
+ $countryCodesIso2 = array();
187
+
188
+ $countryCollection = Mage::getResourceModel('directory/country_collection')->addCountryCodeFilter($countryCodes)->load();
189
+
190
+ foreach ($countryCollection->getItems() as $country)
191
+ {
192
+ $countryCodesToIds[$country->getData('iso3_code')] = $country->getData('country_id');
193
+ $countryCodesToIds[$country->getData('iso2_code')] = $country->getData('country_id');
194
+ $countryCodesIso2[] = $country->getData('iso2_code');
195
+ }
196
+
197
+ $regionCollection = Mage::getResourceModel('directory/region_collection')
198
+ ->addRegionCodeFilter($regionCodes)
199
+ ->addCountryFilter($countryCodesIso2)
200
+ ->load();
201
+
202
+ foreach ($regionCollection->getItems() as $region)
203
+ {
204
+ $regionCodesToIds[$countryCodesToIds[$region->getData('country_id')]][$region->getData('code')] = $region->getData('region_id');
205
+ }
206
+
207
+ foreach ($csvLines as $k => $csvLine)
208
+ {
209
+
210
+ $csvLine = $this->_getCsvValues($csvLine);
211
+
212
+ /*
213
+ * Column 1 - Country
214
+ */
215
+ if (empty($countryCodesToIds) || !array_key_exists($csvLine[0], $countryCodesToIds))
216
+ {
217
+ $countryId = '0';
218
+
219
+ if ($csvLine[0] != '*' && $csvLine[0] != '')
220
+ {
221
+ $exceptions[] = Mage::helper('shipping')->__('Invalid Country "%s" in the Row #%s', $csvLine[0], ($k+1));
222
+ }
223
+ }
224
+ else
225
+ {
226
+ $countryId = $countryCodesToIds[$csvLine[0]];
227
+ }
228
+
229
+
230
+ /*
231
+ * Column 2 - Region/State
232
+ */
233
+ # if (empty($regionCodesToIds[$countryCodesToIds[$csvLine[0]]]) || !array_key_exists($csvLine[1], $regionCodesToIds[$countryCodesToIds[$csvLine[0]]]))
234
+ if ($countryId == '0')
235
+ {
236
+ $regionId = '0';
237
+ }
238
+ else
239
+ {
240
+ if (empty($regionCodesToIds[$countryCodesToIds[$csvLine[0]]]) || !array_key_exists($csvLine[1], $regionCodesToIds[$countryCodesToIds[$csvLine[0]]]))
241
+ {
242
+ $regionId = '0';
243
+
244
+ if ($csvLine[1] != '*' && $csvLine[1] != '')
245
+ {
246
+ $exceptions[] = Mage::helper('shipping')->__('Invalid Region/State "%s" in the Row #%s', $csvLine[1], ($k+1));
247
+ }
248
+ }
249
+ else
250
+ {
251
+ $regionId = $regionCodesToIds[$countryCodesToIds[$csvLine[0]]][$csvLine[1]];
252
+ }
253
+ }
254
+ /*
255
+ * Column 3 - Zip/Postal Code
256
+ */
257
+ if ($csvLine[2] == '*' || $csvLine[2] == '')
258
+ {
259
+ $zip = '';
260
+ }
261
+ else
262
+ {
263
+ $zip = $csvLine[2];
264
+ }
265
+
266
+ /*
267
+ * Column 4 - Order Subtotal
268
+ */
269
+ if (!$this->_isPositiveDecimalNumber($csvLine[3]) || $csvLine[3] == '*' || $csvLine[3] == '')
270
+ {
271
+ $exceptions[] = Mage::helper('shipping')->__('Invalid %s "%s" in the Row #%s', $conditionFullName, $csvLine[3], ($k+1));
272
+ }
273
+ else
274
+ {
275
+ $csvLine[3] = (float)$csvLine[3];
276
+ }
277
+
278
+ /*
279
+ * Column 5 - Shipping Price
280
+ */
281
+ if (!$this->_isPositiveDecimalNumber($csvLine[4]))
282
+ {
283
+ $exceptions[] = Mage::helper('shipping')->__('Invalid Shipping Price "%s" in the Row #%s', $csvLine[4], ($k+1));
284
+ }
285
+ else
286
+ {
287
+ $csvLine[4] = (float)$csvLine[4];
288
+ }
289
+
290
+ $data[] = array(
291
+ 'website_id' => $websiteId,
292
+ 'dest_country_id' => $countryId,
293
+ 'dest_region_id' => $regionId,
294
+ 'dest_zip' => $zip,
295
+ 'condition_name' => $conditionName,
296
+ 'condition_value' => $csvLine[3],
297
+ 'price' => $csvLine[4],
298
+ );
299
+ }
300
+ }
301
+
302
+ if (empty($exceptions))
303
+ {
304
+ $connection = $this->_getWriteAdapter();
305
+
306
+ $condition = array(
307
+ $connection->quoteInto('website_id = ?', $websiteId),
308
+ $connection->quoteInto('condition_name = ?', $conditionName),
309
+ );
310
+
311
+ $connection->delete($table, $condition);
312
+
313
+ foreach($data as $k=>$dataLine)
314
+ {
315
+ try
316
+ {
317
+ $connection->insert($table, $dataLine);
318
+ }
319
+ catch (Exception $e)
320
+ {
321
+ // This should probably show the exception message too.
322
+ $exceptions[] = Mage::helper('shipping')->__('Import error: ' . $e->getMessage());
323
+ }
324
+ }
325
+ }
326
+
327
+ if (!empty($exceptions))
328
+ {
329
+ throw new Exception( "\n" . implode("\n", $exceptions) );
330
+ }
331
+ }
332
+ }
333
+ }
334
+
335
+ protected function _getCsvValues($string, $separator=",")
336
+ {
337
+ $elements = explode($separator, trim($string));
338
+
339
+ for ($i = 0; $i < count($elements); $i++)
340
+ {
341
+ $nquotes = substr_count($elements[$i], '"');
342
+
343
+ if ($nquotes %2 == 1)
344
+ {
345
+ for ($j = $i+1; $j < count($elements); $j++)
346
+ {
347
+ if (substr_count($elements[$j], '"') > 0)
348
+ {
349
+ // Put the quoted string's pieces back together again
350
+ array_splice($elements, $i, $j-$i+1, implode($separator, array_slice($elements, $i, $j-$i+1)));
351
+ break;
352
+ }
353
+ }
354
+ }
355
+
356
+ if ($nquotes > 0)
357
+ {
358
+ // Remove first and last quotes, then merge pairs of quotes
359
+ $qstr =& $elements[$i];
360
+ $qstr = substr_replace($qstr, '', strpos($qstr, '"'), 1);
361
+ $qstr = substr_replace($qstr, '', strrpos($qstr, '"'), 1);
362
+ $qstr = str_replace('""', '"', $qstr);
363
+ }
364
+ $elements[$i] = trim($elements[$i]);
365
+ }
366
+ return $elements;
367
+ }
368
+
369
+ protected function _isPositiveDecimalNumber($n)
370
+ {
371
+ return preg_match ("/^[0-9]+(\.[0-9]*)?$/", $n);
372
+ }
373
+
374
+ }
app/code/community/MondialRelay/Pointsrelais/Model/Mysql4/Carrier/Pointsrelaiscd/Collection.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MondialRelay_Pointsrelais_Model_Mysql4_Carrier_Pointsrelaiscd_Collection extends Varien_Data_Collection_Db
3
+ {
4
+ protected $_shipTable;
5
+ protected $_countryTable;
6
+ protected $_regionTable;
7
+
8
+ public function __construct()
9
+ {
10
+ parent::__construct(Mage::getSingleton('core/resource')->getConnection('shipping_read'));
11
+
12
+ $this->_shipTable = Mage::getSingleton('core/resource')->getTableName('mondialrelay_pointsrelaiscd');
13
+
14
+ $this->_countryTable = Mage::getSingleton('core/resource')->getTableName('directory/country');
15
+
16
+ $this->_regionTable = Mage::getSingleton('core/resource')->getTableName('directory/country_region');
17
+
18
+ $this->_select->from(array("s" => $this->_shipTable))
19
+ ->joinLeft(array("c" => $this->_countryTable), 'c.country_id = s.dest_country_id', 'iso3_code AS dest_country')
20
+ ->joinLeft(array("r" => $this->_regionTable), 'r.region_id = s.dest_region_id', 'code AS dest_region')
21
+ ->order(array("dest_country", "dest_region", "dest_zip"));
22
+
23
+ $this->_setIdFieldName('id');
24
+
25
+ return $this;
26
+ }
27
+
28
+ public function setWebsiteFilter($websiteId)
29
+ {
30
+ $this->_select->where("website_id = ?", $websiteId);
31
+
32
+ return $this;
33
+ }
34
+
35
+ public function setConditionFilter($conditionName)
36
+ {
37
+ $this->_select->where("condition_name = ?", $conditionName);
38
+
39
+ return $this;
40
+ }
41
+
42
+ public function setCountryFilter($countryId)
43
+ {
44
+ $this->_select->where("dest_country_id = ?", $countryId);
45
+
46
+ return $this;
47
+ }
48
+ }
app/code/community/MondialRelay/Pointsrelais/Model/System/Config/Backend/Shipping/Pointsrelaiscd.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MondialRelay_Pointsrelais_Model_System_Config_Backend_Shipping_Pointsrelaiscd extends Mage_Core_Model_Config_Data
3
+ {
4
+ public function _afterSave()
5
+ {
6
+ Mage::getResourceModel('pointsrelais/carrier_pointsrelaiscd')->uploadAndImport($this);
7
+ }
8
+ }
app/code/community/MondialRelay/Pointsrelais/Model/System/Config/Source/Shipping/Pointsrelaiscd.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class MondialRelay_Pointsrelais_Model_System_Config_Source_Shipping_Pointsrelaiscd
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ $tableRate = Mage::getSingleton('pointsrelais/carrier_pointsrelaiscd');
7
+ $arr = array();
8
+
9
+ foreach ($tableRate->getCode('condition_name') as $k=>$v)
10
+ {
11
+ $arr[] = array('value'=>$k, 'label'=>$v);
12
+ }
13
+ // if(!count($arr)){
14
+ // $arr[] = array('value'=>'groups[flatrate][fields][specificcountry][value]', 'label'=>' Livrer aux pays sp�cifiques');
15
+ // }
16
+ return $arr;
17
+ }
18
+ }
app/code/community/MondialRelay/Pointsrelais/controllers/Sales/ImpressionController.php CHANGED
@@ -132,7 +132,7 @@ class MondialRelay_Pointsrelais_Sales_ImpressionController extends Mage_Adminhtm
132
  $this->_processDownload('http://www.mondialrelay.fr' . $urlEtiquette, 'url');
133
  exit(0);
134
  } catch (Mage_Core_Exception $e) {
135
- $this->getSession()->addError(Mage::helper('pointsrelais')->__('Désolé, une erreure est survenu lors de la récupération de l\'étiquetes. Merci de contacter Mondial Relay ou de réessayer plus tard'));
136
  }
137
  return $this->_redirectReferer();
138
 
@@ -147,7 +147,7 @@ class MondialRelay_Pointsrelais_Sales_ImpressionController extends Mage_Adminhtm
147
  $this->_processDownload('http://www.mondialrelay.fr' . $urlEtiquette, 'url');
148
  exit(0);
149
  } catch (Mage_Core_Exception $e) {
150
- $this->getSession()->addError(Mage::helper('pointsrelais')->__('Désolé, une erreure est survenu lors de la récupération de l\'étiquetes. Merci de contacter Mondial Relay ou de réessayer plus tard'));
151
  }
152
  return $this->_redirectReferer();
153
  }
132
  $this->_processDownload('http://www.mondialrelay.fr' . $urlEtiquette, 'url');
133
  exit(0);
134
  } catch (Mage_Core_Exception $e) {
135
+ $this->_getSession()->addError(Mage::helper('pointsrelais')->__('Désolé, une erreure est survenu lors de la récupération de l\'étiquetes. Merci de contacter Mondial Relay ou de réessayer plus tard'));
136
  }
137
  return $this->_redirectReferer();
138
 
147
  $this->_processDownload('http://www.mondialrelay.fr' . $urlEtiquette, 'url');
148
  exit(0);
149
  } catch (Mage_Core_Exception $e) {
150
+ $this->_getSession()->addError(Mage::helper('pointsrelais')->__('Désolé, une erreure est survenu lors de la récupération de l\'étiquetes. Merci de contacter Mondial Relay ou de réessayer plus tard'));
151
  }
152
  return $this->_redirectReferer();
153
  }
app/code/community/MondialRelay/Pointsrelais/controllers/Sales/Order/ShipmentController.php CHANGED
@@ -60,7 +60,83 @@ class MondialRelay_Pointsrelais_Sales_Order_ShipmentController extends Mage_Admi
60
  $_order = $shipment->getOrder();
61
  $_shippingMethod = explode("_",$_order->getShippingMethod());
62
 
63
- if ($_shippingMethod[0] == 'pointsrelais') {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
 
65
  // On met en place les paramètres de la requète
66
 
60
  $_order = $shipment->getOrder();
61
  $_shippingMethod = explode("_",$_order->getShippingMethod());
62
 
63
+ if ($_shippingMethod[0] == 'pointsrelaiscd') {
64
+
65
+ // On met en place les paramètres de la requète
66
+
67
+ $adress = $_order->getShippingAddress()->getStreet();
68
+ if (!isset($adress[1]))
69
+ {
70
+ $adress[1] = '';
71
+ }
72
+ $package_weightTmp = $_order->getWeight()*1000;
73
+
74
+ if($this->getConfigData('package_weight')){
75
+ $package_weightTmp = $package_weightTmp+($this->getConfigData('package_weight'));
76
+ }
77
+
78
+ if($package_weightTmp < 100){
79
+ $package_weightTmp = 100;
80
+ }
81
+ $params = array(
82
+ 'Enseigne' => $this->getConfigData('enseigne'),
83
+ 'ModeCol' => 'CCC',
84
+ 'ModeLiv' => 'DRI',
85
+ 'Expe_Langage' => 'FR',
86
+ 'Expe_Ad1' => trim($this->removeaccents($this->getConfigData('adresse1_enseigne'))),
87
+ 'Expe_Ad3' => trim($this->removeaccents($this->getConfigData('adresse3_enseigne'))),
88
+ 'Expe_Ad4' => trim($this->removeaccents($this->getConfigData('adresse4_enseigne'))),
89
+ 'Expe_Ville' => trim($this->removeaccents($this->getConfigData('ville_enseigne'))),
90
+ 'Expe_CP' => $this->getConfigData('cp_enseigne'),
91
+ 'Expe_Pays' => trim($this->removeaccents($this->getConfigData('pays_enseigne'))),
92
+ 'Expe_Tel1' => '',
93
+ 'Expe_Tel2' => '',
94
+ 'Expe_Mail' => $this->getConfigData('mail_enseigne'),
95
+ 'Dest_Langage' => 'FR',
96
+ 'Dest_Ad1' => trim($this->removeaccents($_order->getShippingAddress()->getFirstname() . ' ' . $_order->getShippingAddress()->getLastname())),
97
+ 'Dest_Ad2' => trim($this->removeaccents($_order->getShippingAddress()->getCompagny())),
98
+ 'Dest_Ad3' => trim($this->removeaccents($adress[0])),
99
+ 'Dest_Ad4' => trim($this->removeaccents($adress[1])),
100
+ 'Dest_Ville' => trim($this->removeaccents($_order->getShippingAddress()->getCity())),
101
+ 'Dest_CP' => $_order->getShippingAddress()->getPostcode(),
102
+ 'Dest_Pays' => trim($this->removeaccents($_order->getShippingAddress()->getCountryId())),
103
+ 'Dest_Tel1' => '',
104
+ 'Dest_Mail' => $_order->getCustomerEmail(),
105
+ 'Poids' => $package_weightTmp,
106
+ 'NbColis' => '1',
107
+ 'CRT_Valeur' => '0',
108
+ 'LIV_Rel_Pays' => $_order->getShippingAddress()->getCountryId(),
109
+ 'LIV_Rel' => $_shippingMethod[1]
110
+ );//$_order->getWeight()*1000,
111
+ //On crée le code de sécurité
112
+
113
+ $select = "";
114
+ foreach($params as $key => $value){
115
+ $select .= "\t".'<option value="'.$key.'">' . $value.'</option>'."\r\n";
116
+ }
117
+ Mage::Log('WSI2_CreationExpeditionResult$params : '.($select));
118
+
119
+ $code = implode("",$params);
120
+ $code .= $this->getConfigData('cle');
121
+
122
+ //On le rajoute aux paramètres
123
+ $params["Security"] = strtoupper(md5($code));
124
+
125
+ // On se connecte
126
+ $client = new SoapClient("http://www.mondialrelay.fr/WebService/Web_Services.asmx?WSDL");
127
+
128
+ // Et on effectue la requète
129
+ $expedition = $client->WSI2_CreationExpedition($params)->WSI2_CreationExpeditionResult;
130
+
131
+ Mage::Log('WSI2_CreationExpeditionResult : '.($expedition->STAT));
132
+ $track = Mage::getModel('sales/order_shipment_track')
133
+ ->setNumber($expedition->ExpeditionNum)
134
+ ->setCarrier('Mondial Relay')
135
+ ->setCarrierCode($_shippingMethod[0])
136
+ ->setTitle('Mondial Relay')
137
+ ->setPopup(1);
138
+ $shipment->addTrack($track);
139
+ }else if ($_shippingMethod[0] == 'pointsrelais') {
140
 
141
  // On met en place les paramètres de la requète
142
 
app/code/community/MondialRelay/Pointsrelais/controllers/System/ConfigController.php CHANGED
@@ -16,6 +16,11 @@ class MondialRelay_Pointsrelais_System_ConfigController extends Mage_Adminhtml_C
16
  $this->exportCSV();
17
  }
18
 
 
 
 
 
 
19
  public function exportld1Action()
20
  {
21
  $this->exportCSV('pointsrelais/carrier_pointsrelaisld1');
16
  $this->exportCSV();
17
  }
18
 
19
+ public function exportcdAction()
20
+ {
21
+ $this->exportCSV('pointsrelais/carrier_pointsrelaiscd');
22
+ }
23
+
24
  public function exportld1Action()
25
  {
26
  $this->exportCSV('pointsrelais/carrier_pointsrelaisld1');
app/code/community/MondialRelay/Pointsrelais/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <MondialRelay_Pointsrelais>
5
- <version>1.2.3</version>
6
  <depends>
7
  <Mage_Adminhtml />
8
  <Mage_Shipping />
@@ -19,14 +19,65 @@
19
  <specificerrmsg>L'expédition en Points Relais n'est pour le moment pas disponible. Si vous avez des questions concernant ce mode de livraison, merci de nous contacter.</specificerrmsg>
20
  <handling_type>F</handling_type>
21
  <package_weight>0</package_weight>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  </pointsrelais>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  <pointsrelaisld1>
24
  <active>0</active>
25
  <model>pointsrelais/carrier_pointsrelaisld1</model>
26
  <title>Mondial Relay - Livraison à Domicile</title>
27
  <description>Mondial Relay - Livraison à Domicile</description>
28
  <specificerrmsg>L'expédition en Points Relais n'est pour le moment pas disponible. Si vous avez des questions concernant ce mode de livraison, merci de nous contacter.</specificerrmsg>
29
- <default_developed_length>10</default_developed_length>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  </pointsrelaisld1>
31
  <pointsrelaislds>
32
  <active>0</active>
@@ -35,6 +86,20 @@
35
  <description>Mondial Relay - Livraison à Domicile spécialisé</description>
36
  <specificerrmsg>L'expédition en Points Relais n'est pour le moment pas disponible. Si vous avez des questions concernant ce mode de livraison, merci de nous contacter.</specificerrmsg>
37
  <default_developed_length>10</default_developed_length>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  </pointsrelaislds>
39
  </carriers>
40
  </default>
@@ -50,6 +115,9 @@
50
  <pointsrelais>
51
  <table>mondialrelay_pointsrelais</table>
52
  </pointsrelais>
 
 
 
53
  <pointsrelaisld1>
54
  <table>mondialrelay_pointsrelaisld1</table>
55
  </pointsrelaisld1>
@@ -68,6 +136,9 @@
68
 
69
  <system_config_source_shipping_pointsrelaislds>MondialRelay_Pointsrelais_Model_System_Config_Source_Shipping_Pointsrelaislds</system_config_source_shipping_pointsrelaislds>
70
  <system_config_backend_shipping_pointsrelaislds>MondialRelay_Pointsrelais_Model_System_Config_Backend_Shipping_Pointsrelaislds</system_config_backend_shipping_pointsrelaislds>
 
 
 
71
  </rewrite>
72
  </adminhtml>
73
  </models>
@@ -79,6 +150,9 @@
79
  <rewrite>
80
  <system_config_form>MondialRelay_Pointsrelais_Block_System_Config_Form</system_config_form>
81
  <system_config_form_field_exportpointsrelais>MondialRelay_Pointsrelais_Block_System_Config_Form_Field_Exportpointsrelais</system_config_form_field_exportpointsrelais>
 
 
 
82
  <sales_order_shipment_view>MondialRelay_Pointsrelais_Block_Sales_Order_Shipment_View</sales_order_shipment_view>
83
  </rewrite>
84
  </adminhtml>
2
  <config>
3
  <modules>
4
  <MondialRelay_Pointsrelais>
5
+ <version>1.3.0</version>
6
  <depends>
7
  <Mage_Adminhtml />
8
  <Mage_Shipping />
19
  <specificerrmsg>L'expédition en Points Relais n'est pour le moment pas disponible. Si vous avez des questions concernant ce mode de livraison, merci de nous contacter.</specificerrmsg>
20
  <handling_type>F</handling_type>
21
  <package_weight>0</package_weight>
22
+ <enseigne>BDTESTMR</enseigne>
23
+ <marque>BD</marque>
24
+ <cle>TesT_MondiaL_RelaY</cle>
25
+ <marque_url>BDTESTMR11</marque_url>
26
+ <cle_url>TesT_MondiaL_RelaY</cle_url>
27
+ <adresse1_enseigne>test</adresse1_enseigne>
28
+ <adresse3_enseigne>test</adresse3_enseigne>
29
+ <adresse4_enseigne></adresse4_enseigne>
30
+ <cp_enseigne>02270</cp_enseigne>
31
+ <ville_enseigne>crecy sur serre</ville_enseigne>
32
+ <pays_enseigne>FR</pays_enseigne>
33
+ <tel_enseigne>0123456789</tel_enseigne>
34
+ <mobile_enseigne></mobile_enseigne>
35
+ <mail_enseigne>test@test.com</mail_enseigne>
36
  </pointsrelais>
37
+ <pointsrelaiscd>
38
+ <active>0</active>
39
+ <sallowspecific>0</sallowspecific>
40
+ <model>pointsrelais/carrier_pointsrelaiscd</model>
41
+ <title>Mondial Relay - Livraison en ColisDrive</title>
42
+ <specificerrmsg>L'expédition en Points Relais n'est pour le moment pas disponible. Si vous avez des questions concernant ce mode de livraison, merci de nous contacter.</specificerrmsg>
43
+ <handling_type>F</handling_type>
44
+ <package_weight>0</package_weight>
45
+ <enseigne>BDTESTMR</enseigne>
46
+ <marque>BD</marque>
47
+ <cle>TesT_MondiaL_RelaY</cle>
48
+ <marque_url>BDTESTMR11</marque_url>
49
+ <cle_url>TesT_MondiaL_RelaY</cle_url>
50
+ <adresse1_enseigne>test</adresse1_enseigne>
51
+ <adresse3_enseigne>test</adresse3_enseigne>
52
+ <adresse4_enseigne>10</adresse4_enseigne>
53
+ <cp_enseigne>02270</cp_enseigne>
54
+ <ville_enseigne>crecy sur serre</ville_enseigne>
55
+ <pays_enseigne>FR</pays_enseigne>
56
+ <tel_enseigne>0123456789</tel_enseigne>
57
+ <mobile_enseigne></mobile_enseigne>
58
+ <mail_enseigne>test@test.com</mail_enseigne>
59
+ </pointsrelaiscd>
60
  <pointsrelaisld1>
61
  <active>0</active>
62
  <model>pointsrelais/carrier_pointsrelaisld1</model>
63
  <title>Mondial Relay - Livraison à Domicile</title>
64
  <description>Mondial Relay - Livraison à Domicile</description>
65
  <specificerrmsg>L'expédition en Points Relais n'est pour le moment pas disponible. Si vous avez des questions concernant ce mode de livraison, merci de nous contacter.</specificerrmsg>
66
+ <enseigne>BDTESTMR</enseigne>
67
+ <marque>BD</marque>
68
+ <cle>TesT_MondiaL_RelaY</cle>
69
+ <marque_url>BDTESTMR11</marque_url>
70
+ <cle_url>TesT_MondiaL_RelaY</cle_url>
71
+ <adresse1_enseigne>test</adresse1_enseigne>
72
+ <adresse3_enseigne>test</adresse3_enseigne>
73
+ <adresse4_enseigne></adresse4_enseigne>
74
+ <cp_enseigne>02270</cp_enseigne>
75
+ <ville_enseigne>crecy sur serre</ville_enseigne>
76
+ <pays_enseigne>FR</pays_enseigne>
77
+ <tel_enseigne>0123456789</tel_enseigne>
78
+ <mobile_enseigne></mobile_enseigne>
79
+ <mail_enseigne>test@test.com</mail_enseigne>
80
+
81
  </pointsrelaisld1>
82
  <pointsrelaislds>
83
  <active>0</active>
86
  <description>Mondial Relay - Livraison à Domicile spécialisé</description>
87
  <specificerrmsg>L'expédition en Points Relais n'est pour le moment pas disponible. Si vous avez des questions concernant ce mode de livraison, merci de nous contacter.</specificerrmsg>
88
  <default_developed_length>10</default_developed_length>
89
+ <enseigne>BDTESTMR</enseigne>
90
+ <marque>BD</marque>
91
+ <cle>TesT_MondiaL_RelaY</cle>
92
+ <marque_url>BDTESTMR11</marque_url>
93
+ <cle_url>TesT_MondiaL_RelaY</cle_url>
94
+ <adresse1_enseigne>test</adresse1_enseigne>
95
+ <adresse3_enseigne>test</adresse3_enseigne>
96
+ <adresse4_enseigne></adresse4_enseigne>
97
+ <cp_enseigne>02270</cp_enseigne>
98
+ <ville_enseigne>crecy sur serre</ville_enseigne>
99
+ <pays_enseigne>FR</pays_enseigne>
100
+ <tel_enseigne>0123456789</tel_enseigne>
101
+ <mobile_enseigne></mobile_enseigne>
102
+ <mail_enseigne>test@test.com</mail_enseigne>
103
  </pointsrelaislds>
104
  </carriers>
105
  </default>
115
  <pointsrelais>
116
  <table>mondialrelay_pointsrelais</table>
117
  </pointsrelais>
118
+ <pointsrelaisldscd>
119
+ <table>mondialrelay_pointsrelaiscd</table>
120
+ </pointsrelaisldscd>
121
  <pointsrelaisld1>
122
  <table>mondialrelay_pointsrelaisld1</table>
123
  </pointsrelaisld1>
136
 
137
  <system_config_source_shipping_pointsrelaislds>MondialRelay_Pointsrelais_Model_System_Config_Source_Shipping_Pointsrelaislds</system_config_source_shipping_pointsrelaislds>
138
  <system_config_backend_shipping_pointsrelaislds>MondialRelay_Pointsrelais_Model_System_Config_Backend_Shipping_Pointsrelaislds</system_config_backend_shipping_pointsrelaislds>
139
+
140
+ <system_config_source_shipping_pointsrelaiscd>MondialRelay_Pointsrelais_Model_System_Config_Source_Shipping_Pointsrelaiscd</system_config_source_shipping_pointsrelaiscd>
141
+ <system_config_backend_shipping_pointsrelaiscd>MondialRelay_Pointsrelais_Model_System_Config_Backend_Shipping_Pointsrelaiscd</system_config_backend_shipping_pointsrelaiscd>
142
  </rewrite>
143
  </adminhtml>
144
  </models>
150
  <rewrite>
151
  <system_config_form>MondialRelay_Pointsrelais_Block_System_Config_Form</system_config_form>
152
  <system_config_form_field_exportpointsrelais>MondialRelay_Pointsrelais_Block_System_Config_Form_Field_Exportpointsrelais</system_config_form_field_exportpointsrelais>
153
+ <system_config_form_field_exportpointsrelaiscd>MondialRelay_Pointsrelais_Block_System_Config_Form_Field_Exportpointsrelaiscd</system_config_form_field_exportpointsrelaiscd>
154
+ <system_config_form_field_exportpointsrelaisld1>MondialRelay_Pointsrelais_Block_System_Config_Form_Field_Exportpointsrelaisld1</system_config_form_field_exportpointsrelaisld1>
155
+ <system_config_form_field_exportpointsrelaislds>MondialRelay_Pointsrelais_Block_System_Config_Form_Field_Exportpointsrelaislds</system_config_form_field_exportpointsrelaislds>
156
  <sales_order_shipment_view>MondialRelay_Pointsrelais_Block_Sales_Order_Shipment_View</sales_order_shipment_view>
157
  </rewrite>
158
  </adminhtml>
app/code/community/MondialRelay/Pointsrelais/etc/system.xml CHANGED
@@ -11,6 +11,15 @@
11
  <show_in_website>1</show_in_website>
12
  <show_in_store>1</show_in_store>
13
  <fields>
 
 
 
 
 
 
 
 
 
14
  <active translate="label">
15
  <label>Enabled</label>
16
  <frontend_type>select</frontend_type>
@@ -243,8 +252,293 @@
243
  <show_in_website>1</show_in_website>
244
  <show_in_store>1</show_in_store>
245
  </sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
  </fields>
247
  </pointsrelais>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  <pointsrelaisld1 translate="label" module="shipping">
249
  <label>Mondial Relay - Livraison a domicile</label>
250
  <frontend_type>text</frontend_type>
@@ -503,6 +797,23 @@
503
  <show_in_website>1</show_in_website>
504
  <show_in_store>1</show_in_store>
505
  </sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
506
  </fields>
507
  </pointsrelaisld1>
508
  <pointsrelaislds translate="label" module="shipping">
@@ -513,6 +824,15 @@
513
  <show_in_website>1</show_in_website>
514
  <show_in_store>1</show_in_store>
515
  <fields>
 
 
 
 
 
 
 
 
 
516
  <active translate="label">
517
  <label>Enabled</label>
518
  <frontend_type>select</frontend_type>
@@ -659,7 +979,7 @@
659
  <label>Description</label>
660
  <comment>Facultatif</comment>
661
  <frontend_type>text</frontend_type>
662
- <sort_order>18</sort_order>
663
  <show_in_default>1</show_in_default>
664
  <show_in_website>1</show_in_website>
665
  <show_in_store>1</show_in_store>
@@ -763,6 +1083,23 @@
763
  <show_in_website>1</show_in_website>
764
  <show_in_store>1</show_in_store>
765
  </sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
766
  </fields>
767
  </pointsrelaislds>
768
  </groups>
11
  <show_in_website>1</show_in_website>
12
  <show_in_store>1</show_in_store>
13
  <fields>
14
+ <title translate="label">
15
+ <label>title</label>
16
+ <comment>Facultatif</comment>
17
+ <frontend_type>text</frontend_type>
18
+ <sort_order>17</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>1</show_in_store>
22
+ </title>
23
  <active translate="label">
24
  <label>Enabled</label>
25
  <frontend_type>select</frontend_type>
252
  <show_in_website>1</show_in_website>
253
  <show_in_store>1</show_in_store>
254
  </sort_order>
255
+ <free_active translate="label">
256
+ <label>Frais de port gratuit a partir d'un montant</label>
257
+ <frontend_type>select</frontend_type>
258
+ <source_model>adminhtml/system_config_source_yesno</source_model>
259
+ <sort_order>18</sort_order>
260
+ <show_in_default>0</show_in_default>
261
+ <show_in_website>1</show_in_website>
262
+ <show_in_store>1</show_in_store>
263
+ </free_active>
264
+ <free_price translate="label">
265
+ <label>montant pour les Frais de port gratuit</label>
266
+ <frontend_type>text</frontend_type>
267
+ <sort_order>19</sort_order>
268
+ <show_in_default>0</show_in_default>
269
+ <show_in_website>1</show_in_website>
270
+ <show_in_store>1</show_in_store>
271
+ </free_price>
272
  </fields>
273
  </pointsrelais>
274
+ <pointsrelaiscd translate="label" module="shipping">
275
+ <label>Mondial Relay ColisDrive</label>
276
+ <frontend_type>text</frontend_type>
277
+ <sort_order>1</sort_order>
278
+ <show_in_default>1</show_in_default>
279
+ <show_in_website>1</show_in_website>
280
+ <show_in_store>1</show_in_store>
281
+ <fields>
282
+ <title translate="label">
283
+ <label>title</label>
284
+ <comment>Facultatif</comment>
285
+ <frontend_type>text</frontend_type>
286
+ <sort_order>17</sort_order>
287
+ <show_in_default>1</show_in_default>
288
+ <show_in_website>1</show_in_website>
289
+ <show_in_store>1</show_in_store>
290
+ </title>
291
+ <active translate="label">
292
+ <label>Enabled</label>
293
+ <frontend_type>select</frontend_type>
294
+ <source_model>adminhtml/system_config_source_yesno</source_model>
295
+ <sort_order>1</sort_order>
296
+ <show_in_default>1</show_in_default>
297
+ <show_in_website>1</show_in_website>
298
+ <show_in_store>1</show_in_store>
299
+ </active>
300
+ <enseigne translate="label">
301
+ <label>Enseigne</label>
302
+ <frontend_type>text</frontend_type>
303
+ <sort_order>2</sort_order>
304
+ <show_in_default>1</show_in_default>
305
+ <show_in_website>1</show_in_website>
306
+ <show_in_store>1</show_in_store>
307
+ </enseigne>
308
+ <marque translate="label">
309
+ <label>Référence de marque (Web service)</label>
310
+ <frontend_type>text</frontend_type>
311
+ <sort_order>3</sort_order>
312
+ <show_in_default>1</show_in_default>
313
+ <show_in_website>1</show_in_website>
314
+ <show_in_store>1</show_in_store>
315
+ </marque>
316
+ <cle translate="label">
317
+ <label>Clé (Web service)</label>
318
+ <frontend_type>text</frontend_type>
319
+ <sort_order>4</sort_order>
320
+ <show_in_default>1</show_in_default>
321
+ <show_in_website>1</show_in_website>
322
+ <show_in_store>1</show_in_store>
323
+ </cle>
324
+ <marque_url translate="label">
325
+ <label>Référence de marque (tracking)</label>
326
+ <frontend_type>text</frontend_type>
327
+ <sort_order>5</sort_order>
328
+ <show_in_default>1</show_in_default>
329
+ <show_in_website>1</show_in_website>
330
+ <show_in_store>1</show_in_store>
331
+ </marque_url>
332
+ <cle_url translate="label">
333
+ <label>Clé (tracking)</label>
334
+ <frontend_type>text</frontend_type>
335
+ <sort_order>6</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
+ </cle_url>
340
+ <adresse1_enseigne translate="label">
341
+ <label>Nom de l'expéditeur</label>
342
+ <comment>Sans accent svp...</comment>
343
+ <frontend_type>text</frontend_type>
344
+ <sort_order>7</sort_order>
345
+ <show_in_default>1</show_in_default>
346
+ <show_in_website>1</show_in_website>
347
+ <show_in_store>1</show_in_store>
348
+ </adresse1_enseigne>
349
+ <adresse3_enseigne translate="label">
350
+ <label>Adresse de l'expéditeur</label>
351
+ <frontend_type>text</frontend_type>
352
+ <sort_order>8</sort_order>
353
+ <show_in_default>1</show_in_default>
354
+ <show_in_website>1</show_in_website>
355
+ <show_in_store>1</show_in_store>
356
+ </adresse3_enseigne>
357
+ <adresse4_enseigne translate="label">
358
+ <label>Complément d'adresse</label>
359
+ <frontend_type>text</frontend_type>
360
+ <sort_order>9</sort_order>
361
+ <show_in_default>1</show_in_default>
362
+ <show_in_website>1</show_in_website>
363
+ <show_in_store>1</show_in_store>
364
+ </adresse4_enseigne>
365
+ <adresse4_enseigne translate="label">
366
+ <label>Complément d'adresse</label>
367
+ <frontend_type>text</frontend_type>
368
+ <sort_order>10</sort_order>
369
+ <show_in_default>1</show_in_default>
370
+ <show_in_website>1</show_in_website>
371
+ <show_in_store>1</show_in_store>
372
+ </adresse4_enseigne>
373
+ <cp_enseigne translate="label">
374
+ <label>Code postal</label>
375
+ <frontend_type>text</frontend_type>
376
+ <sort_order>11</sort_order>
377
+ <show_in_default>1</show_in_default>
378
+ <show_in_website>1</show_in_website>
379
+ <show_in_store>1</show_in_store>
380
+ </cp_enseigne>
381
+ <ville_enseigne translate="label">
382
+ <label>Ville de l'expéditeur</label>
383
+ <frontend_type>text</frontend_type>
384
+ <sort_order>12</sort_order>
385
+ <show_in_default>1</show_in_default>
386
+ <show_in_website>1</show_in_website>
387
+ <show_in_store>1</show_in_store>
388
+ </ville_enseigne>
389
+ <pays_enseigne translate="label">
390
+ <label>Code Pays de l'expéditeur</label>
391
+ <comment>FR, BE, etc...</comment>
392
+ <frontend_type>text</frontend_type>
393
+ <sort_order>13</sort_order>
394
+ <show_in_default>1</show_in_default>
395
+ <show_in_website>1</show_in_website>
396
+ <show_in_store>1</show_in_store>
397
+ </pays_enseigne>
398
+ <tel_enseigne translate="label">
399
+ <label>Téléphone</label>
400
+ <frontend_type>text</frontend_type>
401
+ <sort_order>14</sort_order>
402
+ <show_in_default>1</show_in_default>
403
+ <show_in_website>1</show_in_website>
404
+ <show_in_store>1</show_in_store>
405
+ </tel_enseigne>
406
+ <mobile_enseigne translate="label">
407
+ <label>Mobile</label>
408
+ <comment>Facultatif</comment>
409
+ <frontend_type>text</frontend_type>
410
+ <sort_order>15</sort_order>
411
+ <show_in_default>1</show_in_default>
412
+ <show_in_website>1</show_in_website>
413
+ <show_in_store>1</show_in_store>
414
+ </mobile_enseigne>
415
+ <mail_enseigne translate="label">
416
+ <label>E-mail</label>
417
+ <comment>Facultatif</comment>
418
+ <frontend_type>text</frontend_type>
419
+ <sort_order>16</sort_order>
420
+ <show_in_default>1</show_in_default>
421
+ <show_in_website>1</show_in_website>
422
+ <show_in_store>1</show_in_store>
423
+ </mail_enseigne>
424
+ <handling_type translate="label">
425
+ <label>Calculate Handling Fee</label>
426
+ <frontend_type>select</frontend_type>
427
+ <source_model>shipping/source_handlingType</source_model>
428
+ <sort_order>20</sort_order>
429
+ <show_in_default>1</show_in_default>
430
+ <show_in_website>1</show_in_website>
431
+ <show_in_store>0</show_in_store>
432
+ </handling_type>
433
+ <handling_fee translate="label">
434
+ <label>Handling Fee</label>
435
+ <frontend_type>text</frontend_type>
436
+ <sort_order>21</sort_order>
437
+ <show_in_default>1</show_in_default>
438
+ <show_in_website>1</show_in_website>
439
+ <show_in_store>1</show_in_store>
440
+ </handling_fee>
441
+ <package_weight translate="label">
442
+ <label>Package Weight</label>
443
+ <comment>in g</comment>
444
+ <frontend_type>text</frontend_type>
445
+ <sort_order>22</sort_order>
446
+ <show_in_default>1</show_in_default>
447
+ <show_in_website>1</show_in_website>
448
+ <show_in_store>1</show_in_store>
449
+ </package_weight>
450
+ <import translate="label">
451
+ <label>Import</label>
452
+ <comment>Vous permet d'importer le fichier de configuration des prix de livraison</comment>
453
+ <frontend_type>import</frontend_type>
454
+ <backend_model>adminhtml/system_config_backend_shipping_pointsrelaiscd</backend_model>
455
+ <sort_order>23</sort_order>
456
+ <show_in_default>0</show_in_default>
457
+ <show_in_website>1</show_in_website>
458
+ <show_in_store>0</show_in_store>
459
+ </import>
460
+ <export translate="label">
461
+ <label>Export</label>
462
+ <comment>Vous permet d'exporter le fichier de configuration des prix de livraison</comment>
463
+ <frontend_type>export_pointsrelaiscd</frontend_type>
464
+ <sort_order>24</sort_order>
465
+ <show_in_default>0</show_in_default>
466
+ <show_in_website>1</show_in_website>
467
+ <show_in_store>0</show_in_store>
468
+ </export>
469
+ <condition_name translate="label">
470
+ <label>Condition</label>
471
+ <frontend_type>select</frontend_type>
472
+ <comment>Lors d'un changement de condition, enregistrez la modification, puis vérifier le fichier de configuration des prix de livraison.</comment>
473
+ <source_model>adminhtml/system_config_source_shipping_pointsrelaiscd</source_model>
474
+ <sort_order>25</sort_order>
475
+ <show_in_default>0</show_in_default>
476
+ <show_in_website>1</show_in_website>
477
+ <show_in_store>0</show_in_store>
478
+ </condition_name>
479
+ <sallowspecific translate="label">
480
+ <label>Ship to applicable countries</label>
481
+ <frontend_type>select</frontend_type>
482
+ <sort_order>30</sort_order>
483
+ <frontend_class>shipping-applicable-country</frontend_class>
484
+ <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
485
+ <show_in_default>1</show_in_default>
486
+ <show_in_website>1</show_in_website>
487
+ <show_in_store>1</show_in_store>
488
+ </sallowspecific>
489
+ <specificcountry translate="label">
490
+ <label>Ship to Specific countries</label>
491
+ <frontend_type>multiselect</frontend_type>
492
+ <sort_order>31</sort_order>
493
+ <source_model>adminhtml/system_config_source_country</source_model>
494
+ <show_in_default>1</show_in_default>
495
+ <show_in_website>1</show_in_website>
496
+ <show_in_store>1</show_in_store>
497
+ </specificcountry>
498
+ <showmethod translate="label">
499
+ <label>Show method if not applicable</label>
500
+ <frontend_type>select</frontend_type>
501
+ <sort_order>40</sort_order>
502
+ <source_model>adminhtml/system_config_source_yesno</source_model>
503
+ <show_in_default>1</show_in_default>
504
+ <show_in_website>1</show_in_website>
505
+ <show_in_store>1</show_in_store>
506
+ </showmethod>
507
+ <specificerrmsg translate="label">
508
+ <label>Displayed Error Message</label>
509
+ <frontend_type>textarea</frontend_type>
510
+ <sort_order>41</sort_order>
511
+ <show_in_default>1</show_in_default>
512
+ <show_in_website>1</show_in_website>
513
+ <show_in_store>1</show_in_store>
514
+ </specificerrmsg>
515
+ <sort_order translate="label">
516
+ <label>Sort order</label>
517
+ <frontend_type>text</frontend_type>
518
+ <sort_order>100</sort_order>
519
+ <show_in_default>1</show_in_default>
520
+ <show_in_website>1</show_in_website>
521
+ <show_in_store>1</show_in_store>
522
+ </sort_order>
523
+ <free_active translate="label">
524
+ <label>Frais de port gratuit a partir d'un montant</label>
525
+ <frontend_type>select</frontend_type>
526
+ <source_model>adminhtml/system_config_source_yesno</source_model>
527
+ <sort_order>18</sort_order>
528
+ <show_in_default>0</show_in_default>
529
+ <show_in_website>1</show_in_website>
530
+ <show_in_store>1</show_in_store>
531
+ </free_active>
532
+ <free_price translate="label">
533
+ <label>montant pour les Frais de port gratuit</label>
534
+ <frontend_type>text</frontend_type>
535
+ <sort_order>19</sort_order>
536
+ <show_in_default>0</show_in_default>
537
+ <show_in_website>1</show_in_website>
538
+ <show_in_store>1</show_in_store>
539
+ </free_price>
540
+ </fields>
541
+ </pointsrelaiscd>
542
  <pointsrelaisld1 translate="label" module="shipping">
543
  <label>Mondial Relay - Livraison a domicile</label>
544
  <frontend_type>text</frontend_type>
797
  <show_in_website>1</show_in_website>
798
  <show_in_store>1</show_in_store>
799
  </sort_order>
800
+ <free_active translate="label">
801
+ <label>Frais de port gratuit a partir d'un montant</label>
802
+ <frontend_type>select</frontend_type>
803
+ <source_model>adminhtml/system_config_source_yesno</source_model>
804
+ <sort_order>18</sort_order>
805
+ <show_in_default>0</show_in_default>
806
+ <show_in_website>1</show_in_website>
807
+ <show_in_store>1</show_in_store>
808
+ </free_active>
809
+ <free_price translate="label">
810
+ <label>montant pour les Frais de port gratuit</label>
811
+ <frontend_type>text</frontend_type>
812
+ <sort_order>19</sort_order>
813
+ <show_in_default>0</show_in_default>
814
+ <show_in_website>1</show_in_website>
815
+ <show_in_store>1</show_in_store>
816
+ </free_price>
817
  </fields>
818
  </pointsrelaisld1>
819
  <pointsrelaislds translate="label" module="shipping">
824
  <show_in_website>1</show_in_website>
825
  <show_in_store>1</show_in_store>
826
  <fields>
827
+ <title translate="label">
828
+ <label>title</label>
829
+ <comment>Facultatif</comment>
830
+ <frontend_type>text</frontend_type>
831
+ <sort_order>17</sort_order>
832
+ <show_in_default>1</show_in_default>
833
+ <show_in_website>1</show_in_website>
834
+ <show_in_store>1</show_in_store>
835
+ </title>
836
  <active translate="label">
837
  <label>Enabled</label>
838
  <frontend_type>select</frontend_type>
979
  <label>Description</label>
980
  <comment>Facultatif</comment>
981
  <frontend_type>text</frontend_type>
982
+ <sort_order>17</sort_order>
983
  <show_in_default>1</show_in_default>
984
  <show_in_website>1</show_in_website>
985
  <show_in_store>1</show_in_store>
1083
  <show_in_website>1</show_in_website>
1084
  <show_in_store>1</show_in_store>
1085
  </sort_order>
1086
+ <free_active translate="label">
1087
+ <label>Frais de port gratuit a partir d'un montant</label>
1088
+ <frontend_type>select</frontend_type>
1089
+ <source_model>adminhtml/system_config_source_yesno</source_model>
1090
+ <sort_order>18</sort_order>
1091
+ <show_in_default>0</show_in_default>
1092
+ <show_in_website>1</show_in_website>
1093
+ <show_in_store>1</show_in_store>
1094
+ </free_active>
1095
+ <free_price translate="label">
1096
+ <label>montant pour les Frais de port gratuit</label>
1097
+ <frontend_type>text</frontend_type>
1098
+ <sort_order>19</sort_order>
1099
+ <show_in_default>0</show_in_default>
1100
+ <show_in_website>1</show_in_website>
1101
+ <show_in_store>1</show_in_store>
1102
+ </free_price>
1103
  </fields>
1104
  </pointsrelaislds>
1105
  </groups>
app/code/community/MondialRelay/Pointsrelais/sql/pointsrelais_setup/{mysql4-update-1.0.4.php → mysql4-upgrade-0.1.0-1.0.4.php} RENAMED
File without changes
app/code/community/MondialRelay/Pointsrelais/sql/pointsrelais_setup/{mysql4-update-1.2.0.php → mysql4-upgrade-1.0.4-1.2.0.php} RENAMED
File without changes
app/code/community/MondialRelay/Pointsrelais/sql/pointsrelais_setup/mysql4-upgrade-1.2.4-1.3.0.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+ $installer->startSetup();
5
+ $installer->run("
6
+ DROP TABLE IF EXISTS {$this->getTable('mondialrelay_pointsrelaiscd')};
7
+ CREATE TABLE {$this->getTable('mondialrelay_pointsrelaiscd')} (
8
+ `id` int(10) unsigned NOT NULL auto_increment,
9
+ `website_id` int(11) NOT NULL default '0',
10
+ `dest_country_id` varchar(4) NOT NULL default '0',
11
+ `dest_region_id` int(10) NOT NULL default '0',
12
+ `dest_zip` varchar(10) NOT NULL default '',
13
+ `condition_name` varchar(20) NOT NULL default '',
14
+ `condition_value` decimal(12,4) NOT NULL default '0.0000',
15
+ `price` decimal(12,4) NOT NULL default '0.0000',
16
+ `cost` decimal(12,4) NOT NULL default '0.0000',
17
+ PRIMARY KEY (`id`),
18
+ UNIQUE KEY `dest_country` (`website_id`,`dest_country_id`,`dest_region_id`,`dest_zip`,`condition_name`,`condition_value`)
19
+ ) DEFAULT CHARSET=utf8;
20
+ ");
21
+
22
+ $storesData = $installer->getConnection()->fetchAll("
23
+ SELECT
24
+ DISTINCT (s.website_id)
25
+ FROM
26
+ {$installer->getTable('core/store')} as s
27
+ WHERE
28
+ s.website_id NOT IN (SELECT DISTINCT (website_id) FROM {$this->getTable('mondialrelay_pointsrelaiscd')})
29
+ ");
30
+ foreach ($storesData as $storeData) {
31
+ $websiteId = $storeData['website_id'];
32
+ $query = "INSERT INTO {$this->getTable('mondialrelay_pointsrelaiscd')} (`website_id`, `dest_country_id`, `dest_region_id`, `dest_zip`, `condition_name`, `condition_value`, `price`, `cost`) VALUES
33
+ ({$websiteId}, 'FR', 0, '', 'package_weight', 1.0000, 4.2000, 4.2000),
34
+ ({$websiteId}, 'FR', 0, '', 'package_weight', 2.0000, 5.5000, 5.5000),
35
+ ({$websiteId}, 'FR', 0, '', 'package_weight', 3.0000, 6.2000, 6.2000),
36
+ ({$websiteId}, 'FR', 0, '', 'package_weight', 5.0000, 7.5000, 7.5000),
37
+ ({$websiteId}, 'FR', 0, '', 'package_weight', 7.0000, 9.6000, 9.6000),
38
+ ({$websiteId}, 'FR', 0, '', 'package_weight', 10.0000, 11.9500, 11.9500),
39
+ ({$websiteId}, 'FR', 0, '', 'package_weight', 15.0000, 14.3500, 14.3500),
40
+ ({$websiteId}, 'FR', 0, '', 'package_weight', 20.0000, 17.9500, 17.9500),
41
+ ({$websiteId}, 'BE', 0, '', 'package_weight', 0.5000, 4.2000, 4.2000),
42
+ ({$websiteId}, 'BE', 0, '', 'package_weight', 1.0000, 4.8000, 4.8000),
43
+ ({$websiteId}, 'BE', 0, '', 'package_weight', 2.0000, 5.5000, 5.5000),
44
+ ({$websiteId}, 'BE', 0, '', 'package_weight', 3.0000, 6.2000, 6.2000),
45
+ ({$websiteId}, 'BE', 0, '', 'package_weight', 5.0000, 7.5000, 7.5000),
46
+ ({$websiteId}, 'BE', 0, '', 'package_weight', 7.0000, 9.6000, 9.6000),
47
+ ({$websiteId}, 'BE', 0, '', 'package_weight', 10.0000, 11.9500, 11.9500),
48
+ ({$websiteId}, 'BE', 0, '', 'package_weight', 15.0000, 14.3500, 14.3500),
49
+ ({$websiteId}, 'BE', 0, '', 'package_weight', 20.0000, 17.9500, 17.9500);
50
+ ";
51
+ $installer->run($query);
52
+ }
53
+
54
+ $installer->endSetup();
app/design/adminhtml/default/mondialrelay/template/sales/order/invoice/create/form.phtml ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <form id="edit_form" method="post" action="<?php echo $this->getSaveUrl() ?>">
28
+ <?php echo $this->getBlockHtml('formkey')?>
29
+ <?php $_order = $this->getInvoice()->getOrder() ?>
30
+ <?php echo $this->getChildHtml('order_info') ?>
31
+ <?php if (!$_order->getIsVirtual()): ?>
32
+ <div class="box-left">
33
+ <?php else: ?>
34
+ <div class="box-right">
35
+ <?php endif; ?>
36
+
37
+ <div class="entry-edit">
38
+ <div class="entry-edit-head">
39
+ <h4 class="icon-head head-payment-method"><?php echo Mage::helper('sales')->__('Payment Information') ?></h4>
40
+ </div>
41
+ <fieldset>
42
+ <div><?php echo $this->getChildHtml('order_payment') ?></div>
43
+ <div><?php echo Mage::helper('sales')->__('Order was placed using %s', $_order->getOrderCurrencyCode()) ?></div>
44
+ </fieldset>
45
+ </div>
46
+ </div>
47
+ <?php if (!$_order->getIsVirtual()): ?>
48
+ <div class="box-right">
49
+ <!--Shipping Address-->
50
+ <div class="entry-edit">
51
+ <div class="entry-edit-head">
52
+ <h4 class="icon-head head-shipping-method"><?php echo Mage::helper('sales')->__('Shipping Information') ?></h4>
53
+ </div>
54
+ <fieldset>
55
+ <div>
56
+ <strong><?php echo $_order->getShippingDescription() ?></strong>
57
+ <?php echo $this->helper('sales')->__('Total Shipping Charges'); ?>:
58
+
59
+ <?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
60
+ <?php $_excl = $this->displayShippingPriceInclTax($_order); ?>
61
+ <?php else: ?>
62
+ <?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
63
+ <?php endif; ?>
64
+ <?php $_incl = $this->displayShippingPriceInclTax($_order); ?>
65
+
66
+ <?php echo $_excl; ?>
67
+ <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
68
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
69
+ <?php endif; ?>
70
+ </div>
71
+ <?php $_order = Mage::registry('current_invoice')->getOrder(); ?>
72
+ <?php $_shippingMethod = $_order->getShippingCarrier()->getCarrierCode(); ?>
73
+ <?php if ($this->canCreateShipment() && $this->canShipPartiallyItem()
74
+ && ($_shippingMethod != 'pointsrelais') && ($_shippingMethod != 'pointsrelaiscd') && ($_shippingMethod != 'pointsrelaisld1') && ($_shippingMethod != 'pointsrelaislds')): ?>
75
+ <p class="nm">
76
+ <label for="invoice_do_shipment" class="normal"><?php echo Mage::helper('sales')->__('Create Shipment') ?></label>
77
+ <input type="checkbox" name="invoice[do_shipment]" id="invoice_do_shipment" value="1" onclick="if ( this.checked==true ) { document.getElementById('tracking').style.display = 'block'} else { document.getElementById('tracking').style.display = 'none' }"<?php echo $this->hasInvoiceShipmentTypeMismatch()?' disabled="disabled"':'' ?> />
78
+ </p>
79
+ <?php if ($this->hasInvoiceShipmentTypeMismatch()): ?>
80
+ <small><?php echo $this->__('Some items in this order have different invoice and shipment types. You can create shipment only after the invoice is created.') ?></small>
81
+ <?php endif; ?>
82
+ <?php endif; ?>
83
+ <div id="tracking" style="display:none;"><?php echo $this->getChildHtml('tracking',false) ?></div>
84
+ </fieldset>
85
+ </div>
86
+ </div>
87
+ <?php endif; ?>
88
+ <div class="clear"></div>
89
+
90
+ <div class="entry-edit">
91
+ <div class="entry-edit-head">
92
+ <?php
93
+ $_itemsGridLabel = $this->getForcedShipmentCreate()?'Items to Invoice and Ship':'Items to Invoice';
94
+ ?>
95
+ <h4 class="icon-head head-products"><?php echo Mage::helper('sales')->__('%s', $_itemsGridLabel) ?></h4>
96
+ </div>
97
+ </div>
98
+ <div id="invoice_item_container">
99
+ <?php echo $this->getChildHtml('order_items') ?>
100
+ </div>
101
+ </form>
102
+ <script>
103
+ /*forced creating of shipment*/
104
+ var forcedShipmentCreate = <?php echo $this->getForcedShipmentCreate() ?>;
105
+ var shipmentElement = $('invoice_do_shipment');
106
+ if (forcedShipmentCreate && shipmentElement) {
107
+ shipmentElement.checked = true;
108
+ shipmentElement.disabled = true;
109
+ document.getElementById('tracking').style.display = 'block';
110
+ }
111
+ </script>
app/design/adminhtml/default/mondialrelay/template/sales/order/invoice/create/tracking.phtml ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <script type="text/javascript">
28
+ var trackingControl = {};
29
+ trackingControl = {
30
+ index : 0,
31
+ add : function () {
32
+ this.index++;
33
+ var data = {index:this.index};
34
+ Element.insert($('track_row_container'), {bottom: this.template.evaluate(data)});
35
+ $('trackingC' + this.index).disabled = false;
36
+ $('trackingT' + this.index).disabled = false;
37
+ $('trackingN' + this.index).disabled = false;
38
+ this.bindCurrierOnchange();
39
+ },
40
+ deleteRow : function(event) {
41
+ var row = Event.findElement(event, 'tr');
42
+ if (row) {
43
+ row.parentNode.removeChild(row)
44
+ }
45
+ },
46
+ bindCurrierOnchange : function() {
47
+ var elems = $('tracking_numbers_table').select('.select');
48
+ elems.each(function (elem) {
49
+ if (!elem.onchangeBound) {
50
+ elem.onchangeBound = true;
51
+ elem.valueInput = $(elem.parentNode.parentNode).select('.number-title')[0];
52
+ elem.observe('change', this.currierOnchange);
53
+ }
54
+ }.bind(this));
55
+ },
56
+ currierOnchange : function(event) {
57
+ var elem = Event.element(event);
58
+ var option = elem.options[elem.selectedIndex];
59
+ if (option.value && option.value != 'custom') {
60
+ elem.valueInput.value = option.text;
61
+ }
62
+ else {
63
+ elem.valueInput.value = '';
64
+ }
65
+ }
66
+ }
67
+ </script>
68
+ <?php $_order = Mage::registry('current_invoice')->getOrder(); ?>
69
+ <?php $_shippingMethod = $_order->getShippingCarrier()->getCarrierCode(); ?>
70
+
71
+ <div class="grid">
72
+ <table cellspacing="0" class="data" id="tracking_numbers_table">
73
+ <?php if (($_shippingMethod == 'pointsrelais') || ($_shippingMethod == 'pointsrelaiscd') || ($_shippingMethod == 'pointsrelaisld1') || ($_shippingMethod == 'pointsrelaislds')) : ?>
74
+ <div><?php echo $this->helper('pointsrelais')->__('Le numéro de tracking sera ajouté automatiquement'); ?></div>
75
+ <?php else: ?>
76
+ <col width="100" />
77
+ <col />
78
+ <col />
79
+ <col width="80" />
80
+ <thead>
81
+ <tr class="headings">
82
+ <th><?php echo Mage::helper('sales')->__('Carrier') ?></th>
83
+ <th><?php echo Mage::helper('sales')->__('Title') ?></th>
84
+ <th><?php echo Mage::helper('sales')->__('Number') ?></th>
85
+ <th class="last"><?php echo Mage::helper('sales')->__('Action') ?></th>
86
+ </tr>
87
+ </thead>
88
+ <tfoot>
89
+ <tr>
90
+ <td colspan="4" class="a-center last" style="padding:8px;"><?php echo $this->getChildHtml('add_button') ?></td>
91
+ </tr>
92
+ </tfoot>
93
+ <tbody id="track_row_container">
94
+ <tr id="track_row_template" class="template no-display">
95
+
96
+ <td>
97
+ <select name="tracking[__index__][carrier_code]" id="trackingC__index__" class="select carrier" style="width:110px;" disabled="disabled">
98
+ <?php foreach ($this->getCarriers() as $_code=>$_name): ?>
99
+ <option value="<?php echo $_code ?>"><?php echo $_name ?></option>
100
+ <?php endforeach; ?>
101
+ </select>
102
+ </td>
103
+ <td><input class="input-text number-title" type="text" name="tracking[__index__][title]" id="trackingT__index__" value="" disabled="disabled" /></td>
104
+ <td><input class="input-text" type="text" name="tracking[__index__][number]" id="trackingN__index__" value="" disabled="disabled" /></td>
105
+ <td class="last"><a href="#" onclick="trackingControl.deleteRow(event);return false"><?php echo $this->__('Delete') ?></a></td>
106
+
107
+ </tr>
108
+ </tbody>
109
+ <?php endif; ?>
110
+ </table>
111
+ </div>
112
+ <script type="text/javascript">
113
+ //<![CDATA[
114
+ trackingControl.template = new Template('<tr>' + $('track_row_template').innerHTML.replace(/__index__/g, '#{index}') + '<\/tr>');
115
+ //]]>
116
+ </script>
app/design/adminhtml/default/mondialrelay/template/sales/order/shipment/create/form.phtml ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design_default
22
+ * @package Mage
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <form id="edit_form" method="post" action="<?php echo $this->getSaveUrl() ?>">
28
+ <?php echo $this->getBlockHtml('formkey')?>
29
+ <?php $_order = $this->getShipment()->getOrder() ?>
30
+ <?php $_shippingMethod = explode("_",$_order->getShippingMethod()); ?>
31
+ <?php echo $this->getChildHtml('order_info') ?>
32
+
33
+
34
+ <div class="box-left">
35
+ <!--Billing Address-->
36
+ <div class="entry-edit">
37
+ <div class="entry-edit-head">
38
+ <h4 class="icon-head head-payment-method"><?php echo Mage::helper('sales')->__('Payment Information') ?></h4>
39
+ </div>
40
+ <fieldset>
41
+ <div><?php echo $this->getPaymentHtml() ?></div>
42
+ <div><?php echo Mage::helper('sales')->__('Order was placed using %s', $_order->getOrderCurrencyCode()) ?></div>
43
+ </fieldset>
44
+ </div>
45
+ </div>
46
+ <div class="box-right">
47
+ <!--Shipping Address-->
48
+ <div class="entry-edit">
49
+ <div class="entry-edit-head">
50
+ <h4 class="icon-head head-shipping-method"><?php echo Mage::helper('sales')->__('Shipping Information') ?></h4>
51
+ </div>
52
+ <fieldset>
53
+ <div>
54
+ <strong><?php echo $_order->getShippingDescription() ?></strong>
55
+ <?php echo $this->helper('sales')->__('Total Shipping Charges'); ?>:
56
+
57
+ <?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
58
+ <?php $_excl = $this->displayShippingPriceInclTax($_order); ?>
59
+ <?php else: ?>
60
+ <?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
61
+ <?php endif; ?>
62
+ <?php $_incl = $this->displayShippingPriceInclTax($_order); ?>
63
+
64
+ <?php echo $_excl; ?>
65
+ <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
66
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
67
+ <?php endif; ?>
68
+ </div>
69
+ <?php Mage::Log($_shippingMethod[0]); ?>
70
+ <?php if (($_shippingMethod[0] == 'pointsrelais') || ($_shippingMethod[0] == 'pointsrelaiscd') || ($_shippingMethod[0] == 'pointsrelaisld1') || ($_shippingMethod[0] == 'pointsrelaislds')) : ?>
71
+ <div><?php echo $this->helper('pointsrelais')->__('Le numéro de tracking sera ajouté automatiquement'); ?></div>
72
+ <?php else: ?>
73
+ <div><?php echo $this->getChildHtml('shipment_tracking') ?></div>
74
+ <?php endif; ?>
75
+ </fieldset>
76
+ </div>
77
+ </div>
78
+ <div class="clear"></div>
79
+
80
+ <div class="entry-edit">
81
+ <div class="entry-edit-head">
82
+ <h4 class="icon-head head-products"><?php echo Mage::helper('sales')->__('Items to Ship') ?></h4>
83
+ </div>
84
+ </div>
85
+ <div id="ship_items_container">
86
+ <?php echo $this->getItemsHtml() ?>
87
+ </div>
88
+ </form>
package.xml CHANGED
@@ -1,18 +1,20 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>MondialRelay_Pointsrelais</name>
4
- <version>1.2.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Module de livraison Mondial Relay</summary>
10
  <description>Module de livraison Mondial Relay</description>
11
- <notes>correction de la condition s&#xE9;lectionn&#xE9; dans une autre m&#xE9;thode.</notes>
 
 
12
  <authors><author><name>cyrille guillaud</name><user>auto-converted</user><email>cguillaud@cg-consulting.fr</email></author></authors>
13
- <date>2010-06-10</date>
14
- <time>17:24:58</time>
15
- <contents><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="pointsrelais.css" hash="229d09977ee2eac2e72dcb89bf8eb05c"/></dir><dir name="images"><dir name="mondialrelay"><file name="img_fermer.gif" hash="5901eaf779aa6fa3eac84d1dd9520113"/><file name="img_fleche.gif" hash="908f8a69124b7b16e3ec2caefc78d948"/><file name="logo_PR_01.gif" hash="7066eb60e2645b304d1b926d0a4c31e2"/><file name="Thumbs.db" hash="51da41310be9652f9360715494dc6b03"/></dir></dir><dir name="js"><file name="pointsrelais.js" hash="8008e112e4dd2f468b5726c561a5f8b4"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="pointsrelais.xml" hash="cecd44caa45a4124f3ed64a36137fd17"/></dir><dir name="template"><dir name="pointsrelais"><file name="baseurl.phtml" hash="ddbe6d60de42248171c32ac6279ae46d"/><file name="info.phtml" hash="bd616597f35a48a71bcd7bd1e4ad6575"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="fr_FR"><file name="MondialRelay_Pointsrelais.csv" hash="64ed2a0c6bde5f02862e24a0697a6109"/></dir></target><target name="mageetc"><dir name="modules"><file name="MondialRelay_All.xml" hash="8257e76c52b260553f8ce663c2a8b3d1"/></dir></target><target name="magecommunity"><dir name="MondialRelay"><dir name="Pointsrelais"><dir name="Block"><dir name="Sales"><dir name="Order"><dir name="Shipment"><file name="View.php" hash="376279b97f805cb9f4c233277aece2b4"/></dir></dir><dir name="Shipment"><file name="Grid.php" hash="5b2c413145a1d077bd7503ef8302a0a2"/></dir><file name="Impression.php" hash="0685fabf03cb81a76a643e2fbc7d90bd"/></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Exportpointsrelais.php" hash="770095d552bf84b666577c64ce867404"/><file name="Exportpointsrelaisld1.php" hash="04bbf4fbf5f6015c618ef6e8780a896a"/><file name="Exportpointsrelaislds.php" hash="a82da5ceaaf45eafeb71d14dd691fc4c"/></dir></dir><file name="Form.php" hash="4c0349261f32513bebafe15d0e1295ae"/></dir></dir><file name="Info.php" hash="d24bd6bcffe1eae00144d320f595d40d"/></dir><dir name="controllers"><dir name="Sales"><dir name="Order"><file name="ShipmentController.php" hash="a81a67c3a906c2f1318ee15058c5973c"/></dir><file name="ImpressionController.php" hash="3d4201841e0dfc10f96f5f4a77d5f214"/></dir><dir name="System"><file name="ConfigController.php" hash="ee82a3a607400f7d12589532a5988315"/></dir><file name="IndexController.php" hash="0b3068c6075d1ad50f32f802a91bdf38"/></dir><dir name="etc"><file name="config.xml" hash="67b5ed15c733cb961a7028cf8cda1cd5"/><file name="system.xml" hash="c3abb980f56d7dcaa1d5fadce91aac6e"/></dir><dir name="Helper"><file name="Data.php" hash="e81c10d80df89ecbd51715672c710d3e"/></dir><dir name="Model"><dir name="Carrier"><file name="Pointsrelais.php" hash="9f2d6bb82454c5e1fa54f618659577ca"/><file name="Pointsrelaisld1.php" hash="a4f7c6f91630e268def8376e2aa3c51b"/><file name="Pointsrelaislds.php" hash="b845a1b55af4f8d19b593e85d2b07f7e"/></dir><dir name="Mysql4"><dir name="Carrier"><dir name="Pointsrelais"><file name="Collection.php" hash="8c7735c2b69a53f234628b8ac0d946cd"/></dir><dir name="Pointsrelaisld1"><file name="Collection.php" hash="a844776e9aaa2b90ac2a491f2c2c3013"/></dir><dir name="Pointsrelaislds"><file name="Collection.php" hash="2d9338b9f0d9b2e4e7aa5baed24780b9"/></dir><file name="Pointsrelais.php" hash="c1d5c5f50611d060612ad557111152ce"/><file name="Pointsrelaisld1.php" hash="4db6f346ff99567b6eafdeac201c7726"/><file name="Pointsrelaislds.php" hash="64957492e8b2ce9b6e2ab0e6f5b6c7b0"/></dir></dir><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Shipping"><file name="Pointsrelais.php" hash="39881a493e895b1921f27b3b144450ee"/><file name="Pointsrelaisld1.php" hash="0ed2ee4ee8c3c725fa5f3c1cde0c6626"/><file name="Pointsrelaislds.php" hash="b1bbea361c6aeb38528af5892237d791"/></dir></dir><dir name="Source"><dir name="Shipping"><file name="Pointsrelais.php" hash="a75b6978fea52d78b0aabce1401cf9d3"/><file name="Pointsrelaisld1.php" hash="b8e21537df53d6eaba905855d0c459f2"/><file name="Pointsrelaislds.php" hash="9af32669854321d6136f2fa368566411"/></dir></dir></dir></dir><file name="Observer.php" hash="1538e54242450741dc7a64a74174584b"/></dir><dir name="sql"><dir name="pointsrelais_setup"><file name="mysql4-install-0.1.0.php" hash="bcef01a55bfd48286a132bba6a202ac4"/><file name="mysql4-install-1.2.0.php" hash="4b752ac0e50c7046f0c95516f17d6984"/><file name="mysql4-uninstall-1.2.0.php" hash="ddba123ff4181617d314cdb61dfd2f62"/><file name="mysql4-update-1.0.4.php" hash="caf165761a59a5a9e5caf71c3654ce94"/><file name="mysql4-update-1.2.0.php" hash="5e725e4377df89a26d7a6ff1cc8f32d6"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>MondialRelay_Pointsrelais</name>
4
+ <version>1.3.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Module de livraison Mondial Relay</summary>
10
  <description>Module de livraison Mondial Relay</description>
11
+ <notes>version sp&#xE9;cifique a magento &gt;= 1.4.1
12
+ ajout de colisDrive
13
+ ajout d'une option fdp gratuit a partir d'un certain montant.</notes>
14
  <authors><author><name>cyrille guillaud</name><user>auto-converted</user><email>cguillaud@cg-consulting.fr</email></author></authors>
15
+ <date>2010-11-15</date>
16
+ <time>12:15:30</time>
17
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="mondialrelay"><dir name="template"><dir name="sales"><dir name="order"><dir name="invoice"><dir name="create"><file name="form.phtml" hash="195ad76f25d4100df2461709e2eb6afa"/><file name="tracking.phtml" hash="a30e1d66bd837b4e11d63ee578c2be87"/></dir></dir><dir name="shipment"><dir name="create"><file name="form.phtml" hash="a0180e191534e9e92db20808327abe51"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="pointsrelais.xml" hash="cecd44caa45a4124f3ed64a36137fd17"/></dir><dir name="template"><dir name="pointsrelais"><file name="baseurl.phtml" hash="ddbe6d60de42248171c32ac6279ae46d"/><file name="info.phtml" hash="bd616597f35a48a71bcd7bd1e4ad6575"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="pointsrelais.css" hash="229d09977ee2eac2e72dcb89bf8eb05c"/></dir><dir name="images"><dir name="mondialrelay"><file name="img_fermer.gif" hash="5901eaf779aa6fa3eac84d1dd9520113"/><file name="img_fleche.gif" hash="908f8a69124b7b16e3ec2caefc78d948"/><file name="logo_PR_01.gif" hash="7066eb60e2645b304d1b926d0a4c31e2"/><file name="Thumbs.db" hash="51da41310be9652f9360715494dc6b03"/></dir></dir><dir name="js"><file name="pointsrelais.js" hash="8008e112e4dd2f468b5726c561a5f8b4"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="fr_FR"><file name="MondialRelay_Pointsrelais.csv" hash="64ed2a0c6bde5f02862e24a0697a6109"/></dir></target><target name="mageetc"><dir name="modules"><file name="MondialRelay_All.xml" hash="8257e76c52b260553f8ce663c2a8b3d1"/></dir></target><target name="magecommunity"><dir name="MondialRelay"><dir name="Pointsrelais"><dir name="Block"><dir name="Sales"><dir name="Order"><dir name="Shipment"><file name="View.php" hash="f27d3b193dd33dcd94a5a83f57502e78"/></dir></dir><dir name="Shipment"><file name="Grid.php" hash="bbe6793c04695371e22019334e2268e2"/><file name="Grid.php.old" hash="f9357e7514c3b653e15c4e705c121dac"/></dir><file name="Impression.php" hash="0685fabf03cb81a76a643e2fbc7d90bd"/></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Exportpointsrelais.php" hash="770095d552bf84b666577c64ce867404"/><file name="Exportpointsrelaiscd.php" hash="90f3ced57bf858b6e69795055b724009"/><file name="Exportpointsrelaisld1.php" hash="04bbf4fbf5f6015c618ef6e8780a896a"/><file name="Exportpointsrelaislds.php" hash="a82da5ceaaf45eafeb71d14dd691fc4c"/></dir></dir><file name="Form.php" hash="2fe314af15d89324aa020e7be2c9c492"/></dir></dir><file name="Info.php" hash="d24bd6bcffe1eae00144d320f595d40d"/></dir><dir name="controllers"><dir name="Sales"><dir name="Order"><file name="ShipmentController.php" hash="8cdf75d50390f382a72280d1697b5db4"/></dir><file name="ImpressionController.php" hash="2b5f808c845c1306ba16a82493e6cc95"/></dir><dir name="System"><file name="ConfigController.php" hash="291a57f80a7e1d6a6e2c757dea54869a"/></dir><file name="IndexController.php" hash="0b3068c6075d1ad50f32f802a91bdf38"/></dir><dir name="etc"><file name="config.xml" hash="a439fc0bb648f421b14e6acb3372c1b8"/><file name="system.xml" hash="f0d59b6905c82f871263fbd0d42c708b"/></dir><dir name="Helper"><file name="Data.php" hash="1aa9920b55f6cba7fd2d0fd57be0db13"/></dir><dir name="Model"><dir name="Carrier"><file name="Pointsrelais.php" hash="28fbd326bd914ae12a1c856972c601a4"/><file name="Pointsrelaiscd.php" hash="5226ae8f885de7cbe1c3f89401da8854"/><file name="Pointsrelaisld1.php" hash="c71c209cd2699a40eb51198465a90645"/><file name="Pointsrelaislds.php" hash="57af150f69fe9bb6fed91c0ff26463fb"/></dir><dir name="Mysql4"><dir name="Carrier"><dir name="Pointsrelais"><file name="Collection.php" hash="8c7735c2b69a53f234628b8ac0d946cd"/></dir><dir name="Pointsrelaiscd"><file name="Collection.php" hash="94e736c84e3a30561c8032551aecb9b7"/></dir><dir name="Pointsrelaisld1"><file name="Collection.php" hash="a844776e9aaa2b90ac2a491f2c2c3013"/></dir><dir name="Pointsrelaislds"><file name="Collection.php" hash="2d9338b9f0d9b2e4e7aa5baed24780b9"/></dir><file name="Pointsrelais.php" hash="c1d5c5f50611d060612ad557111152ce"/><file name="Pointsrelaiscd.php" hash="3b54fad46a50ea4a0d84cef8881738f4"/><file name="Pointsrelaisld1.php" hash="4db6f346ff99567b6eafdeac201c7726"/><file name="Pointsrelaislds.php" hash="64957492e8b2ce9b6e2ab0e6f5b6c7b0"/></dir></dir><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Shipping"><file name="Pointsrelais.php" hash="39881a493e895b1921f27b3b144450ee"/><file name="Pointsrelaiscd.php" hash="a03f6c213c222ea48652a9d885794682"/><file name="Pointsrelaisld1.php" hash="0ed2ee4ee8c3c725fa5f3c1cde0c6626"/><file name="Pointsrelaislds.php" hash="b1bbea361c6aeb38528af5892237d791"/></dir></dir><dir name="Source"><dir name="Shipping"><file name="Pointsrelais.php" hash="a75b6978fea52d78b0aabce1401cf9d3"/><file name="Pointsrelaiscd.php" hash="e68ff21b790e9c14fe7bc7c645fbfd02"/><file name="Pointsrelaisld1.php" hash="b8e21537df53d6eaba905855d0c459f2"/><file name="Pointsrelaislds.php" hash="9af32669854321d6136f2fa368566411"/></dir></dir></dir></dir><file name="Observer.php" hash="1538e54242450741dc7a64a74174584b"/></dir><dir name="sql"><dir name="pointsrelais_setup"><file name="mysql4-install-0.1.0.php" hash="bcef01a55bfd48286a132bba6a202ac4"/><file name="mysql4-install-1.2.0.php" hash="4b752ac0e50c7046f0c95516f17d6984"/><file name="mysql4-uninstall-1.2.0.php" hash="ddba123ff4181617d314cdb61dfd2f62"/><file name="mysql4-upgrade-0.1.0-1.0.4.php" hash="caf165761a59a5a9e5caf71c3654ce94"/><file name="mysql4-upgrade-1.0.4-1.2.0.php" hash="5e725e4377df89a26d7a6ff1cc8f32d6"/><file name="mysql4-upgrade-1.2.4-1.3.0.php" hash="b3eb7947cf0056d5e0a081329fc93d86"/></dir></dir></dir></dir></target></contents>
18
  <compatible/>
19
  <dependencies/>
20
  </package>