ColiPoste_La_Poste_Expeditor_Inet_So_Colissimo - Version 1.0.0

Version Notes

Lire le manuel d'installation

Download this release

Release Info

Developer Magento Core Team
Extension ColiPoste_La_Poste_Expeditor_Inet_So_Colissimo
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/LaPoste/ExpeditorINet/Block/Export/Orders.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * LaPoste_ExpeditorINet
4
+ *
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 extends Mage_Adminhtml_Block_Widget_Grid_Container
12
+ {
13
+
14
+ public function __construct()
15
+ {
16
+ $this->_blockGroup = 'expeditorinet';
17
+ $this->_controller = 'export_orders';
18
+ $this->_headerText = Mage::helper('expeditorinet')->__('Export to Expeditor Inet');
19
+ parent::__construct();
20
+ $this->_removeButton('add');
21
+ }
22
+
23
+ }
app/code/community/LaPoste/ExpeditorINet/Block/Export/Orders/Grid.php ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * LaPoste_ExpeditorINet
4
+ *
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();
17
+ $this->setId('expeditorinet_export_order_grid');
18
+ $this->setDefaultSort('created_at');
19
+ $this->setDefaultDir('DESC');
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',
107
+ 'type' => 'action',
108
+ 'getter' => 'getId',
109
+ 'actions' => array(
110
+ array(
111
+ 'caption' => Mage::helper('sales')->__('View'),
112
+ 'url' => array('base'=>'adminhtml/sales_order/view'),
113
+ 'field' => 'order_id'
114
+ )
115
+ ),
116
+ 'filter' => false,
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')) {
145
+ return $this->getUrl('adminhtml/sales_order/view', array('order_id' => $row->getId()));
146
+ }
147
+ return false;
148
+ }
149
+
150
+ public function getGridUrl()
151
+ {
152
+ return $this->getUrl('*/*/*', array('_current'=>true));
153
+ }
154
+
155
+ }
app/code/community/LaPoste/ExpeditorINet/Block/Import/Form.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * LaPoste_ExpeditorINet
4
+ *
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_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
+ }
app/code/community/LaPoste/ExpeditorINet/Helper/Data.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * LaPoste_ExpeditorINet
4
+ *
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_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
+ }
app/code/community/LaPoste/ExpeditorINet/Model/Config/Source/EndOfLineCharacter.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * LaPoste_ExpeditorINet
4
+ *
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_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
+ }
app/code/community/LaPoste/ExpeditorINet/Model/Config/Source/FieldDelimiter.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * LaPoste_ExpeditorINet
4
+ *
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_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
+ }
app/code/community/LaPoste/ExpeditorINet/Model/Config/Source/FieldSeparator.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * LaPoste_ExpeditorINet
4
+ *
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_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
+ }
app/code/community/LaPoste/ExpeditorINet/Model/Config/Source/FileCharset.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * LaPoste_ExpeditorINet
4
+ *
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_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
+ }
app/code/community/LaPoste/ExpeditorINet/Model/Config/Source/FileExtension.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * LaPoste_ExpeditorINet
4
+ *
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_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
+ }
app/code/community/LaPoste/ExpeditorINet/controllers/ExportController.php ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * LaPoste_ExpeditorINet
4
+ *
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_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
+ {
27
+ $this->loadLayout()
28
+ ->_setActiveMenu('sales/expeditorinet/export')
29
+ ->_addContent($this->getLayout()->createBlock('expeditorinet/export_orders'))
30
+ ->renderLayout();
31
+ }
32
+
33
+ /**
34
+ * Export Action
35
+ * Generates a CSV file to download
36
+ */
37
+ public function exportAction()
38
+ {
39
+ /* get the orders */
40
+ $orderIds = $this->getRequest()->getPost('order_ids');
41
+
42
+ /**
43
+ * Get configuration
44
+ */
45
+ $separator = Mage::helper('expeditorinet')->getConfigurationFieldSeparator();
46
+ $delimiter = Mage::helper('expeditorinet')->getConfigurationFieldDelimiter();
47
+ if ($delimiter == 'simple_quote') {
48
+ $delimiter = "'";
49
+ } else if ($delimiter == 'double_quotes') {
50
+ $delimiter = '"';
51
+ }
52
+ $lineBreak = Mage::helper('expeditorinet')->getConfigurationEndOfLineCharacter();
53
+ if ($lineBreak == 'lf') {
54
+ $lineBreak = "\n";
55
+ } else if ($lineBreak == 'cr') {
56
+ $lineBreak = "\r";
57
+ } else if ($lineBreak == 'crlf') {
58
+ $lineBreak = "\r\n";
59
+ }
60
+ $fileExtension = Mage::helper('expeditorinet')->getConfigurationFileExtension();
61
+ $fileCharset = Mage::helper('expeditorinet')->getConfigurationFileCharset();
62
+
63
+ /* So Colissimo product codes for Hors Domicile */
64
+ $hd_productcodes = array (
65
+ 'BPR',
66
+ 'ACP',
67
+ 'CIT',
68
+ 'A2P',
69
+ 'MRL',
70
+ 'CDI'
71
+ );
72
+
73
+ /* set the filename */
74
+ $filename = 'orders_export_'.Mage::getSingleton('core/date')->date('Ymd_His').$fileExtension;
75
+
76
+ /* get company commercial name */
77
+ $commercialName = Mage::helper('expeditorinet')->getCompanyCommercialName();
78
+
79
+ /* initialize the content variable */
80
+ $content = '';
81
+
82
+ if (!empty($orderIds)) {
83
+ foreach ($orderIds as $orderId) {
84
+
85
+ /* get the order */
86
+ $order = Mage::getModel('sales/order')->load($orderId);
87
+
88
+ //if the product code is for Hors Domicile we should take the billing address
89
+ if (in_array($order->getSocoProductCode(), $hd_productcodes)) {
90
+ /* get the shipping address */
91
+ $address = $order->getBillingAddress();
92
+ } else {
93
+ /* get the billing address */
94
+ $address = $order->getShippingAddress();
95
+ }
96
+ /* real order id */
97
+ $content = $this->_addFieldToCsv($content, $delimiter, $order->getRealOrderId());
98
+ $content .= $separator;
99
+ /* customer first name */
100
+ $content = $this->_addFieldToCsv($content, $delimiter, $address->getFirstname());
101
+ $content .= $separator;
102
+ /* customer last name */
103
+ $content = $this->_addFieldToCsv($content, $delimiter, $address->getLastname());
104
+ $content .= $separator;
105
+ /* customer company */
106
+ $content = $this->_addFieldToCsv($content, $delimiter, $address->getCompany());
107
+ $content .= $separator;
108
+ /* street address, on 4 fields */
109
+ $content = $this->_addFieldToCsv($content, $delimiter, $address->getStreet(1));
110
+ $content .= $separator;
111
+ $content = $this->_addFieldToCsv($content, $delimiter, $address->getStreet(2));
112
+ $content .= $separator;
113
+ $content = $this->_addFieldToCsv($content, $delimiter, $address->getStreet(3));
114
+ $content .= $separator;
115
+ $content = $this->_addFieldToCsv($content, $delimiter, $address->getStreet(4));
116
+ $content .= $separator;
117
+ /* postal code */
118
+ $content = $this->_addFieldToCsv($content, $delimiter, $address->getPostcode());
119
+ $content .= $separator;
120
+ /* city */
121
+ $content = $this->_addFieldToCsv($content, $delimiter, $address->getCity());
122
+ $content .= $separator;
123
+ /* country code */
124
+ $content = $this->_addFieldToCsv($content, $delimiter, $address->getCountry());
125
+ $content .= $separator;
126
+ /* telephone */
127
+ $telephone = '';
128
+ if ($order->getSocoPhoneNumber() != '' && $order->getSocoPhoneNumber() != null) {
129
+ $telephone = $order->getSocoPhoneNumber();
130
+ } elseif ($address->getTelephone() != '' && $address->getTelephone() != null) {
131
+ $telephone = $address->getTelephone();
132
+ }
133
+ $content = $this->_addFieldToCsv($content, $delimiter, $telephone);
134
+ $content .= $separator;
135
+ /* code produit */
136
+ $content = $this->_addFieldToCsv($content, $delimiter, $order->getSocoProductCode());
137
+ $content .= $separator;
138
+ /* instruction de livraison */
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());
146
+ $content .= $separator;
147
+ /* code porte 2 */
148
+ $content = $this->_addFieldToCsv($content, $delimiter, $order->getSocoDoorCode2());
149
+ $content .= $separator;
150
+ /* Interphone */
151
+ $content = $this->_addFieldToCsv($content, $delimiter, $order->getSocoInterphone());
152
+ $content .= $separator;
153
+ /* Code point retrait */
154
+ $content = $this->_addFieldToCsv($content, $delimiter, $order->getSocoRelayPointCode());
155
+ $content .= $separator;
156
+ /* E-mail de suivi socolissimo */
157
+ $content = $this->_addFieldToCsv($content, $delimiter, $order->getSocoEmail());
158
+ $content .= $separator;
159
+
160
+ /* total weight */
161
+ $total_weight = 0;
162
+ $items = $order->getAllItems();
163
+ foreach ($items as $item) {
164
+ $total_weight += $item['row_weight'];
165
+ }
166
+ $content = $this->_addFieldToCsv($content, $delimiter, $total_weight);
167
+ $content .= $separator;
168
+
169
+ /* company commercial name */
170
+ $content = $this->_addFieldToCsv($content, $delimiter, $commercialName);
171
+
172
+ $content .= $lineBreak;
173
+ }
174
+
175
+ /* decode the content, depending on the charset */
176
+ if ($fileCharset == 'ISO-8859-1') {
177
+ $content = utf8_decode($content);
178
+ }
179
+
180
+ /* pick file mime type, depending on the extension */
181
+ if ($fileExtension == '.txt') {
182
+ $fileMimeType = 'text/plain';
183
+ } else if ($fileExtension == '.csv') {
184
+ $fileMimeType = 'application/csv';
185
+ } else {
186
+ // default
187
+ $fileMimeType = 'text/plain';
188
+ }
189
+
190
+ /* download the file */
191
+ return $this->_prepareDownloadResponse($filename, $content, $fileMimeType .'; charset="'. $fileCharset .'"');
192
+ }
193
+ else {
194
+ $this->_getSession()->addError($this->__('No Order has been selected'));
195
+ }
196
+ }
197
+
198
+ /**
199
+ * Add a new field to the csv file
200
+ * @param csvContent : the current csv content
201
+ * @param fieldDelimiter : the delimiter character
202
+ * @param fieldContent : the content to add
203
+ * @return : the concatenation of current content and content to add
204
+ */
205
+ private function _addFieldToCsv($csvContent, $fieldDelimiter, $fieldContent) {
206
+ return $csvContent . $fieldDelimiter . $fieldContent . $fieldDelimiter;
207
+ }
208
+
209
+ }
app/code/community/LaPoste/ExpeditorINet/controllers/ImportController.php ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * LaPoste_ExpeditorINet
4
+ *
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_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
+ {
27
+ $this->loadLayout()
28
+ ->_setActiveMenu('sales/expeditorinet/import')
29
+ ->_addContent($this->getLayout()->createBlock('expeditorinet/import_form'))
30
+ ->renderLayout();
31
+ }
32
+
33
+ /**
34
+ * Import Action
35
+ */
36
+ public function importAction()
37
+ {
38
+ if ($this->getRequest()->isPost() && !empty($_FILES['import_expeditor_inet_file']['tmp_name'])) {
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');
55
+ }
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
+ /**
142
+ * Create new shipment for order
143
+ * Inspired by Mage_Sales_Model_Order_Shipment_Api methods
144
+ *
145
+ * @param Mage_Sales_Model_Order $order (it should exist, no control is done into the method)
146
+ * @param string $trackingNumber
147
+ * @param string $trackingTitle
148
+ * @param booleam $email
149
+ * @param string $comment
150
+ * @param boolean $includeComment
151
+ * @return int : shipment real id if creation was ok, else 0
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
+ }
179
+
180
+ $item = $convertor->itemToShipmentItem($orderItem);
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
+ }
app/code/community/LaPoste/ExpeditorINet/etc/config.xml ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
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
+
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>
24
+
25
+ <global>
26
+ <models>
27
+ <expeditorinet>
28
+ <class>LaPoste_ExpeditorINet_Model</class>
29
+ </expeditorinet>
30
+ </models>
31
+ <blocks>
32
+ <expeditorinet>
33
+ <class>LaPoste_ExpeditorINet_Block</class>
34
+ </expeditorinet>
35
+ </blocks>
36
+ <helpers>
37
+ <expeditorinet>
38
+ <class>LaPoste_ExpeditorINet_Helper</class>
39
+ </expeditorinet>
40
+ </helpers>
41
+ </global>
42
+
43
+ <admin>
44
+ <routers>
45
+ <expeditorinet>
46
+ <use>admin</use>
47
+ <args>
48
+ <module>LaPoste_ExpeditorINet</module>
49
+ <frontName>expeditorinet</frontName>
50
+ </args>
51
+ </expeditorinet>
52
+ </routers>
53
+ </admin>
54
+
55
+ <adminhtml>
56
+
57
+ <menu>
58
+ <sales>
59
+ <children>
60
+ <expeditorinet translate="title"> <!-- TODO faire marcher : module="expeditor_inet" (aussi dans les children) -->
61
+ <title>La Poste Expeditor INet</title>
62
+ <sort_order>15</sort_order>
63
+ <children>
64
+ <export translate="title">
65
+ <title>Export orders</title>
66
+ <action>expeditorinet/export</action>
67
+ <sort_order>10</sort_order>
68
+ </export>
69
+ <import translate="title">
70
+ <title>Import shipping</title>
71
+ <action>expeditorinet/import</action>
72
+ <sort_order>20</sort_order>
73
+ </import>
74
+ </children>
75
+ </expeditorinet>
76
+ </children>
77
+ </sales>
78
+ </menu>
79
+
80
+ <acl>
81
+ <resources>
82
+ <admin>
83
+ <children>
84
+ <sales>
85
+ <children>
86
+ <expeditorinet translate="title">
87
+ <title>La Poste Expeditor INet</title>
88
+ <children>
89
+ <export translate="title">
90
+ <title>Export orders</title>
91
+ </export>
92
+ <import translate="title">
93
+ <title>Import shipping</title>
94
+ </import>
95
+ </children>
96
+ <sort_order>15</sort_order>
97
+ </expeditorinet>
98
+ </children>
99
+ </sales>
100
+ <system>
101
+ <children>
102
+ <config>
103
+ <children>
104
+ <expeditorinet>
105
+ <title>La Poste Expeditor INet</title>
106
+ <sort_order>100</sort_order>
107
+ </expeditorinet>
108
+ </children>
109
+ </config>
110
+ </children>
111
+ </system>
112
+ </children>
113
+ </admin>
114
+ </resources>
115
+ </acl>
116
+
117
+ <translate>
118
+ <modules>
119
+ <expeditorinet>
120
+ <files>
121
+ <default>LaPoste_ExpeditorINet.csv</default>
122
+ </files>
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>
140
+ <send_email>1</send_email>
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>
app/code/community/LaPoste/ExpeditorINet/etc/system.xml ADDED
@@ -0,0 +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>
app/design/adminhtml/default/default/template/expeditorinet/import/form.phtml ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ /**
3
+ * LaPoste_ExpeditorINet
4
+ *
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
+ -->
12
+ <div class="content-header">
13
+ <table cellspacing="0">
14
+ <tr>
15
+ <td><h3 class="icon-head head-tax-rate-importExport"><?php echo Mage::helper('expeditorinet')->__('Import from Expeditor Inet') ?></h3></td>
16
+ </tr>
17
+ </table>
18
+ </div>
19
+ <div class="entry-edit">
20
+ <div class="box-left">
21
+ <form id="import_form" action="<?php echo $this->getUrl('*/*/import') ?>" method="post" enctype="multipart/form-data">
22
+ <?php echo $this->getBlockHtml('formkey')?>
23
+ <div class="entry-edit-head">
24
+ <h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('expeditorinet')->__('Import from Expeditor Inet') ?></h4>
25
+ </div>
26
+
27
+ <fieldset>
28
+ <table class="form-list" cellspacing="0">
29
+ <colgroup class="label"/>
30
+ <colgroup class="value"/>
31
+ <tbody>
32
+ <tr>
33
+ <td class="label">
34
+ <label><?php echo Mage::helper('expeditorinet')->__('Tracking Title') ?></label>
35
+ </td>
36
+ <td class="value">
37
+ <input type="text" name="import_expeditor_inet_tracking_title" class="input-file" value="<?php echo Mage::helper('expeditorinet')->getConfigurationDefaultTrackingTitle() ?>"/>
38
+ </td>
39
+ </tr>
40
+ <tr>
41
+ <td class="label">
42
+ <label><?php echo Mage::helper('expeditorinet')->__('Import File') ?></label>
43
+ </td>
44
+ <td class="value">
45
+ <input type="file" name="import_expeditor_inet_file" class="input-file required-entry"/>
46
+ <p class="nm">
47
+ <small><?php echo Mage::helper('expeditorinet')->__('Line format:'). ' "'.Mage::helper('expeditorinet')->__('order id').'","'.Mage::helper('expeditorinet')->__('tracking number').'"'; ?></small>
48
+ </p>
49
+ </td>
50
+ </tr>
51
+ <tr>
52
+ <td>&nbsp;</td>
53
+ <td class="value">
54
+ <?php $button_label = Mage::helper('expeditorinet')->__('Import'); ?>
55
+ <?php echo $this->getButtonHtml($button_label, "this.form.submit();displayLoadingMask();") ?>
56
+ </td>
57
+ </tr>
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');
72
+ }
73
+ </script>
74
+ </div>
75
+ <div class="clear"></div>
76
+ </div>
app/etc/modules/LaPoste_ExpeditorINet.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <modules>
15
+ <LaPoste_ExpeditorINet>
16
+ <active>true</active>
17
+ <codePool>community</codePool>
18
+ </LaPoste_ExpeditorINet>
19
+ </modules>
20
+ </config>
app/locale/fr_FR/LaPoste_ExpeditorINet.csv ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Import from Expeditor Inet","Importer depuis Expeditor Inet"
2
+ "Tracking Title","Nom du suivi"
3
+ "Import File","Fichier d'import"
4
+ "Import","Importer"
5
+ "Line format:","Format des lignes :"
6
+ "order id","id de la commande"
7
+ "tracking number","numéro de suivi"
8
+ "Export to Expeditor Inet","Exporter vers Expeditor Inet"
9
+ "No Order has been selected","Aucune commande n'a été sélectionnée"
10
+ "Invalid file upload attempt","Tentative de téléchargement de fichier invalide"
11
+ "Order Id","Id de la commande"
12
+ "Tracking Number","Numéro de suivi"
13
+ "Line %s format is invalid and has been ignored","La ligne %s n'a pas un format valide et a été ignorée"
14
+ "Order %s does not exist","La commande %s n'existe pas"
15
+ "Shipment %s created for order %s, with tracking number %s","Expédition %s créée pour la commande %s, avec numéro de suivi %s"
16
+ "Order %s can not be shipped or has already been shipped","La commande %s ne peut pas être expédiée ou l'a déjà été"
17
+ "Shipment creation error for Order %s : %s","Erreur de création de l'expédition pour la commande %s : %s"
18
+ "Simple Quote","Quote simple"
19
+ "Double Quotes","Guillemets"
20
+ "Export Configuration","Configuration de l'export"
21
+ "File Extension","Extension du fichier"
22
+ "File Charset","Encodage du fichier"
23
+ "End Of Line Character","Caractère de fin de ligne"
24
+ "Field Delimiter","Délimiteur de champ"
25
+ "Field Separator","Séparateur de champ"
26
+ "Import Configuration","Configuration de l'import"
27
+ "Default Tracking Title","Nom du suivi par défaut"
28
+ "This value can be changed in the import form","Cette valeur peut être modifiée dans le formulaire d'import"
29
+ "Send an e-mail","Envoi d'un e-mail"
30
+ "Send shipping confirmation to the customer","Envoyer la confirmation d'expédition au client"
31
+ "Shipping Comment","Commentaire d'expédition"
32
+ "Internal comment, can be left empty","Commentaire interne, facultatif"
33
+ "Include comment into e-mail","Inclure le commentaire dans l'e-mail"
34
+ "Only applies if the shipping comment is set","Ne s'applique que si le commentaire est non vide"
35
+ "Export orders","Exporter les commandes"
36
+ "Import shipping","Importer les expéditions"
37
+ "Carrier code","Code du transporteur"
38
+ "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.","Par défaut, le numéro de suivi est associé avec le code ""custom"". Indiquer ici le code du transporteur auquel on souhaite l'associer."
39
+ "Company commercial name","Nom commercial de la société"
40
+ "This value is used as commercial name of company for Expeditor Inet","Utilisé comme nom commercial de la société sur les étiquettes de livraison"
package.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>ColiPoste_La_Poste_Expeditor_Inet_So_Colissimo</name>
4
+ <version>1.0.0</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:07:46</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>