ColiPoste_La_Poste_Expeditor_Inet_So_Colissimo - Version 1.0.1

Version Notes

Compatible 1.5

Download this release

Release Info

Developer Berlioz
Extension ColiPoste_La_Poste_Expeditor_Inet_So_Colissimo
Version 1.0.1
Comparing to
See all releases


Code changes from version 1.0.0.1 to 1.0.1

app/code/community/LaPoste/ExpeditorINet/Block/Export/Orders/Grid.php CHANGED
@@ -5,12 +5,15 @@
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
8
- * @author Smile (http://www.smile.fr) & Jibé
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class LaPoste_ExpeditorINet_Block_Export_Orders_Grid extends Mage_Adminhtml_Block_Widget_Grid
12
  {
13
 
 
 
 
14
  public function __construct()
15
  {
16
  parent::__construct();
@@ -20,87 +23,126 @@ class LaPoste_ExpeditorINet_Block_Export_Orders_Grid extends Mage_Adminhtml_Bloc
20
  $this->setSaveParametersInSession(true);
21
  }
22
 
 
 
 
 
23
  protected function _prepareCollection()
24
  {
25
- if (Mage::getVersion() >= '1.4.1') {
26
- $collection = Mage::getResourceModel('sales/order_grid_collection')
27
- ->join('order', 'main_table.entity_id = order.entity_id', 'shipping_method');
 
28
  } else {
29
- $collection = Mage::getResourceModel('sales/order_collection')
30
- ->addAttributeToSelect(array('status', 'shipping_method'))
31
- ->joinAttribute('billing_firstname', 'order_address/firstname', 'billing_address_id', null, 'left')
32
- ->joinAttribute('billing_lastname', 'order_address/lastname', 'billing_address_id', null, 'left')
33
- ->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left')
34
- ->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left')
35
- ->addExpressionAttributeToSelect('billing_name',
36
- 'CONCAT({{billing_firstname}}, " ", {{billing_lastname}})',
37
- array('billing_firstname', 'billing_lastname'))
38
- ->addExpressionAttributeToSelect('shipping_name',
39
- 'CONCAT({{shipping_firstname}}, " ", {{shipping_lastname}})',
40
- array('shipping_firstname', 'shipping_lastname'));
 
 
 
 
41
  }
 
42
  $this->setCollection($collection);
43
  return parent::_prepareCollection();
44
  }
45
 
 
 
 
 
46
  protected function _prepareColumns()
47
  {
48
 
49
- $this->addColumn('real_order_id', array(
50
  'header'=> Mage::helper('sales')->__('Order #'),
51
  'width' => '80px',
52
  'type' => 'text',
53
  'index' => 'increment_id',
54
- ));
 
 
 
 
55
 
56
  if (!Mage::app()->isSingleStoreMode()) {
57
- $this->addColumn('store_id', array(
58
- 'header' => Mage::helper('sales')->__('Purchased from (store)'),
59
- 'index' => 'store_id',
60
- 'type' => 'store',
61
- 'store_view'=> true,
62
- 'display_deleted' => true,
63
- ));
 
 
64
  }
65
 
66
- $this->addColumn('created_at', array(
67
  'header' => Mage::helper('sales')->__('Purchased On'),
68
  'index' => 'created_at',
69
  'type' => 'datetime',
70
  'width' => '100px',
71
- ));
72
-
73
- $this->addColumn('billing_name', array(
74
- 'header' => Mage::helper('sales')->__('Bill to Name'),
75
- 'index' => 'billing_name',
76
- ));
77
-
78
- $this->addColumn('shipping_name', array(
79
- 'header' => Mage::helper('sales')->__('Ship to Name'),
80
- 'index' => 'shipping_name',
81
- ));
82
-
83
- $this->addColumn('base_grand_total', array(
84
- 'header' => Mage::helper('sales')->__('G.T. (Base)'),
85
- 'index' => 'base_grand_total',
86
- 'type' => 'currency',
87
- 'currency' => 'base_currency_code',
88
- ));
89
-
90
- $this->addColumn('carrier', array(
91
- 'header' => Mage::helper('sales')->__('Carrier'),
92
- 'index' => 'shipping_method',
93
- ));
94
-
95
- $this->addColumn('status', array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  'header' => Mage::helper('sales')->__('Status'),
97
  'index' => 'status',
98
  'type' => 'options',
99
  'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
100
- ));
 
 
 
 
101
 
102
  if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
103
- $this->addColumn('action',
 
104
  array(
105
  'header' => Mage::helper('sales')->__('Action'),
106
  'width' => '50px',
@@ -117,28 +159,39 @@ class LaPoste_ExpeditorINet_Block_Export_Orders_Grid extends Mage_Adminhtml_Bloc
117
  'sortable' => false,
118
  'index' => 'stores',
119
  'is_system' => true,
120
- ));
 
121
  }
122
 
123
  return parent::_prepareColumns();
124
  }
125
 
 
 
 
 
126
  protected function _prepareMassaction()
127
  {
128
  $this->setMassactionIdField('entity_id');
129
  $this->getMassactionBlock()->setFormFieldName('order_ids');
130
  if (Mage::getVersion() >= '1.4.1') {
131
- $this->getMassactionBlock()->setUseSelectAll(false);
132
  }
133
 
134
- $this->getMassactionBlock()->addItem('export_order', array(
135
- 'label'=> Mage::helper('expeditorinet')->__('Export to Expeditor Inet'),
136
- 'url' => $this->getUrl('*/*/export'),
137
- ));
 
 
138
 
139
  return $this;
140
  }
141
 
 
 
 
 
142
  public function getRowUrl($row)
143
  {
144
  if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
@@ -147,6 +200,10 @@ class LaPoste_ExpeditorINet_Block_Export_Orders_Grid extends Mage_Adminhtml_Bloc
147
  return false;
148
  }
149
 
 
 
 
 
150
  public function getGridUrl()
151
  {
152
  return $this->getUrl('*/*/*', array('_current'=>true));
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
8
+ * @author Smile (http://www.smile.fr) & Jibé
9
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10
  */
11
  class LaPoste_ExpeditorINet_Block_Export_Orders_Grid extends Mage_Adminhtml_Block_Widget_Grid
12
  {
13
 
14
+ /**
15
+ * Constructor
16
+ */
17
  public function __construct()
18
  {
19
  parent::__construct();
23
  $this->setSaveParametersInSession(true);
24
  }
25
 
26
+ /**
27
+ * Prepare order collection (for different Magento versions)
28
+ * @return LaPoste_ExpeditorINet_Block_Export_Orders_Grid
29
+ */
30
  protected function _prepareCollection()
31
  {
32
+ if (version_compare(Mage::getVersion(), '1.4', '>=')) {
33
+ $collection = Mage::getResourceModel('sales/order_grid_collection')
34
+ ->join('order', 'main_table.entity_id = order.entity_id', array('shipping_method'));
35
+
36
  } else {
37
+ $collection = Mage::getResourceModel('sales/order_collection')
38
+ ->addAttributeToSelect(array('status', 'shipping_method'))
39
+ ->joinAttribute('billing_firstname', 'order_address/firstname', 'billing_address_id', null, 'left')
40
+ ->joinAttribute('billing_lastname', 'order_address/lastname', 'billing_address_id', null, 'left')
41
+ ->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left')
42
+ ->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left')
43
+ ->addExpressionAttributeToSelect(
44
+ 'billing_name',
45
+ 'CONCAT({{billing_firstname}}, " ", {{billing_lastname}})',
46
+ array('billing_firstname', 'billing_lastname')
47
+ )
48
+ ->addExpressionAttributeToSelect(
49
+ 'shipping_name',
50
+ 'CONCAT({{shipping_firstname}}, " ", {{shipping_lastname}})',
51
+ array('shipping_firstname', 'shipping_lastname')
52
+ );
53
  }
54
+
55
  $this->setCollection($collection);
56
  return parent::_prepareCollection();
57
  }
58
 
59
+ /**
60
+ * Prepare grid columns (for different Magento versions)
61
+ * @return LaPoste_ExpeditorINet_Block_Export_Orders_Grid
62
+ */
63
  protected function _prepareColumns()
64
  {
65
 
66
+ $columnData = array(
67
  'header'=> Mage::helper('sales')->__('Order #'),
68
  'width' => '80px',
69
  'type' => 'text',
70
  'index' => 'increment_id',
71
+ );
72
+ if (version_compare(Mage::getVersion(), '1.4', '>=')) {
73
+ $columnData['filter_index'] = 'main_table.'.$columnData['index'];
74
+ }
75
+ $this->addColumn('real_order_id', $columnData);
76
 
77
  if (!Mage::app()->isSingleStoreMode()) {
78
+ $this->addColumn(
79
+ 'store_id', array(
80
+ 'header' => Mage::helper('sales')->__('Purchased from (store)'),
81
+ 'index' => 'store_id',
82
+ 'type' => 'store',
83
+ 'store_view'=> true,
84
+ 'display_deleted' => true,
85
+ )
86
+ );
87
  }
88
 
89
+ $columnData = array(
90
  'header' => Mage::helper('sales')->__('Purchased On'),
91
  'index' => 'created_at',
92
  'type' => 'datetime',
93
  'width' => '100px',
94
+ );
95
+ if (version_compare(Mage::getVersion(), '1.4', '>=')) {
96
+ $columnData['filter_index'] = 'main_table.'.$columnData['index'];
97
+ }
98
+ $this->addColumn('created_at', $columnData);
99
+
100
+ $this->addColumn(
101
+ 'billing_name', array(
102
+ 'header' => Mage::helper('sales')->__('Bill to Name'),
103
+ 'index' => 'billing_name',
104
+ )
105
+ );
106
+
107
+ $this->addColumn(
108
+ 'shipping_name', array(
109
+ 'header' => Mage::helper('sales')->__('Ship to Name'),
110
+ 'index' => 'shipping_name',
111
+ )
112
+ );
113
+
114
+ $columnData = array(
115
+ 'header' => Mage::helper('sales')->__('G.T. (Base)'),
116
+ 'index' => 'base_grand_total',
117
+ 'type' => 'currency',
118
+ 'currency' => 'base_currency_code'
119
+ );
120
+ if (version_compare(Mage::getVersion(), '1.4', '>=')) {
121
+ $columnData['filter_index'] = 'main_table.'.$columnData['index'];
122
+ }
123
+ $this->addColumn('base_grand_total', $columnData);
124
+
125
+ $this->addColumn(
126
+ 'carrier', array(
127
+ 'header' => Mage::helper('sales')->__('Carrier'),
128
+ 'index' => 'shipping_method',
129
+ )
130
+ );
131
+
132
+ $columnData = array(
133
  'header' => Mage::helper('sales')->__('Status'),
134
  'index' => 'status',
135
  'type' => 'options',
136
  'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
137
+ );
138
+ if (version_compare(Mage::getVersion(), '1.4', '>=')) {
139
+ $columnData['filter_index'] = 'main_table.'.$columnData['index'];
140
+ }
141
+ $this->addColumn('status', $columnData);
142
 
143
  if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
144
+ $this->addColumn(
145
+ 'action',
146
  array(
147
  'header' => Mage::helper('sales')->__('Action'),
148
  'width' => '50px',
159
  'sortable' => false,
160
  'index' => 'stores',
161
  'is_system' => true,
162
+ )
163
+ );
164
  }
165
 
166
  return parent::_prepareColumns();
167
  }
168
 
169
+ /**
170
+ * Prepare mass action (for different Magento versions)
171
+ * @return LaPoste_ExpeditorINet_Block_Export_Orders_Grid
172
+ */
173
  protected function _prepareMassaction()
174
  {
175
  $this->setMassactionIdField('entity_id');
176
  $this->getMassactionBlock()->setFormFieldName('order_ids');
177
  if (Mage::getVersion() >= '1.4.1') {
178
+ $this->getMassactionBlock()->setUseSelectAll(false);
179
  }
180
 
181
+ $this->getMassactionBlock()->addItem(
182
+ 'export_order', array(
183
+ 'label'=> Mage::helper('expeditorinet')->__('Export to Expeditor Inet'),
184
+ 'url' => $this->getUrl('*/*/export'),
185
+ )
186
+ );
187
 
188
  return $this;
189
  }
190
 
191
+ /**
192
+ * Get url called when user click on a grid row
193
+ * @return string|boolean
194
+ */
195
  public function getRowUrl($row)
196
  {
197
  if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
200
  return false;
201
  }
202
 
203
+ /**
204
+ * Get grid url
205
+ * @return string
206
+ */
207
  public function getGridUrl()
208
  {
209
  return $this->getUrl('*/*/*', array('_current'=>true));
app/code/community/LaPoste/ExpeditorINet/controllers/ExportController.php CHANGED
@@ -30,6 +30,23 @@ class LaPoste_ExpeditorINet_ExportController extends Mage_Adminhtml_Controller_A
30
  ->renderLayout();
31
  }
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  /**
34
  * Export Action
35
  * Generates a CSV file to download
@@ -139,7 +156,7 @@ class LaPoste_ExpeditorINet_ExportController extends Mage_Adminhtml_Controller_A
139
  $content = $this->_addFieldToCsv($content, $delimiter, $order->getSocoShippingInstruction());
140
  $content .= $separator;
141
  /* civilite */
142
- $content = $this->_addFieldToCsv($content, $delimiter, $order->getSocoCivility());
143
  $content .= $separator;
144
  /* code porte 1 */
145
  $content = $this->_addFieldToCsv($content, $delimiter, $order->getSocoDoorCode1());
@@ -206,4 +223,4 @@ class LaPoste_ExpeditorINet_ExportController extends Mage_Adminhtml_Controller_A
206
  return $csvContent . $fieldDelimiter . $fieldContent . $fieldDelimiter;
207
  }
208
 
209
- }
30
  ->renderLayout();
31
  }
32
 
33
+ /**
34
+ * convert civlity in letters to a code for Expeditor
35
+ * @param civility : string
36
+ */
37
+ private function getExpeditorCodeForCivility($civility)
38
+ {
39
+ if (strtolower($civility) == 'm.') {
40
+ return 2;
41
+ } elseif (strtolower($civility) == 'mme') {
42
+ return 3;
43
+ } elseif (strtolower($civility) == 'mlle') {
44
+ return 4;
45
+ } else {
46
+ return 1;
47
+ }
48
+ }
49
+
50
  /**
51
  * Export Action
52
  * Generates a CSV file to download
156
  $content = $this->_addFieldToCsv($content, $delimiter, $order->getSocoShippingInstruction());
157
  $content .= $separator;
158
  /* civilite */
159
+ $content = $this->_addFieldToCsv($content, $delimiter, $this->getExpeditorCodeForCivility($order->getSocoCivility()));
160
  $content .= $separator;
161
  /* code porte 1 */
162
  $content = $this->_addFieldToCsv($content, $delimiter, $order->getSocoDoorCode1());
223
  return $csvContent . $fieldDelimiter . $fieldContent . $fieldDelimiter;
224
  }
225
 
226
+ }
app/code/community/LaPoste/ExpeditorINet/etc/config.xml CHANGED
@@ -14,10 +14,10 @@
14
 
15
  <modules>
16
  <LaPoste_ExpeditorINet>
17
- <version>1.0.0</version>
18
- <depends>
19
- <Mage_Sales />
20
- <Mage_Adminhtml />
21
  </depends>
22
  </LaPoste_ExpeditorINet>
23
  </modules>
14
 
15
  <modules>
16
  <LaPoste_ExpeditorINet>
17
+ <version>1.0.1</version>
18
+ <depends>
19
+ <Mage_Sales />
20
+ <Mage_Adminhtml />
21
  </depends>
22
  </LaPoste_ExpeditorINet>
23
  </modules>
package.xml CHANGED
@@ -1,23 +1,23 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ColiPoste_La_Poste_Expeditor_Inet_So_Colissimo</name>
4
- <version>1.0.0.1</version>
5
  <stability>stable</stability>
6
- <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Extension officielle permettant d'exporter les commandes So Colissimo (et autres) dans le logiciel Expeditor INET de La Poste / ColisPoste</summary>
10
- <description>Cette extension officielle permet d'exporter les commandes dans le logiciel Expeditor INET de La Poste / ColiPoste.
11
-
12
- Ce module est compatible avec les commandes utilisant le mode de livraison So Colissimo.
13
-
14
- Test&amp;eacute; et valid&amp;eacute; sur Magento CE 1.3.2.4, 1.4.1.1, PE 1.8, EE 1.8 et EE 1.9.
15
  R&amp;eacute;alisation par Smile sur la base du module cr&#xE9;&#xE9; par Jib&#xE9;.</description>
16
- <notes>Lire le manuel d'installation</notes>
17
- <authors><author><name>Berlioz</name><user>auto-converted</user><email>Aline.BERLIOZ@laposte.fr</email></author></authors>
18
- <date>2011-01-03</date>
19
- <time>11:24:05</time>
20
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="expeditorinet"><dir name="import"><file name="form.phtml" hash="1413b5588abae748f040c73e655f3932"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="fr_FR"><file name="LaPoste_ExpeditorINet.csv" hash="b59e1a3a7f65747aea2386606e7a89e8"/></dir></target><target name="magecommunity"><dir name="LaPoste"><dir name="ExpeditorINet"><dir name="Block"><dir name="Export"><dir name="Orders"><file name="Grid.php" hash="a341cd79cfbc0dc46290d1d8816b1554"/></dir><file name="Orders.php" hash="9b53cb8c1bb73ca5c3091fbf1f3c070b"/></dir><dir name="Import"><file name="Form.php" hash="8efe032ad2523ce95d00fd2436528002"/></dir></dir><dir name="controllers"><file name="ExportController.php" hash="c1faa809300821d82f4fceab3755c589"/><file name="ImportController.php" hash="c2e94c15c78dcb7ea07eee005cdd2927"/></dir><dir name="etc"><file name="config.xml" hash="bfe6c67997dc2fe80246fc879b3d540a"/><file name="system.xml" hash="a1465132f56c4a574887fc776cbd7342"/></dir><dir name="Helper"><file name="Data.php" hash="d3d3efa2b60302d4eb719c60cb6cb39b"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="EndOfLineCharacter.php" hash="6cf85adc9a0e733d0ebd6e46c35b436d"/><file name="FieldDelimiter.php" hash="7c5702eff84345a5aeb1691033031602"/><file name="FieldSeparator.php" hash="1f7b189cd8e390044ff044a12abe2484"/><file name="FileCharset.php" hash="2a562111c2c7d9e8e3f8ad7094bcff8c"/><file name="FileExtension.php" hash="1702d1540a90608f52c0421476b3cc2c"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="LaPoste_ExpeditorINet.xml" hash="2a7c93ada6b605d49fb6c047d0feb72e"/></dir></target></contents>
21
  <compatible/>
22
- <dependencies/>
23
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ColiPoste_La_Poste_Expeditor_Inet_So_Colissimo</name>
4
+ <version>1.0.1</version>
5
  <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Extension officielle permettant d'exporter les commandes So Colissimo (et autres) dans le logiciel Expeditor INET de La Poste / ColisPoste</summary>
10
+ <description>Cette extension officielle permet d'exporter les commandes dans le logiciel Expeditor INET de La Poste / ColiPoste.&#xD;
11
+ &#xD;
12
+ Ce module est compatible avec les commandes utilisant le mode de livraison So Colissimo.&#xD;
13
+ &#xD;
14
+ Test&amp;eacute; et valid&amp;eacute; sur Magento CE 1.3.2.4, 1.4.1.1, PE 1.8, EE 1.8 et EE 1.9.&#xD;
15
  R&amp;eacute;alisation par Smile sur la base du module cr&#xE9;&#xE9; par Jib&#xE9;.</description>
16
+ <notes>Compatible 1.5</notes>
17
+ <authors><author><name>Berlioz</name><user>Aline</user><email>Aline.BERLIOZ@laposte.fr</email></author></authors>
18
+ <date>2011-05-05</date>
19
+ <time>14:22:58</time>
20
+ <contents><target name="magedesign"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="expeditorinet"><dir name="import"><file name="form.phtml" hash="1413b5588abae748f040c73e655f3932"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir><dir name="fr_FR"><file name="LaPoste_ExpeditorINet.csv" hash="b59e1a3a7f65747aea2386606e7a89e8"/></dir></dir></target><target name="magecommunity"><dir><dir name="LaPoste"><dir name="ExpeditorINet"><dir name="Block"><dir name="Export"><dir name="Orders"><file name="Grid.php" hash="790cd1c34966bfeb863f73784dabc005"/></dir><file name="Orders.php" hash="9b53cb8c1bb73ca5c3091fbf1f3c070b"/></dir><dir name="Import"><file name="Form.php" hash="8efe032ad2523ce95d00fd2436528002"/></dir></dir><dir name="Helper"><file name="Data.php" hash="d3d3efa2b60302d4eb719c60cb6cb39b"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="EndOfLineCharacter.php" hash="6cf85adc9a0e733d0ebd6e46c35b436d"/><file name="FieldDelimiter.php" hash="7c5702eff84345a5aeb1691033031602"/><file name="FieldSeparator.php" hash="1f7b189cd8e390044ff044a12abe2484"/><file name="FileCharset.php" hash="2a562111c2c7d9e8e3f8ad7094bcff8c"/><file name="FileExtension.php" hash="1702d1540a90608f52c0421476b3cc2c"/></dir></dir></dir><dir name="controllers"><file name="ExportController.php" hash="514c1f165effe2954e9538da23e381f1"/><file name="ImportController.php" hash="c2e94c15c78dcb7ea07eee005cdd2927"/></dir><dir name="etc"><file name="config.xml" hash="20f1935333b25648b7b9c6d7799a804a"/><file name="system.xml" hash="a1465132f56c4a574887fc776cbd7342"/></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="LaPoste_ExpeditorINet.xml" hash="2a7c93ada6b605d49fb6c047d0feb72e"/></dir></dir></target></contents>
21
  <compatible/>
22
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
23
  </package>