Version Notes
The first stable version for urgent cargus AWB.
Download this release
Release Info
Developer | EaDesign |
Extension | Eadesigndev_Awb |
Version | 1.0.7 |
Comparing to | |
See all releases |
Version 1.0.7
- app/code/local/Eadesigndev/Awb/Block/Adminhtml/Block/System/Update.php +26 -0
- app/code/local/Eadesigndev/Awb/Block/Adminhtml/Template/Awb.php +41 -0
- app/code/local/Eadesigndev/Awb/Block/Adminhtml/Template/Awb/Edit.php +221 -0
- app/code/local/Eadesigndev/Awb/Block/Adminhtml/Template/Awb/Edit/Tabs.php +43 -0
- app/code/local/Eadesigndev/Awb/Block/Adminhtml/Template/Awb/Edit/Tabs/Curier.php +183 -0
- app/code/local/Eadesigndev/Awb/Block/Adminhtml/Template/Awb/Edit/Tabs/General.php +140 -0
- app/code/local/Eadesigndev/Awb/Block/Adminhtml/Template/Awb/Grid.php +166 -0
- app/code/local/Eadesigndev/Awb/Helper/City.php +44 -0
- app/code/local/Eadesigndev/Awb/Helper/Data.php +201 -0
- app/code/local/Eadesigndev/Awb/Helper/Update.php +125 -0
- app/code/local/Eadesigndev/Awb/Helper/Urgent.php +247 -0
- app/code/local/Eadesigndev/Awb/Model/Awb.php +31 -0
- app/code/local/Eadesigndev/Awb/Model/Awbcity.php +16 -0
- app/code/local/Eadesigndev/Awb/Model/Eacore/Feed.php +123 -0
- app/code/local/Eadesigndev/Awb/Model/Eacore/Observer.php +13 -0
- app/code/local/Eadesigndev/Awb/Model/Mysql4/Awb.php +24 -0
- app/code/local/Eadesigndev/Awb/Model/Mysql4/Awb/Collection.php +22 -0
- app/code/local/Eadesigndev/Awb/Model/Mysql4/Awbcity.php +24 -0
- app/code/local/Eadesigndev/Awb/Model/Mysql4/Awbcity/Collection.php +22 -0
- app/code/local/Eadesigndev/Awb/Model/Observer.php +33 -0
- app/code/local/Eadesigndev/Awb/Model/System/Abstract.php +23 -0
- app/code/local/Eadesigndev/Awb/Model/System/Pachet.php +12 -0
- app/code/local/Eadesigndev/Awb/Model/System/Plantarifar.php +16 -0
- app/code/local/Eadesigndev/Awb/Model/System/Platatransport.php +13 -0
- app/code/local/Eadesigndev/Awb/Model/System/Punctridicare.php +18 -0
- app/code/local/Eadesigndev/Awb/Model/System/Tarifeafisate.php +13 -0
- app/code/local/Eadesigndev/Awb/controllers/Adminhtml/IndexController.php +384 -0
- app/code/local/Eadesigndev/Awb/etc/adminhtml.xml +48 -0
- app/code/local/Eadesigndev/Awb/etc/config.xml +119 -0
- app/code/local/Eadesigndev/Awb/etc/system.xml +142 -0
- app/code/local/Eadesigndev/Awb/sql/eadsign_awb_setup/mysql4-install-1.0.1.php +53 -0
- app/code/local/Eadesigndev/Awb/sql/eadsign_awb_setup/mysql4-upgrade-1.0.1-1.0.3.php +19 -0
- app/code/local/Eadesigndev/Awb/sql/eadsign_awb_setup/mysql4-upgrade-1.0.3-1.0.4.php +11 -0
- app/code/local/Eadesigndev/Awb/sql/eadsign_awb_setup/mysql4-upgrade-1.0.4-1.0.5.php +11 -0
- app/code/local/Eadesigndev/Awb/sql/eadsign_awb_setup/mysql4-upgrade-1.0.5-1.0.6.php +11 -0
- app/code/local/Eadesigndev/Awb/sql/eadsign_awb_setup/mysql4-upgrade-1.0.6-1.0.7.php +16 -0
- app/design/adminhtml/default/default/template/eadesigndev/awb/edit/edit.phtml +209 -0
- app/design/adminhtml/default/default/template/eadesigndev/awb/list.phtml +40 -0
- app/etc/modules/Eadesigndev_Awb.xml +9 -0
- package.xml +18 -0
app/code/local/Eadesigndev/Awb/Block/Adminhtml/Block/System/Update.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eadesigndev_Awb_Block_Adminhtml_Block_System_Update extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
$helper = Mage::helper('awb/urgent');
|
8 |
+
$isConnected = $helper->isConnected();
|
9 |
+
|
10 |
+
if (!$isConnected) {
|
11 |
+
return;
|
12 |
+
}
|
13 |
+
|
14 |
+
$this->setElement($element);
|
15 |
+
$url = Mage::helper('adminhtml')->getUrl('awbadmin/adminhtml_index/update');
|
16 |
+
|
17 |
+
$html = $this->getLayout()->createBlock('adminhtml/widget_button')
|
18 |
+
->setType('button')
|
19 |
+
->setClass('scalable')
|
20 |
+
->setLabel('Update lista orase!')
|
21 |
+
->setOnClick("setLocation('$url')")
|
22 |
+
->toHtml();
|
23 |
+
|
24 |
+
return $html;
|
25 |
+
}
|
26 |
+
}
|
app/code/local/Eadesigndev/Awb/Block/Adminhtml/Template/Awb.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Description of Template
|
5 |
+
*
|
6 |
+
* @author Ea Design
|
7 |
+
*/
|
8 |
+
class Eadesigndev_Awb_Block_Adminhtml_Template_Awb extends Mage_Adminhtml_Block_Template
|
9 |
+
{
|
10 |
+
/*
|
11 |
+
* Set the default grid view template
|
12 |
+
*/
|
13 |
+
|
14 |
+
protected function _construct()
|
15 |
+
{
|
16 |
+
parent::_construct();
|
17 |
+
$this->setTemplate('eadesigndev/awb/list.phtml');
|
18 |
+
}
|
19 |
+
|
20 |
+
/*
|
21 |
+
* Create blocks for grid and buttons and other stuff we need
|
22 |
+
*/
|
23 |
+
|
24 |
+
protected function _prepareLayout()
|
25 |
+
{
|
26 |
+
$this->setChild('grid', $this->getLayout()->createBlock('awb/adminhtml_template_awb_grid', 'pdf.grid.template'));
|
27 |
+
return parent::_prepareLayout();
|
28 |
+
}
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
/*
|
33 |
+
* Add the header text using the helper
|
34 |
+
*/
|
35 |
+
|
36 |
+
public function getHeaderText()
|
37 |
+
{
|
38 |
+
return Mage::helper('awb')->__('AWB Ne validate');
|
39 |
+
}
|
40 |
+
|
41 |
+
}
|
app/code/local/Eadesigndev/Awb/Block/Adminhtml/Template/Awb/Edit.php
ADDED
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Description of Edit
|
5 |
+
*
|
6 |
+
* @author Ea Design
|
7 |
+
*/
|
8 |
+
class Eadesigndev_Awb_Block_Adminhtml_Template_Awb_Edit extends Mage_Adminhtml_Block_Widget
|
9 |
+
{
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Initialize
|
13 |
+
*/
|
14 |
+
protected function _construct()
|
15 |
+
{
|
16 |
+
$this->setTemplate('eadesigndev/awb/edit/edit.phtml');
|
17 |
+
parent::_construct();
|
18 |
+
}
|
19 |
+
|
20 |
+
protected function getCurrentModel()
|
21 |
+
{
|
22 |
+
$model = mage::registry('awb_template');
|
23 |
+
if ($model) {
|
24 |
+
return $model;
|
25 |
+
}
|
26 |
+
return false;
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Preparing the layout
|
31 |
+
*/
|
32 |
+
protected function _prepareLayout()
|
33 |
+
{
|
34 |
+
$disable = false;
|
35 |
+
if ($this->getCurrentModel()->getData('status')) {
|
36 |
+
$disable = true;
|
37 |
+
}
|
38 |
+
|
39 |
+
$this->setChild('back_button', $this->getLayout()->createBlock('adminhtml/widget_button')
|
40 |
+
->setData(
|
41 |
+
array(
|
42 |
+
'label' => Mage::helper('awb')->__('Back'),
|
43 |
+
'onclick' => "window.location.href = '" . $this->getUrl('*/*') . "'",
|
44 |
+
'class' => 'back',
|
45 |
+
)
|
46 |
+
)
|
47 |
+
);
|
48 |
+
|
49 |
+
$this->setChild('reset_button', $this->getLayout()->createBlock('adminhtml/widget_button')
|
50 |
+
->setData(
|
51 |
+
array(
|
52 |
+
'label' => Mage::helper('awb')->__('Reset'),
|
53 |
+
'onclick' => 'window.location.href = window.location.href',
|
54 |
+
'disabled' => $disable
|
55 |
+
)
|
56 |
+
)
|
57 |
+
);
|
58 |
+
|
59 |
+
$this->setChild('approve_button', $this->getLayout()->createBlock('adminhtml/widget_button')
|
60 |
+
->setData(
|
61 |
+
array(
|
62 |
+
'label' => Mage::helper('awb')->__('Aproba AWB'),
|
63 |
+
'onclick' => 'templateControl.approveTemplate();',
|
64 |
+
'class' => 'save',
|
65 |
+
'disabled' => $disable
|
66 |
+
)
|
67 |
+
)
|
68 |
+
);
|
69 |
+
|
70 |
+
$this->setChild('save_button', $this->getLayout()->createBlock('adminhtml/widget_button')
|
71 |
+
->setData(
|
72 |
+
array(
|
73 |
+
'label' => Mage::helper('awb')->__('Salveaza AWB'),
|
74 |
+
'onclick' => 'templateControl.save();',
|
75 |
+
'class' => 'save',
|
76 |
+
'disabled' => $disable
|
77 |
+
)
|
78 |
+
)
|
79 |
+
);
|
80 |
+
$this->setChild('save_button_continue', $this->getLayout()->createBlock('adminhtml/widget_button')
|
81 |
+
->setData(
|
82 |
+
array(
|
83 |
+
'label' => Mage::helper('adminhtml')->__('Save and Continue Edit'),
|
84 |
+
'onclick' => 'templateControl.saveandcontinue();',
|
85 |
+
'class' => 'save',
|
86 |
+
'disabled' => $disable
|
87 |
+
)
|
88 |
+
)
|
89 |
+
);
|
90 |
+
|
91 |
+
return parent::_prepareLayout();
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Back button return to the etension root
|
96 |
+
*/
|
97 |
+
public function getBackButtonHtml()
|
98 |
+
{
|
99 |
+
return $this->getChildHtml('back_button');
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Reset template - will rest all fields
|
104 |
+
*/
|
105 |
+
public function getResetButtonHtml()
|
106 |
+
{
|
107 |
+
return $this->getChildHtml('reset_button');
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Save current template button
|
112 |
+
*/
|
113 |
+
public function getSaveButtonHtml()
|
114 |
+
{
|
115 |
+
return $this->getChildHtml('save_button');
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Save current template button
|
120 |
+
*/
|
121 |
+
public function getSaveContinueButtonHtml()
|
122 |
+
{
|
123 |
+
return $this->getChildHtml('save_button_continue');
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Not sure we will use this one
|
128 |
+
*/
|
129 |
+
public function getPreviewButtonHtml()
|
130 |
+
{
|
131 |
+
return $this->getChildHtml('preview_button');
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Detele button
|
136 |
+
*/
|
137 |
+
public function getApproveButtonHtml()
|
138 |
+
{
|
139 |
+
return $this->getChildHtml('approve_button');
|
140 |
+
}
|
141 |
+
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Return header text for form
|
145 |
+
*
|
146 |
+
* @return string
|
147 |
+
*/
|
148 |
+
public function getHeaderText()
|
149 |
+
{
|
150 |
+
return Mage::helper('awb')->__('Edit AWB');
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Return form block HTML
|
155 |
+
*
|
156 |
+
* @return string
|
157 |
+
*/
|
158 |
+
public function getFormHtml()
|
159 |
+
{
|
160 |
+
return $this->getChildHtml('form');
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Return action url for form
|
165 |
+
*
|
166 |
+
* @return string
|
167 |
+
*/
|
168 |
+
public function getSaveUrl()
|
169 |
+
{
|
170 |
+
return $this->getUrl('*/*/save', array('_current' => true));
|
171 |
+
}
|
172 |
+
|
173 |
+
public function getSaveAndContinueUrl()
|
174 |
+
{
|
175 |
+
return $this->getUrl('*/*/save', array(
|
176 |
+
'_current' => true,
|
177 |
+
'back' => 'edit',
|
178 |
+
));
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Return preview action url for form
|
183 |
+
*
|
184 |
+
* @return string
|
185 |
+
*/
|
186 |
+
public function getPreviewUrl()
|
187 |
+
{
|
188 |
+
return $this->getUrl('*/*/preview');
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Return delete url for customer group
|
193 |
+
*
|
194 |
+
* @return string
|
195 |
+
*/
|
196 |
+
public function getDeleteUrl()
|
197 |
+
{
|
198 |
+
return $this->getUrl('*/*/delete', array('_current' => true));
|
199 |
+
}
|
200 |
+
|
201 |
+
public function getApproveUrl()
|
202 |
+
{
|
203 |
+
return $this->getUrl('*/*/save',
|
204 |
+
array('_current' => true,
|
205 |
+
'approve' => 'edit',
|
206 |
+
'back' => 'edit'
|
207 |
+
)
|
208 |
+
);
|
209 |
+
}
|
210 |
+
|
211 |
+
public function getLocaleOptions()
|
212 |
+
{
|
213 |
+
return Mage::app()->getLocale()->getOptionLocales();
|
214 |
+
}
|
215 |
+
|
216 |
+
public function getCurrentLocale()
|
217 |
+
{
|
218 |
+
return Mage::app()->getLocale()->getLocaleCode();
|
219 |
+
}
|
220 |
+
|
221 |
+
}
|
app/code/local/Eadesigndev/Awb/Block/Adminhtml/Template/Awb/Edit/Tabs.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Description of Tabs
|
5 |
+
*
|
6 |
+
* @author Ea Design
|
7 |
+
*/
|
8 |
+
class Eadesigndev_Awb_Block_Adminhtml_Template_Awb_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
9 |
+
{
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Initializa the tab system
|
13 |
+
*/
|
14 |
+
public function _construct()
|
15 |
+
{
|
16 |
+
parent::_construct();
|
17 |
+
$this->setId('awb_tabs');
|
18 |
+
$this->setDestElementId('awb_template_new_form');
|
19 |
+
$this->setTitle(Mage::helper('awb')->__('Date AWB'));
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Generate the teab system to send tot he template.
|
24 |
+
*/
|
25 |
+
public function _beforeToHtml()
|
26 |
+
{
|
27 |
+
$this->addTab('general_section', array(
|
28 |
+
'label' => Mage::helper('awb')->__('Adresa'),
|
29 |
+
'title' => Mage::helper('awb')->__('Date AWB'),
|
30 |
+
'content' => $this->getLayout()->createBlock('awb/adminhtml_template_awb_edit_tabs_general')->toHtml(),
|
31 |
+
));
|
32 |
+
|
33 |
+
$this->addTab('main_section', array(
|
34 |
+
'label' => Mage::helper('awb')->__('Curier'),
|
35 |
+
'title' => Mage::helper('awb')->__('Curier'),
|
36 |
+
'content' => $this->getLayout()->createBlock('awb/adminhtml_template_awb_edit_tabs_curier')->toHtml(),
|
37 |
+
));
|
38 |
+
|
39 |
+
return parent::_beforeToHtml();
|
40 |
+
}
|
41 |
+
|
42 |
+
}
|
43 |
+
|
app/code/local/Eadesigndev/Awb/Block/Adminhtml/Template/Awb/Edit/Tabs/Curier.php
ADDED
@@ -0,0 +1,183 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Description of General
|
5 |
+
*
|
6 |
+
* @author Ea Design
|
7 |
+
*/
|
8 |
+
class Eadesigndev_Awb_Block_Adminhtml_Template_Awb_Edit_Tabs_Curier extends Mage_Adminhtml_Block_Widget_Form
|
9 |
+
{
|
10 |
+
|
11 |
+
const LADESTINATIE = 1;
|
12 |
+
const LAEXPEDITOR = 2;
|
13 |
+
|
14 |
+
private $isUrgent = false;
|
15 |
+
|
16 |
+
public function __construct()
|
17 |
+
{
|
18 |
+
parent::__construct();
|
19 |
+
$this->setId('general_tabs');
|
20 |
+
$this->setDestElementId('form');
|
21 |
+
$this->setTitle(Mage::helper('awb')->__('Item Information'));
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Add fields to form and create template info form
|
26 |
+
*
|
27 |
+
* @return Mage_Adminhtml_Block_Widget_Form
|
28 |
+
*/
|
29 |
+
protected function _prepareForm()
|
30 |
+
{
|
31 |
+
$model = Mage::registry('awb_template');
|
32 |
+
$form = new Varien_Data_Form();
|
33 |
+
|
34 |
+
|
35 |
+
if ($model->getData('carrier_id') == Eadesigndev_Awb_Model_Awb::CARRIERURGENT) {
|
36 |
+
$this->isUrgent = true;
|
37 |
+
}
|
38 |
+
|
39 |
+
|
40 |
+
$fieldset = $form->addFieldset('general1_fieldset', array(
|
41 |
+
'legend' => Mage::helper('awb')->__('Template Information'),
|
42 |
+
'class' => 'fieldset'
|
43 |
+
));
|
44 |
+
|
45 |
+
|
46 |
+
$fieldset->addField('carrier_id', 'select', array(
|
47 |
+
'label' => Mage::helper('awb')->__('Curier'),
|
48 |
+
'title' => Mage::helper('awb')->__('Curier'),
|
49 |
+
'name' => 'carrier_id',
|
50 |
+
'options' => array(
|
51 |
+
Eadesigndev_Awb_Model_Awb::CARRIERURGENT => 'Urgent Curier',
|
52 |
+
),
|
53 |
+
'required' => true,
|
54 |
+
'required' => true,
|
55 |
+
'readonly' => true,
|
56 |
+
'class' => 'disabled',
|
57 |
+
'disabled' => true,
|
58 |
+
'permission' => 'readonly',
|
59 |
+
));
|
60 |
+
|
61 |
+
$fieldset->addField('tip_seviciu', 'select', array(
|
62 |
+
'label' => Mage::helper('awb')->__('Metoda plata'),
|
63 |
+
'title' => Mage::helper('awb')->__('Metoda plata'),
|
64 |
+
'name' => 'tip_seviciu',
|
65 |
+
'options' => Mage::helper('awb')->serviciiAsOtionArray(),
|
66 |
+
'required' => true,
|
67 |
+
));
|
68 |
+
|
69 |
+
|
70 |
+
if ($this->isUrgent) {
|
71 |
+
|
72 |
+
$planTarifar[''] = Mage::helper('awb')->__('Selecteaza');
|
73 |
+
$planTarifar = Mage::helper('awb/urgent')->getPricePlans();
|
74 |
+
|
75 |
+
$fieldset->addField('plan_tarifar', 'select', array(
|
76 |
+
'label' => Mage::helper('awb')->__('Plan tarifar'),
|
77 |
+
'title' => Mage::helper('awb')->__('Plan tarifar'),
|
78 |
+
'name' => 'plan_tarifar',
|
79 |
+
'options' => $planTarifar,
|
80 |
+
'required' => true,
|
81 |
+
));
|
82 |
+
$punctRidicare1 = array(''=>Mage::helper('awb')->__('Selecteaza'));
|
83 |
+
$punctRidicare = $punctRidicare1+Mage::helper('awb/urgent')->getPunctToOptonArray();
|
84 |
+
|
85 |
+
}
|
86 |
+
|
87 |
+
$fieldset->addField('awb_pickup_id', 'select', array(
|
88 |
+
'label' => Mage::helper('awb')->__('Punct de ridicare'),
|
89 |
+
'title' => Mage::helper('awb')->__('Punct de ridicare'),
|
90 |
+
'name' => 'awb_pickup_id',
|
91 |
+
'options' => $punctRidicare,
|
92 |
+
'required' => true,
|
93 |
+
));
|
94 |
+
|
95 |
+
$fieldset->addField('plata_expeditie', 'select', array(
|
96 |
+
'label' => Mage::helper('awb')->__('Plata expeditie'),
|
97 |
+
'title' => Mage::helper('awb')->__('Plata expeditie'),
|
98 |
+
'name' => 'plata_expeditie',
|
99 |
+
'options' => array(
|
100 |
+
'' => Mage::helper('awb')->__('Selecteaza'),
|
101 |
+
self::LADESTINATIE => 'Destinatar',
|
102 |
+
self::LAEXPEDITOR => 'Expeditor',
|
103 |
+
),
|
104 |
+
'required' => true,
|
105 |
+
));
|
106 |
+
|
107 |
+
$fieldset->addField('greutate', 'text', array(
|
108 |
+
'name' => 'greutate',
|
109 |
+
'label' => Mage::helper('awb')->__('Greutate'),
|
110 |
+
'required' => true,
|
111 |
+
));
|
112 |
+
|
113 |
+
$fieldset->addField('colete', 'text', array(
|
114 |
+
'name' => 'colete',
|
115 |
+
'label' => Mage::helper('awb')->__('Colete'),
|
116 |
+
'required' => false,
|
117 |
+
));
|
118 |
+
|
119 |
+
$fieldset->addField('plicuri', 'text', array(
|
120 |
+
'name' => 'plicuri',
|
121 |
+
'label' => Mage::helper('awb')->__('Plicuri'),
|
122 |
+
'required' => false,
|
123 |
+
));
|
124 |
+
|
125 |
+
$fieldset->addField('valuare_comanda', 'text', array(
|
126 |
+
'name' => 'valuare_comanda',
|
127 |
+
'label' => Mage::helper('awb')->__('Valoare asigurare comanda'),
|
128 |
+
'required' => true,
|
129 |
+
));
|
130 |
+
|
131 |
+
$fieldset->addField('ramburs_cont_colector', 'text', array(
|
132 |
+
'name' => 'ramburs_cont_colector',
|
133 |
+
'label' => Mage::helper('awb')->__('Valoare ramburs'),
|
134 |
+
'required' => true,
|
135 |
+
));
|
136 |
+
|
137 |
+
$fieldset->addField('continut', 'textarea', array(
|
138 |
+
'name' => 'continut',
|
139 |
+
'label' => Mage::helper('awb')->__('Continut'),
|
140 |
+
'required' => false,
|
141 |
+
));
|
142 |
+
|
143 |
+
$fieldset->addField('livrare_sambata', 'select', array(
|
144 |
+
'label' => Mage::helper('awb')->__('Livrare sambata'),
|
145 |
+
'title' => Mage::helper('awb')->__('Livrare sambata'),
|
146 |
+
'name' => 'livrare_sambata',
|
147 |
+
'options' => array(
|
148 |
+
'' => Mage::helper('awb')->__('Selecteaza'),
|
149 |
+
0 => 'Nu',
|
150 |
+
1 => 'Da',
|
151 |
+
),
|
152 |
+
'required' => true,
|
153 |
+
));
|
154 |
+
|
155 |
+
|
156 |
+
$fieldset->addField('deschidere_colet', 'select', array(
|
157 |
+
'label' => Mage::helper('awb')->__('Deschidere colet'),
|
158 |
+
'title' => Mage::helper('awb')->__('Deschidere colet'),
|
159 |
+
'name' => 'deschidere_colet',
|
160 |
+
'options' => array(
|
161 |
+
'' => Mage::helper('awb')->__('Selecteaza'),
|
162 |
+
0 => 'Nu',
|
163 |
+
1 => 'Da',
|
164 |
+
),
|
165 |
+
'required' => true,
|
166 |
+
));
|
167 |
+
|
168 |
+
$fieldset->addField('comentarii', 'textarea', array(
|
169 |
+
'name' => 'comentarii',
|
170 |
+
'label' => Mage::helper('awb')->__('Comentarii'),
|
171 |
+
'required' => false,
|
172 |
+
));
|
173 |
+
|
174 |
+
|
175 |
+
|
176 |
+
$form->setValues($model->getData());
|
177 |
+
$this->setForm($form);
|
178 |
+
|
179 |
+
return parent::_prepareForm();
|
180 |
+
}
|
181 |
+
|
182 |
+
|
183 |
+
}
|
app/code/local/Eadesigndev/Awb/Block/Adminhtml/Template/Awb/Edit/Tabs/General.php
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Description of General
|
5 |
+
*
|
6 |
+
* @author Ea Design
|
7 |
+
*/
|
8 |
+
class Eadesigndev_Awb_Block_Adminhtml_Template_Awb_Edit_Tabs_General extends Mage_Adminhtml_Block_Widget_Form
|
9 |
+
{
|
10 |
+
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
parent::__construct();
|
14 |
+
$this->setId('general_tabs');
|
15 |
+
$this->setDestElementId('form');
|
16 |
+
$this->setTitle(Mage::helper('awb')->__('Item Information'));
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Add fields to form and create template info form
|
21 |
+
*
|
22 |
+
* @return Mage_Adminhtml_Block_Widget_Form
|
23 |
+
*/
|
24 |
+
protected function _prepareForm()
|
25 |
+
{
|
26 |
+
$model = Mage::registry('awb_template');
|
27 |
+
$form = new Varien_Data_Form();
|
28 |
+
|
29 |
+
|
30 |
+
$fieldset = $form->addFieldset('general_fieldset', array(
|
31 |
+
'legend' => Mage::helper('awb')->__('Template Information'),
|
32 |
+
'class' => 'fieldset'
|
33 |
+
));
|
34 |
+
|
35 |
+
if($model->getData('company')){
|
36 |
+
$fieldset->addField('company', 'text', array(
|
37 |
+
'name' => 'company',
|
38 |
+
'label' => Mage::helper('awb')->__('Company'),
|
39 |
+
'required' => false,
|
40 |
+
));
|
41 |
+
}
|
42 |
+
|
43 |
+
$fieldset->addField('destinatar', 'text', array(
|
44 |
+
'name' => 'destinatar',
|
45 |
+
'label' => Mage::helper('awb')->__('Destinatar'),
|
46 |
+
'required' => true,
|
47 |
+
));
|
48 |
+
|
49 |
+
if ($model->getId()) {
|
50 |
+
$fieldset->addField('awb_id', 'hidden', array(
|
51 |
+
'name' => 'awb_id',
|
52 |
+
));
|
53 |
+
}
|
54 |
+
if ($model->getData('order_id')) {
|
55 |
+
$fieldset->addField('order_id', 'hidden', array(
|
56 |
+
'name' => 'order_id',
|
57 |
+
));
|
58 |
+
}
|
59 |
+
|
60 |
+
$judetOptionArray = Mage::helper('awb')->getRegionByCountry('RO');
|
61 |
+
|
62 |
+
if (is_array($judetOptionArray)) {
|
63 |
+
$fieldset->addField('region_id', 'select', array(
|
64 |
+
'label' => Mage::helper('awb')->__('Judet'),
|
65 |
+
'title' => Mage::helper('awb')->__('Judet'),
|
66 |
+
'name' => 'region_id',
|
67 |
+
'options' => $judetOptionArray,
|
68 |
+
'value' => 0,
|
69 |
+
'required' => true,
|
70 |
+
));
|
71 |
+
} else {
|
72 |
+
$fieldset->addField('region_id', 'text', array(
|
73 |
+
'label' => Mage::helper('awb')->__('Judet'),
|
74 |
+
'title' => Mage::helper('awb')->__('Judet'),
|
75 |
+
'name' => 'region_id',
|
76 |
+
'required' => true,
|
77 |
+
));
|
78 |
+
}
|
79 |
+
|
80 |
+
$orasOtionsArray = Mage::helper('awb')->getCitiesByRegion('RO',$model->getData('region_id'));
|
81 |
+
|
82 |
+
if (is_array($orasOtionsArray)) {
|
83 |
+
$fieldset->addField('city', 'select', array(
|
84 |
+
'label' => Mage::helper('awb')->__('Localitate'),
|
85 |
+
'title' => Mage::helper('awb')->__('Localitate'),
|
86 |
+
'name' => 'city',
|
87 |
+
'options' => $orasOtionsArray,
|
88 |
+
'value' => 0,
|
89 |
+
'required' => true,
|
90 |
+
));
|
91 |
+
} else {
|
92 |
+
$fieldset->addField('city', 'text', array(
|
93 |
+
'label' => Mage::helper('awb')->__('Localitate'),
|
94 |
+
'title' => Mage::helper('awb')->__('Localitate'),
|
95 |
+
'name' => 'city',
|
96 |
+
'required' => true,
|
97 |
+
));
|
98 |
+
}
|
99 |
+
|
100 |
+
$fieldset->addField('street', 'text', array(
|
101 |
+
'label' => Mage::helper('awb')->__('Strada'),
|
102 |
+
'title' => Mage::helper('awb')->__('Strada'),
|
103 |
+
'name' => 'street',
|
104 |
+
'required' => true,
|
105 |
+
));
|
106 |
+
|
107 |
+
$fieldset->addField('telephone', 'text', array(
|
108 |
+
'label' => Mage::helper('awb')->__('Telefon'),
|
109 |
+
'title' => Mage::helper('awb')->__('Telefon'),
|
110 |
+
'name' => 'telephone',
|
111 |
+
'required' => true,
|
112 |
+
));
|
113 |
+
|
114 |
+
$fieldset->addField('customer_email', 'text', array(
|
115 |
+
'label' => Mage::helper('awb')->__('E-mail'),
|
116 |
+
'title' => Mage::helper('awb')->__('E-mail'),
|
117 |
+
'name' => 'customer_email',
|
118 |
+
'required' => true,
|
119 |
+
));
|
120 |
+
|
121 |
+
$fieldset->addField('postcode', 'text', array(
|
122 |
+
'label' => Mage::helper('awb')->__('Cod postal'),
|
123 |
+
'title' => Mage::helper('awb')->__('Cod postal'),
|
124 |
+
'name' => 'postcode',
|
125 |
+
'required' => false,
|
126 |
+
));
|
127 |
+
|
128 |
+
|
129 |
+
// echo '<pre>';
|
130 |
+
// print_r($orasOtionsArray);
|
131 |
+
// exit();
|
132 |
+
|
133 |
+
$form->setValues($model->getData());
|
134 |
+
$this->setForm($form);
|
135 |
+
|
136 |
+
return parent::_prepareForm();
|
137 |
+
}
|
138 |
+
|
139 |
+
|
140 |
+
}
|
app/code/local/Eadesigndev/Awb/Block/Adminhtml/Template/Awb/Grid.php
ADDED
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Description of Grid
|
5 |
+
*
|
6 |
+
* @author Ea Design
|
7 |
+
*/
|
8 |
+
class Eadesigndev_Awb_Block_Adminhtml_Template_Awb_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
9 |
+
{
|
10 |
+
/*
|
11 |
+
* set the default values for the grid system
|
12 |
+
*/
|
13 |
+
|
14 |
+
protected function _construct()
|
15 |
+
{
|
16 |
+
$this->setEmptyText(Mage::helper('awb')->__('Nu sunt awb la validare'));
|
17 |
+
$this->setId('awb');
|
18 |
+
$this->setUseAjax(false);
|
19 |
+
$this->setSaveParametersInSession(true);
|
20 |
+
}
|
21 |
+
|
22 |
+
/*
|
23 |
+
* We set the collection to use
|
24 |
+
*/
|
25 |
+
|
26 |
+
protected function _prepareCollection()
|
27 |
+
{
|
28 |
+
$collection = Mage::getModel('awb/awb')->getCollection();
|
29 |
+
|
30 |
+
$this->setCollection($collection);
|
31 |
+
return parent::_prepareCollection();
|
32 |
+
}
|
33 |
+
|
34 |
+
/*
|
35 |
+
* Add the columns in the grid view
|
36 |
+
*/
|
37 |
+
|
38 |
+
protected function _prepareColumns()
|
39 |
+
{
|
40 |
+
$this->addColumn('awb_id', array(
|
41 |
+
'header' => Mage::helper('awb')->__('ID'),
|
42 |
+
'index' => 'awb_id',
|
43 |
+
'width' => '10px'
|
44 |
+
)
|
45 |
+
);
|
46 |
+
|
47 |
+
$this->addColumn('created_time', array(
|
48 |
+
'header' => Mage::helper('awb')->__('Created Time'),
|
49 |
+
'align' => 'left',
|
50 |
+
'index' => 'created_time',
|
51 |
+
'type' => 'date',
|
52 |
+
));
|
53 |
+
|
54 |
+
$this->addColumn('increment_order_id', array(
|
55 |
+
'header' => Mage::helper('awb')->__('Id comanda'),
|
56 |
+
'index' => 'increment_order_id'
|
57 |
+
));
|
58 |
+
|
59 |
+
$this->addColumn('carrier_id', array(
|
60 |
+
'header' => Mage::helper('awb')->__('Courier'),
|
61 |
+
'index' => 'carrier_id',
|
62 |
+
'type' => 'options',
|
63 |
+
'options' => array(
|
64 |
+
Eadesigndev_Awb_Model_Awb::CARRIERURGENT => 'Urgent Curier',
|
65 |
+
),
|
66 |
+
));
|
67 |
+
|
68 |
+
$this->addColumn('awb_number', array(
|
69 |
+
'header' => Mage::helper('awb')->__('Numar awb'),
|
70 |
+
'index' => 'awb_number'
|
71 |
+
));
|
72 |
+
|
73 |
+
$this->addColumn('awb_pickup_id', array(
|
74 |
+
'header' => Mage::helper('awb')->__('Punct ridicare'),
|
75 |
+
'index' => 'awb_pickup_id',
|
76 |
+
|
77 |
+
));
|
78 |
+
|
79 |
+
$this->addColumn('destinatar', array(
|
80 |
+
'header' => Mage::helper('awb')->__('Destinatar'),
|
81 |
+
'index' => 'destinatar'
|
82 |
+
));
|
83 |
+
|
84 |
+
$this->addColumn('dest_localitate', array(
|
85 |
+
'header' => Mage::helper('awb')->__('Localitate'),
|
86 |
+
'index' => 'dest_localitate'
|
87 |
+
));
|
88 |
+
|
89 |
+
$this->addColumn('colete', array(
|
90 |
+
'header' => Mage::helper('awb')->__('Colete'),
|
91 |
+
'index' => 'colete'
|
92 |
+
));
|
93 |
+
|
94 |
+
$this->addColumn('plata_expeditie', array(
|
95 |
+
'header' => Mage::helper('awb')->__('Courier'),
|
96 |
+
'index' => 'plata_expeditie',
|
97 |
+
'type' => 'options',
|
98 |
+
'options' => array(
|
99 |
+
Eadesigndev_Awb_Block_Adminhtml_Template_Awb_Edit_Tabs_Curier::LADESTINATIE => 'Destinatar',
|
100 |
+
Eadesigndev_Awb_Block_Adminhtml_Template_Awb_Edit_Tabs_Curier::LAEXPEDITOR => 'Expeditor',
|
101 |
+
),
|
102 |
+
));
|
103 |
+
|
104 |
+
$this->addColumn('valuare_comanda', array(
|
105 |
+
'header' => Mage::helper('awb')->__('Valuare comanda'),
|
106 |
+
'index' => 'valuare_comanda'
|
107 |
+
));
|
108 |
+
|
109 |
+
$this->addColumn('ramburs_cont_colector', array(
|
110 |
+
'header' => Mage::helper('awb')->__('Cont colector'),
|
111 |
+
'index' => 'ramburs_cont_colector'
|
112 |
+
));
|
113 |
+
|
114 |
+
$this->addColumn('plata_expeditie', array(
|
115 |
+
'header' => Mage::helper('awb')->__('Plata Expeditie'),
|
116 |
+
'index' => 'plata_expeditie',
|
117 |
+
'type' => 'options',
|
118 |
+
'options' => array(
|
119 |
+
Eadesigndev_Awb_Block_Adminhtml_Template_Awb_Edit_Tabs_Curier::LADESTINATIE => Mage::helper('awb')->__('La destinatie'),
|
120 |
+
Eadesigndev_Awb_Block_Adminhtml_Template_Awb_Edit_Tabs_Curier::LAEXPEDITOR => Mage::helper('awb')->__('La expeditor'),
|
121 |
+
)
|
122 |
+
));
|
123 |
+
|
124 |
+
$this->addColumn('status', array(
|
125 |
+
'header' => Mage::helper('awb')->__('Status'),
|
126 |
+
'index' => 'status',
|
127 |
+
'type' => 'options',
|
128 |
+
'options' => array(
|
129 |
+
0 => Mage::helper('awb')->__('Nou'),
|
130 |
+
1 => Mage::helper('awb')->__('Aprobat'),
|
131 |
+
)
|
132 |
+
));
|
133 |
+
|
134 |
+
$this->addColumn('action',
|
135 |
+
array(
|
136 |
+
'header' => Mage::helper('sales')->__('Action'),
|
137 |
+
'width' => '50px',
|
138 |
+
'type' => 'action',
|
139 |
+
'getter' => 'getId',
|
140 |
+
'actions' => array(
|
141 |
+
array(
|
142 |
+
'caption' => Mage::helper('sales')->__('Edit'),
|
143 |
+
'url' => array('base' => '*/*/edit'),
|
144 |
+
'field' => 'id',
|
145 |
+
'data-column' => 'action',
|
146 |
+
)
|
147 |
+
),
|
148 |
+
'filter' => false,
|
149 |
+
'sortable' => false,
|
150 |
+
'index' => 'stores',
|
151 |
+
'is_system' => true,
|
152 |
+
));
|
153 |
+
|
154 |
+
return $this;
|
155 |
+
}
|
156 |
+
|
157 |
+
/*
|
158 |
+
* We get the row to get action to edit the current id of the template
|
159 |
+
*/
|
160 |
+
|
161 |
+
public function getRowUrl($row)
|
162 |
+
{
|
163 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
164 |
+
}
|
165 |
+
|
166 |
+
}
|
app/code/local/Eadesigndev/Awb/Helper/City.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Created by IntelliJ IDEA.
|
5 |
+
* User: eadesignpc
|
6 |
+
* Date: 7/14/2015
|
7 |
+
* Time: 2:19 PM
|
8 |
+
*/
|
9 |
+
class Eadesigndev_Awb_Helper_City
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Get city
|
13 |
+
* @return string
|
14 |
+
*/
|
15 |
+
public function getCity()
|
16 |
+
{
|
17 |
+
$cities = Mage::helper('awb/urgent')->getDataCity();
|
18 |
+
|
19 |
+
return $cities;
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Get country
|
24 |
+
* @return string
|
25 |
+
*/
|
26 |
+
public function getCounty()
|
27 |
+
{
|
28 |
+
$counties = Mage::helper('awb/urgent')->getDataCounty();
|
29 |
+
|
30 |
+
return $counties;
|
31 |
+
}
|
32 |
+
|
33 |
+
public function getCities($countryId, $regionId)
|
34 |
+
{
|
35 |
+
$cityCollection = Mage::getModel('awb/awbcity')->getCollection();
|
36 |
+
$cityCollection->addFieldToSelect('cityname')
|
37 |
+
->addFieldToFilter('country_id', $countryId)
|
38 |
+
->addFieldToFilter('region_id', $regionId);
|
39 |
+
|
40 |
+
$jsonData = Mage::helper('core')->jsonEncode($cityCollection->getData());
|
41 |
+
|
42 |
+
return $jsonData;
|
43 |
+
}
|
44 |
+
}
|
app/code/local/Eadesigndev/Awb/Helper/Data.php
ADDED
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Created by IntelliJ IDEA.
|
5 |
+
* User: eadesignpc
|
6 |
+
* Date: 5/5/2015
|
7 |
+
* Time: 10:16 AM
|
8 |
+
*/
|
9 |
+
class Eadesigndev_Awb_Helper_Data extends Mage_Core_Helper_Abstract
|
10 |
+
{
|
11 |
+
|
12 |
+
public function getRegionByCountry($country)
|
13 |
+
{
|
14 |
+
$collection = Mage::getModel('directory/region')->getResourceCollection()
|
15 |
+
->addCountryFilter($country)
|
16 |
+
->load();
|
17 |
+
|
18 |
+
$select = array();
|
19 |
+
$select[''] = Mage::helper('awb')->__('Selecteaza');
|
20 |
+
foreach ($collection as $judet) {
|
21 |
+
$select[$judet->getId()] = $judet->getData('default_name');
|
22 |
+
}
|
23 |
+
|
24 |
+
return $select;
|
25 |
+
}
|
26 |
+
|
27 |
+
public function getCitiesByRegion($countryId, $regionId)
|
28 |
+
{
|
29 |
+
$cityCollection = Mage::getModel('awb/awbcity')->getCollection();
|
30 |
+
|
31 |
+
$cityCollection
|
32 |
+
->addFieldToSelect('cityname')
|
33 |
+
->addFieldToFilter('country_id', $countryId)
|
34 |
+
->addFieldToFilter('region_id', $regionId);
|
35 |
+
|
36 |
+
$select = array();
|
37 |
+
$select[''] = Mage::helper('awb')->__('Selecteaza');
|
38 |
+
foreach ($cityCollection as $oras) {
|
39 |
+
$select[$oras->getData('cityname')] = $oras->getData('cityname');
|
40 |
+
}
|
41 |
+
|
42 |
+
return $select;
|
43 |
+
}
|
44 |
+
|
45 |
+
public function serviciiAsOtionArray()
|
46 |
+
{
|
47 |
+
$servicii = array(
|
48 |
+
'' => 'Selecteaza',
|
49 |
+
1 => 'Standard',
|
50 |
+
2 => 'Cont colector'
|
51 |
+
);
|
52 |
+
|
53 |
+
return $servicii;
|
54 |
+
}
|
55 |
+
|
56 |
+
public function getRegionById($id)
|
57 |
+
{
|
58 |
+
|
59 |
+
$judet = Mage::getModel('awb/awb')->convertName($id);
|
60 |
+
return $judet;
|
61 |
+
}
|
62 |
+
|
63 |
+
public function setTrackingCode($code, $awbModel)
|
64 |
+
{
|
65 |
+
$model = Mage::getModel('awb/awb')->load($awbModel->getData('awb_id'));
|
66 |
+
$shipmentId = $model->getData('shippment_id');
|
67 |
+
|
68 |
+
$shipment = Mage::getModel('sales/order_shipment')->load($shipmentId);
|
69 |
+
|
70 |
+
|
71 |
+
$title = 'Urgent Curier';
|
72 |
+
$carrier = 'Eadesigndev_urgent';
|
73 |
+
|
74 |
+
|
75 |
+
$track = Mage::getModel('sales/order_shipment_track')
|
76 |
+
->setNumber($code)
|
77 |
+
->setCarrierCode($carrier)
|
78 |
+
->setTitle($title);
|
79 |
+
|
80 |
+
$shipment->addTrack($track);
|
81 |
+
|
82 |
+
try {
|
83 |
+
$shipment->save();
|
84 |
+
} catch (Mage_Core_Exception $e) {
|
85 |
+
echo $e->getMessage();
|
86 |
+
}
|
87 |
+
|
88 |
+
}
|
89 |
+
|
90 |
+
public function getPaymentCode($order)
|
91 |
+
{
|
92 |
+
if ($order instanceof Mage_Sales_Model_Order) {
|
93 |
+
$payment = $order->getPayment();
|
94 |
+
if (is_object($payment)) {
|
95 |
+
$code = $payment->getMethodInstance()->getCode();
|
96 |
+
return $code;
|
97 |
+
}
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Check if module is active
|
103 |
+
* @return boolean
|
104 |
+
*/
|
105 |
+
public function isActive()
|
106 |
+
{
|
107 |
+
return Mage::getStoreConfig('awbopt/urgent_opt/active');
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Get urgent user name
|
112 |
+
* @return string
|
113 |
+
*/
|
114 |
+
public function getUserName()
|
115 |
+
{
|
116 |
+
return Mage::getStoreConfig('awbopt/urgent_opt/username');
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Get urgent password
|
121 |
+
* @return string
|
122 |
+
*/
|
123 |
+
public function getPassword()
|
124 |
+
{
|
125 |
+
return Mage::getStoreConfig('awbopt/urgent_opt/password');
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Get punct de ridicare
|
130 |
+
* @return string
|
131 |
+
*/
|
132 |
+
public function getPctRidicare()
|
133 |
+
{
|
134 |
+
return Mage::getStoreConfig('awbopt/urgent_opt/punctridicare');
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Get plantarifar
|
139 |
+
* @return string
|
140 |
+
*/
|
141 |
+
public function getPlanTarifar()
|
142 |
+
{
|
143 |
+
return Mage::getStoreConfig('awbopt/urgent_opt/plantarifar');
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Get metoda de plata
|
148 |
+
* @return string
|
149 |
+
*/
|
150 |
+
public function getMetodaPlata()
|
151 |
+
{
|
152 |
+
return Mage::getStoreConfig('awbopt/urgent_opt/afisare');
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Get deschidere colet
|
157 |
+
* @return boolean
|
158 |
+
*/
|
159 |
+
public function getDeschidereColet()
|
160 |
+
{
|
161 |
+
return Mage::getStoreConfig('awbopt/urgent_opt/dechide');
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Get livrare sambata
|
166 |
+
* @return boolean
|
167 |
+
*/
|
168 |
+
public function getLivrareSambata()
|
169 |
+
{
|
170 |
+
return Mage::getStoreConfig('awbopt/urgent_opt/sambata');
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Get afisare metode
|
175 |
+
* @return string
|
176 |
+
*/
|
177 |
+
public function getAfisareMetode()
|
178 |
+
{
|
179 |
+
return Mage::getStoreConfig('awbopt/urgent_opt/pachet');
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* Get asigurare
|
184 |
+
* @return string
|
185 |
+
*/
|
186 |
+
public function getAsigurare()
|
187 |
+
{
|
188 |
+
return Mage::getStoreConfig('awbopt/urgent_opt/asigurare');
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Get plata transport
|
193 |
+
* @return string
|
194 |
+
*/
|
195 |
+
public function getPlataTransport()
|
196 |
+
{
|
197 |
+
return Mage::getStoreConfig('awbopt/urgent_opt/platatransport');
|
198 |
+
}
|
199 |
+
|
200 |
+
|
201 |
+
}
|
app/code/local/Eadesigndev/Awb/Helper/Update.php
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Eadesigndev_Awb_Helper_Update extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
public function getDataCity()
|
5 |
+
{
|
6 |
+
$token = Mage::helper('awb/urgent')->getToken(true);
|
7 |
+
|
8 |
+
$fields = array(
|
9 |
+
'Token' => $token,
|
10 |
+
'CountyId' => null,
|
11 |
+
'CountyName' => '',
|
12 |
+
'CountryId' => null,
|
13 |
+
'CountryName' => 'Romania'
|
14 |
+
);
|
15 |
+
|
16 |
+
$localities = Mage::helper('awb/urgent')->getUrgent('GetLocalities', $fields);
|
17 |
+
|
18 |
+
return $localities;
|
19 |
+
}
|
20 |
+
|
21 |
+
public function getDataCounty()
|
22 |
+
{
|
23 |
+
$token = Mage::helper('awb/urgent')->getToken(true);
|
24 |
+
|
25 |
+
$fields = array(
|
26 |
+
'Token' => $token,
|
27 |
+
'CountryId' => null,
|
28 |
+
'CountryName' => 'Romania'
|
29 |
+
);
|
30 |
+
|
31 |
+
return Mage::helper('awb/urgent')->getUrgent('GetCounties', $fields);
|
32 |
+
}
|
33 |
+
|
34 |
+
|
35 |
+
public function getCity()
|
36 |
+
{
|
37 |
+
$cities = $this->getDataCity();
|
38 |
+
|
39 |
+
return $cities;
|
40 |
+
}
|
41 |
+
|
42 |
+
public function getCounty()
|
43 |
+
{
|
44 |
+
$counties = $this->getDataCounty();
|
45 |
+
|
46 |
+
return $counties;
|
47 |
+
}
|
48 |
+
|
49 |
+
public function processData()
|
50 |
+
{
|
51 |
+
$collection = Mage::getModel('directory/region')->getResourceCollection()
|
52 |
+
->addCountryFilter('RO')
|
53 |
+
->load();
|
54 |
+
|
55 |
+
$regionNew = array();
|
56 |
+
foreach ($collection as $region) {
|
57 |
+
$regionNew[$region->getData('code')] = $region->getData('region_id');
|
58 |
+
}
|
59 |
+
|
60 |
+
$orase = $this->getCity();
|
61 |
+
$judete = $this->getCounty();
|
62 |
+
|
63 |
+
$listaJudeteNoua = array();
|
64 |
+
|
65 |
+
foreach ($judete as $judet) {
|
66 |
+
$listaJudeteNoua[$judet->CountyId] = $judet->Abbreviation;
|
67 |
+
}
|
68 |
+
|
69 |
+
$listaOraseNoua = array();
|
70 |
+
|
71 |
+
foreach ($orase as $oras) {
|
72 |
+
$judetNumeric = $oras->CountyId;
|
73 |
+
$judetCod = $listaJudeteNoua[$judetNumeric];
|
74 |
+
$judetId = $regionNew[$judetCod];
|
75 |
+
|
76 |
+
$listaOraseNoua[] = array(
|
77 |
+
'RO',
|
78 |
+
$oras->Name,
|
79 |
+
$judetId
|
80 |
+
);
|
81 |
+
}
|
82 |
+
|
83 |
+
return $listaOraseNoua;
|
84 |
+
|
85 |
+
}
|
86 |
+
|
87 |
+
public function getUrgentCollection()
|
88 |
+
{
|
89 |
+
$collection = Mage::getModel('awb/awbcity')->getResourceCollection()
|
90 |
+
->load();
|
91 |
+
|
92 |
+
foreach ($collection as $individualObject) {
|
93 |
+
$individualObject->delete();
|
94 |
+
}
|
95 |
+
|
96 |
+
foreach ($this->processData() as $oras) {
|
97 |
+
|
98 |
+
$individualOras = Mage::getModel('awb/awbcity');
|
99 |
+
|
100 |
+
$individualOras->setData('country_id', $oras[0]);
|
101 |
+
$individualOras->setData('region_id', $oras[2]);
|
102 |
+
$individualOras->setData('cityname', $oras[1]);
|
103 |
+
try {
|
104 |
+
$individualOras->save();
|
105 |
+
} catch (Exception $e) {
|
106 |
+
$messege = $e->getMessege();
|
107 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('awb')->__('A avut loc o eroare ' . $messege));
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
$individualuc = Mage::getModel('awb/awbcity')
|
112 |
+
->setData('country_id', 'RO')
|
113 |
+
->setData('region_id', '287')
|
114 |
+
->setData('cityname', 'Bucuresti');
|
115 |
+
|
116 |
+
try {
|
117 |
+
$individualuc->save();
|
118 |
+
} catch (Exception $e) {
|
119 |
+
$messege1 = $e->getMessege();
|
120 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('awb')->__('A avut loc o eroare ' . $messege1));
|
121 |
+
}
|
122 |
+
|
123 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('awb')->__('A fost facut update-ul'));
|
124 |
+
}
|
125 |
+
}
|
app/code/local/Eadesigndev/Awb/Helper/Urgent.php
ADDED
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Created by IntelliJ IDEA.
|
5 |
+
* User: eadesignpc
|
6 |
+
* Date: 5/5/2015
|
7 |
+
* Time: 10:16 AM
|
8 |
+
*/
|
9 |
+
class Eadesigndev_Awb_Helper_Urgent extends Mage_Core_Helper_Abstract
|
10 |
+
{
|
11 |
+
private $ServiceUrl;
|
12 |
+
private $Curl;
|
13 |
+
private $_helper;
|
14 |
+
|
15 |
+
public function __construct()
|
16 |
+
{
|
17 |
+
$this->_helper = Mage::helper('awb');
|
18 |
+
|
19 |
+
$this->ServiceUrl = 'http://urgentcargus.cloudapp.net/IntegrationService.asmx';
|
20 |
+
$this->Curl = curl_init();
|
21 |
+
curl_setopt($this->Curl, CURLOPT_CUSTOMREQUEST, 'POST');
|
22 |
+
curl_setopt($this->Curl, CURLOPT_RETURNTRANSFER, true);
|
23 |
+
}
|
24 |
+
|
25 |
+
public function getHelper()
|
26 |
+
{
|
27 |
+
return $this->_helper;
|
28 |
+
}
|
29 |
+
|
30 |
+
private function getUrgentData($MethodName, $Parameters = null)
|
31 |
+
{
|
32 |
+
if ($Parameters != null) {
|
33 |
+
$Parameters = json_encode($Parameters);
|
34 |
+
curl_setopt($this->Curl, CURLOPT_POSTFIELDS, $Parameters);
|
35 |
+
}
|
36 |
+
curl_setopt($this->Curl, CURLOPT_URL, $this->ServiceUrl . '/' . $MethodName);
|
37 |
+
curl_setopt($this->Curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($Parameters)));
|
38 |
+
$data = json_decode(curl_exec($this->Curl));
|
39 |
+
if (isset($data->d)) {
|
40 |
+
if (strstr($MethodName, 'Print')) {
|
41 |
+
return implode(array_map('chr', $data->d));
|
42 |
+
} else {
|
43 |
+
return $data->d;
|
44 |
+
}
|
45 |
+
} else {
|
46 |
+
return array('error' => isset($data->Message) ? $data->Message : 'unknown');
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
public function getToken($simple = false)
|
51 |
+
{
|
52 |
+
|
53 |
+
$credentials = array(
|
54 |
+
'Username' => $this->getHelper()->getUserName(),
|
55 |
+
'Password' => $this->getHelper()->getPassword(),
|
56 |
+
);
|
57 |
+
|
58 |
+
$token = $this->getUrgentData('LoginUser', $credentials);
|
59 |
+
|
60 |
+
if (is_array($token)) {
|
61 |
+
if (isset($token['error'])) {
|
62 |
+
Mage::getSingleton('core/session')->addError($token['error']);
|
63 |
+
return;
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
if ($simple) {
|
68 |
+
$fields = $token;
|
69 |
+
} else {
|
70 |
+
$fields = array(
|
71 |
+
'Token' => $token
|
72 |
+
);
|
73 |
+
}
|
74 |
+
return $fields;
|
75 |
+
|
76 |
+
}
|
77 |
+
|
78 |
+
public function getPunctRidicare()
|
79 |
+
{
|
80 |
+
if ($this->getToken()) {
|
81 |
+
return $this->getUrgentData('GetPickupLocations', $this->getToken());
|
82 |
+
}
|
83 |
+
return false;
|
84 |
+
}
|
85 |
+
|
86 |
+
public function getPunctToOptonArray()
|
87 |
+
{
|
88 |
+
return $this->toOptionArray($this->getPunctRidicare(), 'LocationId', 'Name');
|
89 |
+
}
|
90 |
+
|
91 |
+
public function toOptionArray($array, $key, $value)
|
92 |
+
{
|
93 |
+
$return = array();
|
94 |
+
foreach ($array as $element) {
|
95 |
+
$return[$element->$key] = $element->$value;
|
96 |
+
}
|
97 |
+
return $return;
|
98 |
+
}
|
99 |
+
|
100 |
+
public function getPricePlans()
|
101 |
+
{
|
102 |
+
$planTarifar = $this->getUrgentData('GetPriceTables', $this->getToken());
|
103 |
+
return $this->toOptionArray($planTarifar, 'PriceTableId', 'Name');
|
104 |
+
}
|
105 |
+
|
106 |
+
public function generateAwb($model)
|
107 |
+
{
|
108 |
+
|
109 |
+
$helper = Mage::helper('awb');
|
110 |
+
|
111 |
+
$tipServiciu = $model->getData('tip_seviciu');
|
112 |
+
if ($tipServiciu == 1) {
|
113 |
+
$cashPayment = $model->getData('ramburs_cont_colector');
|
114 |
+
$contColector = 0;
|
115 |
+
} else {
|
116 |
+
$cashPayment = 0;
|
117 |
+
$contColector = $model->getData('ramburs_cont_colector');
|
118 |
+
}
|
119 |
+
|
120 |
+
|
121 |
+
$deschideColetVal = $model->getData('deschidere_colet');
|
122 |
+
|
123 |
+
if ($deschideColetVal) {
|
124 |
+
$deschideColet = true;
|
125 |
+
} else {
|
126 |
+
$deschideColet = false;
|
127 |
+
}
|
128 |
+
|
129 |
+
$livrareSambataVal = $model->getData('livrare_sambata');
|
130 |
+
|
131 |
+
if ($livrareSambataVal) {
|
132 |
+
$livrareSambata = true;
|
133 |
+
} else {
|
134 |
+
$livrareSambata = false;
|
135 |
+
}
|
136 |
+
|
137 |
+
$plataExpeditie = $model->getData('plata_expeditie');
|
138 |
+
if (Eadesigndev_Awb_Block_Adminhtml_Template_Awb_Edit_Tabs_Curier::LAEXPEDITOR == $plataExpeditie) {
|
139 |
+
$plataExpeditieUrgent = 1;
|
140 |
+
} else {
|
141 |
+
$plataExpeditieUrgent = 2;
|
142 |
+
}
|
143 |
+
|
144 |
+
|
145 |
+
$token = $this->getToken();
|
146 |
+
$stringToken = $token['Token'];
|
147 |
+
|
148 |
+
$destinarar = $model->getData('destinatar');
|
149 |
+
$company = $model->getData('company');
|
150 |
+
$destinararName = $destinarar;
|
151 |
+
if ($company) {
|
152 |
+
$destinararName = $company;
|
153 |
+
}
|
154 |
+
|
155 |
+
$fields = array(
|
156 |
+
'Token' => $stringToken,
|
157 |
+
'Awb' => array(
|
158 |
+
'Sender' => array(
|
159 |
+
'LocationId' => $model->getData('awb_pickup_id')
|
160 |
+
),
|
161 |
+
'Recipient' => array(
|
162 |
+
'LocationId' => null,
|
163 |
+
'Name' => $destinararName,
|
164 |
+
'CountyId' => null,
|
165 |
+
'CountyName' => $helper->getRegionById($model->getData('region_id')),
|
166 |
+
'LocalityId' => null,
|
167 |
+
'LocalityName' => $model->getData('city'),
|
168 |
+
'Address' => $model->getData('street'),
|
169 |
+
'ContactPerson' => $destinarar,
|
170 |
+
'PhoneNumber' => $model->getData('telephone'),
|
171 |
+
'Email' => $model->getData('customer_email')
|
172 |
+
),
|
173 |
+
'Parcels' => $model->getData('colete'),
|
174 |
+
'Envelopes' => $model->getData('plicuri'),
|
175 |
+
'TotalWeight' => round($model->getData('greutate')),
|
176 |
+
'DeclaredValue' => $model->getData('valuare_comanda'),
|
177 |
+
'CashRepayment' => $cashPayment,
|
178 |
+
'BankRepayment' => $contColector,
|
179 |
+
'OtherRepayment' => '',
|
180 |
+
'OpenPackage' => $deschideColet,
|
181 |
+
'PriceTableId' => $model->getData('plan_tarifar'),
|
182 |
+
'ShipmentPayer' => $plataExpeditieUrgent,
|
183 |
+
'SaturdayDelivery' => $livrareSambata,
|
184 |
+
'Observations' => $model->getData('comentarii'),
|
185 |
+
'PackageContent' => $model->getData('continut'),
|
186 |
+
'CustomString' => ''
|
187 |
+
));
|
188 |
+
|
189 |
+
|
190 |
+
$awb = $this->getUrgentData('NewAwb', $fields);
|
191 |
+
|
192 |
+
return $awb;
|
193 |
+
}
|
194 |
+
|
195 |
+
public function getDataCity()
|
196 |
+
{
|
197 |
+
$token = $this->getToken(true);
|
198 |
+
|
199 |
+
$fields = array(
|
200 |
+
'Token' => $token,
|
201 |
+
'CountyId' => null,
|
202 |
+
'CountyName' => '',
|
203 |
+
'CountryId' => null,
|
204 |
+
'CountryName' => 'Romania'
|
205 |
+
);
|
206 |
+
|
207 |
+
$localities = $this->getUrgentData('GetLocalities', $fields);
|
208 |
+
|
209 |
+
return $localities;
|
210 |
+
}
|
211 |
+
|
212 |
+
public function getDataCounty()
|
213 |
+
{
|
214 |
+
$token = $this->getToken(true);
|
215 |
+
|
216 |
+
$fields = array(
|
217 |
+
'Token' => $token,
|
218 |
+
'CountryId' => null,
|
219 |
+
'CountryName' => 'Romania'
|
220 |
+
);
|
221 |
+
|
222 |
+
return $this->getUrgentData('GetCounties', $fields);
|
223 |
+
}
|
224 |
+
|
225 |
+
public function getUrgent($method, $params = null)
|
226 |
+
{
|
227 |
+
return $this->getUrgentData($method, $params);
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Get check if module is connected and activated
|
232 |
+
* @return bool
|
233 |
+
*/
|
234 |
+
public function isConnected()
|
235 |
+
{
|
236 |
+
$helper = Mage::helper('awb');
|
237 |
+
$isActive = $helper->isActive();
|
238 |
+
$punct = $this->getPunctToOptonArray();
|
239 |
+
|
240 |
+
if ($isActive && !empty($punct)) {
|
241 |
+
return true;
|
242 |
+
}
|
243 |
+
|
244 |
+
return false;
|
245 |
+
}
|
246 |
+
|
247 |
+
}
|
app/code/local/Eadesigndev/Awb/Model/Awb.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Description of PdfGenerator
|
5 |
+
*
|
6 |
+
* @author Ea Design
|
7 |
+
*/
|
8 |
+
class Eadesigndev_Awb_Model_Awb extends Mage_Core_Model_Abstract
|
9 |
+
{
|
10 |
+
|
11 |
+
const CARRIERFAN = 1;
|
12 |
+
const CARRIERURGENT = 2;
|
13 |
+
|
14 |
+
|
15 |
+
public function _construct()
|
16 |
+
{
|
17 |
+
$this->_init('awb/awb');
|
18 |
+
}
|
19 |
+
|
20 |
+
public function convertName($id)
|
21 |
+
{
|
22 |
+
$region = Mage::getModel('directory/region')->load($id);
|
23 |
+
|
24 |
+
$name = $region->getName();
|
25 |
+
|
26 |
+
$table = Mage::helper('catalog/product_url')->getConvertTable();
|
27 |
+
$judet = strtr($name, $table);
|
28 |
+
|
29 |
+
return $judet;
|
30 |
+
}
|
31 |
+
}
|
app/code/local/Eadesigndev/Awb/Model/Awbcity.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Description of PdfGenerator
|
5 |
+
*
|
6 |
+
* @author Ea Design
|
7 |
+
*/
|
8 |
+
class Eadesigndev_Awb_Model_Awbcity extends Mage_Core_Model_Abstract
|
9 |
+
{
|
10 |
+
|
11 |
+
public function _construct()
|
12 |
+
{
|
13 |
+
$this->_init('awb/awbcity');
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/local/Eadesigndev/Awb/Model/Eacore/Feed.php
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
Class Eadesigndev_Awb_Model_Eacore_Feed extends Mage_AdminNotification_Model_Feed
|
4 |
+
{
|
5 |
+
|
6 |
+
protected $eadesignUrl;
|
7 |
+
|
8 |
+
public function checkUpdate()
|
9 |
+
{
|
10 |
+
|
11 |
+
if (($this->getFrequency() + $this->getLastUpdate()) > time()) {
|
12 |
+
return $this;
|
13 |
+
}
|
14 |
+
|
15 |
+
$this->getClientData();
|
16 |
+
$feedData = array();
|
17 |
+
|
18 |
+
$feedXml = $this->getFeedData();
|
19 |
+
|
20 |
+
if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
|
21 |
+
foreach ($feedXml->channel->item as $item) {
|
22 |
+
$feedData[] = array(
|
23 |
+
'severity' => (int)$item->severity,
|
24 |
+
'date_added' => $this->getDate((string)$item->pubDate),
|
25 |
+
'title' => (string)$item->title,
|
26 |
+
'description' => (string)$item->description,
|
27 |
+
'url' => (string)$item->link,
|
28 |
+
);
|
29 |
+
}
|
30 |
+
|
31 |
+
|
32 |
+
if ($feedData) {
|
33 |
+
Mage::getModel('adminnotification/inbox')->parse(array_reverse($feedData));
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
37 |
+
|
38 |
+
$this->setLastUpdate();
|
39 |
+
|
40 |
+
return $this;
|
41 |
+
}
|
42 |
+
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Retrieve Last update time
|
46 |
+
*
|
47 |
+
* @return int
|
48 |
+
*/
|
49 |
+
public function getLastUpdate()
|
50 |
+
{
|
51 |
+
return Mage::app()->loadCache('eadesign_lastcheck');
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Set last update time (now)
|
56 |
+
*
|
57 |
+
* @return Mage_AdminNotification_Model_Feed
|
58 |
+
*/
|
59 |
+
public function setLastUpdate()
|
60 |
+
{
|
61 |
+
Mage::app()->saveCache(time(), 'eadesign_lastcheck');
|
62 |
+
return $this;
|
63 |
+
}
|
64 |
+
|
65 |
+
public function getFeedUrl()
|
66 |
+
{
|
67 |
+
if (is_null($this->eadesignUrl)) {
|
68 |
+
$this->eadesignUrl = 'https://www.eadesign.ro/notifications.rss';
|
69 |
+
}
|
70 |
+
return $this->eadesignUrl;
|
71 |
+
}
|
72 |
+
|
73 |
+
|
74 |
+
public function getFeedData()
|
75 |
+
{
|
76 |
+
$curl = new Varien_Http_Adapter_Curl();
|
77 |
+
$curl->setConfig(array(
|
78 |
+
'timeout' => 3
|
79 |
+
));
|
80 |
+
|
81 |
+
$curl->write(Zend_Http_Client::GET, $this->getFeedUrl(), '1.0');
|
82 |
+
$data = $curl->read();
|
83 |
+
if ($data === false) {
|
84 |
+
return false;
|
85 |
+
}
|
86 |
+
$data = preg_split('/^\r?$/m', $data, 2);
|
87 |
+
$data = trim($data[1]);
|
88 |
+
$curl->close();
|
89 |
+
|
90 |
+
try {
|
91 |
+
$xml = new SimpleXMLElement($data);
|
92 |
+
} catch (Exception $e) {
|
93 |
+
return false;
|
94 |
+
}
|
95 |
+
|
96 |
+
return $xml;
|
97 |
+
}
|
98 |
+
|
99 |
+
public function getClientData()
|
100 |
+
{
|
101 |
+
$eadesignUrl = 'https://www.eadesign.ro/';
|
102 |
+
|
103 |
+
$extension = 'Eadesigndev_Awb';
|
104 |
+
|
105 |
+
$moduleVersion = Mage::getConfig()->getModuleConfig($extension)->version;
|
106 |
+
|
107 |
+
$baseUrl = 'track/index/update?url=' . Mage::getBaseUrl();
|
108 |
+
$version = '&version=' . $moduleVersion;
|
109 |
+
$moduleExtension = '&extension='.$extension;
|
110 |
+
|
111 |
+
$url = $eadesignUrl.$baseUrl.$version.$moduleExtension;
|
112 |
+
|
113 |
+
$curl = new Varien_Http_Adapter_Curl();
|
114 |
+
$curl->setConfig(array(
|
115 |
+
'timeout' => 3
|
116 |
+
));
|
117 |
+
|
118 |
+
$curl->write(Zend_Http_Client::GET, $url, '1.0');
|
119 |
+
$curl->read();
|
120 |
+
$curl->close();
|
121 |
+
}
|
122 |
+
|
123 |
+
}
|
app/code/local/Eadesigndev/Awb/Model/Eacore/Observer.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Eadesigndev_Awb_Model_Eacore_Observer
|
3 |
+
{
|
4 |
+
public function preDispatch(Varien_Event_Observer $observer)
|
5 |
+
{
|
6 |
+
if (Mage::getSingleton('admin/session')->isLoggedIn()) {
|
7 |
+
|
8 |
+
$feedModel = Mage::getModel('awb/eacore_feed');
|
9 |
+
|
10 |
+
$feedModel->checkUpdate();
|
11 |
+
}
|
12 |
+
}
|
13 |
+
}
|
app/code/local/Eadesigndev/Awb/Model/Mysql4/Awb.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* To change this template, choose Tools | Templates
|
5 |
+
* and open the template in the editor.
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Description of PdfGenerator
|
10 |
+
*
|
11 |
+
* @author Ea Design
|
12 |
+
*
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
class Eadesigndev_Awb_Model_Mysql4_Awb extends Mage_Core_Model_Mysql4_Abstract
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* Intitialize the collection
|
19 |
+
*/
|
20 |
+
public function _construct()
|
21 |
+
{
|
22 |
+
$this->_init('awb/awb', 'awb_id');
|
23 |
+
}
|
24 |
+
}
|
app/code/local/Eadesigndev/Awb/Model/Mysql4/Awb/Collection.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* To change this template, choose Tools | Templates
|
5 |
+
* and open the template in the editor.
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Description of Collection
|
10 |
+
*
|
11 |
+
* @author Ea Design
|
12 |
+
*/
|
13 |
+
class Eadesigndev_Awb_Model_Mysql4_Awb_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* Retrive the product collection.
|
17 |
+
*/
|
18 |
+
public function _construct()
|
19 |
+
{
|
20 |
+
$this->_init('awb/awb');
|
21 |
+
}
|
22 |
+
}
|
app/code/local/Eadesigndev/Awb/Model/Mysql4/Awbcity.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* To change this template, choose Tools | Templates
|
5 |
+
* and open the template in the editor.
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Description of PdfGenerator
|
10 |
+
*
|
11 |
+
* @author Ea Design
|
12 |
+
*
|
13 |
+
*
|
14 |
+
*/
|
15 |
+
class Eadesigndev_Awb_Model_Mysql4_Awbcity extends Mage_Core_Model_Mysql4_Abstract
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* Intitialize the collection
|
19 |
+
*/
|
20 |
+
public function _construct()
|
21 |
+
{
|
22 |
+
$this->_init('awb/awbcity', 'city_id');
|
23 |
+
}
|
24 |
+
}
|
app/code/local/Eadesigndev/Awb/Model/Mysql4/Awbcity/Collection.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* To change this template, choose Tools | Templates
|
5 |
+
* and open the template in the editor.
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Description of Collection
|
10 |
+
*
|
11 |
+
* @author Ea Design
|
12 |
+
*/
|
13 |
+
class Eadesigndev_Awb_Model_Mysql4_Awbcity_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
14 |
+
{
|
15 |
+
/**
|
16 |
+
* Retrive the product collection.
|
17 |
+
*/
|
18 |
+
public function _construct()
|
19 |
+
{
|
20 |
+
$this->_init('awb/awbcity');
|
21 |
+
}
|
22 |
+
}
|
app/code/local/Eadesigndev/Awb/Model/Observer.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Created by IntelliJ IDEA.
|
5 |
+
* User: eadesignpc
|
6 |
+
* Date: 6/23/2015
|
7 |
+
* Time: 11:56 AM
|
8 |
+
*/
|
9 |
+
class Eadesigndev_Awb_Model_Observer
|
10 |
+
{
|
11 |
+
public function addButtonShip($observer)
|
12 |
+
{
|
13 |
+
|
14 |
+
$container = $observer->getBlock();
|
15 |
+
|
16 |
+
if (null !== $container && $container->getType() == 'adminhtml/sales_order_shipment_view') {
|
17 |
+
|
18 |
+
$dataUrgent = array(
|
19 |
+
'label' => 'Genereaza awb Urgent',
|
20 |
+
'class' => 'awb-button',
|
21 |
+
'onclick' => 'setLocation(\' ' . Mage::helper("adminhtml")->getUrl("awbadmin/adminhtml_index/generate",
|
22 |
+
array(
|
23 |
+
'shippment_id' => $container->getShipment()->getId(),
|
24 |
+
'order_id' => $container->getShipment()->getOrderId(),
|
25 |
+
'carrier_id'=>Eadesigndev_Awb_Model_Awb::CARRIERURGENT
|
26 |
+
)) . '\')',
|
27 |
+
);
|
28 |
+
$container->addButton('my_button_identifier1', $dataUrgent);
|
29 |
+
}
|
30 |
+
|
31 |
+
return $this;
|
32 |
+
}
|
33 |
+
}
|
app/code/local/Eadesigndev/Awb/Model/System/Abstract.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
abstract class Eadesigndev_Awb_Model_System_Abstract
|
4 |
+
{
|
5 |
+
public $helper;
|
6 |
+
|
7 |
+
public function __construct()
|
8 |
+
{
|
9 |
+
$this->helper = Mage::helper('awb/urgent');
|
10 |
+
}
|
11 |
+
|
12 |
+
public function getHelper()
|
13 |
+
{
|
14 |
+
return $this->helper;
|
15 |
+
}
|
16 |
+
|
17 |
+
public function getError(){
|
18 |
+
return array(
|
19 |
+
array('value' => '', 'label' => Mage::helper('awb')->__('Trebuie sa ai un user si parola valide'))
|
20 |
+
);
|
21 |
+
}
|
22 |
+
|
23 |
+
}
|
app/code/local/Eadesigndev/Awb/Model/System/Pachet.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eadesigndev_Awb_Model_System_Pachet extends Eadesigndev_Awb_Model_System_Abstract
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
return array(
|
8 |
+
array('value' => '0', 'label' => Mage::helper('awb')->__('Colet')),
|
9 |
+
array('value' => '1', 'label' => Mage::helper('awb')->__('Plic')),
|
10 |
+
);
|
11 |
+
}
|
12 |
+
}
|
app/code/local/Eadesigndev/Awb/Model/System/Plantarifar.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eadesigndev_Awb_Model_System_Plantarifar extends Eadesigndev_Awb_Model_System_Abstract
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
$helper = $this->getHelper();
|
8 |
+
$plans = $helper->getPricePlans();
|
9 |
+
|
10 |
+
if(empty($plans)){
|
11 |
+
return $this->getError();
|
12 |
+
}
|
13 |
+
|
14 |
+
return $plans;
|
15 |
+
}
|
16 |
+
}
|
app/code/local/Eadesigndev/Awb/Model/System/Platatransport.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eadesigndev_Awb_Model_System_Platatransport extends Eadesigndev_Awb_Model_System_Abstract
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
return array(
|
8 |
+
array('value' => '', 'label' => Mage::helper('awb')->__('Select')),
|
9 |
+
array('value' => '1', 'label' => Mage::helper('awb')->__('Destinatar')),
|
10 |
+
array('value' => '2', 'label' => Mage::helper('awb')->__('Expeditor')),
|
11 |
+
);
|
12 |
+
}
|
13 |
+
}
|
app/code/local/Eadesigndev/Awb/Model/System/Punctridicare.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eadesigndev_Awb_Model_System_Punctridicare extends Eadesigndev_Awb_Model_System_Abstract
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
$helper = $this->getHelper();
|
8 |
+
$punct = $helper->getPunctToOptonArray();
|
9 |
+
|
10 |
+
if(empty($punct)){
|
11 |
+
return $this->getError();
|
12 |
+
}
|
13 |
+
|
14 |
+
return $punct;
|
15 |
+
|
16 |
+
|
17 |
+
}
|
18 |
+
}
|
app/code/local/Eadesigndev/Awb/Model/System/Tarifeafisate.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Eadesigndev_Awb_Model_System_Tarifeafisate extends Eadesigndev_Awb_Model_System_Abstract
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
return array(
|
8 |
+
array('value' => '', 'label' => Mage::helper('awb')->__('Select')),
|
9 |
+
array('value' => '1', 'label' => Mage::helper('awb')->__('Ramburs')),
|
10 |
+
array('value' => '2', 'label' => Mage::helper('awb')->__('Cont colector')),
|
11 |
+
);
|
12 |
+
}
|
13 |
+
}
|
app/code/local/Eadesigndev/Awb/controllers/Adminhtml/IndexController.php
ADDED
@@ -0,0 +1,384 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
* @author Ea Design
|
6 |
+
*/
|
7 |
+
class Eadesigndev_Awb_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* The index action on main extension pannel
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
public function indexAction()
|
14 |
+
{
|
15 |
+
$this->_title($this->__('System'))->_title($this->__('AWB In asteptare'));
|
16 |
+
|
17 |
+
if ($this->getRequest()->getQuery('ajax')) {
|
18 |
+
$this->_forward('grid');
|
19 |
+
return;
|
20 |
+
}
|
21 |
+
|
22 |
+
$this->loadLayout();
|
23 |
+
$this->_setActiveMenu('awbadmin/adminhtml_index');
|
24 |
+
$this->_addBreadcrumb(Mage::helper('awb')->__('AWB Ne validate'), Mage::helper('awb')->__('AWB Ne validate'));
|
25 |
+
|
26 |
+
$listBlock = $this->getLayout()->createBlock('awb/adminhtml_template_awb', 'awb-list');
|
27 |
+
$this->_addContent($listBlock);
|
28 |
+
|
29 |
+
$this->renderLayout();
|
30 |
+
}
|
31 |
+
|
32 |
+
public function gridAction()
|
33 |
+
{
|
34 |
+
$this->getResponse()->setBody($this->getLayout()->createBlock('awb/adminhtml_template_awb')->toHtml());
|
35 |
+
}
|
36 |
+
|
37 |
+
/*
|
38 |
+
* Edit the awb template
|
39 |
+
*/
|
40 |
+
|
41 |
+
public function editAction()
|
42 |
+
{
|
43 |
+
$this->loadLayout();
|
44 |
+
|
45 |
+
$this->_initTemplate('id');
|
46 |
+
|
47 |
+
$this->_setActiveMenu('awbadmin/adminhtml_index');
|
48 |
+
$this->_title($this->__('AWB'))->_title($this->__('Edit AWB'));
|
49 |
+
|
50 |
+
$this->_addBreadcrumb(Mage::helper('awb')
|
51 |
+
->__('Edit AWB'), Mage::helper('awb')
|
52 |
+
->__('Edit AWB'));
|
53 |
+
/*
|
54 |
+
* The edit form!!!
|
55 |
+
*/
|
56 |
+
$this->_addContent(
|
57 |
+
$this->getLayout()
|
58 |
+
->createBlock('awb/adminhtml_template_awb_edit', 'edit_form')
|
59 |
+
);
|
60 |
+
$this->_addLeft(
|
61 |
+
$this->getLayout()
|
62 |
+
->createBlock('awb/adminhtml_template_awb_edit_tabs', 'awb_edit')
|
63 |
+
);
|
64 |
+
|
65 |
+
|
66 |
+
$this->renderLayout();
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Save action
|
71 |
+
*/
|
72 |
+
public function saveAction()
|
73 |
+
{
|
74 |
+
// check if data sent
|
75 |
+
|
76 |
+
if ($data = $this->getRequest()->getPost()) {
|
77 |
+
|
78 |
+
$data = $this->_filterPostData($data);
|
79 |
+
//init model and set data
|
80 |
+
$model = $this->_initTemplate('id');
|
81 |
+
|
82 |
+
if ($id = $this->getRequest()->getParam('id')) {
|
83 |
+
$model->load($id);
|
84 |
+
}
|
85 |
+
|
86 |
+
$model->setData($data);
|
87 |
+
|
88 |
+
if ($id = $this->getRequest()->getParam('id')) {
|
89 |
+
$model->setData('update_time', now());
|
90 |
+
} else {
|
91 |
+
$model->setData('created_time', now());
|
92 |
+
$model->setData('update_time', now());
|
93 |
+
}
|
94 |
+
|
95 |
+
if ($this->getRequest()->getParam('approve')) {
|
96 |
+
|
97 |
+
$modelLoad = Mage::getModel('awb/awb')->load($model->getData('awb_id'));
|
98 |
+
|
99 |
+
if ($modelLoad->getData('carrier_id') == Eadesigndev_Awb_Model_Awb::CARRIERFAN) {
|
100 |
+
$code = Mage::helper('awb/csvgen')->generateCsvList($this->getRequest()->getParam('awb_id'));
|
101 |
+
if (is_array($code)) {
|
102 |
+
$codeLine = implode(',', $code);
|
103 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
104 |
+
Mage::helper('cms')->__($codeLine));
|
105 |
+
$this->_redirect('*/*/*');
|
106 |
+
return;
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
|
111 |
+
if ($modelLoad->getData('carrier_id') == Eadesigndev_Awb_Model_Awb::CARRIERURGENT) {
|
112 |
+
$urgentHelper = Mage::helper('awb/urgent');
|
113 |
+
$code = $urgentHelper->generateAwb($model);
|
114 |
+
if (is_array($code)) {
|
115 |
+
$codeLine = implode(',', $code);
|
116 |
+
Mage::getSingleton('adminhtml/session')->addError(
|
117 |
+
Mage::helper('cms')->__($codeLine));
|
118 |
+
$this->_redirect('*/*/*');
|
119 |
+
return;
|
120 |
+
}
|
121 |
+
|
122 |
+
|
123 |
+
}
|
124 |
+
$awbHelper = Mage::helper('awb');
|
125 |
+
|
126 |
+
$model->setData('awb_number', $code);
|
127 |
+
$awbHelper->setTrackingCode($code, $model);
|
128 |
+
|
129 |
+
$model->setData('status', 1);
|
130 |
+
}
|
131 |
+
|
132 |
+
Mage::dispatchEvent('awb_prepare_save', array('awb' => $model, 'request' => $this->getRequest()));
|
133 |
+
try {
|
134 |
+
|
135 |
+
|
136 |
+
$model->save();
|
137 |
+
|
138 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
139 |
+
Mage::helper('cms')->__('Awb salvat.'));
|
140 |
+
|
141 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
142 |
+
|
143 |
+
if ($this->getRequest()->getParam('back') || $this->getRequest()->getParam('approve')) {
|
144 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId(), '_current' => true));
|
145 |
+
return;
|
146 |
+
}
|
147 |
+
|
148 |
+
$this->_redirect('*/*/');
|
149 |
+
return;
|
150 |
+
} catch (Mage_Core_Exception $e) {
|
151 |
+
$this->_getSession()->addError($e->getMessage());
|
152 |
+
} catch (Exception $e) {
|
153 |
+
$this->_getSession()->addException($e, Mage::helper('awb')->__('An error occurred while saving the template.') . $e->getMessage());
|
154 |
+
}
|
155 |
+
|
156 |
+
$this->_getSession()->setFormData($data);
|
157 |
+
$this->_redirect('*/*/edit', array('awb_id' => $this->getRequest()->getParam('awb_id')));
|
158 |
+
return;
|
159 |
+
}
|
160 |
+
$this->_redirect('*/*/');
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Generate awb action
|
165 |
+
*/
|
166 |
+
public function generateAction()
|
167 |
+
{
|
168 |
+
// check if data sent
|
169 |
+
$helper = Mage::app()->getHelper('awb');
|
170 |
+
|
171 |
+
$model = $this->_initTemplate('id');
|
172 |
+
|
173 |
+
$model->setData('created_time', now());
|
174 |
+
$model->setData('update_time', now());
|
175 |
+
|
176 |
+
$model->setData('status', 0);
|
177 |
+
|
178 |
+
$orderId = $this->getRequest()->getParam('order_id');
|
179 |
+
if ($orderId) {
|
180 |
+
$model->setData('order_id', $orderId);
|
181 |
+
|
182 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
183 |
+
$model->setData('increment_order_id', $order->getIncrementId());
|
184 |
+
|
185 |
+
|
186 |
+
if ($company = $order->getShippingAddress()->getData('company')) {
|
187 |
+
$model->setData('company', $company);
|
188 |
+
}
|
189 |
+
|
190 |
+
$fName = $order->getShippingAddress()->getData('firstname');
|
191 |
+
$lName = $order->getShippingAddress()->getData('lastname');
|
192 |
+
|
193 |
+
$name = $fName . ' ' . $lName;
|
194 |
+
|
195 |
+
$customerName = $name;
|
196 |
+
$model->setData('destinatar', $customerName);
|
197 |
+
|
198 |
+
$customerDestCountry = $order->getShippingAddress()->getData('country_id');
|
199 |
+
$model->setData('country_id', $customerDestCountry);
|
200 |
+
|
201 |
+
$customerDestJudetId = $order->getShippingAddress()->getData('region_id');
|
202 |
+
$model->setData('region_id', $customerDestJudetId);
|
203 |
+
|
204 |
+
$customerDestLocalitate = $order->getShippingAddress()->getData('city');
|
205 |
+
$model->setData('city', $customerDestLocalitate);
|
206 |
+
|
207 |
+
$customerDestStrada = $order->getShippingAddress()->getData('street');
|
208 |
+
$model->setData('street', $customerDestStrada);
|
209 |
+
|
210 |
+
$customerPhone = $order->getShippingAddress()->getData('telephone');
|
211 |
+
$model->setData('telephone', $customerPhone);
|
212 |
+
|
213 |
+
$customerEmail = $order->getData('customer_email');
|
214 |
+
$model->setData('customer_email', $customerEmail);
|
215 |
+
|
216 |
+
$customerDestZip = $order->getData('postcode');
|
217 |
+
if (is_numeric($customerDestZip)) {
|
218 |
+
$model->setData('postcode', $customerDestZip);
|
219 |
+
}
|
220 |
+
|
221 |
+
$customerCarrierId = $this->getRequest()->getParam('carrier_id');
|
222 |
+
$model->setData('carrier_id', $customerCarrierId);
|
223 |
+
|
224 |
+
|
225 |
+
|
226 |
+
$planTarifar = $helper->getPlanTarifar();
|
227 |
+
$model->setData('plan_tarifar', $planTarifar);
|
228 |
+
|
229 |
+
$metodaPlata = $helper->getMetodaPlata();
|
230 |
+
$model->setData('tip_seviciu', $metodaPlata);
|
231 |
+
|
232 |
+
$pctRidicare = $helper->getPctRidicare();
|
233 |
+
$model->setData('awb_pickup_id', $pctRidicare );
|
234 |
+
|
235 |
+
$deschidereColet = $helper->getDeschidereColet();
|
236 |
+
$model->setData('deschidere_colet',$deschidereColet);
|
237 |
+
|
238 |
+
$livrareSambata = $helper->getLivrareSambata();
|
239 |
+
$model->setData('livrare_sambata',$livrareSambata);
|
240 |
+
|
241 |
+
|
242 |
+
|
243 |
+
$shipmentId = $this->getRequest()->getParam('shippment_id');
|
244 |
+
if ($shipmentId) {
|
245 |
+
$model->setData('shippment_id', $shipmentId);
|
246 |
+
$shippment = Mage::getModel('sales/order_shipment')->load($shipmentId);
|
247 |
+
$model->setData('increment_shippment_id', $shippment->getIncrementId());
|
248 |
+
$items = $shippment->getItemsCollection();
|
249 |
+
|
250 |
+
$intemsNames = array();
|
251 |
+
$colete = '';
|
252 |
+
$wheight = '';
|
253 |
+
foreach ($items as $item) {
|
254 |
+
$intemsNames[] = $item->getData('name');
|
255 |
+
$colete += $item->getData('qty');
|
256 |
+
$wheight += $item->getData('qty') * $item->getData('weight');
|
257 |
+
}
|
258 |
+
|
259 |
+
$finalNames = implode(',', $intemsNames);
|
260 |
+
$finalWhight = round($wheight, 0);
|
261 |
+
}
|
262 |
+
|
263 |
+
$plataTransport=$helper->getPlataTransport();
|
264 |
+
$model->setData('plata_expeditie',$plataTransport);
|
265 |
+
|
266 |
+
$model->setData('greutate', $finalWhight);
|
267 |
+
$afisareMetode = $helper->getAfisareMetode();
|
268 |
+
|
269 |
+
if($afisareMetode){
|
270 |
+
$model->setData('colete', 0);
|
271 |
+
$model->setData('plicuri', $colete);
|
272 |
+
}else{
|
273 |
+
$model->setData('colete', $colete);
|
274 |
+
$model->setData('plicuri', 0);
|
275 |
+
}
|
276 |
+
|
277 |
+
|
278 |
+
$total = round($order->getData('grand_total'), 2);
|
279 |
+
|
280 |
+
$asigurare = $helper->getAsigurare();
|
281 |
+
if($asigurare){
|
282 |
+
$model->setData('valuare_comanda',$total);
|
283 |
+
}else{
|
284 |
+
$model->setData('valuare_comanda',0);
|
285 |
+
}
|
286 |
+
|
287 |
+
|
288 |
+
if ($helper->getPaymentCode($order) == 'checkmo') {
|
289 |
+
$model->setData('ramburs_cont_colector', $total);
|
290 |
+
} else {
|
291 |
+
$model->setData('tip_seviciu', 'Standard');
|
292 |
+
$model->setData('ramburs_cont_colector', 0);
|
293 |
+
}
|
294 |
+
|
295 |
+
$model->setData('continut', $finalNames);
|
296 |
+
|
297 |
+
try {
|
298 |
+
|
299 |
+
$model->save();
|
300 |
+
|
301 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
302 |
+
Mage::helper('cms')->__('Awb generat.'));
|
303 |
+
|
304 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
305 |
+
|
306 |
+
$this->_redirect('*/*/edit/', array('id' => $model->getId()));
|
307 |
+
return;
|
308 |
+
} catch (Mage_Core_Exception $e) {
|
309 |
+
$this->_getSession()->addError($e->getMessage());
|
310 |
+
} catch (Exception $e) {
|
311 |
+
$this->_getSession()->addException($e, Mage::helper('awb')->__('An error occurred while saving the template.'));
|
312 |
+
}
|
313 |
+
}
|
314 |
+
}
|
315 |
+
|
316 |
+
|
317 |
+
/*
|
318 |
+
* Load the awb template for processing
|
319 |
+
*
|
320 |
+
* @param string $pdfFieldNameId;
|
321 |
+
* @return the model object with the loaded id
|
322 |
+
*/
|
323 |
+
|
324 |
+
protected function _initTemplate($fieldNameId = 'id')
|
325 |
+
{
|
326 |
+
$this->_title($this->__('System'))->_title($this->__('AWB'));
|
327 |
+
$id = (int)$this->getRequest()->getParam($fieldNameId);
|
328 |
+
$model = Mage::getModel('awb/awb');
|
329 |
+
if ($id) {
|
330 |
+
$model->load($id);
|
331 |
+
}
|
332 |
+
if (!Mage::registry('awb_template')) {
|
333 |
+
Mage::register('awb_template', $model);
|
334 |
+
}
|
335 |
+
if (!Mage::registry('current_awb_template')) {
|
336 |
+
Mage::register('current_awb_template', $model);
|
337 |
+
}
|
338 |
+
|
339 |
+
return $model;
|
340 |
+
}
|
341 |
+
|
342 |
+
/**
|
343 |
+
* Filtering posted data. Converting localized data if needed
|
344 |
+
*
|
345 |
+
* @param array
|
346 |
+
* @return array
|
347 |
+
*/
|
348 |
+
protected function _filterPostData($data)
|
349 |
+
{
|
350 |
+
$data = $this->_filterDates($data, array('custom_theme_from', 'custom_theme_to'));
|
351 |
+
return $data;
|
352 |
+
}
|
353 |
+
|
354 |
+
public function updateAction()
|
355 |
+
{
|
356 |
+
Mage::helper('awb/update')->getUrgentCollection();
|
357 |
+
$this->_redirectReferer();
|
358 |
+
}
|
359 |
+
|
360 |
+
public function settingsAction()
|
361 |
+
{
|
362 |
+
|
363 |
+
$url = Mage::helper('adminhtml')->getUrl('adminhtml/system_config/edit/section/awbopt');
|
364 |
+
Mage::app()->getResponse()->setRedirect($url);
|
365 |
+
}
|
366 |
+
|
367 |
+
public function citiesAction()
|
368 |
+
{
|
369 |
+
if (!$this->getRequest()->isXmlHttpRequest()) {
|
370 |
+
return;
|
371 |
+
}
|
372 |
+
|
373 |
+
$cityId = (int)$this->getRequest()->getParam('city_id');
|
374 |
+
$countryId = $this->getRequest()->getParam('country_id');
|
375 |
+
|
376 |
+
if (!$cityId || !$countryId) {
|
377 |
+
return;
|
378 |
+
}
|
379 |
+
|
380 |
+
echo Mage::helper('awb/city')->getCities($countryId, $cityId);
|
381 |
+
|
382 |
+
return;
|
383 |
+
}
|
384 |
+
}
|
app/code/local/Eadesigndev/Awb/etc/adminhtml.xml
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" ?>
|
2 |
+
<config>
|
3 |
+
<menu>
|
4 |
+
<awb_menu translate="title" module="awb">
|
5 |
+
<title>EaDesign</title>
|
6 |
+
<sort_order>50</sort_order>
|
7 |
+
<children>
|
8 |
+
<first_page module="awb">
|
9 |
+
<title>Lista AWB</title>
|
10 |
+
<action>awbadmin/adminhtml_index</action>
|
11 |
+
</first_page>
|
12 |
+
<auc_preferinte module="awb">
|
13 |
+
<title>Settings</title>
|
14 |
+
<sort_order>10</sort_order>
|
15 |
+
<action>awbadmin/adminhtml_index/settings</action>
|
16 |
+
</auc_preferinte>
|
17 |
+
</children>
|
18 |
+
</awb_menu>
|
19 |
+
</menu>
|
20 |
+
<acl>
|
21 |
+
<resources>
|
22 |
+
<all>
|
23 |
+
<title>Allow Everything</title>
|
24 |
+
</all>
|
25 |
+
<admin>
|
26 |
+
<children>
|
27 |
+
<awb_menu translate="title" module="awb">
|
28 |
+
<title>EaDesign</title>
|
29 |
+
<sort_order>50</sort_order>
|
30 |
+
<children>
|
31 |
+
<!-- child items go here -->
|
32 |
+
<first_page module="awb">
|
33 |
+
<title>Templates</title>
|
34 |
+
<sort_order>10</sort_order>
|
35 |
+
<action>awbadmin/adminhtml_index</action>
|
36 |
+
</first_page>
|
37 |
+
<auc_preferinte module="awb">
|
38 |
+
<title>Settings</title>
|
39 |
+
<sort_order>10</sort_order>
|
40 |
+
<action>awbadmin/adminhtml_index/settings</action>
|
41 |
+
</auc_preferinte>
|
42 |
+
</children>
|
43 |
+
</awb_menu>
|
44 |
+
</children>
|
45 |
+
</admin>
|
46 |
+
</resources>
|
47 |
+
</acl>
|
48 |
+
</config>
|
app/code/local/Eadesigndev/Awb/etc/config.xml
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Eadesigndev_Awb>
|
5 |
+
<version>1.0.7</version>
|
6 |
+
</Eadesigndev_Awb>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<helpers>
|
10 |
+
<awb>
|
11 |
+
<class>Eadesigndev_Awb_Helper</class>
|
12 |
+
</awb>
|
13 |
+
</helpers>
|
14 |
+
<blocks>
|
15 |
+
<awb>
|
16 |
+
<class>Eadesigndev_Awb_Block</class>
|
17 |
+
</awb>
|
18 |
+
</blocks>
|
19 |
+
<models>
|
20 |
+
<awb>
|
21 |
+
<class>Eadesigndev_Awb_Model</class>
|
22 |
+
<resourceModel>awb_mysql4</resourceModel>
|
23 |
+
</awb>
|
24 |
+
<awbcity>
|
25 |
+
<class>Eadesigndev_Awb_Model</class>
|
26 |
+
<resourceModel>awbcity_mysql4</resourceModel>
|
27 |
+
</awbcity>
|
28 |
+
<awb_mysql4>
|
29 |
+
<class>Eadesigndev_Awb_Model_Mysql4</class>
|
30 |
+
<entities>
|
31 |
+
<awb>
|
32 |
+
<table>eadesigndev_awb</table>
|
33 |
+
</awb>
|
34 |
+
<awbcity>
|
35 |
+
<table>directory_country_region_city</table>
|
36 |
+
</awbcity>
|
37 |
+
</entities>
|
38 |
+
</awb_mysql4>
|
39 |
+
</models>
|
40 |
+
<events>
|
41 |
+
<adminhtml_widget_container_html_before>
|
42 |
+
<observers>
|
43 |
+
<add_button_ship>
|
44 |
+
<type>model</type>
|
45 |
+
<class>awb/observer</class>
|
46 |
+
<method>addButtonShip</method>
|
47 |
+
</add_button_ship>
|
48 |
+
</observers>
|
49 |
+
</adminhtml_widget_container_html_before>
|
50 |
+
</events>
|
51 |
+
<resources>
|
52 |
+
<eadsign_awb_setup>
|
53 |
+
<setup>
|
54 |
+
<module>Eadesigndev_Awb</module>
|
55 |
+
<class>Mage_Core_Model_Resource_Setup</class>
|
56 |
+
</setup>
|
57 |
+
</eadsign_awb_setup>
|
58 |
+
<awb_write>
|
59 |
+
<connection>
|
60 |
+
<use>core_write</use>
|
61 |
+
</connection>
|
62 |
+
</awb_write>
|
63 |
+
<awb_read>
|
64 |
+
<connection>
|
65 |
+
<use>core_read</use>
|
66 |
+
</connection>
|
67 |
+
</awb_read>
|
68 |
+
</resources>
|
69 |
+
</global>
|
70 |
+
<adminhtml>
|
71 |
+
<events>
|
72 |
+
<controller_action_predispatch>
|
73 |
+
<observers>
|
74 |
+
<eadesigndev_awb>
|
75 |
+
<class>awb/eacore_observer</class>
|
76 |
+
<method>preDispatch</method>
|
77 |
+
</eadesigndev_awb>
|
78 |
+
</observers>
|
79 |
+
</controller_action_predispatch>
|
80 |
+
</events>
|
81 |
+
<layout>
|
82 |
+
<updates>
|
83 |
+
<awbs module="Eadesigndev_Awb">
|
84 |
+
<file>awb/awb.xml</file>
|
85 |
+
</awbs>
|
86 |
+
</updates>
|
87 |
+
</layout>
|
88 |
+
<acl>
|
89 |
+
<resources>
|
90 |
+
<admin>
|
91 |
+
<children>
|
92 |
+
<system>
|
93 |
+
<children>
|
94 |
+
<config>
|
95 |
+
<children>
|
96 |
+
<awbopt>
|
97 |
+
<title>EaDesign AWB</title>
|
98 |
+
</awbopt>
|
99 |
+
</children>
|
100 |
+
</config>
|
101 |
+
</children>
|
102 |
+
</system>
|
103 |
+
</children>
|
104 |
+
</admin>
|
105 |
+
</resources>
|
106 |
+
</acl>
|
107 |
+
</adminhtml>
|
108 |
+
<admin>
|
109 |
+
<routers>
|
110 |
+
<awbadmin>
|
111 |
+
<use>admin</use>
|
112 |
+
<args>
|
113 |
+
<module>Eadesigndev_Awb</module>
|
114 |
+
<frontName>awbadmin</frontName>
|
115 |
+
</args>
|
116 |
+
</awbadmin>
|
117 |
+
</routers>
|
118 |
+
</admin>
|
119 |
+
</config>
|
app/code/local/Eadesigndev/Awb/etc/system.xml
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<eadesigndevconfig translate="label" module="awb">
|
5 |
+
<label>EaDesign</label>
|
6 |
+
<sort_order>999</sort_order>
|
7 |
+
</eadesigndevconfig>
|
8 |
+
</tabs>
|
9 |
+
|
10 |
+
<sections>
|
11 |
+
<awbopt translate="label" module="awb"> <!--Sections meniu stanga activ cu click-->
|
12 |
+
<label>EaDesign AWB</label>
|
13 |
+
<tab>eadesigndevconfig</tab>
|
14 |
+
<frontend_type>text</frontend_type>
|
15 |
+
<sort_order>1000</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>1</show_in_store>
|
19 |
+
<groups>
|
20 |
+
<urgent_opt translate="label">
|
21 |
+
<label>Urgent</label>
|
22 |
+
<frontend_type>text</frontend_type>
|
23 |
+
<sort_order>1</sort_order>
|
24 |
+
<show_in_default>1</show_in_default>
|
25 |
+
<show_in_website>1</show_in_website>
|
26 |
+
<show_in_store>1</show_in_store>
|
27 |
+
<fields>
|
28 |
+
<active translate="label">
|
29 |
+
<label>Activat</label>
|
30 |
+
<frontend_type>select</frontend_type>
|
31 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
32 |
+
<sort_order>1</sort_order>
|
33 |
+
<show_in_default>1</show_in_default>
|
34 |
+
<show_in_website>1</show_in_website>
|
35 |
+
<show_in_store>0</show_in_store>
|
36 |
+
</active>
|
37 |
+
<username translate="label">
|
38 |
+
<label>Cont utilizator</label>
|
39 |
+
<frontend_type>text</frontend_type>
|
40 |
+
<sort_order>2</sort_order>
|
41 |
+
<show_in_default>1</show_in_default>
|
42 |
+
<show_in_website>1</show_in_website>
|
43 |
+
<show_in_store>1</show_in_store>
|
44 |
+
</username>
|
45 |
+
<password translate="label">
|
46 |
+
<label>Parola</label>
|
47 |
+
<frontend_type>password</frontend_type>
|
48 |
+
<sort_order>3</sort_order>
|
49 |
+
<show_in_default>1</show_in_default>
|
50 |
+
<show_in_website>1</show_in_website>
|
51 |
+
<show_in_store>1</show_in_store>
|
52 |
+
</password>
|
53 |
+
<plantarifar translate="label" module="core">
|
54 |
+
<label>Plan tarifar</label>
|
55 |
+
<frontend_type>select</frontend_type>
|
56 |
+
<source_model>awb/system_plantarifar</source_model>
|
57 |
+
<sort_order>4</sort_order>
|
58 |
+
<show_in_default>1</show_in_default>
|
59 |
+
<show_in_website>1</show_in_website>
|
60 |
+
<show_in_store>1</show_in_store>
|
61 |
+
</plantarifar>
|
62 |
+
<punctridicare translate="label" module="core">
|
63 |
+
<label>Punct ridicare</label>
|
64 |
+
<frontend_type>select</frontend_type>
|
65 |
+
<source_model>awb/system_punctridicare</source_model>
|
66 |
+
<sort_order>5</sort_order>
|
67 |
+
<show_in_default>1</show_in_default>
|
68 |
+
<show_in_website>1</show_in_website>
|
69 |
+
<show_in_store>1</show_in_store>
|
70 |
+
</punctridicare>
|
71 |
+
<platatransport translate="label" module="core">
|
72 |
+
<label>Plata transport</label>
|
73 |
+
<frontend_type>select</frontend_type>
|
74 |
+
<source_model>awb/system_platatransport</source_model>
|
75 |
+
<sort_order>5</sort_order>
|
76 |
+
<show_in_default>1</show_in_default>
|
77 |
+
<show_in_website>1</show_in_website>
|
78 |
+
<show_in_store>1</show_in_store>
|
79 |
+
</platatransport>
|
80 |
+
<afisare translate="label" module="core">
|
81 |
+
<label>Metoda plata</label>
|
82 |
+
<frontend_type>select</frontend_type>
|
83 |
+
<source_model>awb/system_tarifeafisate</source_model>
|
84 |
+
<sort_order>5</sort_order>
|
85 |
+
<show_in_default>1</show_in_default>
|
86 |
+
<show_in_website>1</show_in_website>
|
87 |
+
<show_in_store>1</show_in_store>
|
88 |
+
<validate>required-entry</validate>
|
89 |
+
</afisare>
|
90 |
+
<dechide translate="label">
|
91 |
+
<label>Deschidere colet</label>
|
92 |
+
<frontend_type>select</frontend_type>
|
93 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
94 |
+
<sort_order>6</sort_order>
|
95 |
+
<show_in_default>1</show_in_default>
|
96 |
+
<show_in_website>1</show_in_website>
|
97 |
+
<show_in_store>0</show_in_store>
|
98 |
+
</dechide>
|
99 |
+
<asigurare translate="label">
|
100 |
+
<label>Asigurare</label>
|
101 |
+
<frontend_type>select</frontend_type>
|
102 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
103 |
+
<sort_order>7</sort_order>
|
104 |
+
<show_in_default>1</show_in_default>
|
105 |
+
<show_in_website>1</show_in_website>
|
106 |
+
<show_in_store>0</show_in_store>
|
107 |
+
</asigurare>
|
108 |
+
<sambata translate="label">
|
109 |
+
<label>Livrare sambata</label>
|
110 |
+
<frontend_type>select</frontend_type>
|
111 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
112 |
+
<sort_order>8</sort_order>
|
113 |
+
<show_in_default>1</show_in_default>
|
114 |
+
<show_in_website>1</show_in_website>
|
115 |
+
<show_in_store>0</show_in_store>
|
116 |
+
</sambata>
|
117 |
+
<pachet translate="label" module="core">
|
118 |
+
<label>Afisare metode</label>
|
119 |
+
<frontend_type>select</frontend_type>
|
120 |
+
<source_model>awb/system_pachet</source_model>
|
121 |
+
<sort_order>9</sort_order>
|
122 |
+
<show_in_default>1</show_in_default>
|
123 |
+
<show_in_website>1</show_in_website>
|
124 |
+
<show_in_store>1</show_in_store>
|
125 |
+
<validate>required-entry</validate>
|
126 |
+
</pachet>
|
127 |
+
<update translate="label" module="core">
|
128 |
+
<label>Update Orase</label>
|
129 |
+
<frontend_type>button</frontend_type>
|
130 |
+
<frontend_model>awb/adminhtml_block_system_update</frontend_model>
|
131 |
+
<sort_order>10</sort_order>
|
132 |
+
<show_in_default>1</show_in_default>
|
133 |
+
<show_in_website>1</show_in_website>
|
134 |
+
<show_in_store>1</show_in_store>
|
135 |
+
<validate>required-entry</validate>
|
136 |
+
</update>
|
137 |
+
</fields>
|
138 |
+
</urgent_opt>
|
139 |
+
</groups>
|
140 |
+
</awbopt>
|
141 |
+
</sections>
|
142 |
+
</config>
|
app/code/local/Eadesigndev/Awb/sql/eadsign_awb_setup/mysql4-install-1.0.1.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* To change this template, choose Tools | Templates
|
4 |
+
* and open the template in the editor.
|
5 |
+
*/
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Description of mysql4-install-1
|
9 |
+
*
|
10 |
+
* @author Ea Design
|
11 |
+
*/
|
12 |
+
$installer = $this;
|
13 |
+
|
14 |
+
$installer->startSetup();
|
15 |
+
|
16 |
+
$installer->run("
|
17 |
+
DROP TABLE IF EXISTS {$this->getTable('awb/awb')};
|
18 |
+
CREATE TABLE {$this->getTable('awb/awb')} (
|
19 |
+
`awb_id` mediumint(8) unsigned NOT NULL auto_increment,
|
20 |
+
`awb_number` varchar(255) NOT NULL default '0',
|
21 |
+
`order_id` int(19) NOT NULL default '0',
|
22 |
+
`shippment_id` int(19) NOT NULL default '0',
|
23 |
+
`increment_order_id` varchar(255) NOT NULL default '0',
|
24 |
+
`increment_shippment_id` varchar(255) NOT NULL default '0',
|
25 |
+
`carrier_id` int(19) NOT NULL default '0',
|
26 |
+
`awb_pickup_id` int(19) NOT NULL,
|
27 |
+
`tip_seviciu` varchar(255) NOT NULL,
|
28 |
+
`destinatar` varchar(255) NOT NULL,
|
29 |
+
`country_id` varchar(255) NOT NULL,
|
30 |
+
`region_id` int(19) NOT NULL,
|
31 |
+
`city` varchar(255) NOT NULL,
|
32 |
+
`street` varchar(255) NOT NULL,
|
33 |
+
`telephone` varchar(255) NOT NULL,
|
34 |
+
`customer_email` varchar(255) NOT NULL,
|
35 |
+
`postcode` int(19) NOT NULL,
|
36 |
+
`plicuri` int(19) NOT NULL,
|
37 |
+
`colete` int(19) NOT NULL,
|
38 |
+
`greutate` decimal(10,2) NOT NULL,
|
39 |
+
`plata_ramburs` int(19) NOT NULL,
|
40 |
+
`plata_expeditie` int(19) NOT NULL,
|
41 |
+
`observatii` text NOT NULL,
|
42 |
+
`ramburs_numerar` decimal(10,2) NOT NULL,
|
43 |
+
`ramburs_cont_colector` decimal(10,2) NOT NULL,
|
44 |
+
`continut` varchar(500) NOT NULL,
|
45 |
+
`comentarii` varchar(500) NOT NULL,
|
46 |
+
`status` int(19) NOT NULL default '0',
|
47 |
+
`created_time` datetime NULL,
|
48 |
+
`update_time` datetime NULL,
|
49 |
+
PRIMARY KEY (`awb_id`)
|
50 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
51 |
+
");
|
52 |
+
|
53 |
+
$installer->endSetup();
|
app/code/local/Eadesigndev/Awb/sql/eadsign_awb_setup/mysql4-upgrade-1.0.1-1.0.3.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->getConnection()->addColumn($installer->getTable('awb/awb'), 'livrare_sambata', array(
|
6 |
+
'type' => Varien_Db_Ddl_Table::TYPE_BOOLEAN,
|
7 |
+
'unsigned' => true,
|
8 |
+
'nullable' => false,
|
9 |
+
'default' => '0',
|
10 |
+
'comment' => 'Dechide packet'
|
11 |
+
));
|
12 |
+
|
13 |
+
$installer->getConnection()->addColumn($installer->getTable('awb/awb'), 'deschidere_colet', array(
|
14 |
+
'type' => Varien_Db_Ddl_Table::TYPE_BOOLEAN,
|
15 |
+
'unsigned' => true,
|
16 |
+
'nullable' => false,
|
17 |
+
'default' => '0',
|
18 |
+
'comment' => 'The store id'
|
19 |
+
));
|
app/code/local/Eadesigndev/Awb/sql/eadsign_awb_setup/mysql4-upgrade-1.0.3-1.0.4.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->getConnection()->addColumn($installer->getTable('awb/awb'), 'plan_tarifar', array(
|
6 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
7 |
+
'length' =>255,
|
8 |
+
'comment' => 'Plan Tarifar'
|
9 |
+
));
|
10 |
+
|
11 |
+
|
app/code/local/Eadesigndev/Awb/sql/eadsign_awb_setup/mysql4-upgrade-1.0.4-1.0.5.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->getConnection()->addColumn($installer->getTable('awb/awb'), 'valuare_comanda', array(
|
6 |
+
'type' => Varien_Db_Ddl_Table::TYPE_DECIMAL,
|
7 |
+
'length' => '12,2',
|
8 |
+
'comment' => 'Valuare comanda'
|
9 |
+
));
|
10 |
+
|
11 |
+
|
app/code/local/Eadesigndev/Awb/sql/eadsign_awb_setup/mysql4-upgrade-1.0.5-1.0.6.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->getConnection()->addColumn($installer->getTable('awb/awb'), 'company', array(
|
6 |
+
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
|
7 |
+
'length' =>500,
|
8 |
+
'comment' => 'Firma pentru livrare'
|
9 |
+
));
|
10 |
+
|
11 |
+
|
app/code/local/Eadesigndev/Awb/sql/eadsign_awb_setup/mysql4-upgrade-1.0.6-1.0.7.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->run("
|
6 |
+
CREATE TABLE IF NOT EXISTS {$this->getTable('awb/awbcity')} (
|
7 |
+
`city_id` mediumint(8) unsigned NOT NULL auto_increment,
|
8 |
+
`country_id` varchar(4) NOT NULL default '0',
|
9 |
+
`region_id` varchar(4) NOT NULL default '0',
|
10 |
+
`cityname` varchar(255) default NULL,
|
11 |
+
PRIMARY KEY (`city_id`),
|
12 |
+
KEY `FK_CITY_REGION` (`region_id`))
|
13 |
+
ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Region Cities';
|
14 |
+
");
|
15 |
+
|
16 |
+
|
app/design/adminhtml/default/default/template/eadesigndev/awb/edit/edit.phtml
ADDED
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package default_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<div class="content-header">
|
28 |
+
<h3 class="icon-head head-system-email-template"><?php echo $this->getHeaderText() ?>
|
29 |
+
<span style="font-size: 11px; color: red;">Please report all bugs or ask questions at the following address: <a href="mailto:magentodevel@eadesign.ro">Bug and contact email</a> </span>
|
30 |
+
</h3>
|
31 |
+
<p class="content-buttons form-buttons">
|
32 |
+
<?php echo $this->getBackButtonHtml(); ?>
|
33 |
+
<?php echo $this->getResetButtonHtml(); ?>
|
34 |
+
<?php if ($this->getEditMode()): ?>
|
35 |
+
<?php echo $this->getDeleteButtonHtml(); ?>
|
36 |
+
<?php endif ?>
|
37 |
+
|
38 |
+
<?php echo $this->getApproveButtonHtml(); ?>
|
39 |
+
<?php echo $this->getSaveButtonHtml(); ?>
|
40 |
+
<?php echo $this->getSaveContinueButtonHtml(); ?>
|
41 |
+
</p>
|
42 |
+
</div>
|
43 |
+
|
44 |
+
<form action="<?php echo $this->getSaveUrl() ?>" method="post" id="awb_template_new_form">
|
45 |
+
<?php echo $this->getBlockHtml('formkey') ?>
|
46 |
+
<fieldset>
|
47 |
+
<?php echo $this->getFormHtml() ?>
|
48 |
+
</fieldset>
|
49 |
+
</form>
|
50 |
+
|
51 |
+
<script type="text/javascript">
|
52 |
+
//<![CDATA[
|
53 |
+
|
54 |
+
Event.observe($('region_id'), 'change', function (event) {
|
55 |
+
var selectCountry = 'RO';
|
56 |
+
var selectedRegion = $('region_id').value;
|
57 |
+
getAjaxReqestAdminAwb(selectCountry, selectedRegion)
|
58 |
+
|
59 |
+
});
|
60 |
+
|
61 |
+
|
62 |
+
function getAjaxReqestAdminAwb(selectCountry, selectedRegion) {
|
63 |
+
var action = '<?php echo $this->getUrl('awbadmin/adminhtml_index/cities'); ?>';
|
64 |
+
var city = $('city');
|
65 |
+
|
66 |
+
new Ajax.Request(action,
|
67 |
+
{
|
68 |
+
method: 'GET',
|
69 |
+
onSuccess: function (data) {
|
70 |
+
city.replace('<select id="city" name="city" class="required-entry select">' +
|
71 |
+
'<option value=""></option>' + convertJsonToHtmlOrder(data.responseText, this) +
|
72 |
+
'</select>');
|
73 |
+
},
|
74 |
+
onFailure: console.log('bug notice'),
|
75 |
+
parameters: {city_id: selectedRegion, country_id: selectCountry}
|
76 |
+
}
|
77 |
+
);
|
78 |
+
}
|
79 |
+
|
80 |
+
function convertJsonToHtmlOrder(data, ship, normalImput) {
|
81 |
+
|
82 |
+
var jsonData = data.evalJSON();
|
83 |
+
|
84 |
+
if (jsonData.length == 0) {
|
85 |
+
return;
|
86 |
+
}
|
87 |
+
htmlData = '';
|
88 |
+
|
89 |
+
jsonData.each(function (item) {
|
90 |
+
htmlData += '<option value="' + item.cityname + '">' + item.cityname + '</option>';
|
91 |
+
|
92 |
+
});
|
93 |
+
|
94 |
+
return htmlData;
|
95 |
+
}
|
96 |
+
|
97 |
+
//]]>
|
98 |
+
</script>
|
99 |
+
<!--Need to check here for the preview url-->
|
100 |
+
<script type="text/javascript">
|
101 |
+
//<![CDATA[
|
102 |
+
var templateForm = new varienForm('awb_template_new_form');
|
103 |
+
var templatePreviewForm = new varienForm('awb_template_new_form');
|
104 |
+
var url = '<?php echo $this->getSaveAndContinueUrl() ?>';
|
105 |
+
var templateControl = {
|
106 |
+
unconvertedText: '',
|
107 |
+
typeChange: false,
|
108 |
+
variables: null,
|
109 |
+
init: function () {
|
110 |
+
if ($('convert_button_back')) {
|
111 |
+
$('convert_button_back').hide();
|
112 |
+
}
|
113 |
+
//this.renderPaths(, 'used_default_for');
|
114 |
+
//this.renderPaths(, 'used_currently_for');
|
115 |
+
},
|
116 |
+
stripTags: function () {
|
117 |
+
if(!window.confirm("<?php echo $this->__('Are you sure that you want to strip tags?') ?>")) {
|
118 |
+
return false;
|
119 |
+
}
|
120 |
+
this.unconvertedText = $('template_text').value;
|
121 |
+
$('convert_button').hide();
|
122 |
+
$('template_text').value = $('template_text').value.stripScripts().replace(
|
123 |
+
new RegExp('<style[^>]*>[\\S\\s]*?</style>', 'img'), ''
|
124 |
+
).stripTags().strip();
|
125 |
+
$('convert_button_back').show();
|
126 |
+
$('field_template_styles').hide();
|
127 |
+
this.typeChange = true;
|
128 |
+
return false;
|
129 |
+
},
|
130 |
+
unStripTags: function () {
|
131 |
+
$('convert_button').show();
|
132 |
+
$('convert_button_back').hide();
|
133 |
+
$('template_text').value = this.unconvertedText;
|
134 |
+
$('field_template_styles').show();
|
135 |
+
this.typeChange = false;
|
136 |
+
return false;
|
137 |
+
},
|
138 |
+
/*
|
139 |
+
* We save - need to chack maybe save and continue!
|
140 |
+
*/
|
141 |
+
save: function() {
|
142 |
+
if (this.typeChange) {
|
143 |
+
$('change_flag_element').value = '1';
|
144 |
+
}
|
145 |
+
templateForm.submit();
|
146 |
+
return false;
|
147 |
+
},
|
148 |
+
|
149 |
+
saveandcontinue: function() {
|
150 |
+
if (this.typeChange) {
|
151 |
+
$('change_flag_element').value = '1';
|
152 |
+
}
|
153 |
+
templateForm.submit(url);
|
154 |
+
//window.location.href = '<?php echo $this->getDeleteUrl() ?>';
|
155 |
+
return false;
|
156 |
+
},
|
157 |
+
|
158 |
+
/*
|
159 |
+
*We use in order to aller delete - migh be used for other purpose also
|
160 |
+
*/
|
161 |
+
// deleteTemplate: function() {
|
162 |
+
// if(window.confirm("<?php //echo $this->__('Are you sure that you want to delete this template?') ?>//")) {
|
163 |
+
// window.location.href = '<?php //echo $this->getDeleteUrl() ?>//';
|
164 |
+
// }
|
165 |
+
// },
|
166 |
+
|
167 |
+
approveTemplate: function() {
|
168 |
+
if (this.typeChange) {
|
169 |
+
$('change_flag_element').value = '1';
|
170 |
+
}
|
171 |
+
templateForm.submit('<?php echo $this->getApproveUrl() ?>');
|
172 |
+
return false;
|
173 |
+
},
|
174 |
+
|
175 |
+
|
176 |
+
renderPaths: function(paths, fieldId){
|
177 |
+
var field = $(fieldId);
|
178 |
+
if(field){
|
179 |
+
field.down('td').next('td').update(this.parsePath(paths, '<span class="path-delimiter"> -> </span>', '<br />'));
|
180 |
+
}
|
181 |
+
},
|
182 |
+
|
183 |
+
parsePath: function (value, pathDelimiter, lineDelimiter) {
|
184 |
+
if (Object.isArray(value)) {
|
185 |
+
var result = [];
|
186 |
+
for (var i = 0, len = value.length; i < len; i++) {
|
187 |
+
result.push(this.parsePath(value[i], pathDelimiter, pathDelimiter));
|
188 |
+
}
|
189 |
+
return result.join(lineDelimiter);
|
190 |
+
}
|
191 |
+
|
192 |
+
if(!Object.isString(value) && value.title) {
|
193 |
+
value = (value.url ? '<a href="' + value.url + '">' + value.title + '</a>' : value.title) + (value.scope ? ' <span class="path-scope-label">(' + value.scope + ')</span>' : '');
|
194 |
+
}
|
195 |
+
|
196 |
+
return value;
|
197 |
+
}
|
198 |
+
|
199 |
+
|
200 |
+
|
201 |
+
/**
|
202 |
+
* we will use this to insert variable in other non editor fields - not to be used with edotor area!!!
|
203 |
+
*/
|
204 |
+
};
|
205 |
+
|
206 |
+
templateControl.init();
|
207 |
+
|
208 |
+
//]]>
|
209 |
+
</script>
|
app/design/adminhtml/default/default/template/eadesigndev/awb/list.phtml
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package default_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<div class="content-header">
|
28 |
+
<table cellspacing="0">
|
29 |
+
<tr>
|
30 |
+
<td style="width:50%;">
|
31 |
+
<h3 class="icon-head head-pdf-grid-template"><?php echo $this->getHeaderText() ?>
|
32 |
+
<span style="font-size: 11px; color: red">Please report all bugs or ask questions at the following address: <a href="mailto:magentodevel@eadesign.ro">Bug and contact email</a> </span>
|
33 |
+
</h3>
|
34 |
+
</td>
|
35 |
+
</tr>
|
36 |
+
</table>
|
37 |
+
</div>
|
38 |
+
<div>
|
39 |
+
<?php echo $this->getChildHtml('grid') ?>
|
40 |
+
</div>
|
app/etc/modules/Eadesigndev_Awb.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Eadesigndev_Awb>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Eadesigndev_Awb>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Eadesigndev_Awb</name>
|
4 |
+
<version>1.0.7</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">Extension license name (OSL v3.0)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>The extension will generate the AWB for the Urgent Courier shipments.</summary>
|
10 |
+
<description>The Urgent AWB extension will be available for all users which will generate directly the AWB and to set in Admin specific settings for this.</description>
|
11 |
+
<notes>The first stable version for urgent cargus AWB.</notes>
|
12 |
+
<authors><author><name>EaDesign</name><user>eadesign</user><email>office@eadesign.ro</email></author></authors>
|
13 |
+
<date>2015-10-12</date>
|
14 |
+
<time>10:13:28</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Eadesigndev"><dir name="Awb"><dir name="Block"><dir name="Adminhtml"><dir name="Block"><dir name="System"><file name="Update.php" hash="d03dacbcd98394e72adc262c2aff3d81"/></dir></dir><dir name="Template"><dir name="Awb"><dir name="Edit"><dir name="Tabs"><file name="Curier.php" hash="dfb2470e6ad6a267eed847b309ec77a9"/><file name="General.php" hash="b26924c9f5f594ce307c5375e20c68fd"/></dir><file name="Tabs.php" hash="c7b0691c71a8b40805304cc4fbbea61f"/></dir><file name="Edit.php" hash="78b15f0ea278865873bd3a535db44fb2"/><file name="Grid.php" hash="8bd24618c90afb869fa3be37398f072b"/></dir><file name="Awb.php" hash="6bfb2b2498abe6b88c85f4c713b1b03e"/></dir></dir></dir><dir name="Helper"><file name="City.php" hash="5a9264ab3a7446030e79096cd99d8785"/><file name="Data.php" hash="c187ac74d9f262e7d3e3b01987e103dd"/><file name="Update.php" hash="b86a8b75079889a3826814b568cc5eb0"/><file name="Urgent.php" hash="825758da1e3b9ea77260967f4d7bc8ee"/></dir><dir name="Model"><file name="Awb.php" hash="d06268c2dcc85b7cd8c16ec04261b772"/><file name="Awbcity.php" hash="bbd3ce7cc4de5509d9a96972ee5bc2a2"/><dir name="Eacore"><file name="Feed.php" hash="e3f5332c220a13c83824eeb4aba411fb"/><file name="Observer.php" hash="398d15e59b8606119fadecb459655d49"/></dir><dir name="Mysql4"><dir name="Awb"><file name="Collection.php" hash="072c42994025f03cf8e3c3a9780e90f8"/></dir><file name="Awb.php" hash="c22ec37725f7b0b54b55fdf6e0b9f3ce"/><dir name="Awbcity"><file name="Collection.php" hash="06d0fe46e5e5126bcb4a2bdc4289322b"/></dir><file name="Awbcity.php" hash="b815842f9a8d025c593e0a90daa04f3c"/></dir><file name="Observer.php" hash="5e6dbba3024fcee338a1267f1d9bd36a"/><dir name="System"><file name="Abstract.php" hash="0f70b432b52dd7ff411e1e5329e9f171"/><file name="Pachet.php" hash="3261d557f4e59e1b0475466b349373d7"/><file name="Plantarifar.php" hash="8aa64b5531bbcdbb806886f039bca18b"/><file name="Platatransport.php" hash="d7f33fa5d50ac58ce3a0ae905267ff38"/><file name="Punctridicare.php" hash="f509bfd5983308de2ef2e11a58debd28"/><file name="Tarifeafisate.php" hash="9f31170ff36ef1aac05f6f204488b753"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="1d81318e01b93c3655be53266927c6ac"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="d140eac67b1633c94d135d3a3f36f700"/><file name="config.xml" hash="a625762661152328330408aa87facdf2"/><file name="system.xml" hash="95c1bc79374621d985aaa6ea2217a210"/></dir><dir name="sql"><dir name="eadsign_awb_setup"><file name="mysql4-install-1.0.1.php" hash="054c77e1def92b2a4ed36d4e3b3e8698"/><file name="mysql4-upgrade-1.0.1-1.0.3.php" hash="00b9a49697badbef44dfba319db37d2e"/><file name="mysql4-upgrade-1.0.3-1.0.4.php" hash="9e1ca1cf86afa550047ed09123f292a5"/><file name="mysql4-upgrade-1.0.4-1.0.5.php" hash="71b3f046b07d8eaa55f52c8bb742e349"/><file name="mysql4-upgrade-1.0.5-1.0.6.php" hash="99ddb72c91ae1cc46f3a836467330411"/><file name="mysql4-upgrade-1.0.6-1.0.7.php" hash="04e131f04b2dcdf00ae96c26bfb590d4"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="eadesigndev"><dir name="awb"><dir name="edit"><file name="edit.phtml" hash="70aa8d99b26cd6f6a1aeefb1c8082b71"/></dir><file name="list.phtml" hash="f55378bb66a0f6091edaa3ff92785a64"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Eadesigndev_Awb.xml" hash="5b7cea4f08a7a4f6d62b232c621ff3ea"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>5.6.3</max></php></required></dependencies>
|
18 |
+
</package>
|