Andreani - Version 0.1.9

Version Notes

Release Version 0.1.9

Fix:
- Arreglo en la paginacion de "estado de pedidos".

- Cambio en la ubicaciòn del menù a:
Ventas->Andreani

Download this release

Release Info

Developer Gaspar Mac
Extension Andreani
Version 0.1.9
Comparing to
See all releases


Code changes from version 0.1.8 to 0.1.9

app/code/local/Ecloud/Andreani/Block/Adminhtml/Pedidos/Grid.php CHANGED
@@ -1,182 +1,164 @@
1
-
2
- <?php
3
- /**
4
- * @version 0.1.8 04.07.2014
5
- * @author ecloud solutions http://www.ecloudsolutions.com <info@ecloudsolutions.com>
6
- * @copyright Copyright (C) 2010 - 2014 ecloud solutions ®
7
- */
8
- ?>
9
- <?php
10
- class Ecloud_Andreani_Block_Adminhtml_Pedidos_Grid extends Mage_Adminhtml_Block_Widget_Grid
11
- {
12
-
13
-
14
- public function __construct()
15
- {
16
-
17
-
18
- parent::__construct();
19
- $this->setId('andreani_order');
20
- $this->setDefaultSort('id');
21
- $this->setDefaultDir('DESC');
22
- $this->setSaveParametersInSession(true);
23
- $this->setUseAjax(true);
24
- }
25
-
26
- protected function _prepareCollection()
27
- {
28
- $collection = Mage::getModel('andreani/order')->getCollection();
29
- $this->setCollection($collection);
30
- parent::_prepareCollection();
31
- return $this;
32
- }
33
-
34
-
35
- protected function _prepareColumns()
36
- {
37
- /*
38
- $this->addColumn('id', array(
39
- 'header' => Mage::helper('andreani')->__('ID'),
40
- 'sortable' => true,
41
- 'width' => '5',
42
- 'index' => 'id'
43
- ));*/
44
-
45
- $this->addColumn('id_orden', array(
46
- 'header' => Mage::helper('andreani')->__('ID Orden'),
47
- 'sortable' => true,
48
- 'width' => '2%',
49
- 'index' => 'id_orden',
50
- 'type' => 'text'
51
- ));
52
-
53
- $this->addColumn('nombre', array(
54
- 'header' => Mage::helper('andreani')->__('Nombre'),
55
- 'sortable' => true,
56
- 'width' => '5',
57
- 'index' => 'nombre',
58
- 'type' => 'text'
59
- ));
60
-
61
- $this->addColumn('apellido', array(
62
- 'header' => Mage::helper('andreani')->__('Apellido'),
63
- 'sortable' => true,
64
- 'width' => '5',
65
- 'index' => 'apellido',
66
- 'type' => 'text'
67
- ));
68
-
69
- $this->addColumn('sucursal_retiro', array(
70
- 'header' => Mage::helper('andreani')->__('Sucursal'),
71
- 'sortable' => true,
72
- 'width' => '5',
73
- 'index' => 'sucursal_retiro',
74
- 'type' => 'text'
75
- ));
76
-
77
- $this->addColumn('detalle_productos', array(
78
- 'header' => Mage::helper('andreani')->__('Descripcion Productos'),
79
- 'sortable' => true,
80
- 'width' => '5',
81
- 'index' => 'detalle_productos',
82
- 'type' => 'text'
83
- ));
84
- $this->addColumn('cliente', array(
85
- 'header' => Mage::helper('andreani')->__('Cliente Andreani'),
86
- 'sortable' => true,
87
- 'width' => '60',
88
- 'index' => 'cliente',
89
- 'type' => 'text'
90
- ));
91
-
92
- $this->addColumn('contrato', array(
93
- 'header' => Mage::helper('andreani')->__('Contrato Andreani'),
94
- 'sortable' => true,
95
- 'width' => '60',
96
- 'index' => 'contrato',
97
- 'type' => 'text'
98
- ));
99
-
100
- $this->addColumn('recibo_tracking', array(
101
- 'header' => Mage::helper('andreani')->__('Recibo'),
102
- 'sortable' => true,
103
- 'width' => '5',
104
- 'index' => 'recibo_tracking',
105
- 'type' => 'text'
106
- ));
107
-
108
- $this->addColumn('cod_tracking', array(
109
- 'header' => Mage::helper('andreani')->__('Nro Andreani - Tracking'),
110
- 'sortable' => true,
111
- 'width' => '5',
112
- 'index' => 'cod_tracking',
113
- 'type' => 'text'
114
- ));
115
-
116
- $this->addColumn('impresion', array(
117
- 'header'=> Mage::helper('catalog')->__('Imprimir Constancia'),
118
- 'target' => '_blank',
119
-
120
- 'renderer' => 'andreani/adminhtml_Pedidos_Edit_Renderer_button'
121
-
122
- ));
123
-
124
- $this->addColumn('estado', array(
125
- 'header' => Mage::helper('andreani')->__('Estado'),
126
- 'sortable' => false,
127
- 'width' => '5',
128
- 'index' => 'estado',
129
- 'type' => 'text',
130
-
131
- ));
132
-
133
- $this->addColumn('action_edit', array(
134
- 'header' => $this->helper('andreani')->__('Action'),
135
- 'width' => 15,
136
- 'sortable' => false,
137
- 'filter' => false,
138
- 'type' => 'action',
139
- 'actions' => array(
140
- array(
141
- 'caption' => $this->helper('andreani')->__('View'),
142
- ))
143
- ));
144
-
145
- return parent::_prepareColumns();
146
- }
147
-
148
- protected function _prepareMassaction()
149
- {
150
- $this->setMassactionIdField('id');
151
- $this->getMassactionBlock()->setFormFieldName('id');
152
- $this->getMassactionBlock()->addItem('eliminar', array(
153
- 'label'=> Mage::helper('andreani')->__('Eliminar'),
154
- 'url' => $this->getUrl('*/*/massEliminar', array('' => '')),
155
- 'confirm' => Mage::helper('andreani')->__('¿Seguro que quieres eliminar la orden?')
156
- ));
157
- $this->getMassactionBlock()->addItem('entregado', array(
158
- 'label'=> Mage::helper('andreani')->__('Entregado'),
159
- 'url' => $this->getUrl('*/*/massEntregado', array('' => '')),
160
- 'confirm' => Mage::helper('andreani')->__('¿Seguro que quieres modificar el estado de la orden?')
161
- ));
162
- $this->getMassactionBlock()->addItem('pendiente', array(
163
- 'label'=> Mage::helper('andreani')->__('Pendiente'),
164
- 'url' => $this->getUrl('*/*/massPendiente', array('' => '')),
165
- 'confirm' => Mage::helper('andreani')->__('¿Seguro que quieres modificar el estado de la orden?')
166
- ));
167
-
168
- return $this;
169
- }
170
-
171
- public function getRowUrl($row)
172
- {
173
- return $this->getUrl('*/*/view', array('id' => $row->getId()));
174
- }
175
-
176
- public function getGridUrl()
177
- {
178
- return $this->getUrl('*/*/grid', array('_current'=>true));
179
- }
180
-
181
- }
182
  ?>
1
+ <?php
2
+ /**
3
+ * @version 0.1.8 04.07.2014
4
+ * @author ecloud solutions http://www.ecloudsolutions.com <info@ecloudsolutions.com>
5
+ * @copyright Copyright (C) 2010 - 2014 ecloud solutions ®
6
+ */
7
+ ?>
8
+ <?php
9
+ class Ecloud_Andreani_Block_Adminhtml_Pedidos_Grid extends Mage_Adminhtml_Block_Widget_Grid
10
+ {
11
+
12
+ public function __construct()
13
+ {
14
+ parent::__construct();
15
+ $this->setId('andreani_order');
16
+ $this->setDefaultSort('id');
17
+ $this->setDefaultDir('DESC');
18
+ $this->setSaveParametersInSession(true);
19
+ $this->setUseAjax(true);
20
+ }
21
+
22
+ protected function _prepareCollection()
23
+ {
24
+ $collection = Mage::getModel('andreani/order')->getCollection();
25
+ $this->setCollection($collection);
26
+ parent::_prepareCollection();
27
+ return $this;
28
+ }
29
+
30
+ protected function _prepareColumns()
31
+ {
32
+ /*
33
+ $this->addColumn('id', array(
34
+ 'header' => Mage::helper('andreani')->__('ID'),
35
+ 'sortable' => true,
36
+ 'width' => '5',
37
+ 'index' => 'id'
38
+ ));*/
39
+
40
+ $this->addColumn('id_orden', array(
41
+ 'header' => Mage::helper('andreani')->__('ID Orden'),
42
+ 'sortable' => true,
43
+ 'width' => '2%',
44
+ 'index' => 'id_orden',
45
+ 'type' => 'text'
46
+ ));
47
+
48
+ $this->addColumn('nombre', array(
49
+ 'header' => Mage::helper('andreani')->__('Nombre'),
50
+ 'sortable' => true,
51
+ 'width' => '5',
52
+ 'index' => 'nombre',
53
+ 'type' => 'text'
54
+ ));
55
+
56
+ $this->addColumn('apellido', array(
57
+ 'header' => Mage::helper('andreani')->__('Apellido'),
58
+ 'sortable' => true,
59
+ 'width' => '5',
60
+ 'index' => 'apellido',
61
+ 'type' => 'text'
62
+ ));
63
+
64
+ $this->addColumn('sucursal_retiro', array(
65
+ 'header' => Mage::helper('andreani')->__('Sucursal'),
66
+ 'sortable' => false,
67
+ 'width' => '5',
68
+ 'index' => 'sucursal_retiro',
69
+ 'type' => 'text'
70
+ ));
71
+
72
+ $this->addColumn('detalle_productos', array(
73
+ 'header' => Mage::helper('andreani')->__('Descripcion Productos'),
74
+ 'sortable' => false,
75
+ 'width' => '5',
76
+ 'index' => 'detalle_productos',
77
+ 'type' => 'text'
78
+ ));
79
+ $this->addColumn('cliente', array(
80
+ 'header' => Mage::helper('andreani')->__('Cliente Andreani'),
81
+ 'sortable' => true,
82
+ 'width' => '60',
83
+ 'index' => 'cliente',
84
+ 'type' => 'text'
85
+ ));
86
+
87
+ $this->addColumn('contrato', array(
88
+ 'header' => Mage::helper('andreani')->__('Contrato Andreani'),
89
+ 'sortable' => true,
90
+ 'width' => '60',
91
+ 'index' => 'contrato',
92
+ 'type' => 'text'
93
+ ));
94
+
95
+ $this->addColumn('recibo_tracking', array(
96
+ 'header' => Mage::helper('andreani')->__('Recibo'),
97
+ 'sortable' => true,
98
+ 'width' => '5',
99
+ 'index' => 'recibo_tracking',
100
+ 'type' => 'text'
101
+ ));
102
+
103
+ $this->addColumn('cod_tracking', array(
104
+ 'header' => Mage::helper('andreani')->__('Nro Andreani - Tracking'),
105
+ 'sortable' => true,
106
+ 'width' => '5',
107
+ 'index' => 'cod_tracking',
108
+ 'type' => 'text'
109
+ ));
110
+
111
+ $this->addColumn('impresion', array(
112
+ 'header'=> Mage::helper('catalog')->__('Imprimir Constancia'),
113
+ 'sortable' => false,
114
+ 'target' => '_blank',
115
+ 'renderer' => 'andreani/adminhtml_Pedidos_Edit_Renderer_button'
116
+ ));
117
+
118
+ $this->addColumn('estado', array(
119
+ 'header' => Mage::helper('andreani')->__('Estado'),
120
+ 'sortable' => false,
121
+ 'width' => '5',
122
+ 'index' => 'estado',
123
+ 'type' => 'text',
124
+
125
+ ));
126
+
127
+ return parent::_prepareColumns();
128
+ }
129
+
130
+ protected function _prepareMassaction()
131
+ {
132
+ $this->setMassactionIdField('id');
133
+ $this->getMassactionBlock()->setFormFieldName('id');
134
+ $this->getMassactionBlock()->addItem('eliminar', array(
135
+ 'label'=> Mage::helper('andreani')->__('Eliminar'),
136
+ 'url' => $this->getUrl('*/*/massEliminar', array('' => '')),
137
+ 'confirm' => Mage::helper('andreani')->__('¿Seguro que quieres eliminar la orden?')
138
+ ));
139
+ $this->getMassactionBlock()->addItem('entregado', array(
140
+ 'label'=> Mage::helper('andreani')->__('Entregado'),
141
+ 'url' => $this->getUrl('*/*/massEntregado', array('' => '')),
142
+ 'confirm' => Mage::helper('andreani')->__('¿Seguro que quieres modificar el estado de la orden?')
143
+ ));
144
+ $this->getMassactionBlock()->addItem('pendiente', array(
145
+ 'label'=> Mage::helper('andreani')->__('Pendiente'),
146
+ 'url' => $this->getUrl('*/*/massPendiente', array('' => '')),
147
+ 'confirm' => Mage::helper('andreani')->__('¿Seguro que quieres modificar el estado de la orden?')
148
+ ));
149
+
150
+ return $this;
151
+ }
152
+
153
+ public function getRowUrl($row)
154
+ {
155
+ return $this->getUrl('*/*/view', array('id' => $row->getId()));
156
+ }
157
+
158
+ public function getGridUrl()
159
+ {
160
+ return $this->getUrl('*/*/grid', array('_current'=>true));
161
+ }
162
+
163
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  ?>
app/code/local/Ecloud/Andreani/Model/Carrier/Andreani.php CHANGED
@@ -6,9 +6,6 @@
6
  */
7
  ?><?php require_once Mage::getBaseDir('lib') . '/Andreani/wsseAuth.php';
8
  class Ecloud_Andreani_Model_Carrier_Andreani extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
9
-
10
- //Activamos el almacenamiento en búfer de la salida
11
- //ob_start();
12
 
13
  protected $_code = '';
14
  protected $distancia_final_txt = '';
6
  */
7
  ?><?php require_once Mage::getBaseDir('lib') . '/Andreani/wsseAuth.php';
8
  class Ecloud_Andreani_Model_Carrier_Andreani extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
 
 
 
9
 
10
  protected $_code = '';
11
  protected $distancia_final_txt = '';
app/code/local/Ecloud/Andreani/Model/Observer.php CHANGED
@@ -108,6 +108,7 @@ class Ecloud_Andreani_Model_Observer extends Mage_Core_Model_Session_Abstract {
108
  $client = new SoapClient($datos["urlConfirmar"], $options);
109
  $client->__setSoapHeaders(array($wsse_header));
110
 
 
111
  if (strlen($datos["detalle_productos"]) >= 90){
112
  $datos["detalle_productos"] = substr($datos["detalle_productos"],0,80) . "...";
113
  }
108
  $client = new SoapClient($datos["urlConfirmar"], $options);
109
  $client->__setSoapHeaders(array($wsse_header));
110
 
111
+ // Limitamos el detalle de productos a 90 caracteres para que lo tome el WS de Andreani
112
  if (strlen($datos["detalle_productos"]) >= 90){
113
  $datos["detalle_productos"] = substr($datos["detalle_productos"],0,80) . "...";
114
  }
app/code/local/Ecloud/Andreani/controllers/Adminhtml/PedidosController.php CHANGED
@@ -1,186 +1,187 @@
1
- <?php
2
- /**
3
- * @version 0.1.8 04.07.2014
4
- * @author ecloud solutions http://www.ecloudsolutions.com <info@ecloudsolutions.com>
5
- * @copyright Copyright (C) 2010 - 2014 ecloud solutions ®
6
- */
7
- ?><?php require_once Mage::getBaseDir('lib') . '/Andreani/wsseAuth.php';
8
- class Ecloud_Andreani_Adminhtml_PedidosController extends Mage_Adminhtml_Controller_Action
9
- {
10
-
11
- public function indexAction()
12
- {
13
- $this->_title($this->__('Andreani'))->_title($this->__('Estado de pedidos'));
14
- $this->loadLayout();
15
- $this->_setActiveMenu('andreani/andreani');
16
- $this->_addContent($this->getLayout()->createBlock('andreani/adminhtml_pedidos'));
17
- $this->renderLayout();
18
- }
19
-
20
- public function gridAction()
21
- {
22
- $this->loadLayout();
23
- $this->getResponse()->setBody(
24
- $this->getLayout()->createBlock('andreani/adminhtml_andreani_pedidos_grid')->toHtml()
25
- );
26
-
27
- }
28
-
29
- public function exportEcloudCsvAction()
30
- {
31
- $fileName = 'pedidos_andreani.csv';
32
- $grid = $this->getLayout()->createBlock('andreani/adminhtml_andreani_pedidos_grid');
33
- $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
34
- }
35
-
36
- public function exportEcloudExcelAction()
37
- {
38
- $fileName = 'pedidos_andreani.xml';
39
- $grid = $this->getLayout()->createBlock('andreani/adminhtml_andreani_pedidos_grid');
40
- $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
41
- }
42
-
43
- public function massEliminarAction()
44
- {
45
- $ids = $this->getRequest()->getParam('id');
46
- if(!is_array($ids)) {
47
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('andreani')->__('Por favor seleccionar una orden!'));
48
- } else {
49
- try {
50
- foreach ($ids as $id) {
51
- //Mage::getModel('andreani/order')->load($id)->delete();
52
- Mage::getModel('andreani/order')->load($id)->setData("estado","Eliminada")->save();
53
- }
54
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('andreani')->__('Se han eliminado %d registro(s).', count($ids)));
55
- } catch (Exception $e) {
56
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
57
- }
58
- }
59
- $this->_redirect('*/*/index');
60
- }
61
-
62
- public function massEntregadoAction()
63
- {
64
- $ids = $this->getRequest()->getParam('id');
65
-
66
- if(!is_array($ids)) {
67
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('andreani')->__('Por favor seleccionar una orden!'));
68
- } else {
69
- try {
70
- foreach ($ids as $id) {
71
- Mage::getModel('andreani/order')->load($id)->setData("estado","Entregado")->save();
72
- }
73
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('andreani')->__('Se han actualizado %d registro(s).', count($ids)));
74
- } catch (Exception $e) {
75
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
76
- }
77
- }
78
- $this->_redirect('*/*/index');
79
- }
80
-
81
- public function massPendienteAction()
82
- {
83
- $ids = $this->getRequest()->getParam('id');
84
- if(!is_array($ids)) {
85
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('andreani')->__('Por favor seleccionar una orden!'));
86
- } else {
87
- try {
88
- foreach ($ids as $id) {
89
- Mage::getModel('andreani/order')->load($id)->setData("estado","Pendiente")->save();
90
- }
91
- Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('andreani')->__('Se han actualizado %d registro(s).', count($ids)));
92
- } catch (Exception $e) {
93
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
94
- }
95
- }
96
- $this->_redirect('*/*/index');
97
- }
98
-
99
- public function viewAction()
100
- {
101
- $id = (int) $this->getRequest()->getParam('id');
102
-
103
- // 1. Traemos los datos de la tabla "andreani_order" según el OrderId[0] y asignarla a $datos
104
- $collection = Mage::getModel('andreani/order')->getCollection()
105
- ->addFieldToFilter('id', $id);
106
- $collection->getSelect()->limit(1);
107
-
108
- if (!$collection) {
109
- Mage::log("Andreani :: no existe la orden en la tabla andreani_order.");
110
- return;
111
- }
112
- foreach($collection as $thing) {
113
- $datos = $thing->getData();
114
- }
115
-
116
- // 2. Conectarse a eAndreani
117
- if (Mage::getStoreConfig('carriers/andreaniconfig/testmode',Mage::app()->getStore()) == 1) {
118
- $url = 'https://www.e-andreani.com/eAndreaniWSStaging/Service.svc?wsdl';
119
- } else {
120
- $url = "https://www.e-andreani.com/eAndreaniWS/Service.svc?wsdl";
121
- }
122
-
123
- if ( $datos['cod_tracking'] != '' ) {
124
- try {
125
- $options = array(
126
- 'soap_version' => SOAP_1_2,
127
- 'exceptions' => 1,
128
- 'trace' => 1,
129
- 'style' => SOAP_DOCUMENT,
130
- 'encoding' => SOAP_LITERAL,
131
- );
132
-
133
- $optRequest = array();
134
- $optRequest["ObtenerTrazabilidad"] = array(
135
- 'Pieza' => array(
136
- 'NroPieza' => '',
137
- 'NroAndreani' => $datos['cod_tracking'],
138
- 'CodigoCliente' => $datos['cliente']
139
- ));
140
- $client = new SoapClient($url, $options);
141
- $request = $client->__soapCall("ObtenerTrazabilidad", $optRequest);
142
-
143
- $texto = $request->Pieza->NroPieza . "\n";
144
- $texto .= "Nombre del Envio: " . $request->Pieza->Envios->Envio->NombreEnvio . "\n";
145
- $texto .= "Código de tracking: " . $request->Pieza->Envios->Envio->NroAndreani . "\n";
146
- $texto .= "Fecha de alta: " . $request->Pieza->Envios->Envio->FechaAlta . "\n";
147
-
148
-
149
- foreach( $request->Pieza->Envios->Envio->Eventos as $indice => $valor )
150
- {
151
- $texto .= "Eventos: " . "\n\n";
152
- $texto .= "Fecha del evento: " . $valor->Fecha . "\n";
153
- $texto .= "Estado del envio: " . $valor->Estado . "\n";
154
- $texto .= "Motivo: " . $valor->Motivo . "\n";
155
- $texto .= "Sucursal: " . $valor->Sucursal . "\n";
156
- $texto .= "------------------ \n";
157
- }
158
-
159
- Mage::getModel('andreani/order')->load($id)->setData("tracking",$texto)->save();
160
-
161
- } catch (SoapFault $e) {
162
- Mage::log(print_r($e,true));
163
- }
164
- } else {
165
- $texto = "El envío se encuentra pendiente. Diríjase a 'Ventas->Pedidos' para dar comienzo al proceso cuando el mismo se haya realizado";
166
- Mage::getModel('andreani/order')->load($id)->setData("tracking",$texto)->save();
167
- }
168
-
169
- if ($id) {
170
- $order = Mage::getModel('andreani/order')->load($id);
171
- if (!$order || !$order->getId()) {
172
- Mage::getSingleton('adminhtml/session')->addError(Mage::helper('andreani')->__('No se encontró el ID de la orden'));
173
- $this->_redirect('*/*/');
174
- }
175
- }
176
-
177
- Mage::register('order_data', $order);
178
-
179
- $this->loadLayout();
180
- $block = $this->getLayout()->createBlock('andreani/adminhtml_pedidos_edit');
181
- $this->getLayout()->getBlock('content')->append($block);
182
- $this->renderLayout();
183
- }
184
-
185
- }
 
186
  ?>
1
+ <?php
2
+ /**
3
+ * @version 0.1.8 04.07.2014
4
+ * @author ecloud solutions http://www.ecloudsolutions.com <info@ecloudsolutions.com>
5
+ * @copyright Copyright (C) 2010 - 2014 ecloud solutions ®
6
+ */
7
+ ?><?php require_once Mage::getBaseDir('lib') . '/Andreani/wsseAuth.php';
8
+ class Ecloud_Andreani_Adminhtml_PedidosController extends Mage_Adminhtml_Controller_Action
9
+ {
10
+
11
+ public function indexAction()
12
+ {
13
+ $this->_title($this->__('Andreani'))->_title($this->__('Estado de pedidos'));
14
+ $this->loadLayout();
15
+ $this->_setActiveMenu('andreani/andreani');
16
+ $this->_addContent($this->getLayout()->createBlock('andreani/adminhtml_pedidos'));
17
+ $this->renderLayout();
18
+ }
19
+
20
+ public function gridAction()
21
+ {
22
+ $this->_title($this->__('Andreani'))->_title($this->__('Estado de pedidos'));
23
+ $this->loadLayout();
24
+ $this->_setActiveMenu('andreani/andreani');
25
+ $this->getResponse()->setBody(
26
+ $this->getLayout()->createBlock('andreani/adminhtml_pedidos_grid')->toHtml()
27
+ );
28
+ }
29
+
30
+ public function exportEcloudCsvAction()
31
+ {
32
+ $fileName = 'pedidos_andreani.csv';
33
+ $grid = $this->getLayout()->createBlock('andreani/adminhtml_andreani_pedidos_grid');
34
+ $this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
35
+ }
36
+
37
+ public function exportEcloudExcelAction()
38
+ {
39
+ $fileName = 'pedidos_andreani.xml';
40
+ $grid = $this->getLayout()->createBlock('andreani/adminhtml_andreani_pedidos_grid');
41
+ $this->_prepareDownloadResponse($fileName, $grid->getExcelFile($fileName));
42
+ }
43
+
44
+ public function massEliminarAction()
45
+ {
46
+ $ids = $this->getRequest()->getParam('id');
47
+ if(!is_array($ids)) {
48
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('andreani')->__('Por favor seleccionar una orden!'));
49
+ } else {
50
+ try {
51
+ foreach ($ids as $id) {
52
+ //Mage::getModel('andreani/order')->load($id)->delete();
53
+ Mage::getModel('andreani/order')->load($id)->setData("estado","Eliminada")->save();
54
+ }
55
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('andreani')->__('Se han eliminado %d registro(s).', count($ids)));
56
+ } catch (Exception $e) {
57
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
58
+ }
59
+ }
60
+ $this->_redirect('*/*/index');
61
+ }
62
+
63
+ public function massEntregadoAction()
64
+ {
65
+ $ids = $this->getRequest()->getParam('id');
66
+
67
+ if(!is_array($ids)) {
68
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('andreani')->__('Por favor seleccionar una orden!'));
69
+ } else {
70
+ try {
71
+ foreach ($ids as $id) {
72
+ Mage::getModel('andreani/order')->load($id)->setData("estado","Entregado")->save();
73
+ }
74
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('andreani')->__('Se han actualizado %d registro(s).', count($ids)));
75
+ } catch (Exception $e) {
76
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
77
+ }
78
+ }
79
+ $this->_redirect('*/*/index');
80
+ }
81
+
82
+ public function massPendienteAction()
83
+ {
84
+ $ids = $this->getRequest()->getParam('id');
85
+ if(!is_array($ids)) {
86
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('andreani')->__('Por favor seleccionar una orden!'));
87
+ } else {
88
+ try {
89
+ foreach ($ids as $id) {
90
+ Mage::getModel('andreani/order')->load($id)->setData("estado","Pendiente")->save();
91
+ }
92
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('andreani')->__('Se han actualizado %d registro(s).', count($ids)));
93
+ } catch (Exception $e) {
94
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
95
+ }
96
+ }
97
+ $this->_redirect('*/*/index');
98
+ }
99
+
100
+ public function viewAction()
101
+ {
102
+ $id = (int) $this->getRequest()->getParam('id');
103
+
104
+ // 1. Traemos los datos de la tabla "andreani_order" según el OrderId[0] y asignarla a $datos
105
+ $collection = Mage::getModel('andreani/order')->getCollection()
106
+ ->addFieldToFilter('id', $id);
107
+ $collection->getSelect()->limit(1);
108
+
109
+ if (!$collection) {
110
+ Mage::log("Andreani :: no existe la orden en la tabla andreani_order.");
111
+ return;
112
+ }
113
+ foreach($collection as $thing) {
114
+ $datos = $thing->getData();
115
+ }
116
+
117
+ // 2. Conectarse a eAndreani
118
+ if (Mage::getStoreConfig('carriers/andreaniconfig/testmode',Mage::app()->getStore()) == 1) {
119
+ $url = 'https://www.e-andreani.com/eAndreaniWSStaging/Service.svc?wsdl';
120
+ } else {
121
+ $url = "https://www.e-andreani.com/eAndreaniWS/Service.svc?wsdl";
122
+ }
123
+
124
+ if ( $datos['cod_tracking'] != '' ) {
125
+ try {
126
+ $options = array(
127
+ 'soap_version' => SOAP_1_2,
128
+ 'exceptions' => 1,
129
+ 'trace' => 1,
130
+ 'style' => SOAP_DOCUMENT,
131
+ 'encoding' => SOAP_LITERAL,
132
+ );
133
+
134
+ $optRequest = array();
135
+ $optRequest["ObtenerTrazabilidad"] = array(
136
+ 'Pieza' => array(
137
+ 'NroPieza' => '',
138
+ 'NroAndreani' => $datos['cod_tracking'],
139
+ 'CodigoCliente' => $datos['cliente']
140
+ ));
141
+ $client = new SoapClient($url, $options);
142
+ $request = $client->__soapCall("ObtenerTrazabilidad", $optRequest);
143
+
144
+ $texto = $request->Pieza->NroPieza . "\n";
145
+ $texto .= "Nombre del Envio: " . $request->Pieza->Envios->Envio->NombreEnvio . "\n";
146
+ $texto .= "Código de tracking: " . $request->Pieza->Envios->Envio->NroAndreani . "\n";
147
+ $texto .= "Fecha de alta: " . $request->Pieza->Envios->Envio->FechaAlta . "\n";
148
+
149
+
150
+ foreach( $request->Pieza->Envios->Envio->Eventos as $indice => $valor )
151
+ {
152
+ $texto .= "Eventos: " . "\n\n";
153
+ $texto .= "Fecha del evento: " . $valor->Fecha . "\n";
154
+ $texto .= "Estado del envio: " . $valor->Estado . "\n";
155
+ $texto .= "Motivo: " . $valor->Motivo . "\n";
156
+ $texto .= "Sucursal: " . $valor->Sucursal . "\n";
157
+ $texto .= "------------------ \n";
158
+ }
159
+
160
+ Mage::getModel('andreani/order')->load($id)->setData("tracking",$texto)->save();
161
+
162
+ } catch (SoapFault $e) {
163
+ Mage::log(print_r($e,true));
164
+ }
165
+ } else {
166
+ $texto = "El envío se encuentra pendiente. Diríjase a 'Ventas->Pedidos' para dar comienzo al proceso cuando el mismo se haya realizado";
167
+ Mage::getModel('andreani/order')->load($id)->setData("tracking",$texto)->save();
168
+ }
169
+
170
+ if ($id) {
171
+ $order = Mage::getModel('andreani/order')->load($id);
172
+ if (!$order || !$order->getId()) {
173
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('andreani')->__('No se encontró el ID de la orden'));
174
+ $this->_redirect('*/*/');
175
+ }
176
+ }
177
+
178
+ Mage::register('order_data', $order);
179
+
180
+ $this->loadLayout();
181
+ $block = $this->getLayout()->createBlock('andreani/adminhtml_pedidos_edit');
182
+ $this->getLayout()->getBlock('content')->append($block);
183
+ $this->renderLayout();
184
+ }
185
+
186
+ }
187
  ?>
app/code/local/Ecloud/Andreani/etc/adminhtml.xml CHANGED
@@ -1,10 +1,12 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <menu>
4
- <andreani translate="title" module="andreani">
5
- <sort_order>10</sort_order>
6
- <title>Estado de pedidos</title>
7
- <action>adminhtml/pedidos/</action>
8
- </andreani>
9
- </menu>
 
 
10
  </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <sales>
5
+ <andreani translate="title" module="andreani">
6
+ <sort_order>10</sort_order>
7
+ <title>Estado de pedidos</title>
8
+ <action>adminhtml/pedidos/</action>
9
+ </andreani>
10
+ </sales>
11
+ </menu>
12
  </config>
app/code/local/Ecloud/Andreani/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Ecloud_Andreani>
5
- <version>0.1.8</version>
6
  </Ecloud_Andreani>
7
  </modules>
8
  <global>
@@ -114,17 +114,21 @@
114
  </admin>
115
  <adminhtml>
116
  <menu>
117
- <andreani translate="title" module="andreani">
118
- <title>Andreani</title>
119
- <sort_order>91</sort_order>
120
  <children>
121
- <pedidos translate="title">
122
- <title>Estado de Pedidos</title>
123
- <sort_order>20</sort_order>
124
- <action>adminhtml/pedidos/index</action>
125
- </pedidos>
 
 
 
 
 
 
126
  </children>
127
- </andreani>
128
  </menu>
129
  <acl>
130
  <resources>
2
  <config>
3
  <modules>
4
  <Ecloud_Andreani>
5
+ <version>0.1.9</version>
6
  </Ecloud_Andreani>
7
  </modules>
8
  <global>
114
  </admin>
115
  <adminhtml>
116
  <menu>
117
+ <sales>
 
 
118
  <children>
119
+ <andreani translate="title">
120
+ <title>Andreani</title>
121
+ <sort_order>91</sort_order>
122
+ <children>
123
+ <pedidos translate="title">
124
+ <title>Estado de Pedidos</title>
125
+ <sort_order>20</sort_order>
126
+ <action>adminhtml/pedidos/index</action>
127
+ </pedidos>
128
+ </children>
129
+ </andreani>
130
  </children>
131
+ </sales>
132
  </menu>
133
  <acl>
134
  <resources>
app/code/local/Ecloud/Andreani/sql/andreani_setup/mysql4-upgrade-0.1.8-0.1.9.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $setup = $this;
4
+
5
+ $setup->startSetup();
6
+
7
+ $setup->endSetup();
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Andreani</name>
4
- <version>0.1.8</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/gpl-license.php">GNU General Public License (GPL)</license>
7
  <channel>community</channel>
@@ -24,18 +24,17 @@ For Customers:&#xD;
24
  Location and distance y distance to the nearest branch for "Shipments to branch".&#xD;
25
  Express delivery service.&#xD;
26
  Tracking of shipments.</description>
27
- <notes>Release Version 0.1.8&#xD;
28
  &#xD;
29
- Funcionalidades:&#xD;
30
- - Arreglo en valor de volumen&#xD;
31
- - Arreglo en el detalle de productos que se envia al WS (repite los productos)&#xD;
32
- - % de descuento o aumento para servicio (Admin)&#xD;
33
- - Aplicar promociones en el precio cuando se aplican reglas.&#xD;
34
- - Activaci&#xF2;n de cache de sucursales para optimizar llamadas al WS</notes>
35
  <authors><author><name>Gaspar Mac</name><user>ecloudsolutions</user><email>gaspar@ecloudsolutions.com</email></author><author><name>Nicolas Demayo</name><user>nikete</user><email>nicolas.demayo@ecloudsolutions.com</email></author><author><name>Franco Sabolo</name><user>kako_ecloud</user><email>franco.sabolo@ecloudsolutions.com</email></author><author><name>Mariano Botti</name><user>mbotti89</user><email>mariano.botti@ecloudsolutions.com</email></author></authors>
36
- <date>2014-07-14</date>
37
- <time>17:54:19</time>
38
- <contents><target name="magelocal"><dir name="Ecloud"><dir name="Andreani"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><file name="Edit.php" hash="641bba2f29b24b971cf849e132799187"/><dir name="Form"><dir name="Field"><file name="Medida.php" hash="a42816e6aa4e0d8888d292ee35baf5bd"/></dir></dir></dir><dir name="Pedidos"><dir name="Edit"><file name="Form.php" hash="b8e6ec2ef089eb71d1ec262ef832531c"/><dir name="Renderer"><file name="Button.php" hash="be724d8798843b97dfb5a2d9f107abde"/></dir></dir><file name="Edit.php" hash="15055cc1f30b9e173c9ff6f5867e7785"/><file name="Grid.php" hash="04654bf26be359c27c282322296d3e83"/></dir><file name="Pedidos.php" hash="c92fc91f2e1658b0db2d593fe4eb88b7"/></dir><file name="Andreani.php" hash="c25934ba95ab9d308e7dc71314bcec33"/></dir><dir name="Helper"><file name="Data.php" hash="44776b6d6ede13161ed89cb2c57a75bb"/></dir><dir name="Model"><file name="Andreani.php" hash="1c21ed28b766361188e2e88ea9a40827"/><dir name="Carrier"><file name="Andreani.php" hash="57788b074420f2526d4f69c21e1c9db7"/><file name="Andreaniestandar.php" hash="4b437809ac6ab904c5ccd04258536c5b"/><file name="Andreanisucursal.php" hash="dde8b46c16d7df1f87c3b0482d9ba578"/><file name="Andreaniurgente.php" hash="563e3cdc813bc4a5b430433c4b40b03f"/></dir><dir name="Config"><file name="Medida.php" hash="f1f08e98acdf9e31c8c269bb673bfdd4"/><file name="TestMode.php" hash="3f68f671445173f0cbbb5b69a360ff9f"/></dir><file name="Observer.php" hash="85f2e49d97326723c3b14feee39e3396"/><file name="Order.php" hash="69c1469c3de5522810e4dfa6f42164c9"/><dir name="Resource"><dir name="Order"><file name="Collection.php" hash="59fbc843342805a3b8f0ea0f6b8b6504"/></dir><file name="Order.php" hash="4a7d26f63f80bb939873f6032bae1a2a"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Pedidos"><file name="PedidosController.php" hash="462649aad4dc7d05b9f880bfb1c1bdc6"/></dir><file name="PedidosController.php" hash="c1966200d99d9f88cb928dd0a99a9896"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="8f0a993a42b9844f15056ffd0d7b6312"/><file name="config.xml" hash="568e141291de4b88b83824dbfa9e4279"/><file name="system.xml" hash="ec1bf9a3739d671995cea0afb9289725"/></dir><dir name="sql"><dir name="andreani_setup"><file name="mysql4-install-0.1.0.php" hash="23b5ff1bb77faa3394279983279ef508"/><file name="mysql4-install-0.1.1.php" hash="af9c6884b1ef1e106f598e84d5ac97d5"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="19bbe941b87c48a7c976099f26b6df87"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="31485210af28297146e193090d0ae586"/><file name="mysql4-upgrade-0.1.3-0.1.4.php" hash="19bbe941b87c48a7c976099f26b6df87"/><file name="mysql4-upgrade-0.1.4-0.1.5.php" hash="19bbe941b87c48a7c976099f26b6df87"/><file name="mysql4-upgrade-0.1.5-0.1.6.php" hash="2e5071273633e63d487fa573dc2a33d9"/><file name="mysql4-upgrade-0.1.6-0.1.7.php" hash="2e5071273633e63d487fa573dc2a33d9"/><file name="mysql4-upgrade-0.1.7-0.1.8.php" hash="2e5071273633e63d487fa573dc2a33d9"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ecloud_Andreani.xml" hash="fb71162c7850ff07ee057cc012a609ad"/></dir></target><target name="magelib"><dir name="Andreani"><file name="wsseAuth.php" hash="7f7c0dcac241e7422a6bc657638fc5df"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="checkout"><dir name="onepage"><file name="shipping.phtml" hash="dd07d8ad6a22cd9e2553109498057439"/></dir></dir><dir name="customer"><dir name="address"><file name="edit.phtml" hash="c6a693c55bec274da69b12839a5f4ef1"/></dir></dir><dir name="persistent"><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="c4c0a62c21e9e1a6d2b1b872d0f8bdfc"/></dir></dir></dir><dir name="shipping"><dir name="tracking"><file name="popup.phtml" hash="cab9a1b01c732d7553be9b47e1e1b542"/></dir></dir></dir></dir></dir></dir></target></contents>
39
  <compatible/>
40
  <dependencies><required><php><min>5.2.0</min><max>5.4.25</max></php><extension><name>Core</name><min></min><max></max></extension><extension><name>soap</name><min></min><max></max></extension></required></dependencies>
41
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Andreani</name>
4
+ <version>0.1.9</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/gpl-license.php">GNU General Public License (GPL)</license>
7
  <channel>community</channel>
24
  Location and distance y distance to the nearest branch for "Shipments to branch".&#xD;
25
  Express delivery service.&#xD;
26
  Tracking of shipments.</description>
27
+ <notes>Release Version 0.1.9&#xD;
28
  &#xD;
29
+ Fix:&#xD;
30
+ - Arreglo en la paginacion de "estado de pedidos".&#xD;
31
+ &#xD;
32
+ - Cambio en la ubicaci&#xF2;n del men&#xF9; a:&#xD;
33
+ Ventas-&gt;Andreani</notes>
 
34
  <authors><author><name>Gaspar Mac</name><user>ecloudsolutions</user><email>gaspar@ecloudsolutions.com</email></author><author><name>Nicolas Demayo</name><user>nikete</user><email>nicolas.demayo@ecloudsolutions.com</email></author><author><name>Franco Sabolo</name><user>kako_ecloud</user><email>franco.sabolo@ecloudsolutions.com</email></author><author><name>Mariano Botti</name><user>mbotti89</user><email>mariano.botti@ecloudsolutions.com</email></author></authors>
35
+ <date>2014-07-23</date>
36
+ <time>16:15:10</time>
37
+ <contents><target name="magelocal"><dir name="Ecloud"><dir name="Andreani"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><file name="Edit.php" hash="641bba2f29b24b971cf849e132799187"/><dir name="Form"><dir name="Field"><file name="Medida.php" hash="a42816e6aa4e0d8888d292ee35baf5bd"/></dir></dir></dir><dir name="Pedidos"><dir name="Edit"><file name="Form.php" hash="b8e6ec2ef089eb71d1ec262ef832531c"/><dir name="Renderer"><file name="Button.php" hash="be724d8798843b97dfb5a2d9f107abde"/></dir></dir><file name="Edit.php" hash="15055cc1f30b9e173c9ff6f5867e7785"/><file name="Grid.php" hash="4ed8da91e1f38f86d232c8f0b95f19c3"/></dir><file name="Pedidos.php" hash="c92fc91f2e1658b0db2d593fe4eb88b7"/></dir><file name="Andreani.php" hash="c25934ba95ab9d308e7dc71314bcec33"/></dir><dir name="Helper"><file name="Data.php" hash="44776b6d6ede13161ed89cb2c57a75bb"/></dir><dir name="Model"><file name="Andreani.php" hash="1c21ed28b766361188e2e88ea9a40827"/><dir name="Carrier"><file name="Andreani.php" hash="c121c40f4b5e34e998be4898cf5a1af9"/><file name="Andreaniestandar.php" hash="4b437809ac6ab904c5ccd04258536c5b"/><file name="Andreanisucursal.php" hash="dde8b46c16d7df1f87c3b0482d9ba578"/><file name="Andreaniurgente.php" hash="563e3cdc813bc4a5b430433c4b40b03f"/></dir><dir name="Config"><file name="Medida.php" hash="f1f08e98acdf9e31c8c269bb673bfdd4"/><file name="TestMode.php" hash="3f68f671445173f0cbbb5b69a360ff9f"/></dir><file name="Observer.php" hash="4f0a71a6dd3ece1e0ba9147543996f6c"/><file name="Order.php" hash="69c1469c3de5522810e4dfa6f42164c9"/><dir name="Resource"><dir name="Order"><file name="Collection.php" hash="59fbc843342805a3b8f0ea0f6b8b6504"/></dir><file name="Order.php" hash="4a7d26f63f80bb939873f6032bae1a2a"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Pedidos"><file name="PedidosController.php" hash="462649aad4dc7d05b9f880bfb1c1bdc6"/></dir><file name="PedidosController.php" hash="725ea09dc3c48d2e66276785234580f4"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="572688a74a8eb634953c6bf59d2635f2"/><file name="config.xml" hash="9a90e92f8df23abd4b49ce0f23f44afe"/><file name="system.xml" hash="ec1bf9a3739d671995cea0afb9289725"/></dir><dir name="sql"><dir name="andreani_setup"><file name="mysql4-install-0.1.0.php" hash="23b5ff1bb77faa3394279983279ef508"/><file name="mysql4-install-0.1.1.php" hash="af9c6884b1ef1e106f598e84d5ac97d5"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="19bbe941b87c48a7c976099f26b6df87"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="31485210af28297146e193090d0ae586"/><file name="mysql4-upgrade-0.1.3-0.1.4.php" hash="19bbe941b87c48a7c976099f26b6df87"/><file name="mysql4-upgrade-0.1.4-0.1.5.php" hash="19bbe941b87c48a7c976099f26b6df87"/><file name="mysql4-upgrade-0.1.5-0.1.6.php" hash="2e5071273633e63d487fa573dc2a33d9"/><file name="mysql4-upgrade-0.1.6-0.1.7.php" hash="2e5071273633e63d487fa573dc2a33d9"/><file name="mysql4-upgrade-0.1.7-0.1.8.php" hash="2e5071273633e63d487fa573dc2a33d9"/><file name="mysql4-upgrade-0.1.8-0.1.9.php" hash="2e5071273633e63d487fa573dc2a33d9"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ecloud_Andreani.xml" hash="fb71162c7850ff07ee057cc012a609ad"/></dir></target><target name="magelib"><dir name="Andreani"><file name="wsseAuth.php" hash="7f7c0dcac241e7422a6bc657638fc5df"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="checkout"><dir name="onepage"><file name="shipping.phtml" hash="dd07d8ad6a22cd9e2553109498057439"/></dir></dir><dir name="customer"><dir name="address"><file name="edit.phtml" hash="c6a693c55bec274da69b12839a5f4ef1"/></dir></dir><dir name="persistent"><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="c4c0a62c21e9e1a6d2b1b872d0f8bdfc"/></dir></dir></dir><dir name="shipping"><dir name="tracking"><file name="popup.phtml" hash="cab9a1b01c732d7553be9b47e1e1b542"/></dir></dir></dir></dir></dir></dir></target></contents>
38
  <compatible/>
39
  <dependencies><required><php><min>5.2.0</min><max>5.4.25</max></php><extension><name>Core</name><min></min><max></max></extension><extension><name>soap</name><min></min><max></max></extension></required></dependencies>
40
  </package>