ColiPoste_La_Poste_Expeditor_Inet_So_Colissimo - Version 1.0.3

Version Notes

Ajout du champ code réseau point de retrait

Download this release

Release Info

Developer Berlioz
Extension ColiPoste_La_Poste_Expeditor_Inet_So_Colissimo
Version 1.0.3
Comparing to
See all releases


Code changes from version 1.0.2 to 1.0.3

app/code/community/LaPoste/ExpeditorINet/Block/Export/Orders.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * LaPoste_ExpeditorINet
4
- *
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
@@ -10,7 +10,11 @@
10
  */
11
  class LaPoste_ExpeditorINet_Block_Export_Orders extends Mage_Adminhtml_Block_Widget_Grid_Container
12
  {
13
-
 
 
 
 
14
  public function __construct()
15
  {
16
  $this->_blockGroup = 'expeditorinet';
@@ -19,5 +23,4 @@ class LaPoste_ExpeditorINet_Block_Export_Orders extends Mage_Adminhtml_Block_Wid
19
  parent::__construct();
20
  $this->_removeButton('add');
21
  }
22
-
23
  }
1
  <?php
2
  /**
3
  * LaPoste_ExpeditorINet
4
+ *
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
10
  */
11
  class LaPoste_ExpeditorINet_Block_Export_Orders extends Mage_Adminhtml_Block_Widget_Grid_Container
12
  {
13
+ /**
14
+ * Constructor
15
+ *
16
+ * @return void
17
+ */
18
  public function __construct()
19
  {
20
  $this->_blockGroup = 'expeditorinet';
23
  parent::__construct();
24
  $this->_removeButton('add');
25
  }
 
26
  }
app/code/community/LaPoste/ExpeditorINet/Block/Export/Orders/Grid.php CHANGED
@@ -10,9 +10,10 @@
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
  {
@@ -25,6 +26,7 @@ class LaPoste_ExpeditorINet_Block_Export_Orders_Grid extends Mage_Adminhtml_Bloc
25
 
26
  /**
27
  * Prepare order collection (for different Magento versions)
 
28
  * @return LaPoste_ExpeditorINet_Block_Export_Orders_Grid
29
  */
30
  protected function _prepareCollection()
@@ -32,7 +34,6 @@ class LaPoste_ExpeditorINet_Block_Export_Orders_Grid extends Mage_Adminhtml_Bloc
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'))
@@ -58,11 +59,11 @@ class LaPoste_ExpeditorINet_Block_Export_Orders_Grid extends Mage_Adminhtml_Bloc
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',
@@ -70,22 +71,21 @@ class LaPoste_ExpeditorINet_Block_Export_Orders_Grid extends Mage_Adminhtml_Bloc
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
  $columnData = array(
79
- 'header' => Mage::helper('sales')->__('Purchased from (store)'),
80
- 'index' => 'store_id',
81
- 'type' => 'store',
82
- 'store_view'=> true,
83
- 'display_deleted' => true,
84
  );
85
  if (version_compare(Mage::getVersion(), '1.4', '>=')) {
86
- $columnData['filter_index'] = 'main_table.'.$columnData['index'];
87
  }
88
-
89
  $this->addColumn('store_id', $columnData);
90
  }
91
 
@@ -96,7 +96,7 @@ class LaPoste_ExpeditorINet_Block_Export_Orders_Grid extends Mage_Adminhtml_Bloc
96
  'width' => '100px',
97
  );
98
  if (version_compare(Mage::getVersion(), '1.4', '>=')) {
99
- $columnData['filter_index'] = 'main_table.'.$columnData['index'];
100
  }
101
  $this->addColumn('created_at', $columnData);
102
 
@@ -118,7 +118,7 @@ class LaPoste_ExpeditorINet_Block_Export_Orders_Grid extends Mage_Adminhtml_Bloc
118
  'header' => Mage::helper('sales')->__('G.T. (Base)'),
119
  'index' => 'base_grand_total',
120
  'type' => 'currency',
121
- 'currency' => 'base_currency_code'
122
  );
123
  if (version_compare(Mage::getVersion(), '1.4', '>=')) {
124
  $columnData['filter_index'] = 'main_table.'.$columnData['index'];
@@ -155,8 +155,8 @@ class LaPoste_ExpeditorINet_Block_Export_Orders_Grid extends Mage_Adminhtml_Bloc
155
  array(
156
  'caption' => Mage::helper('sales')->__('View'),
157
  'url' => array('base'=>'adminhtml/sales_order/view'),
158
- 'field' => 'order_id'
159
- )
160
  ),
161
  'filter' => false,
162
  'sortable' => false,
@@ -171,6 +171,7 @@ class LaPoste_ExpeditorINet_Block_Export_Orders_Grid extends Mage_Adminhtml_Bloc
171
 
172
  /**
173
  * Prepare mass action (for different Magento versions)
 
174
  * @return LaPoste_ExpeditorINet_Block_Export_Orders_Grid
175
  */
176
  protected function _prepareMassaction()
@@ -193,23 +194,23 @@ class LaPoste_ExpeditorINet_Block_Export_Orders_Grid extends Mage_Adminhtml_Bloc
193
 
194
  /**
195
  * Get url called when user click on a grid row
196
- * @return string|boolean
 
197
  */
198
  public function getRowUrl($row)
199
  {
200
- if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
201
- return $this->getUrl('adminhtml/sales_order/view', array('order_id' => $row->getId()));
202
- }
203
- return false;
204
  }
205
 
206
  /**
207
  * Get grid url
 
208
  * @return string
209
  */
210
  public function getGridUrl()
211
  {
212
  return $this->getUrl('*/*/*', array('_current'=>true));
213
  }
214
-
215
  }
10
  */
11
  class LaPoste_ExpeditorINet_Block_Export_Orders_Grid extends Mage_Adminhtml_Block_Widget_Grid
12
  {
 
13
  /**
14
  * Constructor
15
+ *
16
+ * @return void
17
  */
18
  public function __construct()
19
  {
26
 
27
  /**
28
  * Prepare order collection (for different Magento versions)
29
+ *
30
  * @return LaPoste_ExpeditorINet_Block_Export_Orders_Grid
31
  */
32
  protected function _prepareCollection()
34
  if (version_compare(Mage::getVersion(), '1.4', '>=')) {
35
  $collection = Mage::getResourceModel('sales/order_grid_collection')
36
  ->join('order', 'main_table.entity_id = order.entity_id', array('shipping_method'));
 
37
  } else {
38
  $collection = Mage::getResourceModel('sales/order_collection')
39
  ->addAttributeToSelect(array('status', 'shipping_method'))
59
 
60
  /**
61
  * Prepare grid columns (for different Magento versions)
62
+ *
63
  * @return LaPoste_ExpeditorINet_Block_Export_Orders_Grid
64
  */
65
  protected function _prepareColumns()
66
  {
 
67
  $columnData = array(
68
  'header'=> Mage::helper('sales')->__('Order #'),
69
  'width' => '80px',
71
  'index' => 'increment_id',
72
  );
73
  if (version_compare(Mage::getVersion(), '1.4', '>=')) {
74
+ $columnData['filter_index'] = 'main_table.' . $columnData['index'];
75
  }
76
  $this->addColumn('real_order_id', $columnData);
77
 
78
  if (!Mage::app()->isSingleStoreMode()) {
79
  $columnData = 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
  if (version_compare(Mage::getVersion(), '1.4', '>=')) {
87
+ $columnData['filter_index'] = 'main_table.' . $columnData['index'];
88
  }
 
89
  $this->addColumn('store_id', $columnData);
90
  }
91
 
96
  'width' => '100px',
97
  );
98
  if (version_compare(Mage::getVersion(), '1.4', '>=')) {
99
+ $columnData['filter_index'] = 'main_table.' . $columnData['index'];
100
  }
101
  $this->addColumn('created_at', $columnData);
102
 
118
  'header' => Mage::helper('sales')->__('G.T. (Base)'),
119
  'index' => 'base_grand_total',
120
  'type' => 'currency',
121
+ 'currency' => 'base_currency_code',
122
  );
123
  if (version_compare(Mage::getVersion(), '1.4', '>=')) {
124
  $columnData['filter_index'] = 'main_table.'.$columnData['index'];
155
  array(
156
  'caption' => Mage::helper('sales')->__('View'),
157
  'url' => array('base'=>'adminhtml/sales_order/view'),
158
+ 'field' => 'order_id',
159
+ ),
160
  ),
161
  'filter' => false,
162
  'sortable' => false,
171
 
172
  /**
173
  * Prepare mass action (for different Magento versions)
174
+ *
175
  * @return LaPoste_ExpeditorINet_Block_Export_Orders_Grid
176
  */
177
  protected function _prepareMassaction()
194
 
195
  /**
196
  * Get url called when user click on a grid row
197
+ *
198
+ * @return string|bool
199
  */
200
  public function getRowUrl($row)
201
  {
202
+ return (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view'))
203
+ ? $this->getUrl('adminhtml/sales_order/view', array('order_id' => $row->getId()))
204
+ : false;
 
205
  }
206
 
207
  /**
208
  * Get grid url
209
+ *
210
  * @return string
211
  */
212
  public function getGridUrl()
213
  {
214
  return $this->getUrl('*/*/*', array('_current'=>true));
215
  }
 
216
  }
app/code/community/LaPoste/ExpeditorINet/Block/Import/Form.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * LaPoste_ExpeditorINet
4
- *
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
@@ -10,11 +10,14 @@
10
  */
11
  class LaPoste_ExpeditorINet_Block_Import_Form extends Mage_Adminhtml_Block_Widget
12
  {
13
-
 
 
 
 
14
  public function __construct()
15
  {
16
  parent::__construct();
17
  $this->setTemplate('expeditorinet/import/form.phtml');
18
  }
19
-
20
  }
1
  <?php
2
  /**
3
  * LaPoste_ExpeditorINet
4
+ *
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
10
  */
11
  class LaPoste_ExpeditorINet_Block_Import_Form extends Mage_Adminhtml_Block_Widget
12
  {
13
+ /**
14
+ * Constructor
15
+ *
16
+ * @return void
17
+ */
18
  public function __construct()
19
  {
20
  parent::__construct();
21
  $this->setTemplate('expeditorinet/import/form.phtml');
22
  }
 
23
  }
app/code/community/LaPoste/ExpeditorINet/Helper/Data.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * LaPoste_ExpeditorINet
4
- *
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
@@ -10,55 +10,125 @@
10
  */
11
  class LaPoste_ExpeditorINet_Helper_Data extends Mage_Core_Helper_Abstract
12
  {
13
-
14
  /**
15
- * Export configuration
 
 
16
  */
17
- public function getConfigurationFileExtension() {
 
18
  return Mage::getStoreConfig('expeditorinet/export/file_extension');
19
  }
20
 
21
- public function getConfigurationFileCharset() {
 
 
 
 
 
 
22
  return Mage::getStoreConfig('expeditorinet/export/file_charset');
23
  }
24
 
25
- public function getConfigurationEndOfLineCharacter() {
 
 
 
 
 
 
26
  return Mage::getStoreConfig('expeditorinet/export/endofline_character');
27
  }
28
 
29
- public function getConfigurationFieldDelimiter() {
 
 
 
 
 
 
30
  return Mage::getStoreConfig('expeditorinet/export/field_delimiter');
31
  }
32
 
33
- public function getConfigurationFieldSeparator() {
 
 
 
 
 
 
34
  return Mage::getStoreConfig('expeditorinet/export/field_separator');
35
  }
36
 
37
- public function getCompanyCommercialName() {
 
 
 
 
 
 
38
  return Mage::getStoreConfig('expeditorinet/export/company_commercial_name');
39
  }
40
 
41
  /**
42
- * Import configuration
 
 
43
  */
44
- public function getConfigurationSendEmail() {
 
45
  return Mage::getStoreConfig('expeditorinet/import/send_email');
46
  }
47
 
48
- public function getConfigurationIncludeComment() {
 
 
 
 
 
 
49
  return Mage::getStoreConfig('expeditorinet/import/include_comment');
50
  }
51
 
52
- public function getConfigurationDefaultTrackingTitle() {
 
 
 
 
 
 
53
  return Mage::getStoreConfig('expeditorinet/import/default_tracking_title');
54
  }
55
 
56
- public function getConfigurationShippingComment() {
 
 
 
 
 
 
57
  return Mage::getStoreConfig('expeditorinet/import/shipping_comment');
58
  }
59
-
60
- public function getConfigurationCarrierCode() {
 
 
 
 
 
 
61
  return Mage::getStoreConfig('expeditorinet/import/carrier_code');
62
  }
63
 
64
- }
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
  /**
3
  * LaPoste_ExpeditorINet
4
+ *
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
10
  */
11
  class LaPoste_ExpeditorINet_Helper_Data extends Mage_Core_Helper_Abstract
12
  {
 
13
  /**
14
+ * Get export file extension
15
+ *
16
+ * @return string
17
  */
18
+ public function getConfigurationFileExtension()
19
+ {
20
  return Mage::getStoreConfig('expeditorinet/export/file_extension');
21
  }
22
 
23
+ /**
24
+ * Get export file charset
25
+ *
26
+ * @return string
27
+ */
28
+ public function getConfigurationFileCharset()
29
+ {
30
  return Mage::getStoreConfig('expeditorinet/export/file_charset');
31
  }
32
 
33
+ /**
34
+ * Get export end of line character
35
+ *
36
+ * @return string
37
+ */
38
+ public function getConfigurationEndOfLineCharacter()
39
+ {
40
  return Mage::getStoreConfig('expeditorinet/export/endofline_character');
41
  }
42
 
43
+ /**
44
+ * Get export field delimiter
45
+ *
46
+ * @return string
47
+ */
48
+ public function getConfigurationFieldDelimiter()
49
+ {
50
  return Mage::getStoreConfig('expeditorinet/export/field_delimiter');
51
  }
52
 
53
+ /**
54
+ * Get export field separator
55
+ *
56
+ * @return string
57
+ */
58
+ public function getConfigurationFieldSeparator()
59
+ {
60
  return Mage::getStoreConfig('expeditorinet/export/field_separator');
61
  }
62
 
63
+ /**
64
+ * Get export company name
65
+ *
66
+ * @return string
67
+ */
68
+ public function getCompanyCommercialName()
69
+ {
70
  return Mage::getStoreConfig('expeditorinet/export/company_commercial_name');
71
  }
72
 
73
  /**
74
+ * Get import email
75
+ *
76
+ * @return string
77
  */
78
+ public function getConfigurationSendEmail()
79
+ {
80
  return Mage::getStoreConfig('expeditorinet/import/send_email');
81
  }
82
 
83
+ /**
84
+ * Get import include comment flag
85
+ *
86
+ * @return string
87
+ */
88
+ public function getConfigurationIncludeComment()
89
+ {
90
  return Mage::getStoreConfig('expeditorinet/import/include_comment');
91
  }
92
 
93
+ /**
94
+ * Get import default tracking title
95
+ *
96
+ * @return string
97
+ */
98
+ public function getConfigurationDefaultTrackingTitle()
99
+ {
100
  return Mage::getStoreConfig('expeditorinet/import/default_tracking_title');
101
  }
102
 
103
+ /**
104
+ * Get import shipping comment
105
+ *
106
+ * @return string
107
+ */
108
+ public function getConfigurationShippingComment()
109
+ {
110
  return Mage::getStoreConfig('expeditorinet/import/shipping_comment');
111
  }
112
+
113
+ /**
114
+ * Get import carrier code
115
+ *
116
+ * @return string
117
+ */
118
+ public function getConfigurationCarrierCode()
119
+ {
120
  return Mage::getStoreConfig('expeditorinet/import/carrier_code');
121
  }
122
 
123
+ /**
124
+ * Get pickup point codes
125
+ *
126
+ * @return array
127
+ */
128
+ public function getPickupPointCodes()
129
+ {
130
+ $codes = Mage::getStoreConfig('expeditorinet/pickup_point_codes');
131
+
132
+ return is_array($codes) ? array_keys($codes) : array();
133
+ }
134
+ }
app/code/community/LaPoste/ExpeditorINet/Model/Config/Source/EndOfLineCharacter.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * LaPoste_ExpeditorINet
4
- *
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
@@ -10,12 +10,17 @@
10
  */
11
  class LaPoste_ExpeditorINet_Model_Config_Source_EndOfLineCharacter
12
  {
 
 
 
 
 
13
  public function toOptionArray()
14
  {
15
  return array(
16
- array('value'=>'lf', 'label'=>Mage::helper('expeditorinet')->__('LF')),
17
- array('value'=>'cr', 'label'=>Mage::helper('expeditorinet')->__('CR')),
18
- array('value'=>'crlf', 'label'=>Mage::helper('expeditorinet')->__('CR+LF'))
19
  );
20
  }
21
  }
1
  <?php
2
  /**
3
  * LaPoste_ExpeditorINet
4
+ *
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
10
  */
11
  class LaPoste_ExpeditorINet_Model_Config_Source_EndOfLineCharacter
12
  {
13
+ /**
14
+ * Get available options for end of line characters
15
+ *
16
+ * @return array
17
+ */
18
  public function toOptionArray()
19
  {
20
  return array(
21
+ array('value' => 'lf', 'label' => Mage::helper('expeditorinet')->__('LF')),
22
+ array('value' => 'cr', 'label' => Mage::helper('expeditorinet')->__('CR')),
23
+ array('value' => 'crlf', 'label' => Mage::helper('expeditorinet')->__('CR+LF')),
24
  );
25
  }
26
  }
app/code/community/LaPoste/ExpeditorINet/Model/Config/Source/FieldDelimiter.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * LaPoste_ExpeditorINet
4
- *
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
@@ -10,11 +10,16 @@
10
  */
11
  class LaPoste_ExpeditorINet_Model_Config_Source_FieldDelimiter
12
  {
 
 
 
 
 
13
  public function toOptionArray()
14
  {
15
  return array(
16
- array('value'=>'simple_quote', 'label'=>Mage::helper('expeditorinet')->__('Simple Quote')),
17
- array('value'=>'double_quotes', 'label'=>Mage::helper('expeditorinet')->__('Double Quotes'))
18
  );
19
  }
20
  }
1
  <?php
2
  /**
3
  * LaPoste_ExpeditorINet
4
+ *
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
10
  */
11
  class LaPoste_ExpeditorINet_Model_Config_Source_FieldDelimiter
12
  {
13
+ /**
14
+ * Get available options for field delimiters
15
+ *
16
+ * @return array
17
+ */
18
  public function toOptionArray()
19
  {
20
  return array(
21
+ array('value' => 'simple_quote', 'label' => Mage::helper('expeditorinet')->__('Simple Quote')),
22
+ array('value' => 'double_quotes', 'label' => Mage::helper('expeditorinet')->__('Double Quotes')),
23
  );
24
  }
25
  }
app/code/community/LaPoste/ExpeditorINet/Model/Config/Source/FieldSeparator.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * LaPoste_ExpeditorINet
4
- *
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
@@ -10,11 +10,16 @@
10
  */
11
  class LaPoste_ExpeditorINet_Model_Config_Source_FieldSeparator
12
  {
 
 
 
 
 
13
  public function toOptionArray()
14
  {
15
  return array(
16
- array('value'=>';', 'label'=>Mage::helper('expeditorinet')->__(';')),
17
- array('value'=>',', 'label'=>Mage::helper('expeditorinet')->__(','))
18
  );
19
  }
20
  }
1
  <?php
2
  /**
3
  * LaPoste_ExpeditorINet
4
+ *
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
10
  */
11
  class LaPoste_ExpeditorINet_Model_Config_Source_FieldSeparator
12
  {
13
+ /**
14
+ * Get available options for field separators
15
+ *
16
+ * @return array
17
+ */
18
  public function toOptionArray()
19
  {
20
  return array(
21
+ array('value' => ';', 'label' => Mage::helper('expeditorinet')->__(';')),
22
+ array('value' => ',', 'label' => Mage::helper('expeditorinet')->__(',')),
23
  );
24
  }
25
  }
app/code/community/LaPoste/ExpeditorINet/Model/Config/Source/FileCharset.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * LaPoste_ExpeditorINet
4
- *
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
@@ -10,11 +10,16 @@
10
  */
11
  class LaPoste_ExpeditorINet_Model_Config_Source_FileCharset
12
  {
 
 
 
 
 
13
  public function toOptionArray()
14
  {
15
  return array(
16
- array('value'=>'ISO-8859-1', 'label'=>Mage::helper('expeditorinet')->__('ISO-8859-1')),
17
- array('value'=>'UTF-8', 'label'=>Mage::helper('expeditorinet')->__('UTF-8'))
18
  );
19
  }
20
  }
1
  <?php
2
  /**
3
  * LaPoste_ExpeditorINet
4
+ *
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
10
  */
11
  class LaPoste_ExpeditorINet_Model_Config_Source_FileCharset
12
  {
13
+ /**
14
+ * Get available options for file charsets
15
+ *
16
+ * @return array
17
+ */
18
  public function toOptionArray()
19
  {
20
  return array(
21
+ array('value' => 'ISO-8859-1', 'label' => Mage::helper('expeditorinet')->__('ISO-8859-1')),
22
+ array('value' => 'UTF-8', 'label' => Mage::helper('expeditorinet')->__('UTF-8')),
23
  );
24
  }
25
  }
app/code/community/LaPoste/ExpeditorINet/Model/Config/Source/FileExtension.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * LaPoste_ExpeditorINet
4
- *
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
@@ -10,11 +10,16 @@
10
  */
11
  class LaPoste_ExpeditorINet_Model_Config_Source_FileExtension
12
  {
 
 
 
 
 
13
  public function toOptionArray()
14
  {
15
  return array(
16
- array('value'=>'.txt', 'label'=>Mage::helper('expeditorinet')->__('.txt')),
17
- array('value'=>'.csv', 'label'=>Mage::helper('expeditorinet')->__('.csv'))
18
  );
19
  }
20
  }
1
  <?php
2
  /**
3
  * LaPoste_ExpeditorINet
4
+ *
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
10
  */
11
  class LaPoste_ExpeditorINet_Model_Config_Source_FileExtension
12
  {
13
+ /**
14
+ * Get available options for file extensions
15
+ *
16
+ * @return array
17
+ */
18
  public function toOptionArray()
19
  {
20
  return array(
21
+ array('value' => '.txt', 'label' => Mage::helper('expeditorinet')->__('.txt')),
22
+ array('value' => '.csv', 'label' => Mage::helper('expeditorinet')->__('.csv')),
23
  );
24
  }
25
  }
app/code/community/LaPoste/ExpeditorINet/controllers/ExportController.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * LaPoste_ExpeditorINet
4
- *
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
@@ -10,17 +10,20 @@
10
  */
11
  class LaPoste_ExpeditorINet_ExportController extends Mage_Adminhtml_Controller_Action
12
  {
13
-
14
  /**
15
  * Constructor
 
 
16
  */
17
  protected function _construct()
18
- {
19
  $this->setUsedModuleName('LaPoste_ExpeditorINet');
20
  }
21
 
22
  /**
23
  * Main action : show orders list
 
 
24
  */
25
  public function indexAction()
26
  {
@@ -31,98 +34,93 @@ class LaPoste_ExpeditorINet_ExportController extends Mage_Adminhtml_Controller_A
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
 
 
53
  */
54
  public function exportAction()
55
  {
56
- /* get the orders */
57
  $orderIds = $this->getRequest()->getPost('order_ids');
58
 
59
- /**
60
- * Get configuration
61
- */
62
  $separator = Mage::helper('expeditorinet')->getConfigurationFieldSeparator();
63
  $delimiter = Mage::helper('expeditorinet')->getConfigurationFieldDelimiter();
64
- if ($delimiter == 'simple_quote') {
65
  $delimiter = "'";
66
- } else if ($delimiter == 'double_quotes') {
67
  $delimiter = '"';
68
  }
69
  $lineBreak = Mage::helper('expeditorinet')->getConfigurationEndOfLineCharacter();
70
- if ($lineBreak == 'lf') {
71
  $lineBreak = "\n";
72
- } else if ($lineBreak == 'cr') {
73
  $lineBreak = "\r";
74
- } else if ($lineBreak == 'crlf') {
75
  $lineBreak = "\r\n";
76
  }
77
  $fileExtension = Mage::helper('expeditorinet')->getConfigurationFileExtension();
78
  $fileCharset = Mage::helper('expeditorinet')->getConfigurationFileCharset();
79
 
80
- /* So Colissimo product codes for Hors Domicile */
81
- $hd_productcodes = array (
82
- 'BPR',
83
- 'ACP',
84
- 'CIT',
85
- 'A2P',
86
- 'MRL',
87
- 'CDI'
88
- );
89
-
90
- /* set the filename */
91
- $filename = 'orders_export_'.Mage::getSingleton('core/date')->date('Ymd_His').$fileExtension;
92
-
93
- /* get company commercial name */
94
  $commercialName = Mage::helper('expeditorinet')->getCompanyCommercialName();
95
 
96
- /* initialize the content variable */
97
  $content = '';
98
 
99
  if (!empty($orderIds)) {
100
  foreach ($orderIds as $orderId) {
101
-
102
- /* get the order */
103
  $order = Mage::getModel('sales/order')->load($orderId);
104
 
105
- //if the product code is for Hors Domicile we should take the billing address
106
- if (in_array($order->getSocoProductCode(), $hd_productcodes)) {
107
- /* get the shipping address */
108
- $address = $order->getBillingAddress();
109
  } else {
110
- /* get the billing address */
111
- $address = $order->getShippingAddress();
112
- }
113
- /* real order id */
 
114
  $content = $this->_addFieldToCsv($content, $delimiter, $order->getRealOrderId());
115
  $content .= $separator;
116
- /* customer first name */
117
  $content = $this->_addFieldToCsv($content, $delimiter, $address->getFirstname());
118
  $content .= $separator;
119
- /* customer last name */
120
  $content = $this->_addFieldToCsv($content, $delimiter, $address->getLastname());
121
  $content .= $separator;
122
- /* customer company */
123
  $content = $this->_addFieldToCsv($content, $delimiter, $address->getCompany());
124
  $content .= $separator;
125
- /* street address, on 4 fields */
126
  $content = $this->_addFieldToCsv($content, $delimiter, $address->getStreet(1));
127
  $content .= $separator;
128
  $content = $this->_addFieldToCsv($content, $delimiter, $address->getStreet(2));
@@ -131,50 +129,54 @@ class LaPoste_ExpeditorINet_ExportController extends Mage_Adminhtml_Controller_A
131
  $content .= $separator;
132
  $content = $this->_addFieldToCsv($content, $delimiter, $address->getStreet(4));
133
  $content .= $separator;
134
- /* postal code */
135
  $content = $this->_addFieldToCsv($content, $delimiter, $address->getPostcode());
136
  $content .= $separator;
137
- /* city */
138
  $content = $this->_addFieldToCsv($content, $delimiter, $address->getCity());
139
  $content .= $separator;
140
- /* country code */
141
  $content = $this->_addFieldToCsv($content, $delimiter, $address->getCountry());
142
  $content .= $separator;
143
- /* telephone */
144
  $telephone = '';
145
  if ($order->getSocoPhoneNumber() != '' && $order->getSocoPhoneNumber() != null) {
146
- $telephone = $order->getSocoPhoneNumber();
147
  } elseif ($address->getTelephone() != '' && $address->getTelephone() != null) {
148
- $telephone = $address->getTelephone();
149
  }
150
  $content = $this->_addFieldToCsv($content, $delimiter, $telephone);
151
  $content .= $separator;
152
- /* code produit */
153
  $content = $this->_addFieldToCsv($content, $delimiter, $order->getSocoProductCode());
154
- $content .= $separator;
155
- /* instruction de livraison */
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());
163
- $content .= $separator;
164
- /* code porte 2 */
165
  $content = $this->_addFieldToCsv($content, $delimiter, $order->getSocoDoorCode2());
166
- $content .= $separator;
167
- /* Interphone */
168
  $content = $this->_addFieldToCsv($content, $delimiter, $order->getSocoInterphone());
169
- $content .= $separator;
170
- /* Code point retrait */
171
  $content = $this->_addFieldToCsv($content, $delimiter, $order->getSocoRelayPointCode());
172
- $content .= $separator;
173
- /* E-mail de suivi socolissimo */
 
 
 
174
  $content = $this->_addFieldToCsv($content, $delimiter, $order->getSocoEmail());
175
- $content .= $separator;
176
 
177
- /* total weight */
178
  $total_weight = 0;
179
  $items = $order->getAllItems();
180
  foreach ($items as $item) {
@@ -183,44 +185,44 @@ class LaPoste_ExpeditorINet_ExportController extends Mage_Adminhtml_Controller_A
183
  $content = $this->_addFieldToCsv($content, $delimiter, $total_weight);
184
  $content .= $separator;
185
 
186
- /* company commercial name */
187
  $content = $this->_addFieldToCsv($content, $delimiter, $commercialName);
188
 
189
  $content .= $lineBreak;
190
  }
191
 
192
- /* decode the content, depending on the charset */
193
  if ($fileCharset == 'ISO-8859-1') {
194
- $content = utf8_decode($content);
195
  }
196
 
197
- /* pick file mime type, depending on the extension */
198
  if ($fileExtension == '.txt') {
199
- $fileMimeType = 'text/plain';
200
- } else if ($fileExtension == '.csv') {
201
- $fileMimeType = 'application/csv';
202
  } else {
203
- // default
204
  $fileMimeType = 'text/plain';
205
  }
206
 
207
- /* download the file */
208
  return $this->_prepareDownloadResponse($filename, $content, $fileMimeType .'; charset="'. $fileCharset .'"');
209
- }
210
- else {
211
- $this->_getSession()->addError($this->__('No Order has been selected'));
212
  }
213
  }
214
 
215
  /**
216
  * Add a new field to the csv file
217
- * @param csvContent : the current csv content
218
- * @param fieldDelimiter : the delimiter character
219
- * @param fieldContent : the content to add
220
- * @return : the concatenation of current content and content to add
 
221
  */
222
- private function _addFieldToCsv($csvContent, $fieldDelimiter, $fieldContent) {
223
- return $csvContent . $fieldDelimiter . $fieldContent . $fieldDelimiter;
 
224
  }
225
-
226
  }
1
  <?php
2
  /**
3
  * LaPoste_ExpeditorINet
4
+ *
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
10
  */
11
  class LaPoste_ExpeditorINet_ExportController extends Mage_Adminhtml_Controller_Action
12
  {
 
13
  /**
14
  * Constructor
15
+ *
16
+ * @return void
17
  */
18
  protected function _construct()
19
+ {
20
  $this->setUsedModuleName('LaPoste_ExpeditorINet');
21
  }
22
 
23
  /**
24
  * Main action : show orders list
25
+ *
26
+ * @return void
27
  */
28
  public function indexAction()
29
  {
34
  }
35
 
36
  /**
37
+ * Convert civility in letters to a code for Expeditor
38
+ *
39
+ * @param string $civility a civility
40
+ * @return int
41
  */
42
+ protected function _getExpeditorCodeForCivility($civility)
43
  {
44
+ if ($civility === 'MR') {
45
+ return 2;
46
+ } elseif ($civility === 'MME') {
47
+ return 3;
48
+ } elseif ($civility === 'MLE') {
49
+ return 4;
50
+ } else {
51
+ return 1;
52
+ }
53
  }
54
 
55
  /**
56
  * Export Action
57
  * Generates a CSV file to download
58
+ *
59
+ * @return void
60
  */
61
  public function exportAction()
62
  {
63
+ // get the orders
64
  $orderIds = $this->getRequest()->getPost('order_ids');
65
 
66
+ // get configuration
 
 
67
  $separator = Mage::helper('expeditorinet')->getConfigurationFieldSeparator();
68
  $delimiter = Mage::helper('expeditorinet')->getConfigurationFieldDelimiter();
69
+ if ($delimiter === 'simple_quote') {
70
  $delimiter = "'";
71
+ } elseif ($delimiter === 'double_quotes') {
72
  $delimiter = '"';
73
  }
74
  $lineBreak = Mage::helper('expeditorinet')->getConfigurationEndOfLineCharacter();
75
+ if ($lineBreak === 'lf') {
76
  $lineBreak = "\n";
77
+ } elseif ($lineBreak === 'cr') {
78
  $lineBreak = "\r";
79
+ } elseif ($lineBreak === 'crlf') {
80
  $lineBreak = "\r\n";
81
  }
82
  $fileExtension = Mage::helper('expeditorinet')->getConfigurationFileExtension();
83
  $fileCharset = Mage::helper('expeditorinet')->getConfigurationFileCharset();
84
 
85
+ // So Colissimo product codes for Hors Domicile
86
+ $hdProductCodes = Mage::helper('expeditorinet')->getPickupPointCodes();
87
+
88
+ // set the filename
89
+ $filename = 'orders_export_'.Mage::getSingleton('core/date')->date('Ymd_His') . $fileExtension;
90
+
91
+ // get company commercial name
 
 
 
 
 
 
 
92
  $commercialName = Mage::helper('expeditorinet')->getCompanyCommercialName();
93
 
94
+ // initialize the content variable
95
  $content = '';
96
 
97
  if (!empty($orderIds)) {
98
  foreach ($orderIds as $orderId) {
99
+ // get the order
 
100
  $order = Mage::getModel('sales/order')->load($orderId);
101
 
102
+ // if the product code is for Hors Domicile we should take the billing address
103
+ if (in_array($order->getSocoProductCode(), $hdProductCodes)) {
104
+ // get the shipping address
105
+ $address = $order->getBillingAddress();
106
  } else {
107
+ // get the billing address
108
+ $address = $order->getShippingAddress();
109
+ }
110
+
111
+ // real order id
112
  $content = $this->_addFieldToCsv($content, $delimiter, $order->getRealOrderId());
113
  $content .= $separator;
114
+ // customer first name
115
  $content = $this->_addFieldToCsv($content, $delimiter, $address->getFirstname());
116
  $content .= $separator;
117
+ // customer last name
118
  $content = $this->_addFieldToCsv($content, $delimiter, $address->getLastname());
119
  $content .= $separator;
120
+ // customer company
121
  $content = $this->_addFieldToCsv($content, $delimiter, $address->getCompany());
122
  $content .= $separator;
123
+ // street address, on 4 fields
124
  $content = $this->_addFieldToCsv($content, $delimiter, $address->getStreet(1));
125
  $content .= $separator;
126
  $content = $this->_addFieldToCsv($content, $delimiter, $address->getStreet(2));
129
  $content .= $separator;
130
  $content = $this->_addFieldToCsv($content, $delimiter, $address->getStreet(4));
131
  $content .= $separator;
132
+ // postal code
133
  $content = $this->_addFieldToCsv($content, $delimiter, $address->getPostcode());
134
  $content .= $separator;
135
+ // city
136
  $content = $this->_addFieldToCsv($content, $delimiter, $address->getCity());
137
  $content .= $separator;
138
+ // country code
139
  $content = $this->_addFieldToCsv($content, $delimiter, $address->getCountry());
140
  $content .= $separator;
141
+ // portable phone number
142
  $telephone = '';
143
  if ($order->getSocoPhoneNumber() != '' && $order->getSocoPhoneNumber() != null) {
144
+ $telephone = $order->getSocoPhoneNumber();
145
  } elseif ($address->getTelephone() != '' && $address->getTelephone() != null) {
146
+ $telephone = $address->getTelephone();
147
  }
148
  $content = $this->_addFieldToCsv($content, $delimiter, $telephone);
149
  $content .= $separator;
150
+ // product code
151
  $content = $this->_addFieldToCsv($content, $delimiter, $order->getSocoProductCode());
152
+ $content .= $separator;
153
+ // shipping instruction
154
  $content = $this->_addFieldToCsv($content, $delimiter, $order->getSocoShippingInstruction());
155
  $content .= $separator;
156
+ // civility
157
+ $civility = $this->_getExpeditorCodeForCivility($order->getSocoCivility());
158
+ $content = $this->_addFieldToCsv($content, $delimiter, $civility);
159
+ $content .= $separator;
160
+ // door code 1
161
  $content = $this->_addFieldToCsv($content, $delimiter, $order->getSocoDoorCode1());
162
+ $content .= $separator;
163
+ // door code 2
164
  $content = $this->_addFieldToCsv($content, $delimiter, $order->getSocoDoorCode2());
165
+ $content .= $separator;
166
+ // interphone
167
  $content = $this->_addFieldToCsv($content, $delimiter, $order->getSocoInterphone());
168
+ $content .= $separator;
169
+ // relay point code
170
  $content = $this->_addFieldToCsv($content, $delimiter, $order->getSocoRelayPointCode());
171
+ $content .= $separator;
172
+ // network code
173
+ $content = $this->_addFieldToCsv($content, $delimiter, $order->getSocoNetworkCode());
174
+ $content .= $separator;
175
+ // email
176
  $content = $this->_addFieldToCsv($content, $delimiter, $order->getSocoEmail());
177
+ $content .= $separator;
178
 
179
+ // total weight
180
  $total_weight = 0;
181
  $items = $order->getAllItems();
182
  foreach ($items as $item) {
185
  $content = $this->_addFieldToCsv($content, $delimiter, $total_weight);
186
  $content .= $separator;
187
 
188
+ // company commercial name
189
  $content = $this->_addFieldToCsv($content, $delimiter, $commercialName);
190
 
191
  $content .= $lineBreak;
192
  }
193
 
194
+ // decode the content, depending on the charset
195
  if ($fileCharset == 'ISO-8859-1') {
196
+ $content = utf8_decode($content);
197
  }
198
 
199
+ // pick file mime type, depending on the extension
200
  if ($fileExtension == '.txt') {
201
+ $fileMimeType = 'text/plain';
202
+ } elseif ($fileExtension == '.csv') {
203
+ $fileMimeType = 'application/csv';
204
  } else {
205
+ // default
206
  $fileMimeType = 'text/plain';
207
  }
208
 
209
+ // download the file
210
  return $this->_prepareDownloadResponse($filename, $content, $fileMimeType .'; charset="'. $fileCharset .'"');
211
+ } else {
212
+ $this->_getSession()->addError($this->__('No Order has been selected'));
 
213
  }
214
  }
215
 
216
  /**
217
  * Add a new field to the csv file
218
+ *
219
+ * @param csvContent the current csv content
220
+ * @param fieldDelimiter the delimiter character
221
+ * @param fieldContent the content to add
222
+ * @return string
223
  */
224
+ protected function _addFieldToCsv($csvContent, $fieldDelimiter, $fieldContent)
225
+ {
226
+ return $csvContent . $fieldDelimiter . $fieldContent . $fieldDelimiter;
227
  }
 
228
  }
app/code/community/LaPoste/ExpeditorINet/controllers/ImportController.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * LaPoste_ExpeditorINet
4
- *
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
@@ -10,17 +10,20 @@
10
  */
11
  class LaPoste_ExpeditorINet_ImportController extends Mage_Adminhtml_Controller_Action
12
  {
13
-
14
  /**
15
  * Constructor
 
 
16
  */
17
  protected function _construct()
18
- {
19
  $this->setUsedModuleName('LaPoste_ExpeditorINet');
20
  }
21
 
22
  /**
23
  * Main action : show import form
 
 
24
  */
25
  public function indexAction()
26
  {
@@ -32,6 +35,8 @@ class LaPoste_ExpeditorINet_ImportController extends Mage_Adminhtml_Controller_A
32
 
33
  /**
34
  * Import Action
 
 
35
  */
36
  public function importAction()
37
  {
@@ -39,16 +44,13 @@ class LaPoste_ExpeditorINet_ImportController extends Mage_Adminhtml_Controller_A
39
  try {
40
  $trackingTitle = $_POST['import_expeditor_inet_tracking_title'];
41
  $this->_importExpeditorInetFile($_FILES['import_expeditor_inet_file']['tmp_name'], $trackingTitle);
42
- }
43
- catch (Mage_Core_Exception $e) {
44
  $this->_getSession()->addError($e->getMessage());
45
- }
46
- catch (Exception $e) {
47
  $this->_getSession()->addError($e->getMessage());
48
  $this->_getSession()->addError($this->__('Invalid file upload attempt'));
49
  }
50
- }
51
- else {
52
  $this->_getSession()->addError($this->__('Invalid file upload attempt'));
53
  }
54
  $this->_redirect('*/*/index');
@@ -56,86 +58,60 @@ class LaPoste_ExpeditorINet_ImportController extends Mage_Adminhtml_Controller_A
56
 
57
  /**
58
  * Importation logic
 
59
  * @param string $fileName
60
  * @param string $trackingTitle
 
61
  */
62
  protected function _importExpeditorInetFile($fileName, $trackingTitle)
63
  {
64
- /**
65
- * File handling
66
- **/
67
  ini_set('auto_detect_line_endings', true);
68
  $csvObject = new Varien_File_Csv();
69
  $csvData = $csvObject->getData($fileName);
70
 
71
- /**
72
- * File expected fields
73
- */
74
  $expectedCsvFields = array(
75
  0 => $this->__('Order Id'),
76
- 1 => $this->__('Tracking Number')
77
  );
78
 
79
- /**
80
- * Get configuration
81
- */
82
  $sendEmail = Mage::helper('expeditorinet')->getConfigurationSendEmail();
83
  $comment = Mage::helper('expeditorinet')->getConfigurationShippingComment();
84
  $includeComment = Mage::helper('expeditorinet')->getConfigurationIncludeComment();
85
 
86
- /* debug */
87
- //$this->_getSession()->addSuccess($this->__('%s - %s - %s - %s', $sendEmail, $comment, $includeComment, $trackingTitle));
88
-
89
- /**
90
- * $k is line number
91
- * $v is line content array
92
- */
93
  foreach ($csvData as $k => $v) {
94
-
95
- /**
96
- * End of file has more than one empty lines
97
- */
98
  if (count($v) <= 1 && !strlen($v[0])) {
99
  continue;
100
  }
101
 
102
- /**
103
- * Check that the number of fields is not lower than expected
104
- */
105
  if (count($v) < count($expectedCsvFields)) {
106
  $this->_getSession()->addError($this->__('Line %s format is invalid and has been ignored', $k));
107
  continue;
108
  }
109
 
110
- /**
111
- * Get fields content
112
- */
113
  $orderId = $v[0];
114
  $trackingNumber = $v[1];
115
 
116
- /* for debug */
117
- //$this->_getSession()->addSuccess($this->__('Lecture ligne %s: %s - %s', $k, $orderId, $trackingNumber));
118
-
119
- /**
120
- * Try to load the order
121
- */
122
  $order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
123
  if (!$order->getId()) {
124
  $this->_getSession()->addError($this->__('Order %s does not exist', $orderId));
125
  continue;
126
  }
127
 
128
- /**
129
- * Try to create a shipment
130
- */
131
  $shipmentId = $this->_createShipment($order, $trackingNumber, $trackingTitle, $sendEmail, $comment, $includeComment);
132
-
133
  if ($shipmentId != 0) {
134
  $this->_getSession()->addSuccess($this->__('Shipment %s created for order %s, with tracking number %s', $shipmentId, $orderId, $trackingNumber));
135
  }
136
-
137
- }//foreach
138
-
139
  }
140
 
141
  /**
@@ -152,27 +128,22 @@ class LaPoste_ExpeditorINet_ImportController extends Mage_Adminhtml_Controller_A
152
  */
153
  public function _createShipment($order, $trackingNumber, $trackingTitle, $email, $comment, $includeComment)
154
  {
155
- /**
156
- * Check shipment creation availability
157
- */
158
  if (!$order->canShip()) {
159
  $this->_getSession()->addError($this->__('Order %s can not be shipped or has already been shipped', $order->getRealOrderId()));
160
  return 0;
161
  }
162
 
163
- /**
164
- * Initialize the Mage_Sales_Model_Order_Shipment object
165
- */
166
  $convertor = Mage::getModel('sales/convert_order');
167
  $shipment = $convertor->toShipment($order);
168
 
169
- /**
170
- * Add the items to send
171
- */
172
  foreach ($order->getAllItems() as $orderItem) {
173
  if (!$orderItem->getQtyToShip()) {
174
  continue;
175
  }
 
176
  if ($orderItem->getIsVirtual()) {
177
  continue;
178
  }
@@ -181,60 +152,47 @@ class LaPoste_ExpeditorINet_ImportController extends Mage_Adminhtml_Controller_A
181
  $qty = $orderItem->getQtyToShip();
182
  $item->setQty($qty);
183
 
184
- $shipment->addItem($item);
185
- }//foreach
186
 
187
  $shipment->register();
188
 
189
- /**
190
- * Tracking number instanciation
191
- */
192
- $carrierCode = Mage::helper('expeditorinet')->getConfigurationCarrierCode();
193
- if(!$carrierCode) $carrierCode = 'custom';
194
-
195
  $track = Mage::getModel('sales/order_shipment_track')
196
- ->setNumber($trackingNumber)
197
- ->setCarrierCode($carrierCode)
198
- ->setTitle($trackingTitle);
199
  $shipment->addTrack($track);
200
 
201
- /**
202
- * Comment handling
203
- */
204
  $shipment->addComment($comment, $email && $includeComment);
205
 
206
- /**
207
- * Change order status to Processing
208
- */
209
  $shipment->getOrder()->setIsInProcess(true);
210
 
211
- /**
212
- * If e-mail, set as sent (must be done before shipment object saving)
213
- */
214
  if ($email) {
215
  $shipment->setEmailSent(true);
216
  }
217
 
218
  try {
219
- /**
220
- * Save the created shipment and the updated order
221
- */
222
  $shipment->save();
223
  $shipment->getOrder()->save();
224
 
225
- /**
226
- * Email sending
227
- */
228
  $shipment->sendEmail($email, ($includeComment ? $comment : ''));
229
  } catch (Mage_Core_Exception $e) {
230
  $this->_getSession()->addError($this->__('Shipment creation error for Order %s : %s', $orderId, $e->getMessage()));
231
  return 0;
232
  }
233
 
234
- /**
235
- * Everything was ok : return Shipment real id
236
- */
237
  return $shipment->getIncrementId();
238
  }
239
-
240
- }
1
  <?php
2
  /**
3
  * LaPoste_ExpeditorINet
4
+ *
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
10
  */
11
  class LaPoste_ExpeditorINet_ImportController extends Mage_Adminhtml_Controller_Action
12
  {
 
13
  /**
14
  * Constructor
15
+ *
16
+ * @return void
17
  */
18
  protected function _construct()
19
+ {
20
  $this->setUsedModuleName('LaPoste_ExpeditorINet');
21
  }
22
 
23
  /**
24
  * Main action : show import form
25
+ *
26
+ * @return void
27
  */
28
  public function indexAction()
29
  {
35
 
36
  /**
37
  * Import Action
38
+ *
39
+ * @return void
40
  */
41
  public function importAction()
42
  {
44
  try {
45
  $trackingTitle = $_POST['import_expeditor_inet_tracking_title'];
46
  $this->_importExpeditorInetFile($_FILES['import_expeditor_inet_file']['tmp_name'], $trackingTitle);
47
+ } catch (Mage_Core_Exception $e) {
 
48
  $this->_getSession()->addError($e->getMessage());
49
+ } catch (Exception $e) {
 
50
  $this->_getSession()->addError($e->getMessage());
51
  $this->_getSession()->addError($this->__('Invalid file upload attempt'));
52
  }
53
+ } else {
 
54
  $this->_getSession()->addError($this->__('Invalid file upload attempt'));
55
  }
56
  $this->_redirect('*/*/index');
58
 
59
  /**
60
  * Importation logic
61
+ *
62
  * @param string $fileName
63
  * @param string $trackingTitle
64
+ * @return void
65
  */
66
  protected function _importExpeditorInetFile($fileName, $trackingTitle)
67
  {
68
+ // file handling
 
 
69
  ini_set('auto_detect_line_endings', true);
70
  $csvObject = new Varien_File_Csv();
71
  $csvData = $csvObject->getData($fileName);
72
 
73
+ // file expected fields
 
 
74
  $expectedCsvFields = array(
75
  0 => $this->__('Order Id'),
76
+ 1 => $this->__('Tracking Number'),
77
  );
78
 
79
+ // get configuration
 
 
80
  $sendEmail = Mage::helper('expeditorinet')->getConfigurationSendEmail();
81
  $comment = Mage::helper('expeditorinet')->getConfigurationShippingComment();
82
  $includeComment = Mage::helper('expeditorinet')->getConfigurationIncludeComment();
83
 
84
+ // $k is line number, $v is line content array
 
 
 
 
 
 
85
  foreach ($csvData as $k => $v) {
86
+ // end of file has more than one empty lines
 
 
 
87
  if (count($v) <= 1 && !strlen($v[0])) {
88
  continue;
89
  }
90
 
91
+ // check that the number of fields is not lower than expected
 
 
92
  if (count($v) < count($expectedCsvFields)) {
93
  $this->_getSession()->addError($this->__('Line %s format is invalid and has been ignored', $k));
94
  continue;
95
  }
96
 
97
+ // get fields content
 
 
98
  $orderId = $v[0];
99
  $trackingNumber = $v[1];
100
 
101
+ // try to load the order
 
 
 
 
 
102
  $order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
103
  if (!$order->getId()) {
104
  $this->_getSession()->addError($this->__('Order %s does not exist', $orderId));
105
  continue;
106
  }
107
 
108
+ // try to create a shipment
 
 
109
  $shipmentId = $this->_createShipment($order, $trackingNumber, $trackingTitle, $sendEmail, $comment, $includeComment);
110
+
111
  if ($shipmentId != 0) {
112
  $this->_getSession()->addSuccess($this->__('Shipment %s created for order %s, with tracking number %s', $shipmentId, $orderId, $trackingNumber));
113
  }
114
+ }
 
 
115
  }
116
 
117
  /**
128
  */
129
  public function _createShipment($order, $trackingNumber, $trackingTitle, $email, $comment, $includeComment)
130
  {
131
+ // check shipment creation availability
 
 
132
  if (!$order->canShip()) {
133
  $this->_getSession()->addError($this->__('Order %s can not be shipped or has already been shipped', $order->getRealOrderId()));
134
  return 0;
135
  }
136
 
137
+ // initialize the Mage_Sales_Model_Order_Shipment object
 
 
138
  $convertor = Mage::getModel('sales/convert_order');
139
  $shipment = $convertor->toShipment($order);
140
 
141
+ // add the items to send
 
 
142
  foreach ($order->getAllItems() as $orderItem) {
143
  if (!$orderItem->getQtyToShip()) {
144
  continue;
145
  }
146
+
147
  if ($orderItem->getIsVirtual()) {
148
  continue;
149
  }
152
  $qty = $orderItem->getQtyToShip();
153
  $item->setQty($qty);
154
 
155
+ $shipment->addItem($item);
156
+ }
157
 
158
  $shipment->register();
159
 
160
+ // tracking number instanciation
161
+ $carrierCode = Mage::helper('expeditorinet')->getConfigurationCarrierCode();
162
+ if (!$carrierCode) {
163
+ $carrierCode = 'custom';
164
+ }
165
+
166
  $track = Mage::getModel('sales/order_shipment_track')
167
+ ->setNumber($trackingNumber)
168
+ ->setCarrierCode($carrierCode)
169
+ ->setTitle($trackingTitle);
170
  $shipment->addTrack($track);
171
 
172
+ // comment handling
 
 
173
  $shipment->addComment($comment, $email && $includeComment);
174
 
175
+ // change order status to Processing
 
 
176
  $shipment->getOrder()->setIsInProcess(true);
177
 
178
+ // if e-mail, set as sent (must be done before shipment object saving)
 
 
179
  if ($email) {
180
  $shipment->setEmailSent(true);
181
  }
182
 
183
  try {
184
+ // save the created shipment and the updated order
 
 
185
  $shipment->save();
186
  $shipment->getOrder()->save();
187
 
188
+ // email sending
 
 
189
  $shipment->sendEmail($email, ($includeComment ? $comment : ''));
190
  } catch (Mage_Core_Exception $e) {
191
  $this->_getSession()->addError($this->__('Shipment creation error for Order %s : %s', $orderId, $e->getMessage()));
192
  return 0;
193
  }
194
 
195
+ // everything was ok : return Shipment real id
 
 
196
  return $shipment->getIncrementId();
197
  }
198
+ }
 
app/code/community/LaPoste/ExpeditorINet/etc/config.xml CHANGED
@@ -6,22 +6,20 @@
6
  * @category LaPoste
7
  * @package LaPoste_ExpeditorINet
8
  * @copyright Copyright (c) 2010 La Poste
9
- * @author Smile (http://www.smile.fr) & Jibé
10
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
  */
12
  -->
13
  <config>
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>
24
-
25
  <global>
26
  <models>
27
  <expeditorinet>
@@ -39,7 +37,6 @@
39
  </expeditorinet>
40
  </helpers>
41
  </global>
42
-
43
  <admin>
44
  <routers>
45
  <expeditorinet>
@@ -51,9 +48,7 @@
51
  </expeditorinet>
52
  </routers>
53
  </admin>
54
-
55
  <adminhtml>
56
-
57
  <menu>
58
  <sales>
59
  <children>
@@ -76,7 +71,6 @@
76
  </children>
77
  </sales>
78
  </menu>
79
-
80
  <acl>
81
  <resources>
82
  <admin>
@@ -113,7 +107,6 @@
113
  </admin>
114
  </resources>
115
  </acl>
116
-
117
  <translate>
118
  <modules>
119
  <expeditorinet>
@@ -123,17 +116,15 @@
123
  </expeditorinet>
124
  </modules>
125
  </translate>
126
-
127
  </adminhtml>
128
-
129
- <default>
130
- <expeditorinet>
131
- <export>
132
- <file_extension>.txt</file_extension>
133
- <file_charset>ISO-8859-1</file_charset>
134
- <endofline_character>lf</endofline_character>
135
- <field_delimiter>double_quotes</field_delimiter>
136
- <field_separator>;</field_separator>
137
  </export>
138
  <import>
139
  <default_tracking_title>So Colissimo</default_tracking_title>
@@ -141,8 +132,17 @@
141
  <shipping_comment></shipping_comment>
142
  <include_comment>0</include_comment>
143
  <carrier_code>socolissimosimplicite_socolissimosimplicite</carrier_code>
144
- </import>
145
- </expeditorinet>
 
 
 
 
 
 
 
 
 
 
146
  </default>
147
-
148
  </config>
6
  * @category LaPoste
7
  * @package LaPoste_ExpeditorINet
8
  * @copyright Copyright (c) 2010 La Poste
9
+ * @author Smile (http://www.smile.fr) & Jibé
10
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
  */
12
  -->
13
  <config>
 
14
  <modules>
15
  <LaPoste_ExpeditorINet>
16
+ <version>1.0.3</version>
17
+ <depends>
18
+ <Mage_Sales />
19
+ <Mage_Adminhtml />
20
+ </depends>
21
  </LaPoste_ExpeditorINet>
22
  </modules>
 
23
  <global>
24
  <models>
25
  <expeditorinet>
37
  </expeditorinet>
38
  </helpers>
39
  </global>
 
40
  <admin>
41
  <routers>
42
  <expeditorinet>
48
  </expeditorinet>
49
  </routers>
50
  </admin>
 
51
  <adminhtml>
 
52
  <menu>
53
  <sales>
54
  <children>
71
  </children>
72
  </sales>
73
  </menu>
 
74
  <acl>
75
  <resources>
76
  <admin>
107
  </admin>
108
  </resources>
109
  </acl>
 
110
  <translate>
111
  <modules>
112
  <expeditorinet>
116
  </expeditorinet>
117
  </modules>
118
  </translate>
 
119
  </adminhtml>
120
+ <default>
121
+ <expeditorinet>
122
+ <export>
123
+ <file_extension>.txt</file_extension>
124
+ <file_charset>ISO-8859-1</file_charset>
125
+ <endofline_character>lf</endofline_character>
126
+ <field_delimiter>double_quotes</field_delimiter>
127
+ <field_separator>;</field_separator>
 
128
  </export>
129
  <import>
130
  <default_tracking_title>So Colissimo</default_tracking_title>
132
  <shipping_comment></shipping_comment>
133
  <include_comment>0</include_comment>
134
  <carrier_code>socolissimosimplicite_socolissimosimplicite</carrier_code>
135
+ </import>
136
+ <pickup_point_codes>
137
+ <A2P />
138
+ <ACP />
139
+ <BDP />
140
+ <BPR />
141
+ <CDI />
142
+ <CIT />
143
+ <CMT />
144
+ <MRL />
145
+ </pickup_point_codes>
146
+ </expeditorinet>
147
  </default>
 
148
  </config>
app/code/community/LaPoste/ExpeditorINet/etc/system.xml CHANGED
@@ -1,148 +1,148 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * LaPoste_ExpeditorINet
5
- *
6
- * @category LaPoste
7
- * @package LaPoste_ExpeditorINet
8
- * @copyright Copyright (c) 2010 La Poste
9
- * @author Smile (http://www.smile.fr) & Jibé
10
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
- */
12
- -->
13
- <config>
14
- <sections>
15
  <expeditorinet>
16
- <label>La Poste Expeditor Inet</label>
17
- <tab>sales</tab>
18
- <frontend_type>text</frontend_type>
19
- <sort_order>2000</sort_order>
20
- <show_in_default>1</show_in_default>
21
- <show_in_website>1</show_in_website>
22
- <show_in_store>1</show_in_store>
23
- <groups>
24
- <export translate="label">
25
- <label>Export Configuration</label>
26
- <frontend_type>text</frontend_type>
27
- <sort_order>10</sort_order>
28
- <show_in_default>1</show_in_default>
29
- <show_in_website>1</show_in_website>
30
- <show_in_store>1</show_in_store>
31
- <fields>
32
- <file_extension translate="label">
33
- <label>File Extension</label>
34
- <frontend_type>select</frontend_type>
35
- <source_model>expeditorinet/config_source_fileExtension</source_model>
36
- <sort_order>10</sort_order>
37
- <show_in_default>1</show_in_default>
38
- <show_in_website>1</show_in_website>
39
- <show_in_store>1</show_in_store>
40
- </file_extension>
41
- <file_charset translate="label">
42
- <label>File Charset</label>
43
- <frontend_type>select</frontend_type>
44
- <source_model>expeditorinet/config_source_fileCharset</source_model>
45
- <sort_order>20</sort_order>
46
- <show_in_default>1</show_in_default>
47
- <show_in_website>1</show_in_website>
48
- <show_in_store>1</show_in_store>
49
- </file_charset>
50
- <endofline_character translate="label">
51
- <label>End Of Line Character</label>
52
- <frontend_type>select</frontend_type>
53
- <source_model>expeditorinet/config_source_endOfLineCharacter</source_model>
54
- <sort_order>30</sort_order>
55
- <show_in_default>1</show_in_default>
56
- <show_in_website>1</show_in_website>
57
- <show_in_store>1</show_in_store>
58
- </endofline_character>
59
- <field_delimiter translate="label">
60
- <label>Field Delimiter</label>
61
- <frontend_type>select</frontend_type>
62
- <source_model>expeditorinet/config_source_fieldDelimiter</source_model>
63
- <sort_order>40</sort_order>
64
- <show_in_default>1</show_in_default>
65
- <show_in_website>1</show_in_website>
66
- <show_in_store>1</show_in_store>
67
- </field_delimiter>
68
- <field_separator translate="label">
69
- <label>Field Separator</label>
70
- <frontend_type>select</frontend_type>
71
- <source_model>expeditorinet/config_source_fieldSeparator</source_model>
72
- <sort_order>50</sort_order>
73
- <show_in_default>1</show_in_default>
74
- <show_in_website>1</show_in_website>
75
- <show_in_store>1</show_in_store>
76
- </field_separator>
77
- <company_commercial_name translate="label comment">
78
- <label>Company commercial name</label>
79
- <frontend_type>text</frontend_type>
80
- <sort_order>100</sort_order>
81
- <show_in_default>1</show_in_default>
82
- <show_in_website>1</show_in_website>
83
- <show_in_store>1</show_in_store>
84
- <comment>This value is used as commercial name of company for Expeditor Inet</comment>
85
- </company_commercial_name>
86
- </fields>
87
- </export>
88
- <import translate="label">
89
- <label>Import Configuration</label>
90
- <frontend_type>text</frontend_type>
91
- <sort_order>20</sort_order>
92
- <show_in_default>1</show_in_default>
93
- <show_in_website>1</show_in_website>
94
- <show_in_store>1</show_in_store>
95
- <fields>
96
- <default_tracking_title translate="label comment">
97
- <label>Default Tracking Title</label>
98
- <frontend_type>text</frontend_type>
99
- <sort_order>10</sort_order>
100
- <show_in_default>1</show_in_default>
101
- <show_in_website>1</show_in_website>
102
  <show_in_store>1</show_in_store>
103
- <comment>This value can be changed in the import form</comment>
104
- </default_tracking_title>
105
- <send_email translate="label comment">
106
- <label>Send an e-mail</label>
107
- <frontend_type>select</frontend_type>
108
- <source_model>adminhtml/system_config_source_yesno</source_model>
109
- <sort_order>20</sort_order>
110
- <show_in_default>1</show_in_default>
111
- <show_in_website>1</show_in_website>
112
  <show_in_store>1</show_in_store>
113
- <comment>Send shipping confirmation to the customer</comment>
114
- </send_email>
115
- <shipping_comment translate="label comment">
116
- <label>Shipping Comment</label>
117
- <frontend_type>text</frontend_type>
118
- <sort_order>30</sort_order>
119
- <show_in_default>1</show_in_default>
120
- <show_in_website>1</show_in_website>
121
- <show_in_store>1</show_in_store>
122
- <comment>Internal comment, can be left empty</comment>
123
- </shipping_comment>
124
- <include_comment translate="label comment">
125
- <label>Include comment into e-mail</label>
126
- <frontend_type>select</frontend_type>
127
- <source_model>adminhtml/system_config_source_yesno</source_model>
128
- <sort_order>40</sort_order>
129
- <show_in_default>1</show_in_default>
130
- <show_in_website>1</show_in_website>
131
  <show_in_store>1</show_in_store>
132
- <comment>Only applies if the shipping comment is set</comment>
133
- </include_comment>
134
- <carrier_code translate="label comment">
135
- <label>Carrier code</label>
136
- <frontend_type>text</frontend_type>
137
- <sort_order>50</sort_order>
138
- <show_in_default>1</show_in_default>
139
- <show_in_website>1</show_in_website>
140
- <show_in_store>1</show_in_store>
141
- <comment>By default, the tracking number will be associated to the "custom" code. If you want to associate it with your carrier code, put it here.</comment>
142
- </carrier_code>
143
- </fields>
144
- </import>
145
- </groups>
146
- </expeditorinet>
147
- </sections>
148
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * LaPoste_ExpeditorINet
5
+ *
6
+ * @category LaPoste
7
+ * @package LaPoste_ExpeditorINet
8
+ * @copyright Copyright (c) 2010 La Poste
9
+ * @author Smile (http://www.smile.fr) & Jibé
10
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
+ */
12
+ -->
13
+ <config>
14
+ <sections>
15
  <expeditorinet>
16
+ <label>La Poste Expeditor Inet</label>
17
+ <tab>sales</tab>
18
+ <frontend_type>text</frontend_type>
19
+ <sort_order>2000</sort_order>
20
+ <show_in_default>1</show_in_default>
21
+ <show_in_website>1</show_in_website>
22
+ <show_in_store>1</show_in_store>
23
+ <groups>
24
+ <export translate="label">
25
+ <label>Export Configuration</label>
26
+ <frontend_type>text</frontend_type>
27
+ <sort_order>10</sort_order>
28
+ <show_in_default>1</show_in_default>
29
+ <show_in_website>1</show_in_website>
30
+ <show_in_store>1</show_in_store>
31
+ <fields>
32
+ <file_extension translate="label">
33
+ <label>File Extension</label>
34
+ <frontend_type>select</frontend_type>
35
+ <source_model>expeditorinet/config_source_fileExtension</source_model>
36
+ <sort_order>10</sort_order>
37
+ <show_in_default>1</show_in_default>
38
+ <show_in_website>1</show_in_website>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  <show_in_store>1</show_in_store>
40
+ </file_extension>
41
+ <file_charset translate="label">
42
+ <label>File Charset</label>
43
+ <frontend_type>select</frontend_type>
44
+ <source_model>expeditorinet/config_source_fileCharset</source_model>
45
+ <sort_order>20</sort_order>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
 
48
  <show_in_store>1</show_in_store>
49
+ </file_charset>
50
+ <endofline_character translate="label">
51
+ <label>End Of Line Character</label>
52
+ <frontend_type>select</frontend_type>
53
+ <source_model>expeditorinet/config_source_endOfLineCharacter</source_model>
54
+ <sort_order>30</sort_order>
55
+ <show_in_default>1</show_in_default>
56
+ <show_in_website>1</show_in_website>
 
 
 
 
 
 
 
 
 
 
57
  <show_in_store>1</show_in_store>
58
+ </endofline_character>
59
+ <field_delimiter translate="label">
60
+ <label>Field Delimiter</label>
61
+ <frontend_type>select</frontend_type>
62
+ <source_model>expeditorinet/config_source_fieldDelimiter</source_model>
63
+ <sort_order>40</sort_order>
64
+ <show_in_default>1</show_in_default>
65
+ <show_in_website>1</show_in_website>
66
+ <show_in_store>1</show_in_store>
67
+ </field_delimiter>
68
+ <field_separator translate="label">
69
+ <label>Field Separator</label>
70
+ <frontend_type>select</frontend_type>
71
+ <source_model>expeditorinet/config_source_fieldSeparator</source_model>
72
+ <sort_order>50</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ </field_separator>
77
+ <company_commercial_name translate="label comment">
78
+ <label>Company commercial name</label>
79
+ <frontend_type>text</frontend_type>
80
+ <sort_order>100</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>1</show_in_store>
84
+ <comment>This value is used as commercial name of company for Expeditor Inet</comment>
85
+ </company_commercial_name>
86
+ </fields>
87
+ </export>
88
+ <import translate="label">
89
+ <label>Import Configuration</label>
90
+ <frontend_type>text</frontend_type>
91
+ <sort_order>20</sort_order>
92
+ <show_in_default>1</show_in_default>
93
+ <show_in_website>1</show_in_website>
94
+ <show_in_store>1</show_in_store>
95
+ <fields>
96
+ <default_tracking_title translate="label comment">
97
+ <label>Default Tracking Title</label>
98
+ <frontend_type>text</frontend_type>
99
+ <sort_order>10</sort_order>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>1</show_in_website>
102
+ <show_in_store>1</show_in_store>
103
+ <comment>This value can be changed in the import form</comment>
104
+ </default_tracking_title>
105
+ <send_email translate="label comment">
106
+ <label>Send an e-mail</label>
107
+ <frontend_type>select</frontend_type>
108
+ <source_model>adminhtml/system_config_source_yesno</source_model>
109
+ <sort_order>20</sort_order>
110
+ <show_in_default>1</show_in_default>
111
+ <show_in_website>1</show_in_website>
112
+ <show_in_store>1</show_in_store>
113
+ <comment>Send shipping confirmation to the customer</comment>
114
+ </send_email>
115
+ <shipping_comment translate="label comment">
116
+ <label>Shipping Comment</label>
117
+ <frontend_type>text</frontend_type>
118
+ <sort_order>30</sort_order>
119
+ <show_in_default>1</show_in_default>
120
+ <show_in_website>1</show_in_website>
121
+ <show_in_store>1</show_in_store>
122
+ <comment>Internal comment, can be left empty</comment>
123
+ </shipping_comment>
124
+ <include_comment translate="label comment">
125
+ <label>Include comment into e-mail</label>
126
+ <frontend_type>select</frontend_type>
127
+ <source_model>adminhtml/system_config_source_yesno</source_model>
128
+ <sort_order>40</sort_order>
129
+ <show_in_default>1</show_in_default>
130
+ <show_in_website>1</show_in_website>
131
+ <show_in_store>1</show_in_store>
132
+ <comment>Only applies if the shipping comment is set</comment>
133
+ </include_comment>
134
+ <carrier_code translate="label comment">
135
+ <label>Carrier code</label>
136
+ <frontend_type>text</frontend_type>
137
+ <sort_order>50</sort_order>
138
+ <show_in_default>1</show_in_default>
139
+ <show_in_website>1</show_in_website>
140
+ <show_in_store>1</show_in_store>
141
+ <comment>By default, the tracking number will be associated to the "custom" code. If you want to associate it with your carrier code, put it here.</comment>
142
+ </carrier_code>
143
+ </fields>
144
+ </import>
145
+ </groups>
146
+ </expeditorinet>
147
+ </sections>
148
+ </config>
app/design/adminhtml/default/default/template/expeditorinet/import/form.phtml CHANGED
@@ -1,7 +1,7 @@
1
- <!--
2
  /**
3
  * LaPoste_ExpeditorINet
4
- *
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
@@ -58,14 +58,13 @@
58
  </tbody>
59
  </table>
60
  </fieldset>
61
-
62
  </form>
63
  <script type="text/javascript">
64
  var importForm = new varienForm('import_form');
65
 
66
  function displayLoadingMask()
67
  {
68
- var loaderArea = $$('#html-body .wrapper')[0]; // Blocks all page
69
  Position.clone($(loaderArea), $('loading-mask'), {offsetLeft:-2});
70
  toggleSelectsUnderBlock($('loading-mask'), false);
71
  Element.show('loading-mask');
1
+ <!--
2
  /**
3
  * LaPoste_ExpeditorINet
4
+ *
5
  * @category LaPoste
6
  * @package LaPoste_ExpeditorINet
7
  * @copyright Copyright (c) 2010 La Poste
58
  </tbody>
59
  </table>
60
  </fieldset>
 
61
  </form>
62
  <script type="text/javascript">
63
  var importForm = new varienForm('import_form');
64
 
65
  function displayLoadingMask()
66
  {
67
+ var loaderArea = $$('#html-body .wrapper')[0]; // blocks all pages
68
  Position.clone($(loaderArea), $('loading-mask'), {offsetLeft:-2});
69
  toggleSelectsUnderBlock($('loading-mask'), false);
70
  Element.show('loading-mask');
app/etc/modules/LaPoste_ExpeditorINet.xml CHANGED
@@ -6,7 +6,7 @@
6
  * @category LaPoste
7
  * @package LaPoste_ExpeditorINet
8
  * @copyright Copyright (c) 2010 La Poste
9
- * @author Smile (http://www.smile.fr) & Jibé
10
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
  */
12
  -->
6
  * @category LaPoste
7
  * @package LaPoste_ExpeditorINet
8
  * @copyright Copyright (c) 2010 La Poste
9
+ * @author Smile (http://www.smile.fr) & Jibé
10
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
11
  */
12
  -->
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ColiPoste_La_Poste_Expeditor_Inet_So_Colissimo</name>
4
- <version>1.0.2</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>
@@ -19,9 +19,9 @@ Test&#xE9; et valid&#xE9; sur Magento :&#xD;
19
  R&#xE9;alis&#xE9; par Smile sur la base du module cr&#xE9;&#xE9; par Jib&#xE9;.</description>
20
  <notes>Ajout du champ code r&#xE9;seau point de retrait</notes>
21
  <authors><author><name>Berlioz</name><user>Aline</user><email>Aline.BERLIOZ@laposte.fr</email></author></authors>
22
- <date>2014-06-19</date>
23
- <time>15:05:27</time>
24
- <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="f1f401650b4beebf8b378dfdc92f7b78"/></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>
25
  <compatible/>
26
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
27
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ColiPoste_La_Poste_Expeditor_Inet_So_Colissimo</name>
4
+ <version>1.0.3</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>
19
  R&#xE9;alis&#xE9; par Smile sur la base du module cr&#xE9;&#xE9; par Jib&#xE9;.</description>
20
  <notes>Ajout du champ code r&#xE9;seau point de retrait</notes>
21
  <authors><author><name>Berlioz</name><user>Aline</user><email>Aline.BERLIOZ@laposte.fr</email></author></authors>
22
+ <date>2014-09-05</date>
23
+ <time>13:36:00</time>
24
+ <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="0afef5bb21747ce26466f7367b3f6d19"/></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="0160b61df3bd9f9df92adc57fe73063c"/></dir><file name="Orders.php" hash="eddae8e734c4b12a36343ef330cdcb32"/></dir><dir name="Import"><file name="Form.php" hash="375c120395760e50ce8eb6e6edf2cdca"/></dir></dir><dir name="Helper"><file name="Data.php" hash="24cb04365b62674358f146627c95125f"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="EndOfLineCharacter.php" hash="b8c600ab0371995b790bbb9f9ce43185"/><file name="FieldDelimiter.php" hash="d82eacb4771e2db3168bc360dbd9586b"/><file name="FieldSeparator.php" hash="30c60175102f0c138798d6ce095e1439"/><file name="FileCharset.php" hash="67ae7384d6c71a535e1d93fd683a4d80"/><file name="FileExtension.php" hash="b5d4b7b193e63270f30c5624ff7e9921"/></dir></dir></dir><dir name="controllers"><file name="ExportController.php" hash="d2eafbe048998ee0ef2468b8ea4526ae"/><file name="ImportController.php" hash="81ed1330737f49c111478411f5287b2c"/></dir><dir name="etc"><file name="config.xml" hash="b19f1f21e76d75c140d6558a4bab2aa2"/><file name="system.xml" hash="633934a8f0ce96d8008a4362a77a364c"/></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="LaPoste_ExpeditorINet.xml" hash="f2198321021ba493d81d064eb99e6aec"/></dir></dir></target></contents>
25
  <compatible/>
26
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
27
  </package>