zitec_dpd - Version 1.0.3

Version Notes

released first version

Download this release

Release Info

Developer Zitec
Extension zitec_dpd
Version 1.0.3
Comparing to
See all releases


Version 1.0.3

Files changed (202) hide show
  1. app/code/community/Zitec/Dpd/Block/Addresslength.php +138 -0
  2. app/code/community/Zitec/Dpd/Block/Adminhtml/Customer/Edit/Form/Addresslength.php +80 -0
  3. app/code/community/Zitec/Dpd/Block/Adminhtml/Order/Totals/Cashondeliverysurcharge/Newcreditmemo.php +39 -0
  4. app/code/community/Zitec/Dpd/Block/Adminhtml/Sales/Order/Address/Form/Addresslength.php +107 -0
  5. app/code/community/Zitec/Dpd/Block/Adminhtml/Sales/Order/Shipment/View.php +75 -0
  6. app/code/community/Zitec/Dpd/Block/Adminhtml/Sales/Order/Shipment/View/Tracking.php +81 -0
  7. app/code/community/Zitec/Dpd/Block/Adminhtml/Sales/Shipment/Grid.php +119 -0
  8. app/code/community/Zitec/Dpd/Block/Adminhtml/Sales/Shipment/Grid/Renderer/Manifest.php +52 -0
  9. app/code/community/Zitec/Dpd/Block/Adminhtml/Shipment/Postcode/Autocompleter.php +31 -0
  10. app/code/community/Zitec/Dpd/Block/Adminhtml/System/Config/Button/Export.php +48 -0
  11. app/code/community/Zitec/Dpd/Block/Adminhtml/Tablerate/Grid.php +155 -0
  12. app/code/community/Zitec/Dpd/Block/Checkout/Onepage/Addresslength.php +37 -0
  13. app/code/community/Zitec/Dpd/Block/Customer/Address/Edit/Addresslength.php +37 -0
  14. app/code/community/Zitec/Dpd/Block/Order/Creditmemo/Totals/Cashondeliverysurcharge.php +72 -0
  15. app/code/community/Zitec/Dpd/Block/Order/Invoice/Totals/Cashondeliverysurcharge.php +72 -0
  16. app/code/community/Zitec/Dpd/Block/Order/Totals/Cashondeliverysurchage.php +161 -0
  17. app/code/community/Zitec/Dpd/Block/Tax/Checkout/Cashondeliverysurchage.php +126 -0
  18. app/code/community/Zitec/Dpd/Helper/Compatibility.php +77 -0
  19. app/code/community/Zitec/Dpd/Helper/Data.php +595 -0
  20. app/code/community/Zitec/Dpd/Helper/Layout.php +107 -0
  21. app/code/community/Zitec/Dpd/Helper/Payment.php +57 -0
  22. app/code/community/Zitec/Dpd/Helper/Postcode/Search.php +182 -0
  23. app/code/community/Zitec/Dpd/Helper/Ws.php +396 -0
  24. app/code/community/Zitec/Dpd/Model/Config/Data/Abstract.php +75 -0
  25. app/code/community/Zitec/Dpd/Model/Config/Data/Mode.php +66 -0
  26. app/code/community/Zitec/Dpd/Model/Config/Data/Tablerate.php +47 -0
  27. app/code/community/Zitec/Dpd/Model/Config/Source/Abstract.php +58 -0
  28. app/code/community/Zitec/Dpd/Model/Config/Source/Order/Status/Pendingpayment.php +30 -0
  29. app/code/community/Zitec/Dpd/Model/Config/Source/Service.php +113 -0
  30. app/code/community/Zitec/Dpd/Model/Config/Source/Wscountry.php +57 -0
  31. app/code/community/Zitec/Dpd/Model/Dpd/Manifest.php +297 -0
  32. app/code/community/Zitec/Dpd/Model/Dpd/Pickup.php +41 -0
  33. app/code/community/Zitec/Dpd/Model/Dpd/Ship.php +40 -0
  34. app/code/community/Zitec/Dpd/Model/Mysql4/Carrier/Tablerate.php +735 -0
  35. app/code/community/Zitec/Dpd/Model/Mysql4/Carrier/Tablerate/Collection.php +109 -0
  36. app/code/community/Zitec/Dpd/Model/Mysql4/Dpd/Manifest.php +57 -0
  37. app/code/community/Zitec/Dpd/Model/Mysql4/Dpd/Pickup.php +34 -0
  38. app/code/community/Zitec/Dpd/Model/Mysql4/Dpd/Ship.php +41 -0
  39. app/code/community/Zitec/Dpd/Model/Mysql4/Dpd/Ship/Collection.php +92 -0
  40. app/code/community/Zitec/Dpd/Model/Observer/Address.php +179 -0
  41. app/code/community/Zitec/Dpd/Model/Observer/Manifest.php +54 -0
  42. app/code/community/Zitec/Dpd/Model/Observer/Payment.php +60 -0
  43. app/code/community/Zitec/Dpd/Model/Observer/Pickup.php +80 -0
  44. app/code/community/Zitec/Dpd/Model/Observer/Shipment.php +455 -0
  45. app/code/community/Zitec/Dpd/Model/Payment/Cashondelivery.php +213 -0
  46. app/code/community/Zitec/Dpd/Model/Payment/Cashondelivery/Source/AmountType.php +41 -0
  47. app/code/community/Zitec/Dpd/Model/Payment/Cashondelivery/Source/Codpaymenttype.php +42 -0
  48. app/code/community/Zitec/Dpd/Model/Payment/Cashondelivery/Source/Country.php +64 -0
  49. app/code/community/Zitec/Dpd/Model/Payment/Cashondelivery/Source/Service.php +66 -0
  50. app/code/community/Zitec/Dpd/Model/Sales/Order/Creditmemo/Total/Cashondeliverysurchage.php +62 -0
  51. app/code/community/Zitec/Dpd/Model/Sales/Order/Creditmemo/Total/Tax.php +50 -0
  52. app/code/community/Zitec/Dpd/Model/Sales/Order/Invoice/Total/Cashondeliverysurchage.php +61 -0
  53. app/code/community/Zitec/Dpd/Model/Sales/Order/Invoice/Total/Tax.php +60 -0
  54. app/code/community/Zitec/Dpd/Model/Sales/Order/Pdf/Total/Cashondeliverysurchage.php +114 -0
  55. app/code/community/Zitec/Dpd/Model/Sales/Order/Total/Cashondeliverysurchage.php +42 -0
  56. app/code/community/Zitec/Dpd/Model/Sales/Quote/Address/Total/Cashondeliverysurchage.php +183 -0
  57. app/code/community/Zitec/Dpd/Model/Shipping/Carrier/Abstract.php +88 -0
  58. app/code/community/Zitec/Dpd/Model/Shipping/Carrier/Dpd.php +542 -0
  59. app/code/community/Zitec/Dpd/controllers/Adminhtml/ConfigController.php +39 -0
  60. app/code/community/Zitec/Dpd/controllers/Adminhtml/ShipmentController.php +463 -0
  61. app/code/community/Zitec/Dpd/etc/adminhtml.xml +75 -0
  62. app/code/community/Zitec/Dpd/etc/config.xml +398 -0
  63. app/code/community/Zitec/Dpd/etc/system.xml +380 -0
  64. app/code/community/Zitec/Dpd/sql/zitec_dpd_setup/mysql4-install-1.0.0.php +209 -0
  65. app/code/community/Zitec/Dpd/sql/zitec_dpd_setup/mysql4-upgrade-1.0.0-1.0.1.php +44 -0
  66. app/code/community/Zitec/Dpd/sql/zitec_dpd_setup/mysql4-upgrade-1.0.1-1.0.2.php +37 -0
  67. app/code/community/Zitec/Dpd/sql/zitec_dpd_setup/mysql4-upgrade-1.0.2-1.0.3.php +38 -0
  68. app/code/community/Zitec/PackedShipment/Block/Addressvalidationdialog.php +105 -0
  69. app/code/community/Zitec/PackedShipment/Block/Addressvalidationinfojs.php +130 -0
  70. app/code/community/Zitec/PackedShipment/Helper/Data.php +143 -0
  71. app/code/community/Zitec/PackedShipment/Model/Carrier/Interface.php +97 -0
  72. app/code/community/Zitec/PackedShipment/Model/Package.php +272 -0
  73. app/code/community/Zitec/PackedShipment/Model/PackedShipment.php +51 -0
  74. app/code/community/Zitec/PackedShipment/controllers/Adminhtml/IndexController.php +119 -0
  75. app/code/community/Zitec/PackedShipment/etc/config.xml +61 -0
  76. app/code/community/Zitec/PrintShippingLabel/Block/Adminhtml/Sales/Order/Shipment/View.php +64 -0
  77. app/code/community/Zitec/PrintShippingLabel/Block/Adminhtml/Sales/View.php +69 -0
  78. app/code/community/Zitec/PrintShippingLabel/Helper/Data.php +29 -0
  79. app/code/community/Zitec/PrintShippingLabel/controllers/Adminhtml/IndexController.php +148 -0
  80. app/code/community/Zitec/PrintShippingLabel/etc/config.xml +89 -0
  81. app/code/community/Zitec/ReportsCommon/Block/RecordsReport/Grid.php +631 -0
  82. app/code/community/Zitec/ReportsCommon/Block/Renderer/Posnegcurrency.php +43 -0
  83. app/code/community/Zitec/ReportsCommon/Controller/Adminhtml/RecordsreportController.php +115 -0
  84. app/code/community/Zitec/ReportsCommon/Helper/Data.php +29 -0
  85. app/code/community/Zitec/ReportsCommon/etc/adminhtml.xml +32 -0
  86. app/code/community/Zitec/ReportsCommon/etc/config.xml +21 -0
  87. app/code/community/Zitec/ShippingReports/Block/Adminhtml/Profitability.php +47 -0
  88. app/code/community/Zitec/ShippingReports/Block/Adminhtml/Profitability/Grid.php +126 -0
  89. app/code/community/Zitec/ShippingReports/Block/Adminhtml/Profitability/Renderer/Orderref.php +39 -0
  90. app/code/community/Zitec/ShippingReports/Helper/Data.php +28 -0
  91. app/code/community/Zitec/ShippingReports/Model/Mysql4/Profitability/Collection.php +72 -0
  92. app/code/community/Zitec/ShippingReports/Model/Observer/Order.php +58 -0
  93. app/code/community/Zitec/ShippingReports/Model/Observer/Shipment.php +89 -0
  94. app/code/community/Zitec/ShippingReports/controllers/Adminhtml/Reports/ProfitabilityController.php +35 -0
  95. app/code/community/Zitec/ShippingReports/etc/adminhtml.xml +43 -0
  96. app/code/community/Zitec/ShippingReports/etc/config.xml +79 -0
  97. app/code/community/Zitec/ShippingReports/sql/zitec_shippingreports_setup/mysql4-install-1.0.0.php +41 -0
  98. app/code/community/Zitec/TableRates/Block/Adminhtml/Tablerate.php +75 -0
  99. app/code/community/Zitec/TableRates/Block/Adminhtml/Tablerate/Edit.php +357 -0
  100. app/code/community/Zitec/TableRates/Block/Adminhtml/Tablerate/Edit/Form.php +277 -0
  101. app/code/community/Zitec/TableRates/Block/Adminhtml/Tablerate/Export.php +62 -0
  102. app/code/community/Zitec/TableRates/Block/Adminhtml/Tablerate/Export/Form.php +75 -0
  103. app/code/community/Zitec/TableRates/Block/Adminhtml/Tablerate/Grid.php +351 -0
  104. app/code/community/Zitec/TableRates/Block/Adminhtml/Tablerate/Grid/Renderer/Shippingpercentage.php +38 -0
  105. app/code/community/Zitec/TableRates/Block/Adminhtml/Tablerate/Import.php +61 -0
  106. app/code/community/Zitec/TableRates/Block/Adminhtml/Tablerate/Import/Form.php +78 -0
  107. app/code/community/Zitec/TableRates/Block/Adminhtml/Widget/Grid/Column/Filter/Region.php +41 -0
  108. app/code/community/Zitec/TableRates/Helper/Data.php +267 -0
  109. app/code/community/Zitec/TableRates/Helper/Directory.php +76 -0
  110. app/code/community/Zitec/TableRates/Model/Mysql4/Tablerate.php +181 -0
  111. app/code/community/Zitec/TableRates/Model/Mysql4/Tablerate/Collection.php +92 -0
  112. app/code/community/Zitec/TableRates/Model/Source/Website.php +55 -0
  113. app/code/community/Zitec/TableRates/Model/Tablerate.php +89 -0
  114. app/code/community/Zitec/TableRates/controllers/Adminhtml/IndexController.php +462 -0
  115. app/code/community/Zitec/TableRates/etc/adminhtml.xml +21 -0
  116. app/code/community/Zitec/TableRates/etc/config.xml +101 -0
  117. app/design/adminhtml/default/default/layout/zitec_dpd.xml +94 -0
  118. app/design/adminhtml/default/default/layout/zitec_packedshipment.xml +34 -0
  119. app/design/adminhtml/default/default/layout/zitec_shippingreports.xml +8 -0
  120. app/design/adminhtml/default/default/layout/zitec_tablerates.xml +38 -0
  121. app/design/adminhtml/default/default/template/zitec_dpd/sales/order/address/postcode/alert-problem.phtml +25 -0
  122. app/design/adminhtml/default/default/template/zitec_dpd/sales/order/address/postcode/validate.phtml +38 -0
  123. app/design/adminhtml/default/default/template/zitec_dpd/sales/order/address/street/alert-problem.phtml +23 -0
  124. app/design/adminhtml/default/default/template/zitec_dpd/sales/order/shipment/postcode/autocompleter.phtml +15 -0
  125. app/design/adminhtml/default/default/template/zitec_dpd/sales/order/shipment/view/tracking.phtml +87 -0
  126. app/design/adminhtml/default/default/template/zitec_dpd/sales/order/shipment/view/tracking_17.phtml +87 -0
  127. app/design/adminhtml/default/default/template/zitec_packedshipment/sales/order/shipment/create/address_validation_dialog.phtml +142 -0
  128. app/design/adminhtml/default/default/template/zitec_packedshipment/sales/order/shipment/create/address_validation_info_js.phtml +18 -0
  129. app/design/adminhtml/default/default/template/zitec_packedshipment/sales/order/shipment/create/items.phtml +363 -0
  130. app/design/adminhtml/default/default/template/zitec_reportscommon/records_report_container.phtml +27 -0
  131. app/design/adminhtml/default/default/template/zitec_reportscommon/records_report_grid.phtml +215 -0
  132. app/design/frontend/base/default/layout/zitec_dpd.xml +79 -0
  133. app/design/frontend/base/default/template/zitec_dpd/customer/address/edit/addresslength.phtml +1 -0
  134. app/design/frontend/base/default/template/zitec_dpd/shipping/tracking/popup.phtml +178 -0
  135. app/design/frontend/base/default/template/zitec_dpd/tax/checkout/cashondeliverysurchage.phtml +38 -0
  136. app/etc/modules/Zitec_Dpd.xml +11 -0
  137. app/etc/modules/Zitec_FieldLengths.xml +9 -0
  138. app/etc/modules/Zitec_PackedShipment.xml +11 -0
  139. app/etc/modules/Zitec_PrintShippingLabel.xml +9 -0
  140. app/etc/modules/Zitec_ReportsCommon.xml +8 -0
  141. app/etc/modules/Zitec_ShippingReports.xml +11 -0
  142. app/etc/modules/Zitec_TableRates.xml +9 -0
  143. app/locale/en_GB/Zitec_Dpd.csv +182 -0
  144. app/locale/en_GB/Zitec_PackedShipment.csv +20 -0
  145. app/locale/en_GB/Zitec_PrintShippingLabel.csv +1 -0
  146. app/locale/en_GB/Zitec_TableRates.csv +78 -0
  147. app/locale/en_US/Zitec_Dpd.csv +141 -0
  148. app/locale/en_US/Zitec_PackedShipment.csv +20 -0
  149. app/locale/en_US/Zitec_PrintShippingLabel.csv +1 -0
  150. app/locale/en_US/Zitec_TableRates.csv +78 -0
  151. app/locale/es_ES/Zitec_Dpd.csv +140 -0
  152. app/locale/es_ES/Zitec_PackedShipment.csv +20 -0
  153. app/locale/es_ES/Zitec_TableRates.csv +79 -0
  154. app/locale/hr_HR/Zitec_Dpd.csv +137 -0
  155. app/locale/hr_HR/Zitec_PackedShipment.csv +20 -0
  156. app/locale/hr_HR/Zitec_PrintShippingLabel.csv +1 -0
  157. app/locale/hr_HR/Zitec_TableRates.csv +78 -0
  158. app/locale/ro_RO/Zitec_Dpd.csv +189 -0
  159. app/locale/ro_RO/Zitec_PackedShipment.csv +18 -0
  160. app/locale/ro_RO/Zitec_PrintShippingLabel.csv +6 -0
  161. app/locale/ro_RO/Zitec_TableRates.csv +68 -0
  162. app/locale/sl_SI/Zitec_Dpd.csv +137 -0
  163. app/locale/sl_SI/Zitec_PackedShipment.csv +20 -0
  164. app/locale/sl_SI/Zitec_PrintShippingLabel.csv +1 -0
  165. app/locale/sl_SI/Zitec_TableRates.csv +78 -0
  166. js/zitec/dpd/admin/PostcodeAutocompleter.js +16 -0
  167. js/zitec/dpd/admin/sales.js +11 -0
  168. js/zitec_fieldlengths/validator.js +58 -0
  169. js/zitec_packedshipment/packedshipment.js +632 -0
  170. lib/Zitec/Dpd/Api.php +124 -0
  171. lib/Zitec/Dpd/Api/Abstract.php +361 -0
  172. lib/Zitec/Dpd/Api/Configs.php +130 -0
  173. lib/Zitec/Dpd/Api/Manifest.php +23 -0
  174. lib/Zitec/Dpd/Api/Manifest/Close.php +140 -0
  175. lib/Zitec/Dpd/Api/Manifest/Close/Response.php +62 -0
  176. lib/Zitec/Dpd/Api/Manifest/Response.php +29 -0
  177. lib/Zitec/Dpd/Api/Pickup.php +27 -0
  178. lib/Zitec/Dpd/Api/Pickup/Create.php +161 -0
  179. lib/Zitec/Dpd/Api/Pickup/Create/Response.php +46 -0
  180. lib/Zitec/Dpd/Api/Pickup/Response.php +21 -0
  181. lib/Zitec/Dpd/Api/Response.php +138 -0
  182. lib/Zitec/Dpd/Api/Shipment.php +32 -0
  183. lib/Zitec/Dpd/Api/Shipment/CalculatePrice.php +123 -0
  184. lib/Zitec/Dpd/Api/Shipment/CalculatePrice/Response.php +110 -0
  185. lib/Zitec/Dpd/Api/Shipment/Delete.php +65 -0
  186. lib/Zitec/Dpd/Api/Shipment/Delete/Response.php +20 -0
  187. lib/Zitec/Dpd/Api/Shipment/GetLabel.php +78 -0
  188. lib/Zitec/Dpd/Api/Shipment/GetLabel/Response.php +28 -0
  189. lib/Zitec/Dpd/Api/Shipment/GetShipmentStatus.php +65 -0
  190. lib/Zitec/Dpd/Api/Shipment/GetShipmentStatus/Response.php +178 -0
  191. lib/Zitec/Dpd/Api/Shipment/Response.php +21 -0
  192. lib/Zitec/Dpd/Api/Shipment/Save.php +316 -0
  193. lib/Zitec/Dpd/Api/Shipment/Save/Exception/ReceiverAddressTooLong.php +29 -0
  194. lib/Zitec/Dpd/Api/Shipment/Save/Response.php +71 -0
  195. lib/Zitec/Dpd/Api/Soapclient.php +87 -0
  196. lib/Zitec/Dpd/ApiTest/test-dpd-calculatePrice.php +128 -0
  197. lib/Zitec/Dpd/ApiTest/test-dpd-createShipment.php +135 -0
  198. lib/Zitec/Dpd/Postcode/Search.php +162 -0
  199. lib/Zitec/Dpd/Postcode/Search/Abstract.php +140 -0
  200. lib/Zitec/Dpd/Postcode/Search/Interface.php +61 -0
  201. lib/Zitec/Dpd/Postcode/Search/Model.php +111 -0
  202. lib/Zitec/Dpd/Postcode/Search/Model/CachedData.php +4961 -0
app/code/community/Zitec/Dpd/Block/Addresslength.php ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Block_Addresslength extends Mage_Core_Block_Template
25
+ {
26
+ /**
27
+ *
28
+ * @return string
29
+ */
30
+ public function getClassName()
31
+ {
32
+ return "zitec_dpd-address-length-validate";
33
+ }
34
+
35
+ /**
36
+ *
37
+ * @return int
38
+ */
39
+ public function getMaxLength()
40
+ {
41
+ return Zitec_Dpd_Api_Configs::SHIPMENT_LIST_RECEIVER_STREET_MAX_LENGTH;
42
+ }
43
+
44
+ public function getMinLength()
45
+ {
46
+ return 35;
47
+ }
48
+
49
+ /**
50
+ *
51
+ * @return array
52
+ */
53
+ public function getFieldNames()
54
+ {
55
+ return array();
56
+ }
57
+
58
+ /**
59
+ *
60
+ * @return string
61
+ */
62
+ public function getMessage()
63
+ {
64
+ return $this->__("The total length of the address cannot be more than %s characters.", $this->getMaxLength());
65
+ }
66
+
67
+ /**
68
+ *
69
+ * @param array $fieldNames
70
+ *
71
+ * @return string
72
+ */
73
+ protected function _getHtml(array $fieldNames)
74
+ {
75
+ if (!$fieldNames) {
76
+ return '';
77
+ }
78
+
79
+ $fieldsHtml = '';
80
+ foreach ($fieldNames as $fieldName) {
81
+ $fieldsHtml .= "
82
+ field = $('{$fieldName}');
83
+ if (field) {
84
+ fields.push(field);
85
+ }";
86
+ }
87
+
88
+ $html = "
89
+ <script type='text/javascript'>
90
+ //<![CDATA[
91
+ var className = '{$this->getClassName()}',
92
+ fields = [],
93
+ field = null,
94
+ message = '{$this->getMessage()}',
95
+ maxLength = {$this->getMaxLength()},
96
+ minLength = {$this->getMinLength()};
97
+
98
+ {$fieldsHtml}
99
+
100
+ new zitecFieldLengths.Validator(className, fields, message, maxLength, minLength);
101
+ //]]>
102
+ </script>";
103
+
104
+ return $html;
105
+ }
106
+
107
+ /**
108
+ *
109
+ * @return string
110
+ */
111
+ protected function _toHtml()
112
+ {
113
+ if ($this->_showBlock()) {
114
+ return $this->_getHtml($this->getFieldNames());
115
+ } else {
116
+ return '';
117
+ }
118
+ }
119
+
120
+ /**
121
+ *
122
+ * @return boolean
123
+ */
124
+ protected function _showBlock()
125
+ {
126
+ return $this->_getHelper()->moduleIsActive();
127
+ }
128
+
129
+ /**
130
+ *
131
+ * @return Zitec_Dpd_Helper_Data
132
+ */
133
+ protected function _getHelper()
134
+ {
135
+ return Mage::helper('zitec_dpd');
136
+ }
137
+ }
138
+
app/code/community/Zitec/Dpd/Block/Adminhtml/Customer/Edit/Form/Addresslength.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Block_Adminhtml_Customer_Edit_Form_Addresslength extends Zitec_Dpd_Block_Addresslength
25
+ {
26
+
27
+
28
+ /**
29
+ *
30
+ * @return array
31
+ */
32
+ public function getFieldNames()
33
+ {
34
+ return array("street0", "street1", "street2", "street3");
35
+ }
36
+
37
+ /**
38
+ *
39
+ * @param array $fieldNames
40
+ *
41
+ * @return string
42
+ */
43
+ protected function _getHtml(array $fieldNames)
44
+ {
45
+ if (!$fieldNames) {
46
+ return '';
47
+ }
48
+
49
+ $fieldsHtml = '';
50
+ foreach ($fieldNames as $fieldName) {
51
+ $fieldsHtml .= "
52
+ field = $('{$fieldName}');
53
+ if (field) {
54
+ fields.push(field);
55
+ }";
56
+ }
57
+
58
+ $html = "
59
+ <script type='text/javascript'>
60
+ //<![CDATA[
61
+ var className = '{$this->getClassName()}',
62
+ fields = [],
63
+ field = null,
64
+ message = '{$this->getMessage()}',
65
+ maxLength = {$this->getMaxLength()},
66
+ minLength = {$this->getMinLength()};
67
+
68
+ {$fieldsHtml}
69
+
70
+ new zitecFieldLengths.Validator(className, fields, message, maxLength, minLength);
71
+ //]]>
72
+ </script>";
73
+
74
+ return $html;
75
+ }
76
+
77
+
78
+ }
79
+
80
+
app/code/community/Zitec/Dpd/Block/Adminhtml/Order/Totals/Cashondeliverysurcharge/Newcreditmemo.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Block_Adminhtml_Order_Totals_Cashondeliverysurcharge_Newcreditmemo extends Zitec_Dpd_Block_Order_Creditmemo_Totals_Cashondeliverysurcharge
25
+ {
26
+
27
+ /**
28
+ *
29
+ * @return string
30
+ */
31
+ protected function _getAfter()
32
+ {
33
+ return $this->_getConfig()->displaySalesSubtotalBoth($this->_getStore()) ? 'subtotal_incl' : 'subtotal';
34
+ }
35
+
36
+
37
+ }
38
+
39
+
app/code/community/Zitec/Dpd/Block/Adminhtml/Sales/Order/Address/Form/Addresslength.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Block_Adminhtml_Sales_Order_Address_Form_Addresslength extends Zitec_Dpd_Block_Addresslength
25
+ {
26
+
27
+ /**
28
+ *
29
+ * @return array
30
+ */
31
+ public function getFieldNames()
32
+ {
33
+ return array("street0", "street1", "street2", "street3");
34
+ }
35
+
36
+ /**
37
+ *
38
+ * @return boolean
39
+ */
40
+ protected function _showBlock()
41
+ {
42
+ return parent::_showBlock() &&
43
+ $this->_getAddress() &&
44
+ $this->_getAddress()->getAddressType() == "shipping" &&
45
+ $this->_getHelper()->isShippingMethodDpd($this->_getAddress()->getOrder()->getShippingMethod());
46
+ }
47
+
48
+ /**
49
+ *
50
+ * @return Mage_Sales_Model_Order_Address
51
+ */
52
+ protected function _getAddress()
53
+ {
54
+ return Mage::registry('order_address');
55
+ }
56
+
57
+
58
+
59
+
60
+ /**
61
+ *
62
+ * @param array $fieldNames
63
+ *
64
+ * @return string
65
+ */
66
+ protected function _getHtml(array $fieldNames)
67
+ {
68
+
69
+ $dpdCarrier = Mage::helper('zitec_dpd')->isDpdCarrierByOrder($this->_getAddress()->getOrder());
70
+ if(!$dpdCarrier){
71
+ return '';
72
+ }
73
+ if (!$fieldNames) {
74
+ return '';
75
+ }
76
+
77
+ $fieldsHtml = '';
78
+ foreach ($fieldNames as $fieldName) {
79
+ $fieldsHtml .= "
80
+ field = $('{$fieldName}');
81
+ if (field) {
82
+ fields.push(field);
83
+ }";
84
+ }
85
+
86
+ $html = "
87
+ <script type='text/javascript'>
88
+ //<![CDATA[
89
+ var className = '{$this->getClassName()}',
90
+ fields = [],
91
+ field = null,
92
+ message = '{$this->getMessage()}',
93
+ maxLength = {$this->getMaxLength()},
94
+ minLength = {$this->getMinLength()};
95
+
96
+ {$fieldsHtml}
97
+
98
+ new zitecFieldLengths.Validator(className, fields, message, maxLength, minLength);
99
+ //]]>
100
+ </script>";
101
+
102
+ return $html;
103
+ }
104
+
105
+ }
106
+
107
+
app/code/community/Zitec/Dpd/Block/Adminhtml/Sales/Order/Shipment/View.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Block_Adminhtml_Sales_Order_Shipment_View extends Mage_Adminhtml_Block_Sales_Order_Shipment_View
25
+ {
26
+
27
+
28
+ public function __construct()
29
+ {
30
+
31
+ parent::__construct();
32
+
33
+ if (!$this->_getHelper()->moduleIsActive()) {
34
+ return;
35
+ }
36
+
37
+ if (!$this->_getHelper()->isShippingMethodDpd($this->getShipment()->getOrder()->getShippingMethod()) || $this->_getHelper()->isCancelledWithDpd($this->getShipment())) {
38
+ return;
39
+ }
40
+
41
+
42
+ $isManifestClosed = $this->_getHelper()->isManifestClosed($this->getShipment()->getId());
43
+ if ($isManifestClosed) {
44
+ $onClick = 'setLocation(\'' . $this->_getManifestUrl() . '\')';
45
+ } else {
46
+ $onClick = "deleteConfirm('"
47
+ . $this->_getHelper()->__('Once the manifest is closed, you will not be able to make further changes to the shipping address. Do you want to continue?')
48
+ . "', '" . $this->_getManifestUrl() . "')";
49
+ }
50
+
51
+ $this->_addButton('closemanifest', array(
52
+ 'label' => $isManifestClosed ? $this->_getHelper()->__('Print Manifest') : $this->_getHelper()->__('Close Manifest'),
53
+ 'class' => 'save',
54
+ 'onclick' => $onClick,
55
+ 'sort_order' => -10
56
+ ));
57
+ }
58
+
59
+
60
+ protected function _getManifestUrl()
61
+ {
62
+ return Mage::helper('adminhtml')->getUrl("zitec_dpd/adminhtml_shipment/manifest", array("shipment_ids" => $this->getShipment()->getId()));
63
+ }
64
+
65
+
66
+ /**
67
+ *
68
+ * @return Zitec_Dpd_Helper_Data
69
+ */
70
+ protected function _getHelper()
71
+ {
72
+ return Mage::helper('zitec_dpd');
73
+ }
74
+
75
+ }
app/code/community/Zitec/Dpd/Block/Adminhtml/Sales/Order/Shipment/View/Tracking.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Block_Adminhtml_Sales_Order_Shipment_View_Tracking extends Mage_Adminhtml_Block_Sales_Order_Shipment_View_Tracking
25
+ {
26
+
27
+ /**
28
+ * check if the carrier code is one of DPD
29
+ *
30
+ * @return boolean
31
+ */
32
+ public function isDPD()
33
+ {
34
+ $shippingMethod = $this->getShipment()->getOrder()->getShippingMethod();
35
+
36
+ return $this->_getHelper()->isShippingMethodDpd($shippingMethod);
37
+ }
38
+
39
+
40
+ public function getShipInfo()
41
+ {
42
+ return '';
43
+ }
44
+
45
+
46
+ /**
47
+ *
48
+ * @param type $track
49
+ *
50
+ * @return string
51
+ */
52
+ public function getRemoveUrl($track)
53
+ {
54
+ if ($this->isDpdTrack($track)) {
55
+ Mage::helper('adminhtml')->getUrl("zitec_dpd/adminhtml_shipment/manifest", array("shipment_ids" => $this->getShipment()->getId()));
56
+
57
+ return $this->getUrl('zitec_dpd/adminhtml_shipment/delete/', array(
58
+ 'shipment_id' => $this->getShipment()->getId(),
59
+ 'track_id' => $track->getId()
60
+ ));
61
+ } else {
62
+ return parent::getRemoveUrl($track);
63
+ }
64
+ }
65
+
66
+
67
+ /**
68
+ *
69
+ * @return Zitec_Dpd_Helper_Data
70
+ */
71
+ protected function _getHelper()
72
+ {
73
+ return Mage::helper('zitec_dpd');
74
+ }
75
+
76
+ public function isDpdTrack(Mage_Sales_Model_Order_Shipment_Track $track)
77
+ {
78
+ return $this->_getHelper()->isDpdTrack($track);
79
+ }
80
+
81
+ }
app/code/community/Zitec/Dpd/Block/Adminhtml/Sales/Shipment/Grid.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Block_Adminhtml_Sales_Shipment_Grid extends Mage_Adminhtml_Block_Sales_Shipment_Grid
25
+ {
26
+
27
+
28
+ /**
29
+ * Prepare and add columns to grid
30
+ *
31
+ * @return Mage_Adminhtml_Block_Widget_Grid
32
+ */
33
+ protected function _prepareColumns()
34
+ {
35
+ if ($this->_getHelper()->moduleIsActive()) {
36
+ $this->addColumn('zitec_dpd_manifest', array(
37
+ 'header' => $this->_getHelper()->__('Manifest'),
38
+ 'index' => 'zitec_manifest_id',
39
+ 'type' => 'text',
40
+ 'renderer' => 'Zitec_Dpd_Block_Adminhtml_Sales_Shipment_Grid_Renderer_Manifest',
41
+ 'filter_condition_callback' => array($this, '_filterManifesto'),
42
+ ));
43
+
44
+ $this->addColumnsOrder('zitec_dpd_manifest_closed', 'total_qty');
45
+
46
+ /*
47
+ * removed column from frontend temporary
48
+ *
49
+ $this->addColumn('zitec_dpd_pickup_time', array(
50
+ 'header' => $this->_getHelper()->__('DPD Pickup'),
51
+ 'index' => 'zitec_dpd_pickup_time',
52
+ 'type' => 'text',
53
+ ));
54
+ $this->addColumnsOrder('zitec_dpd_pickup_time', 'zitec_dpd_manifest');
55
+ */
56
+
57
+ }
58
+
59
+ return parent::_prepareColumns();
60
+
61
+
62
+ }
63
+
64
+ /**
65
+ *
66
+ * @return Mage_Sales_Model_Resource_Order_Shipment_Grid_Collection
67
+ */
68
+ public function getCollection()
69
+ {
70
+ $collection = parent::getCollection();
71
+ if ($collection && !$this->getIsI4ShipsJoined()) {
72
+ /* @var $collection Mage_Sales_Model_Resource_Order_Shipment_Grid_Collection */
73
+ $resource = Mage::getSingleton('core/resource');
74
+ /* @var $resource Mage_Core_Model_Resource */
75
+ $shipsTableName = $resource->getTableName('zitec_dpd_ships');
76
+ $manifestTableName = $resource->getTableName('zitec_dpd_manifest');
77
+
78
+ $collection->getSelect()
79
+ ->joinLeft(array('ships' => $shipsTableName), 'ships.shipment_id = main_table.entity_id', array('zitec_manifest_id' => 'ships.manifest_id'))
80
+ ->joinLeft(array('manifest' => $manifestTableName), 'manifest.manifest_id = ships.manifest_id', array('zitec_manifest_ref' => 'manifest.manifest_ref'));
81
+ $this->setIsI4ShipsJoined(true);
82
+ }
83
+
84
+ return $collection;
85
+ }
86
+
87
+ /**
88
+ *
89
+ * @param Mage_Sales_Model_Resource_Order_Shipment_Grid_Collection $collection
90
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
91
+ *
92
+ * @return \Zitec_Dpd_Block_Adminhtml_Sales_Shipment_Grid
93
+ */
94
+ protected function _filterManifesto($collection, $column)
95
+ {
96
+ $manifestRef = $column->getFilter()->getCondition();
97
+ if ($manifestRef) {
98
+ $resource = Mage::getSingleton('core/resource');
99
+ /* @var $resource Mage_Core_Model_Resource */
100
+ $whereClause = $resource->getConnection("core_read")->quoteInto("manifest.manifest_ref like ? ", $manifestRef);
101
+ $collection->getSelect()
102
+ ->where($whereClause);
103
+ $debug = (string)$collection->getSelect();
104
+ }
105
+
106
+ return $this;
107
+ }
108
+
109
+ /**
110
+ *
111
+ * @return Zitec_Dpd_Helper_Data
112
+ */
113
+ protected function _getHelper()
114
+ {
115
+ return Mage::helper('zitec_dpd');
116
+ }
117
+
118
+ }
119
+
app/code/community/Zitec/Dpd/Block/Adminhtml/Sales/Shipment/Grid/Renderer/Manifest.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Block_Adminhtml_Sales_Shipment_Grid_Renderer_Manifest extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
25
+ {
26
+
27
+ public function render(Varien_Object $row)
28
+ {
29
+ $manifestId = $row->getData('zitec_manifest_id');
30
+ $manifestRef = $row->getData('zitec_manifest_ref');
31
+ if ($manifestId && $manifestRef) {
32
+ $url = $this->_getHelper()->getDownloadManifestUrl($manifestId);
33
+
34
+ return "<a href='{$url}'>{$this->_getHelper()->escapeHtml($manifestRef)}</a>";
35
+ } else {
36
+ return '';
37
+ }
38
+
39
+ }
40
+
41
+ /**
42
+ *
43
+ * @return Zitec_Dpd_Helper_Data
44
+ */
45
+ protected function _getHelper()
46
+ {
47
+ return Mage::helper('zitec_dpd');
48
+ }
49
+
50
+ }
51
+
52
+
app/code/community/Zitec/Dpd/Block/Adminhtml/Shipment/Postcode/Autocompleter.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Block_Adminhtml_Shipment_Postcode_Autocompleter extends Mage_Adminhtml_Block_Template
25
+ {
26
+
27
+
28
+
29
+
30
+ }
31
+
app/code/community/Zitec/Dpd/Block/Adminhtml/System/Config/Button/Export.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Block_Adminhtml_System_Config_Button_Export extends Mage_Adminhtml_Block_System_Config_Form_Field
25
+ {
26
+
27
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
28
+ {
29
+ $buttonBlock = $element->getForm()->getParent()->getLayout()->createBlock('adminhtml/widget_button');
30
+
31
+ $params = array(
32
+ 'website' => $buttonBlock->getRequest()->getParam('website')
33
+ );
34
+
35
+ $data = array(
36
+ 'label' => Mage::helper('adminhtml')->__('Export CSV'),
37
+ 'onclick' => 'setLocation(\'' . Mage::helper('adminhtml')->getUrl("zitec_dpd/adminhtml_config/exportTablerates", $params) . '\')',
38
+ 'class' => '',
39
+ );
40
+
41
+ $html = $buttonBlock->setData($data)->toHtml();
42
+
43
+ return $html;
44
+ }
45
+
46
+ }
47
+
48
+
app/code/community/Zitec/Dpd/Block/Adminhtml/Tablerate/Grid.php ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Block_Adminhtml_Tablerate_Grid extends Mage_Adminhtml_Block_Widget_Grid
25
+ {
26
+
27
+ /**
28
+ * Website filter
29
+ *
30
+ * @var int
31
+ */
32
+ protected $_websiteId;
33
+
34
+
35
+ /**
36
+ * Define grid properties
37
+ *
38
+ * @return void
39
+ */
40
+ public function __construct()
41
+ {
42
+ parent::__construct();
43
+ $this->setId('zitec_dpd_shippingTablerateGrid');
44
+ $this->_exportPageSize = 10000;
45
+ }
46
+
47
+
48
+ /**
49
+ * Set current website
50
+ *
51
+ * @param int $websiteId
52
+ *
53
+ * @return Mage_Adminhtml_Block_Shipping_Carrier_Tablerate_Grid
54
+ */
55
+ public function setWebsiteId($websiteId)
56
+ {
57
+ $this->_websiteId = Mage::app()->getWebsite($websiteId)->getId();
58
+
59
+ return $this;
60
+ }
61
+
62
+ /**
63
+ * Retrieve current website id
64
+ *
65
+ * @return int
66
+ */
67
+ public function getWebsiteId()
68
+ {
69
+ if (is_null($this->_websiteId)) {
70
+ $this->_websiteId = Mage::app()->getWebsite()->getId();
71
+ }
72
+
73
+ return $this->_websiteId;
74
+ }
75
+
76
+ /**
77
+ * Prepare shipping table rate collection
78
+ *
79
+ * @return Mage_Adminhtml_Block_Shipping_Carrier_Tablerate_Grid
80
+ */
81
+ protected function _prepareCollection()
82
+ {
83
+ /** @var $collection Mage_Shipping_Model_Mysql4_Carrier_Tablerate_Collection */
84
+ $collection = Mage::getResourceModel('zitec_dpd/carrier_tablerate_collection');
85
+ $collection->setWebsiteFilter($this->getWebsiteId());
86
+
87
+ $this->setCollection($collection);
88
+
89
+ return parent::_prepareCollection();
90
+ }
91
+
92
+ /**
93
+ * Prepare table columns
94
+ *
95
+ * @return Mage_Adminhtml_Block_Widget_Grid
96
+ */
97
+ protected function _prepareColumns()
98
+ {
99
+
100
+ // 'website_id', 'dest_country_id', 'dest_region_id', 'dest_zip', 'weight', 'price', 'method'
101
+ $this->addColumn('dest_country', array(
102
+ 'header' => Mage::helper('adminhtml')->__('Country'),
103
+ 'index' => 'dest_country',
104
+ 'default' => '*',
105
+ ));
106
+
107
+ $this->addColumn('dest_region', array(
108
+ 'header' => Mage::helper('adminhtml')->__('Region/State'),
109
+ 'index' => 'dest_region',
110
+ 'default' => '*',
111
+ ));
112
+
113
+ $this->addColumn('dest_zip', array(
114
+ 'header' => Mage::helper('adminhtml')->__('Zip/Postal Code'),
115
+ 'index' => 'dest_zip',
116
+ 'default' => '*',
117
+ ));
118
+
119
+ $this->addColumn('weight', array(
120
+ 'header' => 'Weight / Price (and above)',
121
+ 'index' => 'weight',
122
+ ));
123
+
124
+ $this->addColumn('price', array(
125
+ 'header' => Mage::helper('adminhtml')->__('Shipping Price/Percentage/Addition'),
126
+ 'index' => 'shipping_price',
127
+ ));
128
+
129
+ $this->addColumn('Method', array(
130
+ 'header' => 'Method',
131
+ 'index' => 'method',
132
+ ));
133
+
134
+ $this->addColumn('cashondelivery_surcharge', array(
135
+ 'header' => 'Cash On Delivery Surcharge',
136
+ 'index' => 'cashondelivery_surcharge',
137
+ 'default' => ''
138
+ ));
139
+
140
+ $this->addColumn('cod_min_surcharge', array(
141
+ 'header' => 'Minimum COD Surcharge',
142
+ 'index' => 'cod_min_surcharge',
143
+ 'default' => ''
144
+ ));
145
+
146
+ $this->addColumn('price_vs_dest', array(
147
+ 'header' => 'Price vs Dest',
148
+ 'index' => 'price_vs_dest',
149
+ 'default' => '0'
150
+ ));
151
+
152
+
153
+ return parent::_prepareColumns();
154
+ }
155
+ }
app/code/community/Zitec/Dpd/Block/Checkout/Onepage/Addresslength.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Block_Checkout_Onepage_Addresslength extends Zitec_Dpd_Block_Addresslength
25
+ {
26
+
27
+ /**
28
+ *
29
+ * @return array
30
+ */
31
+ public function getFieldNames()
32
+ {
33
+ return array("shipping:street1", "shipping:street2", "shipping:street3", "shipping:street4");
34
+ }
35
+ }
36
+
37
+
app/code/community/Zitec/Dpd/Block/Customer/Address/Edit/Addresslength.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Block_Customer_Address_Edit_Addresslength extends Zitec_Dpd_Block_Addresslength
25
+ {
26
+
27
+ /**
28
+ *
29
+ * @return array
30
+ */
31
+ public function getFieldNames()
32
+ {
33
+ return array("street_1", "street_2", "street_3", "street_4");
34
+ }
35
+ }
36
+
37
+
app/code/community/Zitec/Dpd/Block/Order/Creditmemo/Totals/Cashondeliverysurcharge.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Block_Order_Creditmemo_Totals_Cashondeliverysurcharge extends Zitec_Dpd_Block_Order_Totals_Cashondeliverysurchage
25
+ {
26
+ /**
27
+ *
28
+ * @return float
29
+ */
30
+ protected function _getAmount()
31
+ {
32
+ return $this->_getCreditmemo()->getData('zitec_dpd_cashondelivery_surcharge');
33
+ }
34
+
35
+ /**
36
+ *
37
+ * @return float
38
+ */
39
+ protected function _getBaseAmount()
40
+ {
41
+ return $this->_getCreditmemo()->getData('base_zitec_dpd_cashondelivery_surcharge');
42
+ }
43
+
44
+ /**
45
+ *
46
+ * @return type
47
+ */
48
+ protected function _getCreditmemo()
49
+ {
50
+ return $this->getParentBlock()->getCreditmemo();
51
+ }
52
+
53
+ /**
54
+ *
55
+ * @return float
56
+ */
57
+ protected function _getBaseTax()
58
+ {
59
+ return $this->_getCreditmemo()->getData('base_zitec_dpd_cashondelivery_surcharge_tax');
60
+ }
61
+
62
+ /**
63
+ *
64
+ * @return float
65
+ */
66
+ protected function _getTax()
67
+ {
68
+ return $this->_getCreditmemo()->getData('zitec_dpd_cashondelivery_surcharge_tax');
69
+ }
70
+ }
71
+
72
+
app/code/community/Zitec/Dpd/Block/Order/Invoice/Totals/Cashondeliverysurcharge.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Block_Order_Invoice_Totals_Cashondeliverysurcharge extends Zitec_Dpd_Block_Order_Totals_Cashondeliverysurchage
25
+ {
26
+ /**
27
+ *
28
+ * @return float
29
+ */
30
+ protected function _getAmount()
31
+ {
32
+ return $this->_getInvoice()->getData('zitec_dpd_cashondelivery_surcharge');
33
+ }
34
+
35
+ /**
36
+ *
37
+ * @return float
38
+ */
39
+ protected function _getBaseAmount()
40
+ {
41
+ return $this->_getInvoice()->getData('base_zitec_dpd_cashondelivery_surcharge');
42
+ }
43
+
44
+ /**
45
+ *
46
+ * @return type
47
+ */
48
+ protected function _getInvoice()
49
+ {
50
+ return $this->getParentBlock()->getInvoice();
51
+ }
52
+
53
+ /**
54
+ *
55
+ * @return float
56
+ */
57
+ protected function _getTax()
58
+ {
59
+ return $this->_getInvoice()->getData('zitec_dpd_cashondelivery_surcharge_tax');
60
+ }
61
+
62
+ /**
63
+ *
64
+ * @return float
65
+ */
66
+ protected function _getBaseTax()
67
+ {
68
+ return $this->_getInvoice()->getData('base_zitec_dpd_cashondelivery_surcharge_tax');
69
+ }
70
+ }
71
+
72
+
app/code/community/Zitec/Dpd/Block/Order/Totals/Cashondeliverysurchage.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Block_Order_Totals_Cashondeliverysurchage extends Mage_Sales_Block_Order_Totals
25
+ {
26
+
27
+ public function initTotals()
28
+ {
29
+ $title = Mage::getStoreConfig('payment/zitec_dpd_cashondelivery/total_title', $this->_getOrder()->getStoreId());
30
+
31
+ if (!round($this->_getAmount(), 2)) {
32
+ return;
33
+ }
34
+
35
+ $includingAfter = $this->_getAfter();
36
+ if ($this->_displayBoth() || $this->_displayExcludingTax()) {
37
+ $this->getParentBlock()->addTotal(new Varien_Object(array(
38
+ 'code' => 'zitec_dpd_cashondelivery_surcharge',
39
+ 'value' => $this->_getAmount(),
40
+ 'base_value' => $this->_getBaseAmount(),
41
+ 'label' => $title . ($this->_displayBoth() ? ' ' . $this->_getHelper()->__('(Excl.Tax)') : ''),
42
+ )), $this->_getAfter());
43
+ $includingAfter = 'zitec_dpd_cashondelivery_surcharge';
44
+ }
45
+
46
+ if ($this->_displayIncludingTax() || $this->_displayBoth()) {
47
+ $this->getParentBlock()->addTotal(new Varien_Object(array(
48
+ 'code' => 'zitec_dpd_cashondelivery_surcharge_incl_tax',
49
+ 'value' => $this->_getAmount() + $this->_getTax(),
50
+ 'base_value' => $this->_getBaseAmount() + $this->_getBaseTax(),
51
+ 'label' => $title . ($this->_displayBoth() ? ' ' . $this->_getHelper()->__('(Incl.Tax)') : ''),
52
+ )), $includingAfter);
53
+ }
54
+ }
55
+
56
+ /**
57
+ *
58
+ * @return Mage_Sales_Model_Order
59
+ */
60
+ protected function _getOrder()
61
+ {
62
+ return $this->getParentBlock()->getOrder();
63
+ }
64
+
65
+ protected function _getStore()
66
+ {
67
+ return $this->_getOrder()->getStore();
68
+ }
69
+
70
+ /**
71
+ *
72
+ * @return string
73
+ */
74
+ protected function _getAfter()
75
+ {
76
+ return $this->_displayBoth() ? 'shipping_incl' : 'shipping';
77
+ }
78
+
79
+
80
+ /**
81
+ *
82
+ * @return float
83
+ */
84
+ protected function _getAmount()
85
+ {
86
+ return $this->_getOrder()->getData('zitec_dpd_cashondelivery_surcharge');
87
+ }
88
+
89
+ /**
90
+ *
91
+ * @return float
92
+ */
93
+ protected function _getBaseAmount()
94
+ {
95
+ return $this->_getOrder()->getData('base_zitec_dpd_cashondelivery_surcharge');
96
+ }
97
+
98
+ /**
99
+ *
100
+ * @return float
101
+ */
102
+ protected function _getTax()
103
+ {
104
+ return $this->_getOrder()->getData('zitec_dpd_cashondelivery_surcharge_tax');
105
+ }
106
+
107
+ /**
108
+ *
109
+ * @return float
110
+ */
111
+ protected function _getBaseTax()
112
+ {
113
+ return $this->_getOrder()->getData('base_zitec_dpd_cashondelivery_surcharge_tax');
114
+ }
115
+
116
+ /**
117
+ *
118
+ * @return boolean
119
+ */
120
+ protected function _displayBoth()
121
+ {
122
+ return $this->_getConfig()->displaySalesShippingBoth($this->_getStore());
123
+ }
124
+
125
+ /**
126
+ *
127
+ * @return boolean
128
+ */
129
+ protected function _displayIncludingTax()
130
+ {
131
+ return $this->_getConfig()->displaySalesShippingInclTax($this->_getStore());
132
+ }
133
+
134
+ /**
135
+ *
136
+ * @return boolean
137
+ */
138
+ protected function _displayExcludingTax()
139
+ {
140
+ return $this->_getConfig()->displaySalesShippingExclTax($this->_getStore());
141
+ }
142
+
143
+ /**
144
+ *
145
+ * @return Mage_Tax_Model_Config
146
+ */
147
+ protected function _getConfig()
148
+ {
149
+ return Mage::getSingleton('tax/config');
150
+ }
151
+
152
+ /**
153
+ *
154
+ * @return Zitec_Dpd_Helper_Data
155
+ */
156
+ protected function _getHelper()
157
+ {
158
+ return Mage::helper('zitec_dpd');
159
+ }
160
+
161
+ }
app/code/community/Zitec/Dpd/Block/Tax/Checkout/Cashondeliverysurchage.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Block_Tax_Checkout_Cashondeliverysurchage extends Mage_Checkout_Block_Total_Default
25
+ {
26
+
27
+ protected $_template = 'zitec_dpd/tax/checkout/cashondeliverysurchage.phtml';
28
+
29
+ /**
30
+ *
31
+ * @return float
32
+ */
33
+ protected function _getCashOnDeliverySurcharge()
34
+ {
35
+ return $this->getTotal()->getAddress()->getData('zitec_dpd_cashondelivery_surcharge');
36
+ }
37
+
38
+ /**
39
+ *
40
+ * @return float
41
+ */
42
+ protected function _getCashOnDeliverySurchargeTax()
43
+ {
44
+ return $this->getTotal()->getAddress()->getData('zitec_dpd_cashondelivery_surcharge_tax');
45
+ }
46
+
47
+
48
+ /**
49
+ * Check if we need display shipping include and exclude tax
50
+ *
51
+ * @return bool
52
+ */
53
+ public function displayBoth()
54
+ {
55
+ return Mage::getSingleton('tax/config')->displayCartShippingBoth($this->getStore());
56
+ }
57
+
58
+ /**
59
+ * Check if we need display shipping include tax
60
+ *
61
+ * @return bool
62
+ */
63
+ public function displayIncludeTax()
64
+ {
65
+ return Mage::getSingleton('tax/config')->displayCartShippingInclTax($this->getStore());
66
+ }
67
+
68
+
69
+ /**
70
+ * Get label for cash on delivery surcharge including tax
71
+ *
72
+ * @return float
73
+ */
74
+ public function getIncludeTaxLabel()
75
+ {
76
+ return $this->_getTitle() . $this->_getHelper()->__(' Incl. tax');
77
+ }
78
+
79
+ /**
80
+ * Get label for cash on delivery surcharge excluding tax
81
+ *
82
+ * @return float
83
+ */
84
+ public function getExcludeTaxLabel()
85
+ {
86
+ return $this->_getTitle() . $this->_getHelper()->__(' Excl. tax');
87
+ }
88
+
89
+ /**
90
+ *
91
+ * @return float
92
+ */
93
+ public function getCashOnDeliverySurchargeExcludeTax()
94
+ {
95
+ return $this->_getCashOnDeliverySurcharge();
96
+ }
97
+
98
+ /**
99
+ *
100
+ * @return float
101
+ */
102
+ public function getCashOnDeliverySurchargeIncludeTax()
103
+ {
104
+ return $this->_getCashOnDeliverySurcharge() + $this->_getCashOnDeliverySurchargeTax();
105
+ }
106
+
107
+ /**
108
+ *
109
+ * @return Zitec_Dpd_Helper_Data
110
+ */
111
+ protected function _getHelper()
112
+ {
113
+ return Mage::helper('zitec_dpd');
114
+ }
115
+
116
+ /**
117
+ *
118
+ * @return string
119
+ */
120
+ protected function _getTitle()
121
+ {
122
+ return $this->getTotal()->getTitle();
123
+ }
124
+
125
+
126
+ }
app/code/community/Zitec/Dpd/Helper/Compatibility.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * this class is used for
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Helper_Compatibility extends Mage_Core_Helper_Abstract
25
+ {
26
+
27
+
28
+ /**
29
+ * Checks the possibility of creating shipping label by current carrier
30
+ *
31
+ * compatibility with magento less then 1.6.2
32
+ * @param $shipment
33
+ */
34
+ public function canCreateShippingLabel($shipment){
35
+ $shippingCarrier = $this->getOrder($shipment)->getShippingCarrier();
36
+ return $shippingCarrier && $shippingCarrier->isShippingLabelsAvailable();
37
+ }
38
+
39
+
40
+ /**
41
+ * checko compatibility for print shipping label pdf in Mage_Adminhtml_Sales_Order_ShipmentController
42
+ * compatibility with magento less then 1.6.2
43
+ *
44
+ * @return bool
45
+ */
46
+ public function checkMassPrintShippingLabelExists(){
47
+ if($this->versionIsAtLeast16()){
48
+ return true;
49
+ }
50
+
51
+ return false;
52
+ }
53
+
54
+
55
+ public function versionIsAtLeast16()
56
+ {
57
+ $versionInfo = Mage::getVersionInfo();
58
+ if ($versionInfo['major'] >= 1) {
59
+ if ($versionInfo['minor'] >= 6) {
60
+ return true;
61
+ }
62
+ }
63
+
64
+ return false;
65
+ }
66
+
67
+ /**
68
+ * Retrieve invoice order
69
+ *
70
+ * @return Mage_Sales_Model_Order
71
+ */
72
+ public function getOrder($shipment)
73
+ {
74
+ return $shipment->getOrder();
75
+ }
76
+
77
+ }
app/code/community/Zitec/Dpd/Helper/Data.php ADDED
@@ -0,0 +1,595 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * this class is used for
20
+ *
21
+ * @category Zitec
22
+ * @package Zitec_Dpd
23
+ * @author Zitec COM <magento@zitec.ro>
24
+ */
25
+ class Zitec_Dpd_Helper_Data extends Mage_Core_Helper_Abstract
26
+ {
27
+
28
+
29
+ /**
30
+ * is used in checkout to extract the value of products
31
+ * and the names
32
+ *
33
+ * @param $request
34
+ *
35
+ * @return array
36
+ */
37
+ public function extractInsuranceValuesByRequest($request)
38
+ {
39
+ $allItems = $request->getAllItems();
40
+ $description = '';
41
+ $value = 0;
42
+ if (count($allItems)) {
43
+ foreach ($allItems as $item) {
44
+ if ($item->getParentItemId()) {
45
+ continue;
46
+ }
47
+ $description .= ' | '.$item->getName();
48
+
49
+ $value += $item->getRowTotalInclTax();
50
+ }
51
+ }
52
+ $currencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
53
+
54
+ return array(
55
+ 'goodsValue' => $value,
56
+ 'currency' => $currencyCode,
57
+ 'content' => $description
58
+ );
59
+
60
+
61
+ }
62
+
63
+ /**
64
+ * it is used in admin panel to process the products values and
65
+ * products description
66
+ *
67
+ * @param $request
68
+ *
69
+ * @return array
70
+ */
71
+ public function extractInsuranceValuesByOrder($order)
72
+ {
73
+ $allItems = $order->getAllItems();
74
+ $description = '';
75
+ $value = 0;
76
+ if (count($allItems)) {
77
+ foreach ($allItems as $item) {
78
+ if ($item->getParentItemId()) {
79
+ continue;
80
+ }
81
+ $description .= ' | '.$item->getName();
82
+
83
+ $value += $item->getRowTotalInclTax();
84
+ }
85
+ }
86
+ $currencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
87
+
88
+ return array(
89
+ 'goodsValue' => $value,
90
+ 'currency' => $currencyCode,
91
+ 'content' => $description
92
+ );
93
+
94
+
95
+ }
96
+
97
+ /**
98
+ * @param $message
99
+ * @param string $function
100
+ * @param string $class
101
+ * @param string $line
102
+ *
103
+ * @return $this
104
+ */
105
+ public function log($message, $function = '', $class = '', $line = '')
106
+ {
107
+ $location = ($class ? "$class::" : "") . $function . ($line ? " on line $line" : "");
108
+ Mage::log($message . ($location ? " at $location" : ''), null, "zitec_dpd.log");
109
+
110
+ return $this;
111
+ }
112
+
113
+ /**
114
+ *
115
+ * @param string $field
116
+ * @param mixed $store
117
+ *
118
+ * @return mixed
119
+ */
120
+ public function getConfigData($field, $store = null)
121
+ {
122
+ if (!$store) {
123
+ $store = Mage::app()->getStore();
124
+ }
125
+
126
+ $carrierCode = $this->getDpdCarrierCode();
127
+
128
+ return Mage::getStoreConfig("carriers/$carrierCode/$field", $store);
129
+ }
130
+
131
+ /**
132
+ *
133
+ * @param mixed $store
134
+ *
135
+ * @return string
136
+ */
137
+ public function getCarrierName($store = null)
138
+ {
139
+ return $this->getConfigData("title", $store);
140
+ }
141
+
142
+ /**
143
+ *
144
+ * @param mixed $store
145
+ *
146
+ * @return boolean
147
+ */
148
+ public function moduleIsActive($store = null)
149
+ {
150
+ return $this->getConfigData("active", $store) ? true : false;
151
+ }
152
+
153
+
154
+ /**
155
+ *
156
+ * @param Mage_Shipping_Model_Carrier_Abstract $carrier
157
+ *
158
+ * @return boolean
159
+ */
160
+ public function isCarrierDpd(Mage_Shipping_Model_Carrier_Abstract $carrier)
161
+ {
162
+ return $carrier instanceof Zitec_Dpd_Model_Shipping_Carrier_Dpd;
163
+ }
164
+
165
+ /**
166
+ * test if a order was submited using dpd shipping carrier
167
+ *
168
+ * @param $order
169
+ *
170
+ * @return bool
171
+ */
172
+ public function isDpdCarrierByOrder($order)
173
+ {
174
+ if (!is_object($order)) {
175
+ return false;
176
+ }
177
+ $carrier = $order->getShippingCarrier();
178
+
179
+ return $this->isCarrierDpd($carrier);
180
+ }
181
+
182
+ /**
183
+ * check if the postcode was marked as a valid postcode or not
184
+ *
185
+ * @param $order
186
+ */
187
+ public function isValidAutoPostcode($order)
188
+ {
189
+ if (!is_object($order)) {
190
+ return false;
191
+ }
192
+ if (!$this->isEnabledPostcodeAutocompleteByOrder($order)) {
193
+ //it should be valid
194
+ return 1;
195
+ }
196
+ if (!$this->isDpdCarrierByOrder($order)) {
197
+ //it should be valid
198
+ return 1;
199
+ }
200
+ $_shippingAddress = $order->getShippingAddress();
201
+ $isValid = $_shippingAddress->getValidAutoPostcode();
202
+
203
+ return $isValid;
204
+
205
+ }
206
+
207
+
208
+ public function isEnabledPostcodeAutocompleteByOrder($order)
209
+ {
210
+ if (!is_object($order)) {
211
+ return false;
212
+ }
213
+ $_shippingAddress = $order->getShippingAddress();
214
+ $address = $_shippingAddress->getData();
215
+ if (!empty($address['country_id'])) {
216
+ $countryName = Mage::getModel('directory/country')->loadByCode($address['country_id'])->getName();
217
+ $address['country'] = $countryName;
218
+ } else {
219
+ return false;
220
+ }
221
+
222
+ return (Mage::helper('zitec_dpd/postcode_search')->isEnabledAutocompleteForPostcode($countryName));
223
+ }
224
+
225
+ /**
226
+ * chceck the address length to be less then DPD API requirements
227
+ *
228
+ * @param $shippingAddress
229
+ *
230
+ * @return bool
231
+ */
232
+ public function checkAddressStreetLength($shippingAddress)
233
+ {
234
+
235
+ $shippingAddressStreetArray = $shippingAddress->getStreet();
236
+ if (is_array($shippingAddressStreetArray)) {
237
+ $shippingAddressStreet = '';
238
+ foreach ($shippingAddressStreetArray as $street) {
239
+ $shippingAddressStreet .= '' . $street;
240
+ }
241
+ $shippingAddressStreet = trim($shippingAddressStreet);
242
+ } else {
243
+ $shippingAddressStreet = $shippingAddressStreetArray;
244
+ }
245
+
246
+ return (strlen($shippingAddressStreet) <= Zitec_Dpd_Api_Configs::SHIPMENT_LIST_RECEIVER_STREET_MAX_LENGTH);
247
+ }
248
+
249
+
250
+ /**
251
+ *
252
+ * @param string|Mage_Sales_Model_Order_Shipment|Mage_Sales_Model_Order $shippingMethod
253
+ *
254
+ * @return boolean
255
+ */
256
+ public function isShippingMethodDpd($shippingMethod)
257
+ {
258
+ if ($shippingMethod instanceof Mage_Sales_Model_Order_Shipment) {
259
+ $shippingMethod = $shippingMethod->getOrder()->getShippingMethod();
260
+ } elseif ($shippingMethod instanceof Mage_Sales_Model_Order) {
261
+ $shippingMethod = $shippingMethod->getShippingMethod();
262
+ }
263
+
264
+ return is_string($shippingMethod) && (strpos($shippingMethod, $this->getDpdCarrierCode()) !== false);
265
+ }
266
+
267
+
268
+ /**
269
+ * Returns true if the magento version is greater or equal to the version passed.
270
+ *
271
+ * @param int $major
272
+ * @param int $minor
273
+ * @param int $revision
274
+ * @param int $patch
275
+ *
276
+ * @return boolean
277
+ */
278
+ public function isMagentoVersionGreaterOrEqualTo($major, $minor, $revision, $patch)
279
+ {
280
+ $versionInfo = Mage::getVersionInfo();
281
+ if ((int)$major > (int)$versionInfo['major']) {
282
+ return false;
283
+ } elseif ((int)$minor > (int)$versionInfo['minor']) {
284
+ return false;
285
+ } elseif ((int)$revision > (int)$versionInfo['revision']) {
286
+ return false;
287
+ } elseif ((int)$patch > (int)$versionInfo['patch']) {
288
+ return false;
289
+ } else {
290
+ return true;
291
+ }
292
+ }
293
+
294
+ /**
295
+ *
296
+ * @param string $message
297
+ */
298
+ public function addNotice($message)
299
+ {
300
+ Mage::getSingleton('core/session')->addNotice($message);
301
+ }
302
+
303
+ /**
304
+ *
305
+ * @param string $message
306
+ */
307
+ public function addError($message)
308
+ {
309
+ Mage::getSingleton('core/session')->addError($message);
310
+ }
311
+
312
+ /**
313
+ *
314
+ * @param string $message
315
+ */
316
+ public function addSuccess($message)
317
+ {
318
+ Mage::getSingleton('core/session')->addSuccess($message);
319
+ }
320
+
321
+ /**
322
+ *
323
+ * @param boolean $success
324
+ * @param string $message
325
+ *
326
+ * @return \Zitec_Dpd_Helper_Data
327
+ */
328
+ public function addSuccessError($success, $message)
329
+ {
330
+ if ($success) {
331
+ $this->addSuccess($message);
332
+ } else {
333
+ $this->addError($message);
334
+ }
335
+
336
+ return $this;
337
+ }
338
+
339
+ /**
340
+ *
341
+ * @return boolean
342
+ */
343
+ public function isAdmin()
344
+ {
345
+ return Mage::app()->getStore()->isAdmin();
346
+ }
347
+
348
+ /**
349
+ *
350
+ * @param string $shipmentId
351
+ *
352
+ * @return boolean
353
+ * @deprecated
354
+ */
355
+ public function isManifestClosed($shipmentId)
356
+ {
357
+ $shipsCollection = Mage::getResourceModel('zitec_dpd/dpd_ship_collection');
358
+ /* @var $shipsCollection Zitec_Dpd_Model_Mysql4_Dpd_Ship_Collection */
359
+ $ships = $shipsCollection->getByShipmentId($shipmentId);
360
+
361
+ /* @var $ships Zitec_Dpd_Model_Dpd_Ship */
362
+
363
+ return $ships->getManifest() ? true : false;
364
+
365
+ }
366
+
367
+ /**
368
+ *
369
+ * @param Mage_Sales_Model_Order_Shipment_Track $track
370
+ *
371
+ * @return boolean
372
+ */
373
+ public function isDpdTrack(Mage_Sales_Model_Order_Shipment_Track $track)
374
+ {
375
+ return strpos($track->getCarrierCode(), $this->getDpdCarrierCode()) !== false;
376
+ }
377
+
378
+ /**
379
+ *
380
+ * @param Mage_Sales_Model_Order_Shipment $shipment
381
+ *
382
+ * @return boolean
383
+ */
384
+ public function isCancelledWithDpd(Mage_Sales_Model_Order_Shipment $shipment)
385
+ {
386
+ return $this->isShippingMethodDpd($shipment->getOrder()->getShippingMethod()) && !$shipment->getShippingLabel();
387
+ }
388
+
389
+
390
+ /**
391
+ *
392
+ * @param string $shippingMethod
393
+ *
394
+ * @return string|boolean
395
+ */
396
+ public function getDPDServiceCode($shippingMethod)
397
+ {
398
+ $parts = explode('_', $shippingMethod);
399
+ if (count($parts) == 2) {
400
+ return $parts[1];
401
+ } else {
402
+ return false;
403
+ }
404
+ }
405
+
406
+ /**
407
+ *
408
+ * @param Mage_Sales_Model_Order $order
409
+ *
410
+ * @return boolean
411
+ */
412
+ public function isOrderCashOnDelivery(Mage_Sales_Model_Order $order)
413
+ {
414
+ return $order->getPayment()->getMethod() == Mage::helper('zitec_dpd')->getDpdPaymentCode() ? true : false;
415
+ }
416
+
417
+ /**
418
+ * return default surcharge in checkout if no table rates defined
419
+ *
420
+ * @param Mage_Sales_Model_Quote $quote
421
+ * @param $shippingAmount
422
+ *
423
+ * @return mixed
424
+ */
425
+ public function returnDefaultBaseCashOnDeliverySurcharge(Mage_Sales_Model_Quote $quote)
426
+ {
427
+ $amountType = Mage::getStoreConfig('payment/zitec_dpd_cashondelivery/payment_amount_type', $quote->getStoreId());
428
+ $amount = Mage::getStoreConfig('payment/zitec_dpd_cashondelivery/payment_amount', $quote->getStoreId());
429
+ if ($amountType == Zitec_Dpd_Api_Configs::PAYMENT_AMOUNT_TYPE_FIXED) {
430
+ return $amount;
431
+ } else {
432
+ $address = $quote->getShippingAddress();
433
+ $taxConfig = Mage::getSingleton('tax/config');
434
+ /* @var $taxConfig Mage_Tax_Model_Config */
435
+
436
+ $amount = $amount / 100;
437
+
438
+ return $amount * ($this->getBaseValueOfShippableGoods($quote));
439
+ }
440
+
441
+ }
442
+
443
+ /**
444
+ * here is calculated the price of the quote payment method: cash on delivery using DPD
445
+ *
446
+ * @param Mage_Sales_Model_Quote $quote
447
+ * @param string $surcharge
448
+ *
449
+ * @return float
450
+ */
451
+ public function calculateQuoteBaseCashOnDeliverySurcharge(Mage_Sales_Model_Quote $quote, $surcharge)
452
+ {
453
+ $address = $quote->getShippingAddress();
454
+ $taxConfig = Mage::getSingleton('tax/config');
455
+ /* @var $taxConfig Mage_Tax_Model_Config */
456
+
457
+ if (!$surcharge || !is_array($surcharge) || !isset($surcharge['cashondelivery_surcharge'])) {
458
+ return 0;
459
+ }
460
+ $baseCashondeliverySurchargePercent = $this->parsePercentageValueAsFraction($surcharge['cashondelivery_surcharge']);
461
+ if ($baseCashondeliverySurchargePercent !== false) {
462
+
463
+ $baseCashondeliverySurcharge = $baseCashondeliverySurchargePercent * ($this->getBaseValueOfShippableGoods($quote));
464
+ if (isset($surcharge['cod_min_surcharge'])) {
465
+ $baseCashondeliverySurcharge = max(array((float)$surcharge['cod_min_surcharge'], $baseCashondeliverySurcharge));
466
+ }
467
+ } else {
468
+ $baseCashondeliverySurcharge = (float)$surcharge['cashondelivery_surcharge'];
469
+ }
470
+
471
+ return $baseCashondeliverySurcharge;
472
+ }
473
+
474
+ /**
475
+ * Parse a string of the form nn.nn% and returns the percent as a fraction.
476
+ * It returns false if the string does not have the correct form.
477
+ *
478
+ * @param type $value
479
+ *
480
+ * @return boolean
481
+ */
482
+ public function parsePercentageValueAsFraction($value)
483
+ {
484
+ if (!is_string($value)) {
485
+ return false;
486
+ }
487
+ $value = trim($value);
488
+ if (strlen($value) < 2 || substr($value, -1) != '%') {
489
+ return false;
490
+ }
491
+ $percentage = $this->parseDecimalValue(substr($value, 0, strlen($value) - 1));
492
+ if ($percentage === false) {
493
+ return false;
494
+ }
495
+
496
+ return $percentage / 100;
497
+ }
498
+
499
+
500
+ /**
501
+ * Parse and validate positive decimal value
502
+ * Return false if value is not decimal or is not positive
503
+ *
504
+ * @param string $value
505
+ *
506
+ * @return bool|float
507
+ */
508
+ public function parseDecimalValue($value)
509
+ {
510
+ if (!is_numeric($value)) {
511
+ return false;
512
+ }
513
+ $value = (float)sprintf('%.4F', $value);
514
+ if ($value < 0.0000) {
515
+ return false;
516
+ }
517
+
518
+ return $value;
519
+ }
520
+
521
+
522
+ /**
523
+ *
524
+ * @param Mage_Sales_Model_Quote $quote
525
+ *
526
+ * @return float
527
+ */
528
+ public function getBaseValueOfShippableGoods(Mage_Sales_Model_Quote $quote)
529
+ {
530
+ $baseTotalPrice = 0.0;
531
+ $taxConfig = Mage::getSingleton('tax/config');
532
+ /* @var $taxConfig Mage_Tax_Model_Config */
533
+ if ($quote->getAllItems()) {
534
+ foreach ($quote->getAllItems() as $item) {
535
+ /* @var $item Mage_Sales_Model_Quote_Item */
536
+
537
+ if ($item->getProduct()->isVirtual() || $item->getParentItemId()) {
538
+ continue;
539
+ }
540
+
541
+ $baseTotalPrice += $taxConfig->shippingPriceIncludesTax($quote->getStore()) ? $item->getBaseRowTotalInclTax() : $item->getBaseRowTotal();
542
+ }
543
+ }
544
+
545
+ return $baseTotalPrice;
546
+ }
547
+
548
+
549
+ /**
550
+ *
551
+ * @param Mage_Sales_Model_Order $order
552
+ *
553
+ * @return string
554
+ */
555
+ public function getCodPaymentType(Mage_Sales_Model_Order $order)
556
+ {
557
+ return $order->getPayment()->getMethodInstance()->getConfigData("cod_payment_type", $order->getStoreId());
558
+ }
559
+
560
+
561
+ /**
562
+ *
563
+ * @param int $manifestId
564
+ *
565
+ * @return string
566
+ */
567
+ public function getDownloadManifestUrl($manifestId)
568
+ {
569
+ $helper = Mage::helper('adminhtml');
570
+
571
+ /* @var $helper Mage_Adminhtml_Helper_Data */
572
+
573
+ return $helper->getUrl("zitec_dpd/adminhtml_shipment/downloadmanifest", array("manifest_id" => $manifestId));
574
+ }
575
+
576
+
577
+ /**
578
+ * @return string
579
+ */
580
+ public function getDpdCarrierCode()
581
+ {
582
+ return Zitec_Dpd_Model_Shipping_Carrier_Dpd::CARRIER_CODE;
583
+ }
584
+
585
+
586
+ /**
587
+ * @return string
588
+ */
589
+ public function getDpdPaymentCode()
590
+ {
591
+ return Zitec_Dpd_Model_Payment_Cashondelivery::CODE;
592
+ }
593
+
594
+
595
+ }
app/code/community/Zitec/Dpd/Helper/Layout.php ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Helper_Layout extends Mage_Core_Helper_Abstract
25
+ {
26
+
27
+ const DEFAULT_TRACKING_TEMPLATE = 'sales/order/shipment/view/tracking.phtml';
28
+ const DEFAULT_SHIPPING_TRACKING_POPUP_TEMPLATE = "shipping/tracking/popup.phtml";
29
+
30
+ /**
31
+ *
32
+ * @return string
33
+ */
34
+ public function getAdminhtmlTrackingTemplate()
35
+ {
36
+ if (!$this->_getHelper()->moduleIsActive()) {
37
+ return self::DEFAULT_TRACKING_TEMPLATE;
38
+ }
39
+
40
+ $shipmentId = $this->_getRequest()->getParam('shipment_id');
41
+ if (!$shipmentId) {
42
+ return self::DEFAULT_TRACKING_TEMPLATE;
43
+ }
44
+
45
+ $shipment = Mage::getModel('sales/order_shipment')/* @var $shipment Mage_Sales_Model_Order_Shipment */
46
+ ->load($shipmentId);
47
+ if (!$this->_getHelper()->isShippingMethodDpd($shipment->getOrder()->getShippingMethod())) {
48
+ return self::DEFAULT_TRACKING_TEMPLATE;
49
+ }
50
+
51
+ if ($this->_getHelper()->isMagentoVersionGreaterOrEqualTo('1', '7', '0', '0')) {
52
+ return 'zitec_dpd/sales/order/shipment/view/tracking_17.phtml';
53
+ } else {
54
+ return 'zitec_dpd/sales/order/shipment/view/tracking.phtml';
55
+ }
56
+ }
57
+
58
+ /**
59
+ *
60
+ * @return string
61
+ */
62
+ public function changeShippingTrackingPopupTemplate()
63
+ {
64
+ if (!$this->_getHelper()->moduleIsActive()) {
65
+ return self::DEFAULT_SHIPPING_TRACKING_POPUP_TEMPLATE;
66
+ }
67
+
68
+ $shippingInfo = Mage::registry("current_shipping_info");
69
+ /* @var $shippingInfo Mage_Shipping_Model_Info */
70
+ if (!$shippingInfo instanceof Mage_Shipping_Model_Info) {
71
+ return self::DEFAULT_SHIPPING_TRACKING_POPUP_TEMPLATE;
72
+ }
73
+
74
+
75
+ if ($shippingInfo->getOrderId()) {
76
+ $orderId = $shippingInfo->getOrderId();
77
+ } elseif ($shippingInfo->getShipId()) {
78
+ $orderId = Mage::getModel('sales/order_shipment')->load($shippingInfo->getShipId())->getOrderId();
79
+ } elseif ($shippingInfo->getTrackId()) {
80
+ $orderId = Mage::getModel('sales/order_shipment_track')->load($shippingInfo->getTrackId())->getOrderId();
81
+ } else {
82
+ return self::DEFAULT_SHIPPING_TRACKING_POPUP_TEMPLATE;
83
+ }
84
+
85
+ if (!$orderId) {
86
+ return self::DEFAULT_SHIPPING_TRACKING_POPUP_TEMPLATE;
87
+ }
88
+
89
+ $shippingMethod = Mage::getModel('sales/order')->load($orderId)->getShippingMethod();
90
+ if (!$this->_getHelper()->isShippingMethodDpd($shippingMethod)) {
91
+ return self::DEFAULT_SHIPPING_TRACKING_POPUP_TEMPLATE;
92
+ }
93
+
94
+ return 'zitec_dpd/shipping/tracking/popup.phtml';
95
+ }
96
+
97
+ /**
98
+ *
99
+ * @return Zitec_Dpd_Helper_Data
100
+ */
101
+ protected function _getHelper()
102
+ {
103
+ return Mage::helper('zitec_dpd');
104
+ }
105
+ }
106
+
107
+
app/code/community/Zitec/Dpd/Helper/Payment.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * this class is used for
20
+ *
21
+ * @category Zitec
22
+ * @package Zitec_Dpd
23
+ * @author Zitec COM <magento@zitec.ro>
24
+ */
25
+ class Zitec_Dpd_Helper_Payment extends Mage_Core_Helper_Abstract
26
+ {
27
+
28
+
29
+ public function getWebsiteId()
30
+ {
31
+ if (Mage::app()->getStore()->isAdmin()) {
32
+ $sessionQuote = Mage::getSingleton('adminhtml/session_quote');
33
+ $store = $sessionQuote->getStore();
34
+ if (empty($store)) {
35
+ return 0;
36
+ }
37
+ $webSiteId = $store->getWebsiteId();
38
+
39
+ return $webSiteId;
40
+ }
41
+
42
+ $webSiteId = Mage::app()->getStore()->getWebsiteId();
43
+
44
+ return $webSiteId;
45
+ }
46
+
47
+
48
+
49
+ public function getQuote(){
50
+ if (Mage::app()->getStore()->isAdmin()) {
51
+ return Mage::getSingleton('adminhtml/session_quote')->getQuote();
52
+ } else {
53
+ return Mage::getSingleton('checkout/session')->getQuote();
54
+ }
55
+ }
56
+
57
+ }
app/code/community/Zitec/Dpd/Helper/Postcode/Search.php ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * this class is used for
20
+ *
21
+ * @category Zitec
22
+ * @package Zitec_Dpd
23
+ * @author Zitec COM <magento@zitec.ro>
24
+ */
25
+ class Zitec_Dpd_Helper_Postcode_Search extends Mage_Core_Helper_Abstract
26
+ {
27
+
28
+ public function extractPostCodeForShippingRequest($request)
29
+ {
30
+ $countryName = Mage::getModel('directory/country')->loadByCode($request->getDestCountryId())->getName();
31
+
32
+ if ($this->isEnabledAutocompleteForPostcode($countryName)) {
33
+ if($request->getDestRegionId()) {
34
+ $regionName = Mage::getModel('directory/region')->load($request->getDestRegionId())->getName();
35
+ }
36
+
37
+ $address = array(
38
+ 'country' => $countryName,
39
+ 'region' => $regionName,
40
+ 'city' => $request->getDestCity(),
41
+ 'address' => $request->getDestStreet(),
42
+ 'postcode' => $request->getDestPostcode(),
43
+ );
44
+
45
+ $postcodeRelevance = new stdClass();
46
+ $postCode = $this->search($address, $postcodeRelevance);
47
+
48
+ $checkout = Mage::getSingleton('checkout/session')->getQuote();
49
+ $shipAddress = $checkout->getShippingAddress();
50
+ $shipAddress->setData('auto_postcode', $postCode);
51
+ $shipAddress->setData('valid_auto_postcode', $this->isValid($postCode, $postcodeRelevance));
52
+ if ($this->isValid($postCode, $postcodeRelevance)){
53
+ $shipAddress->setPostcode($postCode);
54
+ }
55
+ } else {
56
+ $postCode = $request->getDestPostcode();
57
+ }
58
+
59
+ return $postCode;
60
+ }
61
+
62
+
63
+
64
+ /**
65
+ * it is used to create a list of relevant addresses for given address.
66
+ * used in admin panel to validate the postcode
67
+ *
68
+ * @param array $address The content will be the edit form for address from admin
69
+ * $address contain next keys
70
+ * MANDATORY
71
+ * country
72
+ * city
73
+ *
74
+ * OPTIONAL
75
+ * region
76
+ * address
77
+ * street
78
+ */
79
+ public function findAllSimilarAddressesForAddress($address){
80
+ if(!empty($address['country_id'])){
81
+ $countryName = Mage::getModel('directory/country')->loadByCode($address['country_id'])->getName();
82
+ $address['country'] = $countryName;
83
+ }
84
+
85
+ if ($this->isEnabledAutocompleteForPostcode($countryName)) {
86
+ if ($address['region_id']) {
87
+ $regionName = Mage::getModel('directory/region')->load($address['region_id'])->getName();
88
+ $address['region'] = $regionName;
89
+ }
90
+
91
+ $foundAddresses = $this->getSearchPostcodeModel()->searchSimilarAddresses($address);
92
+ return $foundAddresses;
93
+ }
94
+
95
+ return false;
96
+ }
97
+
98
+
99
+
100
+ /**
101
+ * @param array $address
102
+ * $address contain next keys
103
+ * MANDATORY
104
+ * country
105
+ * city
106
+ *
107
+ * OPTIONAL
108
+ * region
109
+ * address
110
+ * street
111
+ *
112
+ * @param null $postcodeRelevance
113
+ *
114
+ * @return string
115
+ */
116
+ public function search($address, $postcodeRelevance = null)
117
+ {
118
+ $foundPostCode = $this->getSearchPostcodeModel()->search($address, $postcodeRelevance);
119
+ if (isset($address['postcode']) && strlen($address['postcode']) > 4) {
120
+ if ($foundPostCode == $address['postcode']) {
121
+ return $foundPostCode;
122
+ } elseif (!empty($foundPostCode)) {
123
+ //mark the response as not exactly the same
124
+ return $foundPostCode;
125
+ }
126
+
127
+ return $address['postcode'];
128
+ }
129
+
130
+ return $foundPostCode;
131
+ }
132
+
133
+ /**
134
+ * test if found postcode relevance is enough for considering the postcode useful in the rest of checkout process
135
+ *
136
+ * @param $postCode
137
+ * @param stdClass $relevance
138
+ *
139
+ * @return int
140
+ */
141
+ public function isValid($postCode, stdClass $relevance = null)
142
+ {
143
+ if (empty($relevance)) {
144
+ return 0;
145
+ }
146
+ if (!empty($relevance->percent) && $relevance->percent > Zitec_Dpd_Postcode_Search::SEARCH_RESULT_RELEVANCE_THRESHOLD_FOR_VALIDATION) {
147
+ return 1;
148
+ }
149
+
150
+ return 0;
151
+ }
152
+
153
+
154
+ public function isEnabledAutocompleteForPostcode($countryName)
155
+ {
156
+ $isValid = $this->getSearchPostcodeModel()->isEnabled($countryName);
157
+ if(empty($isValid)){
158
+ return false;
159
+ }
160
+
161
+ $value = Mage::getStoreConfig('carriers/zitecDpd/postcode_autocomplete_checkout');
162
+
163
+ return !empty($value);
164
+ }
165
+
166
+
167
+ public function getSearchPostcodeModel()
168
+ {
169
+ $getSearchPostcodeModel = Mage::registry('getSearchPostcodeModel');
170
+
171
+ if (empty($getSearchPostcodeModel)) {
172
+ $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
173
+ $libInstance = new Zitec_Dpd_Postcode_Search(Zitec_Dpd_Postcode_Search::MYSQL_ADAPTER, $connection);
174
+ Mage::register('getSearchPostcodeModel', $libInstance);
175
+ $getSearchPostcodeModel = $libInstance;
176
+ }
177
+
178
+ return $getSearchPostcodeModel;
179
+ }
180
+
181
+
182
+ }
app/code/community/Zitec/Dpd/Helper/Ws.php ADDED
@@ -0,0 +1,396 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * this helper is used for calling the api methods implemented further in the Zitec_Dpd_Api library
20
+ *
21
+ * @category Zitec
22
+ * @package Zitec_Dpd
23
+ * @author Zitec COM <magento@zitec.ro>
24
+ */
25
+ class Zitec_Dpd_Helper_Ws extends Mage_Core_Helper_Abstract
26
+ {
27
+ protected $_store = null;
28
+
29
+ /**
30
+ * create shipping label and create the pdf content
31
+ *
32
+ * @param int $dpdShipmentId
33
+ * @param string $dpdShipmentReferenceNumber
34
+ *
35
+ * @return string
36
+ * @throws Exception
37
+ */
38
+ public function getNewPdfShipmentLabelsStr($dpdShipmentId, $dpdShipmentReferenceNumber)
39
+ {
40
+ $apiParams = $this->getShipmentParams();
41
+ $apiParams['method'] = Zitec_Dpd_Api_Configs::METHOD_SHIPMENT_GET_LABEL;
42
+ $dpdApi = new Zitec_Dpd_Api($apiParams);
43
+ $dpdLabel = $dpdApi->getApiMethodObject();
44
+
45
+ $dpdLabel->setShipment($dpdShipmentId, $dpdShipmentReferenceNumber);
46
+ try {
47
+ $dpdLabel->execute();
48
+ } catch (Exception $e) {
49
+ throw $e;
50
+ }
51
+ $labelResponse = $dpdLabel->getResponse();
52
+ /* @var $labelResponse Zitec_Dpd_Api_Shipment_GetLabel_Response */
53
+ if ($labelResponse->hasError()) {
54
+ throw new Exception($labelResponse->getErrorText());
55
+ }
56
+
57
+ return $labelResponse->getPdfFile();
58
+ }
59
+
60
+
61
+
62
+ /**
63
+ * this method is used for tracking the order shipment
64
+ * in the response of this method will be a url on dpd website
65
+ *
66
+ * @param $saveShipmentResponse
67
+ *
68
+ * @return mixed
69
+ */
70
+ public function getShipmentStatus($saveShipmentResponse){
71
+
72
+ $apiParams = $this->getShipmentParams();
73
+ $apiParams['method'] = Zitec_Dpd_Api_Configs::METHOD_SHIPMENT_GET_SHIPMENT_STATUS;
74
+
75
+
76
+ $dpdApi = new Zitec_Dpd_Api($apiParams);
77
+ $getShipmentStatus = $dpdApi->getApiMethodObject();
78
+
79
+ $getShipmentStatus->setShipment($saveShipmentResponse->getDpdShipmentId(), $saveShipmentResponse->getDpdShipmentReferenceNumber());
80
+
81
+
82
+ $getShipmentStatus->execute();
83
+ $statusResponse = $getShipmentStatus->getShipmentStatusResponse();
84
+
85
+ return $statusResponse;
86
+ }
87
+
88
+
89
+ /**
90
+ * remove the shipment tracking code form DPD system
91
+ * after this action pdf content will be set to null
92
+ * but the shipment will still exist in magento admin interface
93
+ *
94
+ * @param $shipment
95
+ * @param $saveShipmentResponse
96
+ *
97
+ * @return mixed
98
+ */
99
+ public function deleteWsShipment($shipment, $saveShipmentResponse){
100
+
101
+ $apiParams = $this->getShipmentParams($shipment->getStore());
102
+ $apiParams['method'] = Zitec_Dpd_Api_Configs::METHOD_SHIPMENT_DELETE;
103
+
104
+
105
+ $dpdApi = new Zitec_Dpd_Api($apiParams);
106
+ $deleteShipment = $dpdApi->getApiMethodObject();
107
+
108
+ $deleteShipment->addShipmentReference($saveShipmentResponse->getDpdShipmentId(), $saveShipmentResponse->getDpdShipmentReferenceNumber());
109
+
110
+
111
+ $deleteShipment->execute();
112
+ $wsResult = $deleteShipment->getDeleteShipmentResponse();
113
+
114
+ return $wsResult;
115
+ }
116
+
117
+
118
+
119
+ /**
120
+ *
121
+ * @param mixed $store
122
+ *
123
+ * @return array
124
+ */
125
+ public function getShipmentParams($store = null)
126
+ {
127
+ $params = $this->_getConnectionParams($store);
128
+ $params[Zitec_Dpd_Api_Configs::URL] = $this->_getUrlShipment();
129
+
130
+ return $params;
131
+ }
132
+
133
+ /**
134
+ *
135
+ * @param mixed $store
136
+ *
137
+ * @return array
138
+ */
139
+ public function getManifestParams($store = null)
140
+ {
141
+ $params = $this->_getConnectionParams($store);
142
+ $params[Zitec_Dpd_Api_Configs::URL] = $this->_getUrlManifest();
143
+
144
+ return $params;
145
+ }
146
+
147
+ /**
148
+ *
149
+ * @param mixed $store
150
+ *
151
+ * @return array
152
+ */
153
+ public function getPickupParams($store = null)
154
+ {
155
+ $params = $this->_getConnectionParams($store);
156
+ $params[Zitec_Dpd_Api_Configs::URL] = $this->_getUrlPickup();
157
+
158
+ return $params;
159
+ }
160
+
161
+ /**
162
+ *
163
+ * @param mixed $store
164
+ *
165
+ * @return array
166
+ */
167
+ protected function _getConnectionParams($store = null)
168
+ {
169
+ $this->_store = $store;
170
+
171
+ return array(
172
+ Zitec_Dpd_Api_Configs::CONNECTION_TIMEOUT => $this->_getConnectionTimeout(),
173
+ Zitec_Dpd_Api_Configs::WS_USER_NAME => $this->_getWsUserName(),
174
+ Zitec_Dpd_Api_Configs::WS_PASSWORD => $this->_getWsPassword(),
175
+ Zitec_Dpd_Api_Configs::SENDER_ADDRESS_ID => $this->_getSenderAddressId(),
176
+ Zitec_Dpd_Api_Configs::PAYER_ID => $this->_getPayerId()
177
+ );
178
+ }
179
+
180
+ /**
181
+ *
182
+ * @return int
183
+ */
184
+ protected function _getConnectionTimeout()
185
+ {
186
+ return $this->_getConfigData("connectionTimeout");
187
+ }
188
+
189
+ /**
190
+ *
191
+ * @return type
192
+ */
193
+ protected function _getWsUserName()
194
+ {
195
+ return $this->_getConfigData("username");
196
+ }
197
+
198
+ /**
199
+ *
200
+ * @return string
201
+ */
202
+ protected function _getWsPassword()
203
+ {
204
+ return $this->_getConfigData("password");
205
+ }
206
+
207
+ /**
208
+ *
209
+ * @return string
210
+ */
211
+ protected function _getSenderAddressId()
212
+ {
213
+ return $this->_getConfigData("senderAddressId");
214
+ }
215
+
216
+ /**
217
+ *
218
+ * @return string
219
+ */
220
+ protected function _getPayerId()
221
+ {
222
+ return $this->_getConfigData("payerId");
223
+ }
224
+
225
+ /**
226
+ *
227
+ * @return string
228
+ */
229
+ protected function _getUrlShipment()
230
+ {
231
+ return $this->_getWsUrl("shipmentUrl");
232
+ }
233
+
234
+ /**
235
+ *
236
+ * @return string
237
+ */
238
+ protected function _getUrlManifest()
239
+ {
240
+ return $this->_getWsUrl("manifestUrl");
241
+ }
242
+
243
+ /**
244
+ *
245
+ * @return string
246
+ */
247
+ protected function _getUrlPickup()
248
+ {
249
+ return $this->_getWsUrl("pickupUrl");
250
+ }
251
+
252
+ /**
253
+ *
254
+ * @param string $field
255
+ *
256
+ * @return mixed
257
+ */
258
+ protected function _getConfigData($field)
259
+ {
260
+ return $this->_getHelper()->getConfigData($field, $this->_store);
261
+ }
262
+
263
+ /**
264
+ *
265
+ * @return Zitec_Dpd_Helper_Data
266
+ */
267
+ protected function _getHelper()
268
+ {
269
+ return Mage::helper('zitec_dpd');
270
+ }
271
+
272
+ /**
273
+ *
274
+ * @param string $dateStr
275
+ *
276
+ * @return string|boolean
277
+ */
278
+ public function convertDPDDate($dateStr)
279
+ {
280
+ if (!is_string($dateStr) || strlen($dateStr) != 8) {
281
+ return false;
282
+ }
283
+
284
+ return substr($dateStr, 0, 4) . '-' . substr($dateStr, 4, 2) . '-' . substr($dateStr, -2);
285
+ }
286
+
287
+ /**
288
+ *
289
+ * @param string $timeStr
290
+ *
291
+ * @return string|boolean
292
+ */
293
+ public function convertDPDTime($timeStr)
294
+ {
295
+ if (!is_string($timeStr) || strlen($timeStr) != 6) {
296
+ return false;
297
+ }
298
+
299
+ return substr($timeStr, 0, 2) . ':' . substr($timeStr, 2, 2) . ':' . substr($timeStr, -2);
300
+ }
301
+
302
+
303
+ /**
304
+ *
305
+ * @return array|boolean
306
+ */
307
+ public function getPickupAddress()
308
+ {
309
+ $address = array();
310
+ $address[Zitec_Dpd_Api_Pickup_Create::NAME] = $this->_getPickupAddressConfig("name");
311
+ $address[Zitec_Dpd_Api_Pickup_Create::ADDITIONAL_NAME] = $this->_getPickupAddressConfig("additionalname", false);
312
+ $address[Zitec_Dpd_Api_Pickup_Create::COUNTRY_CODE] = $this->_getPickupAddressConfig("country");
313
+ $address[Zitec_Dpd_Api_Pickup_Create::CITY] = $this->_getPickupAddressConfig("city");
314
+ $address[Zitec_Dpd_Api_Pickup_Create::STREET] = $this->_getPickupAddressConfig("street");
315
+ $address[Zitec_Dpd_Api_Pickup_Create::POSTCODE] = $this->_getPickupAddressConfig("postcode");
316
+ $address[Zitec_Dpd_Api_Pickup_Create::PHONE] = $this->_getPickupAddressConfig("phone");
317
+ $address[Zitec_Dpd_Api_Pickup_Create::EMAIL] = $this->_getPickupAddressConfig("email");
318
+
319
+ return !in_array(false, $address, true) ? $address : false;
320
+ }
321
+
322
+ /**
323
+ *
324
+ * @param string $field
325
+ * @param boolean $mandatory
326
+ *
327
+ * @return string|false
328
+ */
329
+
330
+ protected function _getPickupAddressConfig($field, $mandatory = true)
331
+ {
332
+ $value = Mage::getStoreConfig("shipping/zitec_pickupaddress/$field");
333
+
334
+ return $value || !$mandatory ? $value : false;
335
+ }
336
+
337
+ /**
338
+ * @param $urlType
339
+ *
340
+ * @return mixed|string
341
+ */
342
+ protected function _getWsUrl($urlType)
343
+ {
344
+ $wsCountry = $this->_getConfigData("wscountry");
345
+ $mode = $this->_getHelper()->getConfigData("mode") ? "production" : "test";
346
+ if ($wsCountry && $wsCountry != "zOther") {
347
+ $url = $this->_getConfigData("countryurls/$wsCountry/$mode");
348
+ } elseif ($wsCountry == "zOther") {
349
+ $url = $this->_getConfigData("wsurl$mode");
350
+ $url = ($url && substr($url, -1) != '/') ? "$url/" : $url;
351
+ } else {
352
+ return "";
353
+ }
354
+ if (!$url) {
355
+ return "";
356
+ }
357
+
358
+ $urlServicePart = $this->_getConfigData("{$urlType}Part");
359
+ $url = $url . $urlServicePart;
360
+
361
+ return $url;
362
+ }
363
+
364
+ /**
365
+ *
366
+ * @param string $countryId
367
+ *
368
+ * @return boolean
369
+ */
370
+ public function hasWsUrls($countryId)
371
+ {
372
+ return $this->hasWsProductionUrl($countryId) || $this->hasWsTestUrl($countryId);
373
+ }
374
+
375
+ /**
376
+ *
377
+ * @param string $countryId
378
+ *
379
+ * @return boolean
380
+ */
381
+ public function hasWsTestUrl($countryId)
382
+ {
383
+ return $this->_getConfigData("countryurls/$countryId/test") ? true : false;
384
+ }
385
+
386
+ /**
387
+ *
388
+ * @param string $countryId
389
+ *
390
+ * @return boolean
391
+ */
392
+ public function hasWsProductionUrl($countryId)
393
+ {
394
+ return $this->_getConfigData("countryurls/$countryId/production") ? true : false;
395
+ }
396
+ }
app/code/community/Zitec/Dpd/Model/Config/Data/Abstract.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Config_Data_Abstract extends Mage_Core_Model_Config_Data
25
+ {
26
+ /**
27
+ *
28
+ * @return boolean
29
+ */
30
+ protected function _isActive()
31
+ {
32
+ $isActive = $this->_getConfigValue('active');
33
+
34
+ return $isActive ? true : false;
35
+ }
36
+
37
+ /**
38
+ *
39
+ * @param string $field
40
+ * @param string $group
41
+ *
42
+ * @return string|null
43
+ */
44
+ protected function _getConfigValue($field, $group = 'zitec_dpd')
45
+ {
46
+ $configValueData = $this->getData("groups/{$group}/fields/{$field}");
47
+ if (is_array($configValueData) && array_key_exists('value', $configValueData)) {
48
+ $configValue = $configValueData['value'];
49
+
50
+ return $configValue;
51
+ }
52
+
53
+ return null;
54
+ }
55
+
56
+ /**
57
+ *
58
+ * @return Zitec_Dpd_Helper_Data
59
+ */
60
+ protected function _getHelper()
61
+ {
62
+ return Mage::helper('zitec_dpd');
63
+ }
64
+
65
+ /**
66
+ *
67
+ * @return Zitec_Dpd_Helper_Ws
68
+ */
69
+ protected function _getWsHelper()
70
+ {
71
+ return Mage::helper('zitec_dpd/ws');
72
+ }
73
+ }
74
+
75
+
app/code/community/Zitec/Dpd/Model/Config/Data/Mode.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Config_Data_Mode extends Zitec_Dpd_Model_Config_Data_Abstract
25
+ {
26
+
27
+
28
+ /**
29
+ * Validates that the country selected has a WS Url for the mode (production or test)
30
+ *
31
+ * @return void
32
+ */
33
+ protected function _afterSave()
34
+ {
35
+ if (!$this->_isActive()) {
36
+ return;
37
+ }
38
+
39
+ $countryId = $this->_getCountryId();
40
+ if (!$countryId || $countryId == Zitec_Dpd_Model_Config_Source_Wscountry::WS_COUNTRY_OTHER) {
41
+ return;
42
+ }
43
+
44
+ if ($this->getValue()) { // Production mode
45
+ if (!$this->_getWsHelper()->hasWsProductionUrl($countryId)) {
46
+ Mage::throwException($this->_getHelper()->__("The country you have selected does not have a web service URL for production mode. Please ensure you have selected the correct country, or select 'Other (enter web service URLs manually)' to enter a specific URL."));
47
+ }
48
+ } else { // Test mode
49
+ if (!$this->_getWsHelper()->hasWsTestUrl($countryId)) {
50
+ Mage::throwException($this->_getHelper()->__("The country you have selected does not have a web service URL for test mode. Please ensure you have selected the correct country, or select 'Other (enter web service URLs manually)' to enter a specific URL."));
51
+ }
52
+ }
53
+ }
54
+
55
+ /**
56
+ *
57
+ * @return string
58
+ */
59
+ protected function _getCountryId()
60
+ {
61
+ return $this->_getConfigValue('wscountry');
62
+ }
63
+
64
+
65
+ }
66
+
app/code/community/Zitec/Dpd/Model/Config/Data/Tablerate.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Config_Data_Tablerate extends Mage_Core_Model_Config_Data
25
+ {
26
+
27
+ public function _afterSave()
28
+ {
29
+ try {
30
+ Mage::getResourceModel('zitec_dpd/carrier_tablerate')->uploadAndImport($this);
31
+ } catch (Exception $e) {
32
+ $this->_getHelper()->addError(implode("<br />", explode("\n", $e->getMessage())));
33
+ }
34
+ }
35
+
36
+ /**
37
+ *
38
+ * @return Zitec_Dpd_Helper_Data
39
+ */
40
+ protected function _getHelper()
41
+ {
42
+ return Mage::helper('zitec_dpd');
43
+ }
44
+
45
+ }
46
+
47
+
app/code/community/Zitec/Dpd/Model/Config/Source/Abstract.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Config_Source_Abstract
25
+ {
26
+
27
+
28
+ /**
29
+ *
30
+ * @return Zitec_Dpd_Helper_Data
31
+ */
32
+ protected function _getHelper()
33
+ {
34
+ return Mage::helper('zitec_dpd');
35
+ }
36
+
37
+ /**
38
+ *
39
+ * @return Zitec_Dpd_Helper_Ws
40
+ */
41
+ protected function _getWsHelper()
42
+ {
43
+ return Mage::helper('zitec_dpd/ws');
44
+ }
45
+
46
+ /**
47
+ *
48
+ * @param string $translateStr
49
+ *
50
+ * @return string
51
+ */
52
+ protected function __($translateStr)
53
+ {
54
+ return $this->_getHelper()->__($translateStr);
55
+ }
56
+ }
57
+
58
+
app/code/community/Zitec/Dpd/Model/Config/Source/Order/Status/Pendingpayment.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Config_Source_Order_Status_Pendingpayment extends Mage_Adminhtml_Model_System_Config_Source_Order_Status
25
+ {
26
+ protected $_stateStatuses = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
27
+ }
28
+
29
+
30
+
app/code/community/Zitec/Dpd/Model/Config/Source/Service.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Config_Source_Service extends Zitec_Dpd_Model_Config_Source_Abstract
25
+ {
26
+
27
+ public function toOptionArray($isMultiselect = false)
28
+ {
29
+
30
+ $services = array(
31
+ '1' => $this->__('DPD Classic'),
32
+ '10' => $this->__('DPD 10:00'),
33
+ '9' => $this->__('DPD 12:00'),
34
+ '109' => $this->__('DPD B2C'),
35
+ '27' => $this->__('DPD Same Day'),
36
+ '40033' => $this->__('DPD Classic International'),
37
+ '40107' => $this->__('DPD Classic Bulgaria')
38
+ );
39
+
40
+ if ($isMultiselect) {
41
+ $options = array();
42
+ foreach ($services as $k => $v) {
43
+ $options[] = array('label' => $k . ' - ' . $v, 'value' => $k);
44
+ }
45
+
46
+ return $options;
47
+ } else {
48
+ return $services;
49
+ }
50
+ }
51
+
52
+ /**
53
+ * return default values for all shipping service of dpd carrier to force using
54
+ * api response amount for enabled services
55
+ *
56
+ * @return array
57
+ */
58
+ public function getDefaultShipingRates()
59
+ {
60
+ $rates = array();
61
+ foreach ($this->toOptionArray() as $key => $value) {
62
+ $rates[] = array(
63
+ //'pk'=>14,
64
+ 'website_id' => null,//1
65
+ 'dest_country_id' => 0,
66
+ 'dest_region_id' => 0,
67
+ 'dest_zip' => '',
68
+ 'weight' => 0,
69
+ 'price' => 0,
70
+ 'method' => $key,
71
+ 'markup_type' => 1,
72
+ 'cod_option' => 3,
73
+ 'cashondelivery_surcharge' => "0%",
74
+ 'cod_min_surcharge' => null,
75
+ 'price_vs_dest' => 0,
76
+ );
77
+ }
78
+
79
+ return $rates;
80
+
81
+ }
82
+
83
+
84
+ /**
85
+ * return the payment rate with default values
86
+ * it will return an array forcing the payment to be calculated as a percentage
87
+ *
88
+ * @return array
89
+ */
90
+ public function getDefaultPaymentRate()
91
+ {
92
+ $rate = array(
93
+ 'website_id' => null,
94
+ 'dest_country_id' => 0,
95
+ 'dest_region_id' => 0,
96
+ 'dest_zip' => '',
97
+ 'weight' => 0,
98
+ 'price' => 0,
99
+ 'markup_type' => 1,
100
+ 'cod_option' => 3,
101
+ 'cashondelivery_surcharge' => "0%",
102
+ 'cod_min_surcharge' => null,
103
+ 'price_vs_dest' => 0,
104
+ );
105
+
106
+ return $rate;
107
+
108
+ }
109
+
110
+
111
+ }
112
+
113
+
app/code/community/Zitec/Dpd/Model/Config/Source/Wscountry.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Config_Source_Wscountry extends Zitec_Dpd_Model_Config_Source_Abstract
25
+ {
26
+
27
+ const WS_COUNTRY_OTHER = 'zOther';
28
+
29
+ public function toOptionArray()
30
+ {
31
+ $countryCollection = Mage::getResourceModel('directory/country_collection');
32
+ /* @var $countryCollection Mage_Directory_Model_Resource_Country_Collection */
33
+ $countryOptions = $countryCollection->toOptionArray();
34
+
35
+
36
+ $countries = array();
37
+ $countries[0] = array('value' => 0, 'label' => $this->__('-- Please select an option --'));
38
+ foreach ($countryOptions as $option) {
39
+ if(!empty($option['label']) && !empty($option['value'])) {
40
+ $countries[$option['value']] = array('value' => $option['value'], 'label' => $option['label']);
41
+ }
42
+ }
43
+ $countries[self::WS_COUNTRY_OTHER] = array('value' => self::WS_COUNTRY_OTHER, 'label' => $this->__('Other (enter web service URLs manually)'));
44
+
45
+ // Only include the countries that have web service URLs defined.
46
+ $countryIds = array_keys($countries);
47
+ foreach ($countryIds as $countryId) {
48
+ if ($countryId && $countryId != 'zOther' && !$this->_getWsHelper()->hasWsUrls($countryId)) {
49
+ unset($countries[$countryId]);
50
+ }
51
+ }
52
+
53
+ return $countries;
54
+ }
55
+ }
56
+
57
+
app/code/community/Zitec/Dpd/Model/Dpd/Manifest.php ADDED
@@ -0,0 +1,297 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Dpd_Manifest extends Mage_Core_Model_Abstract
25
+ {
26
+
27
+ /**
28
+ *
29
+ * @var array
30
+ */
31
+ protected $_notifications = array();
32
+
33
+ protected $_shipsForManifest = array();
34
+
35
+
36
+ public function _construct()
37
+ {
38
+ $this->_init('zitec_dpd/dpd_manifest');
39
+ }
40
+
41
+ /**
42
+ *
43
+ * @param array|int|null $shipmentIds
44
+ *
45
+ * @return boolean
46
+ */
47
+ public function createManifestForShipments($shipmentIds)
48
+ {
49
+ $this->_clearNotifications();
50
+
51
+ if ($shipmentIds && is_numeric($shipmentIds)) {
52
+ $shipmentIds = array($shipmentIds);
53
+ }
54
+
55
+ if (!$shipmentIds || !is_array($shipmentIds)) {
56
+ $message = $this->_getHelper()->__("Please the shipments to include in the closed manifest.");
57
+ $this->_addNotification($message);
58
+
59
+ return false;
60
+ }
61
+
62
+
63
+ $shipments = Mage::getResourceModel('sales/order_shipment_collection');
64
+ /* @var $shipments Mage_Sales_Model_Resource_Order_Shipment_Collection */
65
+ $shipments->addFieldToFilter('entity_id', array("in" => $shipmentIds));
66
+
67
+ $ships = Mage::getResourceModel('zitec_dpd/dpd_ship_collection');
68
+ /* @var $ships Zitec_Dpd_Model_Mysql4_Dpd_Ship_Collection */
69
+ $ships->filterByShipmentIds($shipmentIds);
70
+
71
+ $shipmentsForManifest = array();
72
+ $shipsForManifest = array();
73
+ $manifestParams = null;
74
+ foreach ($shipments as $shipment) {
75
+ /* @var $shipment Mage_Sales_Model_Order_Shipment */
76
+ if (!$this->_getHelper()->isShippingMethodDpd($shipment->getOrder()->getShippingMethod())) {
77
+ $message = "Could not include shipment %s in the manifest because it is not a DPD shipment.";
78
+ $this->_addNotification($this->_getHelper()->__($message, $shipment->getIncrementId()), true);
79
+ continue;
80
+ }
81
+
82
+ $ship = $ships->findByShipmentId($shipment->getId());
83
+ /* @var $ship Zitec_Dpd_Model_Dpd_Ship */
84
+ if (!$ship) {
85
+ $message = "Could not include shipment %s in the manifest because it was not communicated to DPD.";
86
+ $this->_addNotification($this->_getHelper()->__($message, $shipment->getIncrementId()), true);
87
+ continue;
88
+ }
89
+
90
+ if ($this->_getHelper()->isCancelledWithDpd($shipment)) {
91
+ $message = "Could not include shipment %s in the manifest because it was cancelled with DPD.";
92
+ $this->_addNotification($this->_getHelper()->__($message, $shipment->getIncrementId()), true);
93
+ continue;
94
+ }
95
+
96
+ if ($ship->getManifestId()) {
97
+ $message = "Could not include shipment %s in the manifest because it is already in a manifest.";
98
+ $this->_addNotification($this->_getHelper()->__($message, $shipment->getIncrementId()), true);
99
+ continue;
100
+ }
101
+
102
+ $storeManifestParams = $this->_getWsHelper()->getManifestParams($shipment->getOrder()->getStore());
103
+ if (isset($manifestParams) && $storeManifestParams != $manifestParams) {
104
+ $this->_clearNotifications();
105
+ $message = "The shipments you selected come from different stores which have different DPD connection parameters. Please select shipments which belong " .
106
+ "to stores that use the same DPD connection parameters.";
107
+ $this->_addNotification($this->_getHelper()->__($message));
108
+
109
+ return false;
110
+ } else {
111
+ $manifestParams = $storeManifestParams;
112
+ }
113
+
114
+ $this->_addNotification($this->_getHelper()->__('Shipment %s was added to the manifest.', $shipment->getIncrementId()));
115
+
116
+ $shipmentsForManifest[] = $shipment;
117
+ $shipsForManifest[] = $ship;
118
+ }
119
+
120
+ if (count($shipmentsForManifest) == 0) {
121
+ $this->_clearNotificationErrorStyles();
122
+ $this->_addNotification("None of the shipments selected could be included in a manifest.");
123
+
124
+ return false;
125
+ }
126
+
127
+ $manifestParams['method'] = Zitec_Dpd_Api_Configs::METHOD_MANIFEST_CLOSE;
128
+ $dpdApi = new Zitec_Dpd_Api($manifestParams);
129
+ $closeManifest = $dpdApi->getApiMethodObject();
130
+
131
+ foreach ($shipmentsForManifest as $index => $shipment) {
132
+ /* @var $shipment Mage_Sales_Model_Order_Shipment */
133
+ $ship = $shipsForManifest[$index];
134
+ /* @var $ship Zitec_Dpd_Model_Dpd_Ship */
135
+ $shipResponse = unserialize($ship->getSaveShipmentResponse());
136
+ /* @var $response Zitec_Dpd_Api_Shipment_Save_Response */
137
+ $closeManifest->addShipment($shipResponse->getDpdShipmentId(), $shipResponse->getDpdShipmentReferenceNumber());
138
+ if ($index == 0) {
139
+ $closeManifest->setManifestReferenceNumber($shipResponse->getDpdShipmentReferenceNumber());
140
+ }
141
+ }
142
+
143
+ try {
144
+ $closeManifest->execute();
145
+ } catch (Exception $e) {
146
+ $this->_clearNotifications();
147
+ $this->_addNotification($this->_getHelper()->__("An error occurred whilst requesting the manifest from DPD: %s", $e->getMessage()));
148
+
149
+ return false;
150
+ }
151
+
152
+ $response = $closeManifest->getCloseManifestResponse();
153
+ if ($response->hasError()) {
154
+ $this->_clearNotifications();
155
+ $this->_addNotification($this->_getHelper()->__('An error occurred whilst communicating the manifest details to DPD. DPD says: "%s"', $response->getErrorText()));
156
+
157
+ return false;
158
+ }
159
+
160
+ $this->setManifestRef($response->getManifestReferenceNumber());
161
+ $this->setManifestDpdId($response->getManifestId());
162
+ $this->setManifestDpdName($response->getManifestName());
163
+ $this->setPdf(base64_encode($response->getPdfFile()));
164
+ $this->setShipsForManifest($shipsForManifest);
165
+
166
+ try {
167
+ $this->save();
168
+
169
+ } catch (Exception $e) {
170
+ $this->_clearNotificationErrorStyles();
171
+ $message = "The manifest was communicated successfully to DPD, but an error occurred whilst saving the manifest details in Magento. <br />" .
172
+ "Please make a capture of this screen so that you have a record of the shipments included in the manifest. <br />" .
173
+
174
+ "For you reference when communicating with DPD, the manifest details are: <br /> " .
175
+ "Manifest Reference: %s <br />" .
176
+ "Manifest Name: %s <br />" .
177
+ "Manifest internal DPD ID: %s <br />" .
178
+ "The error message returned was: %s";
179
+
180
+ $this->_addNotification($this->_getHelper()->__($message, $this->getManifestRef(), $this->getManifestDpdId(), $this->getManifestDpdName(), $e->getMessage()));
181
+ $this->_getHelper()->log(sprintf($message, $this->getManifestRef(), $this->getManifestDpdId(), $this->getManifestDpdName(), $e->getMessage()));
182
+
183
+ return false;
184
+
185
+ }
186
+
187
+ return true;
188
+ }
189
+
190
+
191
+ /**
192
+ *
193
+ * @return \Zitec_Dpd_Model_Dpd_Manifest
194
+ */
195
+ protected function _clearNotifications()
196
+ {
197
+ $this->_notifications = array();
198
+
199
+ return $this;
200
+ }
201
+
202
+ /**
203
+ *
204
+ * @param string $message
205
+ *
206
+ * @return \Zitec_Dpd_Model_Dpd_Manifest
207
+ */
208
+ protected function _addNotification($message, $error = false)
209
+ {
210
+ $this->_notifications[] = $this->_setNotificationErrorStyle($message, $error);
211
+
212
+ return $this;
213
+ }
214
+
215
+ /**
216
+ *
217
+ * @return \Zitec_Dpd_Model_Dpd_Manifest
218
+ */
219
+ protected function _clearNotificationErrorStyles()
220
+ {
221
+ foreach ($this->_notifications as $index => $notification) {
222
+ $this->_notifications[$index] = $this->_setNotificationErrorStyle($notification, false);
223
+ }
224
+
225
+ return $this;
226
+ }
227
+
228
+ /**
229
+ *
230
+ * @param string $message
231
+ * @param boolean $on
232
+ *
233
+ * @return string
234
+ */
235
+ protected function _setNotificationErrorStyle($message, $on)
236
+ {
237
+ $openTag = '<span class="error-msg">';
238
+ $closeTag = '</span>';
239
+ $message = str_replace($openTag, '', $message);
240
+ $message = str_replace($closeTag, '', $message);
241
+ if ($on) {
242
+ $message = $openTag . $message . $closeTag;
243
+ }
244
+
245
+ return $message;
246
+ }
247
+
248
+ /**
249
+ *
250
+ * @param array $shipsForManifest
251
+ *
252
+ * @return \Zitec_Dpd_Model_Dpd_Manifest
253
+ */
254
+ public function setShipsForManifest(array $shipsForManifest)
255
+ {
256
+ $this->_shipsForManifest = $shipsForManifest;
257
+
258
+ return $this;
259
+ }
260
+
261
+ /**
262
+ *
263
+ * @return array
264
+ */
265
+ public function getShipsForManifest()
266
+ {
267
+ return $this->_shipsForManifest;
268
+ }
269
+
270
+ /**
271
+ *
272
+ * @return array
273
+ */
274
+ public function getNotifications()
275
+ {
276
+ return $this->_notifications;
277
+ }
278
+
279
+ /**
280
+ *
281
+ * @return Zitec_Dpd_Helper_Data
282
+ */
283
+ protected function _getHelper()
284
+ {
285
+ return Mage::helper('zitec_dpd');
286
+ }
287
+
288
+ /**
289
+ *
290
+ * @return Zitec_Dpd_Helper_Ws
291
+ */
292
+ protected function _getWsHelper()
293
+ {
294
+ return Mage::helper('zitec_dpd/ws');
295
+ }
296
+
297
+ }
app/code/community/Zitec/Dpd/Model/Dpd/Pickup.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ /**
25
+ * @method Zitec_Dpd_Model_Dpd_Pickup setReference($reference)
26
+ * @method Zitec_Dpd_Model_Dpd_Pickup setDpdId($dpdId)
27
+ * @method Zitec_Dpd_Model_Dpd_Pickup setPickupDate($pickupDate)
28
+ * @method Zitec_Dpd_Model_Dpd_Pickup setPickupTimeFrom($from)
29
+ * @method Zitec_Dpd_Model_Dpd_Pickup setPickupTimeTo($to)
30
+ * @method Zitec_Dpd_Model_Dpd_Pickup setCallData($callData)
31
+ * @method Zitec_Dpd_Model_Dpd_Pickup setResponseData($responseData)
32
+ */
33
+ class Zitec_Dpd_Model_Dpd_Pickup extends Mage_Core_Model_Abstract
34
+ {
35
+ public function _construct()
36
+ {
37
+ $this->_init('zitec_dpd/dpd_pickup');
38
+ }
39
+ }
40
+
41
+
app/code/community/Zitec/Dpd/Model/Dpd/Ship.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ /**
25
+ * @method string getSaveShipmentCall()
26
+ * @method string getSaveShipmentResponse()
27
+ * @method string getShippingLabels()
28
+ * @method string getManifest()
29
+ */
30
+ class Zitec_Dpd_Model_Dpd_Ship extends Mage_Core_Model_Abstract
31
+ {
32
+
33
+ public function _construct()
34
+ {
35
+ $this->_init('zitec_dpd/dpd_ship');
36
+ }
37
+
38
+ }
39
+
40
+
app/code/community/Zitec/Dpd/Model/Mysql4/Carrier/Tablerate.php ADDED
@@ -0,0 +1,735 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Mysql4_Carrier_Tablerate extends Mage_Core_Model_Mysql4_Abstract
25
+ {
26
+
27
+ const CSV_COL_IDX_COUNTRY_ID = 0;
28
+ const CSV_COL_IDX_REGION = 1;
29
+ const CSV_COL_IDX_ZIP = 2;
30
+ const CSV_COL_IDX_WEIGHT = 3;
31
+ const CSV_COL_IDX_PRICE = 4;
32
+ const CSV_COL_IDX_METHOD = 5;
33
+ const CSV_COL_IDX_COD_SURCHARGE = 6;
34
+ const CSV_COL_IDX_COD_MIN_SURCHARGE = 7;
35
+ const CSV_COL_IDX_COD_PRICE_VS_DEST = 8;
36
+
37
+
38
+ const CSV_COL_COUNT = 9;
39
+
40
+
41
+ /**
42
+ * Import table rates website ID
43
+ *
44
+ * @var int
45
+ */
46
+ protected $_importWebsiteId = 0;
47
+
48
+ /**
49
+ * Errors in import process
50
+ *
51
+ * @var array
52
+ */
53
+ protected $_importErrors = array();
54
+
55
+ /**
56
+ * Count of imported table rates
57
+ *
58
+ * @var int
59
+ */
60
+ protected $_importedRows = 0;
61
+
62
+ /**
63
+ * Array of unique table rate keys to protect from duplicates
64
+ *
65
+ * @var array
66
+ */
67
+ protected $_importUniqueHash = array();
68
+
69
+ /**
70
+ * Array of countries keyed by iso2 code
71
+ *
72
+ * @var array
73
+ */
74
+ protected $_importIso2Countries;
75
+
76
+ /**
77
+ * Array of countries keyed by iso3 code
78
+ *
79
+ * @var array
80
+ */
81
+ protected $_importIso3Countries;
82
+
83
+ /**
84
+ * Associative array of countries and regions
85
+ * [country_id][region_code] = region_id
86
+ * [country_id][default_name] = region_id
87
+ *
88
+ * @var array
89
+ */
90
+ protected $_importRegions;
91
+
92
+
93
+ /**
94
+ * Import Table Rate condition name
95
+ *
96
+ * @var string
97
+ */
98
+ protected $_importConditionName;
99
+
100
+ /**
101
+ * Array of condition full names
102
+ *
103
+ * @var array
104
+ */
105
+ protected $_conditionFullNames = array();
106
+
107
+ /**
108
+ * List of valid method codes
109
+ *
110
+ * @var array
111
+ */
112
+ protected $_validMethods = null;
113
+
114
+ /**
115
+ * Define main table and id field name
116
+ *
117
+ * @return void
118
+ */
119
+ protected function _construct()
120
+ {
121
+ $this->_init('zitec_dpd/carrier_tablerate', 'pk');
122
+ }
123
+
124
+ /**
125
+ * Return table rate array or false by rate request
126
+ *
127
+ * @param Mage_Shipping_Model_Rate_Request $request
128
+ *
129
+ * @return array|false
130
+ */
131
+ public function getRate(Mage_Shipping_Model_Rate_Request $request)
132
+ {
133
+ $adapter = $this->_getReadAdapter();
134
+ $bind = array(
135
+ ':website_id' => (int)$request->getWebsiteId(),
136
+ ':country_id' => $request->getDestCountryId(),
137
+ ':region_id' => $request->getDestRegionId(),
138
+ ':postcode' => $request->getDestPostcode(),
139
+ ':weight' => (float)$request->getPackageWeight(),
140
+ ':price' => (float)$request->getData('zitec_table_price')
141
+ );
142
+ $select = $adapter->select()
143
+ ->from($this->getMainTable())
144
+ ->where('website_id=:website_id')
145
+ ->order(array('dest_country_id DESC', 'dest_region_id DESC', 'dest_zip DESC', 'method DESC', 'price_vs_dest DESC', 'weight DESC'));
146
+
147
+
148
+ // render destination condition
149
+ $orWhere = '(' . implode(') OR (', array(
150
+ "dest_country_id = :country_id AND dest_region_id = :region_id AND dest_zip = :postcode",
151
+ "dest_country_id = :country_id AND dest_region_id = :region_id AND dest_zip = ''",
152
+ "dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = ''",
153
+ "dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = :postcode",
154
+ "dest_country_id = '0' AND dest_region_id = 0 AND dest_zip = ''",
155
+ )) . ')';
156
+ $select->where($orWhere);
157
+ $select->where('((weight <= :weight and price_vs_dest = 0) or (weight <= :price and price_vs_dest = 1))');
158
+ $rates = $adapter->fetchAll($select, $bind);
159
+
160
+ if (empty($rates)) {
161
+ $rates = Mage::getModel('zitec_dpd/config_source_service')->getDefaultShipingRates();
162
+ }
163
+
164
+ return $rates;
165
+ }
166
+
167
+ /**
168
+ * Upload table rate file and import data from it
169
+ *
170
+ * @param Varien_Object $object
171
+ *
172
+ * @throws Mage_Core_Exception
173
+ * @return Mage_Shipping_Model_Mysql4_Carrier_Tablerate
174
+ */
175
+ public function uploadAndImport(Varien_Object $object, $csvFile = null)
176
+ {
177
+ $this->_log(__METHOD__);
178
+
179
+ if (!$csvFile && !empty($_FILES['groups']['tmp_name']['zitec_dpd']['fields']['import']['value'])) {
180
+ $csvFile = $_FILES['groups']['tmp_name']['zitec_dpd']['fields']['import']['value'];
181
+ }
182
+ if (!$csvFile) {
183
+ return $this;
184
+ }
185
+
186
+
187
+ $website = Mage::app()->getWebsite($object->getScopeId());
188
+
189
+ $this->_importWebsiteId = (int)$website->getId();
190
+ $this->_importUniqueHash = array();
191
+ $this->_importErrors = array();
192
+ $this->_importedRows = 0;
193
+
194
+ $io = new Varien_Io_File();
195
+ $info = pathinfo($csvFile);
196
+ $io->open(array('path' => $info['dirname']));
197
+ $io->streamOpen($info['basename'], 'r');
198
+
199
+ // check and skip headers
200
+ $headers = $io->streamReadCsv();
201
+ if ($headers === false || count($headers) < self::CSV_COL_COUNT) {
202
+ $io->streamClose();
203
+ Mage::throwException($this->_getHelper()->__('Invalid Table Rates File Format'));
204
+ }
205
+
206
+
207
+ $adapter = $this->_getWriteAdapter();
208
+ $adapter->beginTransaction();
209
+
210
+ try {
211
+ $rowNumber = 1;
212
+ $importData = array();
213
+
214
+ $this->_loadDirectoryCountries();
215
+ $this->_loadDirectoryRegions();
216
+
217
+ // delete old data by website and condition name
218
+ $condition = array(
219
+ 'website_id = ?' => $this->_importWebsiteId,
220
+ );
221
+ $adapter->delete($this->getMainTable(), $condition);
222
+
223
+ while (false !== ($csvLine = $io->streamReadCsv())) {
224
+ $rowNumber++;
225
+ if (is_array($csvLine)) {
226
+ foreach ($csvLine as &$cell) {
227
+ $cell = filter_var($cell, FILTER_SANITIZE_STRING);
228
+ }
229
+ }
230
+
231
+ if (empty($csvLine)) {
232
+ continue;
233
+ }
234
+
235
+ $row = $this->_getImportRow($csvLine, $rowNumber);
236
+ if ($row !== false) {
237
+ $importData[] = $row;
238
+ }
239
+
240
+ if (count($importData) == 5000) {
241
+ $this->_saveImportData($importData);
242
+ $importData = array();
243
+ }
244
+ }
245
+ $this->_saveImportData($importData);
246
+ $io->streamClose();
247
+ } catch (Mage_Core_Exception $e) {
248
+ $adapter->rollback();
249
+ $io->streamClose();
250
+ Mage::throwException($e->getMessage());
251
+ } catch (Exception $e) {
252
+ $adapter->rollback();
253
+ $io->streamClose();
254
+ $this->_log($e->getMessage());
255
+ Mage::throwException($this->_getHelper()->__('An error occurred while import table rates.'));
256
+ }
257
+
258
+ $adapter->commit();
259
+
260
+ if ($this->_importErrors) {
261
+ array_unshift($this->_importErrors, "");
262
+ $error = $this->_getHelper()->__('%1$d records have been imported. See the following list of errors for each record that has not been imported: %2$s', $this->_importedRows, implode(" \n", $this->_importErrors));
263
+ Mage::throwException($error);
264
+ }
265
+
266
+ return $this;
267
+ }
268
+
269
+ /**
270
+ * Load directory countries
271
+ *
272
+ * @return Mage_Shipping_Model_Mysql4_Carrier_Tablerate
273
+ */
274
+ protected function _loadDirectoryCountries()
275
+ {
276
+ if (!is_null($this->_importIso2Countries) && !is_null($this->_importIso3Countries)) {
277
+ return $this;
278
+ }
279
+
280
+ $this->_importIso2Countries = array();
281
+ $this->_importIso3Countries = array();
282
+
283
+ /** @var $collection Mage_Directory_Model_Mysql4_Country_Collection */
284
+ $collection = Mage::getResourceModel('directory/country_collection');
285
+ foreach ($collection->getData() as $row) {
286
+ $this->_importIso2Countries[$row['iso2_code']] = $row['country_id'];
287
+ $this->_importIso3Countries[$row['iso3_code']] = $row['country_id'];
288
+ }
289
+
290
+ return $this;
291
+ }
292
+
293
+ /**
294
+ * Load directory regions
295
+ *
296
+ * @return Mage_Shipping_Model_Mysql4_Carrier_Tablerate
297
+ */
298
+ protected function _loadDirectoryRegions()
299
+ {
300
+ if (!is_null($this->_importRegions)) {
301
+ return $this;
302
+ }
303
+
304
+ $this->_importRegions = array();
305
+
306
+ /** @var $collection Mage_Directory_Model_Mysql4_Region_Collection */
307
+ $collection = Mage::getResourceModel('directory/region_collection');
308
+ foreach ($collection->getData() as $row) {
309
+ $this->_importRegions[$row['country_id']][$row['code']] = (int)$row['region_id'];
310
+ $this->_importRegions[$row['country_id']][$row['default_name']] = (int)$row['region_id'];
311
+ }
312
+
313
+ return $this;
314
+ }
315
+
316
+ /**
317
+ * Return import condition full name by condition name code
318
+ *
319
+ * @return string
320
+ */
321
+ protected function _getConditionFullName($conditionName)
322
+ {
323
+ if (!isset($this->_conditionFullNames[$conditionName])) {
324
+ $name = Mage::getSingleton('shipping/carrier_tablerate')->getCode('condition_name_short', $conditionName);
325
+ $this->_conditionFullNames[$conditionName] = $name;
326
+ }
327
+
328
+ return $this->_conditionFullNames[$conditionName];
329
+ }
330
+
331
+ /**
332
+ * Validate row for import and return table rate array or false
333
+ * Error will be add to _importErrors array
334
+ *
335
+ * @param array $row
336
+ * @param int $rowNumber
337
+ *
338
+ * @return array|false
339
+ */
340
+ protected function _getImportRow($row, $rowNumber = 0)
341
+ {
342
+ // validate row
343
+ if (count($row) < self::CSV_COL_COUNT) {
344
+ $this->_importErrors[] = $this->_getHelper()->__('Invalid Table Rates format in the Row #%s', $rowNumber);
345
+
346
+ return false;
347
+ }
348
+ // validate country
349
+ if (isset($this->_importIso2Countries[$row[self::CSV_COL_IDX_COUNTRY_ID]])) {
350
+ $countryId = $this->_importIso2Countries[$row[self::CSV_COL_IDX_COUNTRY_ID]];
351
+ } else if (isset($this->_importIso3Countries[$row[self::CSV_COL_IDX_COUNTRY_ID]])) {
352
+ $countryId = $this->_importIso3Countries[$row[self::CSV_COL_IDX_COUNTRY_ID]];
353
+ } else if ($row[self::CSV_COL_IDX_COUNTRY_ID] == '*' || $row[self::CSV_COL_IDX_COUNTRY_ID] == '') {
354
+ $countryId = '0';
355
+ } else {
356
+ $this->_importErrors[] = $this->_getHelper()->__('Invalid Country "%s" in the Row #%s.', $row[self::CSV_COL_IDX_COUNTRY_ID], $rowNumber);
357
+
358
+ return false;
359
+ }
360
+
361
+ // validate region
362
+ if ($countryId != '0' && isset($this->_importRegions[$countryId][$row[self::CSV_COL_IDX_REGION]])) {
363
+ $regionId = $this->_importRegions[$countryId][$row[self::CSV_COL_IDX_REGION]];
364
+ } else if ($row[self::CSV_COL_IDX_REGION] == '*' || $row[self::CSV_COL_IDX_REGION] == '') {
365
+ $regionId = 0;
366
+ } else {
367
+ $this->_importErrors[] = $this->_getHelper()->__('Invalid Region/State "%s" in the Row #%s.', $row[self::CSV_COL_IDX_REGION], $rowNumber);
368
+
369
+ return false;
370
+ }
371
+
372
+ // detect zip code
373
+ if ($row[self::CSV_COL_IDX_ZIP] == '*' || $row[self::CSV_COL_IDX_ZIP] == '') {
374
+ $zipCode = '';
375
+ } else {
376
+ $zipCode = $row[self::CSV_COL_IDX_ZIP];
377
+ }
378
+
379
+ // Validar el peso/precio
380
+ $weight = $this->_parseDecimalValue($row[self::CSV_COL_IDX_WEIGHT]);
381
+ if ($weight === false || $weight < 0) {
382
+ $this->_importErrors[] = $this->_getHelper()->__('Invalid weight/price "%s" in the Row #%s.', $weight, $rowNumber);
383
+
384
+ return false;
385
+ }
386
+
387
+ // validate price
388
+ $price = null;
389
+ $markupType = null;
390
+ $priceInput = $row[self::CSV_COL_IDX_PRICE];
391
+ if (!$this->_parsePricePercentage($priceInput, $price, $markupType)) {
392
+ $this->_importErrors[] = $this->_getHelper()->__('Invalid price/percentage/addition "%s" in the Row #%s.', $priceInput, $rowNumber);
393
+
394
+ return false;
395
+ }
396
+
397
+ $method = trim($row[self::CSV_COL_IDX_METHOD]);
398
+ if (!$this->_validateMethod($method)) {
399
+ $this->_importErrors[] = $this->_getHelper()->__('Invalid service "%s" in the Row #%s.', $method, $rowNumber);
400
+
401
+ return false;
402
+ }
403
+
404
+ $cashondelivery_surcharge = $this->_parseCashOnDeliverySurcharge($row[self::CSV_COL_IDX_COD_SURCHARGE]);
405
+ if ($cashondelivery_surcharge === false) {
406
+ $this->_importErrors[] = $this->_getHelper()->__('Invalid COD Surcharge "%s" in the Row #%s.', $row[self::CSV_COL_IDX_COD_SURCHARGE], $rowNumber);
407
+
408
+ return false;
409
+ }
410
+
411
+ // Validar el sobrecargo contrareembolso mínimo.
412
+ $minCodSurcharge = $this->_parseMinCodSurcharge($row[self::CSV_COL_IDX_COD_MIN_SURCHARGE], $cashondelivery_surcharge);
413
+ if ($minCodSurcharge === false) {
414
+ $this->_importErrors[] = $this->_getHelper()->__('Invalid Minimum COD Surcharge "%s" in the Row #%s. The minimum COD surcharge must be greater or equal to zero, and can only be used where the Cash On Delivery Surcharge is specified as a percentage.', $row[self::CSV_COL_IDX_COD_SURCHARGE], $rowNumber);
415
+
416
+ return false;
417
+ }
418
+
419
+ $priceVsDest = $row[self::CSV_COL_IDX_COD_PRICE_VS_DEST] ? $row[self::CSV_COL_IDX_COD_PRICE_VS_DEST] : '0';
420
+ if (array_search($priceVsDest, array('0', '1')) === false) {
421
+ $this->_importErrors[] = $this->_getHelper()->__('Invalid value Price vs Dest value "%s" in the Row #%s. The value should be 0 (Weight vs Dest) or 1 (Price vs Dest).', $row[self::CSV_COL_IDX_COD_SURCHARGE], $rowNumber);
422
+
423
+ return false;
424
+ }
425
+
426
+ $this->_log("[$countryId] [$regionId] [$zipCode] [$weight] [$priceInput] [$method] [$cashondelivery_surcharge] [$minCodSurcharge] [$priceVsDest]");
427
+
428
+ // protect from duplicate
429
+ $hash = sprintf("%s-%d-%s-%F-%d-%d", $countryId, $regionId, $zipCode, $weight, $method, $priceVsDest);
430
+ if (isset($this->_importUniqueHash[$hash])) {
431
+ $this->_importErrors[] = $this->_getHelper()->__('Duplicate Row #%s (Country "%s", Region/State "%s", Zip "%s", Weight/Price "%s", Method "%s", Price vs Dest "%s").', $rowNumber, $row[self::CSV_COL_IDX_COUNTRY_ID], $row[self::CSV_COL_IDX_REGION], $zipCode, $weight, $method);
432
+
433
+ return false;
434
+ }
435
+ $this->_importUniqueHash[$hash] = true;
436
+
437
+
438
+ return array(
439
+ $this->_importWebsiteId, // website_id
440
+ $countryId, // dest_country_id
441
+ $regionId, // dest_region_id,
442
+ $zipCode, // dest_zip
443
+ $weight, // weight
444
+ $price, // price - percentage, addition, or fixed
445
+ $method, // method
446
+ $markupType,// markup_type,
447
+ $cashondelivery_surcharge,
448
+ $minCodSurcharge,
449
+ $priceVsDest
450
+ );
451
+ }
452
+
453
+
454
+ /**
455
+ *
456
+ * @param type $value
457
+ * @param string $value
458
+ * @param string $cashondelivery_surcharge
459
+ *
460
+ * @return boolean
461
+ */
462
+ protected function _parseMinCodSurcharge($value, $cashondelivery_surcharge)
463
+ {
464
+ if (empty($value)) {
465
+ return null;
466
+ }
467
+
468
+ $minCodSurcharge = $this->_parseDecimalValue($value, 2);
469
+ if ($minCodSurcharge === false || $minCodSurcharge < 0) {
470
+ return false;
471
+ }
472
+
473
+ if ($this->_getHelper()->parsePercentageValueAsFraction($cashondelivery_surcharge) === false) {
474
+ return false;
475
+ }
476
+
477
+ return $minCodSurcharge;
478
+ }
479
+
480
+
481
+ /**
482
+ * Save import data batch
483
+ *
484
+ * @param array $data
485
+ *
486
+ * @return Mage_Shipping_Model_Mysql4_Carrier_Tablerate
487
+ */
488
+ protected function _saveImportData(array $data)
489
+ {
490
+ if (!empty($data)) {
491
+ $columns = array('website_id', 'dest_country_id', 'dest_region_id', 'dest_zip',
492
+ 'weight', 'price', 'method', "markup_type", "cashondelivery_surcharge", "cod_min_surcharge", "price_vs_dest");
493
+ $this->_getWriteAdapter()->insertArray($this->getMainTable(), $columns, $data);
494
+ $this->_importedRows += count($data);
495
+ }
496
+
497
+ return $this;
498
+ }
499
+
500
+ /**
501
+ * Parse and validate decimal value
502
+ * Return false if value is not decimal
503
+ *
504
+ * @param string $value
505
+ *
506
+ * @return bool|float
507
+ */
508
+ protected function _parseDecimalValue($value, $precision = 4)
509
+ {
510
+ $value = trim($value);
511
+ if (!is_numeric($value)) {
512
+ return false;
513
+ }
514
+ $value = (float)sprintf("%.{$precision}F", $value);
515
+
516
+ return $value;
517
+ }
518
+
519
+ /**
520
+ * Parse the price/percentage column into a decimal value and a flag
521
+ * which indicates whether the value is a percentage.
522
+ *
523
+ * @param string $value
524
+ * @param float &$decimalPart
525
+ * @param boolean $markupType
526
+ *
527
+ * @return float|boolean
528
+ */
529
+ protected function _parsePricePercentage($value, &$decimalPart, &$markupType)
530
+ {
531
+ $value = trim($value);
532
+ if ($value === '') {
533
+ return false;
534
+ }
535
+ $identifier = '';
536
+ switch (substr($value, -1)) {
537
+ case '#': {
538
+ $markupType = 0;
539
+ $identifier = '#';
540
+ break;
541
+ }
542
+ case '%': {
543
+ $markupType = 1;
544
+ $identifier = '%';
545
+ break;
546
+ }
547
+ case '+': {
548
+ $markupType = 2;
549
+ $identifier = '+';
550
+ break;
551
+ }
552
+ default: {
553
+ if (is_numeric(substr($value, -1)) && is_numeric($value)) {
554
+ $markupType = 0;
555
+ $identifier = '';
556
+
557
+ break;
558
+ }
559
+
560
+ return false;
561
+ }
562
+ }
563
+
564
+ if ($value == '#') {
565
+ $decimalPart = 0;
566
+ $markupType = 0;
567
+
568
+ return true;
569
+ }
570
+ if (strlen($identifier) == 0) {
571
+ $decimalPart = $value;
572
+ } else {
573
+ $decimalPart = substr($value, 0, strlen($value) - 1);
574
+ }
575
+ $decimalPart = $this->_parseDecimalValue($decimalPart);
576
+ if ($decimalPart === false) {
577
+ return false;
578
+ }
579
+ if (!$markupType && $decimalPart < 0) {
580
+ return false;
581
+ }
582
+
583
+ return true;
584
+ }
585
+
586
+ /**
587
+ * Returns true if the method code specified is valid
588
+ *
589
+ * @param string $method
590
+ *
591
+ * @return boolean
592
+ */
593
+ protected function _validateMethod($method)
594
+ {
595
+ if (!is_array($this->_validMethods)) {
596
+ $this->_validMethods = array_keys(Mage::getModel('zitec_dpd/config_source_service')->toOptionArray());
597
+ }
598
+
599
+ return in_array($method, $this->_validMethods);
600
+ }
601
+
602
+ /**
603
+ * Return CashOnDelivery Surcharge Value
604
+ *
605
+ * @param Varien_Object
606
+ *
607
+ * @return float
608
+ */
609
+ public function getCashOnDeliverySurcharge(Varien_Object $request)
610
+ {
611
+ $adapter = $this->_getReadAdapter();
612
+ $bind = array(
613
+ ':website_id' => (int)$request->getWebsiteId(),
614
+ ':country_id' => $request->getDestCountryId(),
615
+ ':region_id' => $request->getDestRegionId(),
616
+ ':postcode' => $request->getDestPostcode(),
617
+ ':weight' => (float)$request->getPackageWeight(),
618
+ ':price' => (float)$request->getData('zitec_table_price'),
619
+ ':method' => $request->getMethod()
620
+ );
621
+
622
+ $select = $adapter->select()
623
+ ->from($this->getMainTable(), array('cashondelivery_surcharge', 'cod_min_surcharge'))
624
+ ->where('website_id=:website_id')
625
+ ->order(array('dest_country_id DESC', 'dest_region_id DESC', 'dest_zip DESC', 'method DESC', 'price_vs_dest DESC', 'weight DESC'));
626
+
627
+
628
+ // render destination condition
629
+ $orWhere = '(' . implode(') OR (', array(
630
+ "dest_country_id = :country_id AND dest_region_id = :region_id AND dest_zip = :postcode",
631
+ "dest_country_id = :country_id AND dest_region_id = :region_id AND dest_zip = ''",
632
+ "dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = ''",
633
+ "dest_country_id = :country_id AND dest_region_id = 0 AND dest_zip = :postcode",
634
+ "dest_country_id = '0' AND dest_region_id = 0 AND dest_zip = ''",
635
+ )) . ')';
636
+
637
+ $select->where($orWhere);
638
+
639
+
640
+ $select->where('((weight <= :weight and price_vs_dest = 0) or (weight <= :price and price_vs_dest = 1))');
641
+ $select->where('method = :method');
642
+
643
+ $rate = $adapter->fetchRow($select, $bind);
644
+
645
+ if (empty($rate) && $this->isRateDefinedForMethod($request)) {
646
+ $rate = null;
647
+ }
648
+
649
+ return $rate;
650
+ }
651
+
652
+
653
+ /**
654
+ * find if there is a rate defined for method in the table rate
655
+ *
656
+ * @param $request
657
+ *
658
+ * @return bool
659
+ */
660
+ public function isRateDefinedForMethod($request)
661
+ {
662
+ $adapter = $this->_getReadAdapter();
663
+ $bind = array(
664
+ ':method' => $request->getMethod()
665
+ );
666
+
667
+ $select = $adapter->select()
668
+ ->from($this->getMainTable(), array('count(*)'));
669
+
670
+ $select->where('method = :method');
671
+
672
+ $rate = $adapter->fetchOne($select, $bind);
673
+ if ($rate) {
674
+ return true;
675
+ }
676
+
677
+ return false;
678
+ }
679
+
680
+
681
+ /**
682
+ * obtain the cash on delivery tax amounth
683
+ *
684
+ * @param mixed $value
685
+ *
686
+ * @return string|null|boolean
687
+ */
688
+ protected function _parseCashOnDeliverySurcharge($value)
689
+ {
690
+ if (!isset($value)) {
691
+ return null;
692
+ }
693
+ $value = trim(strval($value));
694
+ if ($value === "") {
695
+ return null;
696
+ }
697
+
698
+ $asDecimal = $this->_parseDecimalValue($value);
699
+ if ($asDecimal !== false) {
700
+ if ($asDecimal >= 0) {
701
+ return $value;
702
+ } else {
703
+ return false;
704
+ }
705
+ }
706
+
707
+ if ($this->_getHelper()->parsePercentageValueAsFraction($value) !== false) {
708
+ return $value;
709
+ } else {
710
+ return false;
711
+ }
712
+ }
713
+
714
+ /**
715
+ *
716
+ * @return Zitec_Dpd_Helper_Data
717
+ */
718
+ protected function _getHelper()
719
+ {
720
+ return Mage::helper('zitec_dpd');
721
+ }
722
+
723
+ /**
724
+ *
725
+ * @param string $message
726
+ *
727
+ * @return Zitec_Dpd_Helper_Data
728
+ */
729
+ protected function _log($message)
730
+ {
731
+ return $this->_getHelper()->log($message);
732
+ }
733
+
734
+
735
+ }
app/code/community/Zitec/Dpd/Model/Mysql4/Carrier/Tablerate/Collection.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Mysql4_Carrier_Tablerate_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
25
+ {
26
+
27
+ /**
28
+ * directory/country table name
29
+ *
30
+ * @var string
31
+ */
32
+ protected $_countryTable;
33
+
34
+ /**
35
+ * directory/country_region table name
36
+ *
37
+ * @var string
38
+ */
39
+ protected $_regionTable;
40
+
41
+ /**
42
+ * Define resource model and item
43
+ *
44
+ */
45
+ protected function _construct()
46
+ {
47
+ $this->_init('zitec_dpd/shipping_carrier_dpd', 'zitec_dpd/carrier_tablerate');
48
+ $this->_countryTable = $this->getTable('directory/country');
49
+ $this->_regionTable = $this->getTable('directory/country_region');
50
+ }
51
+
52
+ /**
53
+ * Initialize select, add country iso3 code and region name
54
+ *
55
+ * @return void
56
+ */
57
+ public function _initSelect()
58
+ {
59
+ parent::_initSelect();
60
+
61
+ $this->_select
62
+ ->columns(array('shipping_price' => new Zend_Db_Expr("IF(main_table.markup_type = '1' OR main_table.markup_type = '2', IF(main_table.markup_type = '1',CONCAT(main_table.price, '%'), CONCAT(main_table.price,'+')), CONCAT(main_table.price,'#'))")))
63
+ ->joinLeft(
64
+ array('country_table' => $this->_countryTable), 'country_table.country_id = main_table.dest_country_id', array('dest_country' => 'iso3_code'))
65
+ ->joinLeft(
66
+ array('region_table' => $this->_regionTable), 'region_table.region_id = main_table.dest_region_id', array('dest_region' => 'code'));
67
+
68
+ $this->addOrder('dest_country', self::SORT_ORDER_ASC);
69
+ $this->addOrder('dest_region', self::SORT_ORDER_ASC);
70
+ $this->addOrder('dest_zip', self::SORT_ORDER_ASC);
71
+ }
72
+
73
+ /**
74
+ * Add website filter to collection
75
+ *
76
+ * @param int $websiteId
77
+ *
78
+ * @return Mage_Shipping_Model_Mysql4_Carrier_Tablerate_Collection
79
+ */
80
+ public function setWebsiteFilter($websiteId)
81
+ {
82
+ return $this->addFieldToFilter('website_id', $websiteId);
83
+ }
84
+
85
+ /**
86
+ * Add condition name (code) filter to collection
87
+ *
88
+ * @param string $conditionName
89
+ *
90
+ * @return Mage_Shipping_Model_Mysql4_Carrier_Tablerate_Collection
91
+ */
92
+ public function setConditionFilter($conditionName)
93
+ {
94
+ return $this->addFieldToFilter('condition_name', $conditionName);
95
+ }
96
+
97
+ /**
98
+ * Add country filter to collection
99
+ *
100
+ * @param string $countryId
101
+ *
102
+ * @return Mage_Shipping_Model_Mysql4_Carrier_Tablerate_Collection
103
+ */
104
+ public function setCountryFilter($countryId)
105
+ {
106
+ return $this->addFieldToFilter('dest_country_id', $countryId);
107
+ }
108
+
109
+ }
app/code/community/Zitec/Dpd/Model/Mysql4/Dpd/Manifest.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Mysql4_Dpd_Manifest extends Mage_Core_Model_Mysql4_Abstract
25
+ {
26
+
27
+
28
+ protected function _construct()
29
+ {
30
+ $this->_init('zitec_dpd/zitec_dpd_manifest', 'manifest_id');
31
+ }
32
+
33
+ /**
34
+ *
35
+ * @param Mage_Core_Model_Abstract $object
36
+ *
37
+ * @return Zitec_Dpd_Model_Mysql4_Dpd_Manifest
38
+ */
39
+ protected function _afterSave(Mage_Core_Model_Abstract $object)
40
+ {
41
+ $result = parent::_afterSave($object);
42
+
43
+ $manifest = $object;
44
+ /* @var $manifest Zitec_Dpd_Model_Dpd_Manifest */
45
+ foreach ($manifest->getShipsForManifest() as $ship) {
46
+ /* @var $ship Zitec_Dpd_Model_Dpd_Ship */
47
+ $ship->setManifestId($manifest->getId());
48
+ $ship->save();
49
+ }
50
+
51
+ return $result;
52
+ }
53
+
54
+
55
+ }
56
+
57
+
app/code/community/Zitec/Dpd/Model/Mysql4/Dpd/Pickup.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Mysql4_Dpd_Pickup extends Mage_Core_Model_Mysql4_Abstract
25
+ {
26
+ //put your code here
27
+ protected function _construct()
28
+ {
29
+ $this->_init('zitec_dpd/zitec_dpd_pickup_order', 'entity_id');
30
+
31
+ }
32
+ }
33
+
34
+
app/code/community/Zitec/Dpd/Model/Mysql4/Dpd/Ship.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ /**
25
+ * @method int getShipmentId()
26
+ * @method int getOrderId()
27
+ * @method string getSaveShipmentCall()
28
+ * @method string getSaveShipmentResponse()
29
+ * @method string getShippingLabels()
30
+ * @method string getManifest()
31
+ * @method int getManifestId()
32
+ */
33
+ class Zitec_Dpd_Model_Mysql4_Dpd_Ship extends Mage_Core_Model_Mysql4_Abstract
34
+ {
35
+
36
+ protected function _construct()
37
+ {
38
+ $this->_init('zitec_dpd/zitec_dpd_ship', 'id');
39
+ }
40
+
41
+ }
app/code/community/Zitec/Dpd/Model/Mysql4/Dpd/Ship/Collection.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Mysql4_Dpd_Ship_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
25
+ {
26
+
27
+ protected function _construct()
28
+ {
29
+ $this->_init('zitec_dpd/dpd_ship');
30
+ }
31
+
32
+
33
+ /**
34
+ *
35
+ * @param int $shipmentId
36
+ *
37
+ * @return Zitec_Dpd_Model_Dpd_Ship
38
+ */
39
+ public function setOrderFilter($orderId)
40
+ {
41
+ $this->addFieldToFilter('order_id', $orderId);
42
+ }
43
+
44
+ /**
45
+ *
46
+ * @param int $shipmentId
47
+ *
48
+ * @return Zitec_Dpd_Model_Dpd_Ship
49
+ */
50
+ public function getByShipmentId($shipmentId)
51
+ {
52
+ $this->addFieldToFilter('shipment_id', $shipmentId);
53
+ if ($this->count() == 0) {
54
+ return false;
55
+ }
56
+
57
+ return $this->getFirstItem();
58
+ }
59
+
60
+ /**
61
+ *
62
+ * @param array $shipmentIds
63
+ *
64
+ * @return \Zitec_Dpd_Model_Mysql4_Dpd_Ship_Collection
65
+ */
66
+ public function filterByShipmentIds(array $shipmentIds)
67
+ {
68
+ $this->addFieldToFilter("shipment_id", array("in" => $shipmentIds));
69
+
70
+ return $this;
71
+ }
72
+
73
+ /**
74
+ *
75
+ * @param type $shipmentId
76
+ *
77
+ * @return Zitec_Dpd_Model_Dpd_Ship|boolean
78
+ */
79
+ public function findByShipmentId($shipmentId)
80
+ {
81
+ foreach ($this as $ship) {
82
+ /* @var $ship Zitec_Dpd_Model_Dpd_Ship */
83
+ if ($ship->getShipmentId() == $shipmentId) {
84
+ return $ship;
85
+ }
86
+ }
87
+
88
+ return false;
89
+ }
90
+
91
+ }
92
+
app/code/community/Zitec/Dpd/Model/Observer/Address.php ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Observer_Address
25
+ {
26
+
27
+ /**
28
+ * Communicate the updated address to DPD.
29
+ */
30
+ public function salesOrderAddressAfterSave(Varien_Event_Observer $observer)
31
+ {
32
+ if (!$this->_getHelper()->isAdmin()) {
33
+ return;
34
+ }
35
+
36
+
37
+ $address = $observer->getEvent()->getAddress();
38
+ /* @var $address Mage_Sales_Model_Order_Address */
39
+ if ($address->getAddressType() != 'shipping') {
40
+ return;
41
+ }
42
+
43
+ $order = $address->getOrder();
44
+ /* @var $order Mage_Sales_Model_Order */
45
+ if (!$this->_getHelper()->moduleIsActive($order->getStore())) {
46
+ return;
47
+ }
48
+
49
+ if (!$this->_getHelper()->isShippingMethodDpd($order->getShippingMethod())) {
50
+ return;
51
+ }
52
+
53
+ if (!$this->_communicateAddresUpdateToDpd($address)) {
54
+ return;
55
+ }
56
+
57
+ $this->_getHelper()->addNotice($this->__("The new shipping address for shipments associated with this order have been communicated successfully to DPD."));
58
+
59
+ }
60
+
61
+ /**
62
+ * change the status of postcode validation
63
+ *
64
+ */
65
+ public function salesOrderAddressBeforeSave(Varien_Event_Observer $observer)
66
+ {
67
+ if (!$this->_getHelper()->isAdmin()) {
68
+ return;
69
+ }
70
+
71
+
72
+ $address = $observer->getEvent()->getAddress();
73
+ /* @var $address Mage_Sales_Model_Order_Address */
74
+ if ($address->getAddressType() != 'shipping') {
75
+ return;
76
+ }
77
+
78
+ $order = $address->getOrder();
79
+ /* @var $order Mage_Sales_Model_Order */
80
+ if (!$this->_getHelper()->moduleIsActive($order->getStore())) {
81
+ return;
82
+ }
83
+
84
+ if (!$this->_getHelper()->isShippingMethodDpd($order->getShippingMethod())) {
85
+ return;
86
+ }
87
+
88
+ $origPostcode = $address->getOrigData('postcode');
89
+ $newPostcode = $address->getPostcode();
90
+ if ($origPostcode != $newPostcode){
91
+ $address->setValidAutoPostcode(1);
92
+ }
93
+
94
+
95
+ }
96
+
97
+
98
+ /**
99
+ *
100
+ * @param Mage_Sales_Model_Order_Address $address
101
+ *
102
+ * @return boolean
103
+ */
104
+ protected function _communicateAddresUpdateToDpd(Mage_Sales_Model_Order_Address $address)
105
+ {
106
+
107
+ $shipsCollectionForOrder = Mage::getResourceModel('zitec_dpd/dpd_ship_collection');
108
+ /* @var $shipsCollectionForOrder Zitec_Dpd_Model_Mysql4_Dpd_Ship_Collection */
109
+ $shipsCollectionForOrder->setOrderFilter($address->getParentId());
110
+ if (!$shipsCollectionForOrder->count()) {
111
+ return false;
112
+ }
113
+ foreach ($shipsCollectionForOrder as $ship) {
114
+ /* @var $ship Zitec_Dpd_Model_Dpd_Ship */
115
+ $dpdShipment = unserialize($ship->getSaveShipmentCall());
116
+ /* @var $dpdShipmnent Zitec_Dpd_Api_Shipment_Save */
117
+ try {
118
+ $response = $dpdShipment->setReceiverAddress($address)
119
+ ->execute();
120
+ /* @var $response Zitec_Dpd_Api_Shipment_Save_Response */
121
+ } catch (Exception $e) {
122
+ Mage::throwException(sprintf($this->__('An error occurred updating the shipping address details with DPD: <br /> "%s"', $e->getMessage())));
123
+ }
124
+ if ($response->hasError()) {
125
+ Mage::throwException(sprintf($this->__('DPD could not update the shipment address. The following error was returned: <br /> "%s: %s"'), $response->getErrorCode(), $response->getErrorText()));
126
+ }
127
+
128
+ try {
129
+ $labelPdfStr = $this->_getWsHelper()->getNewPdfShipmentLabelsStr($response->getDpdShipmentId(), $response->getDpdShipmentReferenceNumber());
130
+ } catch (Exception $e) {
131
+ Mage::throwException(sprintf($this->__('An error occurred retrieving the updated shipping labels from DPD. <br />"s%"'), $e->getMessage()));
132
+ }
133
+
134
+ $ship->setSaveShipmentCall(serialize($dpdShipment))
135
+ ->setSaveShipmentResponse(serialize($response))
136
+ ->setShippingLabels(base64_encode($labelPdfStr))
137
+ ->save();
138
+
139
+ Mage::getModel('sales/order_shipment')
140
+ ->load($ship->getShipmentId())
141
+ ->setShippingLabel($labelPdfStr)
142
+ ->save();
143
+ }
144
+
145
+ return true;
146
+ }
147
+
148
+
149
+ /**
150
+ *
151
+ * @return Zitec_Dpd_Helper_Data
152
+ */
153
+ protected function _getHelper()
154
+ {
155
+ return Mage::helper('zitec_dpd');
156
+ }
157
+
158
+ /**
159
+ *
160
+ * @param string $translateStr
161
+ *
162
+ * @return string
163
+ */
164
+ protected function __($translateStr)
165
+ {
166
+ return $this->_getHelper()->__($translateStr);
167
+ }
168
+
169
+ /**
170
+ *
171
+ * @return Zitec_Dpd_Helper_Ws
172
+ */
173
+ protected function _getWsHelper()
174
+ {
175
+ return Mage::helper('zitec_dpd/ws');
176
+ }
177
+ }
178
+
179
+
app/code/community/Zitec/Dpd/Model/Observer/Manifest.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Observer_Manifest
25
+ {
26
+
27
+ public function addManifestMassAction(Varien_Event_Observer $observer)
28
+ {
29
+ if (!$this->_getHelper()->moduleIsActive()) {
30
+ return;
31
+ }
32
+ $block = $observer->getEvent()->getBlock();
33
+ if ($block instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction
34
+ && (($block->getRequest()->getControllerName() == 'sales_shipment'))
35
+ ) {
36
+ $block->addItem('print_dpd_manifest', array(
37
+ 'label' => $this->_getHelper()->__('Close DPD Manifest'),
38
+ 'url' => Mage::helper("adminhtml")->getUrl('zitec_dpd/adminhtml_shipment/manifest'),
39
+ 'confirm' => $this->_getHelper()->__('Once the manifest is closed for the selected shipments, you will not be able to make further changes to their shipping addresses. Do you want to continue?')
40
+ ));
41
+ }
42
+ }
43
+
44
+ /**
45
+ *
46
+ * @return Zitec_Dpd_Helper_Data
47
+ */
48
+ protected function _getHelper()
49
+ {
50
+ return Mage::helper('zitec_dpd');
51
+ }
52
+ }
53
+
54
+
app/code/community/Zitec/Dpd/Model/Observer/Payment.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Observer_Payment
25
+ {
26
+
27
+
28
+ /**
29
+ * force collect totals on checkout if the payment method is DPD
30
+ *
31
+ * @param Varien_Event_Observer $observer
32
+ */
33
+ public function setTotalsCollectedFlag(Varien_Event_Observer $observer)
34
+ {
35
+ $input = $observer->getEvent()->getInput();
36
+ if ($input->getMethod() == Mage::helper('zitec_dpd')->getDpdPaymentCode()) {
37
+ Mage::getModel('checkout/cart')->getQuote()->setTotalsCollectedFlag(false);
38
+ }
39
+ }
40
+
41
+ /**
42
+ * force collect html for review order in admin order create
43
+ *
44
+ * @param Varien_Event_Observer $observer
45
+ */
46
+ public function refreshTotalsInAdminOrderCreate(Varien_Event_Observer $observer)
47
+ {
48
+ $request = $observer->getEvent()->getRequestModel();
49
+ $payment = $request->getParam('payment');
50
+ if (!empty($payment)) {
51
+ $block = $request->getParam('block');
52
+ $blocks = explode(',', $block);
53
+ if (!in_array('totals', $blocks)) {
54
+ $request->setParam('block', $request->getParam('block') . ',totals');
55
+ }
56
+ }
57
+ }
58
+
59
+
60
+ }
app/code/community/Zitec/Dpd/Model/Observer/Pickup.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Observer_Pickup
25
+ {
26
+
27
+ public function createPickupAction(Varien_Event_Observer $observer)
28
+ {
29
+ return;
30
+ if (!$this->_getHelper()->moduleIsActive()) {
31
+ return;
32
+ }
33
+ $block = $observer->getEvent()->getBlock();
34
+ if ($block instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction
35
+ && (($block->getRequest()->getControllerName() == 'sales_shipment'))
36
+ ) {
37
+ $block->addItem('create_dpd_pickup', array(
38
+ 'label' => $this->_getHelper()->__('Arrange DPD Pickup'),
39
+ 'url' => Mage::helper("adminhtml")->getUrl('zitec_dpd/adminhtml_shipment/createpickup'),
40
+ 'additional' => array(
41
+ 'zitec_dpd_pickup_date' => array(
42
+ 'name' => 'zitec_dpd_pickup_date',
43
+ 'type' => 'text',
44
+ 'class' => 'required-entry',
45
+ 'label' => Mage::helper('index')->__('Date (DD/MM/YYYY)')
46
+ ),
47
+ 'zitec_dpd_pickup_from' => array(
48
+ 'name' => 'zitec_dpd_pickup_from',
49
+ 'type' => 'time',
50
+ 'class' => 'required-entry',
51
+ 'label' => Mage::helper('index')->__('Between')
52
+ ),
53
+ 'zitec_dpd_pickup_to' => array(
54
+ 'name' => 'zitec_dpd_pickup_to',
55
+ 'type' => 'time',
56
+ 'class' => 'required-entry',
57
+ 'label' => Mage::helper('index')->__('and')
58
+ ),
59
+ 'zitec_dpd_pickup_instruction' => array(
60
+ 'name' => 'zitec_dpd_pickup_instruction',
61
+ 'type' => 'text',
62
+ 'label' => Mage::helper('index')->__('Instructions')
63
+ ),
64
+ )
65
+ ));
66
+ }
67
+ }
68
+
69
+ /**
70
+ *
71
+ * @return Zitec_Dpd_Helper_Data
72
+ */
73
+ protected function _getHelper()
74
+ {
75
+ return Mage::helper('zitec_dpd');
76
+ }
77
+
78
+ }
79
+
80
+
app/code/community/Zitec/Dpd/Model/Observer/Shipment.php ADDED
@@ -0,0 +1,455 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Observer_Shipment
25
+ {
26
+
27
+ /**
28
+ *
29
+ * @var boolean
30
+ */
31
+ protected $_isProcessed = false;
32
+
33
+ /**
34
+ *
35
+ * @var Mage_Sales_Model_Order_Address
36
+ */
37
+ protected $_shippingAddress = null;
38
+
39
+ /**
40
+ *
41
+ * @var Mage_Sales_Model_Order
42
+ */
43
+ protected $_order = null;
44
+
45
+ /**
46
+ *
47
+ * @var Zitec_Dpd_Api_Shipment_Save_Response
48
+ */
49
+ protected $_response = null;
50
+
51
+ /**
52
+ *
53
+ * @var Zitec_Dpd_Api_Shipment_Save
54
+ */
55
+ protected $_call = null;
56
+
57
+ /**
58
+ *
59
+ * @var string
60
+ */
61
+ protected $_labelPdfStr = null;
62
+
63
+
64
+ /**
65
+ *
66
+ * @var Mage_Sales_Model_Order_Shipment
67
+ */
68
+ protected $_shipment = null;
69
+
70
+ /**
71
+ *
72
+ */
73
+ protected $_isOrderShipmentNew = false;
74
+
75
+ /**
76
+ * @param Varien_Event_Observer $observer
77
+ */
78
+ public function salesOrderShipmentSaveBefore(Varien_Event_Observer $observer)
79
+ {
80
+ $shipment = $observer->getEvent()->getShipment();
81
+ if (is_null($shipment->getId())) {
82
+ $this->_isOrderShipmentNew = true;
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Saves the DPD shipment when the shipment is created.
88
+ *
89
+ * @param void
90
+ */
91
+ public function salesOrderShipmentSaveAfter(Varien_Event_Observer $observer)
92
+ {
93
+ /**
94
+ * @var Mage_Sales_Model_Order_Shipment $shipment
95
+ */
96
+ $shipment = $observer->getEvent()->getShipment();
97
+ if (!$this->_canSaveDpdShipment($shipment)) {
98
+ return;
99
+ }
100
+
101
+ $this->_isProcessed = true;
102
+
103
+ $this->_setShipment($observer->getEvent()->getShipment());
104
+ $this->_setOrder($this->_getShipment()->getOrder());
105
+
106
+ $packedShipment = new Zitec_PackedShipment_Model_PackedShipment($this->_getShipment(), Mage::app()->getRequest()->getParam('packages'));
107
+ if (!$packedShipment->getPackages()) {
108
+ return $observer;
109
+ }
110
+
111
+
112
+ $this->_createShipment($packedShipment);
113
+
114
+ $this->_getLabels();
115
+
116
+
117
+ $successNotice = $this->__('Your new shipment was successfully communicated to DPD.');
118
+ if ($this->_getDPDMessage()) {
119
+ $successNotice .= '<br />' . sprintf($this->__('DPD says, "%s"'), $this->_getDPDMessage());
120
+ }
121
+ $this->_getHelper()->addNotice($successNotice);
122
+ }
123
+
124
+ /**
125
+ * @param Zitec_PackedShipment_Model_PackedShipment $packedShipment
126
+ *
127
+ * @return bool
128
+ * @throws Mage_Core_Exception
129
+ */
130
+ protected function _createShipment(Zitec_PackedShipment_Model_PackedShipment $packedShipment)
131
+ {
132
+ $dpdApi = new Zitec_Dpd_Api($this->_getShipmentParams());
133
+ $dpdShipment = $dpdApi->getApiMethodObject();
134
+
135
+ $serviceCode = $this->_getHelper()->getDPDServiceCode($this->_getOrder()->getShippingMethod());
136
+ if (!$serviceCode) {
137
+ Mage::throwException(sprintf($this->__("An error occurred communicating the shipment to DPD. The shipping method '%s' is invalid"), $this->_getOrder()->getShippingMethod()));
138
+ }
139
+ $dpdShipment->setReceiverAddress($this->_getShippingAddress())
140
+ ->setShipmentReferenceNumber($this->_getShipment()->getIncrementId())
141
+ ->setShipmentServiceCode($serviceCode);
142
+
143
+
144
+ foreach ($packedShipment->getPackages() as $packageIdx => $package) {
145
+ $dpdShipment->addParcel($packageIdx + 1, $package->getPackageWeight(), $package->getRef());
146
+ }
147
+
148
+ if ($this->_getHelper()->isOrderCashOnDelivery($this->_getOrder())) {
149
+ $paymentType = $this->_getHelper()->getCodPaymentType($this->_getOrder());
150
+ $dpdShipment->setCashOnDelivery(round($this->_getOrder()->getBaseGrandTotal(), 2), $this->_getOrder()->getBaseCurrencyCode(), $paymentType);
151
+ }
152
+ $order = $this->_getOrder();
153
+ $insurance = Mage::helper('zitec_dpd')->extractInsuranceValuesByOrder($order);
154
+ $dpdShipment->setAdditionalHighInsurance($insurance['goodsValue'], $insurance['currency'], $insurance['content']);
155
+
156
+ try {
157
+ $response = $dpdShipment->execute();
158
+ } catch (Zitec_Dpd_Api_Shipment_Save_Exception_ReceiverAddressTooLong $e) {
159
+ $message = "The shipment could not be communicated to DPD because the shipping street the maximum permitted length of %s characters. <br />Please edit the shipping address to reduce the length of the street in the shipping address.";
160
+ Mage::throwException(sprintf($this->__($message), $e->getMaxLength()));
161
+ } catch (Exception $e) {
162
+ Mage::throwException(sprintf($this->__("An error occurred communicating the shipment to DPD at %s:<br /> '%s'"), $dpdShipment->getUrl(), $e->getMessage()));
163
+ }
164
+
165
+ if ($response->hasError()) {
166
+ $message = sprintf($this->__('DPD could not process the new shipment. The following error was returned: <br /> "%s: %s"'), $response->getErrorCode(), $response->getErrorText());
167
+ Mage::throwException($message);
168
+ }
169
+
170
+ $this->_response = $response;
171
+ $this->_call = $dpdShipment;
172
+
173
+ $this->_saveShipmentResponse($response, $dpdShipment);
174
+
175
+ return true;
176
+ }
177
+
178
+ /**
179
+ *
180
+ * @return string|boolean
181
+ */
182
+ protected function _getDPDMessage()
183
+ {
184
+ if ($this->_response instanceof Zitec_Dpd_Api_Shipment_Save_Response) {
185
+ return $this->_response->getMessage();
186
+ } else {
187
+ return false;
188
+ }
189
+ }
190
+
191
+ /**
192
+ *
193
+ * @return array
194
+ */
195
+ protected function _getShipmentParams()
196
+ {
197
+ $apiParams = $this->_getWsHelper()->getShipmentParams($this->_getOrder()->getStoreId());
198
+ $apiParams['method'] = Zitec_Dpd_Api_Configs::METHOD_CREATE_SHIPMENT;
199
+
200
+ return $apiParams;
201
+ }
202
+
203
+ /**
204
+ * @param Zitec_Dpd_Api_Shipment_Save_Response $response
205
+ *
206
+ * @return bool
207
+ * @throws Exception
208
+ */
209
+ protected function _saveTracking($response)
210
+ {
211
+ $trackNumber = $response->getDpdShipmentReferenceNumber();
212
+ $carrier = Mage::helper('zitec_dpd')->getDpdCarrierCode();
213
+ $shipment = $this->_getShipment();
214
+ $carrierName = $this->_getHelper()->getCarrierName($this->_getStore());
215
+ $track = Mage::getModel('sales/order_shipment_track')
216
+ ->setNumber($trackNumber)
217
+ ->setTrackNumber($trackNumber)
218
+ ->setCarrierCode($carrier)
219
+ ->setTitle($carrierName);
220
+ $shipment->addTrack($track);
221
+ $shipment->save();
222
+
223
+ return true;
224
+ }
225
+
226
+ /**
227
+ *
228
+ * @return boolean
229
+ */
230
+ protected function _getLabels()
231
+ {
232
+ try {
233
+ $this->_labelPdfStr = $this->_getWsHelper()->getNewPdfShipmentLabelsStr($this->_response->getDpdShipmentId(), $this->_response->getDpdShipmentReferenceNumber());
234
+ $this->_getShipment()->setShippingLabel($this->_labelPdfStr)->save();
235
+
236
+ } catch (Exception $e) {
237
+ Mage::throwException(sprintf('An error occurred whilst retreiving the shipping labels from DPD for the new shipment. <br /> "%s"'));
238
+ }
239
+
240
+ return true;
241
+ }
242
+
243
+ /**
244
+ *
245
+ * @param Zitec_Dpd_Api_Shipment_Save_Response $response
246
+ *
247
+ * @return boolean
248
+ */
249
+ protected function _saveShipmentResponse($response, $call)
250
+ {
251
+ $ship = Mage::getModel('zitec_dpd/dpd_ship');
252
+ $ship->setShipmentId($this->_getShipment()->getId())
253
+ ->setOrderId($this->_getOrder()->getId())
254
+ ->setSaveShipmentCall(serialize($call))
255
+ ->setShippingLabels(base64_encode($this->_labelPdfStr))
256
+ ->setSaveShipmentResponse(serialize($response))
257
+ ->save();
258
+
259
+ $this->_saveTracking($response);
260
+
261
+ $this->_getShipment()->setShippingLabel($this->_labelPdfStr)->save();
262
+
263
+ return true;
264
+ }
265
+
266
+ /**
267
+ * is not used anymore - to copy the file we use config.xml
268
+ *
269
+ * @param Varien_Object $observer
270
+ *
271
+ * @return
272
+ */
273
+ public function postcodeAddressConvertToOrder($observer)
274
+ {
275
+ if ($observer->getEvent()->getAddress()->getValidPostcode()) {
276
+ $observer->getEvent()->getOrder()
277
+ ->setValidPostcode($observer->getEvent()->getAddress()->getValidPostcode());
278
+ }
279
+ if ($observer->getEvent()->getAddress()->getAutoPostcode()) {
280
+ $observer->getEvent()->getOrder()
281
+ ->setAutoPostcode($observer->getEvent()->getAddress()->getAutoPostcode());
282
+ }
283
+
284
+ return $this;
285
+ }
286
+
287
+ /**
288
+ * add some blocks used for postcode validation
289
+ *
290
+ * @param Varien_Object $observer
291
+ *
292
+ * @return
293
+ */
294
+ public function adminAddPostcodeAutocompleteBlock($observer)
295
+ {
296
+ $transport = $observer->getEvent()->getTransport();
297
+ $block = $observer->getEvent()->getBlock();
298
+ if ($block instanceof Mage_Adminhtml_Block_Sales_Order_Address) {
299
+ $content = $transport->getHtml();
300
+
301
+ $content .= Mage::app()->getLayout()
302
+ ->createBlock('core/template')
303
+ ->setTemplate('zitec_dpd/sales/order/address/postcode/validate.phtml')->toHtml();
304
+
305
+ $transport->setHtml($content);
306
+ }
307
+
308
+ if ($block instanceof Mage_Adminhtml_Block_Sales_Order_View_Info) {
309
+ $isDpdCarrier = Mage::helper('zitec_dpd')->isDpdCarrierByOrder($block->getOrder());
310
+ $isPCAutocompleterEnabled = Mage::helper('zitec_dpd')->isEnabledPostcodeAutocompleteByOrder($block->getOrder());
311
+ if ($isDpdCarrier) {
312
+ $content = $transport->getHtml();
313
+ if ($isPCAutocompleterEnabled) {
314
+
315
+ $content .= Mage::app()->getLayout()
316
+ ->createBlock('core/template')
317
+ ->setOrder($block->getOrder())
318
+ ->setTemplate('zitec_dpd/sales/order/address/postcode/alert-problem.phtml')->toHtml();
319
+ }
320
+
321
+ $content .= Mage::app()->getLayout()
322
+ ->createBlock('core/template')
323
+ ->setOrder($block->getOrder())
324
+ ->setTemplate('zitec_dpd/sales/order/address/street/alert-problem.phtml')->toHtml();
325
+
326
+ $transport->setHtml($content);
327
+ }
328
+ }
329
+
330
+
331
+ return $this;
332
+ }
333
+
334
+
335
+ /**
336
+ * @param Mage_Sales_Model_Order_Shipment $shipment
337
+ *
338
+ * @return bool
339
+ */
340
+ protected function _canSaveDpdShipment(Mage_Sales_Model_Order_Shipment $shipment)
341
+ {
342
+ if (!$this->_isOrderShipmentNew || $this->_isProcessed) {
343
+ return false;
344
+ }
345
+
346
+ if (!$this->_getHelper()->moduleIsActive($shipment->getOrder()->getStore())) {
347
+ return false;
348
+ }
349
+
350
+ if (!$this->_getHelper()->isShippingMethodDpd($shipment->getOrder()->getShippingMethod())) {
351
+ return false;
352
+ }
353
+
354
+ return true;
355
+ }
356
+
357
+ /**
358
+ *
359
+ * @param Mage_Sales_Model_Order $order
360
+ *
361
+ * @return \Zitec_Dpd_Model_Observer_Shipment
362
+ */
363
+ protected function _setOrder(Mage_Sales_Model_Order $order)
364
+ {
365
+ $this->_order = $order;
366
+
367
+ return $this;
368
+ }
369
+
370
+ /**
371
+ *
372
+ * @return Mage_Sales_Model_Order
373
+ */
374
+ protected function _getOrder()
375
+ {
376
+ return $this->_order;
377
+ }
378
+
379
+ /**
380
+ *
381
+ * @param Mage_Sales_Model_Order_Shipment $shipment
382
+ *
383
+ * @return \Zitec_Dpd_Model_Observer_Shipment
384
+ */
385
+ protected function _setShipment(Mage_Sales_Model_Order_Shipment $shipment)
386
+ {
387
+ $this->_shipment = $shipment;
388
+
389
+ return $this;
390
+ }
391
+
392
+ /**
393
+ *
394
+ * @return Mage_Sales_Model_Order_Shipment
395
+ */
396
+ protected function _getShipment()
397
+ {
398
+ return $this->_shipment;
399
+ }
400
+
401
+ /**
402
+ *
403
+ * @return Mage_Core_Model_Store
404
+ */
405
+ protected function _getStore()
406
+ {
407
+ return $this->_getOrder()->getStore();
408
+ }
409
+
410
+ /**
411
+ * Important: Here we load the shipping address from the database rather than
412
+ * using the one accessible from the order. This is intentional. using the one on the order
413
+ * appears to cause a crash with some versions of PHP.
414
+ *
415
+ * @return Mage_Sales_Model_Order_Address
416
+ */
417
+ protected function _getShippingAddress()
418
+ {
419
+ if (!$this->_shippingAddress) {
420
+ $this->_shippingAddress = Mage::getModel('sales/order_address')->load($this->_getOrder()->getShippingAddressId());
421
+ }
422
+
423
+ return $this->_shippingAddress;
424
+ }
425
+
426
+ /**
427
+ *
428
+ * @return Zitec_Dpd_Helper_Ws
429
+ */
430
+ protected function _getWsHelper()
431
+ {
432
+ return Mage::helper('zitec_dpd/ws');
433
+ }
434
+
435
+ /**
436
+ *
437
+ * @return Zitec_Dpd_Helper_Data
438
+ */
439
+ protected function _getHelper()
440
+ {
441
+ return Mage::helper('zitec_dpd');
442
+ }
443
+
444
+ /**
445
+ *
446
+ * @param string $translateStr
447
+ *
448
+ * @return string
449
+ */
450
+ protected function __($translateStr)
451
+ {
452
+ return $this->_getHelper()->__($translateStr);
453
+ }
454
+
455
+ }
app/code/community/Zitec/Dpd/Model/Payment/Cashondelivery.php ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Payment_Cashondelivery extends Mage_Payment_Model_Method_Abstract
25
+ {
26
+
27
+ const CODE = 'zitec_dpd_cashondelivery';
28
+
29
+ protected $_code = 'zitec_dpd_cashondelivery';
30
+ protected $_isInitializeNeeded = true;
31
+ protected $_canUseInternal = true;
32
+ protected $_canUseForMultishipping = false;
33
+ protected $_surcharge = null;
34
+ protected $_order = null;
35
+
36
+ /**
37
+ * Retrieve payment method title
38
+ *
39
+ * @return string
40
+ */
41
+ public function getTitle()
42
+ {
43
+ $order = $this->fetchOrder();
44
+ $title = '';
45
+ $store = null;
46
+ if ($order) {
47
+ $title = $this->getConfigData('title', $order->getStoreId());
48
+ $store = $order->getStoreId();
49
+ } else {
50
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
51
+ if ($quote) {
52
+ $title = $this->getConfigData('title', $quote->getStoreId());
53
+ $store = $quote->getStoreId();
54
+ }
55
+ }
56
+ $surcharge = $this->getSurchage();
57
+ if ($surcharge > 0) {
58
+ $title = $title . ' (+ ' . Mage::helper('core')->formatCurrency($surcharge, false);
59
+ $taxConfig = Mage::getSingleton('tax/config');
60
+ /* @var $taxConfig Mage_Tax_Model_Config */
61
+ if ($taxConfig->shippingPriceIncludesTax($store)) {
62
+ $title .= $this->_getHelper()->__(' incl. tax');
63
+ } else {
64
+ $title .= $this->_getHelper()->__(' excl. tax');
65
+ }
66
+ $title .= ') ';
67
+ }
68
+
69
+ return $title;
70
+ }
71
+
72
+ /**
73
+ * Check whether payment method can be used
74
+ *
75
+ * TODO: payment method instance is not supposed to know about quote
76
+ *
77
+ * @param Mage_Sales_Model_Quote|null $quote
78
+ *
79
+ * @return bool
80
+ */
81
+ public function isAvailable($quote = null)
82
+ {
83
+ $checkResult = new StdClass;
84
+ $isActive = (bool)(int)$this->getConfigData('active', $quote ? $quote->getStoreId() : null);
85
+ $shippingMethodRaw = $quote->getShippingAddress()->getShippingMethod();
86
+ $product = $this->_getHelper()->getDPDServiceCode($shippingMethodRaw);
87
+
88
+ if (!$isActive ||
89
+ !$quote ||
90
+ !$this->_getHelper()->isShippingMethodDpd($shippingMethodRaw) ||
91
+ !in_array($product, explode(',', $this->getConfigData('specificproducto', $quote->getStoreId()))) ||
92
+ is_null($this->getSurchage())
93
+ ) {
94
+ $isActive = false;
95
+ }
96
+
97
+ $checkResult->isAvailable = $isActive;
98
+ $checkResult->isDeniedInConfig = !$isActive; // for future use in observers
99
+ Mage::dispatchEvent('payment_method_is_active', array(
100
+ 'result' => $checkResult,
101
+ 'method_instance' => $this,
102
+ 'quote' => $quote,
103
+ ));
104
+
105
+ // disable method if it cannot implement recurring profiles management and there are recurring items in quote
106
+ if ($checkResult->isAvailable) {
107
+ $implementsRecurring = $this->canManageRecurringProfiles();
108
+ // the $quote->hasRecurringItems() causes big performance impact, thus it has to be called last
109
+ if ($quote && !$implementsRecurring && $quote->hasRecurringItems()) {
110
+ $checkResult->isAvailable = false;
111
+ }
112
+ }
113
+
114
+ return $checkResult->isAvailable;
115
+ }
116
+
117
+ public function getSurchage()
118
+ {
119
+ if ($this->_surcharge === null) {
120
+ $order = $this->fetchOrder();
121
+ if ($order) {
122
+ $this->_surcharge = $order->getData('base_zitec_dpd_cashondelivery_surcharge');
123
+ } else {
124
+ $quote = Mage::helper('zitec_dpd/payment')->getQuote();
125
+ /* @var $quote Mage_Sales_Model_Quote */
126
+ if ($quote) {
127
+ $shippingAddress = $quote->getShippingAddress();
128
+
129
+ $request = new Varien_Object();
130
+
131
+ $request->setWebsiteId(Mage::helper('zitec_dpd/payment')->getWebsiteId());
132
+ $request->setDestCountryId($shippingAddress->getCountryId());
133
+ $request->setDestRegionId($shippingAddress->getRegionId());
134
+ $request->setDestPostcode($shippingAddress->getPostcode());
135
+ $request->setPackageWeight($shippingAddress->getWeight());
136
+ if ($this->_getTaxHelper()->shippingPriceIncludesTax($quote->getStoreId())) {
137
+ $request->setData('zitec_table_price', $shippingAddress->getBaseSubtotalInclTax());
138
+ } else {
139
+ $request->setData('zitec_table_price', $shippingAddress->getBaseSubtotal());
140
+ }
141
+ $request->setMethod(str_replace(Mage::helper('zitec_dpd')->getDPDCarrierCode() . '_', '', $shippingAddress->getShippingMethod()));
142
+ $tablerateSurcharge = Mage::getResourceModel('zitec_dpd/carrier_tablerate')->getCashOnDeliverySurcharge($request);
143
+
144
+ if (is_null($tablerateSurcharge) || (is_array($tablerateSurcharge)&& is_null($tablerateSurcharge['cashondelivery_surcharge']))) {
145
+ return null;
146
+ } elseif (!empty($tablerateSurcharge)) {
147
+ $this->_surcharge = $this->_getHelper()->calculateQuoteBaseCashOnDeliverySurcharge($quote, $tablerateSurcharge);
148
+ } else {
149
+ $this->_surcharge = $this->_getHelper()->returnDefaultBaseCashOnDeliverySurcharge($quote);
150
+ }
151
+ }
152
+ }
153
+ }
154
+
155
+ return $this->_surcharge;
156
+ }
157
+
158
+ /**
159
+ *
160
+ * @return Mage_Tax_Helper_Data
161
+ */
162
+ protected function _getTaxHelper()
163
+ {
164
+ return Mage::helper('tax');
165
+ }
166
+
167
+ /**
168
+ * @return Mage_Core_Model_Abstract|mixed|null
169
+ */
170
+ public function fetchOrder()
171
+ {
172
+ if (is_null($this->_order)) {
173
+ if (Mage::app()->getStore()->isAdmin()) {
174
+ $this->_order = Mage::registry('current_order');
175
+ if (!$this->_order && Mage::app()->getRequest()->getParam('order_id')) {
176
+ $this->_order = Mage::getModel('sales/order')->load(Mage::app()->getRequest()->getParam('order_id'));
177
+ }
178
+ } else {
179
+ $order_id = Mage::app()->getRequest()->getParam('order_id');
180
+ if ($order_id) {
181
+ $this->_order = Mage::getModel('sales/order')->load(Mage::app()->getRequest()->getParam('order_id'));
182
+ }
183
+ }
184
+ }
185
+
186
+ return $this->_order;
187
+ }
188
+
189
+ /**
190
+ * To check billing country is allowed for the payment method
191
+ *
192
+ * @return bool
193
+ */
194
+ public function canUseForCountry($country)
195
+ {
196
+ $allowedCountries = Zitec_Dpd_Model_Payment_Cashondelivery_Source_Country::getAllAllowedCountries();
197
+ $canUseForCountry = parent::canUseForCountry($country) && (!$allowedCountries || in_array($country, $allowedCountries));
198
+
199
+ return $canUseForCountry ? true : false;
200
+ }
201
+
202
+ /**
203
+ *
204
+ * @return Zitec_Dpd_Helper_Data
205
+ */
206
+ protected function _getHelper()
207
+ {
208
+ return Mage::helper('zitec_dpd');
209
+ }
210
+
211
+
212
+ }
213
+
app/code/community/Zitec/Dpd/Model/Payment/Cashondelivery/Source/AmountType.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Payment_Cashondelivery_Source_AmountType extends Zitec_Dpd_Model_Config_Source_Abstract
25
+ {
26
+
27
+ public function toOptionArray()
28
+ {
29
+
30
+ $codPaymentTypes = array(
31
+ Zitec_Dpd_Api_Configs::PAYMENT_AMOUNT_TYPE_FIXED => $this->__('Fixed amount'),
32
+ Zitec_Dpd_Api_Configs::PAYMENT_AMOUNT_TYPE_PERCENTAGE => $this->__('Percentage of entire order'),
33
+ );
34
+
35
+ return $codPaymentTypes;
36
+ }
37
+
38
+
39
+ }
40
+
41
+
app/code/community/Zitec/Dpd/Model/Payment/Cashondelivery/Source/Codpaymenttype.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Payment_Cashondelivery_Source_Codpaymenttype extends Zitec_Dpd_Model_Config_Source_Abstract
25
+ {
26
+
27
+ public function toOptionArray()
28
+ {
29
+
30
+ $codPaymentTypes = array(
31
+ Zitec_Dpd_Api_Configs::PAYMENT_TYPE_CASH => $this->__('Cash'),
32
+ Zitec_Dpd_Api_Configs::PAYMENT_TYPE_CREDIT_CARD => $this->__('Credit Card'),
33
+ Zitec_Dpd_Api_Configs::PAYMENT_TYPE_CROSSED_CHECK => $this->__('Crossed Check')
34
+ );
35
+
36
+ return $codPaymentTypes;
37
+ }
38
+
39
+
40
+ }
41
+
42
+
app/code/community/Zitec/Dpd/Model/Payment/Cashondelivery/Source/Country.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Payment_Cashondelivery_Source_Country extends Mage_Adminhtml_Model_System_Config_Source_Country
25
+ {
26
+
27
+ protected static $_allAllowedCountries = null;
28
+
29
+ public function toOptionArray($isMultiselect = false)
30
+ {
31
+ $options = parent::toOptionArray($isMultiselect);
32
+ if (self::getAllAllowedCountries()) {
33
+ foreach ($options as $key => $option) {
34
+ if ($option['value'] && !in_array($option['value'], self::getAllAllowedCountries())) {
35
+ unset($options[$key]);
36
+ }
37
+ }
38
+ }
39
+
40
+ return $options;
41
+ }
42
+
43
+ /**
44
+ *
45
+ * @return array
46
+ */
47
+ public static function getAllAllowedCountries()
48
+ {
49
+ if (!is_array(self::$_allAllowedCountries)) {
50
+ $allAllowedCountries = trim(Mage::getStoreConfig("payment/zitec_dpd_cashondelivery/all_allowed_countries"));
51
+ if ($allAllowedCountries) {
52
+ self::$_allAllowedCountries = explode(",", Mage::getStoreConfig("payment/zitec_dpd_cashondelivery/all_allowed_countries"));
53
+ } else {
54
+ self::$_allAllowedCountries = array();
55
+ }
56
+ }
57
+
58
+ return self::$_allAllowedCountries;
59
+ }
60
+
61
+
62
+ }
63
+
64
+
app/code/community/Zitec/Dpd/Model/Payment/Cashondelivery/Source/Service.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Payment_Cashondelivery_Source_Service
25
+ {
26
+ protected $_allowedServices = null;
27
+
28
+ /**
29
+ *
30
+ * @param boolean $isMultiselect
31
+ *
32
+ * @return array
33
+ */
34
+ public function toOptionArray($isMultiselect = false)
35
+ {
36
+ $servicesSource = Mage::getModel('zitec_dpd/config_source_service');
37
+ /* @var $services Zitec_Dpd_Model_Config_Source_Service */
38
+ $services = $servicesSource->toOptionArray($isMultiselect);
39
+ foreach ($services as $key => $service) {
40
+ $serviceCode = $isMultiselect ? $service['value'] : $key;
41
+ if (!in_array($serviceCode, $this->_getAllowedServices())) {
42
+ unset($services[$key]);
43
+ }
44
+ }
45
+
46
+ return $services;
47
+ }
48
+
49
+ /**
50
+ *
51
+ * @return array
52
+ */
53
+ protected function _getAllowedServices()
54
+ {
55
+ if (!is_array($this->_allowedServices)) {
56
+ $this->_allowedServices = explode(",", Mage::getStoreConfig("payment/zitec_dpd_cashondelivery/services"));
57
+ }
58
+
59
+ return $this->_allowedServices;
60
+ }
61
+
62
+
63
+ }
64
+
65
+
66
+
app/code/community/Zitec/Dpd/Model/Sales/Order/Creditmemo/Total/Cashondeliverysurchage.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Sales_Order_Creditmemo_Total_Cashondeliverysurchage extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract
25
+ {
26
+
27
+ public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
28
+ {
29
+
30
+
31
+ $creditmemo->setData('zitec_dpd_cashondelivery_surcharge', 0);
32
+ $creditmemo->setData('base_zitec_dpd_cashondelivery_surcharge', 0);
33
+
34
+ $order = $creditmemo->getOrder();
35
+
36
+
37
+ //Check creditmemo before to see if we have already returned
38
+ $amount = $order->getData('zitec_dpd_cashondelivery_surcharge');
39
+ if ($amount) {
40
+ foreach ($order->getCreditmemosCollection() as $previousCreditMemo) {
41
+ /* @var $previousCreditMemo Mage_Sales_Model_Order_Creditmemo */
42
+ if ($previousCreditMemo->getData("base_zitec_dpd_cashondelivery_surcharge")) {
43
+ return $this;
44
+ }
45
+ }
46
+
47
+ // NB. Here we add one to the total tax base. Taxes
48
+ // are added in Zitec_Dpd_Model_Sales_Order_Creditmemo_Total_Tax
49
+ $creditmemo->setData('zitec_dpd_cashondelivery_surcharge', $amount);
50
+
51
+ $baseAmount = $order->getData('base_zitec_dpd_cashondelivery_surcharge');
52
+ $creditmemo->setData('base_zitec_dpd_cashondelivery_surcharge', $baseAmount);
53
+
54
+ $creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $amount);
55
+ $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $baseAmount);
56
+
57
+ }
58
+
59
+ return $this;
60
+ }
61
+
62
+ }
app/code/community/Zitec/Dpd/Model/Sales/Order/Creditmemo/Total/Tax.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Sales_Order_Creditmemo_Total_Tax extends Mage_Sales_Model_Order_Creditmemo_Total_Tax
25
+ {
26
+ public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
27
+ {
28
+
29
+ $result = parent::collect($creditmemo);
30
+
31
+ // We added taxes on delivery surcharge
32
+ $creditmemo->setData("zitec_dpd_cashondelivery_surcharge_tax", 0);
33
+ $creditmemo->setData("base_zitec_dpd_cashondelivery_surcharge_tax", 0);
34
+ if ($creditmemo->getData("zitec_dpd_cashondelivery_surcharge")) {
35
+ $baseTax = $creditmemo->getOrder()->getData("base_zitec_dpd_cashondelivery_surcharge_tax");
36
+ $creditmemo->setData("base_zitec_dpd_cashondelivery_surcharge_tax", $baseTax);
37
+ $creditmemo->setBaseTaxAmount($creditmemo->getBaseTaxAmount() + $baseTax);
38
+ $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $baseTax);
39
+
40
+ $tax = $creditmemo->getOrder()->getData("zitec_dpd_cashondelivery_surcharge_tax");
41
+ $creditmemo->setData("zitec_dpd_cashondelivery_surcharge_tax", $tax);
42
+ $creditmemo->setTaxAmount($creditmemo->getTaxAmount() + $tax);
43
+ $creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $tax);
44
+ }
45
+
46
+ return $result;
47
+ }
48
+ }
49
+
50
+
app/code/community/Zitec/Dpd/Model/Sales/Order/Invoice/Total/Cashondeliverysurchage.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Sales_Order_Invoice_Total_Cashondeliverysurchage extends Mage_Sales_Model_Order_Invoice_Total_Abstract
25
+ {
26
+
27
+ public function collect(Mage_Sales_Model_Order_Invoice $invoice)
28
+ {
29
+ $invoice->setData('zitec_dpd_cashondelivery_surcharge', 0);
30
+ $invoice->setData('base_zitec_dpd_cashondelivery_surcharge', 0);
31
+ $invoice->setData('zitec_dpd_cashondelivery_surcharge_tax', 0);
32
+ $invoice->setData('base_zitec_dpd_cashondelivery_surcharge_tax', 0);
33
+
34
+ $order = $invoice->getOrder();
35
+ $amount = $order->getData('zitec_dpd_cashondelivery_surcharge');
36
+ if ($amount) {
37
+ // We look at the bills to see if it has already claimed the COD surcharge.
38
+ foreach ($order->getInvoiceCollection() as $previousInvoice) {
39
+ /* @var $previousInvoice Mage_Sales_Model_Order_Invoice */
40
+ if (!$previousInvoice->isCanceled() && $previousInvoice->getData('base_zitec_dpd_cashondelivery_surcharge')) {
41
+ return $this;
42
+ }
43
+ }
44
+ $invoice->setData('zitec_dpd_cashondelivery_surcharge', $amount);
45
+
46
+ $baseAmount = $order->getData('base_zitec_dpd_cashondelivery_surcharge');
47
+ $invoice->setData('base_zitec_dpd_cashondelivery_surcharge', $baseAmount);
48
+
49
+
50
+ $invoice->setGrandTotal($invoice->getGrandTotal() + $amount);
51
+ $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $amount);
52
+
53
+ // NB. We do not add taxes grand total here.
54
+ // Are added Zitec_Dpd_Model_Sales_Order_Invoice_Total_Tax.
55
+
56
+ }
57
+
58
+ return $this;
59
+ }
60
+
61
+ }
app/code/community/Zitec/Dpd/Model/Sales/Order/Invoice/Total/Tax.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Sales_Order_Invoice_Total_Tax extends Mage_Sales_Model_Order_Invoice_Total_Tax
25
+ {
26
+
27
+ public function collect(Mage_Sales_Model_Order_Invoice $invoice)
28
+ {
29
+ $result = parent::collect($invoice);
30
+ // We added taxes on delivery surcharge
31
+
32
+ $invoice->setData("zitec_dpd_cashondelivery_surcharge_tax", 0);
33
+ $invoice->setData("base_zitec_dpd_cashondelivery_surcharge_tax", 0);
34
+ if ($invoice->getData("zitec_dpd_cashondelivery_surcharge")) {
35
+ $baseTax = $invoice->getOrder()->getData("base_zitec_dpd_cashondelivery_surcharge_tax");
36
+ $invoice->setData("base_zitec_dpd_cashondelivery_surcharge_tax", $baseTax);
37
+
38
+ $tax = $invoice->getOrder()->getData("zitec_dpd_cashondelivery_surcharge_tax");
39
+ $invoice->setData("zitec_dpd_cashondelivery_surcharge_tax", $tax);
40
+
41
+ // According to the calculations carried out in the parent class, if returned
42
+ // True for "isLast" we will already added taxes
43
+ // (Including the COD to the total tax and the grand total
44
+ // Order). So just in case you return false from
45
+ // The call to "isLast" add COD taxes to total.
46
+ if (!$invoice->isLast()) {
47
+ $invoice->setBaseTaxAmount($invoice->getBaseTaxAmount() + $baseTax);
48
+ $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseTax);
49
+
50
+ $invoice->setTaxAmount($invoice->getTaxAmount() + $tax);
51
+ $invoice->setGrandTotal($invoice->getGrandTotal() + $tax);
52
+ }
53
+ }
54
+
55
+ return $result;
56
+
57
+ }
58
+ }
59
+
60
+
app/code/community/Zitec/Dpd/Model/Sales/Order/Pdf/Total/Cashondeliverysurchage.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Sales_Order_Pdf_Total_Cashondeliverysurchage extends Mage_Sales_Model_Order_Pdf_Total_Default
25
+ {
26
+
27
+ public function getTotalsForDisplay()
28
+ {
29
+ $amount = $this->getOrder()->getData('zitec_dpd_cashondelivery_surcharge');
30
+ if (floatval($amount)) {
31
+ if ($this->getAmountPrefix()) {
32
+ $discount = $this->getAmountPrefix() . $discount;
33
+ }
34
+
35
+ $title = Mage::getStoreConfig('payment/zitec_dpd_cashondelivery/total_title', $this->getOrder()->getStoreId());
36
+ $fontSize = $this->getFontSize() ? $this->getFontSize() : 7;
37
+
38
+ $totals = array();
39
+ if ($this->_displayBoth() || $this->_displayExcludingTax()) {
40
+ $totals[] = array(
41
+ 'label' => $title . ($this->_displayBoth() ? $this->_getHelper()->__(' (Excl. Tax)') : '') . ':',
42
+ 'amount' => $this->getOrder()->formatPriceTxt($amount),
43
+ 'font_size' => $fontSize,
44
+ );
45
+ }
46
+
47
+ if ($this->_displayBoth() || $this->_displayIncludingTax()) {
48
+ $amount += $this->getOrder()->getData('zitec_dpd_cashondelivery_surcharge_tax');
49
+ $totals[] = array(
50
+ 'label' => $title . ($this->_displayBoth() ? $this->_getHelper()->__(' (Incl. Tax)') : '') . ':',
51
+ 'amount' => $this->getOrder()->formatPriceTxt($amount),
52
+ 'font_size' => $fontSize,
53
+ );
54
+ }
55
+
56
+ return $totals;
57
+ }
58
+ }
59
+
60
+ /**
61
+ *
62
+ * @return boolean
63
+ */
64
+ protected function _displayBoth()
65
+ {
66
+ return $this->_getConfig()->displaySalesShippingBoth($this->_getStore());
67
+ }
68
+
69
+ /**
70
+ *
71
+ * @return boolean
72
+ */
73
+ protected function _displayIncludingTax()
74
+ {
75
+ return $this->_getConfig()->displaySalesShippingInclTax($this->_getStore());
76
+ }
77
+
78
+ /**
79
+ *
80
+ * @return boolean
81
+ */
82
+ protected function _displayExcludingTax()
83
+ {
84
+ return $this->_getConfig()->displaySalesShippingExclTax($this->_getStore());
85
+ }
86
+
87
+ /**
88
+ *
89
+ * @return Mage_Tax_Model_Config
90
+ */
91
+ protected function _getConfig()
92
+ {
93
+ return Mage::getSingleton('tax/config');
94
+ }
95
+
96
+ /**
97
+ *
98
+ * @return Zitec_Dpd_Helper_Data
99
+ */
100
+ protected function _getHelper()
101
+ {
102
+ return Mage::helper('zitec_dpd');
103
+ }
104
+
105
+ /**
106
+ *
107
+ * @return Mage_Core_Model_Store
108
+ */
109
+ protected function _getStore()
110
+ {
111
+ return $this->getOrder()->getStore();
112
+ }
113
+
114
+ }
app/code/community/Zitec/Dpd/Model/Sales/Order/Total/Cashondeliverysurchage.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Sales_Order_Total_Cashondeliverysurchage extends Mage_Sales_Model_Order_Total_Abstract
25
+ {
26
+ public function collect(Mage_Sales_Model_Order $order)
27
+ {
28
+ $order->setData('zitec_dpd_cashondelivery_surcharge', 0);
29
+ $order->setData('base_zitec_dpd_cashondelivery_surcharge', 0);
30
+
31
+ $amount = $order->getOrder()->getData('zitec_dpd_cashondelivery_surcharge');
32
+ $order->setData('zitec_dpd_cashondelivery_surcharge', $amount);
33
+
34
+ $amount = $order->getOrder()->getData('base_zitec_dpd_cashondelivery_surcharge');
35
+ $order->setData('base_zitec_dpd_cashondelivery_surcharge', $amount);
36
+
37
+ $order->setGrandTotal($order->getGrandTotal() + $order->getData('zitec_dpd_cashondelivery_surcharge'));
38
+ $order->setBaseGrandTotal($order->getBaseGrandTotal() + $order->getData('base_zitec_dpd_cashondelivery_surcharge'));
39
+
40
+ return $this;
41
+ }
42
+ }
app/code/community/Zitec/Dpd/Model/Sales/Quote/Address/Total/Cashondeliverysurchage.php ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Sales_Quote_Address_Total_Cashondeliverysurchage extends Mage_Sales_Model_Quote_Address_Total_Abstract
25
+ {
26
+ public function __construct()
27
+ {
28
+ $this->setCode('zitec_dpd_cashondelivery_surcharge');
29
+ }
30
+
31
+ public function collect(Mage_Sales_Model_Quote_Address $address)
32
+ {
33
+ $address->setData('zitec_dpd_cashondelivery_surcharge', 0);
34
+ $address->setData('base_zitec_dpd_cashondelivery_surcharge', 0);
35
+ $address->setData('zitec_dpd_cashondelivery_surcharge_tax', 0);
36
+ $address->setData('base_zitec_dpd_cashondelivery_surcharge_tax', 0);
37
+
38
+ $paymentMethod = $address->getQuote()->getPayment()->getMethod();
39
+
40
+ if ($paymentMethod == Mage::helper('zitec_dpd')->getDpdPaymentCode() && $address->getAddressType() == 'shipping') {
41
+ $quote = $address->getQuote();
42
+ /* @var $quote Mage_Sales_Model_Quote */
43
+ $shippingAddress = $quote->getShippingAddress();
44
+
45
+ $request = new Varien_Object();
46
+ $request->setWebsiteId(Mage::helper('zitec_dpd/payment')->getWebsiteId());
47
+ $request->setDestCountryId($shippingAddress->getCountryId());
48
+ $request->setDestRegionId($shippingAddress->getRegionId());
49
+ $request->setDestPostcode($shippingAddress->getPostcode());
50
+ $request->setPackageWeight($shippingAddress->getWeight());
51
+ if ($this->_getTaxHelper()->shippingPriceIncludesTax($address->getQuote()->getStoreId())) {
52
+ $request->setData('zitec_table_price', $shippingAddress->getBaseSubtotalInclTax());
53
+ } else {
54
+ $request->setData('zitec_table_price', $shippingAddress->getBaseSubtotal());
55
+ }
56
+ $request->setMethod(str_replace(Mage::helper('zitec_dpd')->getDPDCarrierCode() . '_', '', $shippingAddress->getShippingMethod()));
57
+ $tablerateSurcharge = Mage::getResourceModel('zitec_dpd/carrier_tablerate')->getCashOnDeliverySurcharge($request);
58
+
59
+ if (is_null($tablerateSurcharge)) {
60
+ return $this;
61
+ } elseif (!empty($tablerateSurcharge)) {
62
+ $baseCashondeliverySurcharge = $this->_getHelper()->calculateQuoteBaseCashOnDeliverySurcharge($quote, $tablerateSurcharge);
63
+ } else {
64
+ $baseCashondeliverySurcharge = $this->_getHelper()->returnDefaultBaseCashOnDeliverySurcharge($quote);
65
+ }
66
+
67
+ if (!isset($baseCashondeliverySurcharge)) {
68
+ return $this;
69
+ }
70
+
71
+ $baseCurrencyCode = $quote->getStore()->getBaseCurrencyCode();
72
+ $currentCurrencyCode = $quote->getStore()->getCurrentCurrencyCode();
73
+ $cashondeliverySurcharge = Mage::helper('directory')->currencyConvert($baseCashondeliverySurcharge, $baseCurrencyCode, $currentCurrencyCode);
74
+ $address->setData('zitec_dpd_cashondelivery_surcharge', $cashondeliverySurcharge);
75
+ $address->setData('base_zitec_dpd_cashondelivery_surcharge', $baseCashondeliverySurcharge);
76
+ $this->_calculateSurchargeSalesTax($address);
77
+ $quote->save();
78
+ }
79
+
80
+ $address->setGrandTotal($address->getGrandTotal() + $address->getData('zitec_dpd_cashondelivery_surcharge'));
81
+ $address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getData('base_zitec_dpd_cashondelivery_surcharge'));
82
+
83
+ return $this;
84
+ }
85
+
86
+ /**
87
+ *
88
+ * @param Mage_Sales_Model_Quote_Address $address
89
+ *
90
+ * @return \Zitec_Dpd_Model_Sales_Quote_Address_Total_Cashondeliverysurchage
91
+ */
92
+ protected function _calculateSurchargeSalesTax(Mage_Sales_Model_Quote_Address $address)
93
+ {
94
+
95
+ $taxCalculator = Mage::getSingleton('tax/calculation');
96
+ /* @var $taxCalculator Mage_Tax_Model_Calculation */
97
+ $customer = $address->getQuote()->getCustomer();
98
+ if ($customer) {
99
+ $taxCalculator->setCustomer($customer);
100
+ }
101
+
102
+ $store = $address->getQuote()->getStore();
103
+ $request = $taxCalculator->getRateRequest(
104
+ $address,
105
+ $address->getQuote()->getBillingAddress(),
106
+ $address->getQuote()->getCustomerTaxClassId(),
107
+ $store
108
+ );
109
+ $taxConfig = Mage::getSingleton('tax/config');
110
+ /* @var $taxConfig Mage_Tax_Model_Config */
111
+ $request->setProductClassId($taxConfig->getShippingTaxClass($store));
112
+
113
+ $rate = $taxCalculator->getRate($request);
114
+ $inclTax = $taxConfig->shippingPriceIncludesTax($store);
115
+ $surcharge = $address->getData('zitec_dpd_cashondelivery_surcharge');
116
+ $baseSurcharge = $address->getData('base_zitec_dpd_cashondelivery_surcharge');
117
+
118
+ // NOTA: Mira el comentario de 25 abr 2013 10:45 en #43 de collab.
119
+ $surchargeTax = $taxCalculator->calcTaxAmount($surcharge, $rate, $inclTax, true);
120
+ $baseSurchargeTax = $taxCalculator->calcTaxAmount($baseSurcharge, $rate, $inclTax, true);
121
+
122
+ $address->setExtraTaxAmount($address->getExtraTaxAmount() + $surchargeTax);
123
+ $address->setBaseExtraTaxAmount($address->getBaseExtraTaxAmount() + $baseSurchargeTax);
124
+
125
+ $address->setData('zitec_dpd_cashondelivery_surcharge_tax', $surchargeTax);
126
+ $address->setData('base_zitec_dpd_cashondelivery_surcharge_tax', $baseSurchargeTax);
127
+
128
+ if ($inclTax) {
129
+ $address->setData('zitec_dpd_cashondelivery_surcharge', $surcharge - $surchargeTax);
130
+ $address->setData('base_zitec_dpd_cashondelivery_surcharge', $baseSurcharge - $baseSurchargeTax);
131
+ }
132
+
133
+ return $this;
134
+ }
135
+
136
+ /**
137
+ *
138
+ * @return Mage_Tax_Helper_Data
139
+ */
140
+ protected function _getTaxHelper()
141
+ {
142
+ return Mage::helper('tax');
143
+ }
144
+
145
+ public function fetch(Mage_Sales_Model_Quote_Address $address)
146
+ {
147
+ $amount = $address->getData('zitec_dpd_cashondelivery_surcharge');
148
+
149
+ if ($amount != 0 && $address->getAddressType() == 'shipping') {
150
+ $title = Mage::getStoreConfig('payment/zitec_dpd_cashondelivery/total_title', $address->getQuote()->getStore());
151
+
152
+ $address->addTotal(array(
153
+ 'code' => $this->getCode(),
154
+ 'title' => $title,
155
+ 'value' => $amount
156
+ ));
157
+ }
158
+
159
+ return $this;
160
+ }
161
+
162
+ /**
163
+ * Get label
164
+ *
165
+ * @return string
166
+ */
167
+ public function getLabel()
168
+ {
169
+ $title = Mage::getStoreConfig('payment/zitec_dpd_cashondelivery/total_title');
170
+
171
+ return $title;
172
+ }
173
+
174
+ /**
175
+ *
176
+ * @return Zitec_Dpd_Helper_Data
177
+ */
178
+ protected function _getHelper()
179
+ {
180
+ return Mage::helper('zitec_dpd');
181
+ }
182
+
183
+ }
app/code/community/Zitec/Dpd/Model/Shipping/Carrier/Abstract.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ abstract class Zitec_Dpd_Model_Shipping_Carrier_Abstract extends Mage_Shipping_Model_Carrier_Abstract
25
+ {
26
+ protected $_numBoxes = 1;
27
+
28
+
29
+ /**
30
+ * Check if carrier has shipping label option available
31
+ *
32
+ * @return boolean
33
+ */
34
+ public function isShippingLabelsAvailable()
35
+ {
36
+ return true;
37
+ }
38
+
39
+
40
+ public function isTrackingAvailable()
41
+ {
42
+ return true;
43
+ }
44
+
45
+ public function isCityRequired()
46
+ {
47
+ return true;
48
+ }
49
+
50
+ public function isZipCodeRequired($countryId = null)
51
+ {
52
+ return true;
53
+ }
54
+
55
+ public function getTotalNumOfBoxes($weight)
56
+ {
57
+ /*
58
+ reset num box first before retrieve again
59
+ */
60
+ $this->_numBoxes = 1;
61
+ //$weight = $this->convertWeightToLbs($weight);
62
+ $maxPackageWeight = $this->getConfigData('max_package_weight');
63
+ if ($weight > $maxPackageWeight && $maxPackageWeight != 0) {
64
+ $this->_numBoxes = ceil($weight / $maxPackageWeight);
65
+ $weight = $weight / $this->_numBoxes;
66
+ }
67
+
68
+ return $weight;
69
+ }
70
+
71
+ /**
72
+ *
73
+ * @return Zitec_Dpd_Helper_Data
74
+ */
75
+ protected function _getHelper()
76
+ {
77
+ return Mage::helper('zitec_dpd');
78
+ }
79
+
80
+ /**
81
+ *
82
+ * @return Zitec_Dpd_Helper_Ws
83
+ */
84
+ protected function _getWsHelper()
85
+ {
86
+ return Mage::helper('zitec_dpd/ws');
87
+ }
88
+ }
app/code/community/Zitec/Dpd/Model/Shipping/Carrier/Dpd.php ADDED
@@ -0,0 +1,542 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Model_Shipping_Carrier_Dpd extends Zitec_Dpd_Model_Shipping_Carrier_Abstract implements Zitec_PackedShipment_Model_Carrier_Interface
25
+ {
26
+ const CARRIER_CODE = 'zitecDpd';
27
+ protected $_code = 'zitecDpd';
28
+
29
+ public function getAllowedMethods()
30
+ {
31
+ $optionsMethods = Mage::getSingleton('zitec_dpd/config_source_service')->toOptionArray(true);
32
+
33
+ $result = array();
34
+ foreach ($optionsMethods as $method) {
35
+ $result[$method['value']] = $method['label'];
36
+ }
37
+
38
+ return $result;
39
+ }
40
+
41
+ /**
42
+ * Collect and get rates
43
+ *
44
+ * @param Mage_Shipping_Model_Rate_Request $request
45
+ *
46
+ * @return Mage_Shipping_Model_Rate_Result|bool|null
47
+ */
48
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request)
49
+ {
50
+ if (!$this->_canCollectRates($request)) {
51
+ return false;
52
+ }
53
+
54
+ // Recalculate the package value excluding any virtual products.
55
+ if (!$this->getConfigFlag('include_virtual_price')) {
56
+ $request->setPackageValue($request->getPackagePhysicalValue());
57
+ }
58
+
59
+ // Free shipping by qty
60
+ $freeQty = 0;
61
+ $totalPriceInclTax = 0;
62
+ $totalPriceExclTax = 0;
63
+ foreach ($request->getAllItems() as $item) {
64
+ $totalPriceInclTax += $item->getBaseRowTotalInclTax();
65
+ $totalPriceExclTax += $item->getBaseRowTotal();
66
+
67
+ if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
68
+ continue;
69
+ }
70
+
71
+ if ($item->getHasChildren() && $item->isShipSeparately()) {
72
+ foreach ($item->getChildren() as $child) {
73
+ if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
74
+ $freeQty += $item->getQty() * ($child->getQty() - (is_numeric($child->getFreeShipping()) ? $child->getFreeShipping() : 0));
75
+ }
76
+ }
77
+ } elseif ($item->getFreeShipping()) {
78
+ $freeQty += ($item->getQty() - (is_numeric($item->getFreeShipping()) ? $item->getFreeShipping() : 0));
79
+ }
80
+ }
81
+
82
+ // Package weight and qty free shipping
83
+ $oldWeight = $request->getPackageWeight();
84
+ $oldQty = $request->getPackageQty();
85
+ $oldPrice = $request->getPackageValue();
86
+
87
+ $request->setPackageWeight($request->getFreeMethodWeight());
88
+ $request->setPackageQty($oldQty - $freeQty);
89
+ $request->setPackageValue($totalPriceInclTax);
90
+
91
+ $this->_updateFreeMethodQuote($request);
92
+
93
+ // The shipping price calculations for price vs destination is included.
94
+ if ($this->_getTaxHelper()->shippingPriceIncludesTax($request->getStoreId())) {
95
+ $request->setData('zitec_table_price', $totalPriceInclTax);
96
+ } else {
97
+ $request->setData('zitec_table_price', $totalPriceExclTax);
98
+ }
99
+
100
+ $rate = $this->getRate($request);
101
+
102
+ $request->setPackageWeight($oldWeight);
103
+ $request->setPackageQty($oldQty);
104
+ $request->setPackageValue($oldPrice);
105
+
106
+ $isFree = false;
107
+ $freeShippingPrice = ($this->getConfigFlag('free_shipping_subtotal_tax_incl')) ? $totalPriceInclTax : $oldPrice;
108
+ $freeShippingSubtotal = $this->getConfigData('free_shipping_subtotal');
109
+ $freeShippingEnabled = $this->getConfigFlag('free_shipping_enable');
110
+ $freeShipping = ($freeShippingEnabled && $freeShippingPrice >= $freeShippingSubtotal) ? true : false;
111
+ if ($request->getFreeShipping() === true || $freeShipping) {
112
+ $isFree = true;
113
+ }
114
+
115
+ $result = Mage::getModel('shipping/rate_result');
116
+ /* @var $result Mage_Shipping_Model_Rate_Result */
117
+
118
+ if (count($rate) == 0) {
119
+ return false;
120
+ }
121
+
122
+ $methods = array();
123
+ foreach ($rate as $r) {
124
+ // Before adding the rate, we check that it is active in the admin configuration.
125
+ if (!$this->_isRateAllowedByAdminConfiguration($r)) {
126
+ continue;
127
+ }
128
+
129
+ //There can be multiple rate the same method, but is first applicable.
130
+ //If we have already considered a rate of this method, we again evaluate
131
+ //(the other will be for weights / lower prices) or for more general conditions.
132
+
133
+ $dpdMethod = $r['method'];
134
+ if (in_array($dpdMethod, $methods)) {
135
+ continue;
136
+ }
137
+ $methods[] = $dpdMethod;
138
+
139
+ $method = Mage::getModel('shipping/rate_result_method');
140
+
141
+ $method->setCarrier($this->_code);
142
+ $method->setCarrierTitle($this->getConfigData('title'));
143
+ $price = $this->_calculateDPDPrice($r, $request);
144
+ if ($price === false) {
145
+ continue;
146
+ }
147
+ $method->setPrice($price);
148
+ $method->setCost($price);
149
+ $method->setMethod($dpdMethod);
150
+ $methodDescriptions = Mage::getSingleton('zitec_dpd/config_source_service')->toOptionArray();
151
+ $methodTitle = $methodDescriptions[$dpdMethod];
152
+ $method->setMethodTitle($methodTitle);
153
+
154
+ $result->append($method);
155
+ }
156
+
157
+ if ($isFree) {
158
+ $cheapest = $result->getCheapestRate();
159
+ if (!empty($cheapest)) {
160
+ $cheapest->setPrice('0.00');
161
+ $title = $cheapest->getMethodTitle() . ' (' . Mage::helper('shipping')->__('Free') . ')';
162
+ $cheapest->setMethodTitle($title);
163
+ $result->reset();
164
+ $result->append($cheapest);
165
+ }
166
+ }
167
+
168
+ return $result;
169
+ }
170
+
171
+ /**
172
+ * @param Mage_Shipping_Model_Rate_Request $request
173
+ *
174
+ * @return bool
175
+ */
176
+ protected function _canCollectRates(Mage_Shipping_Model_Rate_Request $request)
177
+ {
178
+ if (!$this->getConfigFlag('active')) {
179
+ return false;
180
+ }
181
+
182
+ // Exclude empty carts
183
+ if (!$request->getAllItems()) {
184
+ return false;
185
+ }
186
+
187
+ // Exclude carts containing products with no defined weight or where the
188
+ // total weight of the cart is zero (virtual products only).
189
+ if ($this->_cartContainsProductsOfZeroWeightOrWeighsNothing($request->getAllItems())) {
190
+ return false;
191
+ }
192
+
193
+ return true;
194
+ }
195
+
196
+ /**
197
+ *
198
+ * @return Mage_Tax_Helper_Data
199
+ */
200
+ protected function _getTaxHelper()
201
+ {
202
+ return Mage::helper('tax');
203
+ }
204
+
205
+ /**
206
+ * Returns true if the cart contains items with no defined weight or the
207
+ * whole cart weighs nothing.
208
+ *
209
+ * @param array $itemsInCart
210
+ *
211
+ * @return boolean
212
+ */
213
+ protected function _cartContainsProductsOfZeroWeightOrWeighsNothing($itemsInCart)
214
+ {
215
+
216
+ if (!$itemsInCart) {
217
+ return true;
218
+ }
219
+
220
+ $cartContainsNonVirtualItems = false;
221
+
222
+ foreach ($itemsInCart as $item) {
223
+ if ($item->getParentItem()) {
224
+ continue;
225
+ }
226
+
227
+
228
+ if ($item->getHasChildren() && $item->isShipSeparately()) {
229
+ foreach ($item->getChildren() as $child) {
230
+ if (!$child->getProduct()->isVirtual()) {
231
+ if (!$child->getWeight() || ($child->getWeight() == 0)) {
232
+ return true;
233
+ }
234
+ $cartContainsNonVirtualItems = true;
235
+ }
236
+ }
237
+ } elseif (!$item->getProduct()->isVirtual()) {
238
+ if (!$item->getWeight() || ($item->getWeight() == 0)) {
239
+ return true;
240
+ }
241
+ $cartContainsNonVirtualItems = true;
242
+ }
243
+ }
244
+
245
+ if ($cartContainsNonVirtualItems) {
246
+ return false;
247
+ } else {
248
+ return true; // All items in cart are virtual
249
+ }
250
+ }
251
+
252
+ /**
253
+ *
254
+ * @param Mage_Shipping_Model_Rate_Request $request
255
+ *
256
+ * @return array
257
+ */
258
+ public function getRate(Mage_Shipping_Model_Rate_Request $request)
259
+ {
260
+ $rates = Mage::getResourceModel('zitec_dpd/carrier_tablerate')->getRate($request);
261
+
262
+ return $rates;
263
+ }
264
+
265
+ /**
266
+ *
267
+ * @param array $shippingRate
268
+ *
269
+ * @return boolean
270
+ */
271
+ protected function _isRateAllowedByAdminConfiguration($shippingRate)
272
+ {
273
+
274
+ $availableMethods = explode(',', $this->getconfigData('services'));
275
+
276
+ return in_array($shippingRate['method'], $availableMethods);
277
+ }
278
+
279
+ /**
280
+ * We calculate the shipping price based on the price / rate mentioned in
281
+ * the rates table. If a "markup_type" (percent) indicated we travel to DPD WS
282
+ * to calculate the final price based on the shipping cost with
283
+ * his ws. If the price / percentage is less than zero indicates that the rate is not available.
284
+ *
285
+ * @param array $rate
286
+ * @param Mage_Shipping_Model_Rate_Request $request
287
+ *
288
+ * @return array|boolean
289
+ */
290
+ protected function _calculateDPDPrice(array $rate, Mage_Shipping_Model_Rate_Request $request)
291
+ {
292
+
293
+ if (!$rate['markup_type']) {
294
+ if ($rate['price'] >= 0) {
295
+ return $rate['price'];
296
+ } else {
297
+ return false;
298
+ }
299
+ }
300
+
301
+ $apiParams = $this->_getWsHelper()->getShipmentParams($request->getStoreId());
302
+ $apiParams['method'] = Zitec_Dpd_Api_Configs::METHOD_SHIPMENT_CALCULATE_PRICE;
303
+
304
+ try {
305
+ $dpdApi = new Zitec_Dpd_Api($apiParams);
306
+ $calculatePrice = $dpdApi->getApiMethodObject();
307
+
308
+ $postCode = Mage::helper('zitec_dpd/postcode_search')->extractPostCodeForShippingRequest($request);
309
+
310
+ $calculatePrice->setReceiverAddress($request->getDestStreet(), $request->getDestCity(), $postCode, $request->getDestCountryId())
311
+ ->addParcel($request->getPackageWeight())
312
+ ->setShipmentServiceCode($rate['method']);
313
+
314
+ $insurance = Mage::helper('zitec_dpd')->extractInsuranceValuesByRequest($request);
315
+ $calculatePrice = $calculatePrice->setAdditionalHighInsurance($insurance['goodsValue'], $insurance['currency'], $insurance['content']);
316
+
317
+ $calculatePrice->execute();
318
+ } catch (Exception $e) {
319
+ $this->_getHelper()->log("An error occurred whilst calculating the DPD price for the shipment {$e->getMessage()}");
320
+
321
+ return false;
322
+ }
323
+
324
+ $response = $calculatePrice->getCalculatePriceResponse();
325
+ if ($response->hasError()) {
326
+ $this->_getHelper()->log("DPD returned the following error whilst attempting to calculate the price of a shipment: {$response->getErrorText()}");
327
+
328
+ return false;
329
+ }
330
+
331
+
332
+ if ($request->getBaseCurrency()->getCode() == $response->getCurrency()) {
333
+ $dpdPrice = $response->getAmount();
334
+ } else if ($request->getBaseCurrency()->getCode() == $response->getCurrencyLocal()) {
335
+ $dpdPrice = $response->getAmountLocal();
336
+ } else {
337
+ $this->_getHelper()->log("An error occurred whilst calculating the price of a shipment. The currency of the shipment ({$request->getBaseCurrency()->getCode()}) does not correspond to the currency ({$response->getCurrency()}) or the local currency ({$response->getCurrencyLocal()}) used by DPD. ");
338
+
339
+ return false;
340
+ }
341
+ if ($rate['markup_type'] == 1) {
342
+ return $dpdPrice * (1 + ($rate['price'] / 100));
343
+ } else {
344
+ return $dpdPrice + round(floatval($rate['price']), 2);
345
+ }
346
+ }
347
+
348
+ public function getCitiesForPostcode($postcode, &$errorMsg)
349
+ {
350
+
351
+ }
352
+
353
+ public function getPostcodesForCity($city, &$errorMsg)
354
+ {
355
+
356
+ }
357
+
358
+ /**
359
+ *
360
+ * @param Mage_Sales_Model_Order $order
361
+ * @param string $city
362
+ * @param string $postcode
363
+ * @param array $weightsPackages
364
+ * @param string $errorStr
365
+ *
366
+ * @return double
367
+ */
368
+ public function getShippingCost(Mage_Sales_Model_Order $order, $city, $postcode, $weightsPackages, &$errorStr)
369
+ {
370
+ $shippingAddress = $order->getShippingAddress();
371
+ $city = $city ? $city : $shippingAddress->getCity();
372
+ $postcode = $postcode ? $postcode : $shippingAddress->getPostcode();
373
+ $serviceCode = $this->_getHelper()->getDPDServiceCode($order->getShippingMethod());
374
+ $street = is_array($shippingAddress->getStreetFull()) ? implode("\n", $shippingAddress->getStreetFull()) : $shippingAddress->getStreetFull();
375
+
376
+ $apiParams = $this->_getWsHelper()->getShipmentParams($order->getStore());
377
+ $apiParams['method'] = Zitec_Dpd_Api_Configs::METHOD_SHIPMENT_CALCULATE_PRICE;
378
+
379
+
380
+ try {
381
+ $dpdApi = new Zitec_Dpd_Api($apiParams);
382
+ $calculatePrice = $dpdApi->getApiMethodObject();
383
+
384
+
385
+ $calculatePrice->setReceiverAddress($street, $city, $postcode, $shippingAddress->getCountryId())
386
+ ->setShipmentServiceCode($serviceCode);
387
+
388
+ foreach ($weightsPackages as $parcelWeight) {
389
+ $calculatePrice->addParcel($parcelWeight);
390
+ }
391
+
392
+ $insurance = Mage::helper('zitec_dpd')->extractInsuranceValuesByOrder($order);
393
+ $calculatePrice = $calculatePrice->setAdditionalHighInsurance($insurance['goodsValue'], $insurance['currency'], $insurance['content']);
394
+
395
+ $calculatePrice->execute();
396
+ } catch (Exception $e) {
397
+ $errorStr = $this->_getHelper()->__("Error obtaining shipping price: %s", $e->getMessage());
398
+ $this->_getHelper()->log("An error occurred whilst calculating the DPD price for the shipment {$e->getMessage()}");
399
+
400
+ return 0;
401
+ }
402
+
403
+ $response = $calculatePrice->getCalculatePriceResponse();
404
+ if ($response->hasError()) {
405
+ $errorStr = $this->_getHelper()->__("DPD error: %s", $response->getErrorText());
406
+ $this->_getHelper()->log("DPD returned the following error whilst attempting to calculate the price of a shipment: {$response->getErrorText()}");
407
+
408
+ return 0;
409
+ }
410
+
411
+
412
+ if ($order->getBaseCurrencyCode() == $response->getCurrency()) {
413
+ return $response->getAmount();
414
+ } else if ($order->getBaseCurrencyCode() == $response->getCurrencyLocal()) {
415
+ return $response->getAmountLocal();
416
+ } else {
417
+ $errorStr = $this->_getHelper()->__("Shipping price not available in order currency");
418
+ $this->_getHelper()->log("An error occurred whilst calculating the price of a shipment. The base currency of the shipment ({$order->getBaseCurrencyCode()}) does not correspond to the currency ({$response->getCurrency()}) or the local currency ({$response->getCurrencyLocal()}) used by DPD.");
419
+
420
+ return 0;
421
+ }
422
+ }
423
+
424
+ /**
425
+ *
426
+ * @return boolean
427
+ */
428
+ public function supportsCalculationOfShippingCosts()
429
+ {
430
+ return true;
431
+ }
432
+
433
+ public function getTrackingInfo($trackingNumber)
434
+ {
435
+
436
+
437
+ $trackingCollection = Mage::getResourceModel('sales/order_shipment_track_collection');
438
+ /* @var $trackingCollection Mage_Sales_Model_Mysql4_Order_Shipment_Track_Collection */
439
+ $trackingCollection->addFieldToFilter('track_number', $trackingNumber);
440
+ $track = $trackingCollection->getFirstItem();
441
+ /* @var $track Mage_Sales_Model_Order_Shipment_Track */
442
+ if (!$track->getId()) {
443
+ $result = array("title" => $this->getConfigData("title"), "number" => $trackingNumber);
444
+
445
+ return $result;
446
+ }
447
+
448
+ $shipment = Mage::getModel('sales/order_shipment')/* @var $shipment Mage_Sales_Model_Order_Shipment */
449
+ ->load($track->getParentId());
450
+ $carrierTitle = $this->getConfigData("title", $shipment->getStore());
451
+
452
+ $ships = Mage::getResourceModel('zitec_dpd/dpd_ship_collection');
453
+ /* @var $ships Zitec_Dpd_Model_Mysql4_Dpd_Ship_Collection */
454
+ $ship = $ships->getByShipmentId($track->getParentId());
455
+ /* @var $ship Zitec_Dpd_Model_Dpd_Ship */
456
+ if (!$ship) {
457
+ $errorMessage = $this->_getHelper()->__("Could not load the stored tracking information for track %s", $trackingNumber);
458
+ $this->_getHelper()->log($errorMessage);
459
+ $result = $this->_getTrackingInfoObject($trackingNumber, $carrierTitle, $errorMessage);
460
+
461
+ return $result;
462
+ }
463
+
464
+ $response = @unserialize($ship->getSaveShipmentResponse());
465
+ /* @var $response Zitec_Dpd_Api_Shipment_Save_Response */
466
+ if (!$response) {
467
+ $errorMessage = $this->_getHelper()->__("Error loading stored tracking information for track %s", $trackingNumber);
468
+ $this->_getHelper()->log($errorMessage);
469
+ $result = $this->_getTrackingInfoObject($trackingNumber, $carrierTitle, $errorMessage);
470
+
471
+ return $result;
472
+ }
473
+
474
+ try {
475
+
476
+ $statusResponse = $this->_getWsHelper()->getShipmentStatus($response);
477
+
478
+ } catch (Exception $e) {
479
+ $errorMessage = $this->_getHelper()->__("Error calling DPD for track %s", $trackingNumber);
480
+ $this->_getHelper()->log($errorMessage);
481
+ $this->_getHelper()->log($e->getMessage());
482
+ $result = $this->_getTrackingInfoObject($trackingNumber, $carrierTitle, $errorMessage);
483
+
484
+ return $result;
485
+ }
486
+
487
+ if ($statusResponse->hasError()) {
488
+ $errorMessage = $this->_getHelper()->__('Error calling DPD for track %s: %s ', $trackingNumber, $statusResponse->getErrorText());
489
+ $this->_getHelper()->log($errorMessage);
490
+ $result = $this->_getTrackingInfoObject($trackingNumber, $carrierTitle, $errorMessage);
491
+
492
+ return $result;
493
+ }
494
+
495
+ $result = $this->_getTrackingInfoObject($trackingNumber, $carrierTitle, "", $statusResponse);
496
+
497
+ return $result;
498
+ }
499
+
500
+ /**
501
+ *
502
+ * @param string $trackingNumber
503
+ * @param string $carrierTitle
504
+ * @param string $errorMessage
505
+ * @param Zitec_Dpd_Api_Shipment_GetShipmentStatus_Response $response
506
+ *
507
+ * @return \Varien_Object
508
+ */
509
+ protected function _getTrackingInfoObject($trackingNumber, $carrierTitle, $errorMessage, Zitec_Dpd_Api_Shipment_GetShipmentStatus_Response $response = null)
510
+ {
511
+ $result = $result = new Varien_Object();
512
+ $result->setTracking($trackingNumber);
513
+ $result->setCarrierTitle($carrierTitle);
514
+ $result->setErrorMessage($errorMessage);
515
+ if ($response) {
516
+ $result->setUrl($response->getTrackingUrl());
517
+ $result->setDeliverydate($response->getDeliveryDate());
518
+ $result->setDeliverytime($response->getDeliveryTime());
519
+ $result->setShippedDate($response->getShipDate());
520
+ $result->setService($response->getServiceDescription());
521
+ $result->setWeight($response->getWeight());
522
+ }
523
+
524
+ return $result;
525
+ }
526
+
527
+ public function isValidCityPostcode($city, $postcode, &$errorMsg)
528
+ {
529
+
530
+ }
531
+
532
+ public function shippingMethodRequiresShipmentsOfOnlyOneParcel($shippingMethod)
533
+ {
534
+
535
+ }
536
+
537
+ public function supportsAddressValidation($countryId)
538
+ {
539
+
540
+ }
541
+
542
+ }
app/code/community/Zitec/Dpd/controllers/Adminhtml/ConfigController.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Adminhtml_ConfigController extends Mage_Adminhtml_Controller_Action
25
+ {
26
+
27
+ public function exportTableratesAction()
28
+ {
29
+ $fileName = 'dpd_tablerates.csv';
30
+ $gridBlock = $this->getLayout()->createBlock('zitec_dpd/adminhtml_tablerate_grid');
31
+ $website = Mage::app()->getWebsite($this->getRequest()->getParam('website'));
32
+ $gridBlock->setWebsiteId($website->getId());
33
+ $content = $gridBlock->getCsvFile();
34
+ $this->_prepareDownloadResponse($fileName, $content);
35
+ }
36
+
37
+ }
38
+
39
+
app/code/community/Zitec/Dpd/controllers/Adminhtml/ShipmentController.php ADDED
@@ -0,0 +1,463 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_Dpd_Adminhtml_ShipmentController extends Mage_Adminhtml_Controller_Action
25
+ {
26
+
27
+
28
+ /**
29
+ * this action is used to validate manually the address postcode
30
+ */
31
+ public function validatePostcodeAction(){
32
+ $params = $this->getRequest()->getParams();
33
+ $address = '';
34
+ foreach($params['street'] as $street){
35
+ $address .= ' '.$street;
36
+ }
37
+ $address = trim($address);
38
+ $params['address'] = $address;
39
+ $foundAddresses = Mage::helper('zitec_dpd/postcode_search')->findAllSimilarAddressesForAddress($params);
40
+ $content = $this->getLayout()
41
+ ->createBlock('zitec_dpd/adminhtml_shipment_postcode_autocompleter')
42
+ ->setData('found_addresses',$foundAddresses)
43
+ ->setTemplate('zitec_dpd/sales/order/shipment/postcode/autocompleter.phtml')->toHtml();
44
+
45
+ $this->getResponse()->setBody($content);
46
+
47
+ }
48
+
49
+
50
+ /**
51
+ * download the pdf containg labels for each parcel
52
+ *
53
+ * @return Mage_Core_Controller_Varien_Action
54
+ */
55
+ public function getLabelPdfAction()
56
+ {
57
+ $shipmentId = $this->getRequest()->getParam('shipmentid');
58
+ if (!$shipmentId) {
59
+
60
+ }
61
+ $shipment = Mage::getModel('sales/order_shipment')->load($shipmentId);
62
+ /* @var $shipment Mage_Sales_Model_Order_Shipment */
63
+ $shipmentLabel = $shipment->getShippingLabel();
64
+ $pdf = Zend_Pdf::parse($shipmentLabel);
65
+
66
+ return $this->_prepareDownloadResponse($shipment->getIncrementId().'_dpd_'.$shipment->getCreatedAt().'.pdf', $pdf->render(), 'application/pdf');
67
+ }
68
+
69
+ /**
70
+ * create the manifest and generate the download link for pdf
71
+ */
72
+ public function manifestAction()
73
+ {
74
+ $shipmentIds = $this->getRequest()->getParam('shipment_ids');
75
+
76
+ $manifest = Mage::getModel('zitec_dpd/dpd_manifest');
77
+ /* @var $manifest Zitec_Dpd_Model_Dpd_Manifest */
78
+ try {
79
+ $success = $manifest->createManifestForShipments($shipmentIds);
80
+ $notifications = $manifest->getNotifications();
81
+ if ($success) {
82
+ $downloadLinkMessage = "Successfully closed manifest %s for the following shipments. <a href='%s'>Download the manifest</a>.";
83
+ array_unshift($notifications, $this->_getHelper()->__($downloadLinkMessage, $manifest->getManifestRef(), $this->_getDownloadManifestUrl($manifest->getManifestId())));
84
+ }
85
+ $message = implode("<br />", $notifications);
86
+ $this->_getHelper()->addSuccessError($success, $message);
87
+ } catch (Exception $e) {
88
+ $this->_getHelper()->addError($this->_getHelper()->__("An error occurred whilst closing the manifest: %s", $e->getMessage()));
89
+ $this->_getHelper()->log($e->getMessage(), __FUNCTION__, __CLASS__, __LINE__);
90
+ }
91
+
92
+ $this->_redirect("adminhtml/sales_shipment/index");
93
+ }
94
+
95
+
96
+ /**
97
+ * @param int $manifestId
98
+ *
99
+ * @return string
100
+ */
101
+ protected function _getDownloadManifestUrl($manifestId)
102
+ {
103
+ return $this->_getHelper()->getDownloadManifestUrl($manifestId);
104
+ }
105
+
106
+
107
+ /**
108
+ * create the pdf and download it
109
+ */
110
+ public function downloadManifestAction()
111
+ {
112
+ $manifestId = $this->getRequest()->getParam("manifest_id");
113
+ try {
114
+ if (!$manifestId) {
115
+ $message = $this->_getHelper()->__("A problem occurred whilst attempting to download a manifest. No manifest was specified in the request.");
116
+ Mage::throwException($message);
117
+ }
118
+
119
+ $manifest = Mage::getModel('zitec_dpd/dpd_manifest');
120
+ /* @var $manifest Zitec_Dpd_Model_Dpd_Manifest */
121
+ try {
122
+ $manifest->load($manifestId);
123
+ } catch (Exception $e) {
124
+ $message = $this->_getHelper()->__("A problem occurred whilst attempting to download the manifest id %s: %s", $manifestId, $e->getMessage());
125
+ Mage::throwException($message);
126
+ }
127
+ if ($manifest->getManifestId() != $manifestId) {
128
+ $message = $this->_getHelper()->__("A problem occurred whilst attempting to download the manifest %s. The manifest no longer exists.", $manifestId);
129
+ Mage::throwException($message);
130
+ }
131
+ $pdfFile = base64_decode($manifest->getPdf());
132
+ $pdf = Zend_Pdf::parse($pdfFile);
133
+
134
+ return $this->_prepareDownloadResponse("{$manifest->getManifestRef()}_dpd_manifest.pdf", $pdf->render(), 'application/pdf');
135
+ } catch (Mage_Core_Exception $e) {
136
+ $this->_getHelper()->addError($e->getMessage());
137
+ $this->_getHelper()->log($e->getMessage(), __FUNCTION__, __CLASS__, __LINE__);
138
+ } catch (Exception $e) {
139
+ $message = $this->_getHelper()->__("An unexpected problem occurred whilst attempting to download the manifest %s. %s", $manifestId, $e->getMessage());
140
+ $this->_getHelper()->addError($message);
141
+ $this->_getHelper()->log($message, __FUNCTION__, __CLASS__, __LINE__);
142
+ }
143
+ $this->_redirect("adminhtml/sales_shipment/index");
144
+
145
+ }
146
+
147
+
148
+ /**
149
+ * merge more labels into on pdf and return the Zend_Pdf object
150
+ *
151
+ * @param array $labelsContent
152
+ *
153
+ * @return Zend_Pdf
154
+ */
155
+ protected function _combineLabelsPdf(array $labelsContent)
156
+ {
157
+ $outputPdf = new Zend_Pdf();
158
+ foreach ($labelsContent as $content) {
159
+ if (stripos($content, '%PDF-') !== false) {
160
+ $pdfLabel = Zend_Pdf::parse($content);
161
+ foreach ($pdfLabel->pages as $page) {
162
+ $outputPdf->pages[] = clone $page;
163
+ }
164
+ } else {
165
+ $page = $this->_createPdfPageFromImageString($content);
166
+ if ($page) {
167
+ $outputPdf->pages[] = $page;
168
+ }
169
+ }
170
+ }
171
+
172
+ return $outputPdf;
173
+ }
174
+
175
+
176
+ protected function _createPdfPageFromImageString($imageString)
177
+ {
178
+ $image = imagecreatefromstring($imageString);
179
+ if (!$image) {
180
+ return false;
181
+ }
182
+
183
+ $xSize = imagesx($image);
184
+ $ySize = imagesy($image);
185
+ $page = new Zend_Pdf_Page($xSize, $ySize);
186
+
187
+ imageinterlace($image, 0);
188
+ $tmpFileName = sys_get_temp_dir() . DS . 'shipping_labels_'
189
+ . uniqid(mt_rand()) . time() . '.png';
190
+ imagepng($image, $tmpFileName);
191
+ $pdfImage = Zend_Pdf_Image::imageWithPath($tmpFileName);
192
+ $page->drawImage($pdfImage, 0, 0, $xSize, $ySize);
193
+ unlink($tmpFileName);
194
+
195
+ return $page;
196
+ }
197
+
198
+ /**
199
+ * Delete shipment if the manifest was not closed before
200
+ */
201
+ public function deleteAction()
202
+ {
203
+ $shipmentId = $this->getRequest()->getParam('shipment_id');
204
+ if (!$shipmentId) {
205
+ $this->_setDeleteResponse("No shipment was specified", $shipmentId);
206
+
207
+ return;
208
+ }
209
+ $shipment = Mage::getModel('sales/order_shipment');
210
+ /* @var $shipment Mage_Sales_Model_Order_Shipment */
211
+ $shipment->load($shipmentId);
212
+
213
+ $ships = Mage::getResourceModel('zitec_dpd/dpd_ship_collection');
214
+ /* @var $ships Zitec_Dpd_Model_Mysql4_Dpd_Ship_Collection */
215
+ $ship = $ships->getByShipmentId($shipmentId);
216
+ /* @var $ship Zitec_Dpd_Model_Dpd_Ship */
217
+ if (!$ship) {
218
+ $this->_setDeleteResponse("Could not find any DPD shipment information for this shipment.", $shipment);
219
+
220
+ return;
221
+ }
222
+
223
+ if ($ship->getManifestId()) {
224
+ $this->_setDeleteResponse("You cannot cancel this shipment with DPD because the manifest is already closed.", $shipment);
225
+
226
+ return;
227
+ }
228
+ $response = @unserialize($ship->getSaveShipmentResponse());
229
+ /* @var $response Zitec_Dpd_Api_Shipment_Save_Response */
230
+ if (!$response) {
231
+ $this->_setDeleteResponse("Unable to load shipment information for this shipment.", $shipment);
232
+
233
+ return;
234
+ }
235
+
236
+
237
+ try {
238
+ $wsResult = $this->_getWsHelper()->deleteWsShipment($shipment,$response);
239
+ } catch (Exception $e) {
240
+ $this->_setDeleteResponse('An error occurred whilst attempting to delete the shipment information with DPD. <br /> "%s"', $shipment, $e->getMessage());
241
+
242
+ return;
243
+ }
244
+
245
+ if ($wsResult->hasError()) {
246
+ $this->_setDeleteResponse('An error occurred whilst attempting to delete the shipment information with DPD. <br /> "%s"', $shipment, $wsResult->getErrorText());
247
+
248
+ return;
249
+ }
250
+
251
+ $shipment->setShippingLabel(null)->save();
252
+ $ship->setShippingLabels(null)->save();
253
+
254
+ $this->_forward("removeTrack", "sales_order_shipment", "admin");
255
+ }
256
+
257
+
258
+
259
+ protected function _setDeleteResponse($message, $shipment, $additional = '', $isError = true)
260
+ {
261
+ $response = array(
262
+ 'error' => $isError,
263
+ 'message' => $this->__($message, $additional),
264
+ );
265
+ $response = Mage::helper('core')->jsonEncode($response);
266
+ $this->getResponse()->setBody($response);
267
+ if ($isError) {
268
+ $isShipmentLoaded = $shipment instanceof Mage_Sales_Model_Order_Shipment;
269
+ $incrementId = $isShipmentLoaded ? $shipment->getIncrementId() : "Unknown";
270
+ $shipmentId = $isShipmentLoaded ? $shipment->getId() : $shipment;
271
+ $this->_getHelper()->log(sprintf("Error deleting shipment, id: %s, reference: %s", $shipmentId, $incrementId));
272
+ $this->_getHelper()->log(sprintf("Message: %s", $message));
273
+ if ($additional) {
274
+ $this->_getHelper()->log(sprintf("Additional: %s", $additional));
275
+ }
276
+ }
277
+
278
+ return $isError;
279
+ }
280
+
281
+
282
+ /**
283
+ *
284
+ * Create a pickup request in the future
285
+ * sender address have to be configures
286
+ * shipment should be already generated
287
+ * the manifest can be closed or not
288
+ */
289
+ public function createPickupAction()
290
+ {
291
+ $shipmentIds = $this->getRequest()->getParam("shipment_ids");
292
+ if (!$shipmentIds) {
293
+ $this->_createPickupRedirect($this->__('Please select the shipments for which you wish to arrange a pickup.'));
294
+
295
+ return;
296
+ }
297
+
298
+ list($day, $month, $year) = explode("/", $this->getRequest()->getParam("zitec_dpd_pickup_date"));
299
+ if (!checkdate($month, $day, $year)) {
300
+ $this->_createPickupRedirect($this->__('Please enter a pickup date in the format DD/MM/YYYY.'));
301
+
302
+ return;
303
+ }
304
+ $year = isset($year) && strlen($year) == 2 ? "20$year" : $year;
305
+ $month = isset($month) && strlen($month) < 2 ? str_pad($month, 2, "0") : $month;
306
+ $day = isset($day) && strlen($day) < 2 ? str_pad($day, 2, "0") : $day;
307
+ $pickupDate = "$year$month$day";
308
+
309
+ $pickupFromParts = $this->getRequest()->getParam("zitec_dpd_pickup_from");
310
+ if (!is_array($pickupFromParts) || count($pickupFromParts) != 3) {
311
+ $this->_createPickupRedirect($this->__('Please select a from and to time for the pickup.'));
312
+
313
+ return;
314
+ }
315
+ $pickupFrom = implode("", $pickupFromParts);
316
+
317
+ $pickupToParts = $this->getRequest()->getParam("zitec_dpd_pickup_to");
318
+ if (!is_array($pickupToParts) || count($pickupToParts) != 3) {
319
+ $this->_getHelper()->addError($this->__('Please select a from and to time for the pickup.'));
320
+ $this->_redirect("adminhtml/sales_shipment/index");
321
+
322
+ return;
323
+ }
324
+ $pickupTo = implode("", $pickupToParts);
325
+
326
+ $instruction = $this->getRequest()->getParam("zitec_dpd_pickup_instruction");
327
+
328
+ $pickupAddress = $this->_getWsHelper()->getPickupAddress();
329
+ if (!is_array($pickupAddress)) {
330
+ $this->_getHelper()->addError($this->__('You cannot create a pickup because you have not fully specified your pickup address. <br />Please set your pickup address in System->Configuration->Sales->Shipping Settings->DPD GeoPost Pickup Address.'));
331
+ $this->_redirect("adminhtml/sales_shipment/index");
332
+
333
+ return;
334
+ }
335
+
336
+ $apiParams = $this->_getWsHelper()->getPickupParams();
337
+ $apiParams['method'] = Zitec_Dpd_Api_Configs::METHOD_PICKUP_CREATE;
338
+
339
+ $dpdApi = new Zitec_Dpd_Api($apiParams);
340
+ $createPickup = $dpdApi->getApiMethodObject();
341
+
342
+ $createPickup->setPickupTime($pickupDate, $pickupFrom, $pickupTo);
343
+ $createPickup->setSpecialInstruction($instruction);
344
+ $createPickup->setPickupAddress($pickupAddress);
345
+
346
+ $shipments = Mage::getResourceModel('sales/order_shipment_collection');
347
+ /* @var $shipments Mage_Sales_Model_Resource_Order_Shipment_Collection */
348
+ $shipments->addFieldToFilter('entity_id', array("in" => $shipmentIds));
349
+
350
+ $ships = Mage::getResourceModel('zitec_dpd/dpd_ship_collection');
351
+ /* @var $ships Zitec_Dpd_Model_Mysql4_Dpd_Ship_Collection */
352
+ $ships->filterByShipmentIds($shipmentIds);
353
+
354
+
355
+ $includedShipments = array();
356
+ foreach ($shipments as $shipment) {
357
+ /* @var $shipment Mage_Sales_Model_Order_Shipment */
358
+ $ship = $ships->findByShipmentId($shipment->getId());
359
+ /* @var $ship Zitec_Dpd_Model_Dpd_Ship */
360
+ if (!$ship || !$this->_getHelper()->isShippingMethodDpd($shipment) || $this->_getHelper()->isCancelledWithDpd($shipment)) {
361
+ continue;
362
+ }
363
+ $includedShipments[] = $shipment;
364
+
365
+ $call = @unserialize($ship->getSaveShipmentCall());
366
+ /* @var $call Zitec_Dpd_Api_Shipment_Save */
367
+ if (!$call) {
368
+ $message = $this->__("Unable to load shipment information for this shipment %s.", $shipment);
369
+ $this->_createPickupRedirect($message);
370
+
371
+ return;
372
+ }
373
+ $createPickup->addPieces($call->getShipmentServiceCode(), $call->getParcelCount(), $call->getTotalWeight(), $call->getReceiverCountryCode());
374
+ }
375
+ if (!$includedShipments) {
376
+ $message = $this->__("Your list did not contain any DPD shipments for which to arrange a pickup.", $shipment);
377
+ $this->_createPickupRedirect($message);
378
+
379
+ return;
380
+ }
381
+
382
+ try {
383
+ $createPickup->execute();
384
+ } catch (Exception $e) {
385
+ $message = $this->__('A problem occurred whilst communicating your shipment to DPD. <br />"%s"', $e->getMessage());
386
+ $this->_getHelper()->log($message);
387
+ $this->_createPickupRedirect($message);
388
+
389
+ return;
390
+ }
391
+ $response = $createPickup->getCreatePickupResponse();
392
+ if ($response->hasError()) {
393
+ $message = $this->__('DPD reported an error whilst attempting to arrange your pickup. <br />DPD says, "%s"', $response->getErrorText());
394
+ $this->_getHelper()->log($message);
395
+ $this->_createPickupRedirect($message);
396
+
397
+ return;
398
+ }
399
+
400
+ $pickup = Mage::getModel('zitec_dpd/dpd_pickup');
401
+ /* @var $pickup Zitec_Dpd_Model_Dpd_Pickup */
402
+
403
+ $pickup->setReference($response->getReferenceNumber())
404
+ ->setDpdId($response->getDpdId())
405
+ ->setPickupDate("$year-$month-$day")
406
+ ->setPickupTimeFrom("$year-$month-$day " . implode(":", $pickupFromParts))
407
+ ->setPickupTimeTo("$year-$month-$day " . implode(":", $pickupToParts))
408
+ ->setCallData(serialize($createPickup))
409
+ ->setResponseData(serialize($response))
410
+ ->save();
411
+
412
+ foreach ($includedShipments as $includedShipment) {
413
+ $includedShipment->setData('zitec_dpd_pickup_time', "$year-$month-$day " . implode(":", $pickupFromParts));
414
+ $includedShipment->setData('zitec_dpd_pickup_id', $pickup->getEntityId());
415
+ $includedShipment->save();
416
+ }
417
+
418
+ $this->_getHelper()->addNotice("Your pickup was created successfully");
419
+ $this->_redirect("adminhtml/sales_shipment/index");
420
+ }
421
+
422
+
423
+
424
+ /**
425
+ *
426
+ * @param string $message
427
+ * @param boolean $isError
428
+ */
429
+ protected function _createPickupRedirect($message, $isError = true)
430
+ {
431
+ if ($isError) {
432
+ $this->_getHelper()->addError($message);
433
+ } else {
434
+ $this->_getHelper()->addNotice($message);
435
+ }
436
+ $this->_redirect("adminhtml/sales_shipment/index");
437
+ }
438
+
439
+
440
+
441
+
442
+
443
+
444
+ /**
445
+ *
446
+ * @return Zitec_Dpd_Helper_Ws
447
+ */
448
+ protected function _getWsHelper()
449
+ {
450
+ return Mage::helper('zitec_dpd/ws');
451
+ }
452
+
453
+ /**
454
+ *
455
+ * @return Zitec_Dpd_Helper_Data
456
+ */
457
+ protected function _getHelper()
458
+ {
459
+ return Mage::helper('zitec_dpd');
460
+ }
461
+
462
+
463
+ }
app/code/community/Zitec/Dpd/etc/adminhtml.xml ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <zitec_dpd>
5
+ <title>DPD carrier</title>
6
+ <sort_order>99999</sort_order>
7
+ <action>zitec_shippingreports/adminhtml_reports_profitability/index</action>
8
+ <children>
9
+ <zitec_dpd translate="title" module="zitec_dpd">
10
+ <title>Table Rates</title>
11
+ <sort_order>20</sort_order>
12
+ <action>zitec_tablerates/adminhtml_index/index/carrier/zitecDpd</action>
13
+ </zitec_dpd>
14
+ <zitec_dpd_shipment_settings translate="title" module="zitec_dpd">
15
+ <title>Shipping settings</title>
16
+ <sort_order>10</sort_order>
17
+ <action>adminhtml/system_config/edit/section/carriers</action>
18
+ </zitec_dpd_shipment_settings>
19
+ <zitec_dpd_shipment_sender_settings translate="title" module="zitec_dpd">
20
+ <title>Sender settings</title>
21
+ <sort_order>12</sort_order>
22
+ <action>adminhtml/system_config/edit/section/shipping/</action>
23
+ </zitec_dpd_shipment_sender_settings>
24
+ <zitec_dpd_payment_settings translate="title" module="zitec_dpd">
25
+ <title>Payment settings</title>
26
+ <sort_order>14</sort_order>
27
+ <action>adminhtml/system_config/edit/section/payment</action>
28
+ </zitec_dpd_payment_settings>
29
+ <reports>
30
+ <title>Report price vs cost</title>
31
+ <sort_order>40</sort_order>
32
+ <action>zitec_shippingreports/adminhtml_reports_profitability</action>
33
+ </reports>
34
+ </children>
35
+ </zitec_dpd>
36
+ </menu>
37
+
38
+ <acl>
39
+ <resources>
40
+ <all>
41
+ <title>Allow Everything</title>
42
+ </all>
43
+ <admin>
44
+ <children>
45
+ <zitec_dpd>
46
+ <title>DPD GeoPost</title>
47
+ <sort_order>0</sort_order>
48
+ <children>
49
+ <zitec_dpd translate="title" module="zitec_dpd">
50
+ <title>DPD GeoPost - Table Rates</title>
51
+ <sort_order>500</sort_order>
52
+ </zitec_dpd>
53
+ <zitec_dpd_shipment_settings translate="title" module="zitec_dpd">
54
+ <title>DPD GeoPost - Shipping settings</title>
55
+ <sort_order>500</sort_order>
56
+ </zitec_dpd_shipment_settings>
57
+ <zitec_dpd_shipment_sender_settings translate="title" module="zitec_dpd">
58
+ <title>Sender settings</title>
59
+ <sort_order>500</sort_order>
60
+ </zitec_dpd_shipment_sender_settings>
61
+ <zitec_dpd_payment_settings translate="title" module="zitec_dpd">
62
+ <title>Payment settings</title>
63
+ <sort_order>500</sort_order>
64
+ </zitec_dpd_payment_settings>
65
+ <reports translate="title" module="zitec_dpd">
66
+ <title>DPD GeoPost</title>
67
+ <sort_order>500</sort_order>
68
+ </reports>
69
+ </children>
70
+ </zitec_dpd>
71
+ </children>
72
+ </admin>
73
+ </resources>
74
+ </acl>
75
+ </config>
app/code/community/Zitec/Dpd/etc/config.xml ADDED
@@ -0,0 +1,398 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Zitec_Dpd>
5
+ <version>1.0.3</version>
6
+ </Zitec_Dpd>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <zitec_dpd>
11
+ <class>Zitec_Dpd_Model</class>
12
+ <resourceModel>zitec_dpd_mysql4</resourceModel>
13
+ </zitec_dpd>
14
+ <zitec_dpd_mysql4>
15
+ <class>Zitec_Dpd_Model_Mysql4</class>
16
+ <entities>
17
+ <zitec_dpd_ship>
18
+ <table>zitec_dpd_ships</table>
19
+ </zitec_dpd_ship>
20
+ <carrier_tablerate>
21
+ <table>zitec_dpd_tablerate</table>
22
+ </carrier_tablerate>
23
+ <zitec_dpd_pickup_order>
24
+ <table>zitec_dpd_pickup_order</table>
25
+ </zitec_dpd_pickup_order>
26
+ <zitec_dpd_manifest>
27
+ <table>zitec_dpd_manifest</table>
28
+ </zitec_dpd_manifest>
29
+ </entities>
30
+ </zitec_dpd_mysql4>
31
+ <sales>
32
+ <rewrite>
33
+ <order_creditmemo_total_tax>Zitec_Dpd_Model_Sales_Order_Creditmemo_Total_Tax</order_creditmemo_total_tax>
34
+ <order_invoice_total_tax>Zitec_Dpd_Model_Sales_Order_Invoice_Total_Tax</order_invoice_total_tax>
35
+ </rewrite>
36
+ </sales>
37
+ </models>
38
+ <resources>
39
+ <zitec_dpd_setup>
40
+ <setup>
41
+ <module>Zitec_Dpd</module>
42
+ </setup>
43
+ <connection>
44
+ <use>core_setup</use>
45
+ </connection>
46
+ </zitec_dpd_setup>
47
+ <zitec_dpd_write>
48
+ <connection>
49
+ <use>core_write</use>
50
+ </connection>
51
+ </zitec_dpd_write>
52
+ <zitec_dpd_read>
53
+ <connection>
54
+ <use>core_read</use>
55
+ </connection>
56
+ </zitec_dpd_read>
57
+ </resources>
58
+ <blocks>
59
+ <zitec_dpd>
60
+ <class>Zitec_Dpd_Block</class>
61
+ </zitec_dpd>
62
+ <adminhtml>
63
+ <rewrite>
64
+ <sales_order_shipment_view_tracking>Zitec_Dpd_Block_Adminhtml_Sales_Order_Shipment_View_Tracking</sales_order_shipment_view_tracking>
65
+ <!-- <sales_order_shipment_view>Zitec_Dpd_Block_Adminhtml_Sales_Order_Shipment_View</sales_order_shipment_view> -->
66
+ <sales_shipment_grid>Zitec_Dpd_Block_Adminhtml_Sales_Shipment_Grid</sales_shipment_grid>
67
+ </rewrite>
68
+ </adminhtml>
69
+ </blocks>
70
+ <helpers>
71
+ <zitec_dpd>
72
+ <class>Zitec_Dpd_Helper</class>
73
+ </zitec_dpd>
74
+ </helpers>
75
+ <resources>
76
+ <zitec_dpd_setup>
77
+ <setup>
78
+ <module>Zitec_Dpd</module>
79
+ </setup>
80
+ </zitec_dpd_setup>
81
+ </resources>
82
+ <events>
83
+ <core_block_abstract_to_html_after>
84
+ <observers>
85
+ <zitec_dpd>
86
+ <type>singleton</type>
87
+ <class>zitec_dpd/observer_shipment</class>
88
+ <method>adminAddPostcodeAutocompleteBlock</method>
89
+ </zitec_dpd>
90
+ </observers>
91
+ </core_block_abstract_to_html_after>
92
+ <sales_order_shipment_save_before>
93
+ <observers>
94
+ <zitec_dpd>
95
+ <type>singleton</type>
96
+ <class>zitec_dpd/observer_shipment</class>
97
+ <method>salesOrderShipmentSaveBefore</method>
98
+ </zitec_dpd>
99
+ </observers>
100
+ </sales_order_shipment_save_before>
101
+ <sales_order_shipment_save_after>
102
+ <observers>
103
+ <zitec_dpd>
104
+ <type>singleton</type>
105
+ <class>zitec_dpd/observer_shipment</class>
106
+ <method>salesOrderShipmentSaveAfter</method>
107
+ </zitec_dpd>
108
+ </observers>
109
+ </sales_order_shipment_save_after>
110
+ <sales_order_address_save_after>
111
+ <observers>
112
+ <zitec_dpd>
113
+ <type>singleton</type>
114
+ <class>zitec_dpd/observer_address</class>
115
+ <method>salesOrderAddressAfterSave</method>
116
+ </zitec_dpd>
117
+ </observers>
118
+ </sales_order_address_save_after>
119
+
120
+ <core_block_abstract_prepare_layout_before>
121
+ <observers>
122
+ <zitec_dpd_print_manifest>
123
+ <class>zitec_dpd/observer_manifest</class>
124
+ <method>addManifestMassAction</method>
125
+ </zitec_dpd_print_manifest>
126
+ <zitec_dpd_create_pickup>
127
+ <class>zitec_dpd/observer_pickup</class>
128
+ <method>createPickupAction</method>
129
+ </zitec_dpd_create_pickup>
130
+ </observers>
131
+ </core_block_abstract_prepare_layout_before>
132
+ <sales_quote_payment_import_data_before>
133
+ <observers>
134
+ <zitec_dpd_force_recolect_totals_checkout>
135
+ <class>zitec_dpd/observer_payment</class>
136
+ <method>setTotalsCollectedFlag</method>
137
+ </zitec_dpd_force_recolect_totals_checkout>
138
+ </observers>
139
+ </sales_quote_payment_import_data_before>
140
+ <adminhtml_sales_order_create_process_data_before>
141
+ <observers>
142
+ <zitec_dpd_force_refresh_totals_admin_order_create>
143
+ <class>zitec_dpd/observer_payment</class>
144
+ <method>refreshTotalsInAdminOrderCreate</method>
145
+ </zitec_dpd_force_refresh_totals_admin_order_create>
146
+ </observers>
147
+ </adminhtml_sales_order_create_process_data_before>
148
+ <sales_order_address_save_before>
149
+ <observers>
150
+ <zitec_dpd_sales_order_address_save_before>
151
+ <type>singleton</type>
152
+ <class>zitec_dpd/observer_address</class>
153
+ <method>salesOrderAddressBeforeSave</method>
154
+ </zitec_dpd_sales_order_address_save_before>
155
+ </observers>
156
+ </sales_order_address_save_before>
157
+
158
+ </events>
159
+ <sales>
160
+ <shipping>
161
+ <carriers>
162
+ <zitec_dpd>
163
+ <class>Zitec_Dpd_Model_Shipping_Carrier_DPD</class>
164
+ </zitec_dpd>
165
+ </carriers>
166
+ </shipping>
167
+ <quote>
168
+ <totals>
169
+ <zitec_dpd_cashondelivery_surcharge>
170
+ <class>zitec_dpd/sales_quote_address_total_cashondeliverysurchage</class>
171
+ <after>shipping,tax_shipping</after>
172
+ <before>tax,grand_total</before>
173
+ <renderer>zitec_dpd/tax_checkout_cashondeliverysurchage</renderer>
174
+ </zitec_dpd_cashondelivery_surcharge>
175
+ <grand_total>
176
+ <after>zitec_dpd_cashondelivery_surcharge,tax</after>
177
+ <before>msrp</before>
178
+ </grand_total>
179
+ <tax>
180
+ <before>grand_total</before>
181
+ <after>zitec_dpd_cashondelivery_surcharge</after>
182
+ </tax>
183
+ <msrp>
184
+ <after>grand_total</after>
185
+ </msrp>
186
+ </totals>
187
+
188
+ </quote>
189
+ <order_invoice>
190
+ <totals>
191
+ <zitec_dpd_cashondelivery_surcharge>
192
+ <class>zitec_dpd/sales_order_invoice_total_cashondeliverysurchage</class>
193
+ <after>shipping</after>
194
+ <before>tax,grand_total</before>
195
+ </zitec_dpd_cashondelivery_surcharge>
196
+ </totals>
197
+ </order_invoice>
198
+ <order_creditmemo>
199
+ <totals>
200
+ <zitec_dpd_cashondelivery_surcharge>
201
+ <class>zitec_dpd/sales_order_creditmemo_total_cashondeliverysurchage</class>
202
+ <after>shipping</after>
203
+ <before>tax,grand_total</before>
204
+ </zitec_dpd_cashondelivery_surcharge>
205
+ </totals>
206
+ </order_creditmemo>
207
+ </sales>
208
+ <fieldsets>
209
+ <sales_convert_quote_address>
210
+ <zitec_dpd_cashondelivery_surcharge>
211
+ <to_order>*</to_order>
212
+ </zitec_dpd_cashondelivery_surcharge>
213
+ <base_zitec_dpd_cashondelivery_surcharge>
214
+ <to_order>*</to_order>
215
+ </base_zitec_dpd_cashondelivery_surcharge>
216
+ <zitec_dpd_cashondelivery_surcharge_tax>
217
+ <to_order>*</to_order>
218
+ </zitec_dpd_cashondelivery_surcharge_tax>
219
+ <base_zitec_dpd_cashondelivery_surcharge_tax>
220
+ <to_order>*</to_order>
221
+ </base_zitec_dpd_cashondelivery_surcharge_tax>
222
+ <valid_auto_postcode>
223
+ <to_order_address>*</to_order_address>
224
+ </valid_auto_postcode>
225
+ <auto_postcode>
226
+ <to_order_address>*</to_order_address>
227
+ </auto_postcode>
228
+ </sales_convert_quote_address>
229
+ </fieldsets>
230
+ <pdf>
231
+ <totals>
232
+ <zitec_dpd_cashondelivery_surcharge translate="title">
233
+ <title>Recargo contrareembolso</title>
234
+ <model>zitec_dpd/sales_order_pdf_total_cashondeliverysurchage</model>
235
+ <source_field>zitec_dpd_cashondelivery_surcharge</source_field>
236
+ <font_size>7</font_size>
237
+ <display_zero>0</display_zero>
238
+ <sort_order>410</sort_order>
239
+ </zitec_dpd_cashondelivery_surcharge>
240
+ </totals>
241
+ </pdf>
242
+ </global>
243
+ <adminhtml>
244
+ <translate>
245
+ <modules>
246
+ <Zitec_Dpd>
247
+ <files>
248
+ <default>Zitec_Dpd.csv</default>
249
+ </files>
250
+ </Zitec_Dpd>
251
+ </modules>
252
+ </translate>
253
+
254
+ <layout>
255
+ <updates>
256
+ <zitec_dpd>
257
+ <file>zitec_dpd.xml</file>
258
+ </zitec_dpd>
259
+ </updates>
260
+ </layout>
261
+
262
+ </adminhtml>
263
+ <frontend>
264
+ <layout>
265
+ <updates>
266
+ <zitec_dpd>
267
+ <file>zitec_dpd.xml</file>
268
+ </zitec_dpd>
269
+ </updates>
270
+ </layout>
271
+ <translate>
272
+ <modules>
273
+ <Zitec_Dpd>
274
+ <files>
275
+ <default>Zitec_Dpd_frontend.csv</default>
276
+ </files>
277
+ </Zitec_Dpd>
278
+ </modules>
279
+ </translate>
280
+ </frontend>
281
+ <admin>
282
+ <routers>
283
+ <zitec_dpd>
284
+ <use>admin</use>
285
+ <args>
286
+ <module>Zitec_Dpd</module>
287
+ <frontName>zitec_dpd</frontName>
288
+ </args>
289
+ </zitec_dpd>
290
+ </routers>
291
+ </admin>
292
+ <frontend>
293
+ <routers>
294
+ <zitec_dpd>
295
+ <use>standard</use>
296
+ <args>
297
+ <module>Zitec_Dpd</module>
298
+ <frontName>zitec_dpd</frontName>
299
+ </args>
300
+ </zitec_dpd>
301
+ </routers>
302
+ </frontend>
303
+
304
+ <default>
305
+ <carriers>
306
+ <zitecDpd>
307
+ <postcode_autocomplete_checkout>1</postcode_autocomplete_checkout>
308
+ <connectionTimeout>10</connectionTimeout>
309
+ <model>zitec_dpd/shipping_carrier_dpd</model>
310
+ <countryurls>
311
+ <CZ>
312
+ <production>https://it4em.dpd.cz/IT4EMWebServices/eshop/</production>
313
+ <test>http://it4emtest.dpd.cz:7777/IT4EMWebServices/eshop/</test>
314
+ </CZ>
315
+ <SK>
316
+ <production>https://it4em.dpd.sk/IT4EMWebServices/eshop/</production>
317
+ <test></test>
318
+ </SK>
319
+ <RO>
320
+ <production>https://it4em.dpd.ro/IT4EMWebServices/eshop/</production>
321
+ <test></test>
322
+ </RO>
323
+ <SI>
324
+ <production>https://it4em.dpd.si/IT4EMWebServices/eshop/</production>
325
+ <test></test>
326
+ </SI>
327
+ <HR>
328
+ <production>https://it4em.dpd.hr/IT4EMWebServices/eshop/</production>
329
+ <test></test>
330
+ </HR>
331
+ <LT>
332
+ <production>https://integration.dpd.lt:8443/IT4EMWebServices/eshop/</production>
333
+ <test>https://integrationtest.dpd.lt:8183/IT4EMWebServices/eshop/</test>
334
+ </LT>
335
+ <LV>
336
+ <production>https://integration.dpd.lv:8443/IT4EMWebServices/eshop/</production>
337
+ <test>https://integrationtest.dpd.lv:8183/IT4EMWebServices/eshop/</test>
338
+ </LV>
339
+ <EE>
340
+ <production>https://integration.dpd.ee:8443/IT4EMWebServices/eshop/</production>
341
+ <test>https://integrationtest.dpd.ee:8183/IT4EMWebServices/eshop/</test>
342
+ </EE>
343
+ </countryurls>
344
+ <shipmentUrlPart>ShipmentServiceImpl?wsdl</shipmentUrlPart>
345
+ <manifestUrlPart>ManifestServiceImpl?wsdl</manifestUrlPart>
346
+ <pickupUrlPart>PickupOrderServiceImpl?wsdl</pickupUrlPart>
347
+ <zitec_tablerates>
348
+ <grid_title>DPD Table Rates</grid_title>
349
+ <tablerates_db_table>zitec_dpd/carrier_tablerate</tablerates_db_table>
350
+ <features>
351
+ <markup_type>1</markup_type>
352
+ <price_vs_dest>1</price_vs_dest>
353
+ <cash_on_delivery>1</cash_on_delivery>
354
+ <cod_min_surcharge>1</cod_min_surcharge>
355
+ </features>
356
+ <db_table_field_names>
357
+ <weight_price>weight</weight_price>
358
+ </db_table_field_names>
359
+ <method_source>zitec_dpd/config_source_service</method_source>
360
+ <export_action>zitec_dpd/adminhtml_config/exportTablerates</export_action>
361
+ <import>
362
+ <resource_class>zitec_dpd/carrier_tablerate</resource_class>
363
+ <method>uploadAndImport</method>
364
+ </import>
365
+ </zitec_tablerates>
366
+ </zitecDpd>
367
+ </carriers>
368
+ <payment>
369
+ <zitec_dpd_cashondelivery>
370
+ <active>1</active>
371
+ <title>Cash On Delivery</title>
372
+ <total_title>Cash On Delivery Surcharge</total_title>
373
+ <order_status>zitec_dpd_pending_cashondelivery</order_status>
374
+ <model>zitec_dpd/payment_cashondelivery</model>
375
+ <services>1,9,10,27,109,40033,40107</services>
376
+ <specificproducto>1,9,10,27,109,40033,40107</specificproducto>
377
+ <cod_payment_type>Cash</cod_payment_type>
378
+ <payment_amount_type>1</payment_amount_type>
379
+ <payment_amount>0</payment_amount>
380
+ </zitec_dpd_cashondelivery>
381
+ </payment>
382
+ <sales>
383
+ <totals_sort>
384
+ <zitec_dpd_cashondelivery_surcharge>35</zitec_dpd_cashondelivery_surcharge>
385
+ </totals_sort>
386
+ </sales>
387
+ <zitec_fieldlengths>
388
+ <checkout_onepage_index>
389
+ <street_address>
390
+ <idStartsWith>shipping:street</idStartsWith>
391
+ <maxLength>70</maxLength>
392
+ </street_address>
393
+ </checkout_onepage_index>
394
+ </zitec_fieldlengths>
395
+
396
+ </default>
397
+
398
+ </config>
app/code/community/Zitec/Dpd/etc/system.xml ADDED
@@ -0,0 +1,380 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <sections>
3
+ <carriers>
4
+ <groups>
5
+ <zitecDpd>
6
+ <label>DPD GeoPost By Zitec</label>
7
+ <comment><![CDATA[
8
+ <div class="custom-options">
9
+ <div style="margin-bottom:20px;">
10
+ <strong style="color:#EA7601;">DPD GeoPost v1.0
11
+ <br />
12
+ </div>
13
+ </div>
14
+ ]]>
15
+ </comment>
16
+
17
+ <frontend_type>text</frontend_type>
18
+ <sort_order>20</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>1</show_in_store>
22
+ <fields>
23
+ <active translate="label">
24
+ <label>Enabled</label>
25
+ <frontend_type>select</frontend_type>
26
+ <source_model>adminhtml/system_config_source_yesno</source_model>
27
+ <sort_order>10</sort_order>
28
+ <show_in_default>1</show_in_default>
29
+ <show_in_website>1</show_in_website>
30
+ <show_in_store>0</show_in_store>
31
+ </active>
32
+ <wscountry translate="label">
33
+ <label>DPD Country Select</label>
34
+ <frontend_type>select</frontend_type>
35
+ <source_model>zitec_dpd/config_source_wscountry</source_model>
36
+ <sort_order>15</sort_order>
37
+ <show_in_default>1</show_in_default>
38
+ <show_in_website>1</show_in_website>
39
+ <show_in_store>0</show_in_store>
40
+ </wscountry>
41
+ <mode translate="label">
42
+ <label>Production Mode</label>
43
+ <frontend_type>select</frontend_type>
44
+ <source_model>adminhtml/system_config_source_yesno</source_model>
45
+ <backend_model>zitec_dpd/config_data_mode</backend_model>
46
+ <sort_order>30</sort_order>
47
+ <show_in_default>1</show_in_default>
48
+ <show_in_website>1</show_in_website>
49
+ <show_in_store>0</show_in_store>
50
+ </mode>
51
+ <wsurlproduction translate="label comment">
52
+ <label>Production WS URL</label>
53
+ <frontend_type>text</frontend_type>
54
+ <sort_order>33</sort_order>
55
+ <show_in_default>1</show_in_default>
56
+ <show_in_website>1</show_in_website>
57
+ <show_in_store>0</show_in_store>
58
+ <depends>
59
+ <wscountry>zOther</wscountry>
60
+ </depends>
61
+ <comment><![CDATA[E.g. http://egproduction.dpd.com/IT4EMWebServices/eshop/]]></comment>
62
+ </wsurlproduction>
63
+ <wsurltest translate="label comment">
64
+ <label>Test WS URL</label>
65
+ <frontend_type>text</frontend_type>
66
+ <sort_order>34</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>0</show_in_store>
70
+ <depends>
71
+ <wscountry>zOther</wscountry>
72
+ </depends>
73
+ <comment><![CDATA[E.g. http://egtest.dpd.com/IT4EMWebServices/eshop/]]></comment>
74
+ </wsurltest>
75
+ <title translate="label">
76
+ <label>Method Title</label>
77
+ <frontend_type>text</frontend_type>
78
+ <sort_order>38</sort_order>
79
+ <show_in_default>1</show_in_default>
80
+ <show_in_website>1</show_in_website>
81
+ <show_in_store>1</show_in_store>
82
+ </title>
83
+ <name translate="label">
84
+ <label>Method Name</label>
85
+ <frontend_type>text</frontend_type>
86
+ <sort_order>40</sort_order>
87
+ <show_in_default>1</show_in_default>
88
+ <show_in_website>1</show_in_website>
89
+ <show_in_store>1</show_in_store>
90
+ </name>
91
+ <username translate="label">
92
+ <label>Web Service Username</label>
93
+ <frontend_type>text</frontend_type>
94
+ <sort_order>50</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
+ </username>
99
+ <password translate="label">
100
+ <label>Web Service Password</label>
101
+ <frontend_type>text</frontend_type>
102
+ <sort_order>60</sort_order>
103
+ <show_in_default>1</show_in_default>
104
+ <show_in_website>1</show_in_website>
105
+ <show_in_store>0</show_in_store>
106
+ </password>
107
+ <connectionTimeout translate="label comment">
108
+ <label>Web Service Connection Timeout</label>
109
+ <frontend_type>text</frontend_type>
110
+ <sort_order>65</sort_order>
111
+ <show_in_default>1</show_in_default>
112
+ <show_in_website>1</show_in_website>
113
+ <show_in_store>0</show_in_store>
114
+ <comment>
115
+ <![CDATA[Set a timeout for connecting to the DPD web service in seconds.]]></comment>
116
+ </connectionTimeout>
117
+ <senderAddressId translate="label">
118
+ <label>Sender Address Id</label>
119
+ <frontend_type>text</frontend_type>
120
+ <sort_order>70</sort_order>
121
+ <show_in_default>1</show_in_default>
122
+ <show_in_website>1</show_in_website>
123
+ <show_in_store>0</show_in_store>
124
+ </senderAddressId>
125
+ <payerId translate="label">
126
+ <label>Payer Id</label>
127
+ <frontend_type>text</frontend_type>
128
+ <sort_order>80</sort_order>
129
+ <show_in_default>1</show_in_default>
130
+ <show_in_website>1</show_in_website>
131
+ <show_in_store>0</show_in_store>
132
+ </payerId>
133
+ <services translate="label comment">
134
+ <label>Service</label>
135
+ <frontend_type>multiselect</frontend_type>
136
+ <source_model>zitec_dpd/config_source_service</source_model>
137
+ <sort_order>90</sort_order>
138
+ <show_in_default>1</show_in_default>
139
+ <show_in_website>1</show_in_website>
140
+ <show_in_store>0</show_in_store>
141
+ <comment>Select the services that you want to enable. Note that you must also define the shipping prices for these services in your shipping table rates (see below).</comment>
142
+ </services>
143
+ <export translate="label">
144
+ <label>Export Shipping Table Rates</label>
145
+ <frontend_type>button</frontend_type>
146
+ <frontend_model>zitec_dpd/adminhtml_system_config_button_export</frontend_model>
147
+ <sort_order>100</sort_order>
148
+ <show_in_default>0</show_in_default>
149
+ <show_in_website>1</show_in_website>
150
+ <show_in_store>0</show_in_store>
151
+ </export>
152
+ <import translate="label">
153
+ <label>Import Shipping Table Rates</label>
154
+ <frontend_type>import</frontend_type>
155
+ <backend_model>zitec_dpd/config_data_tablerate</backend_model>
156
+ <sort_order>110</sort_order>
157
+ <show_in_default>0</show_in_default>
158
+ <show_in_website>1</show_in_website>
159
+ <show_in_store>0</show_in_store>
160
+ </import>
161
+ <postcode_autocomplete_checkout translate="label">
162
+ <label>Auto-correct the user postcode in checkout</label>
163
+ <frontend_type>select</frontend_type>
164
+ <source_model>adminhtml/system_config_source_yesno</source_model>
165
+ <sort_order>10</sort_order>
166
+ <show_in_default>1</show_in_default>
167
+ <show_in_website>1</show_in_website>
168
+ <show_in_store>0</show_in_store>
169
+ <comment>Use this option to allow DPD shipment method even if the postcode is not valid. The post code will be automatically generated considering the city, region and street. In some cases the administrator will have to manually validate the postcode.</comment>
170
+ </postcode_autocomplete_checkout>
171
+
172
+ </fields>
173
+ </zitecDpd>
174
+
175
+
176
+ </groups>
177
+ </carriers>
178
+ <shipping>
179
+ <groups>
180
+ <zitec_pickupaddress traslate="label">
181
+ <label>DPD GeoPost Pickup Address</label>
182
+ <sort_order>10</sort_order>
183
+ <show_in_default>1</show_in_default>
184
+ <show_in_website>0</show_in_website>
185
+ <show_in_store>0</show_in_store>
186
+ <fields>
187
+ <name translate="label">
188
+ <label>Name</label>
189
+ <frontend_type>text</frontend_type>
190
+ <sort_order>10</sort_order>
191
+ <show_in_default>1</show_in_default>
192
+ <show_in_website>1</show_in_website>
193
+ <show_in_store>0</show_in_store>
194
+ </name>
195
+ <additionalname translate="label">
196
+ <label>Additional Name</label>
197
+ <frontend_type>text</frontend_type>
198
+ <sort_order>15</sort_order>
199
+ <show_in_default>1</show_in_default>
200
+ <show_in_website>1</show_in_website>
201
+ <show_in_store>0</show_in_store>
202
+ </additionalname>
203
+ <street translate="label">
204
+ <label>Street</label>
205
+ <frontend_type>text</frontend_type>
206
+ <sort_order>20</sort_order>
207
+ <show_in_default>1</show_in_default>
208
+ <show_in_website>1</show_in_website>
209
+ <show_in_store>0</show_in_store>
210
+ </street>
211
+ <city translate="label">
212
+ <label>City</label>
213
+ <frontend_type>text</frontend_type>
214
+ <sort_order>30</sort_order>
215
+ <show_in_default>1</show_in_default>
216
+ <show_in_website>1</show_in_website>
217
+ <show_in_store>0</show_in_store>
218
+ </city>
219
+ <postcode translate="label">
220
+ <label>Postcode</label>
221
+ <frontend_type>text</frontend_type>
222
+ <sort_order>40</sort_order>
223
+ <show_in_default>1</show_in_default>
224
+ <show_in_website>1</show_in_website>
225
+ <show_in_store>0</show_in_store>
226
+ </postcode>
227
+ <country translate="label">
228
+ <label>Country</label>
229
+ <frontend_type>select</frontend_type>
230
+ <sort_order>50</sort_order>
231
+ <source_model>adminhtml/system_config_source_country</source_model>
232
+ <show_in_default>1</show_in_default>
233
+ <show_in_website>1</show_in_website>
234
+ <show_in_store>0</show_in_store>
235
+ </country>
236
+ <phone translate="label">
237
+ <label>Telephone</label>
238
+ <frontend_type>text</frontend_type>
239
+ <sort_order>55</sort_order>
240
+ <show_in_default>1</show_in_default>
241
+ <show_in_website>1</show_in_website>
242
+ <show_in_store>0</show_in_store>
243
+ </phone>
244
+ <email translate="label">
245
+ <label>Email Address</label>
246
+ <frontend_type>text</frontend_type>
247
+ <sort_order>60</sort_order>
248
+ <show_in_default>1</show_in_default>
249
+ <show_in_website>1</show_in_website>
250
+ <show_in_store>0</show_in_store>
251
+ </email>
252
+ </fields>
253
+ </zitec_pickupaddress>
254
+ </groups>
255
+ </shipping>
256
+ <payment>
257
+ <groups>
258
+ <zitec_dpd_cashondelivery translate="label" module="payment">
259
+ <label>Cash On Delivery for DPD GeoPost</label>
260
+ <comment><![CDATA[<div class="custom-options">
261
+ <div style="margin-bottom:20px;">
262
+ <span style="color:#EA7601;">Important:</span> This payment method will only be available if you have activated the shipping method 'DPD GeoPost' and have specified values in the 'CashOnDelivery Surcharge' column of your table rates file.
263
+ <br />
264
+ <strong style="color:#EA7601;">Cash on Delivery for DPD GeoPost v1.0</strong>
265
+ <br />
266
+ </div>
267
+ </div>
268
+ ]]></comment>
269
+ <sort_order>670</sort_order>
270
+ <show_in_default>1</show_in_default>
271
+ <show_in_website>1</show_in_website>
272
+ <show_in_store>1</show_in_store>
273
+ <fields>
274
+ <active translate="label">
275
+ <label>Enabled</label>
276
+ <frontend_type>select</frontend_type>
277
+ <source_model>adminhtml/system_config_source_yesno</source_model>
278
+ <sort_order>1</sort_order>
279
+ <show_in_default>1</show_in_default>
280
+ <show_in_website>1</show_in_website>
281
+ <show_in_store>0</show_in_store>
282
+ </active>
283
+ <title translate="label">
284
+ <label>Title</label>
285
+ <frontend_type>text</frontend_type>
286
+ <sort_order>2</sort_order>
287
+ <show_in_default>1</show_in_default>
288
+ <show_in_website>1</show_in_website>
289
+ <show_in_store>1</show_in_store>
290
+ </title>
291
+ <description translate="label">
292
+ <label>Description</label>
293
+ <frontend_type>textarea</frontend_type>
294
+ <sort_order>3</sort_order>
295
+ <show_in_default>1</show_in_default>
296
+ <show_in_website>1</show_in_website>
297
+ <show_in_store>1</show_in_store>
298
+ </description>
299
+ <total_title translate="label">
300
+ <label>Surcharge Name</label>
301
+ <frontend_type>text</frontend_type>
302
+ <sort_order>4</sort_order>
303
+ <show_in_default>1</show_in_default>
304
+ <show_in_website>1</show_in_website>
305
+ <show_in_store>1</show_in_store>
306
+ </total_title>
307
+ <order_status translate="label">
308
+ <label>New order status</label>
309
+ <frontend_type>select</frontend_type>
310
+ <source_model>zitec_dpd/config_source_order_status_pendingpayment</source_model>
311
+ <sort_order>10</sort_order>
312
+ <show_in_default>1</show_in_default>
313
+ <show_in_website>1</show_in_website>
314
+ <show_in_store>0</show_in_store>
315
+ </order_status>
316
+ <specificproducto translate="label">
317
+ <label>Service</label>
318
+ <frontend_type>multiselect</frontend_type>
319
+ <source_model>zitec_dpd/payment_cashondelivery_source_service</source_model>
320
+ <sort_order>50</sort_order>
321
+ <show_in_default>1</show_in_default>
322
+ <show_in_website>1</show_in_website>
323
+ <show_in_store>0</show_in_store>
324
+ <can_be_empty>1</can_be_empty>
325
+ </specificproducto>
326
+ <cod_payment_type translate="label comment">
327
+ <label>Payment Type</label>
328
+ <frontend_type>select</frontend_type>
329
+ <source_model>zitec_dpd/payment_cashondelivery_source_codpaymenttype</source_model>
330
+ <sort_order>55</sort_order>
331
+ <show_in_default>1</show_in_default>
332
+ <show_in_website>1</show_in_website>
333
+ <show_in_store>0</show_in_store>
334
+ <comment>Select how customers will pay the courier.</comment>
335
+ </cod_payment_type>
336
+ <payment_amount_type translate="label comment">
337
+ <label>Payment amount type</label>
338
+ <frontend_type>select</frontend_type>
339
+ <source_model>zitec_dpd/payment_cashondelivery_source_amountType</source_model>
340
+ <sort_order>57</sort_order>
341
+ <show_in_default>1</show_in_default>
342
+ <show_in_website>1</show_in_website>
343
+ <show_in_store>0</show_in_store>
344
+ <comment>Choose the type of charge percentage of order amount or fixed price in case table rates is not defined for DPD shipping method.</comment>
345
+ </payment_amount_type>
346
+ <payment_amount translate="label comment">
347
+ <label>Payment amount</label>
348
+ <frontend_type>text</frontend_type>
349
+ <sort_order>58</sort_order>
350
+ <show_in_default>1</show_in_default>
351
+ <show_in_website>1</show_in_website>
352
+ <show_in_store>1</show_in_store>
353
+ <comment>This amount will be used to charge the customer if no records is loaded into table rates</comment>
354
+ </payment_amount>
355
+
356
+ <allowspecific translate="label">
357
+ <label>Payment from Applicable Countries</label>
358
+ <frontend_type>allowspecific</frontend_type>
359
+ <sort_order>60</sort_order>
360
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
361
+ <show_in_default>1</show_in_default>
362
+ <show_in_website>1</show_in_website>
363
+ <show_in_store>0</show_in_store>
364
+ </allowspecific>
365
+ <specificcountry translate="label">
366
+ <label>Payment from Specific Countries</label>
367
+ <frontend_type>multiselect</frontend_type>
368
+ <sort_order>61</sort_order>
369
+ <source_model>zitec_dpd/payment_cashondelivery_source_country</source_model>
370
+ <show_in_default>1</show_in_default>
371
+ <show_in_website>1</show_in_website>
372
+ <show_in_store>0</show_in_store>
373
+ <can_be_empty>1</can_be_empty>
374
+ </specificcountry>
375
+ </fields>
376
+ </zitec_dpd_cashondelivery>
377
+ </groups>
378
+ </payment>
379
+ </sections>
380
+ </config>
app/code/community/Zitec/Dpd/sql/zitec_dpd_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+
25
+ /* @var $installer Mage_Core_Model_Resource_Setup */
26
+ $installer = $this;
27
+
28
+ $installer->startSetup();
29
+
30
+ $installer->run("
31
+ DROP TABLE IF EXISTS {$this->getTable('zitec_dpd_ships')};
32
+ CREATE TABLE {$this->getTable('zitec_dpd_ships')} (
33
+ `id` int(10) unsigned NOT NULL auto_increment,
34
+ `shipment_id` int(10) unsigned DEFAULT NULL,
35
+ `order_id` int(10) unsigned DEFAULT NULL,
36
+ `save_shipment_call` mediumtext,
37
+ `save_shipment_response` mediumtext,
38
+ `shipping_labels` mediumtext,
39
+ `manifest` mediumtext,
40
+ PRIMARY KEY (`id`)
41
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
42
+
43
+
44
+ DROP TABLE IF EXISTS {$this->getTable('zitec_dpd_tablerate')};
45
+ CREATE TABLE {$this->getTable('zitec_dpd_tablerate')} (
46
+ `pk` int(10) unsigned NOT NULL auto_increment,
47
+ `website_id` int(11) NOT NULL default '0',
48
+ `dest_country_id` varchar(4) NOT NULL default '0',
49
+ `dest_region_id` int(10) NOT NULL default '0',
50
+ `dest_zip` varchar(10) NOT NULL default '',
51
+ `weight` decimal(12,4) NOT NULL default '0.0000',
52
+ `price` varchar(10) NOT NULL default '0.0000',
53
+ `method` varchar(6) NOT NULL default '0',
54
+ `markup_type` varchar(5) NOT NULL default '0',
55
+ PRIMARY KEY (`pk`),
56
+ UNIQUE KEY `dest_country` (`website_id`,`dest_country_id`,`dest_region_id`,`dest_zip`,`weight`,`method`)
57
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
58
+
59
+ ");
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+ $installer->run("
68
+ DROP TABLE IF EXISTS {$this->getTable('zitec_dpd_pickup_order')};
69
+
70
+ CREATE TABLE {$this->getTable('zitec_dpd_pickup_order')} (
71
+ `entity_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
72
+ `reference` VARCHAR( 255 ) NOT NULL ,
73
+ `dpd_id` INT NOT NULL ,
74
+ `pickup_date` DATETIME NOT NULL ,
75
+ `pickup_time_from` DATETIME NOT NULL ,
76
+ `pickup_time_to` DATETIME NOT NULL ,
77
+ `call_data` MEDIUMTEXT NOT NULL ,
78
+ `response_data` MEDIUMTEXT NOT NULL ,
79
+ INDEX ( `pickup_date` , `pickup_time_from` , `pickup_time_to` ) ,
80
+ UNIQUE (
81
+ `reference`
82
+ )
83
+ ) ENGINE = INNODB DEFAULT CHARSET=utf8;
84
+
85
+ ");
86
+
87
+
88
+
89
+ $salesSetup = Mage::getModel('eav/entity_setup', 'sales_setup');
90
+ /** @var $salesSetup Mage_Sales_Model_Resource_Setup */
91
+ $salesSetup->addAttribute('shipment', 'zitec_dpd_pickup_id', array('type' => 'int'));
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+ $salesSetup = Mage::getModel('eav/entity_setup', 'sales_setup');
100
+ /** @var $salesSetup Mage_Sales_Model_Resource_Setup */
101
+ $salesSetup->addAttribute('shipment', 'zitec_dpd_pickup_time', array('type' => 'datetime', "grid" => true));
102
+ $salesSetup->addAttribute('shipment', 'zitec_dpd_manifest_closed', array('type' => 'int', "grid" => true, "default" => 0));
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+ $installer->getConnection()->addColumn($this->getTable('zitec_dpd_tablerate'), 'cashondelivery_surcharge', "varchar(20) DEFAULT NULL");
113
+
114
+ $salesSetup = new Mage_Sales_Model_Mysql4_Setup('sales_setup');
115
+
116
+ $salesSetup->addAttribute('quote_address', 'zitec_dpd_cashondelivery_surcharge', array('type' => 'decimal'));
117
+ $salesSetup->addAttribute('quote_address', 'base_zitec_dpd_cashondelivery_surcharge', array('type' => 'decimal'));
118
+
119
+ $salesSetup->addAttribute('order', 'zitec_dpd_cashondelivery_surcharge', array('type' => 'decimal'));
120
+ $salesSetup->addAttribute('order', 'base_zitec_dpd_cashondelivery_surcharge', array('type' => 'decimal'));
121
+
122
+ $salesSetup->addAttribute('invoice', 'zitec_dpd_cashondelivery_surcharge', array('type' => 'decimal'));
123
+ $salesSetup->addAttribute('invoice', 'base_zitec_dpd_cashondelivery_surcharge', array('type' => 'decimal'));
124
+
125
+ $salesSetup->addAttribute('creditmemo', 'zitec_dpd_cashondelivery_surcharge', array('type' => 'decimal'));
126
+ $salesSetup->addAttribute('creditmemo', 'base_zitec_dpd_cashondelivery_surcharge', array('type' => 'decimal'));
127
+
128
+ $salesSetup->addAttribute('quote_address', 'zitec_dpd_cashondelivery_surcharge_tax', array('type' => 'decimal'));
129
+ $salesSetup->addAttribute('quote_address', 'base_zitec_dpd_cashondelivery_surcharge_tax', array('type' => 'decimal'));
130
+
131
+ $salesSetup->addAttribute('order', 'zitec_dpd_cashondelivery_surcharge_tax', array('type' => 'decimal'));
132
+ $salesSetup->addAttribute('order', 'base_zitec_dpd_cashondelivery_surcharge_tax', array('type' => 'decimal'));
133
+
134
+ $salesSetup->addAttribute('invoice', 'zitec_dpd_cashondelivery_surcharge_tax', array('type' => 'decimal'));
135
+ $salesSetup->addAttribute('invoice', 'base_zitec_dpd_cashondelivery_surcharge_tax', array('type' => 'decimal'));
136
+
137
+ $salesSetup->addAttribute('creditmemo', 'zitec_dpd_cashondelivery_surcharge_tax', array('type' => 'decimal'));
138
+ $salesSetup->addAttribute('creditmemo', 'base_zitec_dpd_cashondelivery_surcharge_tax', array('type' => 'decimal'));
139
+
140
+ $status = Mage::getModel('sales/order_status');
141
+ $status->setStatus('zitec_dpd_pending_cashondelivery');
142
+ $status->setLabel('DPD Pending Cash On Delivery');
143
+ $status->assignState('pending_payment');
144
+ $status->save();
145
+
146
+
147
+
148
+
149
+
150
+
151
+ $installer->getConnection()->addColumn($this->getTable('zitec_dpd_tablerate'), 'price_vs_dest', "int(10) NOT NULL default '0'");
152
+
153
+
154
+
155
+
156
+
157
+
158
+ $installer->getConnection()->addColumn($this->getTable('zitec_dpd_tablerate'), 'cod_min_surcharge', "decimal(12,4)");
159
+
160
+
161
+
162
+
163
+
164
+
165
+ $installer->getConnection()->dropKey($this->getTable('zitec_dpd_tablerate'), "dest_country");
166
+
167
+ $installer->getConnection()->addKey(
168
+ $this->getTable('zitec_dpd_tablerate'),
169
+ "dest_country",
170
+ array('website_id', 'dest_country_id', 'dest_region_id', 'dest_zip', 'weight', 'method', 'price_vs_dest'),
171
+ "unique");
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+ //$installer->getConnection()->dropColumn($this->getTable('zitec_dpd_ships'), 'manifest');
180
+
181
+ $installer->getConnection()->addColumn($installer->getTable('zitec_dpd_ships'), 'manifest_id', "int");
182
+
183
+ $installer->run("
184
+
185
+ DROP TABLE IF EXISTS {$installer->getTable('zitec_dpd_manifest')};
186
+
187
+
188
+ CREATE TABLE {$installer->getTable('zitec_dpd_manifest')} (
189
+ `manifest_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
190
+ `manifest_ref` VARCHAR( 30 ) NOT NULL ,
191
+ `manifest_dpd_id` VARCHAR( 30 ) NULL ,
192
+ `manifest_dpd_name` VARCHAR( 30 ) NULL ,
193
+ `pdf` MEDIUMTEXT NOT NULL
194
+ ) ENGINE = INNODB; ");
195
+
196
+
197
+
198
+
199
+
200
+
201
+ $installer->getConnection()->dropColumn($this->getTable('zitec_dpd_ships'), 'manifest');
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+ $installer->endSetup();
app/code/community/Zitec/Dpd/sql/zitec_dpd_setup/mysql4-upgrade-1.0.0-1.0.1.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+
25
+ /* @var $installer Mage_Core_Model_Resource_Setup */
26
+ $installer = $this;
27
+
28
+ $installer->startSetup();
29
+
30
+ try {
31
+ $installer->getConnection()->addColumn($installer->getTable('sales/shipment'), 'shipping_label', 'LONGBLOB');
32
+ }catch (Exception $e){
33
+ Mage::logException($e);
34
+ }
35
+
36
+ try {
37
+ $installer->getConnection()->addColumn($installer->getTable('sales/shipment_track'), 'track_number', 'TEXT');
38
+ }catch (Exception $e){
39
+ Mage::logException($e);
40
+ }
41
+
42
+
43
+
44
+ $installer->endSetup();
app/code/community/Zitec/Dpd/sql/zitec_dpd_setup/mysql4-upgrade-1.0.1-1.0.2.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+
25
+ /* @var $installer Mage_Core_Model_Resource_Setup */
26
+ $installer = $this;
27
+
28
+ $installer->startSetup();
29
+
30
+ try {
31
+ Mage::helper('zitec_dpd/postcode_search')->getSearchPostcodeModel()->installPostcodeDatabase();
32
+ }catch (Exception $e){
33
+ Mage::logException($e);
34
+ }
35
+
36
+
37
+ $installer->endSetup();
app/code/community/Zitec/Dpd/sql/zitec_dpd_setup/mysql4-upgrade-1.0.2-1.0.3.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+
25
+ /* @var $installer Mage_Core_Model_Resource_Setup */
26
+ $installer = $this;
27
+
28
+ $installer->startSetup();
29
+
30
+ $salesSetup = new Mage_Sales_Model_Mysql4_Setup('sales_setup');
31
+
32
+ $salesSetup->addAttribute('quote_address', 'valid_auto_postcode', array('type' => 'smallint'));
33
+ $salesSetup->addAttribute('order_address', 'valid_auto_postcode', array('type' => 'smallint'));
34
+ $salesSetup->addAttribute('quote_address', 'auto_postcode', array('type' => 'varchar','length'=>10));
35
+ $salesSetup->addAttribute('order_address', 'auto_postcode', array('type' => 'varchar','length'=>10));
36
+
37
+
38
+ $installer->endSetup();
app/code/community/Zitec/PackedShipment/Block/Addressvalidationdialog.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_PackedShipment_Block_Addressvalidationdialog extends Mage_Adminhtml_Block_Template
25
+ {
26
+ /*
27
+ * @see setOrder
28
+ */
29
+ protected $_order;
30
+
31
+ protected $_postcode;
32
+ protected $_city;
33
+ protected $_countryId;
34
+
35
+ /*
36
+ * Se establece el pedido para el bloque
37
+ * @param Mage_Sales_Model_Order $order
38
+ */
39
+ public function setOrder(Mage_Sales_Model_Order $order)
40
+ {
41
+ $this->_order = $order;
42
+
43
+ return $this;
44
+ }
45
+
46
+ public function getOrder()
47
+ {
48
+ return $this->_order;
49
+ }
50
+
51
+ /*
52
+ * @param string $postcode
53
+ */
54
+ public function setPostcode($postcode)
55
+ {
56
+ $this->_postcode = $postcode;
57
+
58
+ return $this;
59
+ }
60
+
61
+ public function getPostcode()
62
+ {
63
+ return $this->_postcode;
64
+ }
65
+
66
+ /*
67
+ * @param string $city
68
+ */
69
+ public function setCity($city)
70
+ {
71
+ $this->_city = $city;
72
+
73
+ return $this;
74
+ }
75
+
76
+ public function getCity()
77
+ {
78
+ return $this->_city;
79
+ }
80
+
81
+ /**
82
+ *
83
+ * @param string $countryId
84
+ *
85
+ * @return \Zitec_PackedShipment_Block_Addressvalidationdialog
86
+ */
87
+ public function setCountryId($countryId)
88
+ {
89
+ $this->_countryId = $countryId;
90
+
91
+ return $this;
92
+ }
93
+
94
+ /**
95
+ *
96
+ * @return string
97
+ */
98
+ public function getCountryId()
99
+ {
100
+ return $this->_countryId;
101
+ }
102
+
103
+
104
+ }
105
+
app/code/community/Zitec/PackedShipment/Block/Addressvalidationinfojs.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_PackedShipment_Block_Addressvalidationinfojs extends Mage_Core_Block_Template
25
+ {
26
+ /*
27
+ * @see _getOrder()
28
+ */
29
+ protected $_order;
30
+
31
+ /*
32
+ * The current order is returned.
33
+ * @return Mage_Sales_Model_Order
34
+ */
35
+ protected function _getOrder()
36
+ {
37
+ // Since this block is shown on page 'new shipment'
38
+ // know which is the id of the current order in the querystring parameter
39
+ // order_id.
40
+ if (!$this->_order) {
41
+ $this->_order = Mage::getModel('sales/order');
42
+ $orderId = $this->getRequest()->getParam('order_id');
43
+ if ($orderId) {
44
+ $this->_order->load($orderId);
45
+ }
46
+ }
47
+
48
+ return $this->_order;
49
+ }
50
+
51
+
52
+ /*
53
+ * 'True' is returned if the current order allows carrier validation
54
+ * direcciones.
55
+ * @param string $countryId
56
+ * @return bool
57
+ */
58
+ public function isAddressValidationAvailable()
59
+ {
60
+ if ($this->_getOrder()->getId()) {
61
+ $carrier = $this->_getOrder()->getShippingCarrier();
62
+
63
+ return $this->helper('zitec_packedshipment')->carrierSupportsAddressValidation($carrier, $this->getShippingAddressCountryId());
64
+ }
65
+
66
+ return false;
67
+ }
68
+
69
+ /*
70
+ * The city of the delivery address for the current order is returned.
71
+ * @return string
72
+ */
73
+ public function getShippingAddressCity()
74
+ {
75
+ if ($this->_getOrder()->getId()) {
76
+ return $this->_getOrder()->getShippingAddress()->getCity();
77
+ }
78
+
79
+ return '';
80
+ }
81
+
82
+ /*
83
+ * Postal code of the shipping address for the current order is returned.
84
+ * @return string
85
+ */
86
+ public function getShippingAddressPostcode()
87
+ {
88
+ if ($this->_getOrder()->getId()) {
89
+ return $this->_getOrder()->getShippingAddress()->getPostcode();
90
+ }
91
+
92
+ return '';
93
+ }
94
+
95
+ /**
96
+ * The country code of the delivery address for the current order is returned.
97
+ *
98
+ * @return string
99
+ */
100
+ public function getShippingAddressCountryId()
101
+ {
102
+ if ($this->_getOrder()->getId()) {
103
+ return $this->_getOrder()->getShippingAddress()->getCountryId();
104
+ }
105
+
106
+ return '';
107
+ }
108
+
109
+ /*
110
+ * current order id is returned.
111
+ * @return int
112
+ */
113
+ public function getOrderId()
114
+ {
115
+ $orderId = $this->_getOrder()->getId();
116
+
117
+ return $orderId ? $orderId : 0;
118
+ }
119
+
120
+ /*
121
+ * @return string
122
+ */
123
+ public function getAddressValidationDialogHtmlActionUrl()
124
+ {
125
+ return $this->helper("adminhtml")->getUrl('zitec_packedshipment/adminhtml_index/addressvalidationdialoghtml');
126
+ }
127
+
128
+
129
+ }
130
+
app/code/community/Zitec/PackedShipment/Helper/Data.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_PackedShipment_Helper_Data extends Mage_Core_Helper_Abstract
25
+ {
26
+ /*
27
+ * The total weight of a shipment is returned.
28
+ *
29
+ * @param Mage_Sales_Model_Order_Shipment $shipment
30
+ * @return float
31
+ */
32
+ public function getShipmentWeight(Mage_Sales_Model_Order_Shipment $shipment)
33
+ {
34
+ $shipmentWeight = 0;
35
+ foreach ($shipment->getAllItems() as $item) {
36
+ $shipmentWeight += $item->getWeight() * $item->getQty();
37
+ }
38
+
39
+ return $shipmentWeight;
40
+ }
41
+
42
+
43
+ /**
44
+ * True is returned if we transport the shipment in a single package.
45
+ *
46
+ * @param Mage_Sales_Model_Order_Shipment $shipment
47
+ *
48
+ * @return boolean
49
+ */
50
+ public function mustShipInOneParcel(Mage_Sales_Model_Order_Shipment $shipment)
51
+ {
52
+ $carrier = $shipment->getOrder()->getShippingCarrier();
53
+ if ($carrier instanceof Zitec_PackedShipment_Model_Carrier_Interface) {
54
+ $shippingMethod = $shipment->getOrder()->getShippingMethod();
55
+
56
+ return $carrier->shippingMethodRequiresShipmentsOfOnlyOneParcel($shippingMethod);
57
+ }
58
+
59
+ return true;
60
+ }
61
+
62
+ /**
63
+ * True is returned if the carrier can calculate shipping costs.
64
+ *
65
+ * @param Mage_Shipping_Model_Carrier_Abstract $carrier
66
+ *
67
+ * @return boolean
68
+ */
69
+ public function carrierSupportsCalculationOfShippingCosts(Mage_Shipping_Model_Carrier_Abstract $carrier = null)
70
+ {
71
+ if ($carrier instanceof Zitec_PackedShipment_Model_Carrier_Interface) {
72
+ return $carrier->supportsCalculationOfShippingCosts();
73
+ }
74
+
75
+ return false;
76
+ }
77
+
78
+ /**
79
+ * True is returned if the carrier address validation support (postcode, town)
80
+ *
81
+ * @param Mage_Shipping_Model_Carrier_Abstract $carrier
82
+ * @param string $countryId
83
+ *
84
+ * @return boolean
85
+ */
86
+ public function carrierSupportsAddressValidation(Mage_Shipping_Model_Carrier_Abstract $carrier = null, $countryId = 'ES')
87
+ {
88
+ if ($carrier instanceof Zitec_PackedShipment_Model_Carrier_Interface) {
89
+ return $carrier->supportsAddressValidation($countryId);
90
+ }
91
+
92
+ return false;
93
+ }
94
+
95
+ /**
96
+ * We replace the template package if the carrier supports it.
97
+ *
98
+ * @return string
99
+ */
100
+ public function changeOrderItemsTemplate()
101
+ {
102
+ $shipment = Mage::registry('current_shipment');
103
+ /* @var $shipment Mage_Sales_Model_Order_Shipment */
104
+ if ($shipment && ($this->carrierSupportsPackedShipment($shipment->getOrder()->getShippingCarrier()))) {
105
+ return 'zitec_packedshipment/sales/order/shipment/create/items.phtml';
106
+ } else {
107
+ return Mage::app()->getLayout()->getBlock('order_items')->getTemplate();
108
+ }
109
+ }
110
+
111
+ /**
112
+ *
113
+ * @param Mage_Shipping_Model_Carrier_Abstract $carrier
114
+ *
115
+ * @return boolean
116
+ */
117
+ public function carrierSupportsPackedShipment(Mage_Shipping_Model_Carrier_Abstract $carrier = null)
118
+ {
119
+ return $carrier instanceof Zitec_PackedShipment_Model_Carrier_Interface;
120
+ }
121
+
122
+
123
+ public function changeAddressValidationJsTemplate()
124
+ {
125
+ $shipment = Mage::registry('current_shipment');
126
+ /* @var $shipment Mage_Sales_Model_Order_Shipment */
127
+ if ($shipment && ($this->carrierSupportsPackedShipment($shipment->getOrder()->getShippingCarrier()))) {
128
+ return 'zitec_packedshipment/sales/order/shipment/create/address_validation_info_js.phtml';
129
+ } else {
130
+ return '';
131
+ }
132
+ }
133
+
134
+ /**
135
+ * @return boolean
136
+ */
137
+ public function useDescriptionsInsteadOfReferences()
138
+ {
139
+ $useDescriptionsInsteadOfReferences = Mage::getStoreConfig("zitec_packedshipment/useDescriptionsInsteadOfReferences");
140
+
141
+ return $useDescriptionsInsteadOfReferences ? true : false;
142
+ }
143
+ }
app/code/community/Zitec/PackedShipment/Model/Carrier/Interface.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * Interface to follow any shipping carrier that supports packed Shipments .
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ interface Zitec_PackedShipment_Model_Carrier_Interface
25
+ {
26
+
27
+
28
+ /**
29
+ * If the carrier soporate address validation returns true else
30
+ * postcodes in the specified country.
31
+ *
32
+ * @param string $countryId
33
+ *
34
+ * @return bool
35
+ */
36
+ function supportsAddressValidation($countryId);
37
+
38
+ /*
39
+ * True is returned if the combination of city and zip code is valid.
40
+ * @param string $city
41
+ * @param string $postcode
42
+ * @param string &$errorMsg - In the case of an error
43
+ * @return bool
44
+ */
45
+ public function isValidCityPostcode($city, $postcode, &$errorMsg);
46
+
47
+ /*
48
+ * The list of zip codes that are valid is returned to
49
+ * la población proporcionada.
50
+ * @param string $city
51
+ * @param string &$errorMsg - In the case of an error
52
+ * @return array (of string)
53
+ */
54
+ public function getPostcodesForCity($city, &$errorMsg);
55
+
56
+ /*
57
+ * The list of cities that are valid is returned to
58
+ * the zip code provided.
59
+ * @param string $postcode
60
+ * @param string &$errorMsg - In the case of an error *
61
+ * @return array (of string)
62
+ */
63
+ public function getCitiesForPostcode($postcode, &$errorMsg);
64
+
65
+
66
+ /*
67
+ * True is returned if the carrier can provide information on the shipping costs
68
+ *
69
+ * @return bool
70
+ */
71
+ function supportsCalculationOfShippingCosts();
72
+
73
+ /*
74
+ * The cost of shipping is obtained.
75
+ * We order the city and the zip code of the recipient
76
+ * (if different than ordering) and the list of the weights of the packages we send.
77
+ * @param Mage_Sales_Model_Order $order
78
+ * @param string $city
79
+ * @param string $postcode
80
+ * @param array $weightsPackages
81
+ * @param string &$errorStr -- error message returned.
82
+ * @return double -- cost of shipping
83
+ */
84
+ function getShippingCost(
85
+ Mage_Sales_Model_Order $order,
86
+ $city,
87
+ $postcode,
88
+ $weightsPackages,
89
+ &$errorStr);
90
+
91
+ /**
92
+ * @param string $shippingMethod
93
+ *
94
+ * @return int
95
+ */
96
+ function shippingMethodRequiresShipmentsOfOnlyOneParcel($shippingMethod);
97
+ }
app/code/community/Zitec/PackedShipment/Model/Package.php ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_PackedShipment_Model_Package extends Mage_Core_Model_Abstract
25
+ {
26
+ /**
27
+ * @var Mage_Sales_Model_Order_Shipment
28
+ */
29
+ protected $_shipment;
30
+
31
+ /**
32
+ * Ids of the items packed in this parcel
33
+ *
34
+ * @var array
35
+ */
36
+ protected $_packedItemsIds;
37
+
38
+ /**
39
+ * Array with items packaged in this parcel
40
+ *
41
+ * @var array
42
+ */
43
+ protected $_packedItems;
44
+
45
+ /*
46
+ * Array with the quantities of each item in the package array (id1 => qty1 ...)
47
+ */
48
+ protected $_packedItemsQtys;
49
+
50
+ /**
51
+ * reference used to generate the labels
52
+ *
53
+ * @var string
54
+ */
55
+ protected $_ref;
56
+
57
+ /**
58
+ * (sum of items that compose)
59
+ *
60
+ * @var float
61
+ */
62
+ protected $_weight;
63
+
64
+ /**
65
+ * Total number of items that are in this package
66
+ *
67
+ * @var unknown_type
68
+ */
69
+ protected $_totalItemsQty;
70
+
71
+ /**
72
+ * Total price of the package (sum of the prices of the items that comprise it)
73
+ *
74
+ * @var float
75
+ */
76
+ protected $_price;
77
+
78
+
79
+ /**
80
+ * We built a parcel, forcing get 2 mandatory parameters
81
+ *
82
+ * @param array $ids array with the ids of items that are packed in this parcel
83
+ * @param Mage_Sales_Model_Order_Shipment $shipment
84
+ * @param String $ref
85
+ *
86
+ * @throws Exception
87
+ */
88
+ public function __construct(Mage_Sales_Model_Order_Shipment $shipment, array $ids, $ref = null)
89
+ {
90
+
91
+ if (empty($ids))
92
+ throw new Exception("__CLASS__ : One package has to have at least one item. Passed an array of empty itemsIds");
93
+
94
+ $this
95
+ ->setShipment($shipment)
96
+ ->setPackedItemsIds($ids)
97
+ ->setRef($ref);
98
+ }
99
+
100
+ /**
101
+ * We set the ids of the items that are part of this package
102
+ *
103
+ * @param unknown_type $ids
104
+ */
105
+ public function setPackedItemsIds(array $ids)
106
+ {
107
+ $this->_packedItemsIds = $ids;
108
+
109
+ return $this;
110
+ }
111
+
112
+
113
+ /**
114
+ * Adds a collection of items in this bundle
115
+ *
116
+ * @param unknown_type $items
117
+ */
118
+ public function setShipment(Mage_Sales_Model_Order_Shipment $shipment)
119
+ {
120
+ $this->_shipment = $shipment;
121
+
122
+ return $this;
123
+ }
124
+
125
+
126
+ /**
127
+ * @param null $ref
128
+ *
129
+ * @return $this
130
+ */
131
+ public function setRef($ref = null)
132
+ {
133
+ $this->_ref = ($ref) ? $ref : $this->_autocalculateRef();
134
+
135
+ return $this;
136
+ }
137
+
138
+ /**
139
+ * calculate the reference ref using the sku of products in the package
140
+ * @return string
141
+ */
142
+ protected function _autocalculateRef()
143
+ {
144
+ $items = $this->getPackedItems();
145
+ $qtys = $this->_getPackedItemsQtys();
146
+ $skus = array();
147
+ foreach ($items as $itemId => $item) {
148
+ $tmp = $item->getSku();
149
+ if ($qtys[$itemId] > 1)
150
+ $tmp .= '(' . $qtys[$itemId] . ' uds.)';
151
+
152
+ $skus[] = $tmp;
153
+ }
154
+
155
+ return implode(', ', $skus);
156
+ }
157
+
158
+
159
+ /**
160
+ *
161
+ * Returns an array of the items in this bundle
162
+ */
163
+ public function getPackedItems()
164
+ {
165
+ if (!empty($this->_packedItems))
166
+ return $this->_packedItems;
167
+
168
+ $this->_packedItems = array();
169
+ foreach ($this->_packedItemsIds as $id) {
170
+ $this->_packedItems[$id] = $this->getItemByProductId($id);
171
+ }
172
+
173
+ return $this->_packedItems;
174
+ }
175
+
176
+ /*
177
+ * Returns an array of the like array (<item id> => <qty> ...)
178
+ * for all products in the package
179
+ */
180
+ protected function _getPackedItemsQtys()
181
+ {
182
+ if (!empty($this->_packedItemsQtys))
183
+ return $this->_packedItemsQtys;
184
+
185
+ $this->_packedItemsQtys = array();
186
+ foreach ($this->_packedItemsIds as $id) {
187
+ if (!array_key_exists($id, $this->_packedItemsQtys)) {
188
+ $this->_packedItemsQtys[$id] = 1;
189
+ } else {
190
+ $this->_packedItemsQtys[$id]++;
191
+ }
192
+ }
193
+
194
+ return $this->_packedItemsQtys;
195
+ }
196
+
197
+ /**
198
+ * Returns array with the ids item of this package
199
+ */
200
+ public function getPackedItemsIds()
201
+ {
202
+ return $this->_packedItemsIds;
203
+ }
204
+
205
+
206
+ public function getItemByProductId($productId)
207
+ {
208
+ foreach ($this->_shipment->getItemsCollection() as $item) {
209
+ if ($item->getProductId() == $productId) {
210
+ return $item;
211
+ }
212
+ }
213
+
214
+ return false;
215
+ }
216
+
217
+ /**
218
+ * Returns the weight of the package. The first time is calculated by summing weights of items
219
+ */
220
+ public function getPackageWeight()
221
+ {
222
+ if (!empty($this->_weight))
223
+ return $this->_weight;
224
+
225
+ $this->_weight = (float)0;
226
+ $qtys = $this->_getPackedItemsQtys();
227
+ foreach ($this->getPackedItems() as $itemId => $item) {
228
+ $this->_weight += ($item->getWeight() * $qtys[$itemId]);
229
+ }
230
+
231
+ return $this->_weight;
232
+ }
233
+
234
+ /**
235
+ * @return float
236
+ */
237
+ public function getPackagePrice()
238
+ {
239
+ if (!empty($this->_price))
240
+ return $this->_price;
241
+
242
+ $this->_price = (float)0;
243
+ $qtys = $this->_getPackedItemsQtys();
244
+ foreach ($this->getPackedItems() as $itemId => $item) {
245
+ $this->_price += ($item->getPrice() * $qtys[$itemId]);
246
+ }
247
+
248
+ return $this->_price;
249
+ }
250
+
251
+ /**
252
+ * @return int|unknown_type
253
+ */
254
+ public function getTotalItemsQty()
255
+ {
256
+ if (!empty($this->_totalItemsQty))
257
+ return $this->_totalItemsQty;
258
+ $qtys = $this->_getPackedItemsQtys();
259
+ $this->_totalItemsQty = 0;
260
+ foreach ($qtys as $qty) {
261
+ $this->_totalItemsQty += $qty;
262
+ }
263
+
264
+ return $this->_totalItemsQty;
265
+ }
266
+
267
+ public function getRef()
268
+ {
269
+ return $this->_ref;
270
+ }
271
+
272
+ }
app/code/community/Zitec/PackedShipment/Model/PackedShipment.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_PackedShipment_Model_PackedShipment
25
+ {
26
+ protected $_packages = array();
27
+
28
+ public function __construct(Mage_Sales_Model_Order_Shipment $shipment, $packages)
29
+ {
30
+ if (!is_array($packages)) {
31
+ return;
32
+ }
33
+
34
+ foreach ($packages as $packageData) {
35
+ //to avoid errors check that each package has products
36
+ if (!empty($packageData['ids'])) {
37
+ $package = new Zitec_PackedShipment_Model_Package($shipment, $packageData['ids'], $packageData['ref']);
38
+ $this->_packages[] = $package;
39
+ }
40
+ };
41
+ }
42
+
43
+ /**
44
+ *
45
+ * @return array
46
+ */
47
+ public function getPackages()
48
+ {
49
+ return $this->_packages;
50
+ }
51
+ }
app/code/community/Zitec/PackedShipment/controllers/Adminhtml/IndexController.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * Ajax calls dialog packed shipment are handled.
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_PackedShipment_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action
25
+ {
26
+ /*
27
+ * A block is loaded for dialogue address validation
28
+ * or nothing, if the address is sent as valid or if there is nothing to do.
29
+ */
30
+ public function addressvalidationdialoghtmlAction()
31
+ {
32
+
33
+ $orderId = $this->getRequest()->getParam('order');
34
+ $order = Mage::getModel('sales/order');
35
+ if ($orderId) {
36
+ $order->load($orderId);
37
+ }
38
+
39
+ $city = $this->getRequest()->getParam('city');
40
+ $city = $city ? $city : '';
41
+ $postcode = $this->getRequest()->getParam('postcode');
42
+ $postcode = $postcode ? $postcode : '';
43
+ $countryId = $this->getRequest()->getParam('countryid');
44
+ $countryId = $countryId ? $countryId : '';
45
+ $dontCorrectAddress = $this->getRequest()->getParam('dontcorrectaddress');
46
+
47
+
48
+ if (!$dontCorrectAddress) {
49
+ $layout = Mage::getSingleton('core/layout');
50
+ $layout->createBlock('zitec_packedshipment/addressvalidationdialog', 'root')
51
+ ->setTemplate('zitec_packedshipment/sales/order/shipment/create/address_validation_dialog.phtml')
52
+ ->setOrder($order)
53
+ ->setCity($city)
54
+ ->setPostcode($postcode)
55
+ ->setCountryId($countryId);
56
+ $dialogHtml = $layout->addOutputBlock('root')
57
+ ->setDirectOutput(false)
58
+ ->getOutput();
59
+ $data['dialogHtml'] = trim($dialogHtml);
60
+ } else // User has indicated that it wants to make more changes to the address.
61
+ {
62
+ $data['dialogHtml'] = '';
63
+ }
64
+ $this->getResponse()->setHeader('Content-Type', 'application/json', true)->setBody(Mage::helper('core')->jsonEncode($data));
65
+ }
66
+
67
+ /*
68
+ * The cost of transportation of packages shipping is returned.
69
+ * this function receives the package weight, parcels, zip code of the desitnation
70
+
71
+ * @return float
72
+ */
73
+ public function getshippingcostAction()
74
+ {
75
+ $orderId = $this->getRequest()->getParam('order');
76
+ $order = Mage::getModel('sales/order')->load($orderId);
77
+ $carrier = $order->getShippingCarrier();
78
+ if (!Mage::helper('zitec_packedshipment')->carrierSupportsCalculationOfShippingCosts($carrier)) {
79
+ $data = array();
80
+ $data['error'] = Mage::helper('zitec_packedshipment')->__('An attempt to calculate the shipping cost, but the carrier does not support this operation.');
81
+ $this->getResponse()->setHeader('Content-Type', 'application/json', true)->setBody(Mage::helper('core')->jsonEncode($data));
82
+
83
+ }
84
+
85
+ $weightsParcels = $this->getRequest()->getParam('weightsParcels');
86
+
87
+ $shippingAddress = $order->getShippingAddress();
88
+
89
+ $city = $this->getRequest()->getParam('city');
90
+ $city = $city ? $city : $shippingAddress->getCity();
91
+ $postcode = $this->getRequest()->getParam('postcode');
92
+ $postcode = $postcode ? $postcode : $shippingAddress->getPostcode();
93
+
94
+ $errorStr = '';
95
+ $shippingCost = $carrier->getShippingCost(
96
+ $order,
97
+ $city,
98
+ $postcode,
99
+ $weightsParcels,
100
+ $errorStr);
101
+
102
+ $data = array();
103
+ $data['shippingcost'] = Mage::helper('core')->currency($shippingCost, true, false);
104
+
105
+ // Shipping cost is returned to store for reports
106
+ // Shipping module Reports.
107
+ $data['shippingreportsshippingcost'] = $shippingCost;
108
+
109
+ $profit = $order->getBaseShippingAmount() - $shippingCost;
110
+ $data['profit'] = Mage::helper('core')->currency($profit, true, false);
111
+
112
+ $data['profitcolor'] = $profit >= 0 ? 'Black' : 'Red';
113
+
114
+ $data['error'] = $errorStr;
115
+
116
+ $this->getResponse()->setHeader('Content-Type', 'application/json', true)->setBody(Mage::helper('core')->jsonEncode($data));
117
+ }
118
+ }
119
+
app/code/community/Zitec/PackedShipment/etc/config.xml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Zitec_PackedShipment>
5
+ <version>1.0.0</version>
6
+ </Zitec_PackedShipment>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <zitec_packedshipment>
11
+ <class>Zitec_PackedShipment_Model</class>
12
+ </zitec_packedshipment>
13
+ </models>
14
+ <blocks>
15
+ <zitec_packedshipment>
16
+ <class>Zitec_PackedShipment_Block</class>
17
+ </zitec_packedshipment>
18
+ </blocks>
19
+ <helpers>
20
+ <zitec_packedshipment>
21
+ <class>Zitec_PackedShipment_Helper</class>
22
+ </zitec_packedshipment>
23
+ </helpers>
24
+ </global>
25
+ <adminhtml>
26
+ <translate>
27
+ <modules>
28
+ <Zitec_PackedShipment>
29
+ <files>
30
+ <default>Zitec_PackedShipment.csv</default>
31
+ </files>
32
+ </Zitec_PackedShipment>
33
+ </modules>
34
+ </translate>
35
+ <layout>
36
+ <updates>
37
+ <zitec_packedshipment>
38
+ <file>zitec_packedshipment.xml</file>
39
+ </zitec_packedshipment>
40
+ </updates>
41
+ </layout>
42
+ </adminhtml>
43
+
44
+ <admin>
45
+ <routers>
46
+ <zitec_packedshipment>
47
+ <use>admin</use>
48
+ <args>
49
+ <module>Zitec_PackedShipment</module>
50
+ <frontName>zitec_packedshipment</frontName>
51
+ </args>
52
+ </zitec_packedshipment>
53
+ </routers>
54
+ </admin>
55
+
56
+ <default>
57
+ <zitec_packedshipment>
58
+ <useDescriptionsInsteadOfReferences>1</useDescriptionsInsteadOfReferences>
59
+ </zitec_packedshipment>
60
+ </default>
61
+ </config>
app/code/community/Zitec/PrintShippingLabel/Block/Adminhtml/Sales/Order/Shipment/View.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_PrintShippingLabel_Block_Adminhtml_Sales_Order_Shipment_View extends Mage_Adminhtml_Block_Sales_Order_Shipment_View
25
+ {
26
+
27
+ public function __construct()
28
+ {
29
+ parent::__construct();
30
+ if ($this->_hasPdfShippingLabel()) {
31
+ $this->_addButton('zitec_print_shipping_label', array(
32
+ 'label' => $this->_getHelper()->__('Print Shipping Labels'),
33
+ 'onclick' => "setLocation('{$this->_getPrintShippingLabelsUrl()}')"
34
+ ));
35
+ }
36
+ }
37
+
38
+ /**
39
+ * @return bool
40
+ */
41
+ protected function _hasPdfShippingLabel()
42
+ {
43
+ return $this->getShipment()->getShippingLabel() ? true : false;
44
+ }
45
+
46
+ /**
47
+ *
48
+ * @return string
49
+ */
50
+ protected function _getPrintShippingLabelsUrl()
51
+ {
52
+ return Mage::helper('adminhtml')->getUrl('zitec_printshippinglabel/adminhtml_index/printshippinglabels', array('shipment_id' => $this->getShipment()->getId()));
53
+ }
54
+
55
+ /**
56
+ *
57
+ * @return Zitec_PrintShippingLabel_Helper_Data
58
+ */
59
+ protected function _getHelper()
60
+ {
61
+ return Mage::helper('zitec_printshippinglabel');
62
+ }
63
+
64
+ }
app/code/community/Zitec/PrintShippingLabel/Block/Adminhtml/Sales/View.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_PrintShippingLabel_Block_Adminhtml_Sales_View extends Mage_Adminhtml_Block_Sales_Order_View
25
+ {
26
+
27
+ public function __construct()
28
+ {
29
+ parent::__construct();
30
+ if ($this->_hasPdfShippingLabels()) {
31
+ $this->_addButton('zitec_print_shipping_label', array(
32
+ 'label' => $this->_getHelper()->__('Print Shipping Labels'),
33
+ 'onclick' => "setLocation('{$this->_getPrintShippingLabelsUrl()}')"
34
+ ));
35
+ }
36
+ }
37
+
38
+ /**
39
+ *
40
+ * @return boolean
41
+ */
42
+ protected function _hasPdfShippingLabels()
43
+ {
44
+ $shipments = $this->getOrder()->getShipmentsCollection();
45
+ /* @var $shipments Mage_Sales_Model_Resource_Order_Shipment_Collection */
46
+ $shipments->addFieldToFilter('shipping_label', array("notnull" => true));
47
+
48
+ return $shipments->getSize() > 0;
49
+ }
50
+
51
+ /**
52
+ *
53
+ * @return string
54
+ */
55
+ protected function _getPrintShippingLabelsUrl()
56
+ {
57
+ return Mage::helper('adminhtml')->getUrl('zitec_printshippinglabel/adminhtml_index/printshippinglabels', array('order_id' => $this->getOrder()->getId()));
58
+ }
59
+
60
+ /**
61
+ *
62
+ * @return Zitec_PrintShippingLabel_Helper_Data
63
+ */
64
+ protected function _getHelper()
65
+ {
66
+ return Mage::helper('zitec_printshippinglabel');
67
+ }
68
+
69
+ }
app/code/community/Zitec/PrintShippingLabel/Helper/Data.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_PrintShippingLabel_Helper_Data extends Mage_Core_Helper_Abstract
25
+ {
26
+
27
+
28
+ }
29
+
app/code/community/Zitec/PrintShippingLabel/controllers/Adminhtml/IndexController.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_PrintShippingLabel_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action
25
+ {
26
+
27
+
28
+ public function printshippinglabelsAction()
29
+ {
30
+ if (Mage::helper('zitec_dpd/compatibility')->checkMassPrintShippingLabelExists()) {
31
+ $module = (string)Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName');
32
+ $controller = 'sales_order_shipment';
33
+ $action = 'massPrintShippingLabel';
34
+ } else {
35
+ $module = 'zitec_printshippinglabel';
36
+ $controller = 'adminhtml_index';
37
+ $action = 'massPrintShippingLabel';
38
+ }
39
+
40
+ $orderId = $this->getRequest()->getParam('order_id');
41
+ if ($orderId) {
42
+ $this->getRequest()->setPost('order_ids', array($orderId));
43
+ $this->getRequest()->setParam('massaction_prepare_key', 'order_ids');
44
+ $this->_forward($action, $controller, $module);
45
+
46
+ return;
47
+ }
48
+
49
+ $shipmentId = $this->getRequest()->getParam('shipment_id');
50
+ if ($shipmentId) {
51
+ $this->getRequest()->setPost('shipment_ids', array($shipmentId));
52
+ $this->getRequest()->setParam('massaction_prepare_key', 'shipment_ids');
53
+ $this->_forward($action, $controller, $module);
54
+
55
+ return;
56
+ }
57
+ $this->_redirect('adminhtml/sales_order/index');
58
+ }
59
+
60
+
61
+ /**
62
+ * Batch print shipping labels for whole shipments.
63
+ * Push pdf document with shipping labels to user browser
64
+ *
65
+ * @return null
66
+ */
67
+ public function massPrintShippingLabelAction()
68
+ {
69
+ $request = $this->getRequest();
70
+ $ids = $request->getParam('order_ids');
71
+ $createdFromOrders = !empty($ids);
72
+ $shipments = null;
73
+ $labelsContent = array();
74
+ switch ($request->getParam('massaction_prepare_key')) {
75
+ case 'shipment_ids':
76
+ $ids = $request->getParam('shipment_ids');
77
+ array_filter($ids, 'intval');
78
+ if (!empty($ids)) {
79
+ $shipments = Mage::getResourceModel('sales/order_shipment_collection')
80
+ ->addFieldToFilter('entity_id', array('in' => $ids));
81
+ }
82
+ break;
83
+ case 'order_ids':
84
+ $ids = $request->getParam('order_ids');
85
+ array_filter($ids, 'intval');
86
+ if (!empty($ids)) {
87
+ $shipments = Mage::getResourceModel('sales/order_shipment_collection')
88
+ ->setOrderFilter(array('in' => $ids));
89
+ }
90
+ break;
91
+ }
92
+
93
+ if ($shipments && $shipments->getSize()) {
94
+ foreach ($shipments as $shipment) {
95
+ $labelContent = $shipment->getShippingLabel();
96
+ if ($labelContent) {
97
+ $labelsContent[] = $labelContent;
98
+ }
99
+ }
100
+ }
101
+
102
+ if (!empty($labelsContent)) {
103
+ $outputPdf = $this->_combineLabelsPdf($labelsContent);
104
+ $this->_prepareDownloadResponse('ShippingLabels.pdf', $outputPdf->render(), 'application/pdf');
105
+ return;
106
+ }
107
+
108
+ if ($createdFromOrders) {
109
+ $this->_getSession()
110
+ ->addError(Mage::helper('sales')->__('There are no shipping labels related to selected orders.'));
111
+ $this->_redirect('*/sales_order/index');
112
+ } else {
113
+ $this->_getSession()
114
+ ->addError(Mage::helper('sales')->__('There are no shipping labels related to selected shipments.'));
115
+ $this->_redirect('*/sales_order_shipment/index');
116
+ }
117
+ }
118
+
119
+
120
+ /**
121
+ * Combine array of labels as instance PDF
122
+ *
123
+ * @param array $labelsContent
124
+ * @return Zend_Pdf
125
+ */
126
+ protected function _combineLabelsPdf(array $labelsContent)
127
+ {
128
+ $outputPdf = new Zend_Pdf();
129
+ foreach ($labelsContent as $content) {
130
+ if (stripos($content, '%PDF-') !== false) {
131
+ $pdfLabel = Zend_Pdf::parse($content);
132
+ foreach ($pdfLabel->pages as $page) {
133
+ $outputPdf->pages[] = clone $page;
134
+ }
135
+ } else {
136
+ $page = $this->_createPdfPageFromImageString($content);
137
+ if ($page) {
138
+ $outputPdf->pages[] = $page;
139
+ }
140
+ }
141
+ }
142
+ return $outputPdf;
143
+ }
144
+
145
+
146
+
147
+ }
148
+
app/code/community/Zitec/PrintShippingLabel/etc/config.xml ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Zitec_PrintShippingLabel>
5
+ <version>1.0.0</version>
6
+ </Zitec_PrintShippingLabel>
7
+ </modules>
8
+ <global>
9
+ <helpers>
10
+ <zitec_printshippinglabel>
11
+ <class>Zitec_PrintShippingLabel_Helper</class>
12
+ </zitec_printshippinglabel>
13
+ </helpers>
14
+ <models>
15
+ <zitec_printshippinglabel>
16
+ <class>Zitec_PrintShippingLabel_Model</class>
17
+ </zitec_printshippinglabel>
18
+ </models>
19
+ <blocks>
20
+ <zitec_printshippinglabel>
21
+ <class>Zitec_PrintShippingLabel_Block</class>
22
+ </zitec_printshippinglabel>
23
+ <adminhtml>
24
+ <rewrite>
25
+ <sales_order_view>Zitec_PrintShippingLabel_Block_Adminhtml_Sales_View</sales_order_view>
26
+ <sales_order_shipment_view>Zitec_PrintShippingLabel_Block_Adminhtml_Sales_Order_Shipment_View</sales_order_shipment_view>
27
+ </rewrite>
28
+ </adminhtml>
29
+ </blocks>
30
+
31
+ </global>
32
+ <frontend>
33
+ <translate>
34
+ <modules>
35
+ <Zitec_PrintShippingLabel>
36
+ <files>
37
+ <default>Zitec_PrintShippingLabel_frontend.csv</default>
38
+ </files>
39
+ </Zitec_PrintShippingLabel>
40
+ </modules>
41
+ </translate>
42
+ <layout>
43
+ <updates>
44
+ <zitec_printshippinglabel>
45
+ <file>zitec_printshippinglabel.xml</file>
46
+ </zitec_printshippinglabel>
47
+ </updates>
48
+ </layout>
49
+ </frontend>
50
+
51
+
52
+ <adminhtml>
53
+ <layout>
54
+ <updates>
55
+ <zitec_printshippinglabel>
56
+ <file>zitec_printshippinglabel.xml</file>
57
+ </zitec_printshippinglabel>
58
+ </updates>
59
+ </layout>
60
+ <translate>
61
+ <modules>
62
+ <zitec_printshippinglabel>
63
+ <files>
64
+ <default>Zitec_PrintShippingLabel.csv</default>
65
+ </files>
66
+ </zitec_printshippinglabel>
67
+ </modules>
68
+ </translate>
69
+ </adminhtml>
70
+ <admin>
71
+ <routers>
72
+ <zitec_printshippinglabel>
73
+ <use>admin</use>
74
+ <args>
75
+ <module>Zitec_PrintShippingLabel</module>
76
+ <frontName>zitec_printshippinglabel</frontName>
77
+ </args>
78
+ </zitec_printshippinglabel>
79
+ </routers>
80
+ </admin>
81
+ <default>
82
+ <zitec_printshippinglabel>
83
+ <general>
84
+
85
+ </general>
86
+ </zitec_printshippinglabel>
87
+ </default>
88
+
89
+ </config>
app/code/community/Zitec/ReportsCommon/Block/RecordsReport/Grid.php ADDED
@@ -0,0 +1,631 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * Can be used as a class parent reports showing individual rows
20
+ *   The DB (eg a report on individual orders).
21
+ *   Is copied / modified Grid reports Magento.
22
+ * @category Zitec
23
+ * @package Zitec_Dpd
24
+ * @author Zitec COM <magento@zitec.ro>
25
+ */
26
+ class Zitec_ReportsCommon_Block_RecordsReport_Grid extends Mage_Adminhtml_Block_Widget_Grid
27
+ {
28
+ protected $_from;
29
+
30
+ protected $_to;
31
+
32
+ protected $_storeSwitcherVisibility = true;
33
+
34
+ protected $_dateFilterVisibility = true;
35
+
36
+ protected $_exportVisibility = true;
37
+
38
+ protected $_subtotalVisibility = false;
39
+
40
+ protected $_filters = array();
41
+
42
+ protected $_defaultFilters = array(
43
+ 'report_from' => '',
44
+ 'report_to' => ''
45
+ );
46
+
47
+ protected $_subReportSize = 5;
48
+
49
+ protected $_grandTotals;
50
+
51
+ protected $_errors = array();
52
+
53
+ /**
54
+ * stores current currency code
55
+ */
56
+ protected $_currentCurrencyCode = null;
57
+
58
+ public function __construct()
59
+ {
60
+ parent::__construct();
61
+ $this->setFilterVisibility(false);
62
+ $this->setPagerVisibility(false);
63
+ $this->setTemplate('zitec_reportscommon/records_report_grid.phtml');
64
+ $this->setUseAjax(false);
65
+ $this->setCountTotals(true);
66
+ }
67
+
68
+
69
+ protected function _prepareLayout()
70
+ {
71
+ $this->setChild('store_switcher',
72
+ $this->getLayout()->createBlock('adminhtml/store_switcher')
73
+ ->setUseConfirm(false)
74
+ ->setSwitchUrl($this->getUrl('*/*/*', array('store' => null)))
75
+ ->setTemplate('report/store/switcher.phtml')
76
+ );
77
+
78
+ $this->setChild('refresh_button',
79
+ $this->getLayout()->createBlock('adminhtml/widget_button')
80
+ ->setData(array(
81
+ 'label' => Mage::helper('adminhtml')->__('Refresh'),
82
+ 'onclick' => $this->getRefreshButtonCallback(),
83
+ 'class' => 'task'
84
+ ))
85
+ );
86
+ parent::_prepareLayout();
87
+
88
+ return $this;
89
+ }
90
+
91
+ protected function _prepareColumns()
92
+ {
93
+ foreach ($this->_columns as $_column) {
94
+ $_column->setSortable(false);
95
+ }
96
+
97
+ parent::_prepareColumns();
98
+ }
99
+
100
+ protected function _prepareCollection()
101
+ {
102
+ $filter = $this->getParam($this->getVarNameFilter(), null);
103
+
104
+ if (is_null($filter)) {
105
+ $filter = $this->_defaultFilter;
106
+ }
107
+
108
+ if (is_string($filter)) {
109
+ $data = array();
110
+ $filter = base64_decode($filter);
111
+ parse_str(urldecode($filter), $data);
112
+ $data['report_from'] = Mage::helper('core')->htmlEscape($data['report_from']);
113
+ $data['report_to'] = Mage::helper('core')->htmlEscape($data['report_to']);
114
+ if (!isset($data['report_from'])) {
115
+ // getting all reports from 2001 year
116
+ $date = new Zend_Date(mktime(0, 0, 0, 1, 1, 2001));
117
+ $data['report_from'] = $date->toString($this->getLocale()->getDateFormat('short'));
118
+ }
119
+
120
+ if (!isset($data['report_to'])) {
121
+ // getting all reports from 2001 year
122
+ $date = new Zend_Date();
123
+ $data['report_to'] = $date->toString($this->getLocale()->getDateFormat('short'));
124
+ }
125
+
126
+ $this->_setFilterValues($data);
127
+ } else if ($filter && is_array($filter)) {
128
+ $this->_setFilterValues($filter);
129
+ } else if (0 !== sizeof($this->_defaultFilter)) {
130
+ $this->_setFilterValues($this->_defaultFilter);
131
+ }
132
+
133
+ $collection = $this->getCollection();
134
+
135
+ if ($this->getFilter('report_from') && $this->getFilter('report_to')) {
136
+ /**
137
+ * Validate from and to date
138
+ */
139
+ try {
140
+ $from = $this->getLocale()->date($this->getFilter('report_from'), Zend_Date::DATE_SHORT, null, false);
141
+ $to = $this->getLocale()->date($this->getFilter('report_to'), Zend_Date::DATE_SHORT, null, false);
142
+ $to->set('23:59:59', Zend_Date::TIMES);
143
+
144
+
145
+ $collection->setDateRange($from, $to)
146
+ ->setPageSize(false)
147
+ ->setStoreIds($this->getStoreIds());
148
+ } catch (Exception $e) {
149
+ $collection->getSelect()->where('FALSE');
150
+ }
151
+ } else {
152
+ // No se muestra nada si no se han eligido las fechas.
153
+ $collection->getSelect()->where('FALSE');
154
+ }
155
+
156
+ /**
157
+ * Getting and saving store ids for website & group
158
+ */
159
+ $storeIds = array();
160
+ if ($this->getRequest()->getParam('store')) {
161
+ $storeIds = array($this->getParam('store'));
162
+ } elseif ($this->getRequest()->getParam('website')) {
163
+ $storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
164
+ } elseif ($this->getRequest()->getParam('group')) {
165
+ $storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
166
+ }
167
+
168
+ if ($storeIds) {
169
+ $collection->setStoreIds($storeIds);
170
+ }
171
+
172
+ if ($this->getSubReportSize() !== null) {
173
+ $collection->setPageSize($this->getSubReportSize());
174
+ }
175
+
176
+ $debug = (string)$collection->getSelect();
177
+ // echo ($debug);
178
+
179
+ $this->setCollection($collection);
180
+
181
+ $this->_computeTotals();
182
+
183
+ Mage::dispatchEvent('adminhtml_widget_grid_filter_collection',
184
+ array('collection' => $this->getCollection(), 'filter_values' => $this->_filterValues)
185
+ );
186
+ }
187
+
188
+ protected function _setFilterValues($data)
189
+ {
190
+ foreach ($data as $name => $value) {
191
+ //if (isset($data[$name])) {
192
+ $this->setFilter($name, $data[$name]);
193
+ //}
194
+ }
195
+
196
+ return $this;
197
+ }
198
+
199
+ /**
200
+ * Set visibility of store switcher
201
+ *
202
+ * @param boolean $visible
203
+ */
204
+ public function setStoreSwitcherVisibility($visible = true)
205
+ {
206
+ $this->_storeSwitcherVisibility = $visible;
207
+ }
208
+
209
+ /**
210
+ * Return visibility of store switcher
211
+ *
212
+ * @return boolean
213
+ */
214
+ public function getStoreSwitcherVisibility()
215
+ {
216
+ return $this->_storeSwitcherVisibility;
217
+ }
218
+
219
+ /**
220
+ * Return store switcher html
221
+ *
222
+ * @return string
223
+ */
224
+ public function getStoreSwitcherHtml()
225
+ {
226
+ return $this->getChildHtml('store_switcher');
227
+ }
228
+
229
+ /**
230
+ * Set visibility of date filter
231
+ *
232
+ * @param boolean $visible
233
+ */
234
+ public function setDateFilterVisibility($visible = true)
235
+ {
236
+ $this->_dateFilterVisibility = $visible;
237
+ }
238
+
239
+ /**
240
+ * Return visibility of date filter
241
+ *
242
+ * @return boolean
243
+ */
244
+ public function getDateFilterVisibility()
245
+ {
246
+ return $this->_dateFilterVisibility;
247
+ }
248
+
249
+ /**
250
+ * Set visibility of export action
251
+ *
252
+ * @param boolean $visible
253
+ */
254
+ public function setExportVisibility($visible = true)
255
+ {
256
+ $this->_exportVisibility = $visible;
257
+ }
258
+
259
+ /**
260
+ * Return visibility of export action
261
+ *
262
+ * @return boolean
263
+ */
264
+ public function getExportVisibility()
265
+ {
266
+ return $this->_exportVisibility;
267
+ }
268
+
269
+ /**
270
+ * Set visibility of subtotals
271
+ *
272
+ * @param boolean $visible
273
+ */
274
+ public function setSubtotalVisibility($visible = true)
275
+ {
276
+ $this->_subtotalVisibility = $visible;
277
+ }
278
+
279
+ /**
280
+ * Return visibility of subtotals
281
+ *
282
+ * @return boolean
283
+ */
284
+ public function getSubtotalVisibility()
285
+ {
286
+ return $this->_subtotalVisibility;
287
+ }
288
+
289
+ public function getDateFormat()
290
+ {
291
+ return $this->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
292
+ }
293
+
294
+ /**
295
+ * Return refresh button html
296
+ */
297
+ public function getRefreshButtonHtml()
298
+ {
299
+ return $this->getChildHtml('refresh_button');
300
+ }
301
+
302
+ public function setFilter($name, $value)
303
+ {
304
+ if ($name) {
305
+ $this->_filters[$name] = $value;
306
+ }
307
+ }
308
+
309
+ public function getFilter($name)
310
+ {
311
+ if (isset($this->_filters[$name])) {
312
+ return $this->_filters[$name];
313
+ } else {
314
+ return ($this->getRequest()->getParam($name))
315
+ ? htmlspecialchars($this->getRequest()->getParam($name)) : '';
316
+ }
317
+ }
318
+
319
+ public function setSubReportSize($size)
320
+ {
321
+ $this->_subReportSize = $size;
322
+ }
323
+
324
+ public function getSubReportSize()
325
+ {
326
+ return $this->_subReportSize;
327
+ }
328
+
329
+ /**
330
+ * Retrieve locale
331
+ *
332
+ * @return Mage_Core_Model_Locale
333
+ */
334
+ public function getLocale()
335
+ {
336
+ if (!$this->_locale) {
337
+ $this->_locale = Mage::app()->getLocale();
338
+ }
339
+
340
+ return $this->_locale;
341
+ }
342
+
343
+ /**
344
+ * Add new export type to grid
345
+ *
346
+ * @param string $url
347
+ * @param string $label
348
+ *
349
+ * @return Mage_Adminhtml_Block_Widget_Grid
350
+ */
351
+ public function addExportType($url, $label)
352
+ {
353
+ $this->_exportTypes[] = new Varien_Object(
354
+ array(
355
+ 'url' => $this->getUrl($url,
356
+ array(
357
+ '_current' => true,
358
+ 'filter' => $this->getParam($this->getVarNameFilter(), null)
359
+ )
360
+ ),
361
+ 'label' => $label
362
+ )
363
+ );
364
+
365
+ return $this;
366
+ }
367
+
368
+
369
+ public function getReport($from, $to)
370
+ {
371
+ if ($from == '') {
372
+ $from = $this->getFilter('report_from');
373
+ }
374
+ if ($to == '') {
375
+ $to = $this->getFilter('report_to');
376
+ }
377
+ $totalObj = Mage::getModel('reports/totals');
378
+ $this->setTotals($totalObj->countTotals($this, $from, $to));
379
+ $this->addGrandTotals($this->getTotals());
380
+
381
+ return $this->getCollection()->setDateRange($from, $to)
382
+ ->setPageSize(false)
383
+ ->setStoreIds($this->getStoreIds());
384
+ }
385
+
386
+ public function addGrandTotals($total)
387
+ {
388
+ $totalData = $total->getData();
389
+ foreach ($totalData as $key => $value) {
390
+ $_column = $this->getColumn($key);
391
+ if ($_column->getTotal() != '') {
392
+ $this->getGrandTotals()->setData($key, $this->getGrandTotals()->getData($key) + $value);
393
+ }
394
+ }
395
+ /*
396
+ * recalc totals if we have average
397
+ */
398
+ foreach ($this->getColumns() as $key => $_column) {
399
+ if (strpos($_column->getTotal(), '/') !== false) {
400
+ list($t1, $t2) = explode('/', $_column->getTotal());
401
+ if ($this->getGrandTotals()->getData($t2) != 0) {
402
+ $this->getGrandTotals()->setData(
403
+ $key,
404
+ (float)$this->getGrandTotals()->getData($t1) / $this->getGrandTotals()->getData($t2)
405
+ );
406
+ }
407
+ }
408
+ }
409
+ }
410
+
411
+ public function getGrandTotals()
412
+ {
413
+ if (!$this->_grandTotals) {
414
+ $this->_grandTotals = new Varien_Object();
415
+ }
416
+
417
+ return $this->_grandTotals;
418
+ }
419
+
420
+ /**
421
+ * Retrieve grid as CSV
422
+ *
423
+ * @return unknown
424
+ */
425
+ public function getCsv()
426
+ {
427
+ $csv = '';
428
+ $this->_isExport = true;
429
+ $this->_prepareGrid();
430
+ $this->getCollection()->getSelect()->limit();
431
+ $this->getCollection()->setPageSize(0);
432
+ $this->getCollection()->load();
433
+ $this->_afterLoadCollection();
434
+
435
+ $data = array();
436
+ foreach ($this->_columns as $column) {
437
+ if (!$column->getIsSystem()) {
438
+ $data[] = '"' . $column->getExportHeader() . '"';
439
+ }
440
+ }
441
+ $csv .= implode(',', $data) . "\n";
442
+
443
+ foreach ($this->getCollection() as $item) {
444
+ $data = array();
445
+ foreach ($this->_columns as $column) {
446
+ if (!$column->getIsSystem()) {
447
+ $data[] = '"' . str_replace(array('"', '\\'), array('""', '\\\\'), $column->getRowFieldExport($item)) . '"';
448
+ }
449
+ }
450
+ $csv .= implode(',', $data) . "\n";
451
+ }
452
+
453
+ if ($this->getCountTotals()) {
454
+ $data = array();
455
+ $j = 0;
456
+ foreach ($this->_columns as $column) {
457
+ if ($j == 0) {
458
+ $data[] = '"' . $this->getTotalsText() . '"';
459
+ } else {
460
+ if (!$column->getIsSystem()) {
461
+ //$data[] = '"'.str_replace('"', '""', $column->getRowField($this->getTotals())).'"';
462
+ $data[] = '"' . str_replace(array('"', '\\'), array('""', '\\\\'), $column->getRowFieldExport($this->getTotals())) . '"';
463
+ }
464
+ }
465
+ $j++;
466
+ }
467
+ $csv .= implode(',', $data) . "\n";
468
+ }
469
+
470
+ return $csv;
471
+
472
+ }
473
+
474
+ /**
475
+ * Retrieve grid as Excel Xml
476
+ *
477
+ * @return unknown
478
+ */
479
+ public function getExcel($filename = '')
480
+ {
481
+
482
+ $this->_isExport = true;
483
+ $this->_prepareGrid();
484
+ $this->getCollection()->getSelect()->limit();
485
+ $this->getCollection()->setPageSize(0);
486
+ $this->getCollection()->load();
487
+ $this->_afterLoadCollection();
488
+ $headers = array();
489
+ $data = array();
490
+ foreach ($this->_columns as $column) {
491
+ if (!$column->getIsSystem()) {
492
+ $headers[] = $column->getHeader();
493
+ }
494
+ }
495
+ $data[] = $headers;
496
+
497
+ foreach ($this->getCollection() as $item) {
498
+ $row = array();
499
+ foreach ($this->_columns as $column) {
500
+ if (!$column->getIsSystem()) {
501
+ $row[] = $column->getRowField($item);
502
+ }
503
+ }
504
+ $data[] = $row;
505
+ }
506
+
507
+ if ($this->getCountTotals()) {
508
+
509
+ $j = 0;
510
+ $row = array();
511
+ foreach ($this->_columns as $column) {
512
+ if ($j == 0) {
513
+ $row[] = $this->__($this->getTotalText());
514
+ } elseif (!$column->getIsSystem()) {
515
+ $row[] = $column->getRowField($this->getTotals());
516
+ }
517
+ $j++;
518
+ }
519
+ $data[] = $row;
520
+ }
521
+
522
+ $xmlObj = new Varien_Convert_Parser_Xml_Excel();
523
+ $xmlObj->setVar('single_sheet', $filename);
524
+ $xmlObj->setData($data);
525
+ $xmlObj->unparse();
526
+
527
+ return $xmlObj->getData();
528
+
529
+ }
530
+
531
+ public function getSubtotalText()
532
+ {
533
+ return $this->__('Subtotal');
534
+ }
535
+
536
+ public function getTotalText()
537
+ {
538
+ return $this->__('Totals');
539
+ }
540
+
541
+ public function getEmptyText()
542
+ {
543
+ return $this->__('No records found for this period.');
544
+ }
545
+
546
+
547
+ /**
548
+ * onlick event for refresh button to show alert if fields are empty
549
+ *
550
+ * @return string
551
+ */
552
+ public function getRefreshButtonCallback()
553
+ {
554
+ return "{$this->getJsObjectName()}.doFilter();";
555
+
556
+ return "if ($('period_date_to').value == '' && $('period_date_from').value == '') {alert('" . $this->__('Please specify at least start or end date.') . "'); return false;}else {$this->getJsObjectName()}.doFilter();";
557
+ }
558
+
559
+ /**
560
+ * Retrieve errors
561
+ *
562
+ * @return array
563
+ */
564
+ public function getErrors()
565
+ {
566
+ return $this->_errors;
567
+ }
568
+
569
+ /**
570
+ * Retrieve correct currency code for select website, store, group
571
+ *
572
+ * @return string
573
+ */
574
+ public function getCurrentCurrencyCode()
575
+ {
576
+ if (is_null($this->_currentCurrencyCode)) {
577
+ if ($this->getRequest()->getParam('store')) {
578
+ $this->_currentCurrencyCode = Mage::app()->getStore($this->getRequest()->getParam('store'))->getBaseCurrencyCode();
579
+ } else if ($this->getRequest()->getParam('website')) {
580
+ $this->_currentCurrencyCode = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getBaseCurrencyCode();
581
+ } else if ($this->getRequest()->getParam('group')) {
582
+ $this->_currentCurrencyCode = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getWebsite()->getBaseCurrencyCode();
583
+ } else {
584
+ $this->_currentCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
585
+ }
586
+ }
587
+
588
+ return $this->_currentCurrencyCode;
589
+ }
590
+
591
+ protected function _computeTotals()
592
+ {
593
+ $totals = new Varien_Object();
594
+
595
+ foreach ($this->getCollection() as $item) {
596
+ foreach ($this->getColumns() as $col) {
597
+ if ($col->getTotal()) {
598
+ $fieldName = $col->getIndex();
599
+ $subTotal = $totals->getData($fieldName);
600
+ $subTotal = $subTotal ? $subTotal : 0;
601
+ $subTotal += $item->getData($fieldName);
602
+ $totals->setData($fieldName, $subTotal);
603
+ }
604
+ }
605
+ }
606
+
607
+ $collectionSize = $this->getCollection()->getSize();
608
+ if ($collectionSize) {
609
+ foreach ($this->getColumns() as $col) {
610
+ $fieldName = $col->getIndex();
611
+ if ($col->getTotal() == 'avg') {
612
+ $avg = $totals->getData($fieldName) / $collectionSize;
613
+ $totals->setData($fieldName, $avg);
614
+ }
615
+ if ($col->getType() == 'currency') {
616
+ $total = Mage::helper('core')->currency($totals->getData($fieldName), true, false);
617
+ $totals->setData($fieldName, $total);
618
+ }
619
+
620
+ }
621
+ }
622
+
623
+ $this->setTotals($totals);
624
+
625
+ }
626
+
627
+ public function getRowUrl($row)
628
+ {
629
+ return false;
630
+ }
631
+ }
app/code/community/Zitec/ReportsCommon/Block/Renderer/Posnegcurrency.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * For columns of type 'currency'. Shown in green if it is positive, and red if negative.
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_ReportsCommon_Block_Renderer_Posnegcurrency extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
25
+ {
26
+ public function render(Varien_Object $row)
27
+ {
28
+ $value = $row->getData($this->getColumn()->getIndex());
29
+ $formattedValue = Mage::helper('core')->currency($value, true, false);
30
+ $html = '<span style="color: ' . ($value >= 0 ? 'green' : 'red') . '">' . $formattedValue . '</span>';
31
+
32
+ return $html;
33
+ }
34
+
35
+ public function renderExport(Varien_Object $row)
36
+ {
37
+ $value = $row->getData($this->getColumn()->getIndex());
38
+ $formattedValue = Mage::helper('core')->currency($value, true, false);
39
+
40
+ return $formattedValue;
41
+ }
42
+ }
43
+
app/code/community/Zitec/ReportsCommon/Controller/Adminhtml/RecordsreportController.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * Parent class drivers reports "Record Report" (showing * rows - eg orders - individual).
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_ReportsCommon_Controller_Adminhtml_RecordsreportController extends Mage_Adminhtml_Controller_Action
25
+ {
26
+
27
+
28
+ protected $_exportFileName = 'Zitec_Report';
29
+
30
+
31
+ protected $_gridBlock;
32
+
33
+ /*
34
+ * The maximum number of days between the date of permit beginning and end.
35
+ * @var int
36
+ */
37
+ protected $_maxDaysInDateRange = 62;
38
+
39
+
40
+ protected function _initAction()
41
+ {
42
+ $this->loadLayout();
43
+
44
+ return $this;
45
+ }
46
+
47
+ public function indexAction()
48
+ {
49
+ $reportFrom = Mage::helper('core')->htmlEscape($this->getRequest()->getParam('report_from'));
50
+ $reportTo = Mage::helper('core')->htmlEscape($this->getRequest()->getParam('report_to'));
51
+
52
+ // We force the user to enter a range of dates when
53
+ // click on 'Show Report'.
54
+ if (!$reportFrom || !$reportTo) {
55
+ if (!is_null($this->getRequest()->getParam('showReport'))) {
56
+ Mage::getSingleton('core/session')->addError(Mage::helper('zitec_reportscommon')->__("Please select a 'from' and 'to' date."));
57
+ }
58
+ }
59
+
60
+ /* We confirm that the dates are valid and do not break the established limits. */
61
+ try {
62
+ $from = Mage::app()->getLocale()->date($reportFrom, Zend_Date::DATE_SHORT, null, false);
63
+ $to = Mage::app()->getLocale()->date($reportTo, Zend_Date::DATE_SHORT, null, false);
64
+
65
+ $diff = $to->sub($from)->toValue();
66
+ $days = ceil($diff / 60 / 60 / 24) + 1;
67
+
68
+ if ($days > $this->_maxDaysInDateRange) {
69
+ Mage::getSingleton('core/session')
70
+ ->addError(Mage::helper('zitec_reportscommon')
71
+ ->__(sprintf("The 'to' date must be at most %d days after the 'from' date.", $this->_maxDaysInDateRange)));
72
+ }
73
+ } catch (Exception $e) {
74
+ Mage::getSingleton('core/session')->addError(Mage::helper('zitec_reportscommon')->__('Invalid date specified'));
75
+ }
76
+
77
+
78
+ $this->_initAction()->renderLayout();
79
+ }
80
+
81
+ public function exportCsvAction()
82
+ {
83
+ $fileName = $this->_exportFileName . '.csv';
84
+ $content = $this->getLayout()->createBlock($this->_gridBlock)
85
+ ->getCsv();
86
+ $this->_sendUploadResponse($fileName, $content);
87
+ }
88
+
89
+ public function exportExcelAction()
90
+ {
91
+ $fileName = $this->_exportFileName . '.xml';
92
+ $content = $this->getLayout()->createBlock($this->_gridBlock)
93
+ ->getExcel($fileName);
94
+ $this->_sendUploadResponse($fileName, $content);
95
+ }
96
+
97
+ protected function _sendUploadResponse($fileName, $content, $contentType = 'application/octet-stream')
98
+ {
99
+ $response = $this->getResponse();
100
+ $response->setHeader('HTTP/1.1 200 OK', '');
101
+ $response->setHeader('Pragma', 'public', true);
102
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
103
+ $response->setHeader('Content-Disposition', 'attachment; filename=' . $fileName);
104
+ $response->setHeader('Last-Modified', date('r'));
105
+ $response->setHeader('Accept-Ranges', 'bytes');
106
+ $response->setHeader('Content-Length', strlen($content));
107
+ $response->setHeader('Content-type', $contentType);
108
+ $response->setBody($content);
109
+ $response->sendResponse();
110
+ die;
111
+ }
112
+
113
+
114
+ }
115
+
app/code/community/Zitec/ReportsCommon/Helper/Data.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_ReportsCommon_Helper_Data extends Mage_Core_Helper_Abstract
25
+ {
26
+
27
+
28
+ }
29
+
app/code/community/Zitec/ReportsCommon/etc/adminhtml.xml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <report>
5
+ <children>
6
+ <zitec_reportscommon translate="title">
7
+ <title>DPD</title>
8
+ <sort_order>9999</sort_order>
9
+ </zitec_reportscommon>
10
+ </children>
11
+ </report>
12
+ </menu>
13
+ <acl>
14
+ <resources>
15
+ <all>
16
+ <title>Allow Everything</title>
17
+ </all>
18
+ <admin>
19
+ <children>
20
+ <report>
21
+ <children>
22
+ <zitec_reportscommon translate="title">
23
+ <title>DPD</title>
24
+ <sort_order>9999</sort_order>
25
+ </zitec_reportscommon>
26
+ </children>
27
+ </report>
28
+ </children>
29
+ </admin>
30
+ </resources>
31
+ </acl>
32
+ </config>
app/code/community/Zitec/ReportsCommon/etc/config.xml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Zitec_ReportsCommon>
5
+ <version>1.0.0</version>
6
+ </Zitec_ReportsCommon>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <zitec_reportscommon>
11
+ <class>Zitec_ReportsCommon_Block</class>
12
+ </zitec_reportscommon>
13
+ </blocks>
14
+ <helpers>
15
+ <zitec_reportscommon>
16
+ <class>Zitec_ReportsCommon_Helper</class>
17
+ </zitec_reportscommon>
18
+ </helpers>
19
+ </global>
20
+ </config>
21
+
app/code/community/Zitec/ShippingReports/Block/Adminhtml/Profitability.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_ShippingReports_Block_Adminhtml_Profitability extends Mage_Adminhtml_Block_Widget_Grid_Container
25
+ {
26
+
27
+ public function __construct()
28
+ {
29
+ $this->_controller = 'adminhtml_profitability';
30
+ $this->_blockGroup = 'zitec_shippingreports';
31
+ $this->_headerText = Mage::helper('zitec_reportscommon')->__('Shipping Price vs Cost');
32
+ parent::__construct();
33
+ $this->setTemplate('zitec_reportscommon/records_report_container.phtml');
34
+ $this->addButton('filter_form_submit', array(
35
+ 'label' => Mage::helper('zitec_reportscommon')->__('Show Report'),
36
+ 'onclick' => 'filterFormSubmit()'
37
+ ));
38
+ $this->_removeButton('add');
39
+ }
40
+
41
+ public function getFilterUrl()
42
+ {
43
+ $this->getRequest()->setParam('filter', null);
44
+
45
+ return $this->getUrl('*/*/*', array('_current' => true));
46
+ }
47
+ }
app/code/community/Zitec/ShippingReports/Block/Adminhtml/Profitability/Grid.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_ShippingReports_Block_Adminhtml_Profitability_Grid extends Zitec_ReportsCommon_Block_RecordsReport_Grid
25
+ {
26
+
27
+ public function __construct()
28
+ {
29
+ parent::__construct();
30
+ $this->setId('zitec_ShippingReportsProfitabilityGrid');
31
+ $this->setDefaultSort('created_at');
32
+ $this->setDefaultDir('ASC');
33
+ $this->setSaveParametersInSession(true);
34
+ $this->setSubReportSize(false);
35
+ }
36
+
37
+ protected function _prepareCollection()
38
+ {
39
+ $collection = Mage::getResourceModel('zitec_shippingreports/profitability_collection');
40
+ $collection->addReportFields();
41
+ $this->setCollection($collection);
42
+
43
+ parent::_prepareCollection();
44
+
45
+ return $this;
46
+ }
47
+
48
+ protected function _prepareColumns()
49
+ {
50
+ $this->addColumn('order_ref', array(
51
+ 'header' => Mage::helper('zitec_shippingreports')->__('Order #'),
52
+ 'align' => 'right',
53
+ 'index' => 'increment_id',
54
+ 'renderer' => 'Zitec_ShippingReports_Block_Adminhtml_Profitability_Renderer_Orderref'
55
+ ));
56
+
57
+ $this->addColumn('created_at', array(
58
+ 'header' => Mage::helper('zitec_shippingreports')->__('Purchased On'),
59
+ 'index' => 'created_at',
60
+ 'type' => 'datetime',
61
+ ));
62
+
63
+ $this->addColumn('shipping_name', array(
64
+ 'header' => Mage::helper('zitec_shippingreports')->__('Ship to Name'),
65
+ 'index' => 'zitec_shipping_name',
66
+ ));
67
+
68
+ $this->addColumn('shipping_postcode', array(
69
+ 'header' => Mage::helper('zitec_shippingreports')->__('Postcode'),
70
+ 'index' => 'zitec_shipping_postcode',
71
+ ));
72
+
73
+ $this->addColumn('shipping_region', array(
74
+ 'header' => Mage::helper('zitec_shippingreports')->__('Region'),
75
+ 'index' => 'zitec_shipping_region',
76
+ ));
77
+
78
+ $this->addColumn('zitec_shippingreports', array(
79
+ 'header' => Mage::helper('zitec_shippingreports')->__('Country'),
80
+ 'index' => 'zitec_shipping_country_id',
81
+ 'type' => 'country'
82
+ ));
83
+
84
+ $this->addColumn('grand_total', array(
85
+ 'header' => Mage::helper('zitec_shippingreports')->__('Order total'),
86
+ 'index' => 'base_grand_total',
87
+ 'type' => 'currency',
88
+ 'total' => 'sum',
89
+ 'currency' => 'base_currency_code',
90
+
91
+ ));
92
+
93
+
94
+ $this->addColumn('shipping_amount', array(
95
+ 'header' => Mage::helper('zitec_shippingreports')->__('Shipping Price'),
96
+ 'index' => 'base_shipping_amount',
97
+ 'type' => 'currency',
98
+ 'total' => 'sum',
99
+ 'currency' => 'base_currency_code',
100
+ ));
101
+
102
+ $this->addColumn('total_shipping_cost', array(
103
+ 'header' => Mage::helper('zitec_shippingreports')->__('Total Shipping Cost'),
104
+ 'index' => 'zitec_total_shipping_cost',
105
+ 'type' => 'currency',
106
+ 'total' => 'sum',
107
+ 'currency' => 'base_currency_code',
108
+ ));
109
+
110
+ $this->addColumn('shipping_profit', array(
111
+ 'header' => Mage::helper('zitec_shippingreports')->__('Shipping Profit/Loss'),
112
+ 'index' => 'zitec_shipping_profit',
113
+ 'total' => 'sum',
114
+ 'align' => 'right',
115
+ 'renderer' => 'Zitec_ReportsCommon_Block_Renderer_Posnegcurrency',
116
+ ));
117
+
118
+ $this->addExportType('*/*/exportCsv', Mage::helper('zitec_shippingreports')->__('CSV'));
119
+ $this->addExportType('*/*/exportExcel', Mage::helper('zitec_shippingreports')->__('Excel XML'));
120
+
121
+ return parent::_prepareColumns();
122
+ }
123
+
124
+
125
+ }
126
+
app/code/community/Zitec/ShippingReports/Block/Adminhtml/Profitability/Renderer/Orderref.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_ShippingReports_Block_Adminhtml_Profitability_Renderer_Orderref extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
25
+ {
26
+ public function render(Varien_Object $row)
27
+ {
28
+ $link = Mage::helper("adminhtml")->getUrl('adminhtml/sales_order/view', array('order_id' => $row->getEntityId()));
29
+ $html = '<a href="' . $link . '">' . $row->getIncrementId() . '</a>';
30
+
31
+ return $html;
32
+ }
33
+
34
+ public function renderExport(Varien_Object $row)
35
+ {
36
+ return $row->getIncrementId();
37
+ }
38
+ }
39
+
app/code/community/Zitec/ShippingReports/Helper/Data.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_ShippingReports_Helper_Data extends Mage_Core_Helper_Abstract
25
+ {
26
+
27
+
28
+ }
app/code/community/Zitec/ShippingReports/Model/Mysql4/Profitability/Collection.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ * Report for price vs cost of shipping.
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_ShippingReports_Model_Mysql4_Profitability_Collection extends Mage_Sales_Model_Mysql4_Order_Collection
25
+ {
26
+
27
+
28
+ public function addReportFields()
29
+ {
30
+ $resource = Mage::getModel('core/resource');
31
+ /* @var $resource Mage_Core_Model_Resource */
32
+ $salesOrderAddressTable = $resource->getTableName('sales/order_address');
33
+ $this->getSelect()
34
+ ->columns(array('zitec_shipping_profit' => new Zend_Db_Expr("main_table.base_shipping_amount - main_table.zitec_total_shipping_cost")))
35
+ ->joinLeft(array('zitec_shipping_address' => $salesOrderAddressTable),
36
+ "main_table.entity_id = zitec_shipping_address.parent_id AND " .
37
+ "zitec_shipping_address.address_type = 'shipping' ",
38
+ array('zitec_shipping_name' => "CONCAT(zitec_shipping_address.lastname, ', ', zitec_shipping_address.firstname) ",
39
+ 'zitec_shipping_postcode' => "zitec_shipping_address.postcode",
40
+ 'zitec_shipping_region' => "zitec_shipping_address.region",
41
+ 'zitec_shipping_country_id' => "zitec_shipping_address.country_id"
42
+ ));
43
+
44
+ return $this;
45
+ }
46
+
47
+ public function setStoreIds($storeIds)
48
+ {
49
+ if ($storeIds) {
50
+ $this->addAttributeToFilter('store_id', array('in' => (array)$storeIds));
51
+ }
52
+
53
+ return $this;
54
+ }
55
+
56
+ /*
57
+ * @param Zend_Date $from
58
+ * @param Zend_Date $to
59
+ */
60
+
61
+ public function setDateRange($from, $to)
62
+ {
63
+ $fromDate = $from->toString('YYYY-MM-dd HH:mm:ss');
64
+ $toDate = $to->toString('YYYY-MM-dd HH:mm:ss');
65
+
66
+ $this->addAttributeToFilter('created_at', array('from' => $fromDate, 'to' => $toDate));
67
+
68
+ return $this;
69
+ }
70
+
71
+ }
72
+
app/code/community/Zitec/ShippingReports/Model/Observer/Order.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_ShippingReports_Model_Observer_Order extends Mage_Core_Model_Abstract
25
+ {
26
+
27
+ /*
28
+ * These marks are used to prevent the events are invoked twice.
29
+ */
30
+ protected $_beforeSaveAlreadyRun = false;
31
+
32
+
33
+ /*
34
+ * sales_order_shipment_save_before
35
+ * @param Varien_Event_Observer $o
36
+ * @return Varien_Event_Observer
37
+ */
38
+ public function beforeSave($o)
39
+ {
40
+ if ($this->_beforeSaveAlreadyRun) {
41
+ return $o;
42
+ }
43
+
44
+ $order = $o->getEvent()->getOrder();
45
+
46
+ // The total shipping costs for new orders is initialized.
47
+ if (!$order->getId()) {
48
+ $order->setData('zitec_total_shipping_cost', 0);
49
+ }
50
+ $this->_beforeSaveAlreadyRun = true;
51
+
52
+ return $o;
53
+ }
54
+
55
+
56
+ }
57
+
58
+
app/code/community/Zitec/ShippingReports/Model/Observer/Shipment.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_ShippingReports_Model_Observer_Shipment extends Mage_Core_Model_Abstract
25
+ {
26
+
27
+ /*
28
+ * These marks are used to prevent the events are invoked twice.
29
+ */
30
+ protected $_beforeSaveAlreadyRun = false;
31
+
32
+
33
+ /*
34
+ * sales_order_shipment_save_before
35
+ * If invoked from the page 'New Shipment' Magento Admin
36
+ * look if present in the POST data shipping cost added by module PackedShipment.
37
+ * If yes is present, update shipping and order with the cost reports.
38
+ * @param Varien_Event_Observer $o
39
+ * @return Varien_Event_Observer
40
+ */
41
+ public function beforeSave($o)
42
+ {
43
+ if ($this->_beforeSaveAlreadyRun) {
44
+ return $o;
45
+ }
46
+
47
+ // For all new submissions, it is initialized
48
+
49
+
50
+ $module = Mage::app()->getRequest()->getModuleName();
51
+ $controller = Mage::app()->getRequest()->getControllerName();
52
+ $action = Mage::app()->getRequest()->getActionName();
53
+
54
+
55
+ $shippingCost = Mage::app()->getRequest()->getParam('zitecShippingResportsShippingCost');
56
+ if (is_null($shippingCost) || strlen($shippingCost) == 0) {
57
+ return $o;
58
+ }
59
+
60
+ $shipment = $o->getEvent()->getShipment();
61
+
62
+
63
+ $oldShippingCost = $shipment->getData('zitec_shipping_cost', $shippingCost);
64
+
65
+
66
+ $shipment->setData('zitec_shipping_cost', $shippingCost);
67
+
68
+ // The order is updated with the total shipping cost.
69
+ $order = $shipment->getOrder();
70
+
71
+ $totalShippingCost = $order->getData('zitec_total_shipping_cost');
72
+ $totalShippingCost = $totalShippingCost ? $totalShippingCost : 0.000;
73
+
74
+ $totalShippingCost += $shippingCost;
75
+
76
+ if ($oldShippingCost) {
77
+ $totalShippingCost -= $oldShippingCost;
78
+ }
79
+
80
+ $order->setData('zitec_total_shipping_cost', (string)$totalShippingCost);
81
+
82
+ $this->_beforeSaveAlreadyRun = true;
83
+
84
+ return $o;
85
+ }
86
+
87
+
88
+ }
89
+
app/code/community/Zitec/ShippingReports/controllers/Adminhtml/Reports/ProfitabilityController.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_ShippingReports_Adminhtml_Reports_ProfitabilityController extends Zitec_ReportsCommon_Controller_Adminhtml_RecordsreportController
25
+ {
26
+
27
+ protected function _construct()
28
+ {
29
+ $this->_exportFileName = 'zitec_shippingreports_price_vs_cost';
30
+ $this->_gridBlock = 'zitec_shippingreports/adminhtml_profitability_grid';
31
+ }
32
+
33
+
34
+ }
35
+
app/code/community/Zitec/ShippingReports/etc/adminhtml.xml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <menu>
4
+ <report>
5
+ <children>
6
+
7
+ <zitec_reportscommon>
8
+ <children>
9
+ <zitec_shippingreports translate="title" module="zitec_shippingreports">
10
+ <title>Shipping Price vs Cost</title>
11
+ <action>zitec_shippingreports/adminhtml_reports_profitability</action>
12
+ </zitec_shippingreports>
13
+ </children>
14
+ </zitec_reportscommon>
15
+ </children>
16
+ </report>
17
+ </menu>
18
+ <acl>
19
+ <resources>
20
+ <all>
21
+ <title>Allow Everything</title>
22
+ </all>
23
+ <admin>
24
+ <children>
25
+ <report>
26
+ <children>
27
+ <zitec_reportscommon translate="title">
28
+ <title>DPD reports</title>
29
+ <sort_order>9999</sort_order>
30
+ <children>
31
+ <zitec_shippingreports translate="title" module="zitec_shippingreports">
32
+ <title>Shipping Price vs Cost</title>
33
+ <action>zitec_shippingreports/adminhtml_reports_profitability</action>
34
+ </zitec_shippingreports>
35
+ </children>
36
+ </zitec_reportscommon>
37
+ </children>
38
+ </report>
39
+ </children>
40
+ </admin>
41
+ </resources>
42
+ </acl>
43
+ </config>
app/code/community/Zitec/ShippingReports/etc/config.xml ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Zitec_ShippingReports>
5
+ <version>1.0.0</version>
6
+ </Zitec_ShippingReports>
7
+ </modules>
8
+ <admin>
9
+ <routers>
10
+ <zitec_shippingreports>
11
+ <use>admin</use>
12
+ <args>
13
+ <module>Zitec_ShippingReports</module>
14
+ <frontName>zitec_shippingreports</frontName>
15
+ </args>
16
+ </zitec_shippingreports>
17
+ </routers>
18
+ </admin>
19
+ <adminhtml>
20
+ <layout>
21
+ <updates>
22
+ <zitec_shippingreports>
23
+ <file>zitec_shippingreports.xml</file>
24
+ </zitec_shippingreports>
25
+ </updates>
26
+ </layout>
27
+ </adminhtml>
28
+ <global>
29
+ <models>
30
+ <zitec_shippingreports>
31
+ <class>Zitec_ShippingReports_Model</class>
32
+ <resourceModel>zitec_shippingreports_mysql4</resourceModel>
33
+ </zitec_shippingreports>
34
+ <zitec_shippingreports_mysql4>
35
+ <class>Zitec_ShippingReports_Model_Mysql4</class>
36
+ </zitec_shippingreports_mysql4>
37
+ </models>
38
+ <blocks>
39
+ <zitec_shippingreports>
40
+ <class>Zitec_ShippingReports_Block</class>
41
+ </zitec_shippingreports>
42
+ </blocks>
43
+ <helpers>
44
+ <zitec_shippingreports>
45
+ <class>Zitec_ShippingReports_Helper</class>
46
+ </zitec_shippingreports>
47
+ </helpers>
48
+ <resources>
49
+ <zitec_shippingreports_setup>
50
+ <setup>
51
+ <module>Zitec_ShippingReports</module>
52
+ <class>Mage_Sales_Model_Mysql4_Setup</class>
53
+ </setup>
54
+ <connection>
55
+ <use>core_setup</use>
56
+ </connection>
57
+ </zitec_shippingreports_setup>
58
+ </resources>
59
+ <events>
60
+ <sales_order_shipment_save_before>
61
+ <observers>
62
+ <zitec_shippingreports_shipment_before_save>
63
+ <class>zitec_shippingreports/observer_shipment</class>
64
+ <method>beforeSave</method>
65
+ </zitec_shippingreports_shipment_before_save>
66
+ </observers>
67
+ </sales_order_shipment_save_before>
68
+ <sales_order_save_before>
69
+ <observers>
70
+ <zitec_shippingreports_order_before_save>
71
+ <class>zitec_shippingreports/observer_order</class>
72
+ <method>beforeSave</method>
73
+ </zitec_shippingreports_order_before_save>
74
+ </observers>
75
+ </sales_order_save_before>
76
+ </events>
77
+ </global>
78
+ </config>
79
+
app/code/community/Zitec/ShippingReports/sql/zitec_shippingreports_setup/mysql4-install-1.0.0.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+
25
+ $installer = $this;
26
+ /* @var $this Mage_Core_Model_Resource_Setup */
27
+ /* @var $installer Mage_Core_Model_Resource_Setup */
28
+
29
+ $installer->startSetup();
30
+
31
+ $installer->addAttribute('shipment', 'zitec_shipping_cost', array('type' => 'decimal', 'grid' => true));
32
+
33
+ $installer->addAttribute('order', 'zitec_total_shipping_cost', array('type' => 'decimal', 'grid' => true));
34
+
35
+ $installer->run("update {$installer->getTable('sales_flat_order')} set zitec_total_shipping_cost = 0 where zitec_total_shipping_cost is null");
36
+
37
+ $installer->run("update {$installer->getTable('sales_flat_shipment')} set zitec_shipping_cost = 0 where zitec_shipping_cost is null");
38
+
39
+ $installer->endSetup();
40
+
41
+
app/code/community/Zitec/TableRates/Block/Adminhtml/Tablerate.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_TableRates_Block_Adminhtml_Tablerate extends Mage_Adminhtml_Block_Widget_Grid_Container
25
+ {
26
+
27
+ public function __construct()
28
+ {
29
+ $this->_controller = 'adminhtml_tablerate';
30
+ $this->_blockGroup = 'zitec_tablerates';
31
+ $this->_headerText = $this->_getHelper()->getGridTitle();
32
+ $this->_addButtonLabel = Mage::helper('zitec_tablerates')->__('Add Rate');
33
+
34
+ $this->_addButton('zitec_import',
35
+ array(
36
+ 'label' => $this->_getHelper()->__('Import Rates'),
37
+ 'onclick' => "setLocation('{$this->getImportUrl()}')"
38
+ ));
39
+
40
+ $this->_addButton('zitec_export',
41
+ array(
42
+ 'label' => $this->_getHelper()->__('Export Rates'),
43
+ 'onclick' => "setLocation('{$this->getExportUrl()}')"
44
+ ));
45
+ parent::__construct();
46
+
47
+
48
+ }
49
+
50
+ /**
51
+ *
52
+ * @return Zitec_TableRates_Helper_Data
53
+ */
54
+ protected function _getHelper()
55
+ {
56
+ return Mage::helper('zitec_tablerates');
57
+ }
58
+
59
+ public function getCreateUrl()
60
+ {
61
+ return $this->getUrl('*/*/new', array("carrier" => $this->_getHelper()->getCarrierCode()));
62
+ }
63
+
64
+ public function getImportUrl()
65
+ {
66
+ return $this->getUrl('*/*/import', array("carrier" => $this->_getHelper()->getCarrierCode()));
67
+ }
68
+
69
+ public function getExportUrl()
70
+ {
71
+ return $this->getUrl('*/*/export', array("carrier" => $this->_getHelper()->getCarrierCode()));
72
+ }
73
+
74
+
75
+ }
app/code/community/Zitec/TableRates/Block/Adminhtml/Tablerate/Edit.php ADDED
@@ -0,0 +1,357 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_TableRates_Block_Adminhtml_Tablerate_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
25
+ {
26
+
27
+ /**
28
+ *
29
+ * @var array
30
+ */
31
+ public function __construct()
32
+ {
33
+ $this->_objectId = 'tablerate_id';
34
+ $this->_blockGroup = 'zitec_tablerates';
35
+ $this->_controller = 'adminhtml_tablerate';
36
+ $model = Mage::registry('tablerate_data');
37
+ /* @var $model Zitec_TableRates_Model_Tablerate */
38
+ parent::__construct();
39
+
40
+ $this->_updateButton('save', 'label', Mage::helper('zitec_tablerates')->__('Save'));
41
+ if ($model->getId()) {
42
+ $this->_updateButton('delete', 'label', Mage::helper('zitec_tablerates')->__('Delete'));
43
+
44
+ $this->_addButton('duplicate', array(
45
+ 'label' => Mage::helper('zitec_tablerates')->__('Duplicate'),
46
+ 'class' => 'add',
47
+ 'onclick' => "zitecDpdDuplicate()",
48
+
49
+ ));
50
+ } else {
51
+ $this->_removeButton('delete');
52
+ }
53
+
54
+ $json = Mage::helper('zitec_tablerates/directory')->getRegionJson2();
55
+
56
+ $this->_formScripts[] = "function zitecDpdDuplicate() {
57
+ if ($('tablerate_id') && $('edit_form')) {
58
+ $('edit_form').action = $('edit_form').action + 'duplicate/1';
59
+ editForm.submit();
60
+ }
61
+
62
+
63
+ }";
64
+ $this->_formScripts[] = "var updater = new RegionUpdater('{$model->getMappedName('dest_country_id')}', 'none', '{$model->getMappedName('dest_region_id')}', $json, 'disable'); ";
65
+ $this->_formScripts[] = "
66
+ (function() {
67
+ var WEIGHT_AND_ABOVE_LABEL = '{$this->_getHelper()->__("Weight (and above)")}';
68
+ var PRICE_AND_ABOVE_LABEL = '{$this->_getHelper()->__("Price (and above)")}';
69
+
70
+ var SHIPPING_PRICE_LABEL = '{$this->_getHelper()->__("Shipping Price")}';
71
+ var SHIPPING_PERCENTAGE_LABEL = '{$this->_getHelper()->__("Shipping Percentage")}';
72
+ var SHIPPING_FIXED_AMOUNT_LABEL = '{$this->_getHelper()->__("Add fixed amount to price")}';
73
+
74
+ var COD_SURCHARGE_FIXED_LABEL = '{$this->_getHelper()->__("Fixed Cash On Delivery Surcharge Amount")}';
75
+ var COD_SURCHARGE_PERCENTAGE_LABEL = '{$this->_getHelper()->__("Cash On Delivery Surcharge Percentage")}';
76
+
77
+ var COD_MIN_SURCHARGE_LABEL = '{$this->_getHelper()->__("Minimum COD Surcharge")}';
78
+
79
+ var PRICE_AND_ABOVE_NOTE = '{$this->_getHelper()->__("Enter the starting price for this rate in the base currency of website. This rate will apply to orders whose subtotal (excluding shipping) is greater or equal to this price. Only include the sales tax/VAT in this price if you have configured shipping prices to include it (see System->Configuration->Sales->Tax->Calulation Settings->Shipping Prices).")}';
80
+ var WEIGHT_AND_ABOVE_NOTE = '{$this->_getHelper()->__("Enter the starting weight in kg for this rate.")}';
81
+
82
+ var selectorEventHandlers = [];
83
+
84
+ return {
85
+
86
+
87
+ init: function() {
88
+ document.observe('dom:loaded', function() {
89
+ this.setLabelDependingOnSelect({
90
+ selector: 'price_vs_dest',
91
+ labelFor: 'weight_price',
92
+ values: {
93
+ '0': WEIGHT_AND_ABOVE_LABEL,
94
+ '1': PRICE_AND_ABOVE_LABEL
95
+ },
96
+ notes: {
97
+ '0': WEIGHT_AND_ABOVE_NOTE,
98
+ '1': PRICE_AND_ABOVE_NOTE
99
+ },
100
+ isRequired: true,
101
+ validation: ['validate-number']
102
+ });
103
+
104
+ this.setLabelDependingOnSelect({
105
+ selector: 'markup_type',
106
+ labelFor: 'price',
107
+ values: {
108
+ '0': SHIPPING_PRICE_LABEL,
109
+ '1': SHIPPING_PERCENTAGE_LABEL,
110
+ '2': SHIPPING_FIXED_AMOUNT_LABEL
111
+ },
112
+ isRequired: true,
113
+ validation: ['validate-number']
114
+ });
115
+
116
+ this.setLabelDependingOnSelect({
117
+ selector: 'cod_option',
118
+ labelFor: 'cashondelivery_surcharge',
119
+ values: {
120
+ '0': null,
121
+ '1': null,
122
+ '2': COD_SURCHARGE_FIXED_LABEL,
123
+ '3': COD_SURCHARGE_PERCENTAGE_LABEL
124
+ },
125
+ isRequired: true,
126
+ validation: ['validate-number']
127
+ });
128
+
129
+ this.setLabelDependingOnSelect({
130
+ selector: 'cod_option',
131
+ labelFor: 'cod_min_surcharge',
132
+ values: {
133
+ '0': null,
134
+ '1': null,
135
+ '2': null,
136
+ '3': COD_MIN_SURCHARGE_LABEL
137
+ },
138
+ isRequired: false,
139
+ validation: ['validate-number']
140
+ });
141
+
142
+ this.hideFieldsDependingOnSelect('shipping_method_enabled',
143
+ ['0'],
144
+ [ { 'id': 'markup_type', 'isRequired' : true, validation: []},
145
+ { 'id': 'price', 'isRequired' : true, validation: ['validate-number'], 'onShow': this.blankPricePercentage},
146
+ { 'id': 'cod_option', 'isRequired' : true, validation: []},
147
+ { 'id': 'cashondelivery_surcharge', 'isRequired' : true, validation: ['validate-number']},
148
+ { 'id': 'cod_min_surcharge', 'isRequired' : false, validation: ['validate-number']}
149
+
150
+ ]
151
+
152
+ );
153
+ }.bind(this));
154
+
155
+ },
156
+
157
+ blankPricePercentage: function() {
158
+ var value = $('price').getValue();
159
+ if (!isNaN(parseFloat(value)) && isFinite(value) && value < 0) {
160
+ $('price').setValue('');
161
+ }
162
+ },
163
+
164
+ setLabelDependingOnSelect: function(options) {
165
+ var element = $(options.labelFor),
166
+ elementRow = this.getElementRow(options.labelFor),
167
+ label = this.getLabelForId(options.labelFor),
168
+ select = $(options.selector),
169
+ note = this.getNoteForId(options.labelFor),
170
+ labelText = null,
171
+ handler = null;
172
+
173
+ if (!element || !label || !select) {
174
+ return false;
175
+ }
176
+
177
+ handler = function() {
178
+ var i = 0,
179
+ validatorsCount = options.validation.length;
180
+
181
+ labelText = options.values[select.getValue()];
182
+ if (labelText) {
183
+ if (options.isRequired) {
184
+ labelText += ' <span class=\"required\">*</span>';
185
+ element.addClassName('required-entry');
186
+ }
187
+ for (i = 0; i < validatorsCount; i += 1) {
188
+ element.addClassName(options.validation[i]);
189
+ }
190
+ label.innerHTML = labelText;
191
+ if (note && options.notes && options.notes[select.getValue()]) {
192
+ note.innerHTML = options.notes[select.getValue()];
193
+ }
194
+ if (elementRow) {
195
+ elementRow.show();
196
+ }
197
+ element.show();
198
+ label.show();
199
+ } else {
200
+ if (elementRow) {
201
+ elementRow.hide();
202
+ }
203
+ element.hide();
204
+ label.hide();
205
+ element.removeClassName('required-entry');
206
+ for (i = 0; i < validatorsCount; i += 1) {
207
+ element.removeClassName(options.validation[i]);
208
+ }
209
+ element.setValue('');
210
+ }
211
+
212
+ };
213
+
214
+ selectorEventHandlers.push(handler);
215
+
216
+ handler();
217
+
218
+ select.observe('change', handler);
219
+
220
+ return true;
221
+ },
222
+
223
+ hideFieldsDependingOnSelect: function(selectId, selectHideValues, hiddenFields) {
224
+ var select = $(selectId),
225
+ that = this,
226
+ handler = null;
227
+
228
+ if (!select) {
229
+ return false;
230
+ }
231
+
232
+
233
+ handler = function() {
234
+ var i = 0,
235
+ j = 0,
236
+ hiddenFieldsLength = hiddenFields.length,
237
+ hide = false,
238
+ field = null,
239
+ fieldRow = null,
240
+ validatorsCount = null;
241
+
242
+ hide = selectHideValues.indexOf(select.getValue()) >= 0;
243
+ for (i = 0; i < hiddenFieldsLength; i += 1) {
244
+ field = $(hiddenFields[i].id);
245
+ if (!field) {
246
+ continue;
247
+ }
248
+
249
+ fieldRow = that.getElementRow(hiddenFields[i].id);
250
+ if (!fieldRow) {
251
+ continue;
252
+ }
253
+
254
+ if (hide) {
255
+ fieldRow.hide();
256
+ field.removeClassName('required-entry');
257
+ for (j = 0, validatorsCount = hiddenFields[i].validation.length; j < validatorsCount; j += 1) {
258
+ field.removeClassName(hiddenFields[i].validation[j]);
259
+ }
260
+ } else {
261
+ fieldRow.show();
262
+ if (hiddenFields[i].isRequired) {
263
+ field.addClassName('required-entry');
264
+ }
265
+ for (j = 0, validatorsCount = hiddenFields[i].validation.length; j < validatorsCount; j += 1) {
266
+ field.addClassName(hiddenFields[i].validation[j]);
267
+ }
268
+ if (hiddenFields[i].onShow) {
269
+ hiddenFields[i].onShow();
270
+ }
271
+ that.executeSelectorEventHandlers();
272
+ }
273
+ }
274
+
275
+ }
276
+
277
+
278
+ handler();
279
+
280
+ select.observe('change', handler);
281
+
282
+ return true;
283
+
284
+ },
285
+
286
+ executeSelectorEventHandlers: function() {
287
+ var i = 0,
288
+ count = selectorEventHandlers.length;
289
+ for (i = 0; i < count; i += 1) {
290
+ selectorEventHandlers[i]();
291
+ }
292
+ },
293
+
294
+ getLabelForId: function (id) {
295
+ var labels = $$('label[for=\"' + id +'\"]');
296
+ if (labels.length > 0) {
297
+ return labels[0];
298
+ } else {
299
+ return false;
300
+ }
301
+ },
302
+
303
+ getElementRow: function(id) {
304
+ if ($(id)) {
305
+ return $(id).up('tr');
306
+ } else {
307
+ return false;
308
+ }
309
+ },
310
+
311
+ getNoteForId: function(id) {
312
+ var row = this.getElementRow(id);
313
+ if (!row) {
314
+ return false;
315
+ }
316
+ note = row.down('p.note span');
317
+ return note ? note : false;
318
+ }
319
+
320
+
321
+
322
+
323
+ }
324
+ })().init();";
325
+
326
+ }
327
+
328
+ public function getHeaderText()
329
+ {
330
+ $tablerate = Mage::registry('tablerate_data');
331
+ if ($tablerate && $tablerate->getId()) {
332
+ return Mage::helper('zitec_tablerates')->__('Edit Rate');
333
+ } else {
334
+ return Mage::helper('zitec_tablerates')->__('New Rate');
335
+ }
336
+ }
337
+
338
+ public function getBackUrl()
339
+ {
340
+ return $this->getUrl('*/*/', array("carrier" => $this->_getHelper()->getCarrierCode()));
341
+ }
342
+
343
+ public function getDeleteUrl()
344
+ {
345
+ return $this->getUrl('*/*/delete', array($this->_objectId => $this->getRequest()->getParam($this->_objectId), "carrier" => $this->_getHelper()->getCarrierCode()));
346
+ }
347
+
348
+ /**
349
+ *
350
+ * @return Zitec_TableRates_Helper_Data
351
+ */
352
+ protected function _getHelper()
353
+ {
354
+ return Mage::helper('zitec_tablerates');
355
+ }
356
+
357
+ }
app/code/community/Zitec/TableRates/Block/Adminhtml/Tablerate/Edit/Form.php ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_TableRates_Block_Adminhtml_Tablerate_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+
27
+ /**
28
+ * @var array
29
+ */
30
+ public function __construct()
31
+ {
32
+ parent::__construct();
33
+ }
34
+
35
+ protected function _prepareForm()
36
+ {
37
+ $form = new Varien_Data_Form(array(
38
+ 'id' => 'edit_form',
39
+ 'action' => $this->getUrl('*/*/save', array('tablerate_id' => $this->getRequest()->getParam('tablerate_id'), 'carrier' => $this->_getHelper()->getCarrierCode())),
40
+ 'method' => 'post',
41
+ 'enctype' => 'multipart/form-data'
42
+ ));
43
+ $this->setForm($form);
44
+ $model = Mage::registry('tablerate_data');
45
+ /* @var $model Zitec_TableRates_Model_Tablerate */
46
+
47
+ $fieldset = $form->addFieldset('base_fieldset', array());
48
+
49
+ if ($model->getId()) {
50
+ $fieldset->addField('tablerate_id', 'hidden', array(
51
+ 'name' => 'pk',
52
+ 'value' => $model->getMappedData('pk'),
53
+ ));
54
+ }
55
+
56
+ $fieldset->addField('website_id', 'select', array(
57
+ 'name' => 'website_id',
58
+ 'label' => $this->_getHelper()->__('Website'),
59
+ 'required' => true,
60
+ 'value' => $model->getMappedData('website_id'),
61
+ 'values' => Mage::getSingleton('zitec_tablerates/source_website')->toOptionArray()
62
+ ));
63
+
64
+ $destCountryId = $model->getMappedData('dest_country_id');
65
+ $fieldset->addField('dest_country_id', 'select', array(
66
+ 'name' => 'dest_country_id',
67
+ 'label' => $this->_getHelper()->__('Dest Country'),
68
+ 'required' => false,
69
+ 'value' => $destCountryId,
70
+ 'values' => $this->getCountryValues()
71
+ ));
72
+
73
+
74
+ $fieldset->addField('dest_zip', 'text', array(
75
+ 'name' => 'dest_zip',
76
+ 'label' => $this->_getHelper()->__('Dest Zip/Postal Code'),
77
+ 'note' => $this->_getHelper()->__('* or blank - matches any'),
78
+ 'required' => false,
79
+ 'value' => $model->getMappedData('dest_zip')
80
+ ));
81
+
82
+ $fieldset->addField('method', 'select', array(
83
+ 'name' => 'method',
84
+ 'label' => $this->_getHelper()->__('Service'),
85
+ 'required' => true,
86
+ 'value' => $model->getMappedData('method'),
87
+ 'values' => $this->_getHelper()->getMethodOptions(),
88
+ 'note' => $this->_getHelper()->__('For rates with this service to be available, you must enable the service from the configuration panel of the shipping method in System->Configuration->Shipping Methods')
89
+ ));
90
+
91
+ if ($this->_getHelper()->supportsProduct()) {
92
+ $fieldset->addField('product', 'select', array(
93
+ 'name' => 'product',
94
+ 'label' => $this->_getHelper()->__('Product'),
95
+ 'required' => true,
96
+ 'value' => $model->getMappedData('product'),
97
+ 'values' => $this->_getHelper()->getProductOptions(),
98
+ 'note' => $this->_getHelper()->__('For rates with this product to be available, you must enable the product from the configuration panel of the shipping method in System->Configuration->Shipping Methods')
99
+ ));
100
+ }
101
+
102
+ if ($this->_getHelper()->supportsPriceVsDest()) {
103
+ $fieldset->addField('price_vs_dest', 'select', array(
104
+ 'name' => 'price_vs_dest',
105
+ 'label' => $this->_getHelper()->__('Condition'),
106
+ 'required' => true,
107
+ 'value' => $model->getMappedData('price_vs_dest'),
108
+ 'values' => array('0' => $this->_getHelper()->__("Weight vs. Destination"), '1' => $this->_getHelper()->__('Price vs. Destination')),
109
+ ));
110
+ }
111
+
112
+
113
+ $fieldset->addField('weight_price', 'text', array(
114
+ 'name' => 'weight_price',
115
+ 'label' => $this->_getHelper()->__('Weight (and above)'),
116
+ 'required' => true,
117
+ 'class' => 'validate-number',
118
+ 'value' => $model->getMappedData('weight_price'),
119
+ 'note' => $this->_getHelper()->__("Enter the starting weight in kg for this rate.")
120
+ ));
121
+
122
+ $fieldset->addField('shipping_method_enabled', 'select', array(
123
+ 'name' => 'shipping_method_enabled',
124
+ 'label' => $this->_getHelper()->__('Enable Shipping Method'),
125
+ 'required' => true,
126
+ 'value' => ($model->getMappedData('price') >= 0 ? '1' : '0'),
127
+ 'values' => array('0' => $this->_getHelper()->__('Disabled'), '1' => $this->_getHelper()->__('Enabled')),
128
+ 'note' => $this->_getHelper()->__('Disable the shipping method if you would like it to be unavailable for orders whose price or weight is greater or equal to the value you have indicated.')
129
+ ));
130
+
131
+ if ($this->_getHelper()->supportsMarkup()) {
132
+ $fieldset->addField('markup_type', 'select', array(
133
+ 'name' => 'markup_type',
134
+ 'label' => $this->_getHelper()->__('Shipping Price Calculation'),
135
+ 'required' => true,
136
+ 'value' => $model->getMappedData('markup_type'),
137
+ 'values' => array('0' => $this->_getHelper()->__("Fixed Price"), '1' => $this->_getHelper()->__('Add Percentage'), '2' => $this->_getHelper()->__('Add Fixed amount')),
138
+ 'note' => $this->_getHelper()->__("Use 'Add Percentage' if you want to calculate the shipping price by adding a percentage to price charged by the shipping carrier.")
139
+ ));
140
+ }
141
+
142
+ $fieldset->addField('price', 'text', array(
143
+ 'name' => 'price',
144
+ 'label' => $this->_getHelper()->__('Shipping Price'),
145
+ 'required' => true,
146
+ 'value' => $model->getMappedData('price'),
147
+ 'class' => 'validate-number'
148
+ ));
149
+
150
+ if ($this->_getHelper()->supportsCashOnDelivery()) {
151
+ $codOption = $model->getCashOnDeliverySurchargeOption();
152
+ $fieldset->addField('cod_option', 'select', array(
153
+ 'name' => 'cod_option',
154
+ 'label' => $this->_getHelper()->__('Cash On Delivery Surcharge Calculation'),
155
+ 'required' => true,
156
+ 'value' => $codOption,
157
+ 'values' => array(
158
+ Zitec_TableRates_Model_Tablerate::COD_NOT_AVAILABLE => $this->_getHelper()->__("Cash On Delivery Not Available"),
159
+ Zitec_TableRates_Model_Tablerate::COD_SURCHARGE_ZERO => $this->_getHelper()->__("Zero Surcharge"),
160
+ Zitec_TableRates_Model_Tablerate::COD_SURCHARGE_FIXED => $this->_getHelper()->__('Fixed Surcharge'),
161
+ Zitec_TableRates_Model_Tablerate::COD_SURCHARGE_PERCENTAGE => $this->_getHelper()->__('Percentage Surcharge')
162
+ ),
163
+ ));
164
+
165
+
166
+ $fieldset->addField('cashondelivery_surcharge', 'text', array(
167
+ 'name' => 'cashondelivery_surcharge',
168
+ 'label' => $this->_getHelper()->__('Fixed Cash On Delivery Surcharge'),
169
+ 'required' => true,
170
+ 'value' => $codOption == Zitec_TableRates_Model_Tablerate::COD_SURCHARGE_PERCENTAGE ? $model->getData('cod_surcharge_percentage') : $model->getData('cod_surcharge_price'),
171
+ 'class' => 'validate-number',
172
+ ));
173
+
174
+ if ($this->_getHelper()->supportsCodMinSurcharge()) {
175
+ $fieldset->addField('cod_min_surcharge', 'text', array(
176
+ 'name' => 'cod_min_surcharge',
177
+ 'label' => $this->_getHelper()->__('Minimum COD Surcharge'),
178
+ 'required' => false,
179
+ 'value' => $model->getMappedData('cod_min_surcharge'),
180
+ 'class' => 'validate-number',
181
+ 'note' => $this->_getHelper()->__('Optionally specify the minimum COD surcharge.')
182
+ ));
183
+ }
184
+ }
185
+
186
+
187
+ $sessionData = $this->_getSessionFormData();
188
+ if (is_array($sessionData)) {
189
+ $form->setValues($sessionData);
190
+ $destRegionId = array_key_exists('dest_region_id', $sessionData) ? $sessionData['dest_region_id'] : null;
191
+ $destCountryId = array_key_exists('dest_country_id', $sessionData) ? $sessionData['dest_country_id'] : null;
192
+ $this->_clearSessionFormData();
193
+ } else {
194
+ $destRegionId = $model->getMappedData('dest_region_id');
195
+ }
196
+
197
+ $fieldset->addField('dest_region_id', 'select', array(
198
+ 'name' => 'dest_region_id',
199
+ 'label' => $this->_getHelper()->__('Dest Region/State'),
200
+ 'required' => false,
201
+ 'value' => $destRegionId,
202
+ 'values' => $this->getRegionValues($destCountryId),
203
+ ), 'dest_country_id');
204
+
205
+ $form->setUseContainer(true);
206
+
207
+ return parent::_prepareForm();
208
+ }
209
+
210
+ /**
211
+ *
212
+ * @return array
213
+ */
214
+ protected function _getSessionFormData()
215
+ {
216
+ return Mage::getSingleton('adminhtml/session')->getTablerateData();
217
+ }
218
+
219
+ /**
220
+ *
221
+ * @return \Zitec_TableRates_Block_Adminhtml_Tablerate_Edit_Form
222
+ */
223
+ protected function _clearSessionFormData()
224
+ {
225
+ Mage::getSingleton('adminhtml/session')->setTablerateData(null);
226
+
227
+ return $this;
228
+ }
229
+
230
+ /**
231
+ * Get country values
232
+ *
233
+ * @return array
234
+ */
235
+ protected function getCountryValues()
236
+ {
237
+ $countries = Mage::getModel('adminhtml/system_config_source_country')->toOptionArray(false);
238
+ if (isset($countries[0])) {
239
+ $countries[0] = array('label' => '*', 'value' => 0);
240
+ }
241
+
242
+ return $countries;
243
+ }
244
+
245
+ /**
246
+ * Get region values
247
+ *
248
+ * @return array
249
+ */
250
+ protected function getRegionValues($destCountryId = null)
251
+ {
252
+ $regions = array(array('value' => '', 'label' => '*'));
253
+ $model = Mage::registry('tablerate_data');
254
+ $destCountryId = isset($destCountryId) ? $destCountryId : $model->getDestCountryId();
255
+ if ($destCountryId) {
256
+ $regionCollection = Mage::getModel('directory/region')
257
+ ->getCollection()
258
+ ->addCountryFilter($destCountryId);
259
+ $regions = $regionCollection->toOptionArray();
260
+ if (isset($regions[0])) {
261
+ $regions[0]['label'] = '*';
262
+ }
263
+ }
264
+
265
+ return $regions;
266
+ }
267
+
268
+ /**
269
+ *
270
+ * @return Zitec_TableRates_Helper_Data
271
+ */
272
+ protected function _getHelper()
273
+ {
274
+ return Mage::helper('zitec_tablerates');
275
+ }
276
+
277
+ }
app/code/community/Zitec/TableRates/Block/Adminhtml/Tablerate/Export.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_TableRates_Block_Adminhtml_Tablerate_Export extends Mage_Adminhtml_Block_Widget_Form_Container
25
+ {
26
+
27
+ public function __construct()
28
+ {
29
+ $this->_objectId = 'tablerate_id';
30
+ $this->_blockGroup = 'zitec_tablerates';
31
+ $this->_controller = 'adminhtml_tablerate';
32
+ $this->_mode = 'export';
33
+ parent::__construct();
34
+
35
+ $this->_updateButton('save', 'label', Mage::helper('zitec_tablerates')->__('Export'));
36
+ $this->_removeButton('delete');
37
+ $this->_removeButton('reset');
38
+ }
39
+
40
+ public function getHeaderText()
41
+ {
42
+ return $this->_getHelper()->__('Export') . ' ' . $this->_getHelper()->getGridTitle();
43
+ }
44
+
45
+ public function getBackUrl()
46
+ {
47
+ return $this->getUrl('*/*/', array("carrier" => $this->_getHelper()->getCarrierCode()));
48
+ }
49
+
50
+
51
+ /**
52
+ *
53
+ * @return Zitec_TableRates_Helper_Data
54
+ */
55
+ protected function _getHelper()
56
+ {
57
+ return Mage::helper('zitec_tablerates');
58
+ }
59
+
60
+
61
+ }
62
+
app/code/community/Zitec/TableRates/Block/Adminhtml/Tablerate/Export/Form.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_TableRates_Block_Adminhtml_Tablerate_Export_Form extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ /**
27
+ * @var array
28
+ */
29
+ public function __construct()
30
+ {
31
+ parent::__construct();
32
+ }
33
+
34
+ protected function _prepareForm()
35
+ {
36
+ $form = new Varien_Data_Form(array(
37
+ 'id' => 'edit_form',
38
+ 'action' => $this->getUrl('*/*/exportrates', array('tablerate_id' => $this->getRequest()->getParam('tablerate_id'), 'carrier' => $this->_getHelper()->getCarrierCode())),
39
+ 'method' => 'post',
40
+ 'enctype' => 'multipart/form-data'
41
+ ));
42
+ $this->setForm($form);
43
+
44
+
45
+ $fieldset = $form->addFieldset('base_fieldset', array());
46
+
47
+ $fieldset->addField('website_id', 'select', array(
48
+ 'name' => 'website_id',
49
+ 'label' => $this->_getHelper()->__('Website'),
50
+ 'values' => Mage::getSingleton('zitec_tablerates/source_website')->toOptionArray(),
51
+ 'required' => true
52
+ ));
53
+
54
+
55
+ $form->setUseContainer(true);
56
+
57
+ return parent::_prepareForm();
58
+ }
59
+
60
+ public function getExportUrl()
61
+ {
62
+ return $this->getUrl('*/*/exportrates', array("carrier" => $this->_getHelper()->getCarrierCode()));
63
+ }
64
+
65
+ /**
66
+ *
67
+ * @return Zitec_TableRates_Helper_Data
68
+ */
69
+ protected function _getHelper()
70
+ {
71
+ return Mage::helper('zitec_tablerates');
72
+ }
73
+
74
+ }
75
+
app/code/community/Zitec/TableRates/Block/Adminhtml/Tablerate/Grid.php ADDED
@@ -0,0 +1,351 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_TableRates_Block_Adminhtml_Tablerate_Grid extends Mage_Adminhtml_Block_Widget_Grid
25
+ {
26
+
27
+ /**
28
+ *
29
+ * @var array
30
+ */
31
+ protected $_map = null;
32
+
33
+ public function __construct()
34
+ {
35
+ parent::__construct();
36
+ $this->_map = Zitec_TableRates_Model_Mysql4_Tablerate::getLogicalDbFieldNamesMap();
37
+ $this->setId('zitec_tablerates_tablerateGrid');
38
+ $this->setDefaultSort($this->_map['pk']);
39
+ $this->setDefaultDir('DESC');
40
+ $this->setSaveParametersInSession(true);
41
+ $this->setUseAjax(true);
42
+ }
43
+
44
+ protected function _prepareCollection()
45
+ {
46
+ $collection = Mage::getModel('zitec_tablerates/tablerate')->getCollection();
47
+ $this->setCollection($collection);
48
+
49
+ return parent::_prepareCollection();
50
+ }
51
+
52
+ protected function _prepareColumns()
53
+ {
54
+
55
+ $store = $this->_getStore();
56
+
57
+ $this->addColumn('tablerate_id', array(
58
+ 'header' => $this->_getHelper()->__('ID'),
59
+ 'align' => 'right',
60
+ 'width' => '50px',
61
+ 'index' => $this->_map['pk'],
62
+ ));
63
+
64
+
65
+ $this->addColumn('website', array(
66
+ 'header' => $this->_getHelper()->__('Website'),
67
+ 'index' => $this->_map['website_id'],
68
+ 'default' => '',
69
+ 'type' => 'options',
70
+ 'options' => Mage::getSingleton('zitec_tablerates/source_website')->getWebsites(),
71
+ 'filter_index' => "main_table.{$this->_map['website_id']}"
72
+ ));
73
+
74
+
75
+ $this->addColumn('dest_country_id', array(
76
+ 'header' => $this->_getHelper()->__('Destination Country'),
77
+ 'align' => 'left',
78
+ 'index' => $this->_map['dest_country_id'],
79
+ 'filter_index' => "main_table.{$this->_map['dest_country_id']}",
80
+ 'type' => 'options',
81
+ 'options' => $this->getCountryOptions(),
82
+ ));
83
+
84
+ $this->addColumn('dest_region', array(
85
+ 'header' => $this->_getHelper()->__('Dest Region/State'),
86
+ 'align' => 'left',
87
+ 'index' => 'dest_region_name',
88
+ 'filter_index' => 'region_table.default_name',
89
+ 'filter' => 'zitec_tablerates/adminhtml_widget_grid_column_filter_region',
90
+ 'default' => '*',
91
+ ));
92
+
93
+
94
+ $this->addColumn('dest_zip', array(
95
+ 'header' => $this->_getHelper()->__('Destination Zip/Postal Code'),
96
+ 'align' => 'left',
97
+ 'index' => $this->_map['dest_zip'],
98
+ 'default' => '*',
99
+ ));
100
+
101
+ $this->addColumn('method', array(
102
+ 'header' => $this->_getHelper()->__('Service'),
103
+ 'align' => 'left',
104
+ 'index' => $this->_map['method'],
105
+ 'filter_index' => "main_table.{$this->_map['method']}",
106
+ 'type' => 'options',
107
+ 'options' => $this->_getHelper()->getMethodOptions(),
108
+ 'width' => 150,
109
+ ));
110
+
111
+ if ($this->_getHelper()->supportsProduct()) {
112
+ $this->addColumn('product', array(
113
+ 'header' => $this->_getHelper()->__('Product'),
114
+ 'align' => 'left',
115
+ 'index' => $this->_map['product'],
116
+ 'filter_index' => "main_table.{$this->_map['product']}",
117
+ 'type' => 'options',
118
+ 'options' => $this->_getHelper()->getProductOptions(),
119
+ 'width' => 150,
120
+ ));
121
+ }
122
+
123
+
124
+ $this->addColumn('weight_and_above', array(
125
+ 'header' => $this->_getHelper()->__('Weight (and above)'),
126
+ 'index' => 'weight_and_above',
127
+ 'filter_condition_callback' => array($this, '_weightAndAboveFilter'),
128
+ 'default' => '*',
129
+ 'type' => 'number'
130
+ ));
131
+
132
+ if ($this->_getHelper()->supportsPriceVsDest()) {
133
+ $this->addColumn('price_and_above', array(
134
+ 'header' => $this->_getHelper()->__('Price (and above)'),
135
+ 'align' => 'left',
136
+ 'index' => 'price_and_above',
137
+ 'filter_condition_callback' => array($this, '_priceAndAboveFilter'),
138
+ 'type' => 'price',
139
+ 'currency_code' => $store->getBaseCurrency()->getCode(),
140
+ 'default' => '*',
141
+ ));
142
+ }
143
+
144
+ $this->addColumn('is_enabled', array(
145
+ 'header' => $this->_getHelper()->__('Enabled'),
146
+ 'align' => 'left',
147
+ 'index' => 'is_enabled_grid',
148
+ 'filter' => false,
149
+ 'type' => 'options',
150
+ 'options' => array(0 => $this->_getHelper()->__('No'), 1 => $this->_getHelper()->__('Yes')),
151
+ ));
152
+
153
+ $this->addColumn('shipping_price', array(
154
+ 'header' => $this->_getHelper()->__('Shipping Price'),
155
+ 'align' => 'left',
156
+ 'index' => 'shipping_price_grid',
157
+ 'filter_index' => "main_table.{$this->_map['price']}",
158
+ 'type' => 'price',
159
+ 'currency_code' => $store->getBaseCurrency()->getCode(),
160
+ 'default' => '',
161
+ ));
162
+
163
+
164
+ if ($this->_getHelper()->supportsMarkup()) {
165
+ $this->addColumn('shipping_percentage', array(
166
+ 'header' => $this->_getHelper()->__('Shipping Price %'),
167
+ 'align' => 'left',
168
+ 'index' => 'shipping_percentage_grid',
169
+ 'filter_index' => "main_table.{$this->_map['price']}",
170
+ 'type' => 'number',
171
+ 'default' => ''
172
+ ));
173
+
174
+ $this->addColumn('addition_amount', array(
175
+ 'header' => $this->_getHelper()->__('Addition Price'),
176
+ 'align' => 'left',
177
+ 'index' => 'addition_amount_grid',
178
+ 'filter_index' => "main_table.{$this->_map['price']}",
179
+ 'type' => 'price',
180
+ 'currency_code' => $store->getBaseCurrency()->getCode(),
181
+ ));
182
+
183
+ }
184
+
185
+
186
+ if ($this->_getHelper()->supportsCashOnDelivery()) {
187
+ $this->addColumn('cod_surcharge_price', array(
188
+ 'header' => $this->_getHelper()->__('COD Surcharge'),
189
+ 'align' => 'left',
190
+ 'index' => 'cod_surcharge_price',
191
+ 'filter_index' => "main_table.{$this->_map['cashondelivery_surcharge']}",
192
+ 'type' => 'price',
193
+ 'currency_code' => $store->getBaseCurrency()->getCode(),
194
+ ));
195
+
196
+ $this->addColumn('cod_surcharge_percentage', array(
197
+ 'header' => $this->_getHelper()->__('COD Surcharge %'),
198
+ 'index' => 'cod_surcharge_percentage',
199
+ 'filter_index' => "main_table.{$this->_map['cashondelivery_surcharge']}",
200
+ 'type' => 'number',
201
+ ));
202
+
203
+ if ($this->_getHelper()->supportsCodMinSurcharge()) {
204
+ $this->addColumn('cod_min_surcharge', array(
205
+ 'header' => $this->_getHelper()->__('COD Min. Surcharge'),
206
+ 'index' => $this->_map['cod_min_surcharge'],
207
+ 'filter_index' => "main_table.{$this->_map['cod_min_surcharge']}",
208
+ 'type' => 'price',
209
+ 'currency_code' => $store->getBaseCurrency()->getCode(),
210
+ ));
211
+ }
212
+ }
213
+
214
+
215
+ return parent::_prepareColumns();
216
+ }
217
+
218
+ protected function _prepareMassaction()
219
+ {
220
+ $this->setMassactionIdField($this->_map['pk']);
221
+ $this->getMassactionBlock()->setFormFieldName('tablerates');
222
+ $this->getMassactionBlock()->addItem('delete', array(
223
+ 'label' => $this->_getHelper()->__('Delete'),
224
+ 'url' => $this->getUrl('*/*/massDelete', array("carrier" => $this->_getHelper()->getCarrierCode())),
225
+ 'confirm' => $this->_getHelper()->__('Are you sure?')
226
+ ));
227
+
228
+ return $this;
229
+ }
230
+
231
+ public function getGridUrl()
232
+ {
233
+ return $this->getUrl('*/*/grid', array('_current' => true, '_query' => array("carrier" => $this->_getHelper()->getCarrierCode())));
234
+ }
235
+
236
+ public function getRowUrl($row)
237
+ {
238
+ return $this->getUrl('*/*/edit', array('tablerate_id' => $row->getId(), "carrier" => $this->_getHelper()->getCarrierCode()));
239
+ }
240
+
241
+ /**
242
+ * Get country options
243
+ *
244
+ * @return array
245
+ */
246
+ public function getCountryOptions()
247
+ {
248
+ $options = array();
249
+ $countries = Mage::getModel('adminhtml/system_config_source_country')->toOptionArray(false);
250
+ if (isset($countries[0])) {
251
+ $countries[0] = array('value' => '0', 'label' => '*',);
252
+ }
253
+ foreach ($countries as $country) {
254
+ $options[$country['value']] = $country['label'];
255
+ }
256
+
257
+ return $options;
258
+ }
259
+
260
+ /**
261
+ *
262
+ * @param Zitec_TableRates_Model_Mysql4_Tablerate_Collection $collection
263
+ * @param type Mage_Adminhtml_Block_Widget_Grid_Column
264
+ *
265
+ * @return \Zitec_TableRates_Block_Adminhtml_Tablerate_Grid
266
+ */
267
+ protected function _weightAndAboveFilter($collection, $column)
268
+ {
269
+ return $this->_weightPriceAndAboveFilter($collection, $column, false);
270
+ }
271
+
272
+ /**
273
+ *
274
+ * @param Zitec_TableRates_Model_Mysql4_Tablerate_Collection $collection
275
+ * @param type Mage_Adminhtml_Block_Widget_Grid_Column
276
+ *
277
+ * @return \Zitec_TableRates_Block_Adminhtml_Tablerate_Grid
278
+ */
279
+ protected function _priceAndAboveFilter($collection, $column)
280
+ {
281
+ return $this->_weightPriceAndAboveFilter($collection, $column, true);
282
+ }
283
+
284
+ /**
285
+ *
286
+ * @param Zitec_TableRates_Model_Mysql4_Tablerate_Collection $collection
287
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
288
+ * @param boolean $priceVsDest
289
+ *
290
+ * @return \Zitec_TableRates_Block_Adminhtml_Tablerate_Grid
291
+ */
292
+ protected function _weightPriceAndAboveFilter(Zitec_TableRates_Model_Mysql4_Tablerate_Collection $collection, Mage_Adminhtml_Block_Widget_Grid_Column $column, $priceVsDest = false)
293
+ {
294
+
295
+ if ($priceVsDest && !$this->_getHelper()->supportsPriceVsDest()) {
296
+ return $this;
297
+ }
298
+
299
+ $value = $column->getFilter()->getValue();
300
+ if (!is_array($value)) {
301
+ return $this;
302
+ }
303
+
304
+
305
+ $from = isset($value['from']) ? $value['from'] : false;
306
+ $to = isset($value['to']) ? $value['to'] : false;
307
+
308
+ if ($from === false && $to === false) {
309
+ return $this;
310
+ }
311
+
312
+ $select = $collection->getSelect();
313
+ if ($from !== false) {
314
+ $select->where(" main_table.{$this->_map['weight_price']} >= ? ", $from);
315
+ }
316
+
317
+
318
+ if ($to !== false) {
319
+ $select->where(" main_table.{$this->_map['weight_price']} <= ? ", $to);
320
+ }
321
+
322
+ $select->where(" main_table.{$this->_map['price_vs_dest']} = ? ", $priceVsDest ? 1 : 0);
323
+
324
+ $selectStr = (string)$select;
325
+ $this->_getHelper()->log($selectStr);
326
+
327
+ return $this;
328
+ }
329
+
330
+ /**
331
+ * Get store
332
+ *
333
+ * @return Mage_Core_Model_Store
334
+ */
335
+ protected function _getStore()
336
+ {
337
+ $storeId = (int)$this->getRequest()->getParam('store', 0);
338
+
339
+ return Mage::app()->getStore($storeId);
340
+ }
341
+
342
+ /**
343
+ *
344
+ * @return Zitec_TableRates_Helper_Data
345
+ */
346
+ protected function _getHelper()
347
+ {
348
+ return Mage::helper('zitec_tablerates');
349
+ }
350
+
351
+ }
app/code/community/Zitec/TableRates/Block/Adminhtml/Tablerate/Grid/Renderer/Shippingpercentage.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_TableRates_Block_Adminhtml_Tablerate_Grid_Renderer_Shippingpercentage extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
25
+ {
26
+
27
+ public function render(Varien_Object $row)
28
+ {
29
+ $var = $row->getShippingPercentage();
30
+ if (isset($var)) {
31
+ return $row->getShippingPercentage() . '%';
32
+ } else {
33
+ return '';
34
+ }
35
+ }
36
+
37
+ }
38
+
app/code/community/Zitec/TableRates/Block/Adminhtml/Tablerate/Import.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_TableRates_Block_Adminhtml_Tablerate_Import extends Mage_Adminhtml_Block_Widget_Form_Container
25
+ {
26
+
27
+ public function __construct()
28
+ {
29
+ $this->_objectId = 'tablerate_id';
30
+ $this->_blockGroup = 'zitec_tablerates';
31
+ $this->_controller = 'adminhtml_tablerate';
32
+ $this->_mode = 'import';
33
+ parent::__construct();
34
+
35
+ $this->_updateButton('save', 'label', Mage::helper('zitec_tablerates')->__('Import'));
36
+ $this->_removeButton('delete');
37
+ $this->_removeButton('reset');
38
+ }
39
+
40
+ public function getHeaderText()
41
+ {
42
+ return $this->_getHelper()->__('Import') . ' ' . $this->_getHelper()->getGridTitle();
43
+ }
44
+
45
+ public function getBackUrl()
46
+ {
47
+ return $this->getUrl('*/*/', array("carrier" => $this->_getHelper()->getCarrierCode()));
48
+ }
49
+
50
+ /**
51
+ *
52
+ * @return Zitec_TableRates_Helper_Data
53
+ */
54
+ protected function _getHelper()
55
+ {
56
+ return Mage::helper('zitec_tablerates');
57
+ }
58
+
59
+
60
+ }
61
+
app/code/community/Zitec/TableRates/Block/Adminhtml/Tablerate/Import/Form.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_TableRates_Block_Adminhtml_Tablerate_Import_Form extends Mage_Adminhtml_Block_Widget_Form
25
+ {
26
+ /**
27
+ * @var array
28
+ */
29
+ public function __construct()
30
+ {
31
+ parent::__construct();
32
+ }
33
+
34
+ protected function _prepareForm()
35
+ {
36
+ $form = new Varien_Data_Form(array(
37
+ 'id' => 'edit_form',
38
+ 'action' => $this->getUrl('*/*/importrates', array('tablerate_id' => $this->getRequest()->getParam('tablerate_id'), 'carrier' => $this->_getHelper()->getCarrierCode())),
39
+ 'method' => 'post',
40
+ 'enctype' => 'multipart/form-data'
41
+ ));
42
+ $this->setForm($form);
43
+
44
+
45
+ $fieldset = $form->addFieldset('base_fieldset', array());
46
+
47
+ $fieldset->addField('website_id', 'select', array(
48
+ 'name' => 'website_id',
49
+ 'label' => $this->_getHelper()->__('Website'),
50
+ 'values' => Mage::getSingleton('zitec_tablerates/source_website')->toOptionArray(),
51
+ 'required' => true
52
+ ));
53
+
54
+ $fieldset->addField('import', 'file', array(
55
+ 'name' => 'import',
56
+ 'label' => $this->_getHelper()->__('Import Rates'),
57
+ 'required' => true,
58
+
59
+ ));
60
+
61
+
62
+ $form->setUseContainer(true);
63
+
64
+ return parent::_prepareForm();
65
+ }
66
+
67
+
68
+ /**
69
+ *
70
+ * @return Zitec_TableRates_Helper_Data
71
+ */
72
+ protected function _getHelper()
73
+ {
74
+ return Mage::helper('zitec_tablerates');
75
+ }
76
+
77
+ }
78
+
app/code/community/Zitec/TableRates/Block/Adminhtml/Widget/Grid/Column/Filter/Region.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_TableRates_Block_Adminhtml_Widget_Grid_Column_Filter_Region
25
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Text
26
+ {
27
+ /**
28
+ * Get condition
29
+ *
30
+ * @return array
31
+ */
32
+ public function getCondition()
33
+ {
34
+ $value = trim($this->getValue());
35
+ if ($value == '*') {
36
+ return array('null' => true);
37
+ } else {
38
+ return array('like' => '%' . $this->_escapeValue($this->getValue()) . '%');
39
+ }
40
+ }
41
+ }
app/code/community/Zitec/TableRates/Helper/Data.php ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_TableRates_Helper_Data extends Mage_Core_Helper_Abstract
25
+ {
26
+
27
+
28
+ /**
29
+ *
30
+ * @return string
31
+ * @throws Exception
32
+ */
33
+ public function getCarrierCode()
34
+ {
35
+ $carrierCode = Mage::app()->getRequest()->getParam("carrier");
36
+ if (!$carrierCode) {
37
+ throw new Exception("Carrier code not found");
38
+ }
39
+
40
+ return $carrierCode;
41
+ }
42
+
43
+ /**
44
+ *
45
+ * @param string $field
46
+ *
47
+ * @return string
48
+ */
49
+ public function getCarrierConfig($field)
50
+ {
51
+ $path = "carriers/{$this->getCarrierCode()}/zitec_tablerates/$field";
52
+ $value = Mage::getStoreConfig($path);
53
+
54
+ return $value;
55
+ }
56
+
57
+ /**
58
+ *
59
+ * @param string $logicalName
60
+ *
61
+ * @return string
62
+ */
63
+ public function getCarrierConfigDbTableFieldName($logicalName)
64
+ {
65
+ return $this->getCarrierConfig("db_table_field_names/$logicalName");
66
+ }
67
+
68
+ /**
69
+ *
70
+ * @return boolean
71
+ */
72
+ public function supportsPriceVsDest()
73
+ {
74
+ return $this->supportsFeature("price_vs_dest");
75
+ }
76
+
77
+ /**
78
+ *
79
+ * @return boolean
80
+ */
81
+ public function supportsProduct()
82
+ {
83
+ return $this->_getProductSource() ? true : false;
84
+ }
85
+
86
+ /**
87
+ *
88
+ * @return string
89
+ */
90
+ protected function _getProductSource()
91
+ {
92
+ return $this->getCarrierConfig('product_source');
93
+ }
94
+
95
+ /**
96
+ *
97
+ * @return boolean
98
+ */
99
+ public function supportsMarkup()
100
+ {
101
+ return $this->supportsFeature("markup_type");
102
+ }
103
+
104
+ /**
105
+ *
106
+ * @return boolean
107
+ */
108
+ public function supportsCashOnDelivery()
109
+ {
110
+ return $this->supportsFeature('cash_on_delivery');
111
+ }
112
+
113
+ /**
114
+ *
115
+ * @return type
116
+ */
117
+ public function supportsCodMinSurcharge()
118
+ {
119
+ return $this->supportsCashOnDelivery() && $this->supportsFeature('cod_min_surcharge');
120
+ }
121
+
122
+ /**
123
+ *
124
+ * @param string $feature
125
+ *
126
+ * @return boolean
127
+ */
128
+ public function supportsFeature($feature)
129
+ {
130
+ return $this->getCarrierConfig("features/$feature") ? true : false;
131
+ }
132
+
133
+ /**
134
+ *
135
+ * @return string
136
+ */
137
+ public function getGridTitle()
138
+ {
139
+ $gridTitle = $this->getCarrierConfig("grid_title");
140
+
141
+ return $gridTitle ? $this->getCarrierHelper()->__($gridTitle) : $this->__("Zitec Table Rates");
142
+ }
143
+
144
+ /**
145
+ *
146
+ * @return array
147
+ */
148
+ public function getMethodOptions()
149
+ {
150
+ return $this->_optionArrayToValueArray("method_source");
151
+ }
152
+
153
+ /**
154
+ *
155
+ * @return array
156
+ */
157
+ public function getProductOptions()
158
+ {
159
+ return $this->_optionArrayToValueArray("product_source");
160
+ }
161
+
162
+ /**
163
+ *
164
+ * @param string $sourceModel
165
+ *
166
+ * @return type
167
+ */
168
+ protected function _optionArrayToValueArray($sourceConfig)
169
+ {
170
+ $source = $this->getCarrierConfig($sourceConfig);
171
+ if (!$source) {
172
+ $message = __FUNCTION__ . ": $sourceConfig not in carrier's config.xml";
173
+ $this->log($message);
174
+ throw new Exception($message);
175
+ }
176
+ $optionArray = Mage::getModel($source)->toOptionArray(true);
177
+ $options = array();
178
+ foreach ($optionArray as $option) {
179
+ $options[$option['value']] = $option['label'];
180
+ }
181
+
182
+ return $options;
183
+ }
184
+
185
+ /**
186
+ *
187
+ * @return string
188
+ */
189
+ public function getTableratesDbTable()
190
+ {
191
+ return $this->getCarrierConfig("tablerates_db_table");
192
+ }
193
+
194
+ /**
195
+ *
196
+ * @param string &$module
197
+ * @param string &$controller
198
+ * @param string &$action
199
+ *
200
+ * @return type
201
+ */
202
+ public function getExportAction(&$module, &$controller, &$action)
203
+ {
204
+ $exportAction = $this->getCarrierConfig('export_action');
205
+ list($module, $controller, $action) = explode("/", $exportAction);
206
+
207
+ return $exportAction;
208
+ }
209
+
210
+ /**
211
+ *
212
+ * @return boolean
213
+ */
214
+ public function isExportUsingRedirect()
215
+ {
216
+ return $this->getCarrierConfig("export_use_redirect") ? true : false;
217
+ }
218
+
219
+ /**
220
+ *
221
+ * @param string &$resourceClass
222
+ * @param string &$method
223
+ *
224
+ * @return boolean
225
+ */
226
+ public function getImportAction(&$resourceClass, &$method)
227
+ {
228
+ $resourceClass = $this->getCarrierConfig("import/resource_class");
229
+ $method = $this->getCarrierConfig("import/method");
230
+
231
+ return true;
232
+ }
233
+
234
+ /**
235
+ *
236
+ * @return type
237
+ */
238
+ public function getCarrierHelper()
239
+ {
240
+ return Mage::helper('zitec_dpd');
241
+ }
242
+
243
+ /**
244
+ *
245
+ * @param string $message
246
+ *
247
+ * @return \Zitec_TableRates_Helper_Data
248
+ */
249
+ public function log($message)
250
+ {
251
+ Mage::log($message, null, "zitec_tablerates.log");
252
+
253
+ return $this;
254
+ }
255
+
256
+ /**
257
+ *
258
+ * @param string $errorMessage
259
+ *
260
+ * @return boolean
261
+ */
262
+ public function isMySqlDuplicateKeyErrorMessage($errorMessage)
263
+ {
264
+ return strpos($errorMessage, "SQLSTATE[23000]") !== false;
265
+ }
266
+ }
267
+
app/code/community/Zitec/TableRates/Helper/Directory.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_TableRates_Helper_Directory extends Mage_Directory_Helper_Data
25
+ {
26
+
27
+ /**
28
+ * Json representation of regions data
29
+ *
30
+ * @var string
31
+ */
32
+ protected $_regionJson2;
33
+
34
+ public function getRegionJson2()
35
+ {
36
+ if (!$this->_regionJson2) {
37
+ $cacheKey = 'CORE_DIRECTORY_REGIONS_JSON2_STORE' . Mage::app()->getStore()->getId();
38
+ if (Mage::app()->useCache('config')) {
39
+ $json = Mage::app()->loadCache($cacheKey);
40
+ }
41
+ if (empty($json)) {
42
+ $countryIds = array();
43
+ foreach ($this->getCountryCollection() as $country) {
44
+ $countryIds[] = $country->getCountryId();
45
+ }
46
+ $collection = Mage::getModel('directory/region')->getResourceCollection()
47
+ ->addCountryFilter($countryIds)
48
+ ->load();
49
+
50
+ $regions = array(
51
+ 'config' => array(
52
+ 'show_all_regions' => true,
53
+ 'regions_required' => Mage::helper('core')->jsonEncode(array()),
54
+ )
55
+ );
56
+
57
+ foreach ($collection as $region) {
58
+ if (!$region->getRegionId()) {
59
+ continue;
60
+ }
61
+ $regions[$region->getCountryId()][$region->getRegionId()] = array(
62
+ 'code' => $region->getCode(),
63
+ 'name' => $this->__($region->getName())
64
+ );
65
+ }
66
+ $json = Mage::helper('core')->jsonEncode($regions);
67
+ if (Mage::app()->useCache('config')) {
68
+ Mage::app()->saveCache($json, $cacheKey, array('config'));
69
+ }
70
+ }
71
+ $this->_regionJson2 = $json;
72
+ }
73
+
74
+ return $this->_regionJson2;
75
+ }
76
+ }
app/code/community/Zitec/TableRates/Model/Mysql4/Tablerate.php ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_TableRates_Model_Mysql4_Tablerate extends Mage_Core_Model_Mysql4_Abstract
25
+ {
26
+
27
+ /**
28
+ * Initialize resource model
29
+ *
30
+ */
31
+ protected function _construct()
32
+ {
33
+ $this->_init(self::_getHelper()->getTableratesDbTable(), self::getDbTableIdField());
34
+ }
35
+
36
+ /**
37
+ *
38
+ * @param string $field
39
+ * @param mixed $value
40
+ * @param Mage_Core_Model_Abstract $object
41
+ *
42
+ * @return Zend_Db_Select
43
+ */
44
+ protected function _getLoadSelect($field, $value, $object)
45
+ {
46
+ $select = parent::_getLoadSelect($field, $value, $object);
47
+ self::prepareSelectColumns($select, $this->getTable(self::_getHelper()->getTableratesDbTable()));
48
+ $selectStr = (string)$select;
49
+ $this->_getHelper()->log($selectStr);
50
+
51
+ return $select;
52
+ }
53
+
54
+ /**
55
+ *
56
+ * @return string
57
+ */
58
+ public static function getDbTableIdField()
59
+ {
60
+ $map = self::getLogicalDbFieldNamesMap();
61
+
62
+ return self::getDbTableFieldName($map['pk']);
63
+ }
64
+
65
+ /**
66
+ * You may tablerates table for shipping method has a column whose name is distanto than normal for extensions.
67
+ * Must set up the columns and in the config shipping method.
68
+ * Eg the id column is usually called 'pk' but if something else (eg "entity_id"
69
+ * will in the config module shipping method this:
70
+ * carriers / carrier_code / zitec_tablerates / db_table_field_names / pk / entity_id
71
+ *
72
+ *
73
+ * @param string $logicalName
74
+ *
75
+ * @return string
76
+ */
77
+ public static function getDbTableFieldName($logicalName)
78
+ {
79
+ $mappedFieldName = self::_getHelper()->getCarrierConfigDbTableFieldName($logicalName);
80
+
81
+ return $mappedFieldName ? $mappedFieldName : $logicalName;
82
+ }
83
+
84
+ /**
85
+ *
86
+ * @return array
87
+ */
88
+ public static function getLogicalDbFieldNames()
89
+ {
90
+ return array(
91
+ 'pk',
92
+ 'website_id',
93
+ 'dest_country_id',
94
+ 'dest_region_id',
95
+ 'dest_zip',
96
+ 'weight_price',
97
+ 'price_vs_dest',
98
+ 'price',
99
+ 'method',
100
+ 'product',
101
+ 'markup_type',
102
+ 'cashondelivery_surcharge',
103
+ 'cod_min_surcharge'
104
+ );
105
+ }
106
+
107
+ /**
108
+ *
109
+ * @return array
110
+ */
111
+ public static function getLogicalDbFieldNamesMap()
112
+ {
113
+ $map = array();
114
+ foreach (self::getLogicalDbFieldNames() as $logicalName) {
115
+ $map[$logicalName] = self::getDbTableFieldName($logicalName);
116
+ }
117
+
118
+ return $map;
119
+ }
120
+
121
+ /**
122
+ *
123
+ * @param Zend_Db_Select $select
124
+ *
125
+ * @return \Zend_Db_Select
126
+ */
127
+ public static function prepareSelectColumns(Zend_Db_Select $select, $table = 'main_table')
128
+ {
129
+ $map = self::getLogicalDbFieldNamesMap();
130
+
131
+ $pricePercentageColName = $map['price'];
132
+ if (self::_getHelper()->supportsMarkup()) {
133
+ $markupColumnName = $map['markup_type'];
134
+ $select->columns(array('shipping_price' => new Zend_Db_Expr("IF ({$table}.{$markupColumnName} = '0', {$table}.{$pricePercentageColName}, NULL)")));
135
+ $select->columns(array('shipping_percentage' => new Zend_Db_Expr("IF ({$table}.{$markupColumnName} = '1', {$table}.{$pricePercentageColName}, NULL)")));
136
+ $select->columns(array('shipping_price_grid' => new Zend_Db_Expr("IF ({$table}.{$markupColumnName} = '0' and {$table}.{$pricePercentageColName} >= 0, {$table}.{$pricePercentageColName}, NULL)")));
137
+ $select->columns(array('shipping_percentage_grid' => new Zend_Db_Expr("IF ({$table}.{$markupColumnName} = '1' and {$table}.{$pricePercentageColName} >= 0, {$table}.{$pricePercentageColName}, NULL)")));
138
+ $select->columns(array('addition_amount_grid' => new Zend_Db_Expr("IF ({$table}.{$markupColumnName} = '2' and {$table}.{$pricePercentageColName} >= 0, {$table}.{$pricePercentageColName}, NULL)")));
139
+ } else {
140
+
141
+ $select->columns(array('shipping_price' => "{$table}.{$pricePercentageColName}"));
142
+ $select->columns(array('shipping_percentage' => null));
143
+ $select->columns(array('shipping_price_grid' => new Zend_Db_Expr("IF({$table}.{$pricePercentageColName} >= 0, {$table}.{$pricePercentageColName}, NULL)")));
144
+ $select->columns(array('shipping_percentage_grid' => null));
145
+ $select->columns(array('addition_amount_grid' => null));
146
+
147
+ }
148
+
149
+ $select->columns(array('is_enabled_grid' => new Zend_Db_Expr("IF ({$table}.{$pricePercentageColName} >= 0, 1, 0)")));
150
+
151
+ $weightPriceColName = $map['weight_price'];
152
+ if (self::_getHelper()->supportsPriceVsDest()) {
153
+ $priceVsDestColName = $map['price_vs_dest'];
154
+ $select->columns(array('weight_and_above' => new Zend_Db_Expr("IF ({$table}.{$priceVsDestColName} = '0' , {$table}.{$weightPriceColName}, NULL)")));
155
+ $select->columns(array('price_and_above' => new Zend_Db_Expr("IF ({$table}.{$priceVsDestColName} <> '0' , {$table}.{$weightPriceColName}, NULL)")));
156
+ } else {
157
+ $select->columns(array('weight_and_above' => "{$table}.{$weightPriceColName}"));
158
+ $select->columns(array('price_and_above' => null));
159
+ }
160
+
161
+ if (self::_getHelper()->supportsCashOnDelivery()) {
162
+ $cashOnDeliverySurchargeColName = $map['cashondelivery_surcharge'];
163
+ $select->columns(array('cod_surcharge_price' => new Zend_Db_Expr("IF(not ISNULL({$table}.{$cashOnDeliverySurchargeColName}) and RIGHT({$table}.{$cashOnDeliverySurchargeColName}, 1) <> '%' , CAST({$table}.{$cashOnDeliverySurchargeColName} AS DECIMAL(10,2)), NULL) ")));
164
+ $select->columns(array('cod_surcharge_percentage' => new Zend_Db_Expr("IF(RIGHT({$table}.{$cashOnDeliverySurchargeColName}, 1) = '%', CAST(LEFT({$table}.{$cashOnDeliverySurchargeColName}, LENGTH({$table}.{$cashOnDeliverySurchargeColName}) - 1) AS DECIMAL(10,2)), NULL)")));
165
+ } else {
166
+ $select->columns(array('cod_surcharge_price' => null, 'cod_surcharge_percentage' => null));
167
+ }
168
+
169
+ return $select;
170
+ }
171
+
172
+ /**
173
+ *
174
+ * @return Zitec_TableRates_Helper_Data
175
+ */
176
+ protected static function _getHelper()
177
+ {
178
+ return Mage::helper('zitec_tablerates');
179
+ }
180
+
181
+ }
app/code/community/Zitec/TableRates/Model/Mysql4/Tablerate/Collection.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_TableRates_Model_Mysql4_Tablerate_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
25
+ {
26
+
27
+ /**
28
+ *
29
+ * @var array
30
+ */
31
+ protected $_map = null;
32
+
33
+ /**
34
+ * directory/country table name
35
+ *
36
+ * @var string
37
+ */
38
+ protected $_countryTable;
39
+
40
+ /**
41
+ * directory/country_region table name
42
+ *
43
+ * @var string
44
+ */
45
+ protected $_regionTable;
46
+
47
+ /**
48
+ * Constructor
49
+ */
50
+
51
+ /**
52
+ * Define resource model
53
+ *
54
+ */
55
+ protected function _construct()
56
+ {
57
+ $this->_map = Zitec_TableRates_Model_Mysql4_Tablerate::getLogicalDbFieldNamesMap();
58
+ $this->_init('zitec_tablerates/tablerate');
59
+ $this->_countryTable = $this->getTable('directory/country');
60
+ $this->_regionTable = $this->getTable('directory/country_region');
61
+ }
62
+
63
+ /**
64
+ * Initialize select, add country iso3 code and region name
65
+ *
66
+ * @return void
67
+ */
68
+ public function _initSelect()
69
+ {
70
+ parent::_initSelect();
71
+ Zitec_TableRates_Model_Mysql4_Tablerate::prepareSelectColumns($this->_select);
72
+
73
+ $this->_select->joinLeft(
74
+ array('country_table' => $this->_countryTable), "country_table.country_id = main_table.{$this->_map['dest_country_id']}", array('dest_country' => 'iso2_code'))
75
+ ->joinLeft(
76
+ array('region_table' => $this->_regionTable), "region_table.region_id = main_table.{$this->_map['dest_region_id']}", array('dest_region' => 'code', 'dest_region_name' => 'default_name'));
77
+
78
+ $select = (string)$this->_select;
79
+ $this->_getHelper()->log($select);
80
+ }
81
+
82
+
83
+ /**
84
+ *
85
+ * @return Zitec_TableRates_Helper_Data
86
+ */
87
+ protected function _getHelper()
88
+ {
89
+ return Mage::helper('zitec_tablerates');
90
+ }
91
+
92
+ }
app/code/community/Zitec/TableRates/Model/Source/Website.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_TableRates_Model_Source_Website
25
+ {
26
+
27
+ /**
28
+ *
29
+ * @return array
30
+ */
31
+ public function getWebsites()
32
+ {
33
+ $websiteOptions = array();
34
+ foreach (Mage::getModel('core/website')->getCollection() as $website) {
35
+ $websiteOptions[$website->getId()] = $website->getName();
36
+ }
37
+
38
+ return $websiteOptions;
39
+ }
40
+
41
+ /**
42
+ *
43
+ * @return array
44
+ */
45
+ public function toOptionArray()
46
+ {
47
+ $options = array();
48
+ foreach ($this->getWebsites() as $value => $name) {
49
+ $options[] = array('label' => $name, 'value' => $value);
50
+ }
51
+
52
+ return $options;
53
+ }
54
+ }
55
+
app/code/community/Zitec/TableRates/Model/Tablerate.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_TableRates_Model_Tablerate extends Mage_Core_Model_Abstract
25
+ {
26
+ const COD_NOT_AVAILABLE = 0;
27
+ const COD_SURCHARGE_ZERO = 1;
28
+ const COD_SURCHARGE_FIXED = 2;
29
+ const COD_SURCHARGE_PERCENTAGE = 3;
30
+
31
+ /**
32
+ *
33
+ * @var array
34
+ */
35
+ protected $_map = null;
36
+
37
+ public function _construct()
38
+ {
39
+ parent::_construct();
40
+ $this->_map = Zitec_TableRates_Model_Mysql4_Tablerate::getLogicalDbFieldNamesMap();
41
+ $this->_init('zitec_tablerates/tablerate');
42
+ }
43
+
44
+ /**
45
+ *
46
+ * @param string $logicalFieldName
47
+ *
48
+ * @return mixed
49
+ */
50
+ public function getMappedData($logicalFieldName)
51
+ {
52
+ return $this->getData($this->getMappedName($logicalFieldName));
53
+ }
54
+
55
+ /**
56
+ *
57
+ * @param string $logicalFieldName
58
+ *
59
+ * @return string
60
+ * @throws Exception
61
+ */
62
+ public function getMappedName($logicalFieldName)
63
+ {
64
+ if (isset($this->_map[$logicalFieldName])) {
65
+ return $this->_map[$logicalFieldName];
66
+ } else {
67
+ throw new Exception("Invalid logical field name $logicalFieldName");
68
+ }
69
+ }
70
+
71
+ /**
72
+ *
73
+ * @return int
74
+ */
75
+ public function getCashOnDeliverySurchargeOption()
76
+ {
77
+ if (is_null($this->getMappedData('cashondelivery_surcharge'))) {
78
+ return self::COD_NOT_AVAILABLE;
79
+ } elseif (round($this->getData('cod_surcharge_price'), 2) > 0) {
80
+ return self::COD_SURCHARGE_FIXED;
81
+ } elseif (round($this->getData('cod_surcharge_percentage'), 2) > 0) {
82
+ return self::COD_SURCHARGE_PERCENTAGE;
83
+ } else {
84
+ return self::COD_SURCHARGE_ZERO;
85
+ }
86
+ }
87
+
88
+
89
+ }
app/code/community/Zitec/TableRates/controllers/Adminhtml/IndexController.php ADDED
@@ -0,0 +1,462 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ /**
19
+ *
20
+ * @category Zitec
21
+ * @package Zitec_Dpd
22
+ * @author Zitec COM <magento@zitec.ro>
23
+ */
24
+ class Zitec_TableRates_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action
25
+ {
26
+
27
+ /**
28
+ *
29
+ * @return array
30
+ */
31
+ protected function _getMap()
32
+ {
33
+ return Zitec_TableRates_Model_Mysql4_Tablerate::getLogicalDbFieldNamesMap();
34
+ }
35
+
36
+ protected function _initTablerate($idFieldName = 'tablerate_id')
37
+ {
38
+ $this->_title($this->__('DPD Table Rate'))
39
+ ->_title($this->_getTableRateHelper()->getGridTitle());
40
+
41
+ $tablerateId = (int)$this->getRequest()->getParam($idFieldName);
42
+
43
+ $tablerate = Mage::getModel('zitec_tablerates/tablerate');
44
+
45
+ if ($tablerateId) {
46
+ $tablerate->load($tablerateId);
47
+ }
48
+
49
+ Mage::register('tablerate_data', $tablerate);
50
+ Mage::register('current_tablerate', $tablerate);
51
+
52
+ return $this;
53
+ }
54
+
55
+ /**
56
+ *
57
+ * @return \Zitec_TableRates_Adminhtml_IndexController
58
+ */
59
+ protected function _initAction()
60
+ {
61
+ $this->loadLayout()->_setActiveMenu("zitec_dpd/zitec_tablerates/{$this->_getCarrierCode()}");
62
+
63
+ return $this;
64
+ }
65
+
66
+ /**
67
+ *
68
+ * @return string
69
+ */
70
+ protected function _getCarrierCode()
71
+ {
72
+ return $this->_getTableRateHelper()->getCarrierCode();
73
+ }
74
+
75
+ /**
76
+ *
77
+ * @return Zitec_TableRates_Helper_Data
78
+ */
79
+ protected function _getTableRateHelper()
80
+ {
81
+ return Mage::helper('zitec_tablerates');
82
+ }
83
+
84
+ public function indexAction()
85
+ {
86
+ if (!$this->_checkCarrierCode()) {
87
+ return;
88
+ }
89
+
90
+ $this->_initAction()
91
+ ->renderLayout();
92
+ }
93
+
94
+ public function gridAction()
95
+ {
96
+ if (!$this->_checkCarrierCode()) {
97
+ return;
98
+ }
99
+
100
+ $this->getResponse()->setBody(
101
+ $this->getLayout()->createBlock('zitec_tablerates/adminhtml_tablerate_grid')->toHtml()
102
+ );
103
+ }
104
+
105
+ public function newAction()
106
+ {
107
+ if (!$this->_checkCarrierCode()) {
108
+ return;
109
+ }
110
+ Mage::getSingleton('adminhtml/session')->setTablerateData(false);
111
+ $this->_forward('edit');
112
+ }
113
+
114
+ public function editAction()
115
+ {
116
+ if (!$this->_checkCarrierCode()) {
117
+ return;
118
+ }
119
+
120
+ $this->_initTablerate();
121
+ $this->loadLayout();
122
+
123
+ /* @var $store Zitec_SeurMfCustom_Model_Tablerate */
124
+ $tablerate = Mage::registry('current_tablerate');
125
+
126
+ $this->_title($tablerate->getTablerateId() ? implode(', ', array($tablerate->getDestCountryId(), $tablerate->getDestRegionId(), $tablerate->getDestZip())) : $this->__('New Rate'));
127
+
128
+ /**
129
+ * Set active menu item
130
+ */
131
+ $this->_setActiveMenu("zitec_dpd/{$this->_getTableRateHelper()->getCarrierCode()}");
132
+
133
+ $this->renderLayout();
134
+ }
135
+
136
+ public function importAction()
137
+ {
138
+ if (!$this->_checkCarrierCode()) {
139
+ return;
140
+ }
141
+
142
+ $this->loadLayout();
143
+
144
+ $this->_title($this->__('Import Rates'));
145
+
146
+ /**
147
+ * Set active menu item
148
+ */
149
+ $this->_setActiveMenu("zitec_dpd/{$this->_getTableRateHelper()->getCarrierCode()}");
150
+
151
+ $this->renderLayout();
152
+ }
153
+
154
+ public function exportAction()
155
+ {
156
+ if (!$this->_checkCarrierCode()) {
157
+ return;
158
+ }
159
+
160
+ $this->loadLayout();
161
+
162
+ $this->_title($this->__('Export Rates'));
163
+
164
+ /**
165
+ * Set active menu item
166
+ */
167
+ $this->_setActiveMenu("zitec_dpd/{$this->_getTableRateHelper()->getCarrierCode()}");
168
+
169
+ $this->renderLayout();
170
+ }
171
+
172
+ /**
173
+ *
174
+ * @param Zitec_TableRates_Model_Tablerate $tablerate
175
+ * @param array $data
176
+ *
177
+ * @return boolean
178
+ */
179
+ protected function _prepareSaveData(Zitec_TableRates_Model_Tablerate $tablerate, array $data)
180
+ {
181
+ if (isset($data['pk']) && !$data['pk']) {
182
+ unset($data['pk']);
183
+ }
184
+
185
+ $data['dest_zip'] = isset($data['dest_zip']) && $data['dest_zip'] != '*' ? $data['dest_zip'] : '';
186
+
187
+ if (!$this->_getTableRateHelper()->supportsProduct() && isset($data['product'])) {
188
+ unset($data['product']);
189
+ }
190
+
191
+ if ($this->_getTableRateHelper()->supportsPriceVsDest()) {
192
+ $data['price_vs_dest'] = isset($data['price_vs_dest']) ? $data['price_vs_dest'] : '0';
193
+ } elseif (isset($data['price_vs_dest'])) {
194
+ unset($data['price_vs_dest']);
195
+ }
196
+
197
+ $data['weight_price'] = isset($data['weight_price']) && trim($data['weight_price']) ? $data['weight_price'] : '0';
198
+
199
+ if (!isset($data['shipping_method_enabled']) || $data['shipping_method_enabled']) {
200
+ if ($this->_getTableRateHelper()->supportsCashOnDelivery()) {
201
+ if (!isset($data['cod_option'])) {
202
+ $data['cod_option'] = Zitec_TableRates_Model_Tablerate::COD_NOT_AVAILABLE;
203
+ }
204
+ switch ($data['cod_option']) {
205
+ case Zitec_TableRates_Model_Tablerate::COD_NOT_AVAILABLE:
206
+ $data['cashondelivery_surcharge'] = null;
207
+ if ($this->_getTableRateHelper()->supportsCodMinSurcharge()) {
208
+ $data['cod_min_surcharge'] = null;
209
+ }
210
+ break;
211
+ case Zitec_TableRates_Model_Tablerate::COD_SURCHARGE_ZERO:
212
+ $data['cashondelivery_surcharge'] = '0';
213
+ if ($this->_getTableRateHelper()->supportsCodMinSurcharge()) {
214
+ $data['cod_min_surcharge'] = null;
215
+ }
216
+ break;
217
+ case Zitec_TableRates_Model_Tablerate::COD_SURCHARGE_FIXED:
218
+ if (!isset($data['cashondelivery_surcharge']) || !trim($data['cashondelivery_surcharge'])) {
219
+ $data['cashondelivery_surcharge'] = '0';
220
+ }
221
+ if ($this->_getTableRateHelper()->supportsCodMinSurcharge()) {
222
+ $data['cod_min_surcharge'] = null;
223
+ }
224
+ break;
225
+ case Zitec_TableRates_Model_Tablerate::COD_SURCHARGE_PERCENTAGE:
226
+ if (!isset($data['cashondelivery_surcharge']) || !trim($data['cashondelivery_surcharge'])) {
227
+ $data['cashondelivery_surcharge'] = '0';
228
+ }
229
+ $data['cashondelivery_surcharge'] = $data['cashondelivery_surcharge'] ? $data['cashondelivery_surcharge'] . '%' : '0';
230
+ if ($this->_getTableRateHelper()->supportsCodMinSurcharge()) {
231
+ $data['cod_min_surcharge'] = isset($data['cod_min_surcharge']) && trim($data['cod_min_surcharge']) ? $data['cod_min_surcharge'] : null;
232
+ }
233
+ break;
234
+ default:
235
+ $data['cashondelivery_surcharge'] = null;
236
+ if ($this->_getTableRateHelper()->supportsCodMinSurcharge()) {
237
+ $data['cod_min_surcharge'] = null;
238
+ }
239
+ }
240
+ }
241
+ } else {
242
+ if ($this->_getTableRateHelper()->supportsMarkup()) {
243
+ $data['markup_type'] = '0';
244
+ }
245
+ $data['price'] = -1;
246
+ if ($this->_getTableRateHelper()->supportsCashOnDelivery()) {
247
+ $data['cashondelivery_surcharge'] = null;
248
+ }
249
+ if ($this->_getTableRateHelper()->supportsCodMinSurcharge()) {
250
+ $data['cod_min_surcharge'] = null;
251
+ }
252
+ }
253
+
254
+ if (isset($data['shipping_method_enabled'])) {
255
+ unset($data['shipping_method_enabled']);
256
+ }
257
+
258
+ if (!$this->_getTableRateHelper()->supportsMarkup() && isset($data['markup_type'])) {
259
+ unset($data['markup_type']);
260
+ }
261
+
262
+
263
+ if (isset($data['cod_option'])) {
264
+ unset($data['cod_option']);
265
+ }
266
+
267
+ if (!$this->_getTableRateHelper()->supportsCashOnDelivery() && isset($data['cashondelivery_surcharge'])) {
268
+ unset($data['cashondelivery_surcharge']);
269
+ }
270
+
271
+ if (!$this->_getTableRateHelper()->supportsCodMinSurcharge() && isset($data['cod_min_surcharge'])) {
272
+ unset($data['cod_min_surcharge']);
273
+ }
274
+
275
+
276
+ $saveData = array();
277
+ foreach ($this->_getMap() as $logicalName => $dbFieldName) {
278
+ $saveData[$dbFieldName] = isset($data[$logicalName]) ? $data[$logicalName] : null;
279
+ }
280
+
281
+ $tablerate->setData($saveData);
282
+
283
+ return true;
284
+ }
285
+
286
+ public function saveAction()
287
+ {
288
+ if (!$this->_checkCarrierCode()) {
289
+ return;
290
+ }
291
+
292
+ $data = $this->getRequest()->getPost();
293
+ if ($data) {
294
+ if ($this->getRequest()->getParam("duplicate") && isset($data['pk'])) {
295
+ unset($data['pk']);
296
+ Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Rate duplicated successfully'));
297
+ Mage::getSingleton('adminhtml/session')->setTablerateData($data);
298
+ $this->_redirect("*/*/edit", array("carrier" => $this->_getTableRateHelper()->getCarrierCode()));
299
+
300
+ return;
301
+ }
302
+
303
+ $tablerate = Mage::getModel('zitec_tablerates/tablerate');
304
+ /* @var $tablerate Zitec_TableRates_Model_Tablerate */
305
+ $this->_prepareSaveData($tablerate, $data);
306
+ try {
307
+ $tablerate->save();
308
+
309
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('zitec_tablerates')->__('Rate was successfully saved'));
310
+ Mage::getSingleton('adminhtml/session')->setTablerateData(false);
311
+
312
+ if ($this->getRequest()->getParam('back')) {
313
+ $this->_redirect('*/*/edit', array('tablerate_id' => $tablerate->getTablerateId(), "carrier" => $this->_getTableRateHelper()->getCarrierCode()));
314
+
315
+ return;
316
+ }
317
+ $this->_redirect('*/*/', array("carrier" => $this->_getTableRateHelper()->getCarrierCode()));
318
+
319
+ return;
320
+ } catch (Exception $e) {
321
+ if ($this->_getTableRateHelper()->isMySqlDuplicateKeyErrorMessage($e->getMessage())) {
322
+ $message = $this->__("The rate could not be saved because it duplicates the destination, service/product and weight/price of an existing rate. Change some of the rate's values and try saving again.");
323
+ } else {
324
+ $message = $e->getMessage();
325
+ }
326
+ Mage::getSingleton('adminhtml/session')->addError($message);
327
+ Mage::getSingleton('adminhtml/session')->setTablerateData($data);
328
+ $this->_redirect('*/*/edit', array('tablerate_id' => $this->getRequest()->getParam('tablerate_id'), "carrier" => $this->_getTableRateHelper()->getCarrierCode()));
329
+
330
+ return;
331
+ }
332
+ }
333
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('zitec_tablerates')->__('Unable to find rate to save'));
334
+ $this->_redirect('*/*/', array("carrier" => $this->_getTableRateHelper()->getCarrierCode()));
335
+ }
336
+
337
+
338
+ public function deleteAction()
339
+ {
340
+ if (!$this->_checkCarrierCode()) {
341
+ return;
342
+ }
343
+
344
+ $tablerateId = $this->getRequest()->getParam('tablerate_id');
345
+ if ($tablerateId > 0) {
346
+ try {
347
+ $model = Mage::getModel('zitec_tablerates/tablerate')->load($tablerateId);
348
+ $model->delete();
349
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Rate was successfully deleted'));
350
+ $this->_redirect('*/*/', array('tablerate_id' => $this->getRequest()->getParam('tablerate_id'), "carrier" => $this->_getTableRateHelper()->getCarrierCode()));
351
+ } catch (Exception $e) {
352
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
353
+ $this->_redirect('*/*/edit', array('tablerate_id' => $this->getRequest()->getParam('tablerate_id'), "carrier" => $this->_getTableRateHelper()->getCarrierCode()));
354
+ }
355
+ }
356
+ $this->_redirect('*/*/', array("carrier" => $this->_getTableRateHelper()->getCarrierCode()));
357
+ }
358
+
359
+ public function massDeleteAction()
360
+ {
361
+ if (!$this->_checkCarrierCode()) {
362
+ return;
363
+ }
364
+
365
+ $Ids = (array)$this->getRequest()->getParam('tablerates');
366
+ try {
367
+ foreach ($Ids as $id) {
368
+ $result = Mage::getModel('zitec_tablerates/tablerate')->load($id);
369
+ $result->delete();
370
+ }
371
+ $this->_getSession()->addSuccess(
372
+ $this->__('Total of %d record(s) have been deleted.', count($Ids))
373
+ );
374
+ } catch (Mage_Core_Model_Exception $e) {
375
+ $this->_getSession()->addError($e->getMessage());
376
+ } catch (Mage_Core_Exception $e) {
377
+ $this->_getSession()->addError($e->getMessage());
378
+ } catch (Exception $e) {
379
+ $this->_getSession()->addException($e, $this->__('An error occurred while updating records.'));
380
+ }
381
+ $this->_redirect('*/*/', array("carrier" => $this->_getTableRateHelper()->getCarrierCode()));
382
+ }
383
+
384
+ public function importratesAction()
385
+ {
386
+ if (!$this->_checkCarrierCode()) {
387
+ return;
388
+ }
389
+
390
+ $websiteId = $this->getRequest()->getParam('website_id');
391
+ $csvFile = !empty($_FILES['import']['tmp_name']) ? $_FILES['import']['tmp_name'] : null;
392
+ if (!$websiteId || !$csvFile) {
393
+ $this->_getSession()->addError($this->__("Please specify the website and file you wish to import"));
394
+ $this->_redirect('*/*/import', array("carrier" => $this->_getTableRateHelper()->getCarrierCode()));
395
+
396
+ return;
397
+ }
398
+
399
+ $params = new Varien_Object();
400
+ $params->setScopeId($websiteId);
401
+
402
+ $resourceClass = null;
403
+ $method = null;
404
+ $this->_getTableRateHelper()->getImportAction($resourceClass, $method);
405
+
406
+ $message = "";
407
+ try {
408
+ Mage::getResourceModel($resourceClass)->$method($params, $csvFile);
409
+ } catch (Mage_Core_Exception $e) {
410
+ $message = $e->getMessage();
411
+ } catch (Exception $e) {
412
+ $this->_getSession()->addError($this->__("An error occurred whilst importing the tablerates: %s", $e->getMessage()));
413
+ $this->_redirect('*/*/import', array("carrier" => $this->_getTableRateHelper()->getCarrierCode()));
414
+
415
+ return;
416
+ }
417
+ if (!$message) {
418
+ $message = $this->__("Table rates imported successfully");
419
+ $this->_getSession()->addSuccess($message);
420
+ } else {
421
+ $this->_getSession()->addError(str_replace("\n", "<br />", $message));
422
+ }
423
+ $this->_redirect('*/*/index', array("carrier" => $this->_getTableRateHelper()->getCarrierCode()));
424
+ }
425
+
426
+ public function exportratesAction()
427
+ {
428
+ $websiteId = $this->getRequest()->getParam('website_id');
429
+ if (!$websiteId) {
430
+ $this->_getSession()->addError($this->__("Please specify the website whose rates you want to export"));
431
+ $this->_redirect('*/*/export', array("carrier" => $this->_getTableRateHelper()->getCarrierCode()));
432
+
433
+ return;
434
+ }
435
+ $module = null;
436
+ $controller = null;
437
+ $action = null;
438
+ $exportAction = $this->_getTableRateHelper()->getExportAction($module, $controller, $action);
439
+ $params = array('website' => $websiteId);
440
+ if (!$this->_getTableRateHelper()->isExportUsingRedirect()) {
441
+ $this->_forward($action, $controller, $module, $params);
442
+ } else {
443
+ $this->_redirect($exportAction, $params);
444
+ }
445
+
446
+ }
447
+
448
+ /**
449
+ * @return boolean
450
+ */
451
+ protected function _checkCarrierCode()
452
+ {
453
+ try {
454
+ $this->_getTableRateHelper()->getCarrierCode();
455
+ } catch (Exception $e) {
456
+ return false;
457
+ }
458
+
459
+ return true;
460
+ }
461
+
462
+ }
app/code/community/Zitec/TableRates/etc/adminhtml.xml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <acl>
3
+ <resources>
4
+ <all>
5
+ <title>Allow Everything</title>
6
+ </all>
7
+ <admin>
8
+ <children>
9
+ <promo>
10
+ <children>
11
+ <zitec_tablerates translate="title" module="zitec_tablerates">
12
+ <title>DPD Table Rates</title>
13
+ <sort_order>500</sort_order>
14
+ </zitec_tablerates>
15
+ </children>
16
+ </promo>
17
+ </children>
18
+ </admin>
19
+ </resources>
20
+ </acl>
21
+ </config>
app/code/community/Zitec/TableRates/etc/config.xml ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Zitec_TableRates>
5
+ <version>0.1.0</version>
6
+ </Zitec_TableRates>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <zitec_tablerates>
11
+ <class>Zitec_TableRates_Model</class>
12
+ <resourceModel>zitec_tablerates_mysql4</resourceModel>
13
+ </zitec_tablerates>
14
+ <zitec_tablerates_mysql4>
15
+ <class>Zitec_TableRates_Model_Mysql4</class>
16
+ </zitec_tablerates_mysql4>
17
+ </models>
18
+ <resources>
19
+ <zitec_tablerates_write>
20
+ <connection>
21
+ <use>core_write</use>
22
+ </connection>
23
+ </zitec_tablerates_write>
24
+ <zitec_tablerates_read>
25
+ <connection>
26
+ <use>core_read</use>
27
+ </connection>
28
+ </zitec_tablerates_read>
29
+ </resources>
30
+ <blocks>
31
+ <zitec_tablerates>
32
+ <class>Zitec_TableRates_Block</class>
33
+ </zitec_tablerates>
34
+ </blocks>
35
+ <helpers>
36
+ <zitec_tablerates>
37
+ <class>Zitec_TableRates_Helper</class>
38
+ </zitec_tablerates>
39
+ </helpers>
40
+ </global>
41
+ <adminhtml>
42
+ <translate>
43
+ <modules>
44
+ <Zitec_TableRates>
45
+ <files>
46
+ <default>Zitec_TableRates.csv</default>
47
+ </files>
48
+ </Zitec_TableRates>
49
+ </modules>
50
+ </translate>
51
+
52
+ <layout>
53
+ <updates>
54
+ <zitec_tablerates>
55
+ <file>zitec_tablerates.xml</file>
56
+ </zitec_tablerates>
57
+ </updates>
58
+ </layout>
59
+ </adminhtml>
60
+ <frontend>
61
+ <layout>
62
+ <updates>
63
+ <zitec_tablerates>
64
+ <file>zitec_tablerates.xml</file>
65
+ </zitec_tablerates>
66
+ </updates>
67
+ </layout>
68
+ <translate>
69
+ <modules>
70
+ <Zitec_TableRates>
71
+ <files>
72
+ <default>Zitec_TableRates_frontend.csv</default>
73
+ </files>
74
+ </Zitec_TableRates>
75
+ </modules>
76
+ </translate>
77
+ </frontend>
78
+ <admin>
79
+ <routers>
80
+ <zitec_tablerates>
81
+ <use>admin</use>
82
+ <args>
83
+ <module>Zitec_TableRates</module>
84
+ <frontName>zitec_tablerates</frontName>
85
+ </args>
86
+ </zitec_tablerates>
87
+ </routers>
88
+ </admin>
89
+ <frontend>
90
+ <routers>
91
+ <zitec_tablerates>
92
+ <use>standard</use>
93
+ <args>
94
+ <module>Zitec_TableRates</module>
95
+ <frontName>zitec_tablerates</frontName>
96
+ </args>
97
+ </zitec_tablerates>
98
+ </routers>
99
+ </frontend>
100
+
101
+ </config>
app/design/adminhtml/default/default/layout/zitec_dpd.xml ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <layout>
3
+ <adminhtml_sales_order_create_index>
4
+ <reference name="head">
5
+ <action method="addJs"><script>zitec/dpd/admin/sales.js</script></action>
6
+ </reference>
7
+ </adminhtml_sales_order_create_index>
8
+
9
+ <adminhtml_sales_order_shipment_view>
10
+ <reference name="shipment_tracking" >
11
+ <action method="setTemplate">
12
+ <template helper="zitec_dpd/layout/getAdminhtmlTrackingTemplate" />
13
+ </action>
14
+ </reference>
15
+ </adminhtml_sales_order_shipment_view>
16
+ <adminhtml_sales_shipment_index>
17
+ <reference name="head">
18
+ <action method="addItem"><type>skin_css</type><name>zitec_dpd/zitec_dpd.css</name></action>
19
+ </reference>
20
+ </adminhtml_sales_shipment_index>
21
+
22
+ <shipping_tracking_popup translate="label">
23
+ <reference name="shipping.tracking.popup">
24
+ <action method="setTemplate"><template helper="zitec_dpd/layout/changeShippingTrackingPopupTemplate" /></action>
25
+ </reference>
26
+ </shipping_tracking_popup>
27
+
28
+ <adminhtml_sales_order_view>
29
+ <reference name="order_totals">
30
+ <block type="zitec_dpd/order_totals_cashondeliverysurchage" />
31
+ </reference>
32
+ </adminhtml_sales_order_view>
33
+
34
+ <adminhtml_sales_order_invoice_view>
35
+ <reference name="invoice_totals">
36
+ <block type="zitec_dpd/order_invoice_totals_cashondeliverysurcharge" />
37
+ </reference>
38
+ </adminhtml_sales_order_invoice_view>
39
+
40
+ <adminhtml_sales_order_invoice_new>
41
+ <reference name="invoice_totals">
42
+ <block type="zitec_dpd/order_invoice_totals_cashondeliverysurcharge" />
43
+ </reference>
44
+ </adminhtml_sales_order_invoice_new>
45
+
46
+ <adminhtml_sales_order_invoice_new>
47
+ <reference name="invoice_totals">
48
+ <block type="zitec_dpd/order_invoice_totals_cashondeliverysurcharge" />
49
+ </reference>
50
+ </adminhtml_sales_order_invoice_new>
51
+
52
+ <adminhtml_sales_order_invoice_updateqty>
53
+ <reference name="invoice_totals">
54
+ <block type="zitec_dpd/order_totals_cashondeliverysurchage" />
55
+ </reference>
56
+ </adminhtml_sales_order_invoice_updateqty>
57
+
58
+ <adminhtml_sales_order_creditmemo_view>
59
+ <reference name="creditmemo_totals">
60
+ <block type="zitec_dpd/order_creditmemo_totals_cashondeliverysurcharge" />
61
+ </reference>
62
+ </adminhtml_sales_order_creditmemo_view>
63
+
64
+ <adminhtml_sales_order_creditmemo_new>
65
+ <reference name="creditmemo_totals">
66
+ <block type="zitec_dpd/adminhtml_order_totals_cashondeliverysurcharge_newcreditmemo" />
67
+ </reference>
68
+ </adminhtml_sales_order_creditmemo_new>
69
+
70
+ <adminhtml_sales_order_creditmemo_updateqty>
71
+ <reference name="creditmemo_totals">
72
+ <block type="zitec_dpd/adminhtml_order_totals_cashondeliverysurcharge_newcreditmemo" />
73
+ </reference>
74
+ </adminhtml_sales_order_creditmemo_updateqty>
75
+
76
+ <adminhtml_sales_order_address>
77
+ <reference name="head">
78
+ <action method="addJs"><script>zitec_fieldlengths/validator.js</script></action>
79
+ <action method="addJs"><script>zitec/dpd/admin/PostcodeAutocompleter.js</script></action>
80
+ </reference>
81
+ <reference name="before_body_end">
82
+ <block name="zitec_addresslength" type="zitec_dpd/adminhtml_sales_order_address_form_addresslength" />
83
+ </reference>
84
+ </adminhtml_sales_order_address>
85
+
86
+
87
+ <adminhtml_customer_edit>
88
+ <reference name="head">
89
+ <action method="addJs"><script>zitec_fieldlengths/validator.js</script></action>
90
+ </reference>
91
+ </adminhtml_customer_edit>
92
+
93
+
94
+ </layout>
app/design/adminhtml/default/default/layout/zitec_packedshipment.xml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <layout>
3
+ <adminhtml_sales_order_shipment_new>
4
+ <reference name="head">
5
+ <action method="addJs">
6
+ <script>zitec_packedshipment/packedshipment.js</script>
7
+ </action>
8
+ <action method="addCss">
9
+ <name>zitec_packedshipment/windows/themes/default.css</name>
10
+ </action>
11
+ <action method="addCss">
12
+ <name>zitec_packedshipment/windows/themes/magento.css</name>
13
+ </action>
14
+ <!-- <action method="addCss"><name>zitec_packedshipment/windows/themes/spread.css</name></action>-->
15
+ <!-- <action method="addCss"><name>zitec_packedshipment/windows/themes/alert.css</name></action>-->
16
+ <!-- <action method="addCss"><name>zitec_packedshipment/windows/themes/alert_lite.css</name></action>-->
17
+ <!-- <action method="addCss"><name>zitec_packedshipment/windows/themes/alphacube.css</name></action>-->
18
+ <!-- <action method="addCss"><name>zitec_packedshipment/windows/themes/debug.css</name></action>-->
19
+
20
+ </reference>
21
+ <reference name="order_items">
22
+ <action method="setTemplate">
23
+ <template helper="zitec_packedshipment/data/changeOrderItemsTemplate" />
24
+ </action>
25
+ </reference>
26
+ <reference name="js">
27
+ <block name="address_validation_info_js" type="zitec_packedshipment/addressvalidationinfojs">
28
+ <action method="setTemplate">
29
+ <template helper="zitec_packedshipment/data/changeAddressValidationJsTemplate" />
30
+ </action>
31
+ </block>
32
+ </reference>
33
+ </adminhtml_sales_order_shipment_new>
34
+ </layout>
app/design/adminhtml/default/default/layout/zitec_shippingreports.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <zitec_shippingreports_adminhtml_reports_profitability_index>
4
+ <reference name="content">
5
+ <block type="zitec_shippingreports/adminhtml_profitability" name="zitec_shippingreports_profitability" />
6
+ </reference>
7
+ </zitec_shippingreports_adminhtml_reports_profitability_index>
8
+ </layout>
app/design/adminhtml/default/default/layout/zitec_tablerates.xml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <layout>
3
+ <zitec_tablerates_adminhtml_index_index>
4
+ <reference name="content">
5
+ <block type="zitec_tablerates/adminhtml_tablerate" name="tablerates">
6
+ <block name="zitec_dpd_export" as="zitec_dpd_export" type="zitec_dpd/adminhtml_system_config_button_export" />
7
+ </block>
8
+ </reference>
9
+ </zitec_tablerates_adminhtml_index_index>
10
+ <zitec_tablerates_adminhtml_index_grid>
11
+ <block type="core/text_list" name="root" output="toHtml">
12
+ </block>
13
+
14
+ </zitec_tablerates_adminhtml_index_grid>
15
+ <zitec_tablerates_adminhtml_index_new>
16
+ <update handle="zitec_tablerates_adminhtml_index_edit"/>
17
+ </zitec_tablerates_adminhtml_index_new>
18
+ <zitec_tablerates_adminhtml_index_edit>
19
+ <update handle="editor"/>
20
+ <reference name="content">
21
+ <block type="zitec_tablerates/adminhtml_tablerate_edit" name="tablerate_edit"></block>
22
+ </reference>
23
+ </zitec_tablerates_adminhtml_index_edit>
24
+
25
+ <zitec_tablerates_adminhtml_index_import>
26
+ <update handle="editor"/>
27
+ <reference name="content">
28
+ <block type="zitec_tablerates/adminhtml_tablerate_import" name="tablerate_edit"></block>
29
+ </reference>
30
+ </zitec_tablerates_adminhtml_index_import>
31
+
32
+ <zitec_tablerates_adminhtml_index_export>
33
+ <update handle="editor"/>
34
+ <reference name="content">
35
+ <block type="zitec_tablerates/adminhtml_tablerate_export" name="tablerate_edit"></block>
36
+ </reference>
37
+ </zitec_tablerates_adminhtml_index_export>
38
+ </layout>
app/design/adminhtml/default/default/template/zitec_dpd/sales/order/address/postcode/alert-problem.phtml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $shippingAddress = $this->getOrder()->getShippingAddress();
3
+ $shippingAddressData = $shippingAddress->getData();
4
+
5
+ $autoPostcode = (!empty($shippingAddressData['auto_postcode'])) ? $shippingAddressData['auto_postcode'] : '';
6
+
7
+ ?>
8
+ <script type="text/javascript">
9
+ var isPostCodeValid = '<?php echo (!empty($shippingAddressData['valid_auto_postcode'])) ? '1': '0'; ?>';
10
+ var postCodeUsedByDPD = '<?php echo $autoPostcode; ?>';
11
+
12
+ if (isPostCodeValid != '1') {
13
+ $$('.head-shipping-address').each(function (el) {
14
+ el.setStyle({
15
+ background: 'red'
16
+ });
17
+ el.up().up().select('fieldset').each(function(el2){
18
+ el2.insert({bottom:'<div class="fieldset" style="color: #ff0000;"> <?php echo $this->__(
19
+ 'DPD shipping carrier detected an other postcode for current address: %s. You can validate this postcode before scheduling deliveries by clicking the edit button.', $autoPostcode
20
+ ); ?> </div>'});
21
+ });
22
+
23
+ });
24
+ }
25
+ </script>
app/design/adminhtml/default/default/template/zitec_dpd/sales/order/address/postcode/validate.phtml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="postcode_autocomplete" class="autocomplete"></div>
2
+ <script type="text/javascript">
3
+ $('postcode').insert ({'before': '<a id="refresh-postcode" href="#refresh-postcode"><?php echo $this->__('DPD - search postcode') ?></a> <span id="postcode_indicator" class="autocomplete-indicator" style="display: none">' +
4
+ '<img src="<?php echo $this->getSkinUrl('images/ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading...') ?>" class="v-middle"/>' +
5
+ '</span>'
6
+ });
7
+ var postcodeAutocompleter = new PostcodeAutocompleter(
8
+ 'postcode',
9
+ 'postcode_autocomplete',
10
+ '<?php echo $this->getUrl('zitec_dpd/adminhtml_shipment/validatePostcode') ?>',
11
+ {
12
+ paramName:"query",
13
+ minChars:2,
14
+ indicator:"postcode_indicator",
15
+ updateElement:getSelectionPostcodeValidateId,
16
+ evalJSON:'force'
17
+ }
18
+ );
19
+
20
+ $('refresh-postcode').observe('click', function(event) {
21
+ console.log(postcodeAutocompleter);
22
+ postcodeAutocompleter.activate();
23
+ });
24
+ function getSelectionPostcodeValidateId(li) {
25
+ $('postcode').setValue(li.getAttribute('postcode'));
26
+ }
27
+
28
+ </script>
29
+ <style type="text/css">
30
+ #postcode_autocomplete ul{
31
+ max-height: 250px;
32
+ overflow-y: scroll;
33
+ }
34
+ #refresh-postcode{
35
+ clear: both;
36
+ display: block;
37
+ }
38
+ </style>
app/design/adminhtml/default/default/template/zitec_dpd/sales/order/address/street/alert-problem.phtml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $shippingAddress = $this->getOrder()->getShippingAddress();
3
+
4
+ $isValidStreet = Mage::helper('zitec_dpd')->checkAddressStreetLength($shippingAddress);
5
+
6
+ ?>
7
+ <script type="text/javascript">
8
+ var isStreetLengthValid = '<?php echo (!empty($isValidStreet)) ? '1': '0'; ?>';
9
+
10
+ if (isStreetLengthValid != '1') {
11
+ $$('.head-shipping-address').each(function (el) {
12
+ el.setStyle({
13
+ background: 'red'
14
+ });
15
+ el.up().up().select('fieldset').each(function(el2){
16
+ el2.insert({bottom:'<div class="fieldset" style="color: #ff0000;"> <?php echo $this->__(
17
+ 'DPD shipping carrier requirements: The length of address provided by your customer is too long. Please provide a maximum 70 characters length address (street field).'
18
+ ); ?> </div>'});
19
+ });
20
+
21
+ });
22
+ }
23
+ </script>
app/design/adminhtml/default/default/template/zitec_dpd/sales/order/shipment/postcode/autocompleter.phtml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $foundAddresses = $this->getFoundAddresses(); ?>
2
+
3
+ <?php if (is_array($foundAddresses) && count($foundAddresses)): ?>
4
+ <ul>
5
+ <?php foreach($foundAddresses as $address) : ?>
6
+ <li postcode="<?php echo $address['postcode']; ?>">
7
+ <div style="float:right; color:red; font-weight:bold;">[<?php echo $address['region']; ?>]</div>
8
+ <strong><?php echo $address['address']; ?></strong><br/>
9
+ <span class="informal"><?php echo $address['postcode']; ?></span>
10
+ </li>
11
+ <?php endforeach; ?>
12
+ </ul>
13
+ <?php else : ?>
14
+ <ul><li><?php echo $this->__('No results available'); ?></li></ul>
15
+ <?php endif; ?>
app/design/adminhtml/default/default/template/zitec_dpd/sales/order/shipment/view/tracking.phtml ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?
2
+ /* @var $this Zitec_Dpd_Block_Adminhtml_Sales_Order_Shipment_View_Tracking */
3
+ ?>
4
+ <div class="field-row grid" id="shipment_tracking_info">
5
+ <table cellspacing="0" class="data">
6
+ <col width="100" />
7
+ <col />
8
+ <col />
9
+ <col width="80" />
10
+ <thead>
11
+ <tr class="headings">
12
+ <th><?php echo Mage::helper('sales')->__('Carrier') ?></th>
13
+ <th><?php echo Mage::helper('sales')->__('Title') ?></th>
14
+ <th><?php echo Mage::helper('sales')->__('Number') ?></th>
15
+ <?php if($this->isDPD()): ?>
16
+
17
+ <th><?php echo Mage::helper('sales')->__('Label') ?></th>
18
+ <?php endif; ?>
19
+ <th class="last"><?php echo Mage::helper('sales')->__('Action') ?></th>
20
+ </tr>
21
+ </thead>
22
+ <tfoot>
23
+ <tr>
24
+ <td>
25
+ <select name="carrier" class="select" style="width:110px" onchange="selectCarrier(this)">
26
+ <?php foreach ($this->getCarriers() as $_code=>$_name): ?>
27
+ <option value="<?php echo $_code ?>"><?php echo $_name ?></option>
28
+ <?php endforeach; ?>
29
+ </select>
30
+ </td>
31
+ <td><input class="input-text" type="text" id="tracking_title" name="title" value="" /></td>
32
+ <td><input class="input-text" type="text" id="tracking_number" name="number" value="" /></td>
33
+ <?php if($this->isDPD()): ?>
34
+ <td></td>
35
+ <?php endif; ?>
36
+ <td class="last"><?php echo $this->getSaveButtonHtml() ?></td>
37
+ </tr>
38
+ </tfoot>
39
+ <?php if($_tracks = $this->getShipment()->getAllTracks()): ?>
40
+ <tbody>
41
+ <?php $i=0;foreach ($_tracks as $_track):$i++ ?>
42
+ <tr class="<?php echo ($i%2==0)?'even':'odd' ?>">
43
+ <td><?php echo $this->getCarrierTitle($_track->getCarrierCode()) ?></td>
44
+ <td><?php echo $this->escapeHtml($_track->getTitle()) ?></td>
45
+ <td>
46
+ <?php if ($_track->isCustom()): ?>
47
+ <?php echo $this->escapeHtml($_track->getNumber()) ?>
48
+ <?php else: ?>
49
+ <a href="#" onclick="popWin('<?php echo $this->helper('shipping')->getTrackingPopupUrlBySalesModel($_track) ?>','trackorder','width=800,height=600,resizable=yes,scrollbars=yes')"><?php echo $_track->getNumber() ?></a>
50
+ <div id="shipment_tracking_info_response_<?php echo $_track->getId() ?>"></div>
51
+ <?php endif; ?>
52
+ </td>
53
+ <?php if($this->isDpdTrack($_track)): ?>
54
+ <td>
55
+ <a href="<?php echo $this->helper('adminhtml')->getUrl('zitec_dpd/adminhtml_shipment/getlabelpdf', Array('shipmentid' => $this->getShipment()->getId())); ?>" style="display:block;margin-bottom:0.6em;"><?php echo $this->__('PDF'); ?></a>
56
+ </td>
57
+ <?php else: ?>
58
+ <td />
59
+ <?php endif; ?>
60
+ <td class="last"><a href="#" onclick="deleteTrackingNumber('<?php echo $this->getRemoveUrl($_track) ?>', <?php echo $this->isDpdTrack($_track) ? "true" : "false"; ?>); return false;"><?php echo Mage::helper('sales')->__('Delete') ?></a></td>
61
+ </tr>
62
+ <?php endforeach; ?>
63
+ </tbody>
64
+ <?php endif; ?>
65
+ </table>
66
+ </div>
67
+ <script type="text/javascript">
68
+ //<![CDATA[
69
+
70
+ var zitecDPDVars = {
71
+ dpdDeleteConfirmationMessage: "<?php echo $this->__("Taking this action will cancel the shipment with DPD. Are you sure you want to continue?"); ?>",
72
+ defaultDeleteMessage: "<?php echo Mage::helper('sales')->__('Are you sure?') ?>"
73
+ }
74
+
75
+ function selectCarrier(elem) {
76
+ var option = elem.options[elem.selectedIndex];
77
+ $('tracking_title').value = option.value && option.value != 'custom' ? option.text : '';
78
+ }
79
+
80
+ function deleteTrackingNumber(url, isDpdTrack) {
81
+ var confirmationMessage = isDpdTrack ? zitecDPDVars.dpdDeleteConfirmationMessage : zitecDPDVars.defaultDeleteMessage;
82
+ if (confirm(confirmationMessage)) {
83
+ submitAndReloadArea($('shipment_tracking_info').parentNode, url)
84
+ }
85
+ }
86
+ //]]>
87
+ </script>
app/design/adminhtml/default/default/template/zitec_dpd/sales/order/shipment/view/tracking_17.phtml ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?
2
+ /* @var $this Zitec_Dpd_Block_Adminhtml_Sales_Order_Shipment_View_Tracking */
3
+ ?>
4
+ <div class="field-row grid" id="shipment_tracking_info">
5
+ <table cellspacing="0" class="data">
6
+ <col width="100" />
7
+ <col />
8
+ <col />
9
+ <col width="80" />
10
+ <thead>
11
+ <tr class="headings">
12
+ <th><?php echo Mage::helper('sales')->__('Carrier') ?></th>
13
+ <th><?php echo Mage::helper('sales')->__('Title') ?></th>
14
+ <th><?php echo Mage::helper('sales')->__('Number') ?></th>
15
+ <?php if($this->isDPD()): ?>
16
+
17
+ <th><?php echo Mage::helper('sales')->__('Label') ?></th>
18
+ <?php endif; ?>
19
+ <th class="last"><?php echo Mage::helper('sales')->__('Action') ?></th>
20
+ </tr>
21
+ </thead>
22
+ <tfoot>
23
+ <tr>
24
+ <td>
25
+ <select name="carrier" class="select" style="width:110px" onchange="selectCarrier(this)">
26
+ <?php foreach ($this->getCarriers() as $_code=>$_name): ?>
27
+ <option value="<?php echo $_code ?>"><?php echo $_name ?></option>
28
+ <?php endforeach; ?>
29
+ </select>
30
+ </td>
31
+ <td><input class="input-text" type="text" id="tracking_title" name="title" value="" /></td>
32
+ <td><input class="input-text" type="text" id="tracking_number" name="number" value="" /></td>
33
+ <?php if($this->isDPD()): ?>
34
+ <td></td>
35
+ <?php endif; ?>
36
+ <td class="last"><?php echo $this->getSaveButtonHtml() ?></td>
37
+ </tr>
38
+ </tfoot>
39
+ <?php if($_tracks = $this->getShipment()->getAllTracks()): ?>
40
+ <tbody>
41
+ <?php $i=0;foreach ($_tracks as $_track):$i++ ?>
42
+ <tr class="<?php echo ($i%2==0)?'even':'odd' ?>">
43
+ <td><?php echo $this->getCarrierTitle($_track->getCarrierCode()) ?></td>
44
+ <td><?php echo $this->escapeHtml($_track->getTitle()) ?></td>
45
+ <td>
46
+ <?php if ($_track->isCustom()): ?>
47
+ <?php echo $this->escapeHtml($_track->getNumber()) ?>
48
+ <?php else: ?>
49
+ <a href="#" onclick="popWin('<?php echo $this->helper('shipping')->getTrackingPopupUrlBySalesModel($_track) ?>','trackorder','width=800,height=600,resizable=yes,scrollbars=yes')"><?php echo $_track->getNumber() ?></a>
50
+ <div id="shipment_tracking_info_response_<?php echo $_track->getId() ?>"></div>
51
+ <?php endif; ?>
52
+ </td>
53
+ <?php if($this->isDpdTrack($_track)): ?>
54
+ <td>
55
+ <a href="<?php echo $this->helper('adminhtml')->getUrl('zitec_dpd/adminhtml_shipment/getlabelpdf', Array('shipmentid' => $this->getShipment()->getId())); ?>" style="display:block;margin-bottom:0.6em;"><?php echo $this->__('PDF'); ?></a>
56
+ </td>
57
+ <?php else: ?>
58
+ <td />
59
+ <?php endif; ?>
60
+ <td class="last"><a href="#" onclick="deleteTrackingNumber('<?php echo $this->getRemoveUrl($_track) ?>', <?php echo $this->isDpdTrack($_track) ? "true" : "false"; ?>); return false;"><?php echo Mage::helper('sales')->__('Delete') ?></a></td>
61
+ </tr>
62
+ <?php endforeach; ?>
63
+ </tbody>
64
+ <?php endif; ?>
65
+ </table>
66
+ </div>
67
+ <script type="text/javascript">
68
+ //<![CDATA[
69
+
70
+ var zitecDPDVars = {
71
+ dpdDeleteConfirmationMessage: "<?php echo $this->__("Taking this action will cancel the shipment with DPD. Are you sure you want to continue?"); ?>",
72
+ defaultDeleteMessage: "<?php echo Mage::helper('sales')->__('Are you sure?') ?>"
73
+ }
74
+
75
+ function selectCarrier(elem) {
76
+ var option = elem.options[elem.selectedIndex];
77
+ $('tracking_title').value = option.value && option.value != 'custom' ? option.text : '';
78
+ }
79
+
80
+ function deleteTrackingNumber(url, isDpdTrack) {
81
+ var confirmationMessage = isDpdTrack ? zitecDPDVars.dpdDeleteConfirmationMessage : zitecDPDVars.defaultDeleteMessage;
82
+ if (confirm(confirmationMessage)) {
83
+ submitAndReloadArea($('shipment_tracking_info').parentNode, url)
84
+ }
85
+ }
86
+ //]]>
87
+ </script>
app/design/adminhtml/default/default/template/zitec_packedshipment/sales/order/shipment/create/address_validation_dialog.phtml ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Bloques para la validación de direcciones que se muestran en el diálogo de
4
+ * packed shipments.
5
+ */
6
+
7
+ /*
8
+ * @see Zitec_PackedShipment_Block_Addressvalidationdialog
9
+ */
10
+ ?>
11
+ <?php $_errorMsg = ''; ?>
12
+ <?php $_carrier = $this->getOrder()->getShippingCarrier(); ?>
13
+ <?php $_shippingAddress = $this->getOrder()->getShippingAddress(); ?>
14
+ <?php if ($this->helper('zitec_packedshipment')->carrierSupportsAddressValidation($_carrier, $this->getCountryId())): ?>
15
+ <?php if (!$this->getCity() || !$this->getPostcode() || (!$_carrier->isValidCityPostcode($this->getCity(), $this->getPostcode(), $this->getCountryId(), $_errorMsg) && !$_errorMsg)) : ?>
16
+ <?php $_postcodeList = ($this->getCity() && $this->getPostcode()) ? $_carrier->getPostcodesForCity($this->getCity(), $_errorMsg) : array(); ?>
17
+ <?php if ($_postcodeList && !$_errorMsg) : ?>
18
+ <!-- Esta pantalla se muestra en el caso de que la población (City) es válida pero el código postal no. -->
19
+
20
+ <div id="packedshipment_address_validation_postcode">
21
+ <img style="margin:10px 0;" src="<?php echo $this->getSkinUrl('zitec_packedshipment/images/logoSEUR.jpg') ?>"/>
22
+ <a href="http://www.interactiv4.com" target="_blank">
23
+ <img style="float:right; margin:6px 0;" src="<?php echo $this->getSkinUrl('zitec_packedshipment/images/logo-footer.png') ?>"/>
24
+ </a>
25
+ <h4><?php echo $this->__('Código Postal Inválido') ?></h4>
26
+ <p class="small">
27
+ <?php printf($this->__('El código postal %s no coincide con la población %s.'), $this->getPostcode(), $this->getCity()); ?>
28
+ </p>
29
+ <p class="small">
30
+ <?php echo $this->__('Por favor, consulte con el cliente y seleccione el código postal correcto de la siguiente lista.'); ?>
31
+ </p>
32
+ <?php if ($_shippingAddress->getTelephone()): ?>
33
+ <p class="small">
34
+ <?php printf($this->__('Tlf. del cliente: %s.'),$_shippingAddress->getTelephone()); ?>
35
+ </p>
36
+ <?php endif; ?>
37
+ <fieldset>
38
+ <div>
39
+ <label class="normal" for="packagedshipment[corrected_postcode]"><?php echo $this->__('Código postal:') ?></label>
40
+ <select id="packagedshipment[corrected_postcode]" name="packagedshipment[corrected_postcode]" >
41
+ <option value=""><?php echo $this->__('Ninguno de los listados'); ?></option>
42
+ <?php foreach ($_postcodeList as $_postcode): ?>
43
+ <option value="<?php echo $_postcode; ?>"><?php echo $_postcode; ?></option>
44
+ <?php endforeach; ?>
45
+ </select>
46
+ </div>
47
+ </fieldset>
48
+ </div>
49
+ <?php elseif (!$_errorMsg): ?>
50
+ <?php $_cityList = $this->getPostcode() && $this->getCity() ? $_carrier->getCitiesForPostcode($this->getPostcode(), $_errorMsg) : array(); ?>
51
+ <?php if ($_cityList && !$_errorMsg): ?>
52
+ <!-- Esta pantalla se muestra en el caso de que el código postal es válido pero la población no. -->
53
+
54
+ <div id="packedshipment_address_validation_city">
55
+ <img style="margin:10px 0;" src="<?php echo $this->getSkinUrl('zitec_packedshipment/images/logoSEUR.jpg') ?>"/>
56
+ <a href="http://www.interactiv4.com" target="_blank">
57
+ <img style="float:right; margin:6px 0;" src="<?php echo $this->getSkinUrl('zitec_packedshipment/images/logo-footer.png') ?>"/>
58
+ </a>
59
+ <h4><?php echo $this->__('Población Inválida') ?></h4>
60
+ <p class="small">
61
+ <?php printf($this->__('La población %s no coincide con el código postal %s.'), $this->getCity(), $this->getPostcode() ); ?>
62
+ </p>
63
+ <p class="small">
64
+ <?php echo $this->__('Por favor, consulte con el cliente y seleccione la población correcta de la siguiente lista.'); ?>
65
+ </p>
66
+ <?php if ($_shippingAddress->getTelephone()): ?>
67
+ <p class="small">
68
+ <?php printf($this->__('Tlf. del cliente: %s.'),$_shippingAddress->getTelephone()); ?>
69
+ </p>
70
+ <?php endif; ?>
71
+ <fieldset>
72
+ <div>
73
+ <label class="normal" for="packagedshipment[corrected_city]"><?php echo $this->__('Población:') ?></label>
74
+ <select id="packagedshipment[corrected_city]" name="packagedshipment[corrected_city]" >
75
+ <option value=""><?php echo $this->__('Ninguna de las listadas'); ?></option>
76
+ <?php foreach ($_cityList as $_city): ?>
77
+ <option value="<?php echo $_city; ?>"><?php echo $_city; ?></option>
78
+ <?php endforeach; ?>
79
+ </select>
80
+ </div>
81
+ </fieldset>
82
+ </div>
83
+ <?php elseif (!$_errorMsg) : ?>
84
+ <!-- Esta pantalla se muestra en el caso de que la combinación de la población y
85
+ el código postal no coincidan -->
86
+ <div id="packedshipment_address_validation_both">
87
+ <img style="margin:10px 0;" src="<?php echo $this->getSkinUrl('zitec_packedshipment/images/logoSEUR.jpg') ?>"/>
88
+ <a href="http://www.interactiv4.com" target="_blank">
89
+ <img style="float:right; margin:6px 0;" src="<?php echo $this->getSkinUrl('zitec_packedshipment/images/logo-footer.png') ?>"/>
90
+ </a>
91
+ <h4><?php echo $this->__('Población o Código Postal Inválidos') ?></h4>
92
+ <p class="small">
93
+ <?php printf($this->__('La población %s no coincide con el código postal %s.'), $this->getCity() ? $this->getCity() : $_shippingAddress->getCity(), $this->getPostcode() ? $this->getPostcode() : $_shippingAddress->getPostcode() ); ?>
94
+ </p>
95
+ <p class="small">
96
+ <?php echo $this->__('Por favor, contacte con el cliente para verificar sus datos.'); ?>
97
+ </p>
98
+ <?php if ($_shippingAddress->getTelephone()): ?>
99
+ <p class="small">
100
+ <?php printf($this->__('Tlf. del cliente: %s.'),$_shippingAddress->getTelephone()); ?>
101
+ </p>
102
+ <?php endif; ?>
103
+ <fieldset>
104
+ <div>
105
+ <label class="normal" for="packagedshipment[corrected_city]"><?php echo $this->__('Población:') ?></label>
106
+ <input id="packagedshipment[corrected_city]" name="packagedshipment[corrected_city]" type="text" maxlength="255" value="<?php echo $this->getCity() ? $this->getCity() : $_shippingAddress->getCity(); ?>" />
107
+ <label class="normal" for="packagedshipment[corrected_postcode]"><?php echo $this->__('Código postal:') ?></label>
108
+ <input id="packagedshipment[corrected_postcode]" name="packagedshipment[corrected_postcode]" type="text" maxlength="5" value="<?php echo $this->getPostcode() ? $this->getPostcode() : $_shippingAddress->getPostcode(); ?>" />
109
+ </div>
110
+ <div>
111
+ <br />
112
+ <input id="packagedshipment[dont_correct_address]" name="packagedshipment[dont_correct_address]" type="checkbox" value="dont_correct_address" />
113
+ <label class="normal" for="packagedshipment[dont_correct_address]"><?php echo $this->__('Continuar con sin hacer más correcciones') ?></label>
114
+ </div>
115
+ </fieldset>
116
+ </div>
117
+ <?php endif; ?>
118
+ <?php endif; ?>
119
+ <?php endif; ?>
120
+ <?php endif; ?>
121
+
122
+ <?php if ($_errorMsg): ?>
123
+ <div id="packedshipment_address_validation_error">
124
+ <img style="margin:10px 0;" src="<?php echo $this->getSkinUrl('zitec_packedshipment/images/logoSEUR.jpg') ?>"/>
125
+ <a href="http://www.interactiv4.com" target="_blank">
126
+ <img style="float:right; margin:6px 0;" src="<?php echo $this->getSkinUrl('zitec_packedshipment/images/logo-footer.png') ?>"/>
127
+ </a>
128
+ <h4><?php echo $this->__('Error de comunicación') ?></h4>
129
+ <p class="small">
130
+ <?php echo 'Ha ocurrido un error comprobando la dirección del cliente.' ?>
131
+ </p>
132
+ <p class="small">
133
+ <?php echo $this->__('Por favor, vuelva a probar en un momento.'); ?>
134
+ </p>
135
+ <p class="small">
136
+ <?php echo 'Error: '.$_errorMsg; ?>
137
+ </p>
138
+ </div>
139
+ <?php endif; ?>
140
+
141
+
142
+
app/design/adminhtml/default/default/template/zitec_packedshipment/sales/order/shipment/create/address_validation_info_js.phtml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* Se hacen accesible desde la página de 'new shipment' unas informaciones
3
+ * necesarias para la validación de la dirección.
4
+ */
5
+ ?>
6
+
7
+ <script type="text/javascript">
8
+ //<![CDATA[
9
+ var zitecIsAddressValidationAvailable = <?php echo $this->isAddressValidationAvailable() ? 'true' : 'false'; ?>;
10
+ var zitecShippingAddressCity = "<?php echo $this->getShippingAddressCity(); ?>";
11
+ var zitecShippingAddressPostcode = "<?php echo $this->getShippingAddressPostcode(); ?>";
12
+ var zitecShippingAddressCountryId = "<?php echo $this->getShippingAddressCountryId(); ?>";
13
+ var zitecOrderId = "<?php echo $this->getOrderId(); ?>";
14
+ var zitecValidateAddressUrl = "<?php echo $this->getAddressValidationDialogHtmlActionUrl(); ?>";
15
+ var zitecAddressValidationBeforeContinueHandler = "zitecAddressValidationBeforeContinue";
16
+ var zitecDontCorrectAddress = false;
17
+ //]]>
18
+ </script>
app/design/adminhtml/default/default/template/zitec_packedshipment/sales/order/shipment/create/items.phtml ADDED
@@ -0,0 +1,363 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2011 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
+ <?php $_helper = Mage::helper('zitec_packedshipment'); /* @var $_helper Zitec_PackedShipment_Helper_Data */ ?>
28
+ <?php $_useDescriptionsInsteadOfReferences = $_helper->useDescriptionsInsteadOfReferences(); ?>
29
+ <div class="grid np">
30
+ <div class="hor-scroll">
31
+ <table cellspacing="0" class="data order-tables">
32
+ <col/>
33
+ <col width="1"/>
34
+ <col width="1"/>
35
+ <?php if (!$this->canShipPartiallyItem()): ?>
36
+ <col width="20"/>
37
+ <?php endif; ?>
38
+ <thead>
39
+ <tr class="headings">
40
+ <th><?php echo $this->helper('sales')->__('Product') ?></th>
41
+ <th class="a-center"><?php echo $this->helper('sales')->__('Qty') ?></th>
42
+ <th<?php if ($this->isShipmentRegular()): ?> class="last"<?php endif; ?>><span
43
+ class="nobr"><?php echo $this->helper('sales')->__('Qty to Ship') ?></span></th>
44
+
45
+ <?php if (!$this->canShipPartiallyItem()): ?>
46
+ <th class="a-center last"><span class="nobr"><?php echo $this->helper('sales')->__('Ship') ?></span>
47
+ </th>
48
+ <?php endif; ?>
49
+
50
+ </tr>
51
+ </thead>
52
+ <?php $_items = $this->getShipment()->getAllItems() ?>
53
+ <?php $_i = 0;
54
+ foreach ($_items as $_item): if ($_item->getOrderItem()->getIsVirtual() || $_item->getOrderItem()->getParentItem()): continue; endif;
55
+ $_i++ ?>
56
+ <tbody class="<?php echo $_i % 2 ? 'odd' : 'even' ?>">
57
+ <?php echo $this->getItemHtml($_item) ?>
58
+ <?php echo $this->getItemExtraInfoHtml($_item->getOrderItem()) ?>
59
+ </tbody>
60
+ <?php endforeach; ?>
61
+ </table>
62
+ </div>
63
+ </div>
64
+ <br/>
65
+ <div class="box-left entry-edit">
66
+ <div class="entry-edit-head"><h4><?php echo $this->__('Shipment Comments') ?></h4></div>
67
+ <fieldset>
68
+ <div id="order-history_form">
69
+ <span class="field-row">
70
+ <label class="normal"
71
+ for="shipment_comment_text"><?php echo Mage::helper('sales')->__('Shipment Comments') ?></label>
72
+ <textarea id="shipment_comment_text" name="shipment[comment_text]" rows="3" cols="5"
73
+ style="height:6em; width:99%;"><?php echo $this->getShipment()->getCommentText(); ?></textarea>
74
+ </span>
75
+
76
+ <div class="clear"></div>
77
+ </div>
78
+ </fieldset>
79
+ </div>
80
+
81
+
82
+ <!-- zitec_packedshipment: set the maximum number of parcels -->
83
+ <div class="box-right entry-edit">
84
+
85
+ <div class="entry-edit-head"><h4><?php echo $this->__('Grouping your shipment into parcels') ?></h4></div>
86
+ <fieldset>
87
+ <div id="packedshipment-bultos">
88
+ <span class="field-row ">
89
+ <input type="checkbox" id="packedshipment_communicate_shipment"
90
+ name="packedshipment_communicate_shipment" checked value="Y"/>
91
+ <?php echo Mage::helper('zitec_packedshipment')->__('Communicate this shipment to the courier service') ?>
92
+ </span>
93
+ <span class="field-row">
94
+ <input id="packedshipment_parcels_number" name="packedshipment[parcels_number]" value="1" type="text"
95
+ disabled="disabled"/>
96
+ <label class="normal"
97
+ for="packedshipment_parcels_number"><?php echo Mage::helper('zitec_packedshipment')->__('Total number of parcels') ?></label>
98
+ </span>
99
+ </div>
100
+ </fieldset>
101
+ </div>
102
+ <div id="message-popup-window-mask" style="display:none;"></div>
103
+
104
+ <!-- step 1 group products into parcels -->
105
+ <div id="packages_modal_1" style="display:none;">
106
+ <!-- <img style="margin:10px 0;" src="-->
107
+ <?php //echo $this->getSkinUrl('zitec_packedshipment/images/logoSEUR.jpg') ?><!--"/>-->
108
+ <!-- <a href="http://www.interactiv4.com" target="_blank">-->
109
+ <!-- <img style="float:right; margin:6px 0;" src="-->
110
+ <?php //echo $this->getSkinUrl('zitec_packedshipment/images/logo-footer.png') ?><!--"/>-->
111
+ <!-- </a>-->
112
+ <h4><?php echo $this->__("Group the products in your shipment into parcels"); ?></h4>
113
+
114
+ <p class="small"><?php echo $this->__('This module lets you organize your products into parcels using the table below. If you like you can, <strong>leave some parcels empty, and the system will not take them into account</strong>.'); ?>
115
+ </p>
116
+
117
+ <div class="grid np" style="clear:both;">
118
+ <div class="hor-scroll">
119
+ <table cellspacing="0" class="data order-tables" id="packages_table_modal_1">
120
+ <thead>
121
+ <tr class="headings" id="packages_modal_1_headings_tr">
122
+ <th align="center" valign="middle"
123
+ style="padding:5px;"><?php echo $this->helper('sales')->__('SKU') ?></th>
124
+ <th align="center" valign="middle"
125
+ style="padding:5px;"><?php echo $this->helper('sales')->__('Name') ?></th>
126
+ <th align="center" valign="middle"
127
+ style="padding:5px;"><?php echo $this->helper('sales')->__('Weight') ?></th>
128
+ <tr>
129
+ </thead>
130
+ </table>
131
+ <?php $_carrier = $this->getShipment()->getOrder()->getShippingCarrier(); ?>
132
+ <?php if ($this->helper('zitec_packedshipment')->carrierSupportsCalculationOfShippingCosts($_carrier)): ?>
133
+ <script type="text/javascript">
134
+ //<![CDATA[
135
+ var zitecShippingCostUrl = '<?php echo $this->helper("adminhtml")->getUrl('zitec_packedshipment/adminhtml_index/getshippingcost'); ?>';
136
+ var zitecShipmentOrderId = '<?php echo $this->getShipment()->getOrder()->getId(); ?>';
137
+ //]]>
138
+ </script>
139
+ <table id="zitecShippingCostTable" cellspacing="0">
140
+ <tbody>
141
+ <tr>
142
+ <td align="right"><?php echo $this->__('Cost of shipping to customer (excluding tax):'); ?></td>
143
+ <?php $_shippingPrice = $this->getShipment()->getOrder()->getBaseShippingAmount(); ?>
144
+ <td align="right" width="1%"
145
+ id="zitecShippingPrice"><?php echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . Mage::helper('core')->currency($_shippingPrice, true, false); ?></td>
146
+ </tr>
147
+ <tr>
148
+ <td align="right"><?php echo $this->__('Shipping cost (excluding tax):'); ?></td>
149
+ <td align="right" width="1%" id="zitecShippingCost"></td>
150
+ </tr>
151
+ <tr>
152
+ <td align="right"><?php echo $this->__('Difference:'); ?></td>
153
+ <td align="right" width="1%" id="zitecShippingProfit"></td>
154
+ </tr>
155
+ </tbody>
156
+ </table>
157
+ <?php endif; ?>
158
+ </div>
159
+ </div>
160
+ </div>
161
+ <!-- We put a hidden cost to move the server shipping field -->
162
+ <input type="hidden" style="display:none" id="zitecShippingResportsShippingCost"
163
+ name="zitecShippingResportsShippingCost"/>
164
+
165
+ <script type="text/javascript">
166
+ var ps_items = [];
167
+ <?php $_items = $this->getShipment()->getAllItems() ?>
168
+ <?php foreach($_items as $_item):?>
169
+ ps_items[<?php echo $_item->getOrderItemId() ?>] = ({
170
+ 'id': '<?php echo $_item->getOrderItemId()?>',
171
+ 'productId': '<?php echo $_item->getProductId()?>',
172
+ 'sku': '<?php echo str_replace("'", "\'", $_item->getSku())?>',
173
+ 'name': '<?php echo str_replace("'", "\'", $_item->getName())?>',
174
+ 'weight': '<?php echo $_item->getWeight()?>'
175
+ });
176
+ <?php endforeach;?>
177
+ </script>
178
+
179
+ <!-- step 2 -->
180
+ <div id="packages_modal_2" style="display:none;">
181
+ <div class="entry-edit-head">
182
+ <!-- <img style="margin:10px 0;" src="-->
183
+ <?php //echo $this->getSkinUrl('zitec_packedshipment/images/logoSEUR.jpg') ?><!--"/>-->
184
+ <!-- <a href="http://www.interactiv4.com" target="_blank">-->
185
+ <!-- <img style="float:right; margin:6px 0;" src="-->
186
+ <?php //echo $this->getSkinUrl('zitec_packedshipment/images/logo-footer.png') ?><!--"/>-->
187
+ <!-- </a>-->
188
+
189
+ <h4>
190
+ <?php if ($_useDescriptionsInsteadOfReferences): ?>
191
+ <?php echo $this->__("Enter a description for each parcel"); ?>
192
+ <?php else: ?>
193
+ <?php echo $this->__("Enter a descriptive reference for the shipping labels of each parcel"); ?>
194
+ <?php endif; ?>
195
+ </h4>
196
+
197
+ <p class="small">
198
+ <?php if ($_useDescriptionsInsteadOfReferences): ?>
199
+ <?php echo $this->__("You can enter a description of each parcel to communicate to the courier service in the fields below."); ?>
200
+ <?php else: ?>
201
+ <?php echo $this->__("This module generates shipping labels to afix to each parcel. To help you match the labels with the correct parcels, you can customize the references used in each label using the following fields."); ?>
202
+ <?php endif; ?>
203
+ </p>
204
+ </div>
205
+ <fieldset style="clear:both;">
206
+ <div id="packages_modal_2_input_container"></div>
207
+ </fieldset>
208
+ </div>
209
+
210
+ <!-- bring to front the modal for choosing the package -->
211
+
212
+ <div class="box-right entry-edit">
213
+ <div class="order-totals">
214
+ <div class="order-totals-bottom">
215
+ <?php $_shippingAddress = $this->getShipment()->getOrder()->getShippingAddress(); ?>
216
+ <div id="address-validation-window" style="display: none">
217
+ <input type="hidden" id="postcode_valid" name="postcode_valid" value="<?php echo Mage::helper('zitec_dpd')->isValidAutoPostcode($this->getShipment()->getOrder()); ?>" />
218
+ <input type="hidden" id="ignore_postcode_valid" name="ignore_postcode_valid" value="0" />
219
+ <input type="hidden" id="postcode_edit" name="postcode_edit" value="<?php echo $this->getUrl('*/sales_order/address', array('address_id'=>$_shippingAddress->getId())); ?>" />
220
+ <h3 style="color: red;"><?php echo $this->__('The postcode (%s) submitted by your customer is not valid post code. Do you want to edit the address? (This may be a valid postcode %s )', $_shippingAddress->getPostcode() ,$_shippingAddress->getAutoPostcode()); ?></h3>
221
+ <fieldset>
222
+ <address><?php echo $_shippingAddress->getFormated(true) ?></address>
223
+ </fieldset>
224
+ </div>
225
+ <?php if (Mage::helper('zitec_dpd/compatibility')->canCreateShippingLabel($this->getShipment())): ?>
226
+ <p>
227
+ <label class="normal"
228
+ for="create_shipping_label"><?php echo Mage::helper('sales')->__('Create Shipping Label') ?></label>
229
+ <input id="create_shipping_label" name="shipment[create_shipping_label]" value="1" type="checkbox"
230
+ onclick="toggleCreateLabelCheckbox();"/>
231
+ </p>
232
+ <?php endif ?>
233
+ <p>
234
+ <label class="normal"
235
+ for="notify_customer"><?php echo Mage::helper('sales')->__('Append Comments') ?></label>
236
+ <input id="notify_customer" name="shipment[comment_customer_notify]" value="1" type="checkbox"/>
237
+ </p>
238
+ <?php if ($this->canSendShipmentEmail()): ?>
239
+ <p>
240
+ <label class="normal"
241
+ for="send_email"><?php echo Mage::helper('sales')->__('Email Copy of Shipment') ?></label>
242
+ <input id="send_email" name="shipment[send_email]" value="1" type="checkbox"/>
243
+ </p>
244
+ <?php endif; ?>
245
+ <div class="a-right">
246
+ <?php echo $this->getChildHtml('submit_button') ?>
247
+ </div>
248
+ </div>
249
+ </div>
250
+ </div>
251
+ <div class="clear"></div>
252
+ <script type="text/javascript">
253
+ //<![CDATA[
254
+ var sendEmailCheckbox = $('send_email');
255
+ if (sendEmailCheckbox) {
256
+ var notifyCustomerCheckbox = $('notify_customer');
257
+ var shipmentCommentText = $('shipment_comment_text');
258
+ Event.observe(sendEmailCheckbox, 'change', bindSendEmail);
259
+ bindSendEmail();
260
+ }
261
+ function bindSendEmail() {
262
+ if (sendEmailCheckbox.checked == true) {
263
+ notifyCustomerCheckbox.disabled = false;
264
+ //shipmentCommentText.disabled = false;
265
+ }
266
+ else {
267
+ notifyCustomerCheckbox.disabled = true;
268
+ //shipmentCommentText.disabled = true;
269
+ }
270
+ }
271
+ function toggleCreateLabelCheckbox() {
272
+ var checkbox = $('create_shipping_label');
273
+ var submitButton = checkbox.up('.order-totals').select('.submit-button span')[0];
274
+ if (checkbox.checked) {
275
+ submitButton.innerText += '...';
276
+ } else {
277
+ submitButton.innerText = submitButton.innerText.replace(/\.\.\.$/, '');
278
+ }
279
+ }
280
+ function submitShipment(btn) {
281
+ if($('postcode_valid').getValue() == 0 && $('ignore_postcode_valid').getValue() == 0 ){
282
+ alertPostcodeProblems(btn);
283
+ if($('ignore_postcode_valid').getValue() == 0) {
284
+ return false;
285
+ }
286
+ }
287
+
288
+ var checkbox = $(btn).up('.order-totals').select('#create_shipping_label')[0];
289
+ if (checkbox && checkbox.checked) {
290
+ packaging.showWindow();
291
+ } else if (editForm.submit()) {
292
+ disableElements('submit-button');
293
+ }
294
+ }
295
+
296
+
297
+ function alertPostcodeProblems(btn){
298
+ Dialog.confirm($('address-validation-window').innerHTML,
299
+ {
300
+ draggable: true,
301
+ resizable: true,
302
+ closable: true,
303
+ className: "magento",
304
+ title: "<?php echo $this->__('Postcode is invalid'); ?>",
305
+ width: 300,
306
+ height: 300,
307
+ recenterAuto: false,
308
+ hideEffect: Element.hide,
309
+ showEffect: Element.show,
310
+ id: "postcode-validate-inline",
311
+ buttonClass: "form-button button",
312
+ okLabel: "<?php echo $this->__('Edit postcode'); ?>",
313
+ cancel: function(win){
314
+ $('ignore_postcode_valid').setValue(1);
315
+ submitShipment(btn);
316
+ },
317
+ ok: function(win){
318
+ var editUrl = $('postcode_edit').getValue();
319
+ window.location.href = editUrl;
320
+ win.close();
321
+ },
322
+ onClose: function(win){
323
+ }
324
+ }
325
+ );
326
+ return true;
327
+
328
+ }
329
+
330
+ var communicateShipmentCheckbox = $('packedshipment_communicate_shipment');
331
+ if (communicateShipmentCheckbox) {
332
+ Event.observe(communicateShipmentCheckbox, 'change', handleCommunicateShipmentChange);
333
+ handleCommunicateShipmentChange();
334
+ }
335
+
336
+ function handleCommunicateShipmentChange() {
337
+ var parcelsNumber = $('packedshipment_parcels_number');
338
+ if (parcelsNumber) {
339
+ if (communicateShipmentCheckbox.checked == true) {
340
+ parcelsNumber.disabled = false;
341
+ }
342
+ else {
343
+ parcelsNumber.disabled = true;
344
+ }
345
+ }
346
+ }
347
+
348
+ //Flag that indicates if the products must be sent in a single package
349
+ var mustSendShipmentInOneParcel = <?php echo $this->helper('zitec_packedshipment')->mustShipInOneParcel($this->getShipment()) ? 'true' : 'false'; ?>
350
+
351
+
352
+ // Translations
353
+ zitecPSVars.modalDialog1Title = "<?php echo $this->__("Grouping Shipment into Parcels"); ?>";
354
+ zitecPSVars.parcelColumnTitle = "<?php echo $this->__("Parcel"); ?> ";
355
+ zitecPSVars.continueLabel = "<?php echo $this->__("Continue"); ?>";
356
+ zitecPSVars.cancelLabel = "<?php echo $this->__("Cancel"); ?>";
357
+ zitecPSVars.submitLabel = "<?php echo $this->__("Submit"); ?>";
358
+ zitecPSVars.parcelReferenceLabel = "<?php echo $this->__("Parcel Reference"); ?> ",
359
+ zitecPSVars.parcelDescriptionLabel = "<?php echo $this->__("Description of Parcel"); ?> ";
360
+ zitecPSVars.useDescriptionsInsteadOfReferences = <?php echo $_useDescriptionsInsteadOfReferences? "true" : "false"; ?>;
361
+
362
+ //]]>
363
+ </script>
app/design/adminhtml/default/default/template/zitec_reportscommon/records_report_container.phtml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ ?>
5
+
6
+ <div class="content-header">
7
+ <table cellspacing="0">
8
+ <tr>
9
+ <td style="<?php echo $this->getHeaderWidth() ?>"><?php echo $this->getHeaderHtml() ?></td>
10
+ <td class="form-buttons"><?php echo $this->getButtonsHtml() ?></td>
11
+ </tr>
12
+ </table>
13
+ </div>
14
+ <div>
15
+ <?php echo $this->getChildHtml('store.switcher') ?>
16
+ </div>
17
+ <div>
18
+ <?php echo $this->getChildHtml('grid.filter.form') ?>
19
+ </div>
20
+ <div>
21
+ <?php echo $this->getGridHtml() ?>
22
+ </div>
23
+ <script type="text/javascript">
24
+ function filterFormSubmit() {
25
+ switchStore($('store_switcher'));
26
+ }
27
+ </script>
app/design/adminhtml/default/default/template/zitec_reportscommon/records_report_grid.phtml ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ ?>
4
+ <?php
5
+ /**
6
+ * Template for Zitec_ReportsCommon_Block_RecordsReport_Grid
7
+ *
8
+ * getId()
9
+ * getCollection()
10
+ * getColumns()
11
+ * getPagerVisibility()
12
+ * getVarNamePage()
13
+ */
14
+ $numColumns = sizeof($this->getColumns());
15
+ ?>
16
+ <?php if($this->getCollection()): ?>
17
+ <?php if($this->canDisplayContainer()): ?>
18
+ <?php if($this->getGridHeader()): ?>
19
+ <div class="content-header">
20
+ <table cellspacing="0">
21
+ <tr>
22
+ <td style="width:50%;"><h2><?php echo $this->getGridHeader(); ?></h2></td>
23
+ </tr>
24
+ </table>
25
+ </div>
26
+ <?php endif ?>
27
+ <div id="<?php echo $this->getId() ?>">
28
+ <?php else: ?>
29
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
30
+ <?php endif; ?>
31
+ <?php if($this->getStoreSwitcherVisibility() || $this->getDateFilterVisibility()): ?>
32
+ <?php if($this->getStoreSwitcherVisibility()): ?>
33
+ <?php echo $this->getStoreSwitcherHtml() ?>
34
+ <?php endif ?>
35
+ <table cellspacing="0" class="actions">
36
+ <tr>
37
+ <?php if($this->getDateFilterVisibility()): ?>
38
+ <td class="a-left filter">
39
+ <div class="f-left">
40
+ <div><label for="period_date_from"><?php echo $this->__('From') ?><span class="required">*</span>:</label>&nbsp;<input class="input-text no-changes required-entry" type="text" id="period_date_from" name="report_from" value="<?php echo $this->getFilter('report_from') ?>" style="width:5em" /> <img src="<?php echo $this->getSkinUrl('images/grid-cal.gif') ?>" title="<?php echo $this->__('Select Date') ?>" id="period_date_from_trig" alt="<?php echo $this->__('Select Date') ?>" class="v-middle"/>&nbsp;&nbsp;</div>
41
+ <div id="period_date_from_advaice"></div>
42
+ </div>
43
+
44
+ <div class="f-left">
45
+ <div><label for="period_date_to"><?php echo $this->__('To') ?><span class="required">*</span>:</label>&nbsp;<input class="input-text no-changes required-entry" type="text" id="period_date_to" name="report_to" value="<?php echo $this->getFilter('report_to') ?>" style="width:5em" /> <img src="<?php echo $this->getSkinUrl('images/grid-cal.gif') ?>" class="v-middle" title="<?php echo $this->__('Select Date') ?>"id="period_date_to_trig" alt="<?php echo $this->__('Select Date') ?>"/>&nbsp;&nbsp;</div>
46
+ <div id="period_date_to_advaice"></div>
47
+ </div>
48
+
49
+ <script type="text/javascript">
50
+ <!--
51
+ Calendar.setup({
52
+ inputField : 'period_date_from',
53
+ ifFormat : '<?php echo $this->getDateFormat() ?>',
54
+ button : 'period_date_from_trig',
55
+ align : 'Bl',
56
+ singleClick : true
57
+ });
58
+ Calendar.setup({
59
+ inputField : 'period_date_to',
60
+ ifFormat : '<?php echo $this->getDateFormat() ?>',
61
+ button : 'period_date_to_trig',
62
+ align : 'Bl',
63
+ singleClick : true
64
+ });
65
+ //-->
66
+ </script>
67
+ </td>
68
+ <?php endif; ?>
69
+ <?php if($this->getExportVisibility()): ?>
70
+ <td class="a-right">
71
+ <img src="<?php echo $this->getSkinUrl('images/icon_export.gif') ?>" alt="" class="v-middle"/>&nbsp; <?php echo $this->__('Export to:') ?>
72
+ <select name="<?php echo $this->getId() ?>_export" id="<?php echo $this->getId() ?>_export" style="width:8em;">
73
+ <?php foreach ($this->getExportTypes() as $_type): ?>
74
+ <option value="<?php echo $_type->getUrl() ?>"><?php echo $_type->getLabel() ?></option>
75
+ <?php endforeach; ?>
76
+ </select>
77
+ <?php echo $this->getExportButtonHtml() ?>
78
+ </td>
79
+ <?php endif; ?>
80
+ </tr>
81
+ </table>
82
+ <?php endif; ?>
83
+
84
+ <div class="grid">
85
+ <table cellspacing="0" class="data" id="<?php echo $this->getId() ?>_table">
86
+ <col/>
87
+ <?php foreach ($this->getColumns() as $_column): ?>
88
+ <col <?php echo $_column->getHtmlProperty() ?>/>
89
+ <?php endforeach; ?>
90
+ <?php if ($this->getHeadersVisibility() || $this->getFilterVisibility()): ?>
91
+ <thead>
92
+ <?php if ($this->getHeadersVisibility()): ?>
93
+ <tr class="headings">
94
+ <?php foreach ($this->getColumns() as $_column): ?>
95
+ <th <?php echo $_column->getHeaderHtmlProperty() ?>><span class="no-br"><?php echo $_column->getHeaderHtml() ?></span></th>
96
+ <?php endforeach; ?>
97
+ </tr>
98
+ <?php endif; ?>
99
+ </thead>
100
+ <?php endif; ?>
101
+ <tbody>
102
+ <?php if ($this->getCollection()->getSize()): ?>
103
+ <?php foreach ($this->getCollection() as $_index=>$_item): ?>
104
+ <tr title="<?php echo $this->getRowUrl($_item) ?>"<?php if ($_class = $this->getRowClass($_item)):?> class="<?php echo $_class; ?>"<?php endif;?> >
105
+ <?php $i=0;foreach ($this->getColumns() as $_column): ?>
106
+
107
+ <?php if ($this->shouldRenderCell($_item, $_column)):?>
108
+ <?php $_rowspan = $this->getRowspan($_item, $_column);?>
109
+ <td <?php echo ($_rowspan ? 'rowspan="' . $_rowspan . '" ' : '') ?>class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i==$numColumns?'last':'' ?>">
110
+ <?php echo (($_html = $_column->getRowField($_item)) != '' ? $_html : '&nbsp;') ?>
111
+ </td>
112
+ <?php if ($this->shouldRenderEmptyCell($_item, $_column)):?>
113
+ <td colspan="<?php echo $this->getEmptyCellColspan($_item)?>" class="last"><?php echo $this->getEmptyCellLabel()?></td>
114
+ <?php endif;?>
115
+ <?php endif;?>
116
+
117
+ <?php endforeach; ?>
118
+ </tr>
119
+ <?php if ($_multipleRows = $this->getMultipleRows($_item)):?>
120
+ <?php foreach ($_multipleRows as $_i):?>
121
+ <tr>
122
+ <?php $i=0;foreach ($this->getMultipleRowColumns($_i) as $_column): ?>
123
+ <td class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i==$numColumns-1?'last':'' ?>">
124
+ <?php echo (($_html = $_column->getRowField($_i)) != '' ? $_html : '&nbsp;') ?>
125
+ </td>
126
+ <?php endforeach; ?>
127
+ </tr>
128
+ <?php endforeach;?>
129
+ <?php endif;?>
130
+
131
+ <?php if ($this->shouldRenderSubTotal($_item)): ?>
132
+ <tr class="subtotals">
133
+ <?php $i = 0; foreach ($this->getSubTotalColumns() as $_column): ?>
134
+ <td class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i == $numColumns ? 'last' : '' ?>">
135
+ <?php echo ($_column->hasSubtotalsLabel() ? $_column->getSubtotalsLabel() :
136
+ $_column->getRowField($this->getSubTotalItem($_item))
137
+ );
138
+ ?>
139
+ </td>
140
+ <?php endforeach; ?>
141
+ </tr>
142
+ <?php endif; ?>
143
+ <?php endforeach; ?>
144
+ <?php elseif ($this->getEmptyText()): ?>
145
+ <tr>
146
+ <td class="empty-text <?php echo $this->getEmptyTextClass() ?>" colspan="<?php echo $numColumns ?>"><?php echo $this->getEmptyText() ?></td>
147
+ </tr>
148
+ <?php endif; ?>
149
+ </tbody>
150
+ <?php if ($this->getCountTotals() && $this->getCollection()->getSize()): ?>
151
+ <tfoot>
152
+ <tr>
153
+ <?php $j=0;foreach ($this->getColumns() as $_column): ?>
154
+ <th class="<?php echo $_column->getCssProperty() ?> <?php echo ++$j==$numColumns?'last':'' ?>">
155
+ <?php echo (($j > 1) || !$this->getTotalText()) ? $_column->getRowField($this->getTotals()) : $this->getTotalText(); ?>
156
+ </th>
157
+ <?php endforeach; ?>
158
+ </tr>
159
+ </tfoot>
160
+ <?php endif; ?>
161
+ </table>
162
+ </div>
163
+ <?php if($this->canDisplayContainer()): ?>
164
+ </div>
165
+ <script type="text/javascript">
166
+ //<![CDATA[
167
+ <?php echo $this->getJsObjectName() ?> = new varienGrid('<?php echo $this->getId() ?>', '<?php echo $this->getGridUrl() ?>', '<?php echo $this->getVarNamePage() ?>', '<?php echo $this->getVarNameSort() ?>', '<?php echo $this->getVarNameDir() ?>', '<?php echo $this->getVarNameFilter() ?>');
168
+ <?php echo $this->getJsObjectName() ?>.useAjax = '<?php echo $this->getUseAjax() ?>';
169
+ <?php if($this->getDateFilterVisibility()):?>
170
+ <?php echo $this->getJsObjectName() ?>.doFilterCallback = validateFilterDate;
171
+ var period_date_from = $('period_date_from');
172
+ var period_date_to = $('period_date_to');
173
+ period_date_from.advaiceContainer = $('period_date_from_advaice');
174
+ period_date_to.advaiceContainer = $('period_date_to_advaice');
175
+
176
+ function validateFilterDate()
177
+ {
178
+ if (period_date_from && period_date_to) {
179
+ return Validation.validate(period_date_from) && Validation.validate(period_date_to);
180
+ }
181
+ else {
182
+ return true;
183
+ }
184
+ }
185
+ <?php endif;?>
186
+ /* Overwrite function from switcher.phtml widget*/
187
+ function switchStore(obj){
188
+ if (obj.options[obj.selectedIndex].getAttribute('website') == 'true') {
189
+ var selectionType = 'website';
190
+ } else if (obj.options[obj.selectedIndex].getAttribute('group') == 'true') {
191
+ var selectionType = 'group';
192
+ } else {
193
+ var selectionType = 'store';
194
+ }
195
+ var storeParam = obj.value ? selectionType + '/' + obj.value + '/' : '';
196
+ if(obj.switchParams){
197
+ storeParam+= obj.switchParams;
198
+ }
199
+ var formParam = new Array('period_date_from', 'period_date_to');
200
+ var paramURL = 'showReport=1&';
201
+ var switchURL = '<?php echo $this->getAbsoluteGridUrl(array('_current' => false)); ?>'.replace(/(store|group|website)\/\d+\//,'');
202
+
203
+ for(var i=0;i<formParam.length;i++){
204
+ if ($(formParam[i]).value && $(formParam[i]).name) {
205
+ paramURL+= $(formParam[i]).name + '=' + escape($(formParam[i]).value) + '&';
206
+ }
207
+ }
208
+ setLocation(switchURL + storeParam + '?' + paramURL);
209
+ }
210
+
211
+
212
+ //]]>
213
+ </script>
214
+ <?php endif; ?>
215
+ <?php endif; ?>
app/design/frontend/base/default/layout/zitec_dpd.xml ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <layout>
3
+
4
+
5
+ <shipping_tracking_popup translate="label">
6
+ <reference name="shipping.tracking.popup">
7
+ <action method="setTemplate">
8
+ <template helper="zitec_dpd/layout/changeShippingTrackingPopupTemplate" />
9
+ </action>
10
+ </reference>
11
+ </shipping_tracking_popup>
12
+
13
+ <sales_order_view>
14
+ <reference name="order_totals">
15
+ <block type="zitec_dpd/order_totals_cashondeliverysurchage" />
16
+ </reference>
17
+ </sales_order_view>
18
+
19
+ <sales_order_invoice>
20
+ <reference name="invoice_totals">
21
+ <block type="zitec_dpd/order_invoice_totals_cashondeliverysurcharge" />
22
+ </reference>
23
+ </sales_order_invoice>
24
+
25
+ <sales_order_creditmemo>
26
+ <reference name="creditmemo_totals">
27
+ <block type="zitec_dpd/order_creditmemo_totals_cashondeliverysurcharge" />
28
+ </reference>
29
+ </sales_order_creditmemo>
30
+
31
+ <sales_order_print>
32
+ <reference name="order_totals">
33
+ <block type="zitec_dpd/order_totals_cashondeliverysurchage" />
34
+ </reference>
35
+ </sales_order_print>
36
+
37
+ <sales_order_printinvoice>
38
+ <reference name="invoice_totals">
39
+ <block type="zitec_dpd/order_invoice_totals_cashondeliverysurcharge" />
40
+ </reference>
41
+ </sales_order_printinvoice>
42
+
43
+ <sales_order_printcreditmemo>
44
+ <reference name="creditmemo_totals">
45
+ <block type="zitec_dpd/order_creditmemo_totals_cashondeliverysurcharge" />
46
+ </reference>
47
+ </sales_order_printcreditmemo>
48
+
49
+ <sales_email_order_items>
50
+ <reference name="order_totals">
51
+ <block type="zitec_dpd/order_totals_cashondeliverysurchage" />
52
+ </reference>
53
+ </sales_email_order_items>
54
+
55
+ <sales_email_order_invoice_items>
56
+ <reference name="invoice_totals">
57
+ <block type="zitec_dpd/order_invoice_totals_cashondeliverysurcharge" />
58
+ </reference>
59
+ </sales_email_order_invoice_items>
60
+
61
+ <sales_email_order_creditmemo_items>
62
+ <reference name="creditmemo_totals">
63
+ <block type="zitec_dpd/order_creditmemo_totals_cashondeliverysurcharge" />
64
+ </reference>
65
+ </sales_email_order_creditmemo_items>
66
+
67
+ <checkout_onepage_index>
68
+ <reference name="head">
69
+ <action method="addJs"><script>zitec_fieldlengths/validator.js</script></action>
70
+ </reference>
71
+ </checkout_onepage_index>
72
+
73
+ <customer_address_form>
74
+ <reference name="head">
75
+ <action method="addJs"><script>zitec_fieldlengths/validator.js</script></action>
76
+ </reference>
77
+ </customer_address_form>
78
+
79
+ </layout>
app/design/frontend/base/default/template/zitec_dpd/customer/address/edit/addresslength.phtml ADDED
@@ -0,0 +1 @@
 
1
+ hello world!
app/design/frontend/base/default/template/zitec_dpd/shipping/tracking/popup.phtml ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 base_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
+ <?php /** @var $this Mage_Shipping_Block_Tracking_Popup */ ?>
28
+ <?php $_results = $this->getTrackingInfo(); ?>
29
+ <div class="page-title title-buttons">
30
+ <h1><?php echo $this->__('Tracking Information'); ?></h1>
31
+ <button class="button" onclick="window.close(); window.opener.focus();"><span><span><?php echo $this->__('Close Window') ?></span></span></button>
32
+ </div>
33
+ <?php if(sizeof($_results)>0): ?>
34
+ <?php foreach($_results as $shipid => $_result): ?>
35
+ <?php if($shipid): ?>
36
+ <h2 class="sub-title"><?php echo $this->__('Shipment #').$shipid; ?></h2>
37
+ <?php endif; ?>
38
+ <?php if(sizeof($_result)>0): ?>
39
+ <?php $rowCount = sizeof($_result); $counter = 1; ?>
40
+ <?php $_id = 0; foreach($_result as $track): ?>
41
+ <table class="tracking-table-popup data-table" id="tracking-table-popup-<?php echo $_id ?>">
42
+ <col width="15%" />
43
+ <col />
44
+ <tbody>
45
+ <?php if(is_object($track)): ?>
46
+ <tr>
47
+ <th class="label"><?php echo $this->__('Tracking Number:'); ?></th>
48
+ <td class="value"><?php echo $this->escapeHtml($track->getTracking()); ?></td>
49
+ </tr>
50
+ <?php if ($track->getCarrierTitle()): ?>
51
+ <tr>
52
+ <th class="label"><?php echo $this->__('Carrier:'); ?></th>
53
+ <td class="value"><?php echo $this->escapeHtml($track->getCarrierTitle()); ?></td>
54
+ </tr>
55
+ <?php endif; ?>
56
+ <?php if($track->getErrorMessage()): ?>
57
+ <tr>
58
+ <th class="label"><?php echo $this->__('Error:'); ?></th>
59
+ <td class="error"><?php echo $this->__('Tracking information is currently not available. Please '); if ($this->getContactUsEnabled()) : ?><a href="<?php echo $this->getContactUs() ?>" title="<?php echo $this->__('contact us') ?>" onclick="this.target='_blank'"><?php echo $this->__('contact us') ?></a><?php echo $this->__(' for more information or '); endif; echo $this->__('email us at '); ?><a href="mailto:<?php echo $this->getStoreSupportEmail() ?>"><?php echo $this->getStoreSupportEmail() ?></a></td>
60
+ </tr>
61
+ <?php elseif($track->getTrackSummary()): ?>
62
+ <tr>
63
+ <th class="label"><?php echo $this->__('Info:'); ?></th>
64
+ <td class="value"><?php echo $track->getTrackSummary(); ?></td>
65
+ </tr>
66
+ <?php elseif($track->getUrl()): ?>
67
+ <tr>
68
+ <th class="label"><?php echo $this->__('Track:'); ?></th>
69
+ <td class="value"><a href="<?php echo $this->escapeHtml($track->getUrl()); ?>" onclick="this.target='_blank'"><?php echo $this->escapeHtml($track->getUrl()); ?></a></td>
70
+ </tr>
71
+ <?php endif; ?>
72
+
73
+ <?php if ($track->getStatus()): ?>
74
+ <tr>
75
+ <th class="label"><?php echo $this->__('Status:'); ?></th>
76
+ <td class="value"><?php echo $track->getStatus(); ?></td>
77
+ </tr>
78
+ <?php endif; ?>
79
+
80
+ <?php if ($track->getDeliverydate()): ?>
81
+ <tr>
82
+ <th class="label"><?php echo $this->__('Delivered on:'); ?></th>
83
+ <td class="value"><?php echo $this->formatDeliveryDateTime($track->getDeliverydate(),$track->getDeliverytime()); ?></td>
84
+ </tr>
85
+ <?php endif; ?>
86
+
87
+ <?php if ($track->getSignedby()): ?>
88
+ <tr>
89
+ <th class="label"><?php echo $this->__('Signed by:'); ?></th>
90
+ <td class="value"><?php echo $track->getSignedby(); ?></td>
91
+ </tr>
92
+ <?php endif; ?>
93
+
94
+ <?php if ($track->getDeliveryLocation()): ?>
95
+ <tr>
96
+ <th class="label"><?php echo $this->__('Delivered to:'); ?></th>
97
+ <td class="value"><?php echo $track->getDeliveryLocation(); ?></td>
98
+ </tr>
99
+ <?php endif; ?>
100
+
101
+ <?php if ($track->getShippedDate()): ?>
102
+ <tr>
103
+ <th class="label"><?php echo $this->__('Shipped or billed on:'); ?></th>
104
+ <td class="value"><?php echo $track->getShippedDate(); ?></td>
105
+ </tr>
106
+ <?php endif; ?>
107
+
108
+ <?php if ($track->getService()): ?>
109
+ <tr>
110
+ <th class="label"><?php echo $this->__('Service Type:'); ?></th>
111
+ <td class="value"><?php echo $track->getService(); ?></td>
112
+ </tr>
113
+ <?php endif; ?>
114
+
115
+ <?php if ($track->getWeight()): ?>
116
+ <tr>
117
+ <th class="label"><?php echo $this->__('Weight:'); ?></th>
118
+ <td class="value"><?php echo $track->getWeight(); ?></td>
119
+ </tr>
120
+ <?php endif; ?>
121
+
122
+ <?php elseif(isset($track['title']) && isset($track['number']) && $track['number']): ?>
123
+ <!--if the tracking is custom value-->
124
+ <tr>
125
+ <th class="label"><?php echo ($track['title'] ? $this->escapeHtml($track['title']) : $this->__('N/A')); ?>:</th>
126
+ <td class="value"><?php echo (isset($track['number']) ? $this->escapeHtml($track['number']) : ''); ?></td>
127
+ </tr>
128
+ <?php endif; ?>
129
+ </tbody>
130
+ </table>
131
+ <script type="text/javascript">decorateTable('tracking-table-popup-<?php echo $_id++ ?>');</script>
132
+ <?php if (is_object($track) && sizeof($track->getProgressdetail())>0): ?>
133
+ <br />
134
+ <table class="data-table" id="track-history-table-<?php echo $track->getTracking(); ?>">
135
+ <col />
136
+ <col width="1" />
137
+ <col width="1" />
138
+ <col />
139
+ <thead>
140
+ <tr>
141
+ <th><?php echo $this->__('Location') ?></th>
142
+ <th><?php echo $this->__('Date') ?></th>
143
+ <th><?php echo $this->__('Local Time') ?></th>
144
+ <th><?php echo $this->__('Description') ?></th>
145
+ </tr>
146
+ </thead>
147
+ <tbody>
148
+ <?php foreach($track->getProgressdetail() as $_detail): ?>
149
+ <?php $_detailDate = (isset($_detail['deliverydate']) ? $this->formatDeliveryDate($_detail['deliverydate']) : '') ?>
150
+ <?php $_detailTime = (isset($_detail['deliverytime']) ? $this->formatDeliveryTime($_detail['deliverytime'], $_detail['deliverydate']) : '') ?>
151
+ <tr>
152
+ <td><?php echo (isset($_detail['deliverylocation']) ? $_detail['deliverylocation'] : ''); ?></td>
153
+ <td><span class="nobr"><?php echo $_detailDate ?></span></td>
154
+ <td><span class="nobr"><?php echo $_detailTime ?></span></td>
155
+ <td><?php echo (isset($_detail['activity']) ? $_detail['activity'] : '') ?></td>
156
+ </tr>
157
+ <?php endforeach; ?>
158
+ </tbody>
159
+ </table>
160
+ <script type="text/javascript">decorateTable('track-history-table-<?php echo $track->getTracking(); ?>');</script>
161
+ <?php endif; ?>
162
+ <div class="divider"></div>
163
+ <?php if($counter!=$rowCount): ?>
164
+ <?php endif; ?>
165
+ <?php $counter++; ?>
166
+ <!--end for each tracking information-->
167
+ <?php endforeach; ?>
168
+ <?php else: ?>
169
+ <p><?php echo $this->__('There is no tracking available for this shipment.'); ?></p>
170
+ <?php endif; ?>
171
+
172
+ <?php endforeach; ?>
173
+ <?php else: ?>
174
+ <p><?php echo $this->__('There is no tracking available.'); ?></p>
175
+ <?php endif; ?>
176
+ <div class="buttons-set">
177
+ <button type="button" title="<?php echo $this->__('Close Window') ?>" class="button" onclick="window.close(); window.opener.focus();"><span><span><?php echo $this->__('Close Window') ?></span></span></button>
178
+ </div>
app/design/frontend/base/default/template/zitec_dpd/tax/checkout/cashondeliverysurchage.phtml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /* @var $this Zitec_Dpd_Block_Tax_Checkout_Cashondeliverysurchage */ ?>
2
+
3
+ <?php if ($this->displayBoth()): ?>
4
+ <tr>
5
+ <td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
6
+ <?php echo $this->getExcludeTaxLabel() ?>
7
+ </td>
8
+ <td style="<?php echo $this->getStyle() ?>" class="a-right">
9
+ <?php echo $this->helper('checkout')->formatPrice($this->getCashondeliverySurchargeExcludeTax()) ?>
10
+ </td>
11
+ </tr>
12
+ <tr>
13
+ <td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
14
+ <?php echo $this->getIncludeTaxLabel() ?>
15
+ </td>
16
+ <td style="<?php echo $this->getStyle() ?>" class="a-right">
17
+ <?php echo $this->helper('checkout')->formatPrice($this->getCashOnDeliverySurchargeIncludeTax()) ?>
18
+ </td>
19
+ </tr>
20
+ <?php elseif ($this->displayIncludeTax()) : ?>
21
+ <tr>
22
+ <td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
23
+ <?php echo $this->getTotal()->getTitle() ?>
24
+ </td>
25
+ <td style="<?php echo $this->getStyle() ?>" class="a-right">
26
+ <?php echo $this->helper('checkout')->formatPrice($this->getCashondeliverySurchargeIncludeTax()) ?>
27
+ </td>
28
+ </tr>
29
+ <?php else: ?>
30
+ <tr>
31
+ <td style="<?php echo $this->getStyle() ?>" class="a-right" colspan="<?php echo $this->getColspan(); ?>">
32
+ <?php echo $this->escapeHtml($this->getTotal()->getTitle()) ?>
33
+ </td>
34
+ <td style="<?php echo $this->getStyle() ?>" class="a-right">
35
+ <?php echo $this->helper('checkout')->formatPrice($this->getCashOnDeliverySurchargeExcludeTax()) ?>
36
+ </td>
37
+ </tr>
38
+ <?php endif; ?>
app/etc/modules/Zitec_Dpd.xml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Zitec_Dpd>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <depends>Zitec_PackedShipment</depends>
8
+ <depends>Zitec_TableRates</depends>
9
+ </Zitec_Dpd>
10
+ </modules>
11
+ </config>
app/etc/modules/Zitec_FieldLengths.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Zitec_TableRates>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Zitec_TableRates>
8
+ </modules>
9
+ </config>
app/etc/modules/Zitec_PackedShipment.xml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <modules>
3
+ <Zitec_PackedShipment>
4
+ <active>true</active>
5
+ <codePool>community</codePool>
6
+ <depends>
7
+ <Mage_Shipping/>
8
+ </depends>
9
+ </Zitec_PackedShipment>
10
+ </modules>
11
+ </config>
app/etc/modules/Zitec_PrintShippingLabel.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+
2
+ <config>
3
+ <modules>
4
+ <Zitec_PrintShippingLabel>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Zitec_PrintShippingLabel>
8
+ </modules>
9
+ </config>
app/etc/modules/Zitec_ReportsCommon.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <modules>
3
+ <Zitec_ReportsCommon>
4
+ <active>true</active>
5
+ <codePool>community</codePool>
6
+ </Zitec_ReportsCommon>
7
+ </modules>
8
+ </config>
app/etc/modules/Zitec_ShippingReports.xml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <modules>
3
+ <Zitec_ShippingReports>
4
+ <active>true</active>
5
+ <codePool>community</codePool>
6
+ <depends>
7
+ <Zitec_ReportsCommon/>
8
+ </depends>
9
+ </Zitec_ShippingReports>
10
+ </modules>
11
+ </config>
app/etc/modules/Zitec_TableRates.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Zitec_TableRates>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Zitec_TableRates>
8
+ </modules>
9
+ </config>
app/locale/en_GB/Zitec_Dpd.csv ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "DPD Table Rates", "DPD Table Rates"
2
+ "Table Rates", "Table Rates"
3
+ "Enabled", "Enabled"
4
+ "DPD Country Select", "DPD Country Select"
5
+ "Production Mode", "Production Mode"
6
+ "Production WS URL", "Production WS URL"
7
+ "Test WS URL", "Test WS URL"
8
+ "Method Title", "Method Title"
9
+ "Method Name", "Method Name"
10
+ "Web Service Username", "Web Service Username"
11
+ "Web Service Password", "Web Service Password"
12
+ "Web Service Connection Timeout", "Web Service Connection Timeout"
13
+ "Set a timeout for connecting to the DPD web service in seconds.", "Set a timeout for connecting to the DPD web service in seconds."
14
+ "E.g. http://egproduction.dpd.com/IT4EMWebServices/eshop/", "E.g. http://egproduction.dpd.com/IT4EMWebServices/eshop/"
15
+ "E.g. http://egtest.dpd.com/IT4EMWebServices/eshop/", "E.g. http://egtest.dpd.com/IT4EMWebServices/eshop/"
16
+ "Sender Address Id", "Sender Address Id"
17
+ "Payer Id", "Payer Id"
18
+ "Service", "Service"
19
+ "Select the services that you want to enable. Note that you must also define the shipping prices for these services in your shipping table rates (see below).", "Select the services that you want to enable. Note that you must also define the shipping prices for these services in your shipping table rates (see below)."
20
+ "Export Shipping Table Rates", "Export Shipping Table Rates"
21
+ "Import Shipping Table Rates", "Import Shipping Table Rates"
22
+ "DPD GeoPost Pickup Address", "DPD GeoPost Pickup Address"
23
+ "Name", "Name"
24
+ "Additional Name", "Additional Name"
25
+ "Street", "Street"
26
+ "City", "City"
27
+ "Postcode", "Postcode"
28
+ "Country", "Country"
29
+ "Telephone", "Telephone"
30
+ "Email Address", "Email Address"
31
+ "Cash On Delivery for DPD GeoPost", "Cash On Delivery for DPD GeoPost"
32
+ "Enabled", "Enabled"
33
+ "Title", "Title"
34
+ "Description", "Description"
35
+ "Surcharge Name", "Surcharge Name"
36
+ "New order status", "New order status"
37
+ "Service", "Service"
38
+ "Payment Type", "Payment Type"
39
+ "Payment from Applicable Countries", "Payment from Applicable Countries"
40
+ "Payment from Specific Countries", "Payment from Specific Countries"
41
+ "The new shipping address for shipments associated with this order have been communicated successfully to DPD.", "The new shipping address for shipments associated with this order have been communicated successfully to DPD."
42
+ "An error occurred updating the shipping address details with DPD: <br /> ""%s""", "An error occurred updating the shipping address details with DPD: <br /> ""%s"""
43
+ "DPD could not update the shipment address. The following error was returned: <br /> ""%s: %s""", "DPD could not update the shipment address. The following error was returned: <br /> ""%s: %s"""
44
+ "An error occurred retrieving the updated shipping labels from DPD. <br />""s%""", "An error occurred retrieving the updated shipping labels from DPD. <br />""s%"""
45
+ "The total length of the address cannot be more than %s characters.", "The total length of the address cannot be more than %s characters."
46
+ " incl. tax", " incl. VAT"
47
+ " excl. tax", " excl. VAT"
48
+ " Incl. tax", " Incl. VAT"
49
+ " Excl. tax", " Excl. VAT"
50
+ "(Excl.Tax)", "(Excl. VAT)"
51
+ "(Incl.Tax)", "(Incl. VAT)"
52
+ " (Excl. Tax)", " (Excl. VAT)"
53
+ " (Incl. Tax)", " (Incl. VAT)"
54
+ "Cash", "Cash"
55
+ "Credit Card", "Credit Card"
56
+ "Crossed Check", "Crossed Cheque"
57
+ "Free", "Free"
58
+ "Error obtaining shipping price: %s", "Error obtaining shipping price: %s"
59
+ "DPD error: %s", "DPD error: %s"
60
+ "Shipping price not available in order currency", "Shipping price not available in order currency"
61
+ "Could not load the stored tracking information for track %s", "Could not load the stored tracking information for track %s"
62
+ "Error loading stored tracking information for track %s", "Error loading stored tracking information for track %s"
63
+ "Error calling DPD for track %s", "Error calling DPD for track %s"
64
+ "Error calling DPD for track %s: %s ", "Error calling DPD for track %s: %s "
65
+ "Export CSV", "Export CSV"
66
+ "Manifest", "Manifest"
67
+ "DPD Pickup", "DPD Pickup"
68
+ "Country", "Country"
69
+ "Region/State", "Region/State"
70
+ "Zip/Postal Code", "Postcode"
71
+ "Shipping Price/Percentage", "Shipping Price/Percentage"
72
+ "Please the shipments to include in the closed manifest.", "Please the shipments to include in the closed manifest."
73
+ "Could not include shipment %s in the manifest because it is not a DPD shipment.", "Could not include shipment %s in the manifest because it is not a DPD shipment."
74
+ "Could not include shipment %s in the manifest because it was not communicated to DPD.", "Could not include shipment %s in the manifest because it was not communicated to DPD."
75
+ "Could not include shipment %s in the manifest because it was cancelled with DPD.", "Could not include shipment %s in the manifest because it was cancelled with DPD."
76
+ "Could not include shipment %s in the manifest because it is already in a manifest.", "Could not include shipment %s in the manifest because it is already in a manifest."
77
+ "The shipments you selected come from different stores which have different DPD connection parameters. Please select shipments which belong to stores that use the same DPD connection parameters.", "The shipments you selected come from different stores which have different DPD connection parameters. Please select shipments which belong to stores that use the same DPD connection parameters."
78
+ "Shipment %s was added to the manifest.", "Shipment %s was added to the manifest."
79
+ "An error occurred whilst requesting the manifest from DPD: %s", "An error occurred whilst requesting the manifest from DPD: %s"
80
+ "An error occurred whilst communicating the manifest details to DPD. DPD says: ""%s""", "An error occurred whilst communicating the manifest details to DPD. DPD says: ""%s"""
81
+ "The manifest was communicated successfully to DPD, but an error occurred whilst saving the manifest details in Magento. <br />Please make a capture of this screen so that you have a record of the shipments included in the manifest. <br />For you reference when communicating with DPD, the manifest details are: <br /> Manifest Reference: %s <br />Manifest Name: %s <br />Manifest internal DPD ID: %s <br />The error message returned was: %s", "The manifest was communicated successfully to DPD, but an error occurred whilst saving the manifest details in Magento. <br />Please make a capture of this screen so that you have a record of the shipments included in the manifest. <br />For you reference when communicating with DPD, the manifest details are: <br /> Manifest Reference: %s <br />Manifest Name: %s <br />Manifest internal DPD ID: %s <br />The error message returned was: %s"
82
+ "Close DPD Manifest", "Close DPD Manifest"
83
+ "Once the manifest is closed for the selected shipments, you will not be able to make further changes to their shipping addresses. Do you want to continue?", "Once the manifest is closed for the selected shipments, you will not be able to make further changes to their shipping addresses. Do you want to continue?"
84
+ "Arrange DPD Pickup", "Arrange DPD Pickup"
85
+ "Date (DD/MM/YYYY)", "Date (DD/MM/YYYY)"
86
+ "Between", "Between"
87
+ "and", "and"
88
+ "Instructions", "Instructions"
89
+ "DPD Classic", "DPD Classic"
90
+ "DPD 10:00", "DPD 10:00"
91
+ "DPD 12:00", "DPD 12:00"
92
+ "DPD B2C", "DPD B2C"
93
+ "DPD Same Day", "DPD Same Day"
94
+ "Your new shipment was successfully communicated to DPD.", "Your new shipment was successfully communicated to DPD."
95
+ "DPD says, ""%s""", "DPD says, ""%s"""
96
+ "An error occurred communicating the shipment to DPD. The shipping method '%s' is invalid", "An error occurred communicating the shipment to DPD. The shipping method '%s' is invalid"
97
+ "The shipment could not be communicated to DPD because the shipping street the maximum permitted length of %s characters. <br />Please edit the shipping address to reduce the length of the street in the shipping address.", "The shipment could not be communicated to DPD because the shipping street the maximum permitted length of %s characters. <br />Please edit the shipping address to reduce the length of the street in the shipping address."
98
+ "An error occurred communicating the shipment to DPD:<br /> ""%s""", "An error occurred communicating the shipment to DPD:<br /> ""%s"""
99
+ "DPD could not process the new shipment. The following error was returned: <br /> ""%s: %s""", "DPD could not process the new shipment. The following error was returned: <br /> ""%s: %s"""
100
+ "Successfully closed manifest %s for the following shipments. <a href='%s'>Download the manifest</a>.", "Successfully closed manifest %s for the following shipments. <a href='%s'>Download the manifest</a>."
101
+ "An error occurred whilst closing the manifest: %s", "An error occurred whilst closing the manifest: %s"
102
+ "A problem occurred whilst attempting to download a manifest. No manifest was specified in the request.", "A problem occurred whilst attempting to download a manifest. No manifest was specified in the request."
103
+ "A problem occurred whilst attempting to download the manifest id %s: %s", "A problem occurred whilst attempting to download the manifest id %s: %s"
104
+ "A problem occurred whilst attempting to download the manifest %s. The manifest no longer exists.", "A problem occurred whilst attempting to download the manifest %s. The manifest no longer exists."
105
+ "An unexpected problem occurred whilst attempting to download the manifest %s. %s", "An unexpected problem occurred whilst attempting to download the manifest %s. %s"
106
+ "Please select the shipments for which you wish to arrange a pickup.", "Please select the shipments for which you wish to arrange a pickup."
107
+ "Please enter a pickup date in the format DD/MM/YYYY.", "Please enter a pickup date in the format DD/MM/YYYY."
108
+ "Please select a from and to time for the pickup.", "Please select a from and to time for the pickup."
109
+ "You cannot create a pickup because you have not fully specified your pickup address. <br />Please set your pickup address in System->Configuration->Sales->Shipping Settings->DPD GeoPost Pickup Address.", "You cannot create a pickup because you have not fully specified your pickup address. <br />Please set your pickup address in System->Configuration->Sales->Shipping Settings->DPD GeoPost Pickup Address."
110
+ "Unable to load shipment information for this shipment %s.", "Unable to load shipment information for this shipment %s."
111
+ "Your list did not contain any DPD shipments for which to arrange a pickup.", "Your list did not contain any DPD shipments for which to arrange a pickup."
112
+ "A problem occurred whilst communicating your shipment to DPD. <br />""%s""", "A problem occurred whilst communicating your shipment to DPD. <br />""%s"""
113
+ "DPD reported an error whilst attempting to arrange your pickup. <br />DPD says, ""%s""", "DPD reported an error whilst attempting to arrange your pickup. <br />DPD says, ""%s"""
114
+ "Invalid Table Rates File Format", "Invalid Table Rates File Format"
115
+ "An error occurred while import table rates.", "An error occurred while import table rates."
116
+ "%1$d records have been imported. See the following list of errors for each record that has not been imported: %2$s", "%1$d records have been imported. See the following list of errors for each record that has not been imported: %2$s"
117
+ "Invalid Table Rates format in the Row #%s", "Invalid Table Rates format in the Row #%s"
118
+ "Invalid Country ""%s"" in the Row #%s., "Invalid Country ""%s"" in the Row #%s."
119
+ "Invalid Region/State ""%s"" in the Row #%s.", "Invalid Region/State ""%s"" in the Row #%s."
120
+ "Invalid weight/price ""%s"" in the Row #%s.", "Invalid weight/price ""%s"" in the Row #%s."
121
+ "Invalid price/percentage ""%s"" in the Row #%s.", "Invalid price/percentage ""%s"" in the Row #%s."
122
+ "Invalid service ""%s"" in the Row #%s.", "Invalid service ""%s"" in the Row #%s."
123
+ "Invalid COD Surcharge ""%s"" in the Row #%s.", "Invalid COD Surcharge ""%s"" in the Row #%s."
124
+ "Invalid value Price vs Dest value ""%s"" in the Row #%s. The value should be 0 (Weight vs Dest) or 1 (Price vs Dest).", "Invalid value Price vs Dest value ""%s"" in the Row #%s. The value should be 0 (Weight vs Dest) or 1 (Price vs Dest)."
125
+ "Duplicate Row #%s (Country ""%s"", Region/State ""%s"", Zip ""%s"", Weight/Price ""%s"", Method ""%s"", Price vs Dest ""%s"").", "Duplicate Row #%s (Country ""%s"", Region/State ""%s"", Zip ""%s"", Weight/Price ""%s"", Method ""%s"", Price vs Dest ""%s"")."
126
+ "Once the manifest is closed, you will not be able to make further changes to the shipping address. Do you want to continue?", "Once the manifest is closed, you will not be able to make further changes to the shipping address. Do you want to continue?"
127
+ "Print Manifest", "Print Manifest"
128
+ "Close Manifest", "Close Manifest"
129
+ "-- Please select an option --", "-- Please select an option --"
130
+ "Other (enter web service URLs manually)", "Other (enter web service URLs manually)"
131
+ "Carrier", "Carrier"
132
+ "Title", "Title"
133
+ "Number", "Number"
134
+ "Label", "Label"
135
+ "Action", "Action"
136
+ "Delete", "Delete"
137
+ "Taking this action will cancel the shipment with DPD. Are you sure you want to continue?", "Taking this action will cancel the shipment with DPD. Are you sure you want to continue?"
138
+ "Are you sure?", "Are you sure?"
139
+ "The country you have selected does not have a web service URL for production mode. Please ensure you have selected the correct country, or select 'Other (enter web service URLs manually)' to enter a specific URL.", "The country you have selected does not have a web service URL for production mode. Please ensure you have selected the correct country, or select 'Other (enter web service URLs manually)' to enter a specific URL."
140
+ "The country you have selected does not have a web service URL for test mode. Please ensure you have selected the correct country, or select 'Other (enter web service URLs manually)' to enter a specific URL.", "The country you have selected does not have a web service URL for test mode. Please ensure you have selected the correct country, or select 'Other (enter web service URLs manually)' to enter a specific URL."
141
+ "An error occurred communicating the shipment to DPD at %s:<br /> '%s'", "An error occurred communicating the shipment to DPD at %s:<br /> '%s'"
142
+ "Auto-correct the user postcode in checkout","Auto-correct the user postcode in checkout"
143
+ "Use this option to allow DPD shipment method even if the postcode is not valid. The post code will be automatically generated considering the city, region and street. In some cases the administrator will have to manually validate the postcode.","Use this option to allow DPD shipment method even if the postcode is not valid. The post code will be automatically generated considering the city, region and street. In some cases the administrator will have to manually validate the postcode."
144
+ "Destination Country","Destination Country"
145
+ "Dest Region/State","Dest Region/State"
146
+ "Destination Zip/Postal Code","Destination Zip/Postal Code"
147
+ "Dest Zip/Postal Code","Dest Zip/Postal Code"
148
+ "Service", "Service"
149
+ "Weight (and above)","Weight (and above)"
150
+ "Price (and above)","Price (and above)"
151
+ "Shipping Price","Shipping Price"
152
+ "Shipping Price %","Shipping Price %"
153
+ "Addition Price","Addition Price"
154
+ "COD Surcharge","COD Surcharge"
155
+ "COD Surcharge %","COD Surcharge %"
156
+ "COD Min. Surcharge","COD Min. Surcharge"
157
+ "Import Rates","Import Rates"
158
+ "Dest Country","Dest Country"
159
+ "For rates with this service to be available, you must enable the service from the configuration panel of the shipping method in System->Configuration->Shipping Methods","For rates with this service to be available, you must enable the service from the configuration panel of the shipping method in System->Configuration->Shipping Methods"
160
+ "Price vs. Destination","Price vs. Destination"
161
+ "Weight vs. Destination","Weight vs. Destination"
162
+ "Enter the starting price for this rate in the base currency of website. This rate will apply to orders whose subtotal (excluding shipping) is greater or equal to this price. Only include the sales tax/VAT in this price if you have configured shipping prices to include it (see System->Configuration->Sales->Tax->Calulation Settings->Shipping Prices).","Enter the starting price for this rate in the base currency of website. This rate will apply to orders whose subtotal (excluding shipping) is greater or equal to this price. Only include the sales tax/VAT in this price if you have configured shipping prices to include it (see System->Configuration->Sales->Tax->Calulation Settings->Shipping Prices)."
163
+ "Enable Shipping Method","Enable Shipping Method"
164
+ "Enabled","Enabled"
165
+ "New Order Status","New Order Status"
166
+ "Surcharge Name","Surcharge Name",
167
+ "Payment Type","Payment Type"
168
+ "Payment amount type","Payment amount type"
169
+ "Payment amount","Payment amount"
170
+ "Payment from Applicable Countries","Payment from Applicable Countries"
171
+ "Payment from Specific Countries","Payment from Specific Countries"
172
+ "Order #","Order #"
173
+ "Purchased On","Purchased On"
174
+ "Ship to Name","Ship to Name"
175
+ "Postcode","Postcode"
176
+ "Region","Region"
177
+ "Country","Country"
178
+ "Order total","Order total"
179
+ "Shipping Price","Shipping Price"
180
+ "Total Shipping","Total Shipping"
181
+ "Cost","Cost"
182
+ "Shipping Profit/Loss","Shipping Profit/Loss"
app/locale/en_GB/Zitec_PackedShipment.csv ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Agrupación por bultos", "Grouping your shipment into parcels"
2
+ "Communicar este envío con el servicio de mensajería", "Communicate this shipment to the courier service"
3
+ "Communicar este envío con el servicio de mensajero", "Communicate this shipment to the courier service"
4
+ "Total bultos", "Total number of parcels"
5
+ "Coste del envío (base imponible):", "Shipping cost (excluding tax):"
6
+ "Diferencia:", "Difference:"
7
+ "Distribuya los productos en bultos", "Group the products in your shipment into parcels"
8
+ "Este módulo permite distribuir sus productos agrupados en bultos, utilizando la tabla inferior. Si lo desea, <strong>puede dejar bultos vacios, y el sistema no los tendrá en cuenta</strong>.", "This module lets you organize your products into parcels using the table below. If you like you can <strong>leave some parcels empty, and the system will not take them into account</strong>."
9
+ "Introduzca una referencia indicativa para las etiquetas de cada bulto", "Enter a descriptive reference for the shipping labels of each parcel"
10
+ "Este módulo genera etiquetas que debera pegar en cada bulto. Para facilitarle la logística, puede personalizar la etiqueta de cada bulto usando los siguientes campos.", "This module generates shipping labels to afix to each parcel. To help you match the labels with the correct parcels, you can customize the references used in each label using the following fields."
11
+ "Precio del envío al cliente (base imponible):", "Cost of shipping to customer (excluding tax):"
12
+ "Distribución de bultos", "Grouping Shipment into Parcels"
13
+ "bulto ", "Parcel "
14
+ "Continuar", "Continue"
15
+ "Cancelar", "Cancel"
16
+ "Enviar", "Submit"
17
+ "Referencia bulto ", "Parcel Reference "
18
+ "Descripción del bulto ", "Description of Parcel "
19
+ "Introduzca una descripción de cada bulto", "Enter a description for each parcel"
20
+ "Puede introducir una descripción de cada bulto para comunicar al servicio de mensajería usando los siguientes campos.", "You can enter a description of each parcel to communicate to the courier service in the fields below."
app/locale/en_GB/Zitec_PrintShippingLabel.csv ADDED
@@ -0,0 +1 @@
 
1
+ "Print Shipping Labels", "Print Shipping Labels"
app/locale/en_GB/Zitec_TableRates.csv ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Table Rates","Table Rates"
2
+ "Table Rates","Table Rates"
3
+ "Save","Save"
4
+ "Delete","Delete"
5
+ "Duplicate","Duplicate"
6
+ "Save And Continue Edit","Save And Continue Edit"
7
+ "Weight (and above)","Weight (and above)"
8
+ "Price (and above)","Price (and above)"
9
+ "Shipping Price","Shipping Price"
10
+ "Shipping Percentage","Shipping Percentage"
11
+ "Fixed Cash On Delivery Surcharge Amount","Fixed Cash On Delivery Surcharge Amount"
12
+ "Minimum COD Surcharge","Minimum COD Surcharge"
13
+ "Edit Rate","Edit Rate"
14
+ "New Rate","New Rate"
15
+ "Export","Export"
16
+ "Website","Website"
17
+ "Dest Country","Dest Country"
18
+ "Dest Zip/Postal Code","Dest Zip/Postal Code"
19
+ "* or blank - matches any","* or blank - matches any"
20
+ "Service","Service"
21
+ "For rates with this service to be available, you must enable the service from the configuration panel of the shipping method in System->Configuration->Shipping Methods","For rates with this service to be available, you must enable the service from the configuration panel of the shipping method in System->Configuration->Shipping Methods"
22
+ "Product","Product"
23
+ "For rates with this product to be available, you must enable the product from the configuration panel of the shipping method in System->Configuration->Shipping Methods","For rates with this product to be available, you must enable the product from the configuration panel of the shipping method in System->Configuration->Shipping Methods"
24
+ "Condition","Condition"
25
+ "Price vs. Destination","Price vs. Destination"
26
+ "Weight vs. Destination","Weight vs. Destination"
27
+ "Enable Shipping Method","Enable Shipping Method"
28
+ "Disabled","Disabled"
29
+ "Enabled","Enabled"
30
+ "Disable the shipping method if you would like it to be unavailable for orders whose price or weight is greater or equal to the value you have indicated.","Disable the shipping method if you would like it to be unavailable for orders whose price or weight is greater or equal to the value you have indicated."
31
+ "Shipping Price Calculation","Shipping Price Calculation"
32
+ "Fixed Price","Fixed Price"
33
+ "Add Percentage","Add Percentage"
34
+ "Use 'Add Percentage' if you want to calculate the shipping price by adding a percentage to price charged by the shipping carrier.","Use 'Add Percentage' if you want to calculate the shipping price by adding a percentage to price charged by the shipping carrier."
35
+ "Shipping Price","Shipping Price"
36
+ "Cash On Delivery Surcharge Calculation","Cash On Delivery Surcharge Calculation"
37
+ "Cash On Delivery Not Available","Cash On Delivery Not Available"
38
+ "Zero Surcharge","Zero Surcharge"
39
+ "Fixed Surcharge","Fixed Surcharge"
40
+ "Percentage Surcharge","Percentage Surcharge"
41
+ "Fixed Cash On Delivery Surcharge","Fixed Cash On Delivery Surcharge"
42
+ "Minimum COD Surcharge","Minimum COD Surcharge"
43
+ "Optionally specify the minimum COD surcharge.","Optionally specify the minimum COD surcharge."
44
+ "Dest Region/State","Dest Region/State"
45
+ "Import Rates","Import Rates"
46
+ "ID","ID"
47
+ "Destination Country","Destination Country"
48
+ "Dest Region/State","Dest Region/State"
49
+ "Destination Zip/Postal Code","Destination Zip/Postal Code"
50
+ "Yes","Yes"
51
+ "No","No"
52
+ "Shipping Price %","Shipping Price %"
53
+ "COD Surcharge","COD Surcharge"
54
+ "COD Surcharge %","COD Surcharge %"
55
+ "COD Min. Surcharge","COD Min. Surcharge"
56
+ "Are you sure?","Are you sure?"
57
+ "Import","Import"
58
+ "Promotion","Promotion"
59
+ "New Rate","New Rate"
60
+ "Import Rates","Import Rates"
61
+ "Export Rates","Export Rates"
62
+ "Rate duplicated successfully","Rate duplicated successfully"
63
+ "Rate was successfully saved","Rate was successfully saved"
64
+ "The rate could not be saved because it duplicates the destination, service/product and weight/price of an existing rate. Change some of the rate's values and try saving again.","The rate could not be saved because it duplicates the destination, service/product and weight/price of an existing rate. Change some of the rate's values and try saving again."
65
+ "Unable to find rate to save","Unable to find rate to save"
66
+ "Rate was successfully deleted","Rate was successfully deleted"
67
+ "Total of %d record(s) have been deleted.","Total of %d record(s) have been deleted."
68
+ "An error occurred while updating records.","An error occurred while updating records."
69
+ "Please specify the website and file you wish to import","Please specify the website and file you wish to import"
70
+ "An error occurred whilst importing the tablerates: %s","An error occurred whilst importing the tablerates: %s"
71
+ "Table rates imported successfully","Table rates imported successfully"
72
+ "Please specify the website whose rates you want to export","Please specify the website whose rates you want to export"
73
+ "Add Rate","Add Rate"
74
+ "Import Rates","Import Rates"
75
+ "Export Rates","Export Rates"
76
+ "Cash On Delivery Surcharge Percentage","Cash On Delivery Surcharge Percentage"
77
+ "Enter the starting weight in kg for this rate.","Enter the starting weight in kg for this rate."
78
+ "Enter the starting price for this rate in the base currency of website. This rate will apply to orders whose subtotal (excluding shipping) is greater or equal to this price. Only include the sales tax/VAT in this price if you have configured shipping prices to include it (see System->Configuration->Sales->Tax->Calulation Settings->Shipping Prices).","Enter the starting price for this rate in the base currency of website. This rate will apply to orders whose subtotal (excluding shipping) is greater or equal to this price. Only include the sales tax/VAT in this price if you have configured shipping prices to include it (see System->Configuration->Sales->Tax->Calulation Settings->Shipping Prices)."
app/locale/en_US/Zitec_Dpd.csv ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "DPD Table Rates", "Tabla de costes de envío DPD"
2
+ "Enabled", "Enabled"
3
+ "DPD Country Select", "DPD Country Select"
4
+ "Production Mode", "Production Mode"
5
+ "Production WS URL", "Production WS URL"
6
+ "Test WS URL", "Test WS URL"
7
+ "Method Title", "Method Title"
8
+ "Method Name", "Method Name"
9
+ "Web Service Username", "Web Service Username"
10
+ "Web Service Password", "Web Service Password"
11
+ "Web Service Connection Timeout", "Web Service Connection Timeout"
12
+ "Set a timeout for connecting to the DPD web service in seconds.", "Set a timeout for connecting to the DPD web service in seconds."
13
+ "E.g. http://egproduction.dpd.com/IT4EMWebServices/eshop/", "E.g. http://egproduction.dpd.com/IT4EMWebServices/eshop/"
14
+ "E.g. http://egtest.dpd.com/IT4EMWebServices/eshop/", "E.g. http://egtest.dpd.com/IT4EMWebServices/eshop/"
15
+ "Sender Address Id", "Sender Address Id"
16
+ "Payer Id", "Payer Id"
17
+ "Service", "Service"
18
+ "Select the services that you want to enable. Note that you must also define the shipping prices for these services in your shipping table rates (see below).", "Select the services that you want to enable. Note that you must also define the shipping prices for these services in your shipping table rates (see below)."
19
+ "Export Shipping Table Rates", "Export Shipping Table Rates"
20
+ "Import Shipping Table Rates", "Import Shipping Table Rates"
21
+ "DPD GeoPost Pickup Address", "DPD GeoPost Pickup Address"
22
+ "Name", "Name"
23
+ "Additional Name", "Additional Name"
24
+ "Street", "Street"
25
+ "City", "City"
26
+ "Postcode", "Postcode"
27
+ "Country", "Country"
28
+ "Telephone", "Telephone"
29
+ "Email Address", "Email Address"
30
+ "Cash On Delivery for DPD GeoPost", "Cash On Delivery for DPD GeoPost"
31
+ "Enabled", "Enabled"
32
+ "Title", "Title"
33
+ "Description", "Description"
34
+ "Surcharge Name", "Surcharge Name"
35
+ "New order status", "New order status"
36
+ "Service", "Service"
37
+ "Payment Type", "Payment Type"
38
+ "Payment from Applicable Countries", "Payment from Applicable Countries"
39
+ "Payment from Specific Countries", "Payment from Specific Countries"
40
+ "The new shipping address for shipments associated with this order have been communicated successfully to DPD.", "The new shipping address for shipments associated with this order have been communicated successfully to DPD."
41
+ "An error occurred updating the shipping address details with DPD: <br /> ""%s""", "An error occurred updating the shipping address details with DPD: <br /> ""%s"""
42
+ "DPD could not update the shipment address. The following error was returned: <br /> ""%s: %s""", "DPD could not update the shipment address. The following error was returned: <br /> ""%s: %s"""
43
+ "An error occurred retrieving the updated shipping labels from DPD. <br />""s%""", "An error occurred retrieving the updated shipping labels from DPD. <br />""s%"""
44
+ "The total length of the address cannot be more than %s characters.", "The total length of the address cannot be more than %s characters."
45
+ " incl. tax", " incl. VAT"
46
+ " excl. tax", " excl. VAT"
47
+ " Incl. tax", " Incl. VAT"
48
+ " Excl. tax", " Excl. VAT"
49
+ "(Excl.Tax)", "(Excl. VAT)"
50
+ "(Incl.Tax)", "(Incl. VAT)"
51
+ " (Excl. Tax)", " (Excl. VAT)"
52
+ " (Incl. Tax)", " (Incl. VAT)"
53
+ "Cash", "Cash"
54
+ "Credit Card", "Credit Card"
55
+ "Crossed Check", "Crossed Cheque"
56
+ "Free", "Free"
57
+ "Error obtaining shipping price: %s", "Error obtaining shipping price: %s"
58
+ "DPD error: %s", "DPD error: %s"
59
+ "Shipping price not available in order currency", "Shipping price not available in order currency"
60
+ "Could not load the stored tracking information for track %s", "Could not load the stored tracking information for track %s"
61
+ "Error loading stored tracking information for track %s", "Error loading stored tracking information for track %s"
62
+ "Error calling DPD for track %s", "Error calling DPD for track %s"
63
+ "Error calling DPD for track %s: %s ", "Error calling DPD for track %s: %s "
64
+ "Export CSV", "Export CSV"
65
+ "Manifest", "Manifest"
66
+ "DPD Pickup", "DPD Pickup"
67
+ "Country", "Country"
68
+ "Region/State", "Region/State"
69
+ "Zip/Postal Code", "Postcode"
70
+ "Shipping Price/Percentage", "Shipping Price/Percentage"
71
+ "Please the shipments to include in the closed manifest.", "Please the shipments to include in the closed manifest."
72
+ "Could not include shipment %s in the manifest because it is not a DPD shipment.", "Could not include shipment %s in the manifest because it is not a DPD shipment."
73
+ "Could not include shipment %s in the manifest because it was not communicated to DPD.", "Could not include shipment %s in the manifest because it was not communicated to DPD."
74
+ "Could not include shipment %s in the manifest because it was cancelled with DPD.", "Could not include shipment %s in the manifest because it was cancelled with DPD."
75
+ "Could not include shipment %s in the manifest because it is already in a manifest.", "Could not include shipment %s in the manifest because it is already in a manifest."
76
+ "The shipments you selected come from different stores which have different DPD connection parameters. Please select shipments which belong to stores that use the same DPD connection parameters.", "The shipments you selected come from different stores which have different DPD connection parameters. Please select shipments which belong to stores that use the same DPD connection parameters."
77
+ "Shipment %s was added to the manifest.", "Shipment %s was added to the manifest."
78
+ "An error occurred whilst requesting the manifest from DPD: %s", "An error occurred whilst requesting the manifest from DPD: %s"
79
+ "An error occurred whilst communicating the manifest details to DPD. DPD says: ""%s""", "An error occurred whilst communicating the manifest details to DPD. DPD says: ""%s"""
80
+ "The manifest was communicated successfully to DPD, but an error occurred whilst saving the manifest details in Magento. <br />Please make a capture of this screen so that you have a record of the shipments included in the manifest. <br />For you reference when communicating with DPD, the manifest details are: <br /> Manifest Reference: %s <br />Manifest Name: %s <br />Manifest internal DPD ID: %s <br />The error message returned was: %s", "The manifest was communicated successfully to DPD, but an error occurred whilst saving the manifest details in Magento. <br />Please make a capture of this screen so that you have a record of the shipments included in the manifest. <br />For you reference when communicating with DPD, the manifest details are: <br /> Manifest Reference: %s <br />Manifest Name: %s <br />Manifest internal DPD ID: %s <br />The error message returned was: %s"
81
+ "Close DPD Manifest", "Close DPD Manifest"
82
+ "Once the manifest is closed for the selected shipments, you will not be able to make further changes to their shipping addresses. Do you want to continue?", "Once the manifest is closed for the selected shipments, you will not be able to make further changes to their shipping addresses. Do you want to continue?"
83
+ "Arrange DPD Pickup", "Arrange DPD Pickup"
84
+ "Date (DD/MM/YYYY)", "Date (DD/MM/YYYY)"
85
+ "Between", "Between"
86
+ "and", "and"
87
+ "Instructions", "Instructions"
88
+ "DPD Classic", "DPD Classic"
89
+ "DPD 10:00", "DPD 10:00"
90
+ "DPD 12:00", "DPD 12:00"
91
+ "DPD B2C", "DPD B2C"
92
+ "DPD Same Day", "DPD Same Day"
93
+ "Your new shipment was successfully communicated to DPD.", "Your new shipment was successfully communicated to DPD."
94
+ "DPD says, ""%s""", "DPD says, ""%s"""
95
+ "An error occurred communicating the shipment to DPD. The shipping method '%s' is invalid", "An error occurred communicating the shipment to DPD. The shipping method '%s' is invalid"
96
+ "The shipment could not be communicated to DPD because the shipping street the maximum permitted length of %s characters. <br />Please edit the shipping address to reduce the length of the street in the shipping address.", "The shipment could not be communicated to DPD because the shipping street the maximum permitted length of %s characters. <br />Please edit the shipping address to reduce the length of the street in the shipping address."
97
+ "An error occurred communicating the shipment to DPD:<br /> ""%s""", "An error occurred communicating the shipment to DPD:<br /> ""%s"""
98
+ "DPD could not process the new shipment. The following error was returned: <br /> ""%s: %s""", "DPD could not process the new shipment. The following error was returned: <br /> ""%s: %s"""
99
+ "Successfully closed manifest %s for the following shipments. <a href='%s'>Download the manifest</a>.", "Successfully closed manifest %s for the following shipments. <a href='%s'>Download the manifest</a>."
100
+ "An error occurred whilst closing the manifest: %s", "An error occurred whilst closing the manifest: %s"
101
+ "A problem occurred whilst attempting to download a manifest. No manifest was specified in the request.", "A problem occurred whilst attempting to download a manifest. No manifest was specified in the request."
102
+ "A problem occurred whilst attempting to download the manifest id %s: %s", "A problem occurred whilst attempting to download the manifest id %s: %s"
103
+ "A problem occurred whilst attempting to download the manifest %s. The manifest no longer exists.", "A problem occurred whilst attempting to download the manifest %s. The manifest no longer exists."
104
+ "An unexpected problem occurred whilst attempting to download the manifest %s. %s", "An unexpected problem occurred whilst attempting to download the manifest %s. %s"
105
+ "Please select the shipments for which you wish to arrange a pickup.", "Please select the shipments for which you wish to arrange a pickup."
106
+ "Please enter a pickup date in the format DD/MM/YYYY.", "Please enter a pickup date in the format DD/MM/YYYY."
107
+ "Please select a from and to time for the pickup.", "Please select a from and to time for the pickup."
108
+ "You cannot create a pickup because you have not fully specified your pickup address. <br />Please set your pickup address in System->Configuration->Sales->Shipping Settings->DPD GeoPost Pickup Address.", "You cannot create a pickup because you have not fully specified your pickup address. <br />Please set your pickup address in System->Configuration->Sales->Shipping Settings->DPD GeoPost Pickup Address."
109
+ "Unable to load shipment information for this shipment %s.", "Unable to load shipment information for this shipment %s."
110
+ "Your list did not contain any DPD shipments for which to arrange a pickup.", "Your list did not contain any DPD shipments for which to arrange a pickup."
111
+ "A problem occurred whilst communicating your shipment to DPD. <br />""%s""", "A problem occurred whilst communicating your shipment to DPD. <br />""%s"""
112
+ "DPD reported an error whilst attempting to arrange your pickup. <br />DPD says, ""%s""", "DPD reported an error whilst attempting to arrange your pickup. <br />DPD says, ""%s"""
113
+ "Invalid Table Rates File Format", "Invalid Table Rates File Format"
114
+ "An error occurred while import table rates.", "An error occurred while import table rates."
115
+ "%1$d records have been imported. See the following list of errors for each record that has not been imported: %2$s", "%1$d records have been imported. See the following list of errors for each record that has not been imported: %2$s"
116
+ "Invalid Table Rates format in the Row #%s", "Invalid Table Rates format in the Row #%s"
117
+ "Invalid Country ""%s"" in the Row #%s., "Invalid Country ""%s"" in the Row #%s."
118
+ "Invalid Region/State ""%s"" in the Row #%s.", "Invalid Region/State ""%s"" in the Row #%s."
119
+ "Invalid weight/price ""%s"" in the Row #%s.", "Invalid weight/price ""%s"" in the Row #%s."
120
+ "Invalid price/percentage ""%s"" in the Row #%s.", "Invalid price/percentage ""%s"" in the Row #%s."
121
+ "Invalid service ""%s"" in the Row #%s.", "Invalid service ""%s"" in the Row #%s."
122
+ "Invalid COD Surcharge ""%s"" in the Row #%s.", "Invalid COD Surcharge ""%s"" in the Row #%s."
123
+ "Invalid value Price vs Dest value ""%s"" in the Row #%s. The value should be 0 (Weight vs Dest) or 1 (Price vs Dest).", "Invalid value Price vs Dest value ""%s"" in the Row #%s. The value should be 0 (Weight vs Dest) or 1 (Price vs Dest)."
124
+ "Duplicate Row #%s (Country ""%s"", Region/State ""%s"", Zip ""%s"", Weight/Price ""%s"", Method ""%s"", Price vs Dest ""%s"").", "Duplicate Row #%s (Country ""%s"", Region/State ""%s"", Zip ""%s"", Weight/Price ""%s"", Method ""%s"", Price vs Dest ""%s"")."
125
+ "Once the manifest is closed, you will not be able to make further changes to the shipping address. Do you want to continue?", "Once the manifest is closed, you will not be able to make further changes to the shipping address. Do you want to continue?"
126
+ "Print Manifest", "Print Manifest"
127
+ "Close Manifest", "Close Manifest"
128
+ "-- Please select an option --", "-- Please select an option --"
129
+ "Other (enter web service URLs manually)", "Other (enter web service URLs manually)"
130
+ "Carrier", "Carrier"
131
+ "Title", "Title"
132
+ "Number", "Number"
133
+ "Label", "Label"
134
+ "Action", "Action"
135
+ "Delete", "Delete"
136
+ "Taking this action will cancel the shipment with DPD. Are you sure you want to continue?", "Taking this action will cancel the shipment with DPD. Are you sure you want to continue?"
137
+ "Are you sure?", "Are you sure?"
138
+ "The country you have selected does not have a web service URL for production mode. Please ensure you have selected the correct country, or select 'Other (enter web service URLs manually)' to enter a specific URL.", "The country you have selected does not have a web service URL for production mode. Please ensure you have selected the correct country, or select 'Other (enter web service URLs manually)' to enter a specific URL."
139
+ "The country you have selected does not have a web service URL for test mode. Please ensure you have selected the correct country, or select 'Other (enter web service URLs manually)' to enter a specific URL.", "The country you have selected does not have a web service URL for test mode. Please ensure you have selected the correct country, or select 'Other (enter web service URLs manually)' to enter a specific URL."
140
+ "An error occurred communicating the shipment to DPD at %s:<br /> '%s'", "An error occurred communicating the shipment to DPD at %s:<br /> '%s'"
141
+
app/locale/en_US/Zitec_PackedShipment.csv ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Agrupación por bultos", "Grouping your shipment into parcels"
2
+ "Communicar este envío con el servicio de mensajería", "Communicate this shipment to the courier service"
3
+ "Communicar este envío con el servicio de mensajero", "Communicate this shipment to the courier service"
4
+ "Total bultos", "Total number of parcels"
5
+ "Coste del envío (base imponible):", "Shipping cost (excluding tax):"
6
+ "Diferencia:", "Difference:"
7
+ "Distribuya los productos en bultos", "Group the products in your shipment into parcels"
8
+ "Este módulo permite distribuir sus productos agrupados en bultos, utilizando la tabla inferior. Si lo desea, <strong>puede dejar bultos vacios, y el sistema no los tendrá en cuenta</strong>.", "This module lets you organize your products into parcels using the table below. If you like you can <strong>leave some parcels empty, and the system will not take them into account</strong>."
9
+ "Introduzca una referencia indicativa para las etiquetas de cada bulto", "Enter a descriptive reference for the shipping labels of each parcel"
10
+ "Este módulo genera etiquetas que debera pegar en cada bulto. Para facilitarle la logística, puede personalizar la etiqueta de cada bulto usando los siguientes campos.", "This module generates shipping labels to afix to each parcel. To help you match the labels with the correct parcels, you can customize the references used in each label using the following fields."
11
+ "Precio del envío al cliente (base imponible):", "Cost of shipping to customer (excluding tax):"
12
+ "Distribución de bultos", "Grouping Shipment into Parcels"
13
+ "bulto ", "Parcel "
14
+ "Continuar", "Continue"
15
+ "Cancelar", "Cancel"
16
+ "Enviar", "Submit"
17
+ "Referencia bulto ", "Parcel Reference "
18
+ "Descripción del bulto ", "Description of Parcel "
19
+ "Introduzca una descripción de cada bulto", "Enter a description for each parcel"
20
+ "Puede introducir una descripción de cada bulto para comunicar al servicio de mensajería usando los siguientes campos.", "You can enter a description of each parcel to communicate to the courier service in the fields below."
app/locale/en_US/Zitec_PrintShippingLabel.csv ADDED
@@ -0,0 +1 @@
 
1
+ "Print Shipping Labels", "Print Shipping Labels"
app/locale/en_US/Zitec_TableRates.csv ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Table Rates","Table Rates"
2
+ "Table Rates","Table Rates"
3
+ "Save","Save"
4
+ "Delete","Delete"
5
+ "Duplicate","Duplicate"
6
+ "Save And Continue Edit","Save And Continue Edit"
7
+ "Weight (and above)","Weight (and above)"
8
+ "Price (and above)","Price (and above)"
9
+ "Shipping Price","Shipping Price"
10
+ "Shipping Percentage","Shipping Percentage"
11
+ "Fixed Cash On Delivery Surcharge Amount","Fixed Cash On Delivery Surcharge Amount"
12
+ "Minimum COD Surcharge","Minimum COD Surcharge"
13
+ "Edit Rate","Edit Rate"
14
+ "New Rate","New Rate"
15
+ "Export","Export"
16
+ "Website","Website"
17
+ "Dest Country","Dest Country"
18
+ "Dest Zip/Postal Code","Dest Zip/Postal Code"
19
+ "* or blank - matches any","* or blank - matches any"
20
+ "Service","Service"
21
+ "For rates with this service to be available, you must enable the service from the configuration panel of the shipping method in System->Configuration->Shipping Methods","For rates with this service to be available, you must enable the service from the configuration panel of the shipping method in System->Configuration->Shipping Methods"
22
+ "Product","Product"
23
+ "For rates with this product to be available, you must enable the product from the configuration panel of the shipping method in System->Configuration->Shipping Methods","For rates with this product to be available, you must enable the product from the configuration panel of the shipping method in System->Configuration->Shipping Methods"
24
+ "Condition","Condition"
25
+ "Price vs. Destination","Price vs. Destination"
26
+ "Weight vs. Destination","Weight vs. Destination"
27
+ "Enable Shipping Method","Enable Shipping Method"
28
+ "Disabled","Disabled"
29
+ "Enabled","Enabled"
30
+ "Disable the shipping method if you would like it to be unavailable for orders whose price or weight is greater or equal to the value you have indicated.","Disable the shipping method if you would like it to be unavailable for orders whose price or weight is greater or equal to the value you have indicated."
31
+ "Shipping Price Calculation","Shipping Price Calculation"
32
+ "Fixed Price","Fixed Price"
33
+ "Add Percentage","Add Percentage"
34
+ "Use 'Add Percentage' if you want to calculate the shipping price by adding a percentage to price charged by the shipping carrier.","Use 'Add Percentage' if you want to calculate the shipping price by adding a percentage to price charged by the shipping carrier."
35
+ "Shipping Price","Shipping Price"
36
+ "Cash On Delivery Surcharge Calculation","Cash On Delivery Surcharge Calculation"
37
+ "Cash On Delivery Not Available","Cash On Delivery Not Available"
38
+ "Zero Surcharge","Zero Surcharge"
39
+ "Fixed Surcharge","Fixed Surcharge"
40
+ "Percentage Surcharge","Percentage Surcharge"
41
+ "Fixed Cash On Delivery Surcharge","Fixed Cash On Delivery Surcharge"
42
+ "Minimum COD Surcharge","Minimum COD Surcharge"
43
+ "Optionally specify the minimum COD surcharge.","Optionally specify the minimum COD surcharge."
44
+ "Dest Region/State","Dest Region/State"
45
+ "Import Rates","Import Rates"
46
+ "ID","ID"
47
+ "Destination Country","Destination Country"
48
+ "Dest Region/State","Dest Region/State"
49
+ "Destination Zip/Postal Code","Destination Zip/Postal Code"
50
+ "Yes","Yes"
51
+ "No","No"
52
+ "Shipping Price %","Shipping Price %"
53
+ "COD Surcharge","COD Surcharge"
54
+ "COD Surcharge %","COD Surcharge %"
55
+ "COD Min. Surcharge","COD Min. Surcharge"
56
+ "Are you sure?","Are you sure?"
57
+ "Import","Import"
58
+ "Promotion","Promotion"
59
+ "New Rate","New Rate"
60
+ "Import Rates","Import Rates"
61
+ "Export Rates","Export Rates"
62
+ "Rate duplicated successfully","Rate duplicated successfully"
63
+ "Rate was successfully saved","Rate was successfully saved"
64
+ "The rate could not be saved because it duplicates the destination, service/product and weight/price of an existing rate. Change some of the rate's values and try saving again.","The rate could not be saved because it duplicates the destination, service/product and weight/price of an existing rate. Change some of the rate's values and try saving again."
65
+ "Unable to find rate to save","Unable to find rate to save"
66
+ "Rate was successfully deleted","Rate was successfully deleted"
67
+ "Total of %d record(s) have been deleted.","Total of %d record(s) have been deleted."
68
+ "An error occurred while updating records.","An error occurred while updating records."
69
+ "Please specify the website and file you wish to import","Please specify the website and file you wish to import"
70
+ "An error occurred whilst importing the tablerates: %s","An error occurred whilst importing the tablerates: %s"
71
+ "Table rates imported successfully","Table rates imported successfully"
72
+ "Please specify the website whose rates you want to export","Please specify the website whose rates you want to export"
73
+ "Add Rate","Add Rate"
74
+ "Import Rates","Import Rates"
75
+ "Export Rates","Export Rates"
76
+ "Cash On Delivery Surcharge Percentage","Cash On Delivery Surcharge Percentage"
77
+ "Enter the starting weight in kg for this rate.","Enter the starting weight in kg for this rate."
78
+ "Enter the starting price for this rate in the base currency of website. This rate will apply to orders whose subtotal (excluding shipping) is greater or equal to this price. Only include the sales tax/VAT in this price if you have configured shipping prices to include it (see System->Configuration->Sales->Tax->Calulation Settings->Shipping Prices).","Enter the starting price for this rate in the base currency of website. This rate will apply to orders whose subtotal (excluding shipping) is greater or equal to this price. Only include the sales tax/VAT in this price if you have configured shipping prices to include it (see System->Configuration->Sales->Tax->Calulation Settings->Shipping Prices)."
app/locale/es_ES/Zitec_Dpd.csv ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "DPD Table Rates", "Tabla de costes de envío DPD"
2
+ "Enabled", "Enabled"
3
+ "DPD Country Select", "DPD Country Select"
4
+ "Production Mode", "Production Mode"
5
+ "Production WS URL", "Production WS URL"
6
+ "Test WS URL", "Test WS URL"
7
+ "Method Title", "Method Title"
8
+ "Method Name", "Method Name"
9
+ "Web Service Username", "Web Service Username"
10
+ "Web Service Password", "Web Service Password"
11
+ "Web Service Connection Timeout", "Web Service Connection Timeout"
12
+ "Set a timeout for connecting to the DPD web service in seconds.", "Set a timeout for connecting to the DPD web service in seconds."
13
+ "E.g. http://egproduction.dpd.com/IT4EMWebServices/eshop/", "E.g. http://egproduction.dpd.com/IT4EMWebServices/eshop/"
14
+ "E.g. http://egtest.dpd.com/IT4EMWebServices/eshop/", "E.g. http://egtest.dpd.com/IT4EMWebServices/eshop/"
15
+ "Sender Address Id", "Sender Address Id"
16
+ "Payer Id", "Payer Id"
17
+ "Service", "Service"
18
+ "Select the services that you want to enable. Note that you must also define the shipping prices for these services in your shipping table rates (see below).", "Select the services that you want to enable. Note that you must also define the shipping prices for these services in your shipping table rates (see below)."
19
+ "Export Shipping Table Rates", "Export Shipping Table Rates"
20
+ "Import Shipping Table Rates", "Import Shipping Table Rates"
21
+ "DPD GeoPost Pickup Address", "DPD GeoPost Pickup Address"
22
+ "Name", "Name"
23
+ "Additional Name", "Additional Name"
24
+ "Street", "Street"
25
+ "City", "City"
26
+ "Postcode", "Postcode"
27
+ "Country", "Country"
28
+ "Telephone", "Telephone"
29
+ "Email Address", "Email Address"
30
+ "Cash On Delivery for DPD GeoPost", "Cash On Delivery for DPD GeoPost"
31
+ "Enabled", "Enabled"
32
+ "Title", "Title"
33
+ "Description", "Description"
34
+ "Surcharge Name", "Surcharge Name"
35
+ "New order status", "New order status"
36
+ "Service", "Service"
37
+ "Payment Type", "Payment Type"
38
+ "Payment from Applicable Countries", "Payment from Applicable Countries"
39
+ "Payment from Specific Countries", "Payment from Specific Countries"
40
+ "The new shipping address for shipments associated with this order have been communicated successfully to DPD.", "The new shipping address for shipments associated with this order have been communicated successfully to DPD."
41
+ "An error occurred updating the shipping address details with DPD: <br /> ""%s""", "An error occurred updating the shipping address details with DPD: <br /> ""%s"""
42
+ "DPD could not update the shipment address. The following error was returned: <br /> ""%s: %s""", "DPD could not update the shipment address. The following error was returned: <br /> ""%s: %s"""
43
+ "An error occurred retrieving the updated shipping labels from DPD. <br />""s%""", "An error occurred retrieving the updated shipping labels from DPD. <br />""s%"""
44
+ "The total length of the address cannot be more than %s characters.", "The total length of the address cannot be more than %s characters."
45
+ " incl. tax", " incl. VAT"
46
+ " excl. tax", " excl. VAT"
47
+ " Incl. tax", " Incl. VAT"
48
+ " Excl. tax", " Excl. VAT"
49
+ "(Excl.Tax)", "(Excl. VAT)"
50
+ "(Incl.Tax)", "(Incl. VAT)"
51
+ " (Excl. Tax)", " (Excl. VAT)"
52
+ " (Incl. Tax)", " (Incl. VAT)"
53
+ "Cash", "Cash"
54
+ "Credit Card", "Credit Card"
55
+ "Crossed Check", "Crossed Cheque"
56
+ "Free", "Free"
57
+ "Error obtaining shipping price: %s", "Error obtaining shipping price: %s"
58
+ "DPD error: %s", "DPD error: %s"
59
+ "Shipping price not available in order currency", "Shipping price not available in order currency"
60
+ "Could not load the stored tracking information for track %s", "Could not load the stored tracking information for track %s"
61
+ "Error loading stored tracking information for track %s", "Error loading stored tracking information for track %s"
62
+ "Error calling DPD for track %s", "Error calling DPD for track %s"
63
+ "Error calling DPD for track %s: %s ", "Error calling DPD for track %s: %s "
64
+ "Export CSV", "Export CSV"
65
+ "Manifest", "Manifest"
66
+ "DPD Pickup", "DPD Pickup"
67
+ "Country", "Country"
68
+ "Region/State", "Region/State"
69
+ "Zip/Postal Code", "Postcode"
70
+ "Shipping Price/Percentage", "Shipping Price/Percentage"
71
+ "Please the shipments to include in the closed manifest.", "Please the shipments to include in the closed manifest."
72
+ "Could not include shipment %s in the manifest because it is not a DPD shipment.", "Could not include shipment %s in the manifest because it is not a DPD shipment."
73
+ "Could not include shipment %s in the manifest because it was not communicated to DPD.", "Could not include shipment %s in the manifest because it was not communicated to DPD."
74
+ "Could not include shipment %s in the manifest because it was cancelled with DPD.", "Could not include shipment %s in the manifest because it was cancelled with DPD."
75
+ "Could not include shipment %s in the manifest because it is already in a manifest.", "Could not include shipment %s in the manifest because it is already in a manifest."
76
+ "The shipments you selected come from different stores which have different DPD connection parameters. Please select shipments which belong to stores that use the same DPD connection parameters.", "The shipments you selected come from different stores which have different DPD connection parameters. Please select shipments which belong to stores that use the same DPD connection parameters."
77
+ "Shipment %s was added to the manifest.", "Shipment %s was added to the manifest."
78
+ "An error occurred whilst requesting the manifest from DPD: %s", "An error occurred whilst requesting the manifest from DPD: %s"
79
+ "An error occurred whilst communicating the manifest details to DPD. DPD says: ""%s""", "An error occurred whilst communicating the manifest details to DPD. DPD says: ""%s"""
80
+ "The manifest was communicated successfully to DPD, but an error occurred whilst saving the manifest details in Magento. <br />Please make a capture of this screen so that you have a record of the shipments included in the manifest. <br />For you reference when communicating with DPD, the manifest details are: <br /> Manifest Reference: %s <br />Manifest Name: %s <br />Manifest internal DPD ID: %s <br />The error message returned was: %s", "The manifest was communicated successfully to DPD, but an error occurred whilst saving the manifest details in Magento. <br />Please make a capture of this screen so that you have a record of the shipments included in the manifest. <br />For you reference when communicating with DPD, the manifest details are: <br /> Manifest Reference: %s <br />Manifest Name: %s <br />Manifest internal DPD ID: %s <br />The error message returned was: %s"
81
+ "Close DPD Manifest", "Close DPD Manifest"
82
+ "Once the manifest is closed for the selected shipments, you will not be able to make further changes to their shipping addresses. Do you want to continue?", "Once the manifest is closed for the selected shipments, you will not be able to make further changes to their shipping addresses. Do you want to continue?"
83
+ "Arrange DPD Pickup", "Arrange DPD Pickup"
84
+ "Date (DD/MM/YYYY)", "Date (DD/MM/YYYY)"
85
+ "Between", "Between"
86
+ "and", "and"
87
+ "Instructions", "Instructions"
88
+ "DPD Classic", "DPD Classic"
89
+ "DPD 10:00", "DPD 10:00"
90
+ "DPD 12:00", "DPD 12:00"
91
+ "DPD B2C", "DPD B2C"
92
+ "DPD Same Day", "DPD Same Day"
93
+ "Your new shipment was successfully communicated to DPD.", "Your new shipment was successfully communicated to DPD."
94
+ "DPD says, ""%s""", "DPD says, ""%s"""
95
+ "An error occurred communicating the shipment to DPD. The shipping method '%s' is invalid", "An error occurred communicating the shipment to DPD. The shipping method '%s' is invalid"
96
+ "The shipment could not be communicated to DPD because the shipping street the maximum permitted length of %s characters. <br />Please edit the shipping address to reduce the length of the street in the shipping address.", "The shipment could not be communicated to DPD because the shipping street the maximum permitted length of %s characters. <br />Please edit the shipping address to reduce the length of the street in the shipping address."
97
+ "An error occurred communicating the shipment to DPD:<br /> ""%s""", "An error occurred communicating the shipment to DPD:<br /> ""%s"""
98
+ "DPD could not process the new shipment. The following error was returned: <br /> ""%s: %s""", "DPD could not process the new shipment. The following error was returned: <br /> ""%s: %s"""
99
+ "Successfully closed manifest %s for the following shipments. <a href='%s'>Download the manifest</a>.", "Successfully closed manifest %s for the following shipments. <a href='%s'>Download the manifest</a>."
100
+ "An error occurred whilst closing the manifest: %s", "An error occurred whilst closing the manifest: %s"
101
+ "A problem occurred whilst attempting to download a manifest. No manifest was specified in the request.", "A problem occurred whilst attempting to download a manifest. No manifest was specified in the request."
102
+ "A problem occurred whilst attempting to download the manifest id %s: %s", "A problem occurred whilst attempting to download the manifest id %s: %s"
103
+ "A problem occurred whilst attempting to download the manifest %s. The manifest no longer exists.", "A problem occurred whilst attempting to download the manifest %s. The manifest no longer exists."
104
+ "An unexpected problem occurred whilst attempting to download the manifest %s. %s", "An unexpected problem occurred whilst attempting to download the manifest %s. %s"
105
+ "Please select the shipments for which you wish to arrange a pickup.", "Please select the shipments for which you wish to arrange a pickup."
106
+ "Please enter a pickup date in the format DD/MM/YYYY.", "Please enter a pickup date in the format DD/MM/YYYY."
107
+ "Please select a from and to time for the pickup.", "Please select a from and to time for the pickup."
108
+ "You cannot create a pickup because you have not fully specified your pickup address. <br />Please set your pickup address in System->Configuration->Sales->Shipping Settings->DPD GeoPost Pickup Address.", "You cannot create a pickup because you have not fully specified your pickup address. <br />Please set your pickup address in System->Configuration->Sales->Shipping Settings->DPD GeoPost Pickup Address."
109
+ "Unable to load shipment information for this shipment %s.", "Unable to load shipment information for this shipment %s."
110
+ "Your list did not contain any DPD shipments for which to arrange a pickup.", "Your list did not contain any DPD shipments for which to arrange a pickup."
111
+ "A problem occurred whilst communicating your shipment to DPD. <br />""%s""", "A problem occurred whilst communicating your shipment to DPD. <br />""%s"""
112
+ "DPD reported an error whilst attempting to arrange your pickup. <br />DPD says, ""%s""", "DPD reported an error whilst attempting to arrange your pickup. <br />DPD says, ""%s"""
113
+ "Invalid Table Rates File Format", "Invalid Table Rates File Format"
114
+ "An error occurred while import table rates.", "An error occurred while import table rates."
115
+ "%1$d records have been imported. See the following list of errors for each record that has not been imported: %2$s", "%1$d records have been imported. See the following list of errors for each record that has not been imported: %2$s"
116
+ "Invalid Table Rates format in the Row #%s", "Invalid Table Rates format in the Row #%s"
117
+ "Invalid Country ""%s"" in the Row #%s., "Invalid Country ""%s"" in the Row #%s."
118
+ "Invalid Region/State ""%s"" in the Row #%s.", "Invalid Region/State ""%s"" in the Row #%s."
119
+ "Invalid weight/price ""%s"" in the Row #%s.", "Invalid weight/price ""%s"" in the Row #%s."
120
+ "Invalid price/percentage ""%s"" in the Row #%s.", "Invalid price/percentage ""%s"" in the Row #%s."
121
+ "Invalid service ""%s"" in the Row #%s.", "Invalid service ""%s"" in the Row #%s."
122
+ "Invalid COD Surcharge ""%s"" in the Row #%s.", "Invalid COD Surcharge ""%s"" in the Row #%s."
123
+ "Invalid value Price vs Dest value ""%s"" in the Row #%s. The value should be 0 (Weight vs Dest) or 1 (Price vs Dest).", "Invalid value Price vs Dest value ""%s"" in the Row #%s. The value should be 0 (Weight vs Dest) or 1 (Price vs Dest)."
124
+ "Duplicate Row #%s (Country ""%s"", Region/State ""%s"", Zip ""%s"", Weight/Price ""%s"", Method ""%s"", Price vs Dest ""%s"").", "Duplicate Row #%s (Country ""%s"", Region/State ""%s"", Zip ""%s"", Weight/Price ""%s"", Method ""%s"", Price vs Dest ""%s"")."
125
+ "Once the manifest is closed, you will not be able to make further changes to the shipping address. Do you want to continue?", "Once the manifest is closed, you will not be able to make further changes to the shipping address. Do you want to continue?"
126
+ "Print Manifest", "Print Manifest"
127
+ "Close Manifest", "Close Manifest"
128
+ "-- Please select an option --", "-- Please select an option --"
129
+ "Other (enter web service URLs manually)", "Other (enter web service URLs manually)"
130
+ "Carrier", "Carrier"
131
+ "Title", "Title"
132
+ "Number", "Number"
133
+ "Label", "Label"
134
+ "Action", "Action"
135
+ "Delete", "Delete"
136
+ "Taking this action will cancel the shipment with DPD. Are you sure you want to continue?", "Taking this action will cancel the shipment with DPD. Are you sure you want to continue?"
137
+ "Are you sure?", "Are you sure?"
138
+ "The country you have selected does not have a web service URL for production mode. Please ensure you have selected the correct country, or select 'Other (enter web service URLs manually)' to enter a specific URL.", "The country you have selected does not have a web service URL for production mode. Please ensure you have selected the correct country, or select 'Other (enter web service URLs manually)' to enter a specific URL."
139
+ "The country you have selected does not have a web service URL for test mode. Please ensure you have selected the correct country, or select 'Other (enter web service URLs manually)' to enter a specific URL.", "The country you have selected does not have a web service URL for test mode. Please ensure you have selected the correct country, or select 'Other (enter web service URLs manually)' to enter a specific URL."
140
+ "An error occurred communicating the shipment to DPD at %s:<br /> '%s'", "An error occurred communicating the shipment to DPD at %s:<br /> '%s'"
app/locale/es_ES/Zitec_PackedShipment.csv ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Agrupación por bultos", "Grouping your shipment into parcels"
2
+ "Communicar este envío con el servicio de mensajería", "Communicate this shipment to the courier service"
3
+ "Communicar este envío con el servicio de mensajero", "Communicate this shipment to the courier service"
4
+ "Total bultos", "Total number of parcels"
5
+ "Coste del envío (base imponible):", "Shipping cost (excluding tax):"
6
+ "Diferencia:", "Difference:"
7
+ "Distribuya los productos en bultos", "Group the products in your shipment into parcels"
8
+ "Este módulo permite distribuir sus productos agrupados en bultos, utilizando la tabla inferior. Si lo desea, <strong>puede dejar bultos vacios, y el sistema no los tendrá en cuenta</strong>.", "This module lets you organize your products into parcels using the table below. If you like you can <strong>leave some parcels empty, and the system will not take them into account</strong>."
9
+ "Introduzca una referencia indicativa para las etiquetas de cada bulto", "Enter a descriptive reference for the shipping labels of each parcel"
10
+ "Este módulo genera etiquetas que debera pegar en cada bulto. Para facilitarle la logística, puede personalizar la etiqueta de cada bulto usando los siguientes campos.", "This module generates shipping labels to afix to each parcel. To help you match the labels with the correct parcels, you can customize the references used in each label using the following fields."
11
+ "Precio del envío al cliente (base imponible):", "Cost of shipping to customer (excluding tax):"
12
+ "Distribución de bultos", "Grouping Shipment into Parcels"
13
+ "bulto ", "Parcel "
14
+ "Continuar", "Continue"
15
+ "Cancelar", "Cancel"
16
+ "Enviar", "Submit"
17
+ "Referencia bulto ", "Parcel Reference "
18
+ "Descripción del bulto ", "Description of Parcel "
19
+ "Introduzca una descripción de cada bulto", "Enter a description for each parcel"
20
+ "Puede introducir una descripción de cada bulto para comunicar al servicio de mensajería usando los siguientes campos.", "You can enter a description of each parcel to communicate to the courier service in the fields below."
app/locale/es_ES/Zitec_TableRates.csv ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Table Rates", "Tabla de costes"
2
+ "Table Rates", "Tabla de costes"
3
+ "Save", "Guardar"
4
+ "Delete", "Eliminar"
5
+ "Duplicate", "Duplicar"
6
+ "Save And Continue Edit", "Guardar y continuar editando"
7
+ "Weight (and above)", "Peso (y por encima)"
8
+ "Price (and above)", "Precio (y por encima)"
9
+ "Shipping Price", "Precio de envío"
10
+ "Shipping Percentage", "Porcentaje añadido al coste de envío"
11
+ "Fixed Cash On Delivery Surcharge Amount", "Sobrecargo de contrareembolso fijo"
12
+ "Minimum COD Surcharge", "Sobrecargo mínimo de contrareembolso"
13
+ "Edit Rate", "Editar tasa"
14
+ "New Rate", "Nueva tasa"
15
+ "Export", "Exportar"
16
+ "Website", "Sitio web"
17
+ "Dest Country", "País de destino"
18
+ "Dest Zip/Postal Code", "Código postal de destino"
19
+ "* or blank - matches any", "* o en blanco = cualquiera"
20
+ "Service", "Servicio"
21
+ "For rates with this service to be available, you must enable the service from the configuration panel of the shipping method in System->Configuration->Shipping Methods", "Para que estén disponibles las tasas de este servicio, hay que habilitar el servicio desde el panel de configuración del método de envío en Sistema->Configuración->Métodos de envío."
22
+ "Product", "Producto"
23
+ "For rates with this product to be available, you must enable the product from the configuration panel of the shipping method in System->Configuration->Shipping Methods", "Para que estén disponibles las tasas de este producto, hay que habilitar el producto desde el panel de configuración del método de envío en Sistema->Configuración->Métodos de envío."
24
+ "Condition", "Condición"
25
+ "Price vs. Destination", "Precio vs. destino"
26
+ "Weight vs. Destination", "Peso vs. destino"
27
+ "Enable Shipping Method", "Habilitar tasa de envío"
28
+ "Disabled", "Deshabilitada"
29
+ "Enabled", "Habilitada"
30
+ "Disable the shipping method if you would like it to be unavailable for orders whose price or weight is greater or equal to the value you have indicated.", "Deshabilita la tasa de envío si quieres que no esté disponible para pedidos cuyos precios o pesos son mayores o iguales al precio indicado."
31
+ "Shipping Price Calculation", "Cálculo del precio de envío"
32
+ "Fixed Price", "Precio fijo"
33
+ "Add Percentage", "Añadir porcentaje"
34
+ "Use 'Add Percentage' if you want to calculate the shipping price by adding a percentage to price charged by the shipping carrier.", "Utiliza la opción 'Añadir porcentaje' si quieres calcular el precio de envío añadiendo un porcentaje al precio cobrado por el servicio de mensajería"
35
+ "Shipping Price", "Precio de envío"
36
+ "Cash On Delivery Surcharge Calculation", "Cálculo del sobrecargo de contrareembolso"
37
+ "Cash On Delivery Not Available", "Contrareembolso no disponible"
38
+ "Zero Surcharge", "Sin sobrecargo"
39
+ "Fixed Surcharge", "Sobrecargo fijo"
40
+ "Percentage Surcharge", "Sobrecargo porcentual"
41
+ "Fixed Cash On Delivery Surcharge", "Sobrecargo de contrareembolso fijo"
42
+ "Minimum COD Surcharge", "Sobrecargo de contrareembolso mínimo"
43
+ "Optionally specify the minimum COD surcharge.", "Opcionalmente, especifica el sobrecargo de contrareembolso mínimo."
44
+ "Dest Region/State", "Provincia de destino"
45
+ "Import Rates", "Importar tabla de costes"
46
+ "ID", "ID"
47
+ "Destination Country", "País de destino"
48
+ "Dest Region/State", "Provincia de destino"
49
+ "Destination Zip/Postal Code", "Código postal de destino"
50
+ "Yes", "Sí"
51
+ "No", "No"
52
+ "Shipping Price %", "Precio de envío %"
53
+ "COD Surcharge", "Sobrecargo contrareembolso"
54
+ "COD Surcharge %", "Sobrecargo contrareembolso %"
55
+ "COD Min. Surcharge", "Sobrecargo contrareembolso mínimo"
56
+ "Are you sure?", "¿Estás seguro?"
57
+ "Import", "Importar"
58
+ "Promotion", "Promoción"
59
+ "New Rate", "Nueva tasa"
60
+ "Import Rates", "Importar tasas"
61
+ "Export Rates", "Exportar tasas"
62
+ "Rate duplicated successfully", "La tasa se ha duplicado con éxito"
63
+ "Rate was successfully saved", "La tasa se ha guardado con éxito"
64
+ "The rate could not be saved because it duplicates the destination, service/product and weight/price of an existing rate. Change some of the rate's values and try saving again.", "La tasa no se ha podido guardar porque duplica el destino, servicio/producto, y peso/precio de una tasa existente. Cambia unos de los valores de la tasa y vuelve a guardarla."
65
+ "Unable to find rate to save", "No se ha podido encontrar la tasa para guardarla."
66
+ "Rate was successfully deleted", "La tasa se ha eliminado con éxito"
67
+ "Total of %d record(s) have been deleted.", "%d tasa(s) eliminadas."
68
+ "An error occurred while updating records.", "Ha ocurrido un error actulizando la tabla de costes."
69
+ "Please specify the website and file you wish to import", "Por favor, especifica el sitio web y el fichero que quieres importar."
70
+ "An error occurred whilst importing the tablerates: %s", "Ha ocurrido un error importando la tabla de costes: %s"
71
+ "Table rates imported successfully", "Se ha importado con éxito la tabla de costes."
72
+ "Please specify the website whose rates you want to export", "Por favor, especifica el sitio web cuya tabla de costes quieres exportar"
73
+ "Add Rate", "Añadir tasa"
74
+ "Import Rates", "Importar tasas"
75
+ "Export Rates", "Exportar tasas"
76
+ "Cash On Delivery Surcharge Percentage", "Sobrecargo de contrareembolso porcentual"
77
+ "Enter the starting weight in kg for this rate.", "Introduce el peso mínimo en kg para esta tasa."
78
+ "Enter the starting price for this rate in the base currency of website. This rate will apply to orders whose subtotal (excluding shipping) is greater or equal to this price. Only include the sales tax/VAT in this price if you have configured shipping prices to include it (see System->Configuration->Sales->Tax->Calulation Settings->Shipping Prices).", "Introduce el precio mínimo para esta tasa en la divisa base del sitio web. Esta tasa se aplicará a los pedidos cuyos subtotales (excluyendo el precio de envío) son mayores o iguales a este precio. Deberías incluir el IVA en este precio sólo en el caso de que hayas configurado los precios de envío a incluirlo (Sistema->Configuración->Ventas->Impuestos->Ajustes de cálculo->Precios de envío)"
79
+
app/locale/hr_HR/Zitec_Dpd.csv ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "DPD Table Rates","DPD tablica cijena"
2
+ "Enabled","Dozvoljeno"
3
+ "DPD Country Select","DPD popis država - izabrati"
4
+ "Production Mode","Radna metoda"
5
+ "Production WS URL","Radni WS URL"
6
+ "Test WS URL","Testni WS URL"
7
+ "Method Title","Naslov metode"
8
+ "Method Name","Ime metode"
9
+ "Web Service Username","Korisničko ime Web usluge"
10
+ "Web Service Password","Lozinka Web Usluge"
11
+ "Web Service Connection Timeout","Tajm-out povezivanja s Web uslugom"
12
+ "Set a timeout for connecting to the DPD web service in seconds.","Odredite u sekundama period tajm-outa za povezivanje s DPD web uslugom"
13
+ "E.g. http://egproduction.dpd.com/IT4EMWebServices/eshop/","E.g. http://egproduction.dpd.com/IT4EMWebServices/eshop/"
14
+ "E.g. http://egtest.dpd.com/IT4EMWebServices/eshop/","E.g. http://egtest.dpd.com/IT4EMWebServices/eshop/"
15
+ "Sender Address Id","Pošiljatelj adresa ID"
16
+ "Payer Id","Platitelj ID"
17
+ "Service","Servis"
18
+ "Select the services that you want to enable. Note that you must also define the shipping prices for these services in your shipping table rates (see below).","Ne zaboravite definirati cijene dostava za servise koje ste omogućili (pogledajte ispod)."
19
+ "Export Shipping Table Rates","Eksportirati tablicu cijena dostave"
20
+ "Import Shipping Table Rates","Importirati tablicu cijena dostave"
21
+ "DPD GeoPost Pickup Address","DPD GeoPost adresa pokupljanja"
22
+ "Name","Ime"
23
+ "Additional Name","Prezime"
24
+ "Street","Ulica"
25
+ "City","Grad"
26
+ "Postcode","Poštanski broj"
27
+ "Country","Država"
28
+ "Telephone","Telefon"
29
+ "Email Address","Email"
30
+ "Cash On Delivery for DPD GeoPost","Plaćanje gotovinom prilikom dostave koristeći DPD GeoPost"
31
+ "Enabled","Omogućeno"
32
+ "Title","Naslov"
33
+ "Description","Opis"
34
+ "Surcharge Name","Surcharge Name"
35
+ "New order status","Status novog naloga"
36
+ "Service","Servis"
37
+ "Payment Type","Vrsta plaćanja"
38
+ "Payment from Applicable Countries","Payment from Applicable Countries"
39
+ "Payment from Specific Countries","Payment from Specific Countries"
40
+ "The new shipping address for shipments associated with this order have been communicated successfully to DPD.",
41
+ "An error occurred updating the shipping address details with DPD: <br /> ""%s""","Pojavila se greška kod ažuriranja detalja adrese dostave sa DPD-om: <br /> ""%s"""
42
+ "DPD could not update the shipment address. The following error was returned: <br /> ""%s: %s""","DPD ne može ažurirati adresu dostave. Pojavila se slijedeća greška: <br /> ""%s: %s"""
43
+ "An error occurred retrieving the updated shipping labels from DPD. <br />""s%""","Pojavila se greška prilikom primanja ažuriranih paketnih oznaka DPD-a. <br />""s%"""
44
+ "The total length of the address cannot be more than %s characters.","Dužina adrese ne može imati više od % znakova."
45
+ " incl. tax","PDV sadržan"
46
+ " excl. tax","PDV nije sadržan"
47
+ " Incl. tax","PDV sadržan"
48
+ " Excl. tax","PDV nije sadržan"
49
+ "(Excl.Tax)","(PDV nije sadržan)"
50
+ "(Incl.Tax)","(PDV sadržan)"
51
+ " (Excl. Tax)","(PDV nije sadržan)"
52
+ " (Incl. Tax)","(PDV sadržan)"
53
+ "Cash","Gotovina"
54
+ "Credit Card","Kreditna kartica"
55
+ "Crossed Check","Ček"
56
+ "Free","Besplatno"
57
+ "Error obtaining shipping price: %s","Pogreška prilikom dobivanja cijene dostave: %s"
58
+ "DPD error: %s","DPD greška: %s"
59
+ "Shipping price not available in order currency","Cijena dostave nije moguća u naručenoj valuti"
60
+ "Could not load the stored tracking information for track %s","Nije moguće prenijeti pohranjene informacije za paketne brojeve %s"
61
+ "Error loading stored tracking information for track %s","Pogreška prilikom pohranjivanja paketne informacije za paketne brojeve %s"
62
+ "Error calling DPD for track %s","Greška prilikom pozivanja DPD-a za paketne brojeve %s"
63
+ "Error calling DPD for track %s: %s ","Greška prilikom pozivanja DPD-a za paketne brojeve: %s"
64
+ "Export CSV","Export CSV"
65
+ "Manifest","Otpremnica"
66
+ "DPD Pickup","DPD pokupljanje"
67
+ "Country","Država"
68
+ "Region/State","Županija"
69
+ "Zip/Postal Code","Poštanski broj"
70
+ "Shipping Price/Percentage","Cijena dostave / postotak"
71
+ "Please the shipments to include in the closed manifest.","Molimo da se sve pošiljke nalaze na Otpremnici."
72
+ "Could not include shipment %s in the manifest because it is not a DPD shipment.","Broj Pošiljke %s ne nalazi se na Otpremnici jer nije DPD pošiljka."
73
+ "Could not include shipment %s in the manifest because it was not communicated to DPD.","Broj Pošiljke %s se ne nalazi na Otpremnici jer DPD nije informiran."
74
+ "Could not include shipment %s in the manifest because it was cancelled with DPD.","Broj Pošiljke %s ne nalazi se na Otpremnici jer je stornirana od strane DPD-a."
75
+ "Could not include shipment %s in the manifest because it is already in a manifest.","Broj Pošiljke %s ne nalazi se na Otpremnici jer je već od prije na Otpremnici."
76
+ "The shipments you selected come from different stores which have different DPD connection parameters. Please select shipments which belong to stores that use the same DPD connection parameters.","Pošiljke koje ste odabrali dolaze iz različitih dućana koji imaju različite parametre DPD veze. Odaberite pošiljke koje pripadaju trgovinama koje koriste iste DPD parametre veze."
77
+ "Shipment %s was added to the manifest.","Broj Pošiljke %s je dodan na Otpremnicu."
78
+ "An error occurred whilst requesting the manifest from DPD: %s","Došlo je do greške prilikom traženja otpremnice od DPD-a: %s"
79
+ "An error occurred whilst communicating the manifest details to DPD. DPD says: ""%s""","Došlo je do greške prilikom komunikacije detalja Otpremnice prema DPD-u. DPD kaže: ""%s"""
80
+ "The manifest was communicated successfully to DPD, but an error occurred whilst saving the manifest details in Magento. <br />Please make a capture of this screen so that you have a record of the shipments included in the manifest. <br />For you reference when communicating with DPD, the manifest details are: <br /> Manifest Reference: %s <br />Manifest Name: %s <br />Manifest internal DPD ID: %s <br />The error message returned was: %s",
81
+ "Close DPD Manifest","Zatvoriti DPD otpremnice"
82
+ "Once the manifest is closed for the selected shipments, you will not be able to make further changes to their shipping addresses. Do you want to continue?",
83
+ "Arrange DPD Pickup","Organizirati DPD pokupljanje"
84
+ "Date (DD/MM/YYYY)","Datum (DD/MM/YYYY)"
85
+ "Between","između"
86
+ "and","i"
87
+ "Instructions","Uputstva"
88
+ "DPD Classic","DPD Classic"
89
+ "DPD 10:00","DPD 10:00"
90
+ "DPD 12:00","DPD 12:00"
91
+ "DPD B2C","DPD B2C"
92
+ "DPD Same Day","DPD Isti dan"
93
+ "Your new shipment was successfully communicated to DPD.","Vaša nova pošiljka uspješno je priopćena DPD-u."
94
+ "DPD says, ""%s""","DPD kaže, ""%s"""
95
+ "An error occurred communicating the shipment to DPD. The shipping method '%s' is invalid","Došlo je do greške kod komunikacije pošiljke sa DPD-om. Metoda otpreme ""%s"" nije valjana."
96
+ "The shipment could not be communicated to DPD because the shipping street the maximum permitted length of %s characters. <br />Please edit the shipping address to reduce the length of the street in the shipping address.",
97
+ "An error occurred communicating the shipment to DPD:<br /> ""%s""","Došlo je do greške kod komunikacije sa DPD-om. Slijedeća greška je vraćena: <br /> ""%s"""
98
+ "DPD could not process the new shipment. The following error was returned: <br /> ""%s: %s""","DPD ne može procesuirati novu pošiljku. Slijedeća greška je vraćena: <br /> ""%s: %s"""
99
+ "Successfully closed manifest %s for the following shipments. <a href='%s'>Download the manifest</a>.","Otpremnica %s uspješno zatvorena za slijedeće pošiljke. <a href='%s'>Preuzeti Otpremnicu</a>."
100
+ "An error occurred whilst closing the manifest: %s","Došlo je do greške prilikom zatvaranja Otpremnice: %s"
101
+ "A problem occurred whilst attempting to download a manifest. No manifest was specified in the request.","Došlo je do greške prilikom pokušaja preuzimanja Otpremnice. Nije specificirana ni jedna Otpremnice."
102
+ "A problem occurred whilst attempting to download the manifest id %s: %s","Došlo je do greške prilikom pokušaja preuzimanja Otpremnice id %s: %s"
103
+ "A problem occurred whilst attempting to download the manifest %s. The manifest no longer exists.","Došlo je do greške prilikom pokušaja preuzimanja Otpremnice id %s. Ta Otpremnica više ne postoji."
104
+ "An unexpected problem occurred whilst attempting to download the manifest %s. %s","Pojavio se neočekivani problem kod pokušaja preuzimanja otpremnice %s. %s"
105
+ "Please select the shipments for which you wish to arrange a pickup.","Molimo označite pošiljku za koju želite dogovriti pokupljanje."
106
+ "Please enter a pickup date in the format DD/MM/YYYY.","Molimo unesite datum pokupljanja u formatu DD/MM/YYYY."
107
+ "Please select a from and to time for the pickup.","Molimo oznaćite vrijeme od - do za pokupljanje."
108
+ "You cannot create a pickup because you have not fully specified your pickup address. <br />Please set your pickup address in System->Configuration->Sales->Shipping Settings->DPD GeoPost Pickup Address.","Ne možete kreirati pokupljanje jer niste sasvim specificirali vašu adresu pokupljanja. <br />Molimo postavite svoju adresu pokupljanja u System->Configuration->Sales->Shipping Settings->DPD GeoPost Pickup Address."
109
+ "Unable to load shipment information for this shipment %s.","Nije moguće učitati informacije pošiljke za ovu pošiljku %s."
110
+ "Your list did not contain any DPD shipments for which to arrange a pickup.","Vaša lista ne sadrži DPD pošiljke za koje je potrebno organizirati pokupljanje."
111
+ "A problem occurred whilst communicating your shipment to DPD. <br />""%s""","Greška prilikom komunikacije vaše pošilje prema DPD-u. <br />""%s"""
112
+ "DPD reported an error whilst attempting to arrange your pickup. <br />DPD says, ""%s""","DPD je prijavio grešku prilikom pokušaja dogovora za pokupljanjem. <br />DPD says, ""%s"""
113
+ "Invalid Table Rates File Format","Netočan file format tablice cijena"
114
+ "An error occurred while import table rates.","Greška prilikom importiranja tablice cijena."
115
+ "%1$d records have been imported. See the following list of errors for each record that has not been imported: %2$s","%1$d zapisa je uvezeno. Pogledajte listu grešaka za svaki paket koji nije importiran: %2$s"
116
+ "Invalid Table Rates format in the Row #%s","Pogrešan format tablice cijena u redu #%s"
117
+ "Invalid Country ""%s"" in the Row #%s.","Neispravna država ""%s"" u redu #%s."
118
+ "Invalid Region/State ""%s"" in the Row #%s.","Neispravna županija ""%s"" u redu #%s."
119
+ "Invalid weight/price ""%s"" in the Row #%s.","Neispravna težina/cijena ""%s"" u redu #%s."
120
+ "Invalid price/percentage ""%s"" in the Row #%s.","Neispravna cijena/postotak ""%s"" u redu #%s."
121
+ "Invalid service ""%s"" in the Row #%s.","Neispravan servis ""%s"" u redu #%s."
122
+ "Invalid COD Surcharge ""%s"" in the Row #%s.","Neispravan COD dodatak ""%s"" u redu #%s."
123
+ "Invalid value Price vs Dest value ""%s"" in the Row #%s. The value should be 0 (Weight vs Dest) or 1 (Price vs Dest).",
124
+ "Duplicate Row #%s (Country ""%s"", Region/State ""%s"", Zip ""%s"", Weight/Price ""%s"", Method ""%s"", Price vs Dest ""%s"").",
125
+ "Once the manifest is closed, you will not be able to make further changes to the shipping address. Do you want to continue?",
126
+ "Print Manifest","Ispisati Otpremnicu"
127
+ "Close Manifest","Zatvoriti Otpremnicu"
128
+ "-- Please select an option --","-- Molimo izaberite opciju --"
129
+ "Other (enter web service URLs manually)","Ostalo (unesite web servis URL ručno)"
130
+ "Carrier","Prijevoznik"
131
+ "Title","Naslov"
132
+ "Number","Broj"
133
+ "Label","Naljepnica"
134
+ "Action","Akcija"
135
+ "Delete","Izbrisati"
136
+ "Taking this action will cancel the shipment with DPD. Are you sure you want to continue?","Ovom akcijom stornirati ćete pošiljanje DPD-om. Dali ste sigurni da želite nastaviti?"
137
+ "Are you sure?","Dali ste sigurni?"
app/locale/hr_HR/Zitec_PackedShipment.csv ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Agrupación por bultos,Grupiranje vaše pošiljke u pakete
2
+ Communicar este envío con el servicio de mensajería,Komunikacija pošiljke sa dostavnom službom
3
+ Communicar este envío con el servicio de mensajero,Komunikacija pošiljke sa dostavnom službom
4
+ Total bultos,Ukupni broj paketa
5
+ Coste del envío (base imponible):,Troškovi dostave (bez pdv-a):
6
+ Diferencia:,Razlika:
7
+ Distribuya los productos en bultos,Grupiranje proizvoda vaše pošiljke u pakete
8
+ "Este módulo permite distribuir sus productos agrupados en bultos, utilizando la tabla inferior. Si lo desea, <strong>puede dejar bultos vacios, y el sistema no los tendrá en cuenta</strong>.",Ovaj modul omogućava vam organizirati vaše proizvode u pakete koristeći tablicu ispod. Ako želite možete <strong>ostaviti neke pakete praznima i sistem ih neće uzeti u obzir</strong>.
9
+ Introduzca una referencia indicativa para las etiquetas de cada bulto,Unesite opisnu referencu za svaku paketnu oznaku svakog paketa.
10
+ "Este módulo genera etiquetas que debera pegar en cada bulto. Para facilitarle la logística, puede personalizar la etiqueta de cada bulto usando los siguientes campos.","Ovaj modul generira paketnu oznaku za svaki paket. To će vam pomoći da spojite paketnu oznaku sa paketom, možete prilagoditi referencu svake paketne oznake koristeći slijedeća polja."
11
+ Precio del envío al cliente (base imponible):,Troškovi pošiljanja primatelju (bez pdv-a):
12
+ Distribución de bultos,Grupiranje pošiljke u pakete
13
+ bulto ,Paket
14
+ Continuar,Nastaviti
15
+ Cancelar,Odustati
16
+ Enviar,Potvrditi
17
+ Referencia bulto ,Paketna referenca
18
+ Descripción del bulto ,Opis paketa
19
+ Introduzca una descripción de cada bulto,Unesite opis za svaki paket
20
+ Puede introducir una descripción de cada bulto para comunicar al servicio de mensajería usando los siguientes campos.,Možete unijeti opis svakog paketa zbog komunikacije sa dostavnom službom u niža polja.
app/locale/hr_HR/Zitec_PrintShippingLabel.csv ADDED
@@ -0,0 +1 @@
 
1
+ "Print Shipping Labels", "Ispis paketne oznake"
app/locale/hr_HR/Zitec_TableRates.csv ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Table Rates","Tablica cijena"
2
+ "Table Rates","Tablica cijena"
3
+ "Save","Spremiti"
4
+ "Delete","Odustati"
5
+ "Duplicate","Duplicirati"
6
+ "Save And Continue Edit","Spremiti i nastaviti unositi"
7
+ "Weight (and above)","Težina (i prekomjerna)"
8
+ "Price (and above)","Cijena (i prekomjerna)"
9
+ "Shipping Price","Cijena dostave"
10
+ "Shipping Percentage","Postotak dostave"
11
+ "Fixed Cash On Delivery Surcharge Amount","Fiksna cijena nadoplate za pouzeće"
12
+ "Minimum COD Surcharge","Minimalna nadoplata za pouzeće"
13
+ "Edit Rate","Unos cijene"
14
+ "New Rate","Nova cijena"
15
+ "Export","Izvoz"
16
+ "Website","Web stranica"
17
+ "Dest Country","Država primatelja"
18
+ "Dest Zip/Postal Code","Poštanski broj primatelja"
19
+ "* or blank - matches any","* or blank - matches any"
20
+ "Service","Servis"
21
+ "For rates with this service to be available, you must enable the service from the configuration panel of the shipping method in System->Configuration->Shipping Methods","Za podešene cijene servisa, potrebno je i dozvoliti servise u konfiguracijskom panelu: System->Configuration->Shipping Methods"
22
+ "Product","Produkt"
23
+ "For rates with this product to be available, you must enable the product from the configuration panel of the shipping method in System->Configuration->Shipping Methods",
24
+ "Condition","Uvijet"
25
+ "Price vs. Destination","Cijena vs. Destinacija"
26
+ "Weight vs. Destination","Težina vs. Destinacija"
27
+ "Enable Shipping Method","Omogućiti metodu dostave"
28
+ "Disabled","Onemogućeno"
29
+ "Enabled","Omogućeno"
30
+ "Disable the shipping method if you would like it to be unavailable for orders whose price or weight is greater or equal to the value you have indicated.",
31
+ "Shipping Price Calculation","Izračun cijene dostave"
32
+ "Fixed Price","Fixna cijena"
33
+ "Add Percentage","Dodati postotak"
34
+ "Use 'Add Percentage' if you want to calculate the shipping price by adding a percentage to price charged by the shipping carrier.","Koristiti ""Dodati postotak"" ako želite izračunati dostave dodavanjem postotka cijeni zaračunatog od dostavne službe."
35
+ "Shipping Price","Cijena dostave"
36
+ "Cash On Delivery Surcharge Calculation","Izračun dodatka za pouzeće"
37
+ "Cash On Delivery Not Available","Pouzeće nije dozvoljeno"
38
+ "Zero Surcharge","Nula dodatak"
39
+ "Fixed Surcharge","Fiksni dodatak"
40
+ "Percentage Surcharge","Postotni dodatak"
41
+ "Fixed Cash On Delivery Surcharge","Fiksni dodatak za pouzeće"
42
+ "Minimum COD Surcharge","Minimalni dodatak za pouzeće"
43
+ "Optionally specify the minimum COD surcharge.","Opcionalno specificirati minimalni dodataka za pouzeće."
44
+ "Dest Region/State","Destinacijska županija"
45
+ "Import Rates","Importirati cijene"
46
+ "ID","ID"
47
+ "Destination Country","Destinacijska država"
48
+ "Dest Region/State","Destinacijska država"
49
+ "Destination Zip/Postal Code","Destinacijski poštanski broj"
50
+ "Yes","Da"
51
+ "No","Ne"
52
+ "Shipping Price %","Cijena dostave %"
53
+ "COD Surcharge","Dodatak za pouzeće"
54
+ "COD Surcharge %","Dodatak za pouzeće %"
55
+ "COD Min. Surcharge","Minimalni COD dodatak"
56
+ "Are you sure?","Dlai ste sigurni?"
57
+ "Import","Uvoz"
58
+ "Promotion","Promocija"
59
+ "New Rate","Nova cijena"
60
+ "Import Rates","Izvesti cijene"
61
+ "Export Rates","Uvesti cijene"
62
+ "Rate duplicated successfully","Cijene su uspješno duplicirane"
63
+ "Rate was successfully saved","Cijene su uspješno sačuvane"
64
+ "The rate could not be saved because it duplicates the destination, service/product and weight/price of an existing rate. Change some of the rate's values and try saving again.","Iznos nije pohranjen jer su pronađeni dupli unosi destinacije, usluge/produkta i težine/cijene za postojeći isnos. Promijenite paramatre iznosa i pokušajte ponovno."
65
+ "Unable to find rate to save","Nije moguće pronaći cijenu za sačuvati"
66
+ "Rate was successfully deleted","Cijena je uspješno obrisana"
67
+ "Total of %d record(s) have been deleted.","Ukupno od %d zapisa je obrisano."
68
+ "An error occurred while updating records.","Došlo je do greške prilikom ažuriranja zapisa."
69
+ "Please specify the website and file you wish to import","Molimo specificirajte web stranicu i datoteku koju želite uvesti"
70
+ "An error occurred whilst importing the tablerates: %s","Došlo je do greške prilikom uvoza tablice cijena: %s"
71
+ "Table rates imported successfully","Tablica cijena uspješno uvežena"
72
+ "Please specify the website whose rates you want to export","Molimo specificirajte web stranicu čije cijene želite importirati"
73
+ "Add Rate","Dodati cijenu"
74
+ "Import Rates","Uvesti cijene"
75
+ "Export Rates","Izvesti cijene"
76
+ "Cash On Delivery Surcharge Percentage","Postotak dodatka za pouzećem "
77
+ "Enter the starting weight in kg for this rate.","Unijeti početnu kilažu za tu cijenu"
78
+ "Enter the starting price for this rate in the base currency of website. This rate will apply to orders whose subtotal (excluding shipping) is greater or equal to this price. Only include the sales tax/VAT in this price if you have configured shipping prices to include it (see System->Configuration->Sales->Tax->Calulation Settings->Shipping Prices).","Unesite početnu cijenu u osnovnoj valuti s web stranice. Ovaj će se iznos applicirati na narudžbe čiji subtotal (osim dostave) je veći ili jednak ovoj cijeni. Uključite porez na promet / PDV u ovu cijenu, ako ste podesili cijene prijevoza da se PDV uključi (vidi Sustav-> Postavke-> Prodaja-> Porezni-> Metoda Izračuna-> Dostava cijene)."
app/locale/ro_RO/Zitec_Dpd.csv ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "DPD Table Rates", "DPD Tabel Taxe"
2
+ "Table Rates", "Tabel Taxe"
3
+ "Enabled", "Activ"
4
+ "DPD Country Select", "Selecteaza Tara"
5
+ "Production Mode", "Modul Productie"
6
+ "Production WS URL", "URL serviciu web [Productie]"
7
+ "Test WS URL", "URL serviciu web [Test]"
8
+ "Method Title", "Titlul metodei de livrare"
9
+ "Method Name", "Numele metodei de livrare"
10
+ "Web Service Username", "Utilizator DPD"
11
+ "Web Service Password", "Parola DPD"
12
+ "Web Service Connection Timeout", "Web Service conexiune Timeout"
13
+ "Set a timeout for connecting to the DPD web service in seconds.", "Setati un interval de timp pentru conectarea cu serviciul web DPD."
14
+ "E.g. http://egproduction.dpd.com/IT4EMWebServices/eshop/", "Ex. http://egproduction.dpd.com/IT4EMWebServices/eshop/"
15
+ "E.g. http://egtest.dpd.com/IT4EMWebServices/eshop/", "Ex. http://egtest.dpd.com/IT4EMWebServices/eshop/"
16
+ "Sender Address Id", "Id-ul adresei de expeditie"
17
+ "Payer Id", "Id-ul platitorului"
18
+ "Service","Serviciu"
19
+ "Select the services that you want to enable. Note that you must also define the shipping prices for these services in your shipping table rates (see below).", "Selecteaza serviciile DPD de livrare care vor fi active in checkout. Pentru serviciile activate se pot defini intrari in tabela de taxare pentru o flexibilitate mai mare de gestionare a costului de livrare."
20
+ "Export Shipping Table Rates", "Export Tabel preturi"
21
+ "Import Shipping Table Rates", "Import Tabel preturi"
22
+ "DPD GeoPost Pickup Address", "DPD GeoPost - Adresa de ridicare a coletelor"
23
+ "Name", "Nume"
24
+ "Additional Name", "Nume Aditional"
25
+ "Street", "Strada"
26
+ "City", "Oras"
27
+ "Postcode", "Cod Postal"
28
+ "Country", "Tara"
29
+ "Telephone", "Telefon"
30
+ "Email Address", "Adresa email"
31
+ "Cash On Delivery for DPD GeoPost", "Plata la livrare prin DPD - COD"
32
+ "Description", "Descriere"
33
+ "Surcharge Name", "Nume taxa"
34
+ "New order status", "Statusul noii comenzi"
35
+ "Payment Type", "Tip plata"
36
+ "Payment from Applicable Countries", "Metoda de plata activa pentru tarile"
37
+ "Payment from Specific Countries", "Selecteaza tarile"
38
+ "The new shipping address for shipments associated with this order have been communicated successfully to DPD.", "O noua adresa de livrare pentru expeditiile asociate cu comanda comunicata catre DPD"
39
+ "An error occurred updating the shipping address details with DPD: <br /> ""%s""", "Eroare aparuta la actualizarea datelor de contact de expediere cu DPD.<br /> ""%s"""
40
+ "DPD could not update the shipment address. The following error was returned: <br /> ""%s: %s""", "DPD nu a putut actualiza adresa de expediere.Urmatoarea eroare a fost returnata: <br /> ""%s: %s"" "
41
+ "An error occurred retrieving the updated shipping labels from DPD. <br />""s%""", "A ap?rut o eroare la preluarea etichetele de expediere actualizate din DPD. <br />""s%"""
42
+ "The total length of the address cannot be more than %s characters.", "Lungimea totala a adresei nu poate fi mai mult de %s caractere"
43
+ "incl. tax", " incl. VAT"
44
+ "excl. tax", " excl. VAT"
45
+ "Incl. tax", " Incl. VAT"
46
+ "Excl. tax", " Excl. VAT"
47
+ "(Excl.Tax)", "(Excl. VAT)"
48
+ "(Incl.Tax)", "(Incl. VAT)"
49
+ "(Excl. Tax)", " (Excl. VAT)"
50
+ "(Incl. Tax)", " (Incl. VAT)"
51
+ "Cash", "Cash"
52
+ "Credit Card", "Credit Card"
53
+ "Crossed Check", "Crossed Cheque"
54
+ "Free", "Gratis"
55
+ "Error obtaining shipping price: %s", "Eroare la pretul expeditiei. <br> %s"
56
+ "DPD error: %s", "Eroare DPD: %s"
57
+ "Shipping price not available in order currency", "Pretul expeditiei nu este valabil pentru moneda curenta"
58
+ "Could not load the stored tracking information for track %s", "Nu se pot încarca informațiile stocate de urmarire "
59
+ "Error loading stored tracking information for track %s", "Eroare la încarcarea informațiilor stocate de urmarire "
60
+ "Error calling DPD for track %s", "Eroare solicitare pentru urmarire DPD: %s"
61
+ "Error calling DPD for track %s: %s ", "Eroare solicitare pentru urmarire DPD, %s: %s"
62
+ "Export CSV", "Export CSV"
63
+ "Manifest", "Borderou"
64
+ "DPD Pickup", "Ridicare DPD"
65
+ "Region/State", "Region/State"
66
+ "Zip/Postal Code", "Cod postal"
67
+ "Shipping Price/Percentage", "Pretul expeditiei/Procentaj"
68
+ "Please the shipments to include in the closed manifest.", "Va rugam ca expeditiile sa includa borderoul închis."
69
+ "Could not include shipment %s in the manifest because it is not a DPD shipment.", "Livrarea %s - Nu a putut fi inclusa expeditia în borderou, deoarece nu este facut transferul catre DPD"
70
+ "Could not include shipment %s in the manifest because it was not communicated to DPD.", "Livrarea %s - Nu a putut fi inclusa expeditia în borderou deoarece nu a fost comunicata catre DPD"
71
+ "Could not include shipment %s in the manifest because it was cancelled with DPD.", "Nu a putut fi inclusa expeditia în borderou deoarece nu a fost anulata de DPD"
72
+ "Could not include shipment %s in the manifest because it is already in a manifest.", "Nu a putut fi inclusa expeditia în borderou deoarece este deja deshisa in alt borderou"
73
+ "The shipments you selected come from different stores which have different DPD connection parameters. Please select shipments which belong to stores that use the same DPD connection parameters.", "Expeditile pe care le-ati selectat provin din magazine diferite care au diferiti parametrii de conexiune DPD. Va rugam sa selectați expeditiile care fac parte din magazinele care folosesc aceiași parametrii de conectare DPD."
74
+ "Shipment %s was added to the manifest.", "Expeditia a fost adaugata in borderou"
75
+ "An error occurred whilst requesting the manifest from DPD: %s", "A aparut o eroare în timpul solicitarii bordroului de la DPD: %s"
76
+ "An error occurred whilst communicating the manifest details to DPD. DPD says: ""%s""", "A aparut o eroare în timpul comunicarii detaliilor borderoului la DPD. DPD spune: ""%s"" "
77
+ "The manifest was communicated successfully to DPD, but an error occurred whilst saving the manifest details in Magento. <br />Please make a capture of this screen so that you have a record of the shipments included in the manifest. <br />For you reference when communicating with DPD, the manifest details are: <br /> Manifest Reference: %s <br />Manifest Name: %s <br />Manifest internal DPD ID: %s <br />The error message returned was: %s", "Borderoul a fost comunicat cu succes la DPD, dar a aparut o eroare în timp ce se salvau detaliile borderoului in Magento. <br /> Va rugam sa face?i o captura de ecran, astfel incat sa ave?i o evidența a expedtitiilor, daca o eroare a avut loc în timp ce se salvau detaliile borderoului în Magento. <br /> Referința Manifest:%s <br /> Numele Manifest:%s <br /> Borderou ID DPD intern:%s <br /> mesajul de eroare returnat a fost: %s"
78
+ "Close DPD Manifest", "Generare Borderou"
79
+ "Once the manifest is closed for the selected shipments you will not be able to make further changes to their shipping addresses. Do you want to continue?", "Once the manifest is closed for the selected shipments, you will not be able to make further changes to their shipping addresses. Do you want to continue?"
80
+ "Arrange DPD Pickup", "Ridicare DPD stabilita"
81
+ "Date (DD/MM/YYYY)", "Date (DD/MM/YYYY)"
82
+ "Between", "Between"
83
+ "and", "și"
84
+ Instructions,"Instructions"
85
+ "DPD Classic", "Persoana Juridica"
86
+ "DPD 10:00", "DPD 10:00"
87
+ "DPD 12:00", "DPD 12:00"
88
+ "DPD B2C", "Persoana Fizica"
89
+ "DPD Same Day", "DPD Same Day"
90
+ "Your new shipment was successfully communicated to DPD.", "Noua dvs. expeditie a fost transmisa cu succes la DPD"
91
+ "DPD says, ""%s""", "Raspuns DPD ""%s"""
92
+ "An error occurred communicating the shipment to DPD. The shipping method '%s' is invalid", "A aparut o eroare a transmiterii expeditiei la DPD.Metoda de expediere '%s' nu este valida."
93
+ "The shipment could not be communicated to DPD because the shipping street the maximum permitted length of %s characters. <br />Please edit the shipping address to reduce the length of the street in the shipping address.", "Expeditia nu a putut fi transmisa la DPD deoarece lungimea maxima a strazii de expediere este permisă de %s caractere. <br /> Modificați adresa de livrare, pentru a reduce lungimea străzii din adresa de livrare."
94
+ "An error occurred communicating the shipment to DPD:<br /> ""%s""", "A apărut o eroare de transmitere a expeditiei la DPD:<br /> ""%s"""
95
+ "DPD could not process the new shipment. The following error was returned: <br /> ""%s: %s""", "DPD nu poate procesa noua expeditie. Eroare este: <br /> ""%s: %s"""
96
+ "Successfully closed manifest %s for the following shipments. <a href='%s'>Download the manifest</a>.", "Borderoul %s a fost generat cu success. <a href='%s'>Descarca borderoul</a> "
97
+ "An error occurred whilst closing the manifest: %s", "A apărut o eroare în timpul generarii borderoului: %s"
98
+ "A problem occurred whilst attempting to download a manifest. No manifest was specified in the request.", "A apărut o problemă în timpul incercarii descărcarii borderoului. Nici un borderou nu a fost selectat?"
99
+ "A problem occurred whilst attempting to download the manifest id %s: %s", "A apărut o problemă în timpul descarcarii id-ului boderoului"
100
+ "A problem occurred whilst attempting to download the manifest %s. The manifest no longer exists.", "A apărut o problemă in timpul incercarii descarcarii borderoului %s. Borderoul nu mai există"
101
+ "An unexpected problem occurred whilst attempting to download the manifest %s. %s", "O problemă neasteptată în timpul inccercarii de descarcare a borderoului. "
102
+ "Please select the shipments for which you wish to arrange a pickup.", "Vă rugăm să selectai expeditiile pentru care doriți sa stabiliti ridicare lor."
103
+ "Please enter a pickup date in the format DD/MM/YYYY.", "Vă rugăm să introduceți data pentru ridicare în formatul zz/ll/aaaa."
104
+ "Please select a from and to time for the pickup.", "Selectați intervalul de timp ridicarea comenzii."
105
+ "You cannot create a pickup because you have not fully specified your pickup address. <br />Please set your pickup address in System->Configuration->Sales->Shipping Settings->DPD GeoPost Pickup Address.", "Nu puteți solicita o ridicare, deoarece nu aveti specificat pe deplin adresa dumneavoastra de ridicare. <br /> Vă rugăm să setați adresa dumneavoastră de ridicare în System -> Configuration-> DPD GeoPost Pickup Address"
106
+ "Unable to load shipment information for this shipment %s.", "Imposibil de încărcat informațiile expediere pentru acest expeditie."
107
+ "Your list did not contain any DPD shipments for which to arrange a pickup.", "Lista dvs. nu conține nici o expeditie DPD pentru care puteti solicita o ridicare."
108
+ "A problem occurred whilst communicating your shipment to DPD. <br />""%s""", "A apărut o problemă în timp ce se trimitea expeditia catre DPD"
109
+ "DPD reported an error whilst attempting to arrange your pickup. <br />DPD says", "DPD a raportat o eroare în timp ce se încerca o solicitare de ridicare."
110
+ "Invalid Table Rates File Format", "Formatul Tabelului de preturi invalid"
111
+ "An error occurred while import table rates.", "Eroare aparuta in timpul importului tabelului de preturi."
112
+ "%1$d records have been imported. See the following list of errors for each record that has not been imported: %2$s", "%1$d inregistrări au fost importate. Vezi următoarea listă de erori pentru fiecare înregistrare care nu a fost importat %2$s"
113
+ "Invalid Table Rates format in the Row #%s", "Format incorect in randul #%s pretului din tabel"
114
+ "Invalid Country ""%s""in the Row #%s.", "Tara Gresita ""%s"" pe randul #%s."
115
+ "Invalid Region/State ""%s""in the Row #%s.", "Regiune ""%s"" Gresita pe randul #%s."
116
+ "Invalid weight/price ""%s""in the Row #%s.", "Greutate/pret ""%s"" Gresita pe randul #%s."
117
+ "Invalid price/percentage ""%s""in the Row #%s.", "Pret/procentaj ""%s"" Gresit pe randul #%s."
118
+ "Invalid service ""%s""in the Row #%s.", "Serviciu ""%s"" Gresit pe randul #%s "
119
+ "Invalid COD Surcharge ""%s""in the Row #%s.", "Taxa Plata ramburs ""%s"" invalida pe randul #%s."
120
+ "Invalid value Price vs Dest value ""%s""in the Row #%s. The value should be 0 (Weight vs Dest) or 1 (Price vs Dest).", "Valoarea invalidă Preț vs Dest ""%s"" în rândul #%s. Valoarea trebuie să fie 0 (greutate vs Dest) sau 1 (Preț vs Dest)"
121
+ "Duplicate Row #%s (Country ""%s""Region/State ""%s"" Zip ""%s""Weight/Price ""%s"" Method ""%s"" Price vs Dest ""%s"").", "Duplicat rând #%s (Tara %s, Regiunea/statul %s, Cod postal %s, Greutate / Preț %s, Metoda %s, Preț vs Dest %s)"
122
+ "Once the manifest is closed you will not be able to make further changes to the shipping address. Do you want to continue?", "Odată ce manifestul este închis, nu se vor putea face modificări suplimentare la adresa de livrare. Vrei să continuați? "
123
+ "Print Manifest", "Printarea Borderoului"
124
+ "Close Manifest", "Generare Borderou"
125
+ "-- Please select an option --", "-- Selecteaza o optiune --"
126
+ "Other (enter web service URLs manually)", "Alta (introdu URL-ul serviciului DPD manual)"
127
+ "Carrier", "Transportator"
128
+ "Title", "Titlu"
129
+ "Number", "Numar"
130
+ "Label", "Eticheta"
131
+ "Action", "Action"
132
+ "Delete", "Delete"
133
+ "Taking this action will cancel the shipment with DPD. Are you sure you want to continue?", "Actionand veti anula expeditia cu DPD. Sunteti sigur ca doriti sa continuati?"
134
+ "Are you sure?", "Sunteti sigur ?"
135
+ "The country you have selected does not have a web service URL for production mode. Please ensure you have selected the correct country, or select 'Other (enter web service URLs manually)' to enter a specific URL.", "Tara aleasă de dvs. nu are un servici web URL pentru modul de producție. Vă rugăm să vă asigurați că ați selectat țara corectț sau selectați Altele(introduceti un serviciu web URL manual ) pentru a introduce un URL valid."
136
+ "The country you have selected does not have a web service URL for test mode. Please ensure you have selected the correct country, or select 'Other (enter web service URLs manually)' to enter a specific URL.", "Tara aleasă de dvs. nu are un servici web URL pentru modul de test. Vă rugăm să vă asigurați că ați selectat țara corectă sau selectați Altele(introduceti un serviciu web URL manual ) pentru a introduce un URL valid."
137
+ "An error occurred communicating the shipment to DPD at %s:<br /> '%s'", "Eroare de comunicare aparuta la transferul catre DPD"
138
+ "Auto-correct the user postcode in checkout", "Corecteaza automat codul postal in checkout"
139
+ "Use this option to allow DPD shipment method even if the postcode is not valid. The post code will be automatically generated considering the city, region and street. In some cases the administrator will have to manually validate the postcode.", "Prin activarea optiunii se permite extensiei DPD de livrare sa genereze automat codul postal, folosind adresa introdusa de catre client si corectarea/validarea codului postal introdus de client."
140
+ "Destination Country", "Tara destinatie"
141
+ "Dest Region/State", "Regiunea/Statul dest."
142
+ "Destination Zip/Postal Code", "Cod postal dest."
143
+ "Dest Zip/Postal Code", "Cod postal dest."
144
+ "Weight (and above)", "Greutate (si mai mare)"
145
+ "Price (and above)", "Pret (si mai mare)"
146
+ "Shipping Price", "Pret de livrare"
147
+ "Shipping Price %", "Pret de livrare %"
148
+ "Addition Price", "Pret aditional"
149
+ "COD Surcharge", "Taxa COD"
150
+ "COD Surcharge %", "Taxa COD %"
151
+ "COD Min. Surcharge", "Taxa minima COD"
152
+ "Import Rates", "Importa tabel taxare"
153
+ "Export Rates", "Exporta tabel taxare"
154
+ "Dest Country", "Tara dest."
155
+ "For rates with this service to be available you must enable the service from the configuration panel of the shipping method in System->Configuration->Shipping Methods", "For rates with this service to be available you must enable the service from the configuration panel of the shipping method in System->Configuration->Shipping Methods"
156
+ "Price vs. Destination", "Price vs. Destination"
157
+ "Weight vs. Destination", "Weight vs. Destination"
158
+ "Enter the starting price for this rate in the base currency of website. This rate will apply to orders whose subtotal (excluding shipping) is greater or equal to this price. Only include the sales tax/VAT in this price if you have configured shipping prices to include it (see System->Configuration->Sales->Tax->Calulation Settings->Shipping Prices).", "Introduceți prețul de pornire pentru această rată în moneda de baza a site-ului. Această rată se va aplica la comenzi ale căror subtotal (cu excepia de expediere) este mai mare sau egal cu acest preț. Includ numai pentru vânzările de impozitare / TVA în acest preț dacă ați configurat prețurile de livrare să-l includă (a se vedea System->Configuration->Sales->Tax->Calulation Settings->Shipping Prices)."
159
+ "Enable Shipping Method", "Permite medoda de expditie"
160
+ "Payment amount type", "Tip valoare plata"
161
+ "Payment amount", "Suma de plata"
162
+ "Order #","Comanda"
163
+ "Purchased On", "Cumpărate de pe"
164
+ "Ship to Name", "Ship to Name"
165
+ "Order total", "Comanda totala"
166
+ "Shipping Price", "Pretul Expeditiei"
167
+ "Total Shipping", "Raport de transport"
168
+ Cost,Cost
169
+ "Shipping Profit/Loss", "Expeditie Profit / Pierdere"
170
+ "Shipping settings", "Setari livrare"
171
+ "Sender settings", "Setari expeditor"
172
+ "Payment settings", "Setari plata"
173
+ "Report price vs cost", "Raport pret vs cost"
174
+ "DPD carrier", "Livrare DPD"
175
+ "Choose the type of charge percentage of order amount or fixed price in case table rates is not defined for DPD shipping method.", "Alege tipul de valoare: valoare fixa sau valoare procentuala din valoarea produselor comandate."
176
+ "Fixed amount", "Valoare fixa"
177
+ "Percentage of entire order", "Procent din valoarea produselor comandate"
178
+ "Payment amount", "Valoare plata"
179
+ "This amount will be used to charge the customer if no records is loaded into table rates", "Valoarea care va fi folosita la taxarea clientului, daca nu se regasesc inregistrari in tabelul de taxare. Aceasta valoare poate fi procentuala sau fixa in functie de optiune alesa la punctul [Tip valoare plata]"
180
+ "Select how customers will pay the courier.", "Selecteaza cum va plati clientul curierilor."
181
+ "Add Fixed amount", "Adaos pret fix"
182
+ "Total Shipping Charges", "Total taxa de livrare"
183
+ "DPD Classic", "DPD Persoana Juridica"
184
+ "DPD B2C", "DPD Persoana Fizica"
185
+ "The postcode (%s) submitted by your customer is not valid post code. Do you want to edit the address? (This may be a valid postcode %s )","Codul postal (%s) introdus de client nu este valid. Vreti sa editati adresa si sa generati automat un cod postal? Un posibil cod postal este: %s"
186
+ "DPD - search postcode","Cauta cod postal"
187
+ "DPD shipping carrier detected an other postcode for current address: %s. You can validate this postcode before scheduling deliveries by clicking the edit button.","Extensia DPD de transport a detectat un alt cod postal pentru adresa curenta: %s. Puteti valida/modifica acest cod postal inainte de programarea livrarii prin apaseara butonului ""Edit"" "
188
+ "DPD shipping carrier requirements: The length of address provided by your customer is too long. Please provide a maximum 70 characters length address (street field).","Cerinte serviciu DPD: Adresa de livrare a acestei comenzi este prea lunga. Lungimea maxima a campului adresa(strada) este 70 de caractere. Recomandam sa editati adresa apasand butonul edit."
189
+ "No results available","Nu s-au gasit rezultate"
app/locale/ro_RO/Zitec_PackedShipment.csv ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Communicate this shipment to the courier service", "Comunica cu serviciul DPD pentru obtinerea pretului de livrare"
2
+ "Total number of parcels", "Numarul de cutii"
3
+ "Shipping cost (excluding tax):", "Cost de livrare(exclus taxe):"
4
+ "Difference:", "Diferenta:"
5
+ "Grouping your shipment into parcels", "Grupeaza produsele livrate in cutii"
6
+ "Group the products in your shipment into parcels", "Grupeaza produsele livrate in cutii"
7
+ "This module lets you organize your products into parcels using the table below. If you like you can, <strong>leave some parcels empty, and the system will not take them into account</strong>.", "Acest modul iti permite organizarea produselor care urmeaza a fi livrate folosind tabelul de mai jos. Daca lasati anumite cutii goale sistemul nu le va lua in considerare. Implicit o singura cutie va fi creata."
8
+ "Enter a descriptive reference for the shipping labels of each parcel", "Introdu descrierea pachetului pentru fiecare cutie in parte"
9
+ "Cost of shipping to customer (excluding tax):", "Taxa livrare platita de client (exclus taxe):"
10
+ "Grouping Shipment into Parcels", "Grupeaza Livrarea in Pachete"
11
+ "Parcel","Cutia"
12
+ "Continue","Continua"
13
+ "Cancel","Renunta"
14
+ "Parcel Reference", "Referinta cutie"
15
+ "Description of Parcel", "Descriere cutie"
16
+ "Enter a description for each parcel", "Introdu descriere pentru fiecare cutie in parte"
17
+ "You can enter a description of each parcel to communicate to the courier service in the fields below.", "Poti introduce o descriere pentru fiecare cutie in parte descriere care va fi trimisa catre DPD"
18
+
app/locale/ro_RO/Zitec_PrintShippingLabel.csv ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ "Print Shipping Labels", "Genereaza etichete expeditie"
2
+ "Track Order", "Urmareste comanda"
3
+ "PDF Packingslips", "PDF Packingslips"
4
+ "Print Shipping Labels", "Printeaza etichete expeditie"
5
+ "Close DPD Manifest", "Genereaza borderou"
6
+ "Manifest","Borderou"
app/locale/ro_RO/Zitec_TableRates.csv ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Table Rates", "Tabel de Preturi"
2
+ "Table Rates", "Tabel de Preturi"
3
+ "Save", "Salvare"
4
+ "Delete", "Stergere"
5
+ "Duplicate", "Duplicate"
6
+ "Save And Continue Edit", "Galveaza si continua editarea"
7
+ "Weight (and above)", "Weight (and above)"
8
+ "Price (and above)", "Price (and above)"
9
+ "Shipping Price", "Pretul Expeditiei"
10
+ "Shipping Percentage", "Procentajul Expeditiei"
11
+ "Fixed Cash On Delivery Surcharge Amount", "Taxa numerar fixa a platei la livrare "
12
+ "Minimum COD Surcharge", "Taxa minima a platei la livrare"
13
+ "Edit Rate", "Modifica Regula"
14
+ "Export", "Export"
15
+ "Website", "Website"
16
+ "Dest Country", "Dest Tara"
17
+ "Dest Zip/Postal Code", "Dest Zip/Postal Code"
18
+ "* or blank - matches any", "* sau gol - pentru toate valorile"
19
+ "For rates with this service to be available you must enable the service from the configuration panel of the shipping method in System->Configuration->Shipping Methods", "Pentru preturi acest serviciu pentru a fi disponibil, trebuie să activați serviciul din panoul de configurare a metodei de expediere System->Configuration->Shipping Methods"
20
+ "For rates with this product to be available, you must enable the product from the configuration panel of the shipping method in System->Configuration->Shipping Methods", "Pentru preturi acest serviciu pentru a fi disponibil, trebuie să activați serviciul din panoul de configurare a metodei de expediere System->Configuration->Shipping Methods"
21
+ "Condition", "Conditie"
22
+ "Price vs. Destination", "Pret vs. Destinatie"
23
+ "Weight vs. Destination", "Greutate vs. Destinatie"
24
+ "Enable Shipping Method", "Activeaza Metoda Livrare"
25
+ "Disabled", "Inactiv"
26
+ "Enabled", "Activ"
27
+ "Disable the shipping method if you would like it to be unavailable for orders whose price or weight is greater or equal to the value you have indicated.", "Dezactiveaza metoda de plata pentru comenzi care au pretul sau greutatea mai mare decat valoarea selectata anterior."
28
+ "Shipping Price Calculation", "Calcularea pretului de livrare"
29
+ "Fixed Price", "Pret fix"
30
+ "Add Percentage", "Adaos procentual"
31
+ "Use 'Add Percentage' if you want to calculate the shipping price by adding a percentage to price charged by the shipping carrier.", "Folositi o valoare fixa de taxare, un adaos procentual fata de valoarea returnata de DPD sau un adaos absolut fata de valoarea returnata de serviciul DPD."
32
+ "Shipping Price", "Pret livrare"
33
+ "Cash On Delivery Surcharge Calculation", "Taxa plata la livrare"
34
+ "Cash On Delivery Not Available", "Plata la livrare dezactivata"
35
+ "Zero Surcharge", "Pret zero"
36
+ "Fixed Surcharge", "Taxa valoare fixa"
37
+ "Percentage Surcharge", "Adaos porcentual"
38
+ "Fixed Cash On Delivery Surcharge", "Taxa fixa pentru plata la livrare"
39
+ "Minimum COD Surcharge", "Taxa minima pentru plata la livrare"
40
+ "Optionally specify the minimum COD surcharge.", "Taxa minima specificata optionala pentru plata la livrare"
41
+ "Dest Region/State", "Dest Judet"
42
+ "Import Rates", "Import preturi"
43
+ "Are you sure?", "Esti sigur?"
44
+ "Import", "Import"
45
+ "Promotion", "Promotion"
46
+ "Import Rates", "Importa Reguli"
47
+ "Export Rates", "Exporta Reguli"
48
+ "Rate duplicated successfully", "Tarifele dublate cu succes"
49
+ "Rate was successfully saved", "Tariful au fost salvate cu succes"
50
+ "The rate could not be saved because it duplicates the destination service/product and weight/price of an existing rate. Change some of the rate's values and try saving again.", "Tariful nu a putut fi salvata, întrucât este duplicat destinația serviciului / produs și greutate / prețul unei tari existente. Schimbati câteva dintre valorile tarifale și încercați să salvați din nou. "
51
+ "Unable to find rate to save", "Imposibil de a găsi tariful pentru a salva"
52
+ "Rate was successfully deleted", "Tariful a fost sters cu succes"
53
+ "Total of %d record(s) have been deleted.", "Numărul total de înregistrări care au fost șterse: %d."
54
+ "An error occurred while updating records.", "A apărut o eroare în timp ce se actualizau inregistrarile"
55
+ "Please specify the website and file you wish to import", "Vă rugăm să specificați site-ul și fișierul pe care doriți să-l importați"
56
+ "An error occurred whilst importing the tablerates: %s", "A apărut o eroare în timp ce se importa tabela de preturi"
57
+ "Table rates imported successfully", "Tabelul de preturi a fost importat cu succes"
58
+ "Please specify the website whose rates you want to export", "Vă rugăm să specificați site-ul, unde doriti sa exportati aceste tarife"
59
+ "Add Rate", "Adauga Regula"
60
+ "Cash On Delivery Surcharge Percentage", "Taxa procentuala COD - din valoarea comenzii"
61
+ "Enter the starting weight in kg for this rate.", "Introdu greutatea minima in KG pentru care aceasta regula este activa."
62
+ "Enter the starting price for this rate in the base currency of website. This rate will apply to orders whose subtotal (excluding shipping) is greater or equal to this price. Only include the sales tax/VAT in this price if you have configured shipping prices to include it (see System->Configuration->Sales->Tax->Calulation Settings->Shipping Prices).", "Introduceți prețul de pornire pentru această tabela de preturi în moneda de baza a site-ului. Această rată se va aplica la comenzi ale căror subtotal (cu excepția de expediere) este mai mare sau egal cu acest preț. Includ numai pentru vânzările de impozitare / TVA în acest preț dacă ați configurat prețurile de livrare să-l includă (a se vedea System->Configuration->Sales->Tax->Calulation Settings->Shipping Prices)."
63
+ "Add Rule", "Adauga Regula"
64
+ "Import", "Importa"
65
+ "Export", "Exporta"
66
+ "New Rate", "Regula noua"
67
+ "Condition", "Conditie"
68
+ "Add fixed amount to price","Adaos valoare fixa la valoare DPD"
app/locale/sl_SI/Zitec_Dpd.csv ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "DPD Table Rates","DPD cenik"
2
+ "Enabled","omogočena"
3
+ "DPD Country Select","DPD izbor države"
4
+ "Production Mode","način proizvodnje"
5
+ "Production WS URL","Produkt WS URL"
6
+ "Test WS URL","test WS URL"
7
+ "Method Title","Naslov metode"
8
+ "Method Name","Ime metode"
9
+ "Web Service Username","Spletno Uporabniško ime"
10
+ "Web Service Password","Spletno Geslo"
11
+ "Web Service Connection Timeout","Potek povezave na spletni strani"
12
+ "Set a timeout for connecting to the DPD web service in seconds.","Nastavitev zakasnitve povezave s spletno storitvijo DPD v sekundah"
13
+ "E.g. http://egproduction.dpd.com/IT4EMWebServices/eshop/","E.g. http://egproduction.dpd.com/IT4EMWebServices/eshop/"
14
+ "E.g. http://egtest.dpd.com/IT4EMWebServices/eshop/","E.g. http://egtest.dpd.com/IT4EMWebServices/eshop/"
15
+ "Sender Address Id","ID naslov pošiljatelja"
16
+ "Payer Id","ID plačnika"
17
+ "Service","storitev"
18
+ "Select the services that you want to enable. Note that you must also define the shipping prices for these services in your shipping table rates (see below).","Izberite storitve, ki jih želite omogočiti. Ne pozabite, da morate določiti tudi cene prevozov za te storitve, ki so navedene v tabelah (glej spodaj)."
19
+ "Export Shipping Table Rates","Cena izvoznih stroškov"
20
+ "Import Shipping Table Rates","Cena uvoznih stroškov"
21
+ "DPD GeoPost Pickup Address","DPDGeoPost naslov prevzema"
22
+ "Name","Ime"
23
+ "Additional Name","Dodatno ime"
24
+ "Street","Ulica"
25
+ "City","Mesto"
26
+ "Postcode","Poštna številka"
27
+ "Country","Država"
28
+ "Telephone","Telefonska številka"
29
+ "Email Address","elektronski naslov"
30
+ "Cash On Delivery for DPD GeoPost","Plačilo ob dostavi"
31
+ "Enabled","omogočena"
32
+ "Title","Naslov"
33
+ "Description","opis"
34
+ "Surcharge Name","ime doplačila"
35
+ "New order status","Novo Stanje naročila/nov status naročila"
36
+ "Service","storitev"
37
+ "Payment Type","način plačila"
38
+ "Payment from Applicable Countries","Plačilo iz ostalih držav"
39
+ "Payment from Specific Countries","Plačilo iz izbranih držav"
40
+ "The new shipping address for shipments associated with this order have been communicated successfully to DPD.","Nov naslov dostave v povezavi s tem naročilo je bil uspešno oddan"
41
+ "An error occurred updating the shipping address details with DPD: <br /> ""%s""","Prišlo je do napake pri posodobitvi podatkov za naslov dostave"
42
+ "DPD could not update the shipment address. The following error was returned: <br /> ""%s: %s""","DPD ni mogel posodobiti naslova za dostavo. Prišlo je do naslednje napake: <br /> ""% s:% s"""
43
+ "An error occurred retrieving the updated shipping labels from DPD. <br />""s%""","Prišlo je do napake pri pridobivanju posodobljenih DPD nalepk."
44
+ "The total length of the address cannot be more than %s characters.","Celotna dolžina naslova ne sme presegati ?? Znakov"
45
+ " incl. tax","z DDV"
46
+ " excl. tax","Brez DDV"
47
+ " Incl. tax","z DDV"
48
+ " Excl. tax","Brez DDV"
49
+ "(Excl.Tax)","Brez DDV"
50
+ "(Incl.Tax)","z DDV"
51
+ " (Excl. Tax)","Brez DDV"
52
+ " (Incl. Tax)","z DDV"
53
+ "Cash","denar"
54
+ "Credit Card","plačilna kartica"
55
+ "Crossed Check","navzkrižno preverjanje"
56
+ "Free","brezplačno"
57
+ "Error obtaining shipping price: %s","Prišlo je do napake pri vnosu cene dostave"
58
+ "DPD error: %s","DPD napaka"
59
+ "Shipping price not available in order currency","Cene pošiljanja v navedeni valuti niso na voljo"
60
+ "Could not load the stored tracking information for track %s","Ni možno naložiti shranjenih podatkov za sledilne številke"
61
+ "Error loading stored tracking information for track %s","Napaka pri shranjevanju informacij za sledilne številke"
62
+ "Error calling DPD for track %s",
63
+ "Error calling DPD for track %s: %s ",
64
+ "Export CSV","Izvoz CSV"
65
+ "Manifest","seznam paketov"
66
+ "DPD Pickup","DPD prevzem"
67
+ "Country","Država"
68
+ "Region/State","Regija/država"
69
+ "Zip/Postal Code","Poštna številka"
70
+ "Shipping Price/Percentage","cena prevoza/odstotno"
71
+ "Please the shipments to include in the closed manifest.","Prosimo vključite pakete v seznam"
72
+ "Could not include shipment %s in the manifest because it is not a DPD shipment.","Paketov ni bilo mogoče vključiti v seznam paketov, saj ni DPD pošiljka"
73
+ "Could not include shipment %s in the manifest because it was not communicated to DPD.","Paketov ni bilo mogoče vključiti v seznam paketov, saj ni bilo povezave z DPD"
74
+ "Could not include shipment %s in the manifest because it was cancelled with DPD.","Paketov ni bilo mogoče vključiti v seznam paketov, saj je bilo prekinjeno"
75
+ "Could not include shipment %s in the manifest because it is already in a manifest.","Paketov ni bilo mogoče vključiti v seznam paketov, saj so že v seznamu paketov"
76
+ "The shipments you selected come from different stores which have different DPD connection parameters. Please select shipments which belong to stores that use the same DPD connection parameters.",
77
+ "Shipment %s was added to the manifest.","Paket je bil dodan v seznam paketov"
78
+ "An error occurred whilst requesting the manifest from DPD: %s","Priz zahtevi seznama paketov je prišlo do napake"
79
+ "An error occurred whilst communicating the manifest details to DPD. DPD says: ""%s""","Med oddajo podatkov o seznamu paketov je prišlo do napake"
80
+ "The manifest was communicated successfully to DPD, but an error occurred whilst saving the manifest details in Magento. <br />Please make a capture of this screen so that you have a record of the shipments included in the manifest. <br />For you reference when communicating with DPD, the manifest details are: <br /> Manifest Reference: %s <br />Manifest Name: %s <br />Manifest internal DPD ID: %s <br />The error message returned was: %s","Seznam paketov je bil uspešno oddan, vendar je prišlo do napake pri shranjevanju podatkov v Magento. Prosimo ustvarite prikaz zaslona, da imate podatke o paketih vključenih v seznam paketov."
81
+ "Close DPD Manifest","Zapri seznam paketov"
82
+ "Once the manifest is closed for the selected shipments, you will not be able to make further changes to their shipping addresses. Do you want to continue?","Ko enkrat zaprete seznam izbranih paketov, ne bo več možno spreminjanje naslovov dostave. Želite nadaljevati?"
83
+ "Arrange DPD Pickup","Naročilo prevzema"
84
+ "Date (DD/MM/YYYY)","datum (DD/MM/LLLL)"
85
+ "Between","med"
86
+ "and","in"
87
+ "Instructions","navodila"
88
+ "DPD Classic","DPD classic"
89
+ "DPD 10:00","DPD 10:00"
90
+ "DPD 12:00","DPD 12:00"
91
+ "DPD B2C","DPD B2C"
92
+ "DPD Same Day","DPD isti dan"
93
+ "Your new shipment was successfully communicated to DPD.","Vnos nove pošilje je bil uspešno oddan"
94
+ "DPD says, ""%s""","DPD pravi,"
95
+ "An error occurred communicating the shipment to DPD. The shipping method '%s' is invalid","Prišlo je do napake pri oddaji pošilje. Metoda je nepravilna."
96
+ "The shipment could not be communicated to DPD because the shipping street the maximum permitted length of %s characters. <br />Please edit the shipping address to reduce the length of the street in the shipping address.","Oddaja paketa ni bila možna, saj je naslov za dostavo omejen na ?? znakov. Prosimo uredite naslov do največje dovoljene dolžine."
97
+ "An error occurred communicating the shipment to DPD:<br /> ""%s""","Prišlo je do napake pri oddaji pošiljke"
98
+ "DPD could not process the new shipment. The following error was returned: <br /> ""%s: %s""","DPD ni mogel obdelati nove pošiljke. Prišlo je do naslednje napake"
99
+ "Successfully closed manifest %s for the following shipments. <a href='%s'>Download the manifest</a>.","Seznam pakeotv je bil uspešno zaključen za sledeče pakete. Prenesite seznam."
100
+ "An error occurred whilst closing the manifest: %s","Prišlo je do napake pri zapiranju seznama pakeotv."
101
+ "A problem occurred whilst attempting to download a manifest. No manifest was specified in the request.","Prišlo je do napake pri prenosu seznama paketov. Noben seznam ni bil označen v zahtevi."
102
+ "A problem occurred whilst attempting to download the manifest id %s: %s","Prišlo je do napake pri prenosu seznama paketov."
103
+ "A problem occurred whilst attempting to download the manifest %s. The manifest no longer exists.","Prišlo je do napake pri prenosu seznama paketov. Seznam ne obstaja."
104
+ "An unexpected problem occurred whilst attempting to download the manifest %s. %s","Prišlo je do nepričakovane napake pri shranjevanju seznama paketov."
105
+ "Please select the shipments for which you wish to arrange a pickup.","Izberite pakete, za katere želite urediti prevzem"
106
+ "Please enter a pickup date in the format DD/MM/YYYY.","Prosimo vnesite datum prevzema v obliki DD/MM/LLLL"
107
+ "Please select a from and to time for the pickup.","Prosimo izberite kraj in čas prevzema"
108
+ "You cannot create a pickup because you have not fully specified your pickup address. <br />Please set your pickup address in System->Configuration->Sales->Shipping Settings->DPD GeoPost Pickup Address.","Naročilo prevzema ni mogoče, saj je naslov prevzema zaveden napačno. Prosimo nastavite naslov prevzema v System->Configuration->Sales->Shipping Settings->DPD GeoPost Pickup Address."
109
+ "Unable to load shipment information for this shipment %s.","Ni možno naložiti podatkov o pošiljki"
110
+ "Your list did not contain any DPD shipments for which to arrange a pickup.","Vaš seznam ne vsebuje nobenih paketov za oddajo naročila prevzema"
111
+ "A problem occurred whilst communicating your shipment to DPD. <br />""%s""","Prišlo je do napake pri oddaji naročila"
112
+ "DPD reported an error whilst attempting to arrange your pickup. <br />DPD says, ""%s""","Zabeležili smo napako med poskusom organizacije prevzema paketov."
113
+ "Invalid Table Rates File Format","nepravilna oblika zapisa cenika"
114
+ "An error occurred while import table rates.","Prišlo je do napake pri vnosu cen."
115
+ "%1$d records have been imported. See the following list of errors for each record that has not been imported: %2$s","Zapisi so bili uvoženi. Oglejte si seznam napak pri vsakem zapisu, ki ni bil uvožen."
116
+ "Invalid Table Rates format in the Row #%s","nepravilna oblika zapisa cenika v vrstici"
117
+ "Invalid Country ""%s"" in the Row #%s.","Neveljavna država v vrstici"
118
+ "Invalid Region/State ""%s"" in the Row #%s.","Neveljavna regija/država v vrstici"
119
+ "Invalid weight/price ""%s"" in the Row #%s.","Neveljavna teža/cena v vrstici"
120
+ "Invalid price/percentage ""%s"" in the Row #%s.","Neveljavna cena/odstotek v vrstici"
121
+ "Invalid service ""%s"" in the Row #%s.","Neveljavna storitev v vrstici"
122
+ "Invalid COD Surcharge ""%s"" in the Row #%s.","Neveljaven dodatek COD v vrstici"
123
+ "Invalid value Price vs Dest value ""%s"" in the Row #%s. The value should be 0 (Weight vs Dest) or 1 (Price vs Dest).","Nepravilna vrednost cene v primerjavi z destinacijo v vrstici. Vrednost mora biti 0 (teža v primerjavi z destinacijo) ali 1 (cena v primerjavi z destinacijo)."
124
+ "Duplicate Row #%s (Country ""%s"", Region/State ""%s"", Zip ""%s"", Weight/Price ""%s"", Method ""%s"", Price vs Dest ""%s"").","Podvojene vrstice (Cržava, Regija, Teža/Cena, Metoda)"
125
+ "Once the manifest is closed, you will not be able to make further changes to the shipping address. Do you want to continue?","Ko enkrat zaprete seznam izbranih paketov, ne bo več možno spreminjanje naslovov dostave. Želite nadaljevati?"
126
+ "Print Manifest","Natisni seznam paketov"
127
+ "Close Manifest","Zapri seznam paketov"
128
+ "-- Please select an option --","Prosimo izberite možnost"
129
+ "Other (enter web service URLs manually)","Drugo (naslov spletne strani vnesite ročno)"
130
+ "Carrier","prevoznik"
131
+ "Title","naslov"
132
+ "Number","število"
133
+ "Label","nalepka"
134
+ "Action","ukrepanje"
135
+ "Delete","izbriši"
136
+ "Taking this action will cancel the shipment with DPD. Are you sure you want to continue?","S tem ukazom boste preklicali pošiljanje. Želite nadaljevati?"
137
+ "Are you sure?","Ste sigurni? / Zagotovo?"
app/locale/sl_SI/Zitec_PackedShipment.csv ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Agrupación por bultos","Sortiranje pošiljke v pakete"
2
+ "Communicar este envío con el servicio de mensajería","Communicate this shipment to the courier service"
3
+ "Communicar este envío con el servicio de mensajero","Communicate this shipment to the courier service"
4
+ "Total bultos","Skupno število paketov"
5
+ "Coste del envío (base imponible):","Stroški pošiljanja (brez DDV):"
6
+ "Diferencia:","Razlika:"
7
+ Distribuya los productos en bultos,Sortiranje produktov pošiljke v pakete
8
+ "Este módulo permite distribuir sus productos agrupados en bultos, utilizando la tabla inferior. Si lo desea, <strong>puede dejar bultos vacios, y el sistema no los tendrá en cuenta</strong>.",Modul dovoljuje razvrščanje produktov v posamezne pakete z uporabo spodnje tabele. Po želji lahko<strong> posamezne pakete pustite prazne in sistem jih ne bo upošteval.<strong>
9
+ Introduzca una referencia indicativa para las etiquetas de cada bulto,Vnesi opisno referenco odpremne nalepke za vsak paket posebaj.
10
+ "Este módulo genera etiquetas que debera pegar en cada bulto. Para facilitarle la logística, puede personalizar la etiqueta de cada bulto usando los siguientes campos.","Modul omogoča generiranje odpremnih nalepk za vsak posamičen paket. Za pomoč pri ujemanju odpremne nalepke z ustreznim paketom, lahko prilagodite reference v spodnjih poljih"
11
+ Precio del envío al cliente (base imponible):,Stroški pošiljanja stranki (brez DDV):
12
+ Distribución de bultos,Sortiranje pošiljke v pakete
13
+ bulto ,Paket
14
+ Continuar,Nadaljuj
15
+ Cancelar,Prekliči
16
+ Enviar,Predloži
17
+ Referencia bulto ,Paketna referenca
18
+ Descripción del bulto ,Opis paketa
19
+ Introduzca una descripción de cada bulto,Vnesi opis za vsak posamičen paket
20
+ Puede introducir una descripción de cada bulto para comunicar al servicio de mensajería usando los siguientes campos.,V spodnja polja lahko vnesete opombe za dostavno službo.
app/locale/sl_SI/Zitec_PrintShippingLabel.csv ADDED
@@ -0,0 +1 @@
 
1
+ "Print Shipping Labels", "Izis paketne oznake"
app/locale/sl_SI/Zitec_TableRates.csv ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Table Rates","Interaktivni ceniki"
2
+ "Table Rates","Interaktivni ceniki"
3
+ "Save","Shrani"
4
+ "Delete","Zbriši"
5
+ "Duplicate","Podvoji"
6
+ "Save And Continue Edit","Shrani in nadaljuj z urejanjem"
7
+ "Weight (and above)","Teža"
8
+ "Price (and above)","Cena"
9
+ "Shipping Price","Cena pošiljanja"
10
+ "Shipping Percentage","Procent pošiljanja"
11
+ "Fixed Cash On Delivery Surcharge Amount","Znesek COD dodatka "
12
+ "Minimum COD Surcharge","Minimalen COD dodatek"
13
+ "Edit Rate","Uredi stopnjo"
14
+ "New Rate","Nova stopnja"
15
+ "Export","Izvoz"
16
+ "Website","Spletna stran"
17
+ "Dest Country","Namembna država"
18
+ "Dest Zip/Postal Code","ZIP/ Poštna številka"
19
+ "* or blank - matches any","* ali prazno -ujemanje z vsemi"
20
+ "Service","storitev"
21
+ "For rates with this service to be available, you must enable the service from the configuration panel of the shipping method in System->Configuration->Shipping Methods","Če želite omogočiti stopnjo storitve, morate nastaviti v System->Configuration->Shipping Methods"
22
+ "Product","Produkt"
23
+ "For rates with this product to be available, you must enable the product from the configuration panel of the shipping method in System->Configuration->Shipping Methods","Če želite omogočiti stopnjo izdelka, morate nastaviti v System->Configuration->Shipping Methods"
24
+ "Condition","Pogoji"
25
+ "Price vs. Destination","Cena vs. Destinacija"
26
+ "Weight vs. Destination","Teža vs. Destinacija"
27
+ "Enable Shipping Method","Omogoči metodo pošiljanja"
28
+ "Disabled","Onemogoči"
29
+ "Enabled","Omogči"
30
+ "Disable the shipping method if you would like it to be unavailable for orders whose price or weight is greater or equal to the value you have indicated.","Onemogoči pošiljanje, v kolikor želite, da ni na voljo za naročila, katerih cena ali teža je enaka ali večja od vrednosti, ki ste jih navedli."
31
+ "Shipping Price Calculation","Kalkulator cen pošiljanja"
32
+ "Fixed Price","Fiksna cena"
33
+ "Add Percentage","Dodaj procent"
34
+ "Use 'Add Percentage' if you want to calculate the shipping price by adding a percentage to price charged by the shipping carrier.","Uporabite ""Dodaj Odstotek"", če želite izračunati ceno prevoza z dodanim dodatkom."
35
+ "Shipping Price","Cena pošiljanja"
36
+ "Cash On Delivery Surcharge Calculation","Kalkulator COD dodatka"
37
+ "Cash On Delivery Not Available","COD ni na voljo"
38
+ "Zero Surcharge","Nični dodatek"
39
+ "Fixed Surcharge","Fiksni dodatek"
40
+ "Percentage Surcharge","Procentualni dodatek"
41
+ "Fixed Cash On Delivery Surcharge","Fiksni COD dodatek"
42
+ "Minimum COD Surcharge","Minimalni COD dodatek"
43
+ "Optionally specify the minimum COD surcharge.","Določi (opcijsko) minimalni COD dodatek"
44
+ "Dest Region/State","Namebna regija"
45
+ "Import Rates","Uvozi cene"
46
+ "ID","ID"
47
+ "Destination Country","Namembna država"
48
+ "Dest Region/State","Namembna regija"
49
+ "Destination Zip/Postal Code","Zip/Poštna številka"
50
+ "Yes","Da"
51
+ "No","Ne"
52
+ "Shipping Price %","Cena pošiljanja %"
53
+ "COD Surcharge","COD dodatek"
54
+ "COD Surcharge %","COD dodatek %"
55
+ "COD Min. Surcharge","COD min dodatek"
56
+ "Are you sure?","Ste prepričani?"
57
+ "Import","Uvozi cene"
58
+ "Promotion","Promocija"
59
+ "New Rate","Nova cena"
60
+ "Import Rates","Uvozi cene"
61
+ "Export Rates","Izvozi cene"
62
+ "Rate duplicated successfully","Cena uspešno podvojena"
63
+ "Rate was successfully saved","Cena uspešno shranjena"
64
+ "The rate could not be saved because it duplicates the destination, service/product and weight/price of an existing rate. Change some of the rate's values and try saving again.","Stopnje ni bili mogoče shraniti, saj je podvojen naslov dotave, storitev/izdelek in teža/cena. Spremenite katero izmed vrednosti in ponovno poskusite shraniti."
65
+ "Unable to find rate to save","Ne najde cen za s"
66
+ "Rate was successfully deleted","Cena je bila uspešno zbrisana"
67
+ "Total of %d record(s) have been deleted.","Skupaj od zapisov je bilo izbrisanih"
68
+ "An error occurred while updating records.","Med posodabljanjem zapisa je prišlo do napake."
69
+ "Please specify the website and file you wish to import","Navedite spletno stran in datoteko, ki jo želite uvoziti"
70
+ "An error occurred whilst importing the tablerates: %s","Med uvažanjem cen je prišlo do napake"
71
+ "Table rates imported successfully","Lestvica cen je bila uspešno uvožena"
72
+ "Please specify the website whose rates you want to export","Navedite spletno stran, katere stopnje želite izvoziti"
73
+ "Add Rate","Dodajte ceno"
74
+ "Import Rates","Uvozne cene"
75
+ "Export Rates","Izvozne cene"
76
+ "Cash On Delivery Surcharge Percentage","Dodatek za plačilo ob dostavi"
77
+ "Enter the starting weight in kg for this rate.","Vnesite začetno težo v kg."
78
+ "Enter the starting price for this rate in the base currency of website. This rate will apply to orders whose subtotal (excluding shipping) is greater or equal to this price. Only include the sales tax/VAT in this price if you have configured shipping prices to include it (see System->Configuration->Sales->Tax->Calulation Settings->Shipping Prices).","Vnesite začetno ceno za to stopnjo v osnovni valuti. Ta stopnja se uporablja za naročila, pri katerih vmesni seštevek(brez poštnine) znaša več ali enako tej ceni. Cene vključujejo DDV, v kolikor ste nastavili možnost, da ga vključujejo (System->Configuration->Sales->Tax->Calulation Settings->Shipping Prices)."
js/zitec/dpd/admin/PostcodeAutocompleter.js ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var PostcodeAutocompleter = new Class.create(Ajax.Autocompleter, {
2
+ getUpdatedChoices: function() {
3
+ this.startIndicator();
4
+ var entry = encodeURIComponent(this.options.paramName) + '=' +
5
+ encodeURIComponent(this.getToken());
6
+
7
+ this.options.parameters = this.options.callback ?
8
+ this.options.callback(this.element, entry) : entry;
9
+
10
+ if(this.options.defaultParams)
11
+ this.options.parameters += '&' + this.options.defaultParams;
12
+ this.options.parameters = $('edit_form').serialize();
13
+ console.log(this.options);
14
+ new Ajax.Request(this.url, this.options);
15
+ }
16
+ });
js/zitec/dpd/admin/sales.js ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * fixed admin order sales refresh order totals after payment method switched
3
+ * @param method
4
+ */
5
+ AdminOrder.prototype.switchPaymentMethod = function(method){
6
+ this.setPaymentMethod(method);
7
+ var data = {};
8
+ data['order[payment_method]'] = method;
9
+ this.loadArea(['card_validation','totals'], true, data);
10
+ };
11
+
js/zitec_fieldlengths/validator.js ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * To change this template, choose Tools | Templates
3
+ * and open the template in the editor.
4
+ */
5
+
6
+
7
+ var zitecFieldLengths = zitecFieldLengths || {};
8
+
9
+ zitecFieldLengths.Validator = Class.create({
10
+ initialize: function(className, fields, message, maxLength, minLength) {
11
+ this.className = typeof className !=='undefined'? className : 'zitec_fieldlengths-validator';
12
+ this.fields = typeof fields !=='undefined'? fields : [];
13
+ this.message = typeof message !=='undefined'? message : "Too long";
14
+ this.maxLength = typeof maxLength !=='undefined'? maxLength : 0;
15
+ this.minLength = typeof minLength !=='undefined'? minLength : 0;
16
+
17
+ if (!this.className || !this.fields || !this.maxLength) {
18
+ return;
19
+ }
20
+
21
+ var fixedLength = Math.floor(this.maxLength / this.fields.length);
22
+ if (fixedLength >= this.minLength) {
23
+ for (var i = this.fields.length - 1; i >= 0; i -= 1) {
24
+ field = this.fields[i];
25
+ field.writeAttribute("maxlength", fixedLength);
26
+ }
27
+ }
28
+
29
+ if (!Validation) {
30
+ return;
31
+ }
32
+
33
+
34
+ Validation.add(this.className, this.message, function(value, elm) {
35
+ var fullTextLength = 0;
36
+ var lastFieldWithContent = null;
37
+ for (var i = this.fields.length - 1; i >= 0; i -= 1) {
38
+ if (this.fields[i].getValue()) {
39
+ fullTextLength += this.fields[i].getValue().length;
40
+ if (!lastFieldWithContent) {
41
+ lastFieldWithContent = this.fields[i];
42
+ }
43
+ }
44
+ }
45
+
46
+ return fullTextLength <= this.maxLength || (lastFieldWithContent && lastFieldWithContent.id != elm.id);
47
+ }.bind(this));
48
+
49
+
50
+
51
+ for (var i = this.fields.length - 1; i >= 0; i -= 1) {
52
+ field = this.fields[i];
53
+ field.addClassName(this.className)
54
+ }
55
+ }
56
+
57
+
58
+ }) ;
js/zitec_packedshipment/packedshipment.js ADDED
@@ -0,0 +1,632 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Functionality for sending packages grouped
3
+ *
4
+ **/
5
+
6
+
7
+ var ps_totalItemsToShip = 0;
8
+ var ps_qtyInputs;
9
+ var ps_parcelsInput;
10
+ var ps_edit_form;
11
+ var ps_data;
12
+ var runAddressValidation = true;
13
+ var modalDialog1;
14
+
15
+ var zitecPSVars = {
16
+ modalDialog1Title: "",
17
+ parcelColumnTitle: " ",
18
+ cancelLabel: "",
19
+ continueLabel: "",
20
+ submitLabel: "",
21
+ useDescriptionsInsteadOfReferences: false,
22
+ parcelReferenceLabel: "",
23
+ parcelDescriptionLabel: ""
24
+ }
25
+
26
+
27
+ /**
28
+ * Vamos a extender la clase varienps_edit_form para que el submit lance un evento que podamos capturar
29
+ *
30
+ **/
31
+ //when subclassing, specify the class you want to inherit from
32
+ var varienForm = Class.create(varienForm, {
33
+ // redefine the submit method
34
+ submit: function ($super, url, doSubmit) {
35
+ Event.fire($(this.formId), 'packedshipment:submit');
36
+ if (!doSubmit) {
37
+ return false;
38
+ } else {
39
+ return $super(url);
40
+ }
41
+ }
42
+ });
43
+
44
+
45
+ function initNumberOfParcels() {
46
+ ps_qtyInputs = $$("#ship_items_container .grid input");
47
+ ps_qtyInputs.each(function (input) {
48
+ Event.observe(input, 'change', updateMaxParcels);
49
+ });
50
+ ps_parcelsInput = $("packedshipment_parcels_number");
51
+ Event.observe(ps_parcelsInput, 'change', validateParcelsInput);
52
+
53
+ ps_edit_form = $('edit_form');
54
+
55
+ updateMaxParcels();
56
+ }
57
+
58
+ /**
59
+ * Counts the totall number of parcels to send
60
+ */
61
+ function updateMaxParcels() {
62
+ /*
63
+ In the case the carrier's rules force us to send all products in one parcel, we leave empty the field with total
64
+ number of parcels empty. Otherwise, we initialize it with the total number of items that will be shipped
65
+ */
66
+
67
+ if (!mustSendShipmentInOneParcel) { // mustSendShipmentInOneParcel is defined in sales/order/shipment/create/items.phtml
68
+ ps_totalItemsToShip = 0;
69
+ ps_qtyInputs.each(function (input) {
70
+ ps_totalItemsToShip = parseInt(input.value) + ps_totalItemsToShip;
71
+ });
72
+
73
+ ps_parcelsInput.value = ps_totalItemsToShip;
74
+ ps_parcelsInput.enable();
75
+ }
76
+ else {
77
+ ps_parcelsInput.value = 1;
78
+ ps_parcelsInput.disable();
79
+ }
80
+ }
81
+
82
+ /**
83
+ *
84
+ * Validate the number of parcels. It must be between 1 and the total number of products.
85
+ */
86
+ function validateParcelsInput(event) {
87
+ //The total number of parcels cannot be 0 or greater then the number of products
88
+ var valid = true;
89
+ var input = event.target;
90
+ var value = input.getValue();
91
+
92
+ if (isNaN(value) || value < 1 || value > ps_totalItemsToShip) {
93
+ Dialog.alert("The total number of parcels cannot be 0 or greater then the number of products",
94
+ {
95
+ width: 300,
96
+ okLabel: "accept",
97
+ className: "magento",
98
+ ok: function (win) {
99
+ Form.Element.activate(input);
100
+ input.value = ps_totalItemsToShip;
101
+ return true;
102
+ }
103
+ }
104
+ );
105
+ }
106
+
107
+ }
108
+
109
+ function _cancelModals() {
110
+ Event.fire(ps_edit_form, 'packedshipment:cancel');
111
+ $$(".packedshipment_added").each(function (el) {
112
+ el.remove();
113
+ });
114
+ }
115
+
116
+ function _doEditFormSubmit() {
117
+ ps_data.each(function (el, index) {
118
+ //create a hidden element for each product id
119
+ el.ids.each(function (id) {
120
+ var input = new Element('input', {
121
+ 'type': 'hidden',
122
+ 'name': 'packages[' + el.package + '][ids][]',
123
+ 'value': id,
124
+ 'class': 'packedshipment_hidden'
125
+ });
126
+
127
+ ps_edit_form.insert(input);
128
+ });
129
+ });
130
+
131
+ for (var i = 0; i < ps_parcelsInput.value; i++) {
132
+ var packageIndex = i + 1;
133
+ var data = ps_data[i];
134
+ if (data.ids.length > 0) {
135
+ var input = new Element('input', {
136
+ 'type': 'hidden',
137
+ 'name': 'packages[' + packageIndex + '][ref]',
138
+ 'value': ps_data[i].ref,
139
+ 'class': 'packedshipment_hidden'
140
+ });
141
+ }
142
+
143
+ ps_edit_form.insert(input);
144
+ }
145
+
146
+ ps_edit_form.submit();
147
+ }
148
+
149
+ function _getTotalWeightAllParcels() {
150
+ //Calculate the total weight of parcels
151
+ var parcelsWeightsArr = document.getElementsByName('lineWeight');
152
+ var sumWeights = 0;
153
+ for (var arrIdx = 0; arrIdx < parcelsWeightsArr.length; arrIdx++) {
154
+ sumWeights += parseFloat($(parcelsWeightsArr[arrIdx]).innerHTML);
155
+ }
156
+
157
+ return sumWeights;
158
+ }
159
+
160
+ function _recalculateTotalParcelsWeights() {
161
+ // We start the total weight for each parcel at 0
162
+ var numberOfParcels = ps_parcelsInput.value;
163
+ for (var parcelIdx = 1; parcelIdx <= numberOfParcels; parcelIdx++) {
164
+ $('parcel_total_weight_' + parcelIdx).innerHTML = '0.0000';
165
+ }
166
+
167
+ //Calculate the total weight for each parcel
168
+ $$(modalDialog1 ? "#" + modalDialog1.getId() + " .packedshipment_input" : "input.packedshipment_input").each(function (el) {
169
+ if ((el.type == 'radio') && (el.checked)) {
170
+ var parcelIndex = el.getValue();
171
+ var eltName = el.readAttribute('name');
172
+ var eltNameParts = eltName.split("_");
173
+ var productId = eltNameParts[0];
174
+
175
+ // The weight of each product is at the beginning of each row with ID
176
+ // lineWeight_<product_id>_<row_num>.
177
+ // There may be several elements with the same product ID, which will have the same weight as the first
178
+
179
+ var productWeightEls = $$('[id^="lineWeight_' + productId + '"]');
180
+ var productWeightEl = productWeightEls[0];
181
+ var productWeight = parseFloat(productWeightEl.innerHTML);
182
+ var parcelTotalWeight = $('parcel_total_weight_' + parcelIndex);
183
+ parcelTotalWeight.innerHTML = (parseFloat(parcelTotalWeight.innerHTML) + productWeight).toFixed(4);
184
+ }
185
+ })
186
+ }
187
+
188
+ // If the system need to call the api to obtain shipping cost amount
189
+ // we calculate it based on the configuration of packages and zip code / city
190
+ // Current.
191
+ // Important: This feature requires that we have already calculated the weights of the
192
+ // parcels, making a call to the function _recalculateTotalParcelsWeights.
193
+ function _recalculateShippingCost() {
194
+ if (!$('zitecShippingCostTable')) {
195
+ return;
196
+ }
197
+
198
+ var ajaxParameters = [];
199
+ ajaxParameters['order'] = zitecShipmentOrderId;
200
+
201
+ ajaxParameters['city'] = zitecShippingAddressCity ? zitecShippingAddressCity : '';
202
+ ajaxParameters['postcode'] = zitecShippingAddressPostcode ? zitecShippingAddressPostcode : '';
203
+
204
+ // Sacamos un array de los pesos de los bultos que actualmente contienen algo.
205
+ $$(modalDialog1 ? "#" + modalDialog1.getId() + " .packedshipment_input" : "input.packedshipment_input").each(function (el) {
206
+ if ((el.type == 'radio') && (el.checked)) {
207
+ var parcelIndex = el.getValue();
208
+ ajaxParameters['weightsParcels[' + parcelIndex + ']'] = $('parcel_total_weight_' + parcelIndex).innerHTML;
209
+ }
210
+ });
211
+
212
+
213
+ new Ajax.Request(zitecShippingCostUrl, {
214
+ method: 'post',
215
+ parameters: ajaxParameters,
216
+ onSuccess: function (transport) {
217
+ var jsonResponse = transport.responseJSON;
218
+ if (jsonResponse.shippingcost) {
219
+ $('zitecShippingCost').innerHTML = jsonResponse.shippingcost;
220
+ $('zitecShippingProfit').innerHTML = jsonResponse.profit;
221
+ $('zitecShippingProfit').style.color = jsonResponse.profitcolor;
222
+ $('zitecShippingResportsShippingCost').setValue(jsonResponse.shippingreportsshippingcost);
223
+ }
224
+ }
225
+ });
226
+
227
+
228
+ }
229
+
230
+ function _recalculateTotals() {
231
+ // We calculate the actual weight and cost for parcels
232
+ _recalculateTotalParcelsWeights();
233
+
234
+ // We calculate the shipping cost
235
+ _recalculateShippingCost();
236
+ }
237
+
238
+ function _prepareModal1() {
239
+ var numberOfParcels = ps_parcelsInput.value;
240
+
241
+ for (var i = 1; i <= numberOfParcels; i++) {
242
+ //for each selected package we have to create a th
243
+ var th = new Element('th', {
244
+ 'align': 'center',
245
+ 'valign': 'middle',
246
+ 'class': 'packedshipment_added',
247
+ 'style': 'padding:5px;'
248
+ }).update(zitecPSVars.parcelColumnTitle + i);
249
+ $("packages_modal_1_headings_tr").insert(th);
250
+ }
251
+
252
+ var checkedIndex = 1;
253
+ var row = 0;
254
+ $$("#ship_items_container .grid input").each(function (el) {
255
+ var qty = el.getValue();
256
+ var id = el.readAttribute('name').replace("shipment[items][", "");
257
+ id = id.replace("]", "");
258
+ ps_itemData = ps_items[id];
259
+
260
+ for (var i = 0; i < qty; i++) {
261
+ var sku = new Element('td', {
262
+ 'align': 'center',
263
+ 'valign': 'middle',
264
+ 'class': 'packedshipment_added',
265
+ 'style': 'padding:5px;'
266
+ });
267
+ sku.update(ps_itemData.sku);
268
+
269
+ var name = new Element('td', {
270
+ 'align': 'center',
271
+ 'valign': 'middle',
272
+ 'class': 'packedshipment_added',
273
+ 'style': 'padding:5px;'
274
+ });
275
+ name.update(ps_itemData.name);
276
+
277
+ var lineWeightId = 'lineWeight_' + ps_itemData.productId + '_' + row;
278
+ var weight = new Element('td', {
279
+ 'id': lineWeightId,
280
+ name: 'lineWeight',
281
+ 'align': 'center',
282
+ 'valign': 'middle',
283
+ 'class': 'packedshipment_added',
284
+ 'style': 'padding:5px;'
285
+ });
286
+ weight.update(ps_itemData.weight);
287
+
288
+ var tr = new Element('tr', {
289
+ 'class': 'border packages_modal_1_product_tr',
290
+ 'packages:item_id': (ps_itemData.productId + '_' + (row + 1))
291
+ });
292
+ tr.insert(sku);
293
+ tr.insert(name);
294
+ tr.insert(weight);
295
+
296
+ //Now we add a column for each parcel
297
+ for (var j = 1; j <= numberOfParcels; j++) {
298
+ var input = new Element('input', {
299
+ 'type': 'radio',
300
+ 'name': ps_itemData.productId + '_' + (row + 1),
301
+ 'value': j,
302
+ 'class': 'packedshipment_input',
303
+ 'onclick': '_recalculateTotals()'
304
+ });
305
+ if (checkedIndex == j) {
306
+ input.writeAttribute('checked', 'checked');
307
+ }
308
+
309
+ var td = new Element('td', {
310
+ 'align': 'center',
311
+ 'valign': 'middle',
312
+ 'class': 'packedshipment_added',
313
+ 'style': 'padding:5px;'
314
+ }).update(input);
315
+ tr.insert(td);
316
+ }
317
+ //checkedIndex = (checkedIndex == numberOfParcels) ? 1 : checkedIndex + 1;
318
+
319
+
320
+ var oddEven = row % 2 ? 'odd' : 'even';
321
+ var tbody = new Element('tbody', {'class': oddEven + ' packedshipment_added'});
322
+ tbody.update(tr);
323
+
324
+
325
+ $('packages_table_modal_1').insert(tbody);
326
+
327
+ row++;
328
+ } // for
329
+ });
330
+
331
+ // Add new lines to the totals section
332
+
333
+ // Total weight
334
+ var weightTitle = new Element('td', {
335
+ 'align': 'right',
336
+ 'valign': 'middle',
337
+ 'class': 'packedshipment_added',
338
+ 'style': 'padding:5px;',
339
+ 'colspan': 2
340
+ });
341
+ weightTitle.update('<span class="headings">Total Weight</span>');
342
+ var totalWeightAll = new Element('td', {
343
+ 'align': 'center',
344
+ 'valign': 'middle',
345
+ 'class': 'packedshipment_added',
346
+ 'style': 'padding:5px;'
347
+ });
348
+ totalWeightAll.update(_getTotalWeightAllParcels().toFixed(4));
349
+ var weightTotalsRow = new Element('tr', {'class': 'border packages_modal_1_product_tr'});
350
+ weightTotalsRow.insert(weightTitle);
351
+ weightTotalsRow.insert(totalWeightAll);
352
+ for (var j = 1; j <= numberOfParcels; j++) {
353
+ var bultoTotalWeightId = 'parcel_total_weight_' + j;
354
+ var bultoTotalWeight = new Element('td', {
355
+ 'id': bultoTotalWeightId,
356
+ 'align': 'center',
357
+ 'valign': 'middle',
358
+ 'class': 'packedshipment_added',
359
+ 'style': 'padding:5px;'
360
+ });
361
+ weightTotalsRow.insert(bultoTotalWeight);
362
+ }
363
+ var oddEven = row % 2 ? 'odd' : 'even';
364
+ var tbody = new Element('tbody', {'class': oddEven + ' packedshipment_added'});
365
+ tbody.update(weightTotalsRow);
366
+ $('packages_table_modal_1').insert(tbody);
367
+
368
+ modalDialog1 = null;
369
+ _recalculateTotals();
370
+
371
+ row++;
372
+ }
373
+
374
+
375
+ function openModal1() {
376
+
377
+ _prepareModal1();
378
+
379
+ var content = $('packages_modal_1').innerHTML;
380
+
381
+ modalDialog1 = Dialog.confirm(
382
+ content,
383
+ {
384
+ className: "magento",
385
+ title: zitecPSVars.modalDialog1Title,
386
+ minWidth: 600,
387
+ minHeight: 300,
388
+ width: 960,
389
+ height: 400,
390
+ resizable: true,
391
+ closable: true,
392
+ minimizable: false,
393
+ maximizable: false,
394
+ draggable: true,
395
+ width: 400,
396
+ okLabel: zitecPSVars.continueLabel,
397
+ cancelLabel: zitecPSVars.cancelLabel,
398
+ onOk: _onModal1Ok,
399
+ onCancel: _cancelModals,
400
+ onClose: _cancelModals,
401
+ buttonClass: "scalable"
402
+ });
403
+
404
+
405
+ }
406
+
407
+ function _onModal1Ok(win) {
408
+ ps_data = [];
409
+ for (var i = 0; i < ps_parcelsInput.value; i++) {
410
+ ps_data[i] = {'package': i + 1, 'ids': [], 'ref': ''};
411
+ }
412
+
413
+ $$("#" + win.getId() + " .packedshipment_input").each(function (el) {
414
+ if (el.checked) {
415
+ var parcelIndex = el.getValue();
416
+ var tmp = el.readAttribute('name').split("_");
417
+ var productoId = tmp[0];
418
+ ps_data[(parcelIndex - 1)].ids.push(productoId);
419
+ ps_data[(parcelIndex - 1)].ref += el.up().up().firstDescendant().innerHTML + " ";
420
+ }
421
+ })
422
+
423
+ this.close();
424
+ openModal2();
425
+ return false;
426
+ }
427
+
428
+
429
+ function _prepareModal2() {
430
+ ps_data.each(function (el) {
431
+ if (el.ids.length > 0) {
432
+ var input = new Element('textarea', {
433
+ 'id': 'package_' + el.package + '_ref',
434
+ 'style': "height:6em; width:99%;",
435
+ 'cols': '5',
436
+ 'rows': '3',
437
+ 'name': 'packages[' + el.package + '][ref]'
438
+ });
439
+ input.update(el.ref);
440
+
441
+ var label = new Element('label', {
442
+ 'for': 'package_' + el.package + '_ref',
443
+ 'class': 'bold'
444
+ });
445
+ var parcelReferenceLabel = zitecPSVars.useDescriptionsInsteadOfReferences ? zitecPSVars.parcelDescriptionLabel : zitecPSVars.parcelReferenceLabel;
446
+ label.update(parcelReferenceLabel + el.package);
447
+
448
+ var span = new Element('span', {
449
+ 'class': 'field-row packedshipment_added'
450
+ });
451
+ span.insert(label);
452
+ span.insert(input);
453
+
454
+ $("packages_modal_2_input_container").insert(span);
455
+ }
456
+ });
457
+
458
+ }
459
+
460
+
461
+ function openModal2() {
462
+
463
+ _prepareModal2();
464
+
465
+ var content = $('packages_modal_2').innerHTML;
466
+
467
+ Dialog.confirm(
468
+ content,
469
+ {
470
+ className: "magento",
471
+ //parent: ps_edit_form,
472
+ title: zitecPSVars.modalDialog1Title,
473
+ minWidth: 600,
474
+ minHeight: 300,
475
+ height: 400,
476
+ resizable: true,
477
+ closable: true,
478
+ minimizable: false,
479
+ maximizable: false,
480
+ draggable: true,
481
+ width: 400,
482
+ okLabel: zitecPSVars.submitLabel,
483
+ cancelLabel: zitecPSVars.cancelLabel,
484
+ onOk: _onModal2Ok,
485
+ onCancel: _cancelModals,
486
+ onClose: _cancelModals,
487
+ buttonClass: "scalable"
488
+ });
489
+
490
+ }
491
+
492
+
493
+ function _onModal2Ok(win) {
494
+ $$("#" + win.getId() + " textarea").each(function (el) {
495
+
496
+ var tmp = el.readAttribute('id');
497
+ tmp = tmp.replace("package_", "");
498
+ var parcelIndex = tmp.replace("_ref", "");
499
+ ps_data[(parcelIndex - 1)].ref = el.getValue();
500
+
501
+ });
502
+
503
+ _doEditFormSubmit();
504
+ this.close();
505
+ return false;
506
+ }
507
+
508
+ function _addressValidationModalOk() {
509
+ var correctedCityInput = $('packagedshipment[corrected_city]');
510
+ var correctedCity = '';
511
+ if (correctedCityInput) {
512
+ if (correctedCityInput.tagName == 'SELECT') {
513
+ correctedCity = correctedCityInput.options[correctedCityInput.selectedIndex].value;
514
+ }
515
+ else {
516
+ correctedCity = correctedCityInput.value;
517
+ }
518
+ zitecShippingAddressCity = correctedCity;
519
+ }
520
+
521
+ var correctedPostcodeInput = $('packagedshipment[corrected_postcode]');
522
+ var correctedPostcode = '';
523
+ if (correctedPostcodeInput) {
524
+ if (correctedPostcodeInput.tagName == 'SELECT') {
525
+ correctedPostcode = correctedPostcodeInput.options[correctedPostcodeInput.selectedIndex].value;
526
+ } else {
527
+ correctedPostcode = correctedPostcodeInput.value;
528
+ }
529
+ zitecShippingAddressPostcode = correctedPostcode;
530
+
531
+ }
532
+
533
+ var dontCorrectAddressInput = $('packagedshipment[dont_correct_address]');
534
+ if (dontCorrectAddressInput && dontCorrectAddressInput.checked) {
535
+ zitecDontCorrectAddress = true;
536
+ } else {
537
+ zitecDontCorrectAddress = false;
538
+ }
539
+
540
+ this.close();
541
+
542
+ openAddressValidationModal();
543
+ }
544
+
545
+ function openAddressValidationModal() {
546
+
547
+ new Ajax.Request(zitecValidateAddressUrl, {
548
+ method: 'post',
549
+ parameters: {
550
+ order: zitecOrderId,
551
+ city: zitecShippingAddressCity,
552
+ postcode: zitecShippingAddressPostcode,
553
+ countryid: zitecShippingAddressCountryId,
554
+ dontcorrectaddress: zitecDontCorrectAddress ? 1 : 0
555
+ },
556
+ onSuccess: function (transport) {
557
+ var jsonResponse = transport.responseJSON;
558
+ if (jsonResponse.dialogHtml) {
559
+ Dialog.confirm(
560
+ jsonResponse.dialogHtml,
561
+ {
562
+ className: "magento",
563
+ title: "Validation of the shipping address",
564
+ minWidth: 600,
565
+ minHeight: 300,
566
+ height: 400,
567
+ resizable: true,
568
+ closable: true,
569
+ minimizable: false,
570
+ maximizable: false,
571
+ draggable: true,
572
+ width: 400,
573
+ okLabel: "Continue",
574
+ cancelLabel: "Cancel",
575
+ onOk: _addressValidationModalOk,
576
+ onCancel: _cancelModals,
577
+ onClose: _cancelModals,
578
+ buttonClass: "scalable"
579
+ });
580
+ } else {
581
+ if ($('packagedshipment[city]')) {
582
+ var cityParentNode = $('packagedshipment[city]').parentNode;
583
+ cityParentNode.removeChild($('packagedshipment[city]'));
584
+ }
585
+ if ($('packagedshipment[postcode]')) {
586
+ var postcodeParentNode = $('packagedshipment[postcode]').parentNode;
587
+ postcodeParentNode.removeChild($('packagedshipment[postcode]'));
588
+ }
589
+ $("packages_modal_2_input_container").insert('<input type="hidden" value="' + zitecShippingAddressCity +
590
+ '" name="packagedshipment[city]" id="packagedshipment[city]" /> ' +
591
+ '<input type="hidden" value="' + zitecShippingAddressPostcode +
592
+ '" name="packagedshipment[postcode]" id="packagedshipment[postcode]" /> ');
593
+ openModal1();
594
+ }
595
+ }
596
+ });
597
+
598
+ }
599
+
600
+ function openPackedhipmentModal() {
601
+ // If the user has chosen to send the shipment request to DPD, open the diablog box to group the products in parcels
602
+
603
+ // The variable zitec_packedshipment is defined in zitec_packedshipment/sales/order/shipment/create/items.phtml
604
+ if (communicateShipmentCheckbox && communicateShipmentCheckbox.checked) {
605
+ // The variable zitec_packedshipment is defined zitec_packedshipment/sales/order/shipment/create/address_validation_info_js.phtml
606
+ if (zitecIsAddressValidationAvailable) {
607
+ openAddressValidationModal();
608
+ }
609
+ else {
610
+ openModal1();
611
+ }
612
+ }
613
+ else {
614
+ ps_edit_form.submit();
615
+ }
616
+ }
617
+
618
+ Event.observe(window, 'load', function () {
619
+ if ($('packages_modal_1')) {
620
+ initNumberOfParcels();
621
+
622
+ Event.observe(ps_edit_form, 'packedshipment:submit', function (event) {
623
+ openPackedhipmentModal();
624
+ });
625
+ } else {
626
+ Event.observe($('edit_form'), 'packedshipment:submit', function (event) {
627
+ $('edit_form').submit();
628
+ });
629
+ }
630
+
631
+ });
632
+
lib/Zitec/Dpd/Api.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api
7
+ *
8
+ *
9
+ * @category Zitec
10
+ * www.zitec.com
11
+ * @package Zitec_Dpd
12
+ * @author george.babarus <george.babarus@gmail.com>
13
+ * @license http://opensource.org/licenses/osl-3.0.php
14
+ */
15
+ class Zitec_Dpd_Api
16
+ {
17
+
18
+ const API_VERSION = 1;
19
+
20
+
21
+ protected $_parameters;
22
+ protected $_method;
23
+
24
+ protected $_methodObject;
25
+
26
+ protected static $_instance;
27
+
28
+
29
+ public function __construct()
30
+ {
31
+ $parameters = func_get_args();
32
+
33
+ if (count($parameters) == 0) {
34
+ return;
35
+ }
36
+ foreach ($parameters as $param) {
37
+ if (is_string($param)) {
38
+ $this->_method = $param;
39
+ }
40
+ if (is_array($param)) {
41
+ $this->_parameters = $param;
42
+ $this->_method = $this->_parameters['method'];
43
+ unset($this->_parameters['method']);
44
+ }
45
+ }
46
+
47
+ $this->__init();
48
+ }
49
+
50
+
51
+ public function __init()
52
+ {
53
+ if (empty($this->_method) || empty($this->_parameters) || !is_array($this->_parameters)) {
54
+ throw new Exception('DPD API - wrong parameters set for calling the api', 110);
55
+ }
56
+
57
+ $className = Zitec_Dpd_Api_Configs::getClassNameForMethod($this->_method);
58
+
59
+ if (!empty($className)) {
60
+ $this->_methodObject = new $className($this->_parameters);
61
+ } else {
62
+ throw new Exception('DPD API - Invalid method called', 111);
63
+ }
64
+
65
+ }
66
+
67
+
68
+ public function __invoke()
69
+ {
70
+ return $this->getApiMethodObject();
71
+ }
72
+
73
+
74
+ /**
75
+ * @return Zitec_Dpd_Api_Abstract
76
+ */
77
+ public function getApiMethodObject()
78
+ {
79
+ return $this->_methodObject;
80
+ }
81
+
82
+ /**
83
+ * Singleton pattern implementation
84
+ *
85
+ * @return Varien_Autoload
86
+ */
87
+ static public function instance()
88
+ {
89
+ if (!self::$_instance) {
90
+ self::$_instance = new Zitec_Dpd_Api();
91
+ }
92
+
93
+ return self::$_instance;
94
+ }
95
+
96
+ /**
97
+ * Register SPL autoload function
98
+ */
99
+ static public function autoloadRegister()
100
+ {
101
+ spl_autoload_register(array(self::instance(), 'autoload'));
102
+ }
103
+
104
+
105
+ /**
106
+ * Load class source code
107
+ *
108
+ * @param string $class
109
+ */
110
+ public function autoload($class)
111
+ {
112
+ $baseDir = dirname(dirname(dirname(__FILE__)));
113
+
114
+ $classFile = $baseDir . DIRECTORY_SEPARATOR . str_replace(' ', DIRECTORY_SEPARATOR, ucwords(str_replace('_', ' ', $class)));
115
+ $classFile .= '.php';
116
+
117
+ return include $classFile;
118
+ }
119
+
120
+
121
+ }
122
+
123
+
124
+ Zitec_Dpd_Api::autoloadRegister();
lib/Zitec/Dpd/Api/Abstract.php ADDED
@@ -0,0 +1,361 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Abstract
7
+ * This class will be extended to obtain fully functional api call
8
+ *
9
+ * put api parameters on constructor
10
+ * overwrite getMethod method - to return the called action on the api
11
+ * call execute
12
+ * read the response with getResponse method as object
13
+ *
14
+ * surround the call of init and execute function with a try catch
15
+ * it may throw some exception to be processed
16
+ *
17
+ * Error codes
18
+ * 100 DPD Api - No method specified:
19
+ * 101 Soap client problems, no api url specified
20
+ * 102 DPD API - Incorrect parameters supplied
21
+ * 103 DPD API - Incorrect supplied parameter path
22
+ *
23
+ *
24
+ * @category Zitec
25
+ * www.zitec.com
26
+ * @package Zitec_Dpd
27
+ * @author george.babarus <george.babarus@gmail.com>
28
+ * @license http://opensource.org/licenses/osl-3.0.php
29
+ */
30
+ abstract class Zitec_Dpd_Api_Abstract
31
+ {
32
+
33
+ protected $_url = null;
34
+ protected $_connectionTimeout = null;
35
+ protected $_wsUserName = null;
36
+ protected $_wsPassword = null;
37
+ protected $_payerId = null;
38
+ protected $_senderAddressId = null;
39
+
40
+ protected $_lastResponse = null;
41
+ protected $_lastRequest = null;
42
+
43
+ protected $_data = array();
44
+
45
+ protected $_method = null;
46
+
47
+ protected $_response = null;
48
+
49
+
50
+ public function __construct(array $connectionParams)
51
+ {
52
+ $this->_data = $connectionParams;
53
+
54
+ /**
55
+ * initialize all others data members
56
+ */
57
+ $this->_init();
58
+ }
59
+
60
+ /**
61
+ *
62
+ * @throws Exception
63
+ */
64
+ protected function _init()
65
+ {
66
+ /**
67
+ * set main service code
68
+ * allowed
69
+ * 1 - DPD Classic
70
+ * 10 - DPD 10:00
71
+ * 9 - DPD 12:00
72
+ * 109 - DPD B2C
73
+ * 27 - DPD Same Day
74
+ * */
75
+ if (isset($this->_data[Zitec_Dpd_Api_Configs::SHIPMENT_LIST_MAIN_SERVICE_CODE])) {
76
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_MAIN_SERVICE_CODE, $this->_data[Zitec_Dpd_Api_Configs::SHIPMENT_LIST_MAIN_SERVICE_CODE]);
77
+ }
78
+
79
+ //conection details
80
+ $this->_url = $this->_data[Zitec_Dpd_Api_Configs::URL];
81
+ $this->_connectionTimeout = isset($this->_data[Zitec_Dpd_Api_Configs::CONNECTION_TIMEOUT]) ? $this->_data[Zitec_Dpd_Api_Configs::CONNECTION_TIMEOUT] : 10;
82
+ $this->_wsUserName = $this->_data[Zitec_Dpd_Api_Configs::WS_USER_NAME];
83
+ $this->_wsPassword = $this->_data[Zitec_Dpd_Api_Configs::WS_PASSWORD];
84
+ $this->_method = $this->_getMethod();
85
+
86
+ //delivery details
87
+ $this->_senderAddressId = $this->_data[Zitec_Dpd_Api_Configs::SENDER_ADDRESS_ID];
88
+ $this->_payerId = $this->_data[Zitec_Dpd_Api_Configs::PAYER_ID];
89
+
90
+
91
+ $this->_setData(Zitec_Dpd_Api_Configs::WS_USER_NAME, $this->_wsUserName);
92
+ $this->_setData(Zitec_Dpd_Api_Configs::WS_PASSWORD, $this->_wsPassword);
93
+ }
94
+
95
+
96
+ /**
97
+ * it is used to identify the method will be called on api
98
+ *
99
+ * @return string
100
+ */
101
+ protected abstract function _getMethod();
102
+
103
+
104
+ /**
105
+ * instantiate the standard soap client for PHP 5.3 >
106
+ * or instantiate the custom soap client
107
+ *
108
+ * @return \SoapClient
109
+ * @throws Exception
110
+ */
111
+ protected function _getSoapClient()
112
+ {
113
+
114
+ try {
115
+ if (version_compare(phpversion(), '5.3.0', '<') === true) {
116
+ $soapClient = new Zitec_Dpd_Api_Soapclient($this->_url, array('soap_version' => SOAP_1_1, 'encoding' => 'UTF-8', 'cache_wsdl' => WSDL_CACHE_NONE, "trace" => true));
117
+ } else {
118
+ $soapClient = new SoapClient($this->_url, array('soap_version' => SOAP_1_1, 'encoding' => 'UTF-8', 'cache_wsdl' => WSDL_CACHE_NONE, "trace" => true));
119
+ }
120
+
121
+ return $soapClient;
122
+ } catch (SoapFault $e) {
123
+ throw new Exception($e->getMessage(), 101);
124
+ } catch (Exception $e) {
125
+ throw new Exception($e->getMessage(), 101);
126
+ }
127
+ }
128
+
129
+
130
+ /**
131
+ * execute the soap call with the existing param on $_data at url $this->_url
132
+ *
133
+ * @param string $method
134
+ * @param array $data
135
+ *
136
+ * @return Zitec_Dpd_Api_Response
137
+ * @throws Exception
138
+ */
139
+ public function execute($method = null)
140
+ {
141
+ if (!$method) {
142
+ $method = $this->_method;
143
+ }
144
+
145
+ if (!$method) {
146
+ throw new Exception("DPD Api - No method specified: " . __FUNCTION__, 100);
147
+ }
148
+
149
+ $this->_beforeExecute();
150
+
151
+ $e = null;
152
+ $response = null;
153
+
154
+ $soapClient = $this->_getSoapClient();
155
+
156
+ $response = $soapClient->__soapCall($method, array($this->_data));
157
+
158
+ $this->_lastRequest = $soapClient->__getLastRequest();
159
+ $this->_lastResponse = $soapClient->__getLastResponse();
160
+
161
+ $this->_response = $this->_createResponse($response);
162
+
163
+ $this->_afterExecute();
164
+
165
+ return $this->_response;
166
+ }
167
+
168
+
169
+ /**
170
+ *
171
+ * @param mixed $path
172
+ * @param mixed $value
173
+ * @param array $data
174
+ *
175
+ * @throws Exception
176
+ * @return Zitec_Dpd_Api_Abstract
177
+ */
178
+ protected function _setData($path, $value, &$data = null)
179
+ {
180
+ if (!$path) {
181
+ throw new Exception("DPD API - Incorrect supplied parameter path", 102);
182
+ }
183
+
184
+ if (!isset($data)) {
185
+ return $this->_setData($path, $value, $this->_data);
186
+ }
187
+
188
+ if (!is_array($path)) {
189
+ $path = explode('/', $path);
190
+ }
191
+
192
+
193
+ if (count($path) == 1) {
194
+ if (array_key_exists($path[0], $data)) {
195
+ if (is_array($data[$path[0]]) && $value != null) {
196
+ $pathKeys = array_keys($data[$path[0]]);
197
+ if (count($pathKeys) > 0 && $pathKeys[0] == "0") {
198
+ $data[$path[0]][] = $value;
199
+ } else {
200
+ $currentValue = $data[$path[0]];
201
+ $data[$path[0]] = array_merge($currentValue, $value);
202
+ }
203
+ } else {
204
+ $data[$path[0]] = $value;
205
+ }
206
+ } else {
207
+ $data[$path[0]] = $value;
208
+ }
209
+ } else {
210
+ $pathEl = array_shift($path);
211
+ if (!array_key_exists($pathEl, $data)) {
212
+ $data[$pathEl] = array();
213
+ }
214
+
215
+ return $this->_setData($path, $value, $data[$pathEl]);
216
+ }
217
+
218
+ return $this;
219
+
220
+ }
221
+
222
+
223
+ /**
224
+ *
225
+ * @param mixed $path
226
+ * @param array $data
227
+ *
228
+ * @return mixed
229
+ * @throws Exception
230
+ */
231
+ protected function _getData($path, $data = null)
232
+ {
233
+ if (!$path) {
234
+ throw new Exception("DPD API - Incorrect supplied parameter path" , 103);
235
+ }
236
+
237
+ if (!isset($data)) {
238
+ $data = $this->_data;
239
+ }
240
+
241
+ if (!is_array($path)) {
242
+ $path = array($path);
243
+ }
244
+
245
+ $pathEl = array_shift($path);
246
+ if (array_key_exists($pathEl, $data)) {
247
+ if (count($path) == 0) {
248
+ return $data[$pathEl];
249
+ } else {
250
+ return $this->_getData($path, $data[$pathEl]);
251
+ }
252
+ } else {
253
+ return null;
254
+ }
255
+
256
+ }
257
+
258
+
259
+
260
+
261
+
262
+ /**
263
+ *
264
+ * @param string|array $path
265
+ *
266
+ * @return int
267
+ */
268
+ protected function _count($path)
269
+ {
270
+ $value = $this->_getData($path);
271
+ if (!$value) {
272
+ return 0;
273
+ } elseif (is_array($value)) {
274
+ $keys = array_keys($value);
275
+ if (count($keys) > 0 && $keys[0] == "0") {
276
+ return count($value);
277
+ } else {
278
+ return 1;
279
+ }
280
+ } else {
281
+ return 1;
282
+ }
283
+ }
284
+
285
+
286
+
287
+ /**
288
+ * create a response object and fill it with data
289
+ *
290
+ * @return Zitec_Dpd_Api_Response
291
+ */
292
+ protected abstract function _createResponse(stdClass $response);
293
+
294
+
295
+
296
+ /**
297
+ * return the response of the last call to the api
298
+ *
299
+ * @return stdClass
300
+ */
301
+ public function getResponse()
302
+ {
303
+ return $this->_response;
304
+ }
305
+
306
+
307
+ protected function _afterExecute()
308
+ {
309
+ return $this;
310
+ }
311
+
312
+ protected function _beforeExecute()
313
+ {
314
+ return $this;
315
+ }
316
+
317
+
318
+ /**
319
+ *
320
+ * @return string
321
+ */
322
+ public function getUrl()
323
+ {
324
+ return $this->_url;
325
+ }
326
+
327
+
328
+ /**
329
+ *
330
+ * @param string $tag
331
+ * @param mixed $value
332
+ *
333
+ * @return Zitec_Dpd_Api_Shipment_Save
334
+ */
335
+ public function addAdditionalServices($tag, $value)
336
+ {
337
+ return $this->setShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_ADDITIONAL_SERVICES, array($tag => $value));
338
+ }
339
+
340
+
341
+ /**
342
+ * set the insurance value on each package on the delivery
343
+ *
344
+ * @param $amount
345
+ * @param $currency
346
+ * @param $description
347
+ */
348
+ public function setAdditionalHighInsurance($amount, $currency, $description)
349
+ {
350
+
351
+ $this->addAdditionalServices(Zitec_Dpd_Api_Configs::ADDITIONAL_INSURANCE,
352
+ array(Zitec_Dpd_Api_Configs::INSURANCE_GOODS_VALUE => $amount,
353
+ Zitec_Dpd_Api_Configs::INSURANCE_CURRENCY => $currency,
354
+ Zitec_Dpd_Api_Configs::INSURANCE_CONTENT => $description));
355
+ return $this;
356
+ }
357
+
358
+
359
+
360
+
361
+ }
lib/Zitec/Dpd/Api/Configs.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Configs
7
+ * contains various needed constants and configs
8
+ * it is used also in autoloading class
9
+ *
10
+ * @category Zitec
11
+ * www.zitec.com
12
+ * @package Zitec_Dpd
13
+ * @author george.babarus <george.babarus@gmail.com>
14
+ * @license http://opensource.org/licenses/osl-3.0.php
15
+ */
16
+ class Zitec_Dpd_Api_Configs
17
+ {
18
+
19
+ const URL = 'url';
20
+ const CONNECTION_TIMEOUT = 'connectionTimeout';
21
+
22
+ const WS_USER_NAME = "wsUserName";
23
+ const WS_PASSWORD = "wsPassword";
24
+ const WS_LANG = "wsLang";
25
+ const WS_LANG_EN = "EN";
26
+ const APPLICATION_TYPE = "applicationType";
27
+ const APPLICATION_TYPE_DEFAULT = 9;
28
+
29
+ const PAYER_ID = "payerId";
30
+ const SENDER_ADDRESS_ID = "senderAddressId";
31
+
32
+ const PRICE_OPTION = "priceOption";
33
+ const PRICE_OPTION_WITHOUT_PRICE = "WithoutPrice";
34
+
35
+ const SHIPMENT_LIST = "shipmentList";
36
+ const SHIPMENT_LIST_SHIPMENT_ID = "shipmentId";
37
+ const SHIPMENT_LIST_REFERENCE_NUMBER = "shipmentReferenceNumber";
38
+ const SHIPMENT_LIST_RECEIVER_NAME = "receiverName";
39
+ const SHIPMENT_LIST_RECEIVER_FIRM_NAME = "receiverFirmName";
40
+ const SHIPMENT_LIST_RECEIVER_COUNTRY_CODE = "receiverCountryCode";
41
+ const SHIPMENT_LIST_RECEIVER_ZIP_CODE = "receiverZipCode";
42
+ const SHIPMENT_LIST_RECEIVER_CITY = "receiverCity";
43
+ const SHIPMENT_LIST_RECEIVER_STREET = "receiverStreet";
44
+ const SHIPMENT_LIST_RECEIVER_STREET_MAX_LENGTH = 70;
45
+ const SHIPMENT_LIST_RECEIVER_HOUSE_NO = "receiverHouseNo";
46
+ const SHIPMENT_LIST_RECEIVER_PHONE_NO = "receiverPhoneNo";
47
+ const SHIPMENT_LIST_MAIN_SERVICE_CODE = "mainServiceCode";
48
+ const SHIPMENT_LIST_ADDITIONAL_SERVICES = "additionalServices";
49
+
50
+ const ADDITIONAL_SERVICES_COD = "cod";
51
+ const ADDITIONAL_INSURANCE = "highInsurance";
52
+ const COD_AMOUNT = "amount";
53
+ const COD_CURRENCY = "currency";
54
+ const COD_PAYMENT_TYPE = "paymentType";
55
+ CONST INSURANCE_GOODS_VALUE = 'goodsValue';
56
+ CONST INSURANCE_CURRENCY = 'currency';
57
+ CONST INSURANCE_CONTENT = 'content';
58
+
59
+
60
+ const PARCELS = "parcels";
61
+ const PARCELS_PARCEL_ID = "parcelId";
62
+ const PARCELS_PARCEL_NO = "parcelNo";
63
+ const PARCELS_PARCEL_REFERENCE_NUMBER = "parcelReferenceNumber";
64
+ const PARCELS_DIMENSION_HEIGHT = "dimensionsHeight";
65
+ const PARCELS_DIMENSION_WIDTH = "dimensionsWidth";
66
+ const PARCELS_DIMENSION_LENGTH = "dimensionsLength";
67
+ const PARCELS_WEIGHT = "weight";
68
+ const PARCELS_DESCRIPTION = "description";
69
+
70
+ const PRINT_OPTION = 'printOption';
71
+ const PRINT_OPTION_PDF = 'Pdf';
72
+
73
+ const PAYMENT_TYPE_CASH = 'Cash';
74
+ const PAYMENT_TYPE_CREDIT_CARD = "CreditCard";
75
+ const PAYMENT_TYPE_CROSSED_CHECK = "CrossedCheck";
76
+
77
+ const PAYMENT_AMOUNT_TYPE_FIXED = 1;
78
+ const PAYMENT_AMOUNT_TYPE_PERCENTAGE = 2;
79
+
80
+ const METHOD_CALCULATE_PRICE = "calculatePrice";
81
+ const METHOD_SHIPMENT_CALCULATE_PRICE = "calculatePrice";
82
+ const METHOD_SHIPMENT_GET_LABEL = "getShipmentLabel";
83
+ const METHOD_SHIPMENT_GET_SHIPMENT_STATUS = "getShipmentStatus";
84
+ const METHOD_SHIPMENT_SAVE = "createShipment";
85
+ const METHOD_SHIPMENT_DELETE = "deleteShipment";
86
+
87
+ const METHOD_CREATE_SHIPMENT = "createShipment";
88
+ const METHOD_UPDATE_SHIPMENT = "updateShipment";
89
+
90
+ const METHOD_PICKUP_CREATE = "createPickupOrder";
91
+
92
+ const METHOD_MANIFEST_CLOSE = "closeManifest";
93
+ const TRACKING_URL_TEMPLATE = "https://tracking.dpd.de/cgi-bin/delistrack?typ=1&lang=ro&pknr=%s&var=internalNewSearch&x=4&y=13";
94
+
95
+
96
+ protected static $_availableClassMethods = array(
97
+ self::METHOD_SHIPMENT_CALCULATE_PRICE => 'Zitec_Dpd_Api_Shipment_CalculatePrice',
98
+ self::METHOD_SHIPMENT_GET_LABEL => 'Zitec_Dpd_Api_Shipment_GetLabel',
99
+ self::METHOD_SHIPMENT_GET_SHIPMENT_STATUS => 'Zitec_Dpd_Api_Shipment_GetShipmentStatus',
100
+ self::METHOD_SHIPMENT_SAVE => 'Zitec_Dpd_Api_Shipment_Save',
101
+ self::METHOD_SHIPMENT_DELETE => 'Zitec_Dpd_Api_Shipment_Delete',
102
+
103
+
104
+ self::METHOD_PICKUP_CREATE => 'Zitec_Dpd_Api_Pickup_Create',
105
+
106
+ self::METHOD_MANIFEST_CLOSE => 'Zitec_Dpd_Api_Manifest_Close',
107
+ );
108
+
109
+
110
+ /**
111
+ * @param $method
112
+ */
113
+ public static function getClassNameForMethod($method)
114
+ {
115
+ if (!empty(self::$_availableClassMethods[$method])) {
116
+ return self::$_availableClassMethods[$method];
117
+ }
118
+
119
+ return false;
120
+ }
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+ }
129
+
130
+
lib/Zitec/Dpd/Api/Manifest.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Manifest
7
+ *
8
+ * customize api call for manifest entity processing
9
+ *
10
+ * @category Zitec
11
+ * www.zitec.com
12
+ * @package Zitec_Dpd
13
+ * @author george.babarus <george.babarus@gmail.com>
14
+ * @license http://opensource.org/licenses/osl-3.0.php
15
+ */
16
+ abstract class Zitec_Dpd_Api_Manifest extends Zitec_Dpd_Api_Abstract
17
+ {
18
+ //put your code here
19
+
20
+
21
+ }
22
+
23
+
lib/Zitec/Dpd/Api/Manifest/Close.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Manifest_Close
7
+ *
8
+ * Use this class to call close manifest api method
9
+ *
10
+ *
11
+ * @category Zitec
12
+ * www.zitec.com
13
+ * @package Zitec_Dpd
14
+ * @author george.babarus <george.babarus@gmail.com>
15
+ * @license http://opensource.org/licenses/osl-3.0.php
16
+ */
17
+ class Zitec_Dpd_Api_Manifest_Close extends Zitec_Dpd_Api_Manifest
18
+ {
19
+
20
+ const MANIFEST = 'manifest';
21
+ const SHIPMENT_REFERENCE_LIST = "shipmentReferenceList";
22
+ const SHIPMENT_REFERENCE_ID = "id";
23
+ const SHIPMENT_REFERENCE_NUMBER = "referenceNumber";
24
+ const MANIFEST_PRINT_OPTION = "manifestPrintOption";
25
+ const MANIFEST_PRINT_OPTION_MANIFEST_ONLY = "PrintOnlyManifest";
26
+ const MANIFEST_PRINT_OPTION_WITH_UNPRINTED = "PrintManifestWithUnprintedParcels";
27
+ const PRINT_OPTION = "printOption";
28
+ const PRINT_OPTION_PDF = "Pdf";
29
+
30
+
31
+
32
+ protected function _getMethod()
33
+ {
34
+ return Zitec_Dpd_Api_Configs::METHOD_MANIFEST_CLOSE ;
35
+ }
36
+
37
+
38
+ protected function _init()
39
+ {
40
+ parent::_init();
41
+ $this->_setData(Zitec_Dpd_Api_Configs::WS_LANG, Zitec_Dpd_Api_Configs::WS_LANG_EN);
42
+ $this->_setData(Zitec_Dpd_Api_Configs::APPLICATION_TYPE, Zitec_Dpd_Api_Configs::APPLICATION_TYPE_DEFAULT);
43
+
44
+ $this->_setData(self::MANIFEST_PRINT_OPTION, self::MANIFEST_PRINT_OPTION_WITH_UNPRINTED);
45
+ $this->_setData(self::PRINT_OPTION, self::PRINT_OPTION_PDF);
46
+ }
47
+
48
+
49
+ /**
50
+ *
51
+ * @param string $referenceNumber
52
+ *
53
+ * @return Zitec_Dpd_Api_Manifest_Close
54
+ */
55
+ public function setManifestReferenceNumber($referenceNumber)
56
+ {
57
+ return $this->setManifest("manifestReferenceNumber", $referenceNumber);
58
+ }
59
+
60
+
61
+ /**
62
+ *
63
+ * @return string
64
+ */
65
+ public function getManifestReferenceNumber()
66
+ {
67
+ return $this->_getData(array(self::MANIFEST, "manifestReferenceNumber"));
68
+ }
69
+
70
+
71
+ /**
72
+ *
73
+ * @param string $notes
74
+ *
75
+ * @return Zitec_Dpd_Api_Manifest_Close
76
+ */
77
+ public function setManifestNotes($notes)
78
+ {
79
+ return $this->setManifest("manifestNotes", $notes);
80
+ }
81
+
82
+
83
+ /**
84
+ *
85
+ * @param string $tag
86
+ * @param string $value
87
+ *
88
+ * @return Zitec_Dpd_Api_Manifest_Close
89
+ */
90
+ public function setManifest($tag, $value)
91
+ {
92
+ return $this->_setData(array(self::MANIFEST, $tag), $value);
93
+ }
94
+
95
+
96
+ /**
97
+ *
98
+ * @param int $dpdShipmentId
99
+ * @param string $dpdShipmentReferenceNumber
100
+ *
101
+ * @return Zitec_Dpd_Api_Manifest_Close
102
+ */
103
+ public function addShipment($dpdShipmentId, $dpdShipmentReferenceNumber)
104
+ {
105
+ return $this->_setData(
106
+ array(
107
+ self::MANIFEST,
108
+ self::SHIPMENT_REFERENCE_LIST),
109
+ array(
110
+ self::SHIPMENT_REFERENCE_ID => $dpdShipmentId,
111
+ self::SHIPMENT_REFERENCE_NUMBER => $dpdShipmentReferenceNumber
112
+ )
113
+ );
114
+ }
115
+
116
+ /**
117
+ *
118
+ * @param stdClass $response
119
+ *
120
+ * @return \Zitec_Dpd_Api_Manifest_Close_Response
121
+ */
122
+ protected function _createResponse(stdClass $response)
123
+ {
124
+ return new Zitec_Dpd_Api_Manifest_Close_Response($response);
125
+ }
126
+
127
+ /**
128
+ *
129
+ * @return Zitec_Dpd_Api_Manifest_Close_Response
130
+ */
131
+ public function getCloseManifestResponse()
132
+ {
133
+ return $this->getResponse();
134
+ }
135
+
136
+
137
+
138
+ }
139
+
140
+
lib/Zitec/Dpd/Api/Manifest/Close/Response.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Manifest_Close_Response
7
+ * Customize here manifest close response
8
+ *
9
+ * @category Zitec
10
+ * www.zitec.com
11
+ * @package Zitec_Dpd
12
+ * @author george.babarus <george.babarus@gmail.com>
13
+ * @license http://opensource.org/licenses/osl-3.0.php
14
+ */
15
+ class Zitec_Dpd_Api_Manifest_Close_Response extends Zitec_Dpd_Api_Manifest_Response
16
+ {
17
+
18
+ const RESULT = 'return';
19
+ const PDF_MANIFEST_FILE = 'pdfManifestFile';
20
+ const MANIFEST_ID = 'manifestId';
21
+ const MANIFEST_NAME = 'manifestName';
22
+ const MANIFEST_REFERENCE_NUMBER = 'manifestReferenceNumber';
23
+
24
+ /**
25
+ *
26
+ * @return string
27
+ */
28
+ public function getPdfFile()
29
+ {
30
+ return $this->_getResponseProperty(array(self::RESULT, self::PDF_MANIFEST_FILE));
31
+ }
32
+
33
+ /**
34
+ *
35
+ * @return string
36
+ */
37
+ public function getManifestId()
38
+ {
39
+ return $this->_getResponseProperty(array(self::RESULT, self::MANIFEST_ID));
40
+ }
41
+
42
+ /**
43
+ *
44
+ * @return string
45
+ */
46
+ public function getManifestName()
47
+ {
48
+ return $this->_getResponseProperty(array(self::RESULT, self::MANIFEST_NAME));
49
+ }
50
+
51
+ /**
52
+ *
53
+ * @return string
54
+ */
55
+ public function getManifestReferenceNumber()
56
+ {
57
+ return $this->_getResponseProperty(array(self::RESULT, self::MANIFEST_REFERENCE_NUMBER));
58
+ }
59
+
60
+ }
61
+
62
+
lib/Zitec/Dpd/Api/Manifest/Response.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Manifest_Response
7
+ * Customize here all manifest related response
8
+ *
9
+ * @category Zitec
10
+ * www.zitec.com
11
+ * @package Zitec_Dpd
12
+ * @author george.babarus <george.babarus@gmail.com>
13
+ * @license http://opensource.org/licenses/osl-3.0.php
14
+ */
15
+ class Zitec_Dpd_Api_Manifest_Response extends Zitec_Dpd_Api_Response
16
+ {
17
+
18
+
19
+ /**
20
+ *
21
+ * @return string
22
+ */
23
+ protected function _getErrorObjectPath()
24
+ {
25
+ return "return/error";
26
+ }
27
+ }
28
+
29
+
lib/Zitec/Dpd/Api/Pickup.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Pickup
7
+ *
8
+ * customize api call for pickup entity processing
9
+ *
10
+ * @category Zitec
11
+ * www.zitec.com
12
+ * @package Zitec_Dpd
13
+ * @author george.babarus <george.babarus@gmail.com>
14
+ * @license http://opensource.org/licenses/osl-3.0.php
15
+ */
16
+ abstract class Zitec_Dpd_Api_Pickup extends Zitec_Dpd_Api_Abstract
17
+ {
18
+ protected function _init()
19
+ {
20
+ parent::_init();
21
+ $this->_setData(Zitec_Dpd_Api_Configs::WS_LANG, Zitec_Dpd_Api_Configs::WS_LANG_EN);
22
+ $this->_setData(Zitec_Dpd_Api_Configs::APPLICATION_TYPE, Zitec_Dpd_Api_Configs::APPLICATION_TYPE_DEFAULT);
23
+ }
24
+
25
+ }
26
+
27
+
lib/Zitec/Dpd/Api/Pickup/Create.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Pickup_Create
7
+ * Customize here pickup create request
8
+ *
9
+ * @category Zitec
10
+ * www.zitec.com
11
+ * @package Zitec_Dpd
12
+ * @author george.babarus <george.babarus@gmail.com>
13
+ * @license http://opensource.org/licenses/osl-3.0.php
14
+ */
15
+ class Zitec_Dpd_Api_Pickup_Create extends Zitec_Dpd_Api_Pickup
16
+ {
17
+
18
+ const PICKUP_ORDER_LIST = "pickupOrderList";
19
+ const REFERENCE_NUMBER = "referenceNumber";
20
+
21
+ const NAME = "contactName";
22
+ const ADDITIONAL_NAME = "senderAddress/additionalName";
23
+ const COUNTRY_CODE = "senderAddress/countryCode";
24
+ const CITY = "senderAddress/city";
25
+ const STREET = "senderAddress/street";
26
+ const POSTCODE = "senderAddress/zipCode";
27
+ const PHONE = "contactPhone";
28
+ const EMAIL = "contactEmail";
29
+
30
+ const PIECES = "pieces";
31
+ const PIECES_SERVICE_CODE = "serviceCode";
32
+ const PIECES_QUANTITY = "quantity";
33
+ const PIECES_WEIGHT = "weight";
34
+ const PIECES_DESTINATION_COUNTRY_CODE = "destinationCountryCode";
35
+
36
+
37
+ /**
38
+ *
39
+ * @return string
40
+ */
41
+ protected function _getMethod()
42
+ {
43
+ return Zitec_Dpd_Api_Configs::METHOD_PICKUP_CREATE;
44
+ }
45
+
46
+
47
+
48
+ protected function _init()
49
+ {
50
+ parent::_init();
51
+
52
+ $this->setPickupOrderList(Zitec_Dpd_Api_Configs::PAYER_ID, $this->_payerId);
53
+ $this->setPickupOrderList(Zitec_Dpd_Api_Configs::SENDER_ADDRESS_ID, $this->_senderAddressId);
54
+
55
+
56
+ }
57
+
58
+ /**
59
+ *
60
+ * @param string $tag
61
+ * @param mixed $value
62
+ *
63
+ * @return Zitec_Dpd_Api_Pickup_Create
64
+ */
65
+ public function setPickupOrderList($tag, $value)
66
+ {
67
+
68
+ return $this->_setData(self::PICKUP_ORDER_LIST . "/" . $tag, $value);
69
+ }
70
+
71
+ /**
72
+ *
73
+ * @param string $date (format YYYYMMDD)
74
+ * @param type $from (format HHMMSS)
75
+ * @param type $to (format HHMMSS)
76
+ *
77
+ * @return \Zitec_Dpd_Api_Pickup_Create
78
+ */
79
+ public function setPickupTime($date, $from, $to)
80
+ {
81
+ $this->setPickupOrderList("date", $date);
82
+ $this->setPickupOrderList("fromTime", $from);
83
+ $this->setPickupOrderList("toTime", $to);
84
+ $referenceNumber = "$date/$from/" . strtoupper(substr(sha1(uniqid(rand(), true)), 0, 5));
85
+ $this->setPickupOrderList(self::REFERENCE_NUMBER, $referenceNumber);
86
+
87
+ return $this;
88
+ }
89
+
90
+ /**
91
+ *
92
+ * @param string $instruction
93
+ *
94
+ * @return Zitec_Dpd_Api_Pickup_Create
95
+ */
96
+ public function setSpecialInstruction($instruction)
97
+ {
98
+ return $this->setPickupOrderList("specialInstruction", $instruction);
99
+ }
100
+
101
+ /**
102
+ *
103
+ * @param array $pickupAddress
104
+ *
105
+ * @return \Zitec_Dpd_Api_Pickup_Create
106
+ */
107
+ public function setPickupAddress(array $pickupAddress)
108
+ {
109
+ foreach ($pickupAddress as $tag => $value) {
110
+ $this->setPickupOrderList($tag, $value);
111
+ }
112
+
113
+ return $this;
114
+ }
115
+
116
+ /**
117
+ *
118
+ * @param string $serviceCode
119
+ * @param int $quantity
120
+ * @param float $weight
121
+ * @param string $destinationCountryCode
122
+ *
123
+ * @return \Zitec_Dpd_Api_Pickup_Create
124
+ */
125
+ public function addPieces($serviceCode, $quantity, $weight, $destinationCountryCode)
126
+ {
127
+ $pieces = array(
128
+ self::PIECES_SERVICE_CODE => $serviceCode,
129
+ self::PIECES_QUANTITY => $quantity,
130
+ self::PIECES_WEIGHT => $weight,
131
+ self::PIECES_DESTINATION_COUNTRY_CODE => $destinationCountryCode
132
+ );
133
+ $this->setPickupOrderList(self::PIECES, $pieces);
134
+
135
+ return $this;
136
+ }
137
+
138
+ /**
139
+ *
140
+ * @return Zitec_Dpd_Api_Pickup_Create_Response
141
+ */
142
+ public function getCreatePickupResponse()
143
+ {
144
+ return $this->getResponse();
145
+ }
146
+
147
+ /**
148
+ *
149
+ * @param stdClass $response
150
+ *
151
+ * @return \Zitec_Dpd_Api_Pickup_Response
152
+ */
153
+ protected function _createResponse(stdClass $response)
154
+ {
155
+ return new Zitec_Dpd_Api_Pickup_Create_Response($response);
156
+ }
157
+
158
+
159
+ }
160
+
161
+
lib/Zitec/Dpd/Api/Pickup/Create/Response.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Pickup_Create_Response
7
+ * Customize here all pickup related response
8
+ *
9
+ * @category Zitec
10
+ * www.zitec.com
11
+ * @package Zitec_Dpd
12
+ * @author george.babarus <george.babarus@gmail.com>
13
+ * @license http://opensource.org/licenses/osl-3.0.php
14
+ */
15
+ class Zitec_Dpd_Api_Pickup_Create_Response extends Zitec_Dpd_Api_Pickup_Response
16
+ {
17
+
18
+ /**
19
+ *
20
+ * @return string
21
+ */
22
+ protected function _getErrorObjectPath()
23
+ {
24
+ return "result/resultList/error";
25
+ }
26
+
27
+ /**
28
+ *
29
+ * @return string
30
+ */
31
+ public function getReferenceNumber()
32
+ {
33
+ return $this->_getResponseProperty("result/resultList/pickupOrderReference/referenceNumber");
34
+ }
35
+
36
+ /**
37
+ *
38
+ * @return string
39
+ */
40
+ public function getDpdId()
41
+ {
42
+ return $this->_getResponseProperty("result/resultList/pickupOrderReference/id");
43
+ }
44
+ }
45
+
46
+
lib/Zitec/Dpd/Api/Pickup/Response.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Pickup_Response
7
+ * Customize here all pickup related response
8
+ *
9
+ * @category Zitec
10
+ * www.zitec.com
11
+ * @package Zitec_Dpd
12
+ * @author george.babarus <george.babarus@gmail.com>
13
+ * @license http://opensource.org/licenses/osl-3.0.php
14
+ */
15
+ class Zitec_Dpd_Api_Pickup_Response extends Zitec_Dpd_Api_Response
16
+ {
17
+
18
+
19
+ }
20
+
21
+
lib/Zitec/Dpd/Api/Response.php ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Response
7
+ * All api response will extend this class
8
+ *
9
+ * @category Zitec
10
+ * www.zitec.com
11
+ * @package Zitec_Dpd
12
+ * @author george.babarus <george.babarus@gmail.com>
13
+ * @license http://opensource.org/licenses/osl-3.0.php
14
+ */
15
+ class Zitec_Dpd_Api_Response
16
+ {
17
+
18
+ /**
19
+ *
20
+ * @var stdClass
21
+ */
22
+ protected $_response;
23
+
24
+ /**
25
+ *
26
+ * @param stdClass $response
27
+ */
28
+ public function __construct(stdClass $response)
29
+ {
30
+ $this->_response = $response;
31
+ }
32
+
33
+ /**
34
+ *
35
+ * @return stdClass
36
+ */
37
+ protected function _getResponse()
38
+ {
39
+ return $this->_response;
40
+ }
41
+
42
+ /**
43
+ *
44
+ * @param string $path
45
+ * @param stdClass $responseObject
46
+ *
47
+ * @return mixed
48
+ * @throws Exception
49
+ */
50
+ protected function _getResponseProperty($path, $responseObject = null)
51
+ {
52
+ if (!$path) {
53
+ return NULL;
54
+ }
55
+
56
+ if (!is_array($path)) {
57
+ $path = explode("/", $path);
58
+ }
59
+
60
+ if (!$responseObject) {
61
+ $responseObject = $this->_response;
62
+ }
63
+
64
+ if (!$responseObject) {
65
+ return NULL;
66
+ }
67
+
68
+ if (!($responseObject instanceof stdClass)) {
69
+ return NULL;
70
+ }
71
+
72
+ $property = $path[0];
73
+ if (property_exists($responseObject, $path[0])) {
74
+ $responseObject = $responseObject->$property;
75
+ } else {
76
+ return false;
77
+ }
78
+
79
+ if (count($path) == 1) {
80
+ return $responseObject;
81
+ } else {
82
+ array_shift($path);
83
+
84
+ return $this->_getResponseProperty($path, $responseObject);
85
+ }
86
+
87
+
88
+ }
89
+
90
+ /**
91
+ *
92
+ * @return stdClass|false
93
+ */
94
+ protected function _getErrorObject()
95
+ {
96
+ return $this->_getResponseProperty($this->_getErrorObjectPath());
97
+ }
98
+
99
+ /**
100
+ *
101
+ * @return string
102
+ */
103
+ protected function _getErrorObjectPath()
104
+ {
105
+ return "result/resultList/error";
106
+ }
107
+
108
+ /**
109
+ *
110
+ * @return boolean
111
+ */
112
+ public function hasError()
113
+ {
114
+ return $this->_getErrorObject() instanceof stdClass;
115
+ }
116
+
117
+ /**
118
+ *
119
+ * @return string
120
+ */
121
+ public function getErrorCode()
122
+ {
123
+ return $this->_getResponseProperty($this->_getErrorObjectPath() . '/code');
124
+ }
125
+
126
+ /**
127
+ *
128
+ * @return string
129
+ */
130
+ public function getErrorText()
131
+ {
132
+ return $this->_getResponseProperty($this->_getErrorObjectPath() . '/text');
133
+ }
134
+
135
+
136
+ }
137
+
138
+
lib/Zitec/Dpd/Api/Shipment.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Shipment
7
+ *
8
+ * customize api call for shipment entity processing
9
+ *
10
+ * @category Zitec
11
+ * www.zitec.com
12
+ * @package Zitec_Dpd
13
+ * @author george.babarus <george.babarus@gmail.com>
14
+ * @license http://opensource.org/licenses/osl-3.0.php
15
+ */
16
+ abstract class Zitec_Dpd_Api_Shipment extends Zitec_Dpd_Api_Abstract
17
+ {
18
+
19
+
20
+ protected function _init()
21
+ {
22
+ parent::_init();
23
+ $this->_setData(Zitec_Dpd_Api_Configs::WS_LANG, Zitec_Dpd_Api_Configs::WS_LANG_EN);
24
+ $this->_setData(Zitec_Dpd_Api_Configs::APPLICATION_TYPE, Zitec_Dpd_Api_Configs::APPLICATION_TYPE_DEFAULT);
25
+ }
26
+
27
+
28
+
29
+
30
+ }
31
+
32
+
lib/Zitec/Dpd/Api/Shipment/CalculatePrice.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Shipment_CalculatePrice
7
+ * Calculate price method is called using this class
8
+ *
9
+ * @category Zitec
10
+ * www.zitec.com
11
+ * @package Zitec_Dpd
12
+ * @author george.babarus <george.babarus@gmail.com>
13
+ * @license http://opensource.org/licenses/osl-3.0.php
14
+ */
15
+ class Zitec_Dpd_Api_Shipment_CalculatePrice extends Zitec_Dpd_Api_Shipment
16
+ {
17
+
18
+ protected function _getMethod()
19
+ {
20
+ return Zitec_Dpd_Api_Configs::METHOD_CALCULATE_PRICE;
21
+ }
22
+
23
+ protected function _init()
24
+ {
25
+ parent::_init();
26
+
27
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::PAYER_ID, $this->_payerId);
28
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SENDER_ADDRESS_ID, $this->_senderAddressId);
29
+
30
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_REFERENCE_NUMBER, null);
31
+
32
+ }
33
+
34
+
35
+ /**
36
+ *
37
+ * @param stdClass $response
38
+ *
39
+ * @return \Zitec_Dpd_Api_Shipment_CalculatePrice_Response
40
+ */
41
+ protected function _createResponse(stdClass $response)
42
+ {
43
+ return new Zitec_Dpd_Api_Shipment_CalculatePrice_Response($response);
44
+ }
45
+
46
+
47
+ /**
48
+ *
49
+ * @return Zitec_Dpd_Api_Shipment_CalculatePrice_Response
50
+ */
51
+ public function getCalculatePriceResponse()
52
+ {
53
+ return $this->_response;
54
+ }
55
+
56
+ /**
57
+ *
58
+ * @param string $tag
59
+ * @param mixed $value
60
+ *
61
+ * @return Zitec_Dpd_Api_Shipment_Calculateprice
62
+ */
63
+ public function setShipmentList($tag, $value)
64
+ {
65
+ return $this->_setData(array(Zitec_Dpd_Api_Configs::SHIPMENT_LIST, $tag), $value);
66
+ }
67
+
68
+
69
+ /**
70
+ *
71
+ * @param Mage_Sales_Model_Order_Address $shippingAddress
72
+ *
73
+ * @return \Zitec_Dpd_Api_Shipment_Save
74
+ */
75
+ public function setReceiverAddress($street, $city, $postcode, $countryId)
76
+ {
77
+ $processedStreet = substr(implode(explode("\n", $street)), 0, Zitec_Dpd_Api_Configs::SHIPMENT_LIST_RECEIVER_STREET_MAX_LENGTH - 1);
78
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_RECEIVER_NAME, "DPD Price Calculation");
79
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_RECEIVER_FIRM_NAME, null);
80
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_RECEIVER_COUNTRY_CODE, $countryId);
81
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_RECEIVER_ZIP_CODE, $postcode);
82
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_RECEIVER_CITY, $city);
83
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_RECEIVER_STREET, $processedStreet);
84
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_RECEIVER_HOUSE_NO, null);
85
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_RECEIVER_PHONE_NO, null);
86
+
87
+ return $this;
88
+ }
89
+
90
+ /**
91
+ *
92
+ * @param string $serviceCode
93
+ *
94
+ * @return \Zitec_Dpd_Api_Shipment_Save
95
+ */
96
+ public function setShipmentServiceCode($serviceCode)
97
+ {
98
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_MAIN_SERVICE_CODE, $serviceCode);
99
+
100
+ return $this;
101
+ }
102
+
103
+
104
+ /**
105
+ *
106
+ * @param float $weight
107
+ *
108
+ * @return \Zitec_Dpd_Api_Shipment_Calculateprice
109
+ */
110
+ public function addParcel($weight)
111
+ {
112
+ $parcel = array(
113
+ Zitec_Dpd_Api_Configs::PARCELS_WEIGHT => $weight,
114
+ Zitec_Dpd_Api_Configs::PARCELS_PARCEL_REFERENCE_NUMBER => null
115
+ );
116
+ $this->_setData(array(Zitec_Dpd_Api_Configs::SHIPMENT_LIST, Zitec_Dpd_Api_Configs::PARCELS), $parcel);
117
+
118
+ return $this;
119
+ }
120
+
121
+ }
122
+
123
+
lib/Zitec/Dpd/Api/Shipment/CalculatePrice/Response.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Shipment_Calculateprice_Response
7
+ * calculate price method will have this response - contain all customization fot needed to this method
8
+ *
9
+ * @category Zitec
10
+ * www.zitec.com
11
+ * @package Zitec_Dpd
12
+ * @author george.babarus <george.babarus@gmail.com>
13
+ * @license http://opensource.org/licenses/osl-3.0.php
14
+ */
15
+ class Zitec_Dpd_Api_Shipment_Calculateprice_Response extends Zitec_Dpd_Api_Shipment_Response
16
+ {
17
+
18
+ /**
19
+ *
20
+ * @param string $name
21
+ *
22
+ * @return stdClass
23
+ */
24
+ protected function _getPriceAttribute($name)
25
+ {
26
+ $price = $this->_getResponseProperty('result/priceList/price');
27
+
28
+ return $price !== false ? $this->_getResponseProperty($name, $price) : false;
29
+ }
30
+
31
+ /**
32
+ *
33
+ * @return float
34
+ */
35
+ public function getAmount()
36
+ {
37
+ return $this->_getPriceAttribute("amount");
38
+ }
39
+
40
+ public function getVatAmount()
41
+ {
42
+ return $this->_getPriceAttribute("vatAmount");
43
+ }
44
+
45
+ /**
46
+ *
47
+ * @return float
48
+ */
49
+ public function getTotalAmount()
50
+ {
51
+ return $this->_getPriceAttribute("totalAmount");
52
+ }
53
+
54
+ /**
55
+ *
56
+ * @return string
57
+ */
58
+ public function getCurrency()
59
+ {
60
+ return $this->_getPriceAttribute("currency");
61
+ }
62
+
63
+ /**
64
+ *
65
+ * @return float
66
+ */
67
+ public function getAmountLocal()
68
+ {
69
+ return $this->_getPriceAttribute("amountLocal");
70
+ }
71
+
72
+ /**
73
+ *
74
+ * @return float
75
+ */
76
+ public function getVatAmountLocal()
77
+ {
78
+ return $this->_getPriceAttribute("vatAmountLocal");
79
+ }
80
+
81
+ /**
82
+ *
83
+ * @return float
84
+ */
85
+ public function getTotalAmountLocal()
86
+ {
87
+ return $this->_getPriceAttribute("totalAmountLocal");
88
+ }
89
+
90
+ /**
91
+ *
92
+ * @return string
93
+ */
94
+ public function getCurrencyLocal()
95
+ {
96
+ return $this->_getPriceAttribute("currencyLocal");
97
+ }
98
+
99
+ /**
100
+ *
101
+ * @return string
102
+ */
103
+ protected function _getErrorObjectPath()
104
+ {
105
+ return "result/priceList/error";
106
+ }
107
+
108
+ }
109
+
110
+
lib/Zitec/Dpd/Api/Shipment/Delete.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Shipment_Delete
7
+ * Delete shipment api method will be available using this class
8
+ *
9
+ * @category Zitec
10
+ * www.zitec.com
11
+ * @package Zitec_Dpd
12
+ * @author george.babarus <george.babarus@gmail.com>
13
+ * @license http://opensource.org/licenses/osl-3.0.php
14
+ */
15
+ class Zitec_Dpd_Api_Shipment_Delete extends Zitec_Dpd_Api_Shipment
16
+ {
17
+
18
+
19
+ /**
20
+ *
21
+ * @return string
22
+ */
23
+ protected function _getMethod()
24
+ {
25
+ return Zitec_Dpd_Api_Configs::METHOD_SHIPMENT_DELETE;
26
+ }
27
+
28
+
29
+ /**
30
+ *
31
+ * @param stdClass $response
32
+ *
33
+ * @return \Zitec_Dpd_Api_Shipment_Delete_Response
34
+ */
35
+ protected function _createResponse(stdClass $response)
36
+ {
37
+ return new Zitec_Dpd_Api_Shipment_Delete_Response($response);
38
+ }
39
+
40
+ /**
41
+ *
42
+ * @param type $dpdShipmentId
43
+ * @param type $dpdShipmentReferenceNumber
44
+ *
45
+ * @return \Zitec_Dpd_Api_Shipment_Getlabel
46
+ */
47
+ public function addShipmentReference($dpdShipmentId, $dpdShipmentReferenceNumber)
48
+ {
49
+ $this->_setData('shipmentReferenceList/id', $dpdShipmentId);
50
+ $this->_setData('shipmentReferenceList/referenceNumber', $dpdShipmentReferenceNumber);
51
+
52
+ return $this;
53
+ }
54
+
55
+ /**
56
+ *
57
+ * @return Zitec_Dpd_Api_Shipment_Delete_Response
58
+ */
59
+ public function getDeleteShipmentResponse()
60
+ {
61
+ return $this->_response;
62
+ }
63
+ }
64
+
65
+
lib/Zitec/Dpd/Api/Shipment/Delete/Response.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Shipment_Delete_Response
7
+ * delete shipment method have a custom response here
8
+ *
9
+ * @category Zitec
10
+ * www.zitec.com
11
+ * @package Zitec_Dpd
12
+ * @author george.babarus <george.babarus@gmail.com>
13
+ * @license http://opensource.org/licenses/osl-3.0.php
14
+ */
15
+ class Zitec_Dpd_Api_Shipment_Delete_Response extends Zitec_Dpd_Api_Shipment_Response
16
+ {
17
+ //put your code here
18
+ }
19
+
20
+
lib/Zitec/Dpd/Api/Shipment/GetLabel.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Shipment_GetLabel
7
+ * call getLabel method on api using this class
8
+ *
9
+ * @category Zitec
10
+ * www.zitec.com
11
+ * @package Zitec_Dpd
12
+ * @author george.babarus <george.babarus@gmail.com>
13
+ * @license http://opensource.org/licenses/osl-3.0.php
14
+ */
15
+ class Zitec_Dpd_Api_Shipment_GetLabel extends Zitec_Dpd_Api_Shipment
16
+ {
17
+
18
+ protected function _getMethod()
19
+ {
20
+ return Zitec_Dpd_Api_Configs::METHOD_SHIPMENT_GET_LABEL;
21
+ }
22
+
23
+ protected function _init()
24
+ {
25
+ parent::_init();
26
+ $this->_setData(Zitec_Dpd_Api_Configs::PRINT_OPTION, Zitec_Dpd_Api_Configs::PRINT_OPTION_PDF);
27
+ }
28
+
29
+
30
+ /**
31
+ *
32
+ * @param stdClass $response
33
+ *
34
+ * @return \Zitec_Dpd_Api_Shipment_GetLabel_Response
35
+ */
36
+ protected function _createResponse(stdClass $response)
37
+ {
38
+ return new Zitec_Dpd_Api_Shipment_GetLabel_Response($response);
39
+ }
40
+
41
+ /**
42
+ *
43
+ * @param type $dpdShipmentId
44
+ * @param type $dpdShipmentReferenceNumber
45
+ *
46
+ * @return \Zitec_Dpd_Api_Shipment_Getlabel
47
+ */
48
+ public function setShipment($dpdShipmentId, $dpdShipmentReferenceNumber)
49
+ {
50
+ $this->_setData('shipmentReferenceList/id', $dpdShipmentId);
51
+ $this->_setData('shipmentReferenceList/referenceNumber', $dpdShipmentReferenceNumber);
52
+
53
+ return $this;
54
+ }
55
+
56
+ /**
57
+ * @param array $data
58
+ *
59
+ * @throws Exception
60
+ * @return \Zitec_Dpd_Api_Shipment_Getlabel
61
+ */
62
+ public function getShipmentLabels()
63
+ {
64
+
65
+ try {
66
+ $response = $this->_soapCall();
67
+
68
+ } catch (Exception $e) {
69
+ throw $e;
70
+ }
71
+
72
+ return $response;
73
+ }
74
+
75
+
76
+ }
77
+
78
+
lib/Zitec/Dpd/Api/Shipment/GetLabel/Response.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Shipment_GetLabel_Response
7
+ * getLabel method will respond with this object
8
+ *
9
+ * @category Zitec
10
+ * www.zitec.com
11
+ * @package Zitec_Dpd
12
+ * @author george.babarus <george.babarus@gmail.com>
13
+ * @license http://opensource.org/licenses/osl-3.0.php
14
+ */
15
+ class Zitec_Dpd_Api_Shipment_GetLabel_Response extends Zitec_Dpd_Api_Shipment_Response
16
+ {
17
+
18
+ /**
19
+ *
20
+ * @return string
21
+ */
22
+ public function getPdfFile()
23
+ {
24
+ return $this->_getResponseProperty('result/pdfFile');
25
+ }
26
+ }
27
+
28
+
lib/Zitec/Dpd/Api/Shipment/GetShipmentStatus.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Shipment_GetShipmentStatus
7
+ * getShipmentStatus api method is called using this class
8
+ *
9
+ * @category Zitec
10
+ * www.zitec.com
11
+ * @package Zitec_Dpd
12
+ * @author george.babarus <george.babarus@gmail.com>
13
+ * @license http://opensource.org/licenses/osl-3.0.php
14
+ */
15
+ class Zitec_Dpd_Api_Shipment_GetShipmentStatus extends Zitec_Dpd_Api_Shipment
16
+ {
17
+
18
+ /**
19
+ *
20
+ * @return string
21
+ */
22
+ protected function _getMethod()
23
+ {
24
+ return Zitec_Dpd_Api_Configs::METHOD_SHIPMENT_GET_SHIPMENT_STATUS ;
25
+ }
26
+
27
+ /**
28
+ *
29
+ * @param stdClass $response
30
+ *
31
+ * @return \Zitec_Dpd_Api_Shipment_GetShipmentStatus_Response
32
+ */
33
+ protected function _createResponse(stdClass $response)
34
+ {
35
+ return new Zitec_Dpd_Api_Shipment_GetShipmentStatus_Response($response);
36
+ }
37
+
38
+ /**
39
+ *
40
+ * @param string $dpdShipmentId
41
+ * @param string $dpdShipmentReferenceNumber
42
+ *
43
+ * @return \Zitec_Dpd_Api_Shipment_Getshipmentstatus
44
+ */
45
+ public function setShipment($dpdShipmentId, $dpdShipmentReferenceNumber)
46
+ {
47
+ $this->_setData('shipmentReferenceList/id', $dpdShipmentId);
48
+ $this->_setData('shipmentReferenceList/referenceNumber', $dpdShipmentReferenceNumber);
49
+
50
+ return $this;
51
+ }
52
+
53
+ /**
54
+ *
55
+ * @return Zitec_Dpd_Api_Shipment_GetShipmentStatus_Response
56
+ */
57
+ public function getShipmentStatusResponse()
58
+ {
59
+ return $this->_response;
60
+ }
61
+
62
+
63
+ }
64
+
65
+
lib/Zitec/Dpd/Api/Shipment/GetShipmentStatus/Response.php ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Shipment_GetShipmentStatus_Response
7
+ * getShipmentsStatus will return with this object
8
+ *
9
+ * @category Zitec
10
+ * www.zitec.com
11
+ * @package Zitec_Dpd
12
+ * @author george.babarus <george.babarus@gmail.com>
13
+ * @license http://opensource.org/licenses/osl-3.0.php
14
+ */
15
+ class Zitec_Dpd_Api_Shipment_GetShipmentStatus_Response extends Zitec_Dpd_Api_Shipment_Response
16
+ {
17
+
18
+ /**
19
+ *
20
+ * @param string $name
21
+ *
22
+ * @return mixed
23
+ */
24
+ protected function _getStatusInfoAttribute($name)
25
+ {
26
+ $statusInfo = $this->_getResponseProperty('result/statusInfoList/statusInfo');
27
+
28
+ return $statusInfo !== false ? $this->_getResponseProperty($name, $statusInfo) : false;
29
+ }
30
+
31
+
32
+ /**
33
+ *
34
+ * @return string
35
+ */
36
+ protected function _getErrorObjectPath()
37
+ {
38
+ return "result/statusInfoList/error";
39
+ }
40
+
41
+ /**
42
+ *
43
+ * @return string
44
+ */
45
+ public function getShipDate()
46
+ {
47
+ $shipDate = $this->_getStatusInfoAttribute("shipDate");
48
+ $shipDate = $this->convertDPDDate($shipDate);
49
+
50
+ return $shipDate ? $shipDate : '';
51
+ }
52
+
53
+ /**
54
+ *
55
+ * @return string
56
+ */
57
+ public function getShipTime()
58
+ {
59
+ $shipTime = $this->_getStatusInfoAttribute("shipTime");
60
+ $shipTime = $this->convertDPDTime($shipTime);
61
+
62
+ return $shipTime ? $shipTime : '';
63
+ }
64
+
65
+ /**
66
+ *
67
+ * @return string
68
+ */
69
+ public function getDeliveryDate()
70
+ {
71
+ $deliveryDate = $this->_getStatusInfoAttribute("deliveryDate");
72
+ $deliveryDate = $this->convertDPDDate($deliveryDate);
73
+
74
+ return $deliveryDate ? $deliveryDate : '';
75
+ }
76
+
77
+ /**
78
+ *
79
+ * @return string
80
+ */
81
+ public function getDeliveryTime()
82
+ {
83
+ $deliveryTime = $this->_getStatusInfoAttribute("deliveryTime");
84
+ $deliveryTime = $this->convertDPDTime($deliveryTime);
85
+
86
+ return $deliveryTime ? $deliveryTime : '';
87
+ }
88
+
89
+ /**
90
+ *
91
+ * @return string
92
+ */
93
+ public function getServiceCode()
94
+ {
95
+ $serviceCode = $this->_getStatusInfoAttribute("serviceCode");
96
+
97
+ return $serviceCode;
98
+ }
99
+
100
+ /**
101
+ *
102
+ * @return string
103
+ */
104
+ public function getServiceDescription()
105
+ {
106
+ return $this->_getStatusInfoAttribute("serviceDescription");
107
+ }
108
+
109
+ /**
110
+ *
111
+ * @return float
112
+ */
113
+ public function getWeight()
114
+ {
115
+ return $this->_getStatusInfoAttribute("weight");
116
+ }
117
+
118
+ /**
119
+ *
120
+ * @return string
121
+ */
122
+ public function getDpdUrl()
123
+ {
124
+ return $this->_getStatusInfoAttribute("dpdUrl");
125
+ }
126
+
127
+
128
+ public function getTrackingUrl(){
129
+ $parcelNo = $this->getParcelNumber();
130
+ return sprintf(Zitec_Dpd_Api_Configs::TRACKING_URL_TEMPLATE ,$parcelNo);
131
+ }
132
+
133
+ /**
134
+ *
135
+ * @return string
136
+ */
137
+ public function getParcelNumber()
138
+ {
139
+ return $this->_getStatusInfoAttribute("parcelNo");
140
+ }
141
+
142
+
143
+
144
+ /**
145
+ *
146
+ * @param string $dateStr
147
+ *
148
+ * @return string|boolean
149
+ */
150
+ public function convertDPDDate($dateStr)
151
+ {
152
+ if (!is_string($dateStr) || strlen($dateStr) != 8) {
153
+ return false;
154
+ }
155
+
156
+ return substr($dateStr, 0, 4) . '-' . substr($dateStr, 4, 2) . '-' . substr($dateStr, -2);
157
+ }
158
+
159
+ /**
160
+ *
161
+ * @param string $timeStr
162
+ *
163
+ * @return string|boolean
164
+ */
165
+ public function convertDPDTime($timeStr)
166
+ {
167
+ if (!is_string($timeStr) || strlen($timeStr) != 6) {
168
+ return false;
169
+ }
170
+
171
+ return substr($timeStr, 0, 2) . ':' . substr($timeStr, 2, 2) . ':' . substr($timeStr, -2);
172
+ }
173
+
174
+
175
+
176
+ }
177
+
178
+
lib/Zitec/Dpd/Api/Shipment/Response.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Pickup_Response
7
+ * Customize here all pickup related response
8
+ *
9
+ * @category Zitec
10
+ * www.zitec.com
11
+ * @package Zitec_Dpd
12
+ * @author george.babarus <george.babarus@gmail.com>
13
+ * @license http://opensource.org/licenses/osl-3.0.php
14
+ */
15
+ class Zitec_Dpd_Api_Shipment_Response extends Zitec_Dpd_Api_Response
16
+ {
17
+
18
+
19
+ }
20
+
21
+
lib/Zitec/Dpd/Api/Shipment/Save.php ADDED
@@ -0,0 +1,316 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Pickup_Response
7
+ * Customize here all pickup related response
8
+ *
9
+ * @category Zitec
10
+ * www.zitec.com
11
+ * @package Zitec_Dpd
12
+ * @author george.babarus <george.babarus@gmail.com>
13
+ * @license http://opensource.org/licenses/osl-3.0.php
14
+ */
15
+ class Zitec_Dpd_Api_Shipment_Save extends Zitec_Dpd_Api_Shipment
16
+ {
17
+
18
+
19
+
20
+ /**
21
+ *
22
+ * @return string
23
+ */
24
+ protected function _getMethod()
25
+ {
26
+ return Zitec_Dpd_Api_Configs::METHOD_CREATE_SHIPMENT;
27
+ }
28
+
29
+
30
+
31
+ protected function _init()
32
+ {
33
+ parent::_init();
34
+ $this->_setData(Zitec_Dpd_Api_Configs::PRICE_OPTION, Zitec_Dpd_Api_Configs::PRICE_OPTION_WITHOUT_PRICE);
35
+
36
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_SHIPMENT_ID, null);
37
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::PAYER_ID, $this->_payerId);
38
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SENDER_ADDRESS_ID, $this->_senderAddressId);
39
+
40
+ }
41
+
42
+
43
+ /**
44
+ *
45
+ * @param string $tag
46
+ * @param string mixed
47
+ *
48
+ * @return Zitec_Dpd_Api_Shipment_Save
49
+ */
50
+ public function setShipmentList($tag, $value)
51
+ {
52
+ return $this->_setData(array(Zitec_Dpd_Api_Configs::SHIPMENT_LIST, $tag), $value);
53
+ }
54
+
55
+ /**
56
+ *
57
+ * @param string $tag
58
+ *
59
+ * @return string
60
+ */
61
+ public function getShipmentList($tag)
62
+ {
63
+ return $this->_getData(array(Zitec_Dpd_Api_Configs::SHIPMENT_LIST, $tag));
64
+ }
65
+
66
+ /**
67
+ *
68
+ * @param Mage_Sales_Model_Order_Address $shippingAddress
69
+ *
70
+ * @return \Zitec_Dpd_Api_Shipment_Save
71
+ */
72
+ public function setReceiverAddress(Mage_Sales_Model_Order_Address $shippingAddress)
73
+ {
74
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_RECEIVER_NAME, $shippingAddress->getFirstname() . ' ' . $shippingAddress->getLastname());
75
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_RECEIVER_FIRM_NAME, $shippingAddress->getCompany());
76
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_RECEIVER_COUNTRY_CODE, $shippingAddress->getCountryId());
77
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_RECEIVER_ZIP_CODE, $shippingAddress->getPostcode());
78
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_RECEIVER_CITY, $shippingAddress->getCity());
79
+ $street = is_array($shippingAddress->getStreetFull()) ? $shippingAddress->getStreetFull() : explode("\n", $shippingAddress->getStreetFull());
80
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_RECEIVER_STREET, implode(" ", $street));
81
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_RECEIVER_HOUSE_NO, null);
82
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_RECEIVER_PHONE_NO, $shippingAddress->getTelephone());
83
+
84
+ return $this;
85
+ }
86
+
87
+ /**
88
+ *
89
+ * @return string
90
+ */
91
+ public function getReceiverCountryCode()
92
+ {
93
+ return $this->getShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_RECEIVER_COUNTRY_CODE);
94
+ }
95
+
96
+ /**
97
+ *
98
+ * @param string $serviceCode
99
+ *
100
+ * @return \Zitec_Dpd_Api_Shipment_Save
101
+ */
102
+ public function setShipmentServiceCode($serviceCode)
103
+ {
104
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_MAIN_SERVICE_CODE, $serviceCode);
105
+
106
+ return $this;
107
+ }
108
+
109
+ /**
110
+ *
111
+ * @return string
112
+ */
113
+ public function getShipmentServiceCode()
114
+ {
115
+ return $this->getShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_MAIN_SERVICE_CODE);
116
+ }
117
+
118
+ /**
119
+ *
120
+ * @param string $referenceNumber
121
+ * @param type $makeUnique
122
+ *
123
+ * @return \Zitec_Dpd_Api_Shipment_Save
124
+ */
125
+ public function setShipmentReferenceNumber($referenceNumber, $makeUnique = true)
126
+ {
127
+ if ($makeUnique) {
128
+ $referenceNumber .= '-' . strtoupper(substr(sha1(uniqid(rand(), true)), 0, 4));
129
+ }
130
+
131
+ $this->setShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_REFERENCE_NUMBER, $referenceNumber);
132
+
133
+ return $this;
134
+ }
135
+
136
+ /**
137
+ *
138
+ * @return string
139
+ */
140
+ public function getShipmentReferenceNumber()
141
+ {
142
+ return $this->getShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_REFERENCE_NUMBER);
143
+ }
144
+
145
+ /**
146
+ *
147
+ * @param string $referenceNumber
148
+ * @param float $weight
149
+ * @param string $description
150
+ *
151
+ * @return \Zitec_Dpd_Api_Shipment_Save
152
+ */
153
+ public function addParcel($referenceNumber, $weight, $description)
154
+ {
155
+ $shipmentReferenceNumber = $this->getShipmentReferenceNumber();
156
+ if (!$shipmentReferenceNumber) {
157
+ throw new Exception('DPD API - Shipment has no reference number', 106);
158
+ }
159
+ $parcelRefNo = (string)$referenceNumber . '-' . $shipmentReferenceNumber;
160
+ $parcel = array(
161
+ Zitec_Dpd_Api_Configs::PARCELS_PARCEL_ID => null,
162
+ Zitec_Dpd_Api_Configs::PARCELS_PARCEL_NO => null,
163
+ Zitec_Dpd_Api_Configs::PARCELS_PARCEL_REFERENCE_NUMBER => $parcelRefNo,
164
+ Zitec_Dpd_Api_Configs::PARCELS_DIMENSION_HEIGHT => null,
165
+ Zitec_Dpd_Api_Configs::PARCELS_DIMENSION_WIDTH => null,
166
+ Zitec_Dpd_Api_Configs::PARCELS_DIMENSION_LENGTH => null,
167
+ Zitec_Dpd_Api_Configs::PARCELS_WEIGHT => $weight,
168
+ Zitec_Dpd_Api_Configs::PARCELS_DESCRIPTION => $description
169
+ );
170
+ $this->_setData(array(Zitec_Dpd_Api_Configs::SHIPMENT_LIST, Zitec_Dpd_Api_Configs::PARCELS), $parcel);
171
+
172
+ return $this;
173
+ }
174
+
175
+ /**
176
+ *
177
+ * @return int
178
+ */
179
+ public function getParcelCount()
180
+ {
181
+ return $this->_count(array(Zitec_Dpd_Api_Configs::SHIPMENT_LIST, Zitec_Dpd_Api_Configs::PARCELS));
182
+ }
183
+
184
+ /**
185
+ *
186
+ * @param string $parcelReferenceNumber
187
+ * @param string $parcelId
188
+ *
189
+ * @return \Zitec_Dpd_Api_Shipment_Save
190
+ */
191
+ protected function _setParcelId($parcelReferenceNumber, $parcelId)
192
+ {
193
+ $parcels = $this->_getParcels();
194
+ foreach (array_keys($parcels) as $parcelKey) {
195
+ if ($parcels[$parcelKey][Zitec_Dpd_Api_Configs::PARCELS_PARCEL_REFERENCE_NUMBER] == $parcelReferenceNumber) {
196
+ $parcels[$parcelKey][Zitec_Dpd_Api_Configs::PARCELS_PARCEL_ID] = $parcelId;
197
+ break;
198
+ }
199
+ }
200
+ $this->_setData(array(Zitec_Dpd_Api_Configs::SHIPMENT_LIST, Zitec_Dpd_Api_Configs::PARCELS), null);
201
+ foreach ($parcels as $parcel) {
202
+ $this->_setData(array(Zitec_Dpd_Api_Configs::SHIPMENT_LIST, Zitec_Dpd_Api_Configs::PARCELS), $parcel);
203
+ }
204
+
205
+ return $this;
206
+ }
207
+
208
+ protected function _getParcels()
209
+ {
210
+ $parcels = $this->_getData(array(Zitec_Dpd_Api_Configs::SHIPMENT_LIST, Zitec_Dpd_Api_Configs::PARCELS));
211
+ if ($this->getParcelCount() == 1) {
212
+ $parcels = array($parcels);
213
+ }
214
+
215
+ return $parcels;
216
+ }
217
+
218
+ /**
219
+ *
220
+ * @return array
221
+ */
222
+ public function getParcelWeights()
223
+ {
224
+ $parcelWeights = array();
225
+ foreach ($this->_getParcels() as $parcel) {
226
+ $parcelWeights[$parcel[Zitec_Dpd_Api_Configs::PARCELS_PARCEL_REFERENCE_NUMBER]] = $parcel[Zitec_Dpd_Api_Configs::PARCELS_WEIGHT];
227
+ }
228
+
229
+ return $parcelWeights;
230
+ }
231
+
232
+ /**
233
+ *
234
+ * @return float
235
+ */
236
+ public function getTotalWeight()
237
+ {
238
+ return array_sum($this->getParcelWeights());
239
+ }
240
+
241
+ /**
242
+ *
243
+ * @param float $amount
244
+ * @param string $currency
245
+ * @param string $paymentType
246
+ *
247
+ * @return Zitec_Dpd_Api_Shipment_Save
248
+ */
249
+ public function setCashOnDelivery($amount, $currency, $paymentType)
250
+ {
251
+ return $this->addAdditionalServices(Zitec_Dpd_Api_Configs::ADDITIONAL_SERVICES_COD,
252
+ array(Zitec_Dpd_Api_Configs::COD_AMOUNT => $amount,
253
+ Zitec_Dpd_Api_Configs::COD_CURRENCY => $currency,
254
+ Zitec_Dpd_Api_Configs::COD_PAYMENT_TYPE => $paymentType));
255
+ }
256
+
257
+
258
+ /**
259
+ *
260
+ * @param stdClass $response
261
+ *
262
+ * @return \Zitec_Dpd_Api_Shipment_Save_Response
263
+ */
264
+ protected function _createResponse(stdClass $response)
265
+ {
266
+ return new Zitec_Dpd_Api_Shipment_Save_Response($response);
267
+ }
268
+
269
+ /**
270
+ *
271
+ * @param type $shipmentId
272
+ *
273
+ * @return \Zitec_Dpd_Api_Shipment_Save
274
+ */
275
+ public function setDpdShipmentId($shipmentId)
276
+ {
277
+ $this->setShipmentList('shipmentId', $shipmentId);
278
+
279
+ return $this;
280
+ }
281
+
282
+ /**
283
+ *
284
+ * @return Zitec_Dpd_Api_Shipment_Save_Response
285
+ */
286
+ public function getShipmentSaveResponse()
287
+ {
288
+ return $this->getResponse();
289
+ }
290
+
291
+ protected function _afterExecute()
292
+ {
293
+ $this->setDpdShipmentId($this->getShipmentSaveResponse()->getDpdShipmentId());
294
+ foreach ($this->getShipmentSaveResponse()->getParcelRefsIds() as $parcelRefNo => $parcelId) {
295
+ $this->_setParcelId($parcelRefNo, $parcelId);
296
+ }
297
+ if ($this->_method == Zitec_Dpd_Api_Configs::METHOD_CREATE_SHIPMENT) {
298
+ $this->_method = Zitec_Dpd_Api_Configs::METHOD_UPDATE_SHIPMENT;
299
+ }
300
+ }
301
+
302
+ /**
303
+ *
304
+ * @throws Zitec_Dpd_Api_Shipment_Save_Exception_ReceiverAddressTooLong
305
+ */
306
+ protected function _beforeExecute()
307
+ {
308
+ $receiverStreet = $this->getShipmentList(Zitec_Dpd_Api_Configs::SHIPMENT_LIST_RECEIVER_STREET);
309
+ if (strlen($receiverStreet) > Zitec_Dpd_Api_Configs::SHIPMENT_LIST_RECEIVER_STREET_MAX_LENGTH) {
310
+ throw new Zitec_Dpd_Api_Shipment_Save_Exception_ReceiverAddressTooLong("Receiver address too long");
311
+ }
312
+ }
313
+
314
+ }
315
+
316
+
lib/Zitec/Dpd/Api/Shipment/Save/Exception/ReceiverAddressTooLong.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Shipment_Save_Exception_Receiveraddresstoolong
7
+ * We have a custom exception here for save shipment method
8
+ *
9
+ * @category Zitec
10
+ * www.zitec.com
11
+ * @package Zitec_Dpd
12
+ * @author george.babarus <george.babarus@gmail.com>
13
+ * @license http://opensource.org/licenses/osl-3.0.php
14
+ */
15
+ class Zitec_Dpd_Api_Shipment_Save_Exception_ReceiverAddressTooLong extends Exception
16
+ {
17
+
18
+ /**
19
+ *
20
+ * @return int
21
+ */
22
+ public function getMaxLength()
23
+ {
24
+ return Zitec_Dpd_Api_Configs::SHIPMENT_LIST_RECEIVER_STREET_MAX_LENGTH;
25
+ }
26
+
27
+ }
28
+
29
+
lib/Zitec/Dpd/Api/Shipment/Save/Response.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Shipment_Save_Response
7
+ *
8
+ *
9
+ * @category Zitec
10
+ * www.zitec.com
11
+ * @package Zitec_Dpd
12
+ * @author george.babarus <george.babarus@gmail.com>
13
+ * @license http://opensource.org/licenses/osl-3.0.php
14
+ */
15
+ class Zitec_Dpd_Api_Shipment_Save_Response extends Zitec_Dpd_Api_Shipment_Response
16
+ {
17
+
18
+ /**
19
+ *
20
+ * @return string
21
+ */
22
+ public function getDpdShipmentReferenceNumber()
23
+ {
24
+ return $this->_getResponseProperty('result/resultList/shipmentReference/referenceNumber');
25
+ }
26
+
27
+ /**
28
+ *
29
+ * @return string
30
+ */
31
+ public function getDpdShipmentId()
32
+ {
33
+ return $this->_getResponseProperty('result/resultList/shipmentReference/id');
34
+ }
35
+
36
+ /**
37
+ *
38
+ * @return string
39
+ */
40
+ public function getMessage()
41
+ {
42
+ return $this->_getResponseProperty("result/resultList/message");
43
+ }
44
+
45
+ /**
46
+ *
47
+ * @return type
48
+ */
49
+ public function getParcelRefsIds()
50
+ {
51
+ $parcels = $this->_getResponseProperty('result/resultList/parcelResultList');
52
+ if (!$parcels) {
53
+ return array();
54
+ }
55
+
56
+ if (!is_array($parcels)) {
57
+ $parcels = array($parcels);
58
+ }
59
+
60
+ $parcelRefsIds = array();
61
+ foreach ($parcels as $parcel) {
62
+ $parcelRefNumber = $this->_getResponseProperty('parcelReferenceNumber', $parcel);
63
+ $parcelId = $this->_getResponseProperty('parcelId', $parcel);
64
+ $parcelRefsIds[$parcelRefNumber] = $parcelId;
65
+ }
66
+
67
+ return $parcelRefsIds;
68
+ }
69
+ }
70
+
71
+
lib/Zitec/Dpd/Api/Soapclient.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Zitec Dpd - Api
5
+ *
6
+ * Class Zitec_Dpd_Api_Soapclient
7
+ *
8
+ * use this SOAP client if you are using PHP 5.3<
9
+ *
10
+ * @category Zitec
11
+ * www.zitec.com
12
+ * @package Zitec_Dpd
13
+ * @author george.babarus <george.babarus@gmail.com>
14
+ * @license http://opensource.org/licenses/osl-3.0.php
15
+ */
16
+ class Zitec_Dpd_Api_Soapclient extends SoapClient
17
+ {
18
+
19
+ /**
20
+ * @param string $wsdl
21
+ * @param array $options
22
+ */
23
+ public function __construct($wsdl, $options)
24
+ {
25
+ $url = parse_url($wsdl);
26
+ if ($url['port']) {
27
+ $this->_port = $url['port'];
28
+ }
29
+
30
+ return parent::__construct($wsdl, $options);
31
+ }
32
+
33
+
34
+
35
+ /**
36
+ * @param string $request
37
+ * @param string $location
38
+ * @param string $action
39
+ * @param int $version
40
+ * @param int $one_way
41
+ *
42
+ * @return string
43
+ */
44
+ public function __doRequest($request, $location, $action, $version, $one_way = 0)
45
+ {
46
+ $parts = parse_url($location);
47
+ if ($this->_port) {
48
+ $parts['port'] = $this->_port;
49
+ }
50
+ $location = $this->buildLocation($parts);
51
+
52
+ $return = parent::__doRequest($request, $location, $action, $version, $one_way);
53
+
54
+ return $return;
55
+ }
56
+
57
+ /**
58
+ * @param array $parts
59
+ *
60
+ * @return string
61
+ */
62
+ public function buildLocation($parts = array())
63
+ {
64
+ $location = '';
65
+
66
+ if (isset($parts['scheme'])) {
67
+ $location .= $parts['scheme'] . '://';
68
+ }
69
+ if (isset($parts['user']) || isset($parts['pass'])) {
70
+ $location .= $parts['user'] . ':' . $parts['pass'] . '@';
71
+ }
72
+ $location .= $parts['host'];
73
+ if (isset($parts['port'])) {
74
+ $location .= ':' . $parts['port'];
75
+ }
76
+ $location .= $parts['path'];
77
+ if (isset($parts['query'])) {
78
+ $location .= '?' . $parts['query'];
79
+ }
80
+
81
+ return $location;
82
+ }
83
+
84
+
85
+ }
86
+
87
+
lib/Zitec/Dpd/ApiTest/test-dpd-calculatePrice.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: george.babarus
5
+ * Date: 10/24/2014
6
+ * Time: 2:36 PM
7
+ */
8
+
9
+
10
+ error_reporting(E_ALL | E_STRICT);
11
+ ini_set('display_errors', 1);
12
+
13
+
14
+ $d = dirname(__FILE__) . '/lib/Zitec/Dpd/Api.php';
15
+ include $d;
16
+
17
+
18
+ $_options = array(
19
+ 'url' => 'https://geopost:KF9DVy7Jjk@integration.dpd.eo.pl/IT4EMWebServices/eshop/ShipmentServiceImpl?wsdl',
20
+ 'wsUserName' => 'WEBSERVICE',
21
+ 'wsPassword' => 'VZSxy18nfK',
22
+ 'wsLang' => 'EN',
23
+ 'applicationType' => '9',
24
+
25
+ 'payerId' => '8038059',
26
+ 'senderAddressId' => '8377391',
27
+ 'mainServiceCode' => 1,
28
+
29
+ 'shipmentList' => array(
30
+ 'shipmentReferenceNumber' => 1234567,
31
+ 'receiverName' => 'DPD Price Calculation',
32
+ 'receiverFirmName' => null,
33
+
34
+ 'receiverCountryCode' => "SK",
35
+
36
+ 'receiverZipCode' => 96001,
37
+ 'receiverCity' => 'Zvolen',
38
+ 'receiverStreet' => 'Antona Bernoláka 28-30',
39
+ 'receiverHouseNo' => '28-30',
40
+ 'receiverPhoneNo' => '0734344544',
41
+
42
+ 'parcels' => array(
43
+ 'weight' => 3,
44
+ 'parcelReferenceNumber' => 123
45
+ ),
46
+ ),
47
+
48
+ 'method' => Zitec_Dpd_Api_Configs::METHOD_SHIPMENT_SAVE
49
+ );
50
+
51
+ try {
52
+ $dpdApi = new Zitec_Dpd_Api($_options);
53
+
54
+ $dpdApi()->execute();
55
+
56
+ } catch (Exception $e) {
57
+ var_dump($e->getMessage());
58
+ }
59
+ var_dump($dpdApi());
60
+
61
+
62
+
63
+ /*
64
+ Response example
65
+
66
+
67
+
68
+
69
+ object(Zitec_Dpd_Api_Shipment_CalculatePrice)[3]
70
+ protected '_url' => string 'https://geopost:KF9DVy7Jjk@integration.dpd.eo.pl/IT4EMWebServices/eshop/ShipmentServiceImpl?wsdl' (length=96)
71
+ protected '_connectionTimeout' => int 10
72
+ protected '_wsUserName' => string 'WEBSERVICE' (length=10)
73
+ protected '_wsPassword' => string 'VZSxy18nfK' (length=10)
74
+ protected '_payerId' => string '8038059' (length=7)
75
+ protected '_senderAddressId' => string '8377391' (length=7)
76
+ protected '_lastResponse' => string '<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:Header></env:Header><env:Body><ns1:calculatePriceResponse xmlns:ns1='http://it4em.yurticikargo.com.tr/eshop/shipment' xmlns:ns2='http://it4em.yurticikargo.com.tr/eshop/shipment' xmlns:ns3='http://it4em.yurticikargo.com.tr/eshop/'><result><transactionId>82272</transactionId><priceList><price><amount>6.55</amount><vatAmount>1.31</vatAmount><totalAmount>7.86</totalAmount><currency>EUR</currency><amountLocal>6.55</amountLocal><vatAmountLocal>1.31</vatAmountLocal><totalAmountLocal>7.86</totalAmountLocal><currencyLocal>EUR</currencyLocal></price><error xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true'/></priceList></result></ns1:calculatePriceResponse></env:Body></env:Envelope>' (length=772)
77
+ protected '_lastRequest' => string '<?xml version="1.0" encoding="UTF-8"?>
78
+ <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://it4em.yurticikargo.com.tr/eshop/shipment"><SOAP-ENV:Body><ns1:calculatePrice><wsUserName>WEBSERVICE</wsUserName><wsPassword>VZSxy18nfK</wsPassword><wsLang>EN</wsLang><applicationType>9</applicationType><shipmentList><shipmentId xsi:nil="true"/><shipmentReferenceNumber/><payerId>8038059</payerId><senderAddressId>8377391</senderAddressId><receiverName>DPD Price Calculation</receiverName><receiverFirmName xsi:nil="true"/><receiverCountryCode>SK</receiverCountryCode><receiverZipCode>96001</receiverZipCode><receiverCity>Zvolen</receiverCity><receiverStreet>Antona Bernoláka 28-30</receiverStreet><receiverHouseNo>28-30</receiverHouseNo><receiverPhoneNo>0734344544</receiverPhoneNo><mainServiceCode>1</mainServiceCode><parcels><parcelId xsi:nil="true"/><parcelNo xsi:nil="true"/><parcelReferenceNumber/><dimensionsHeight xsi:nil="true'... (length=1224)
79
+ protected '_data' =>
80
+ array (size=9)
81
+ 'url' => string 'https://geopost:KF9DVy7Jjk@integration.dpd.eo.pl/IT4EMWebServices/eshop/ShipmentServiceImpl?wsdl' (length=96)
82
+ 'wsUserName' => string 'WEBSERVICE' (length=10)
83
+ 'wsPassword' => string 'VZSxy18nfK' (length=10)
84
+ 'wsLang' => string 'EN' (length=2)
85
+ 'applicationType' => int 9
86
+ 'payerId' => string '8038059' (length=7)
87
+ 'senderAddressId' => string '8377391' (length=7)
88
+ 'mainServiceCode' => int 1
89
+ 'shipmentList' =>
90
+ array (size=13)
91
+ 'shipmentReferenceNumber' => null
92
+ 'receiverName' => string 'DPD Price Calculation' (length=21)
93
+ 'receiverFirmName' => null
94
+ 'receiverCountryCode' => string 'SK' (length=2)
95
+ 'receiverZipCode' => int 96001
96
+ 'receiverCity' => string 'Zvolen' (length=6)
97
+ 'receiverStreet' => string 'Antona Bernoláka 28-30' (length=23)
98
+ 'receiverHouseNo' => string '28-30' (length=5)
99
+ 'receiverPhoneNo' => string '0734344544' (length=10)
100
+ 'parcels' =>
101
+ array (size=2)
102
+ 'weight' => int 3
103
+ 'parcelReferenceNumber' => null
104
+ 'mainServiceCode' => int 1
105
+ 'payerId' => string '8038059' (length=7)
106
+ 'senderAddressId' => string '8377391' (length=7)
107
+ protected '_method' => string 'calculatePrice' (length=14)
108
+ protected '_response' =>
109
+ object(Zitec_Dpd_Api_Shipment_CalculatePrice_Response)[9]
110
+ protected '_response' =>
111
+ object(stdClass)[5]
112
+ public 'result' =>
113
+ object(stdClass)[6]
114
+ public 'transactionId' => int 82272
115
+ public 'priceList' =>
116
+ object(stdClass)[7]
117
+ public 'price' =>
118
+ object(stdClass)[8]
119
+ public 'amount' => float 6.55
120
+ public 'vatAmount' => float 1.31
121
+ public 'totalAmount' => float 7.86
122
+ public 'currency' => string 'EUR' (length=3)
123
+ public 'amountLocal' => float 6.55
124
+ public 'vatAmountLocal' => float 1.31
125
+ public 'totalAmountLocal' => float 7.86
126
+ public 'currencyLocal' => string 'EUR' (length=3)
127
+ public 'error' => null
128
+ */
lib/Zitec/Dpd/ApiTest/test-dpd-createShipment.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Created by PhpStorm.
4
+ * User: george.babarus
5
+ * Date: 10/24/2014
6
+ * Time: 2:36 PM
7
+ */
8
+
9
+
10
+ error_reporting(E_ALL | E_STRICT);
11
+ ini_set('display_errors', 1);
12
+
13
+
14
+ $d = dirname(__FILE__) . '/lib/Zitec/Dpd/Api.php';
15
+ include $d;
16
+
17
+
18
+ $_options = array(
19
+ 'url' => 'https://geopost:KF9DVy7Jjk@integration.dpd.eo.pl/IT4EMWebServices/eshop/ShipmentServiceImpl?wsdl',
20
+ 'wsUserName' => 'WEBSERVICE',
21
+ 'wsPassword' => 'VZSxy18nfK',
22
+ 'wsLang' => 'EN',
23
+ 'applicationType' => '9',
24
+
25
+ 'payerId' => '8038059',
26
+ 'senderAddressId' => '8377391',
27
+ 'mainServiceCode' => 1,
28
+
29
+ 'shipmentList' => array(
30
+ 'shipmentReferenceNumber' => 1234567,
31
+ 'receiverName' => 'DPD Price Calculation',
32
+ 'receiverFirmName' => null,
33
+
34
+ 'receiverCountryCode' => "SK",
35
+
36
+ 'receiverZipCode' => 96001,
37
+ 'receiverCity' => 'Zvolen',
38
+ 'receiverStreet' => 'Antona Bernoláka 28-30',
39
+ 'receiverHouseNo' => '28-30',
40
+ 'receiverPhoneNo' => '0734344544',
41
+
42
+ 'parcels' => array(
43
+ 'weight' => 3,
44
+ 'parcelReferenceNumber' => 123
45
+ ),
46
+ ),
47
+
48
+ 'method' => Zitec_Dpd_Api_Configs::METHOD_SHIPMENT_SAVE
49
+ );
50
+
51
+ try {
52
+ $dpdApi = new Zitec_Dpd_Api($_options);
53
+
54
+ $dpdApi()->execute();
55
+
56
+ } catch (Exception $e) {
57
+ var_dump($e->getMessage());
58
+ }
59
+ var_dump($dpdApi());
60
+
61
+
62
+
63
+ /*
64
+ Response example
65
+
66
+
67
+
68
+
69
+ object(Zitec_Dpd_Api_Shipment_Save)[3]
70
+ protected '_url' => string 'https://geopost:KF9DVy7Jjk@integration.dpd.eo.pl/IT4EMWebServices/eshop/ShipmentServiceImpl?wsdl' (length=96)
71
+ protected '_connectionTimeout' => int 10
72
+ protected '_wsUserName' => string 'WEBSERVICE' (length=10)
73
+ protected '_wsPassword' => string 'VZSxy18nfK' (length=10)
74
+ protected '_payerId' => string '8038059' (length=7)
75
+ protected '_senderAddressId' => string '8377391' (length=7)
76
+ protected '_lastResponse' => string '<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:Header></env:Header><env:Body><ns1:createShipmentResponse xmlns:ns1='http://it4em.yurticikargo.com.tr/eshop/shipment' xmlns:ns2='http://it4em.yurticikargo.com.tr/eshop/shipment' xmlns:ns3='http://it4em.yurticikargo.com.tr/eshop/'><result><transactionId>82276</transactionId><resultList><shipmentReference><id xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true'/><referenceNumber>1234567</referenceNumber></shipmentReference><price xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true'/><error><code>50030</code><text>shipmentReferenceNumber (1234567) is used before!</text><solution xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true'/></error><shipmentDate xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true'/><shipmentTime xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true'/><message xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true'/></resultLis'... (length=1090)
77
+ protected '_lastRequest' => string '<?xml version="1.0" encoding="UTF-8"?>
78
+ <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://it4em.yurticikargo.com.tr/eshop/shipment"><SOAP-ENV:Body><ns1:createShipment><wsUserName>WEBSERVICE</wsUserName><wsPassword>VZSxy18nfK</wsPassword><wsLang>EN</wsLang><applicationType>9</applicationType><shipmentList><shipmentId xsi:nil="true"/><shipmentReferenceNumber>1234567</shipmentReferenceNumber><payerId>8038059</payerId><senderAddressId>8377391</senderAddressId><receiverName>DPD Price Calculation</receiverName><receiverFirmName xsi:nil="true"/><receiverCountryCode>SK</receiverCountryCode><receiverZipCode>96001</receiverZipCode><receiverCity>Zvolen</receiverCity><receiverStreet>Antona Bernoláka 28-30</receiverStreet><receiverHouseNo>28-30</receiverHouseNo><receiverPhoneNo>0734344544</receiverPhoneNo><mainServiceCode>1</mainServiceCode><parcels><parcelId xsi:nil="true"/><parcelNo xsi:nil="true"/><parcelReferenceNumber>'... (length=1321)
79
+ protected '_data' =>
80
+ array (size=10)
81
+ 'url' => string 'https://geopost:KF9DVy7Jjk@integration.dpd.eo.pl/IT4EMWebServices/eshop/ShipmentServiceImpl?wsdl' (length=96)
82
+ 'wsUserName' => string 'WEBSERVICE' (length=10)
83
+ 'wsPassword' => string 'VZSxy18nfK' (length=10)
84
+ 'wsLang' => string 'EN' (length=2)
85
+ 'applicationType' => int 9
86
+ 'payerId' => string '8038059' (length=7)
87
+ 'senderAddressId' => string '8377391' (length=7)
88
+ 'mainServiceCode' => int 1
89
+ 'shipmentList' =>
90
+ array (size=14)
91
+ 'shipmentReferenceNumber' => int 1234567
92
+ 'receiverName' => string 'DPD Price Calculation' (length=21)
93
+ 'receiverFirmName' => null
94
+ 'receiverCountryCode' => string 'SK' (length=2)
95
+ 'receiverZipCode' => int 96001
96
+ 'receiverCity' => string 'Zvolen' (length=6)
97
+ 'receiverStreet' => string 'Antona Bernoláka 28-30' (length=23)
98
+ 'receiverHouseNo' => string '28-30' (length=5)
99
+ 'receiverPhoneNo' => string '0734344544' (length=10)
100
+ 'parcels' =>
101
+ array (size=2)
102
+ 'weight' => int 3
103
+ 'parcelReferenceNumber' => int 123
104
+ 'mainServiceCode' => int 1
105
+ 'shipmentId' => null
106
+ 'payerId' => string '8038059' (length=7)
107
+ 'senderAddressId' => string '8377391' (length=7)
108
+ 'priceOption' => string 'WithoutPrice' (length=12)
109
+ protected '_method' => string 'updateShipment' (length=14)
110
+ protected '_response' =>
111
+ object(Zitec_Dpd_Api_Shipment_Save_Response)[10]
112
+ protected '_response' =>
113
+ object(stdClass)[5]
114
+ public 'result' =>
115
+ object(stdClass)[6]
116
+ public 'transactionId' => int 82276
117
+ public 'resultList' =>
118
+ object(stdClass)[7]
119
+ public 'shipmentReference' =>
120
+ object(stdClass)[8]
121
+ public 'id' => null
122
+ public 'referenceNumber' => string '1234567' (length=7)
123
+ public 'price' => null
124
+ public 'error' =>
125
+ object(stdClass)[9]
126
+ public 'code' => int 50030
127
+ public 'text' => string 'shipmentReferenceNumber (1234567) is used before!' (length=49)
128
+ public 'solution' => null
129
+ public 'shipmentDate' => null
130
+ public 'shipmentTime' => null
131
+ public 'message' => null
132
+
133
+
134
+
135
+ */
lib/Zitec/Dpd/Postcode/Search.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension - postcode validation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+
19
+ class Zitec_Dpd_Postcode_Search extends Zitec_Dpd_Postcode_Search_Abstract implements Zitec_Dpd_Postcode_Search_Interface
20
+ {
21
+
22
+ public function __construct($_searchModel = null, $connection = null)
23
+ {
24
+ $this->_searchModel = $_searchModel;
25
+ $this->_connection = $connection;
26
+ $this->_init();
27
+ }
28
+
29
+
30
+ public function _init()
31
+ {
32
+ switch ($this->_searchModel) {
33
+ case self::MYSQL_ADAPTER : {
34
+ $this->_initMysqlModel();
35
+ break;
36
+ }
37
+ default: {
38
+ $this->_initDefaultModel();
39
+ }
40
+ }
41
+ }
42
+
43
+
44
+ public function _initMysqlModel()
45
+ {
46
+ if (empty($this->_connection)) {
47
+ throw new Exception('Zitec DPD Postcode - database connection missing');
48
+ }
49
+ $this->_searchModel = new Zitec_Dpd_Postcode_Search_Model_Mysql($this->_connection);
50
+
51
+ return true;
52
+ }
53
+
54
+ public function _initDefaultModel()
55
+ {
56
+ $this->_initMysqlModel();
57
+
58
+ return true;
59
+ }
60
+
61
+
62
+ /**
63
+ * @return boolean
64
+ */
65
+ public function installPostcodeDatabase()
66
+ {
67
+ $this->_searchModel->install();
68
+
69
+ return true;
70
+ }
71
+
72
+
73
+ /**
74
+ * @return boolean
75
+ */
76
+ public function updatePostcodeDatabase()
77
+ {
78
+ return true;
79
+ }
80
+
81
+
82
+ /**
83
+ * @param array $address
84
+ * $address contain next keys
85
+ * MANDATORY
86
+ * country
87
+ * city
88
+ *
89
+ * OPTIONAL
90
+ * region
91
+ * address
92
+ * street
93
+ *
94
+ * @return string - postcode or null
95
+ */
96
+ public function search(array $address, stdClass $relevance = null)
97
+ {
98
+ $address = $this->filterAddressInput($address);
99
+
100
+ $postcode = $this->_searchModel->search($address,$relevance);
101
+ if (!empty($postcode)){
102
+ return $postcode;
103
+ }
104
+ return null;
105
+ }
106
+
107
+
108
+
109
+ /**
110
+ * @param array $address
111
+ * $address contain next keys
112
+ * MANDATORY
113
+ * country
114
+ * city
115
+ *
116
+ * OPTIONAL
117
+ * region
118
+ * address
119
+ * street
120
+ *
121
+ * @return string - postcode or null
122
+ */
123
+ public function searchSimilarAddresses(array $address){
124
+ $address = $this->filterAddressInput($address);
125
+
126
+ $address = $this->_searchModel->searchSimilarAddresses($address);
127
+ return $address;
128
+ }
129
+
130
+
131
+ public function getAddressByPostcode($postcode)
132
+ {
133
+ return $this->_searchModel->getAddressByPostcode($postcode);
134
+ }
135
+
136
+
137
+ /**
138
+ * @param string $postcode
139
+ * - perform a search in database to see if the postcode is valid
140
+ *
141
+ * @return mixed
142
+ */
143
+ public function isValid($postcode)
144
+ {
145
+
146
+
147
+ }
148
+
149
+ public function isEnabled($country)
150
+ {
151
+ $country = $this->applyInputFilter(0,$country);
152
+ if($country=='romania'){
153
+ return true;
154
+ }
155
+ return false;
156
+ }
157
+
158
+
159
+ }
160
+
161
+
162
+ Zitec_Dpd_Postcode_Search::autoloadRegister();
lib/Zitec/Dpd/Postcode/Search/Abstract.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension - postcode validation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ abstract class Zitec_Dpd_Postcode_Search_Abstract
19
+ {
20
+
21
+ const MYSQL_ADAPTER = 'mysql';
22
+ const SQLITE_ADAPTER = 'sqlite';
23
+
24
+ const ADDRESS_FIELD_CITY = 'city';
25
+ const ADDRESS_FIELD_COUNTRY = 'country';
26
+ const ADDRESS_FIELD_REGION = 'region';
27
+ const ADDRESS_FIELD_ADDRESS = 'address';
28
+ const ADDRESS_FIELD_POSTCODE = 'postcode';
29
+
30
+ const SEARCH_APPLY_SIMILARITY_MAX_THRESHOLD = 100;
31
+ const SEARCH_CAN_RETURN_RANDOM_VALUES = 1;
32
+ const SEARCH_RESULT_RELEVANCE_THRESHOLD_FOR_VALIDATION = 84;
33
+
34
+ const SEARCH_APPLY_SIMILARITY_MIN_THRESHOLD = 2;
35
+
36
+ const SEARCH_APPLY_SIMILARITY_CITY_PERCENTAGE_THRESHOLD = 60;
37
+
38
+ const SEARCH_HOUSE_NUMBER_IDENTIFIER_CAN_SKIP_WORDS = 1;
39
+
40
+ //constants used to calibrate house number mapping in address
41
+ //is used to define the comparison threshold
42
+ const SEARCH_HOUSE_NUMBER_CONSTANT1 = 2;
43
+ //is used to increase the results mapping house numbers
44
+ const SEARCH_HOUSE_NUMBER_CONSTANT2 = 5;
45
+
46
+
47
+ protected $_searchModel;
48
+ protected $_connection;
49
+
50
+ protected static $_instance;
51
+ protected static $base_path;
52
+
53
+
54
+
55
+
56
+
57
+ /**
58
+ * filter input address by search model function
59
+ * @param $array
60
+ */
61
+ protected function filterAddressInput($array)
62
+ {
63
+ if(is_array($array)){
64
+ foreach($array as $key => &$value){
65
+ $value = $this->applyInputFilter($key, $value);
66
+ }
67
+ }
68
+ return $array;
69
+ }
70
+
71
+ /**
72
+ * you can customize here how input filters will be applied
73
+ *
74
+ * default is applied the search model filter
75
+ * @param $key
76
+ * @param $value
77
+ */
78
+ public function applyInputFilter($key, $value){
79
+
80
+ return $this->_searchModel->applyFiltersForAddress( $value );
81
+ }
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+ /**
90
+ * Singleton pattern implementation
91
+ *
92
+ * @return Varien_Autoload
93
+ */
94
+ static public function instance()
95
+ {
96
+ if (!self::$_instance) {
97
+ self::$_instance = new Zitec_Dpd_Postcode_Search();
98
+ }
99
+
100
+ return self::$_instance;
101
+ }
102
+
103
+ /**
104
+ * Register SPL autoload function
105
+ */
106
+ static public function autoloadRegister()
107
+ {
108
+ spl_autoload_register(array('Zitec_Dpd_Postcode_Search', 'autoload'));
109
+ }
110
+
111
+
112
+ public function getModel(){
113
+ return $this->_searchModel;
114
+ }
115
+
116
+ /**
117
+ * Load class source code
118
+ *
119
+ * @param string $class
120
+ */
121
+ public static function autoload($class)
122
+ {
123
+ $baseDir = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
124
+ Zitec_Dpd_Postcode_Search::$base_path = $baseDir;
125
+ $classFile = $baseDir . DIRECTORY_SEPARATOR . str_replace(' ', DIRECTORY_SEPARATOR, ucwords(str_replace('_', ' ', $class)));
126
+ $classFile .= '.php';
127
+
128
+ return include $classFile;
129
+ }
130
+
131
+ public static function getBasePath()
132
+ {
133
+ if(empty(self::$base_path)){
134
+ $baseDir = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
135
+ Zitec_Dpd_Postcode_Search::$base_path = $baseDir;
136
+ }
137
+ return self::$base_path;
138
+ }
139
+
140
+ }
lib/Zitec/Dpd/Postcode/Search/Interface.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension - postcode validation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ interface Zitec_Dpd_Postcode_Search_Interface
19
+ {
20
+
21
+
22
+ /**
23
+ * @return boolean
24
+ */
25
+ public function installPostcodeDatabase();
26
+
27
+ /**
28
+ * @return boolean
29
+ */
30
+ public function updatePostcodeDatabase();
31
+
32
+
33
+ /**
34
+ * @param array $address
35
+ * $address contain next keys
36
+ * MANDATORY
37
+ * country
38
+ * city
39
+ *
40
+ * OPTIONAL
41
+ * region
42
+ * address
43
+ * street
44
+ * postcode - if postcode is provided then the function will validate it
45
+ * and return if it is valid for the input address
46
+ *
47
+ * @return string - postcode or null
48
+ */
49
+ public function search(array $address);
50
+
51
+
52
+ /**
53
+ * @param string $postcode
54
+ * - perform a search in database to see if the postcode is valid
55
+ *
56
+ * @return mixed
57
+ */
58
+ public function isValid($postcode);
59
+
60
+
61
+ }
lib/Zitec/Dpd/Postcode/Search/Model.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension - postcode validation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ abstract class Zitec_Dpd_Postcode_Search_Model
19
+ {
20
+
21
+ protected $_autoQuoteIdentifiers = true;
22
+
23
+ protected static $_connection = null;
24
+
25
+ const TABLE_NAME = 'zitec_dpd_postcodes';
26
+
27
+ protected static function getConnection()
28
+ {
29
+ return self::$_connection;
30
+ }
31
+
32
+ /**
33
+ * quote an input string by the connection adapter
34
+ *
35
+ * @param $string
36
+ *
37
+ * @return mixed
38
+ */
39
+ public function quote($string){
40
+ return $this->getConnection()->quote($string);
41
+ }
42
+
43
+ /**
44
+ * Returns the symbol the adapter uses for delimited identifiers.
45
+ *
46
+ * @return string
47
+ */
48
+ public function getQuoteIdentifierSymbol()
49
+ {
50
+ return '`';
51
+ }
52
+
53
+
54
+ /**
55
+ * Quote an identifier.
56
+ *
57
+ * @param string $value The identifier or expression.
58
+ * @param boolean $auto If true, heed the AUTO_QUOTE_IDENTIFIERS config option.
59
+ *
60
+ * @return string The quoted identifier and alias.
61
+ */
62
+ protected function _quoteIdentifier($value, $auto = false)
63
+ {
64
+ if ($auto === false || $this->_autoQuoteIdentifiers === true) {
65
+ $q = $this->getQuoteIdentifierSymbol();
66
+
67
+ return ($q . str_replace("$q", "$q$q", $value) . $q);
68
+ }
69
+
70
+ return $value;
71
+ }
72
+
73
+ /**
74
+ * apply general filters on address array
75
+ *
76
+ * @param $data
77
+ *
78
+ * @return string
79
+ */
80
+ public function applyFiltersForAddress(&$data)
81
+ {
82
+ if (!is_array($data)) {
83
+ $data = $this->applyTextFilter($data);
84
+ } else {
85
+ foreach ($data as &$value) {
86
+ $value = $this->applyTextFilter($value);
87
+ }
88
+ }
89
+
90
+ return $data;
91
+ }
92
+
93
+
94
+ protected function applyTextFilter($string)
95
+ {
96
+ $search = array('Ă', 'ă', 'Â', 'â', 'Î', 'î', 'Ş', 'ş', 'Ţ', 'ţ', 'Ş', 'ş', 'Ţ', 'ţ',"\s", "\t","\r\n");
97
+ $replace = array('A', 'a', 'A', 'a', 'I', 'i', 'S', 's', 'T', 't', 'S', 's', 'T', 't', " ", ' ', ' ');
98
+ $string = str_replace($search, $replace, $string);
99
+
100
+ $temp = @iconv("utf-8", "ascii//TRANSLIT", $string);
101
+ if(!empty($temp)){
102
+ $string = $temp;
103
+ }
104
+ $string = filter_var($string, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH);
105
+ $string = preg_replace("/[^a-zA-Z0-9.\\\ \/-]+/", "", $string);
106
+ return strtolower(trim($string));
107
+ }
108
+
109
+
110
+
111
+ }
lib/Zitec/Dpd/Postcode/Search/Model/CachedData.php ADDED
@@ -0,0 +1,11029 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Zitec_Dpd – shipping carrier extension - postcode validation
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ *
12
+ * @category Zitec
13
+ * @package Zitec_Dpd
14
+ * @copyright Copyright (c) 2014 Zitec COM
15
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
+ */
17
+
18
+ class Zitec_Dpd_Postcode_Search_Model_CachedData
19
+ {
20
+
21
+
22
+ /**
23
+ * @return array
24
+ */
25
+ public static function getCities()
26
+ {
27
+ return self::$_cities;
28
+ }
29
+
30
+ /**
31
+ * @return array
32
+ */
33
+ public static function getRegions()
34
+ {
35
+ return self::$_regions;
36
+ }
37
+
38
+ public static function getHouseNumberIdentifier(){
39
+ return self::$_housenumberIdentifier;
40
+ }
41
+
42
+ protected static $_housenumberIdentifier = array('nr', 'no', 'numarul', 'numar', 'numaru');
43
+
44
+ protected static $_regions =
45
+ array(
46
+ 0 => 'bucuresti',
47
+ 1 => 'ilfov',
48
+ 2 => 'giurgiu',
49
+ 3 => 'prahova',
50
+ 4 => 'arges',
51
+ 5 => 'buzau',
52
+ 6 => 'dambovita',
53
+ 7 => 'teleorman',
54
+ 8 => 'dolj',
55
+ 9 => 'gorj',
56
+ 10 => 'mehedinti',
57
+ 11 => 'olt',
58
+ 12 => 'valcea',
59
+ 13 => 'timis',
60
+ 14 => 'arad',
61
+ 15 => 'caras-severin',
62
+ 16 => 'hunedoara',
63
+ 17 => 'cluj',
64
+ 18 => 'bihor',
65
+ 19 => 'bistrita-nasaud',
66
+ 20 => 'maramures',
67
+ 21 => 'satu-mare',
68
+ 22 => 'salaj',
69
+ 23 => 'brasov',
70
+ 24 => 'alba',
71
+ 25 => 'covasna',
72
+ 26 => 'harghita',
73
+ 27 => 'mures',
74
+ 28 => 'sibiu',
75
+ 29 => 'bacau',
76
+ 30 => 'neamt',
77
+ 31 => 'vrancea',
78
+ 32 => 'iasi',
79
+ 33 => 'botosani',
80
+ 34 => 'suceava',
81
+ 35 => 'vaslui',
82
+ 36 => 'galati',
83
+ 37 => 'braila',
84
+ 38 => 'tulcea',
85
+ 39 => 'constanta',
86
+ 40 => 'calarasi',
87
+ 41 => 'ialomita',
88
+ );
89
+
90
+ protected static $_cities =
91
+ array(
92
+ 0 => 'bucuresti',
93
+ 1 => 'buftea',
94
+ 2 => 'buciumeni',
95
+ 3 => 'otopeni',
96
+ 4 => 'odaile',
97
+ 5 => '1 decembrie',
98
+ 6 => 'copaceni',
99
+ 7 => 'afumati',
100
+ 8 => 'balotesti',
101
+ 9 => 'dumbraveni',
102
+ 10 => 'saftica',
103
+ 11 => 'berceni',
104
+ 12 => 'bragadiru',
105
+ 13 => 'branesti',
106
+ 14 => 'islaz',
107
+ 15 => 'pasarea',
108
+ 16 => 'vadu anei',
109
+ 17 => 'cernica',
110
+ 18 => 'balaceanca',
111
+ 19 => 'caldararu',
112
+ 20 => 'posta',
113
+ 21 => 'tanganu',
114
+ 22 => 'chiajna',
115
+ 23 => 'dudu',
116
+ 24 => 'rosu',
117
+ 25 => 'chitila',
118
+ 26 => 'rudeni',
119
+ 27 => 'ciolpani',
120
+ 28 => 'izvorani',
121
+ 29 => 'luparia',
122
+ 30 => 'piscu',
123
+ 31 => 'ciorogarla',
124
+ 32 => 'darvari',
125
+ 33 => 'clinceni',
126
+ 34 => 'olteni',
127
+ 35 => 'ordoreanu',
128
+ 36 => 'corbeanca',
129
+ 37 => 'ostratu',
130
+ 38 => 'petresti',
131
+ 39 => 'tamasi',
132
+ 40 => 'cornetu',
133
+ 41 => 'buda',
134
+ 42 => 'dascalu',
135
+ 43 => 'creata',
136
+ 44 => 'gagu',
137
+ 45 => 'runcu',
138
+ 46 => 'darasti-ilfov',
139
+ 47 => 'dobroesti',
140
+ 48 => 'fundeni',
141
+ 49 => 'domnesti',
142
+ 50 => 'teghes',
143
+ 51 => 'dragomiresti-vale',
144
+ 52 => 'dragomiresti-deal',
145
+ 53 => 'zurbaua',
146
+ 54 => 'ganeasa',
147
+ 55 => 'cozieni',
148
+ 56 => 'moara domneasca',
149
+ 57 => 'piteasca',
150
+ 58 => '?indrilita',
151
+ 59 => 'glina',
152
+ 60 => 'catelu',
153
+ 61 => 'manolache',
154
+ 62 => 'gradistea',
155
+ 63 => 'sitaru',
156
+ 64 => 'gruiu',
157
+ 65 => 'lipia',
158
+ 66 => 'silistea snagovului',
159
+ 67 => '?antu-floresti',
160
+ 68 => 'jilava',
161
+ 69 => 'magurele',
162
+ 70 => 'alunisu',
163
+ 71 => 'dumitrana',
164
+ 72 => 'pruni',
165
+ 73 => 'varteju',
166
+ 74 => 'moara vlasiei',
167
+ 75 => 'caciulati',
168
+ 76 => 'mogosoaia',
169
+ 77 => 'nuci',
170
+ 78 => 'balta neagra',
171
+ 79 => 'merii petchii',
172
+ 80 => 'micsunesti-moara',
173
+ 81 => 'micsunestii mari',
174
+ 82 => 'pantelimon',
175
+ 83 => 'peris',
176
+ 84 => 'balteni',
177
+ 85 => 'burias',
178
+ 86 => 'petrachioaia',
179
+ 87 => 'maineasca',
180
+ 88 => 'surlari',
181
+ 89 => 'vanatori',
182
+ 90 => 'popesti-leordeni',
183
+ 91 => 'snagov',
184
+ 92 => 'ciofliceni',
185
+ 93 => 'tancabesti',
186
+ 94 => 'vladiceasca',
187
+ 95 => 'ghermanesti',
188
+ 96 => '?tefanestii de jos',
189
+ 97 => 'cretuleasca',
190
+ 98 => '?tefanestii de sus',
191
+ 99 => 'tunari',
192
+ 100 => 'dimieni',
193
+ 101 => 'vidra',
194
+ 102 => 'cretesti',
195
+ 103 => 'sintesti',
196
+ 104 => 'voluntari',
197
+ 105 => 'giurgiu',
198
+ 106 => 'bolintin-vale',
199
+ 107 => 'crivina',
200
+ 108 => 'malu spart',
201
+ 109 => 'suseni',
202
+ 110 => 'mihailesti',
203
+ 111 => 'draganescu',
204
+ 112 => 'novaci',
205
+ 113 => 'popesti',
206
+ 114 => 'adunatii-copaceni',
207
+ 115 => 'darasti-vlasca',
208
+ 116 => 'mogosesti',
209
+ 117 => 'varlaam',
210
+ 118 => 'baneasa',
211
+ 119 => 'frasinu',
212
+ 120 => 'pietrele',
213
+ 121 => 'sfantu gheorghe (ban',
214
+ 122 => 'bolintin-deal',
215
+ 123 => 'mihai voda',
216
+ 124 => 'bucsani',
217
+ 125 => 'anghelesti',
218
+ 126 => 'goleasca',
219
+ 127 => 'obedeni',
220
+ 128 => 'podisor',
221
+ 129 => 'uiesti',
222
+ 130 => 'vadu lat',
223
+ 131 => 'bulbucata',
224
+ 132 => 'coteni',
225
+ 133 => 'facau',
226
+ 134 => 'teisori',
227
+ 135 => 'buturugeni',
228
+ 136 => 'padureni',
229
+ 137 => 'podu ilfovatului',
230
+ 138 => 'calugareni',
231
+ 139 => 'branistari',
232
+ 140 => 'crucea de piatra',
233
+ 141 => 'hulubesti',
234
+ 142 => 'uzunu',
235
+ 143 => 'clejani',
236
+ 144 => 'neajlovu',
237
+ 145 => 'podu doamnei',
238
+ 146 => 'sterea',
239
+ 147 => 'colibasi',
240
+ 148 => 'campurelu',
241
+ 149 => 'comana',
242
+ 150 => 'budeni',
243
+ 151 => 'falastoaca',
244
+ 152 => 'vlad tepes',
245
+ 153 => 'crevedia mare',
246
+ 154 => 'crevedia mica',
247
+ 155 => 'dealu',
248
+ 156 => 'gaiseanca',
249
+ 157 => 'priboiu',
250
+ 158 => 'sfantu gheorghe (cre',
251
+ 159 => 'daia',
252
+ 160 => 'plopsoru',
253
+ 161 => 'floresti-stoenesti',
254
+ 162 => 'floresti',
255
+ 163 => 'palanca',
256
+ 164 => 'stoenesti (floresti-',
257
+ 165 => 'fratesti',
258
+ 166 => 'cetatea',
259
+ 167 => 'remus',
260
+ 168 => 'gaiseni',
261
+ 169 => 'carpenisu',
262
+ 170 => 'cascioarele (gaiseni',
263
+ 171 => 'podu popa nae',
264
+ 172 => 'gaujani',
265
+ 173 => 'cetatuia',
266
+ 174 => 'pietrisu',
267
+ 175 => 'ghimpati',
268
+ 176 => 'copaciu',
269
+ 177 => 'naipu',
270
+ 178 => 'valea plopilor',
271
+ 179 => 'gogosari',
272
+ 180 => 'draghiceanu',
273
+ 181 => 'izvoru (gogosari)',
274
+ 182 => 'ralesti',
275
+ 183 => 'gostinari',
276
+ 184 => 'mironesti',
277
+ 185 => 'gostinu',
278
+ 186 => 'gradinari',
279
+ 187 => 'tantava',
280
+ 188 => 'zorile',
281
+ 189 => 'greaca',
282
+ 190 => 'putu greci',
283
+ 191 => 'zboiu',
284
+ 192 => 'hotarele',
285
+ 193 => 'herasti',
286
+ 194 => 'izvoarele (hotarele)',
287
+ 195 => 'milosesti',
288
+ 196 => 'teiusu',
289
+ 197 => 'iepuresti',
290
+ 198 => 'banesti',
291
+ 199 => 'chirculesti',
292
+ 200 => 'gorneni',
293
+ 201 => 'stalpu',
294
+ 202 => 'valter maracineanu',
295
+ 203 => 'izvoarele',
296
+ 204 => 'chiriacu',
297
+ 205 => 'dimitrie cantemir',
298
+ 206 => 'petru rares',
299
+ 207 => 'radu voda',
300
+ 208 => 'valea bujorului',
301
+ 209 => 'joita',
302
+ 210 => 'bacu',
303
+ 211 => 'cosoba',
304
+ 212 => 'sabareni',
305
+ 213 => 'letca noua',
306
+ 214 => 'letca veche',
307
+ 215 => 'milcovatu',
308
+ 216 => 'marsa',
309
+ 217 => 'mihai bravu',
310
+ 218 => 'ogrezeni',
311
+ 219 => 'hobaia',
312
+ 220 => 'oinacu',
313
+ 221 => 'branistea',
314
+ 222 => 'prundu',
315
+ 223 => 'puieni',
316
+ 224 => 'putineiu',
317
+ 225 => 'hodivoaia',
318
+ 226 => 'vieru',
319
+ 227 => 'rasuceni',
320
+ 228 => 'carapancea',
321
+ 229 => 'cucuruzu',
322
+ 230 => 'satu nou',
323
+ 231 => 'roata de jos',
324
+ 232 => 'cartojani',
325
+ 233 => 'roata mica',
326
+ 234 => 'sadina',
327
+ 235 => 'schitu',
328
+ 236 => 'bila',
329
+ 237 => 'camineasca',
330
+ 238 => 'vlasin',
331
+ 239 => 'singureni',
332
+ 240 => 'cranguri',
333
+ 241 => 'stejaru',
334
+ 242 => 'slobozia',
335
+ 243 => 'stanesti',
336
+ 244 => 'balanu',
337
+ 245 => 'ghizdaru',
338
+ 246 => 'oncesti',
339
+ 247 => 'stoenesti',
340
+ 248 => 'ianculesti',
341
+ 249 => 'mirau',
342
+ 250 => 'toporu',
343
+ 251 => 'tomulesti',
344
+ 252 => 'ulmi',
345
+ 253 => 'cascioarele (ulmi)',
346
+ 254 => 'draganeasca',
347
+ 255 => 'ghionea',
348
+ 256 => 'icoana',
349
+ 257 => 'mosteni',
350
+ 258 => 'poenari',
351
+ 259 => 'trestieni',
352
+ 260 => 'valea dragului',
353
+ 261 => 'varasti',
354
+ 262 => 'dobreni',
355
+ 263 => 'vanatorii mici',
356
+ 264 => 'cupele',
357
+ 265 => 'izvoru (vanatorii mi',
358
+ 266 => 'poiana lui stanga',
359
+ 267 => 'valcelele',
360
+ 268 => 'vanatorii mari',
361
+ 269 => 'zadariciu',
362
+ 270 => 'vedea',
363
+ 271 => 'malu',
364
+ 272 => 'ploiesti',
365
+ 273 => 'azuga',
366
+ 274 => 'baicoi',
367
+ 275 => 'dambu',
368
+ 276 => 'liliesti',
369
+ 277 => 'schela',
370
+ 278 => 'tufeni',
371
+ 279 => 'tintea',
372
+ 280 => 'boldesti-scaeni',
373
+ 281 => 'seciu',
374
+ 282 => 'breaza',
375
+ 283 => 'breaza de jos',
376
+ 284 => 'breaza de sus',
377
+ 285 => 'frasinet',
378
+ 286 => 'gura beliei',
379
+ 287 => 'irimesti',
380
+ 288 => 'nistoresti',
381
+ 289 => 'podu corbului',
382
+ 290 => 'podu vadului',
383
+ 291 => 'surdesti',
384
+ 292 => 'valea tarsei',
385
+ 293 => 'busteni',
386
+ 294 => 'poiana tapului',
387
+ 295 => 'campina',
388
+ 296 => 'comarnic',
389
+ 297 => 'ghiosesti',
390
+ 298 => 'podu lung',
391
+ 299 => 'poiana',
392
+ 300 => 'posada',
393
+ 301 => 'mizil',
394
+ 302 => 'fefelei',
395
+ 303 => 'plopeni',
396
+ 304 => 'sinaia',
397
+ 305 => 'slanic',
398
+ 306 => 'grosani',
399
+ 307 => 'prajani',
400
+ 308 => 'urlati',
401
+ 309 => 'arionestii noi',
402
+ 310 => 'arionestii vechi',
403
+ 311 => 'cherba',
404
+ 312 => 'jercalai',
405
+ 313 => 'maruntis',
406
+ 314 => 'orzoaia de jos',
407
+ 315 => 'orzoaia de sus',
408
+ 316 => 'schiau (urlati)',
409
+ 317 => 'valea bobului',
410
+ 318 => 'valea crangului',
411
+ 319 => 'valea mieilor',
412
+ 320 => 'valea nucetului',
413
+ 321 => 'valea pietrei',
414
+ 322 => 'valea seman',
415
+ 323 => 'valea urloii',
416
+ 324 => 'valenii de munte',
417
+ 325 => 'adunati',
418
+ 326 => 'ocina de jos',
419
+ 327 => 'ocina de sus',
420
+ 328 => 'albesti-paleologu',
421
+ 329 => 'albesti-muru',
422
+ 330 => 'cioceni',
423
+ 331 => 'vadu parului',
424
+ 332 => 'alunis',
425
+ 333 => 'ostrovu',
426
+ 334 => 'apostolache',
427
+ 335 => 'buzota',
428
+ 336 => 'marlogea',
429
+ 337 => 'udresti',
430
+ 338 => 'valea cricovului',
431
+ 339 => 'aricestii rahtivani',
432
+ 340 => 'buda (aricestii raht',
433
+ 341 => 'nedelea',
434
+ 342 => 'targsoru nou',
435
+ 343 => 'aricestii zeletin',
436
+ 344 => 'albinari',
437
+ 345 => 'baba ana',
438
+ 346 => 'ciresanu',
439
+ 347 => 'conduratu',
440
+ 348 => 'crangurile',
441
+ 349 => 'satu nou (baba ana)',
442
+ 350 => 'balta doamnei',
443
+ 351 => 'bara',
444
+ 352 => 'curcubeu',
445
+ 353 => 'lacu turcului',
446
+ 354 => 'baltesti',
447
+ 355 => 'izesti',
448
+ 356 => 'podenii vechi',
449
+ 357 => 'urleta',
450
+ 358 => 'barcanesti',
451
+ 359 => 'ghighiu',
452
+ 360 => 'puscasi',
453
+ 361 => 'romanesti',
454
+ 362 => 'tatarani',
455
+ 363 => 'cartierul dambu',
456
+ 364 => 'catunu (berceni)',
457
+ 365 => 'corlatesti',
458
+ 366 => 'moara noua',
459
+ 367 => 'bertea',
460
+ 368 => 'lutu rosu',
461
+ 369 => 'blejoi',
462
+ 370 => 'ploiestiori',
463
+ 371 => 'tantareni',
464
+ 372 => 'boldesti-gradistea',
465
+ 373 => 'boldesti',
466
+ 374 => 'brazi',
467
+ 375 => 'batesti',
468
+ 376 => 'brazii de jos',
469
+ 377 => 'brazii de sus',
470
+ 378 => 'negoiesti',
471
+ 379 => 'popesti (brazi)',
472
+ 380 => 'colonia brazi',
473
+ 381 => 'brebu',
474
+ 382 => 'brebu megiesesc',
475
+ 383 => 'pietriceaua',
476
+ 384 => 'podu cheii',
477
+ 385 => 'brebu manastirei',
478
+ 386 => 'bucov',
479
+ 387 => 'bighilin',
480
+ 388 => 'chitorani',
481
+ 389 => 'pleasa',
482
+ 390 => 'valea orlei',
483
+ 391 => 'valea scheilor',
484
+ 392 => 'carbunesti',
485
+ 393 => 'gogeasca',
486
+ 394 => 'ceptura',
487
+ 395 => 'ceptura de jos',
488
+ 396 => 'malu rosu',
489
+ 397 => 'rotari',
490
+ 398 => '?oimesti',
491
+ 399 => 'ceptura de sus',
492
+ 400 => 'cerasu',
493
+ 401 => 'slon',
494
+ 402 => 'valea borului',
495
+ 403 => 'valea bradetului',
496
+ 404 => 'valea lespezii',
497
+ 405 => 'valea tocii',
498
+ 406 => 'chiojdeanca',
499
+ 407 => 'nucet (chiojdeanca)',
500
+ 408 => 'trenu',
501
+ 409 => 'ciorani',
502
+ 410 => 'cioranii de sus',
503
+ 411 => 'cioranii de jos',
504
+ 412 => 'cocorastii mislii',
505
+ 413 => 'goruna',
506
+ 414 => 'tiparesti',
507
+ 415 => 'colceag',
508
+ 416 => 'inotesti',
509
+ 417 => 'parepa-rusani',
510
+ 418 => 'cornu',
511
+ 419 => 'cornu de sus (cornu)',
512
+ 420 => 'valea oprii',
513
+ 421 => 'cornu de jos (cornu)',
514
+ 422 => 'cosminele',
515
+ 423 => 'cosmina de jos',
516
+ 424 => 'cosmina de sus',
517
+ 425 => 'draghicesti',
518
+ 426 => 'poiana trestiei',
519
+ 427 => 'drajna',
520
+ 428 => 'catunu (drajna)',
521
+ 429 => 'ciocrac',
522
+ 430 => 'drajna de jos',
523
+ 431 => 'drajna de sus',
524
+ 432 => 'faget',
525
+ 433 => 'ogretin',
526
+ 434 => 'piatra (drajna)',
527
+ 435 => 'pitigoi',
528
+ 436 => 'plai',
529
+ 437 => 'podurile',
530
+ 438 => 'poiana mierlei',
531
+ 439 => 'draganesti',
532
+ 440 => 'baraitaru',
533
+ 441 => 'belciug',
534
+ 442 => 'cornu de jos (dragan',
535
+ 443 => 'hatcarau',
536
+ 444 => 'meri',
537
+ 445 => 'tufani',
538
+ 446 => 'dumbrava',
539
+ 447 => 'ciupelnita',
540
+ 448 => 'cornu de sus (dumbra',
541
+ 449 => 'trestienii de jos',
542
+ 450 => 'trestienii de sus',
543
+ 451 => 'zanoaga',
544
+ 452 => 'dumbravesti',
545
+ 453 => 'gavanel',
546
+ 454 => 'malaestii de jos',
547
+ 455 => 'malaestii de sus',
548
+ 456 => 'plopeni (dumbravesti',
549
+ 457 => 'sfarleanca',
550
+ 458 => 'fantanele',
551
+ 459 => 'bozieni',
552
+ 460 => 'ghinoaica',
553
+ 461 => 'ungureni (fantanele)',
554
+ 462 => 'vadu sapat',
555
+ 463 => 'filipestii de padure',
556
+ 464 => 'ditesti',
557
+ 465 => 'minieri',
558
+ 466 => 'silistea dealului',
559
+ 467 => 'filipestii de targ',
560
+ 468 => 'bratasanca',
561
+ 469 => 'ezeni',
562
+ 470 => 'marginenii de jos',
563
+ 471 => 'ungureni (filipestii',
564
+ 472 => 'cap rosu',
565
+ 473 => 'calinesti',
566
+ 474 => 'catina',
567
+ 475 => 'novacesti',
568
+ 476 => 'fulga',
569
+ 477 => 'fulga de jos',
570
+ 478 => 'fulga de sus',
571
+ 479 => 'gherghita',
572
+ 480 => 'fanari (gherghita)',
573
+ 481 => 'independenta',
574
+ 482 => 'malamuc',
575
+ 483 => 'olari',
576
+ 484 => 'olarii vechi',
577
+ 485 => 'ungureni (gherghita)',
578
+ 486 => 'gorgota',
579
+ 487 => 'fanari (gorgota)',
580
+ 488 => 'poienarii apostoli',
581
+ 489 => 'potigrafu',
582
+ 490 => 'gornet',
583
+ 491 => 'bogdanesti',
584
+ 492 => 'cuib',
585
+ 493 => 'nucet (gornet)',
586
+ 494 => 'gornet-cricov',
587
+ 495 => 'coserele',
588
+ 496 => 'dobrota',
589
+ 497 => 'priseaca',
590
+ 498 => 'tarculesti',
591
+ 499 => 'valea seaca',
592
+ 500 => 'gura vadului',
593
+ 501 => 'persunari (gura vadu',
594
+ 502 => 'tohani',
595
+ 503 => 'gura vitioarei',
596
+ 504 => 'bughea de jos',
597
+ 505 => 'fagetu',
598
+ 506 => 'poiana copaceni',
599
+ 507 => 'iordacheanu',
600
+ 508 => 'mocesti',
601
+ 509 => 'plavia',
602
+ 510 => 'straosti',
603
+ 511 => 'valea cucului',
604
+ 512 => 'varbila',
605
+ 513 => 'cernesti',
606
+ 514 => 'chiritesti',
607
+ 515 => 'homoraciu',
608
+ 516 => 'malu vanat',
609
+ 517 => 'schiulesti',
610
+ 518 => 'jugureni',
611
+ 519 => 'boboci',
612
+ 520 => 'marginea padurii',
613
+ 521 => 'valea unghiului',
614
+ 522 => 'lapos',
615
+ 523 => 'glod',
616
+ 524 => 'laposel',
617
+ 525 => 'pietricica',
618
+ 526 => 'lipanesti',
619
+ 527 => 'satu nou (lipanesti)',
620
+ 528 => '?ipotu',
621
+ 529 => 'zamfira',
622
+ 530 => 'coada malului',
623
+ 531 => 'iazu',
624
+ 532 => 'magureni',
625
+ 533 => 'cocorastii caplii',
626
+ 534 => 'lunca prahovei',
627
+ 535 => 'maneciu',
628
+ 536 => 'cheia',
629
+ 537 => 'chiciureni',
630
+ 538 => 'costeni',
631
+ 539 => 'facaieni',
632
+ 540 => 'gheaba',
633
+ 541 => 'maneciu-pamanteni',
634
+ 542 => 'manastirea suzana',
635
+ 543 => 'plaietu',
636
+ 544 => 'maneciu-ungureni',
637
+ 545 => 'manesti',
638
+ 546 => 'baltita',
639
+ 547 => 'chesnoiu',
640
+ 548 => 'coada izvorului',
641
+ 549 => 'cocorastii colt',
642
+ 550 => 'cocorastii grind',
643
+ 551 => 'coltu de jos',
644
+ 552 => 'ghioldum',
645
+ 553 => 'gura crivatului',
646
+ 554 => 'persunari (manesti)',
647
+ 555 => 'piatra (manesti)',
648
+ 556 => 'satu de sus',
649
+ 557 => 'zalhanaua',
650
+ 558 => 'pacureti',
651
+ 559 => 'barzila',
652
+ 560 => 'curmatura',
653
+ 561 => 'matita',
654
+ 562 => 'slavu',
655
+ 563 => 'paulesti',
656
+ 564 => 'cocosesti',
657
+ 565 => 'gageni',
658
+ 566 => 'paulestii noi',
659
+ 567 => 'plopu',
660
+ 568 => 'galmeia',
661
+ 569 => 'harsa',
662
+ 570 => 'nisipoasa',
663
+ 571 => 'podenii noi',
664
+ 572 => 'ghiocel',
665
+ 573 => 'mehedinta',
666
+ 574 => 'nevesteasca',
667
+ 575 => 'podu lui galben',
668
+ 576 => 'popesti (podenii noi',
669
+ 577 => 'rahova',
670
+ 578 => 'salcioara',
671
+ 579 => 'sfacaru',
672
+ 580 => 'valea dulce',
673
+ 581 => 'poiana campina',
674
+ 582 => 'bobolia',
675
+ 583 => 'ragman',
676
+ 584 => 'poienarii burchii',
677
+ 585 => 'carbunari',
678
+ 586 => 'ologeni',
679
+ 587 => 'pioresti',
680
+ 588 => 'podu valeni',
681
+ 589 => 'poienarii vechi',
682
+ 590 => 'poienarii-rali',
683
+ 591 => 'tatarai',
684
+ 592 => 'posesti',
685
+ 593 => 'bodesti',
686
+ 594 => 'merdeala',
687
+ 595 => 'nucsoara de jos',
688
+ 596 => 'nucsoara de sus',
689
+ 597 => 'posestii-pamanteni',
690
+ 598 => 'posestii-ungureni',
691
+ 599 => 'tarlesti',
692
+ 600 => 'valea plopului',
693
+ 601 => 'valea screzii',
694
+ 602 => 'valea stupinii',
695
+ 603 => 'predeal-sarari',
696
+ 604 => 'bobicesti',
697
+ 605 => 'poienile',
698
+ 606 => 'predeal',
699
+ 607 => 'sarari',
700
+ 608 => 'saratel',
701
+ 609 => 'tulburea',
702
+ 610 => 'tulburea-valeni',
703
+ 611 => 'vitioara de sus',
704
+ 612 => 'zambroaia',
705
+ 613 => 'provita de jos',
706
+ 614 => 'draganeasa',
707
+ 615 => 'piatra (provita de j',
708
+ 616 => 'provita de sus',
709
+ 617 => 'izvoru',
710
+ 618 => 'plaiu (provita de su',
711
+ 619 => 'valea bradului',
712
+ 620 => 'puchenii mari',
713
+ 621 => 'miroslavesti',
714
+ 622 => 'moara',
715
+ 623 => 'pietrosani',
716
+ 624 => 'puchenii mici',
717
+ 625 => 'puchenii-mosneni',
718
+ 626 => 'rafov',
719
+ 627 => 'antofiloaia',
720
+ 628 => 'buchilasi',
721
+ 629 => 'buda (rafov)',
722
+ 630 => 'goga',
723
+ 631 => 'malaiesti',
724
+ 632 => 'sicrita',
725
+ 633 => 'salcia',
726
+ 634 => 'salciile',
727
+ 635 => 'sangeru',
728
+ 636 => 'butuci',
729
+ 637 => 'miresu mare',
730
+ 638 => 'miresu mic',
731
+ 639 => 'piatra mica',
732
+ 640 => 'tisa',
733
+ 641 => 'scorteni',
734
+ 642 => 'bordenii mari',
735
+ 643 => 'bordenii mici',
736
+ 644 => 'mislea',
737
+ 645 => 'sarca',
738
+ 646 => 'secaria',
739
+ 647 => 'starchiojd',
740
+ 648 => 'batrani',
741
+ 649 => 'bradet',
742
+ 650 => 'gresia',
743
+ 651 => 'poiana mare',
744
+ 652 => 'rotarea',
745
+ 653 => 'valea anei',
746
+ 654 => 'zmeuret',
747
+ 655 => 'surani',
748
+ 656 => 'pacuri',
749
+ 657 => '?irna',
750
+ 658 => 'bratesti',
751
+ 659 => 'coceana',
752
+ 660 => 'habud',
753
+ 661 => 'tariceni',
754
+ 662 => 'varnita',
755
+ 663 => '?oimari',
756
+ 664 => 'lopatnita',
757
+ 665 => 'magura',
758
+ 666 => '?otrile',
759
+ 667 => 'lunca mare',
760
+ 668 => 'plaiu campinei',
761
+ 669 => 'plaiu cornului',
762
+ 670 => 'seciuri',
763
+ 671 => 'vistieru',
764
+ 672 => '?tefesti',
765
+ 673 => 'scurtesti',
766
+ 674 => 'tarsoreni',
767
+ 675 => 'talea',
768
+ 676 => 'plaiu (talea)',
769
+ 677 => 'tataru',
770
+ 678 => 'podgoria',
771
+ 679 => 'silistea',
772
+ 680 => 'targsoru vechi',
773
+ 681 => 'stancesti',
774
+ 682 => 'strejnicu',
775
+ 683 => 'zahanaua',
776
+ 684 => 'teisani',
777
+ 685 => 'bughea de sus',
778
+ 686 => '?tubeiu',
779
+ 687 => 'valea stalpului',
780
+ 688 => 'telega',
781
+ 689 => 'bosilcesti',
782
+ 690 => 'bustenari',
783
+ 691 => 'doftana',
784
+ 692 => 'melicesti',
785
+ 693 => 'tontesti',
786
+ 694 => 'tinosu',
787
+ 695 => 'pisculesti',
788
+ 696 => 'predesti',
789
+ 697 => 'tomsani',
790
+ 698 => 'loloiasca',
791
+ 699 => 'magula',
792
+ 700 => 'satucu',
793
+ 701 => 'valea calugareasca',
794
+ 702 => 'arva',
795
+ 703 => 'coslegi',
796
+ 704 => 'pantazi',
797
+ 705 => 'rachieri',
798
+ 706 => 'radila',
799
+ 707 => 'schiau (valea caluga',
800
+ 708 => 'valea larga',
801
+ 709 => 'valea mantei',
802
+ 710 => 'valea nicovani',
803
+ 711 => 'valea poienii',
804
+ 712 => 'valea popii',
805
+ 713 => 'valea ursoii',
806
+ 714 => 'varfurile',
807
+ 715 => 'valea doftanei',
808
+ 716 => 'traisteni',
809
+ 717 => 'tesila',
810
+ 718 => 'varbilau',
811
+ 719 => 'cotofenesti',
812
+ 720 => 'livadea',
813
+ 721 => 'podu ursului',
814
+ 722 => 'poiana varbilau',
815
+ 723 => 'valcanesti',
816
+ 724 => 'carjari',
817
+ 725 => 'trestioara',
818
+ 726 => 'pitesti',
819
+ 727 => 'campulung',
820
+ 728 => 'valea rumanestilor',
821
+ 729 => 'costesti',
822
+ 730 => 'brosteni (costesti)',
823
+ 731 => 'laceni',
824
+ 732 => 'parvu rosu',
825
+ 733 => 'podu brosteni',
826
+ 734 => 'smei',
827
+ 735 => 'starci',
828
+ 736 => 'curtea de arges',
829
+ 737 => 'noaptes',
830
+ 738 => 'mioveni',
831
+ 739 => 'clucereasa',
832
+ 740 => 'racovita',
833
+ 741 => 'topoloveni',
834
+ 742 => 'botarcani',
835
+ 743 => 'crintesti',
836
+ 744 => 'goranesti',
837
+ 745 => 'tiganesti',
838
+ 746 => 'albestii de arges',
839
+ 747 => 'albestii ungureni',
840
+ 748 => 'doblea',
841
+ 749 => 'dobrotu',
842
+ 750 => 'albestii pamanteni',
843
+ 751 => 'dumiresti',
844
+ 752 => 'florieni',
845
+ 753 => 'albestii de muscel',
846
+ 754 => 'albesti',
847
+ 755 => 'candesti',
848
+ 756 => 'albota',
849
+ 757 => 'cerbu',
850
+ 758 => 'gura vaii',
851
+ 759 => 'mares',
852
+ 760 => 'aninoasa',
853
+ 761 => 'brosteni (aninoasa)',
854
+ 762 => 'valea silistii',
855
+ 763 => 'arefu',
856
+ 764 => 'capatanenii pamanten',
857
+ 765 => 'capatanenii ungureni',
858
+ 766 => 'bascov',
859
+ 767 => 'braileni',
860
+ 768 => 'glambocu',
861
+ 769 => 'mica',
862
+ 770 => 'prislopu mic',
863
+ 771 => 'schiau',
864
+ 772 => 'uiasca',
865
+ 773 => 'valea ursului',
866
+ 774 => 'babana',
867
+ 775 => 'bajanesti',
868
+ 776 => 'ciobanesti',
869
+ 777 => 'cotmenita',
870
+ 778 => 'grosi',
871
+ 779 => 'lupueni',
872
+ 780 => 'slatioarele',
873
+ 781 => 'baiculesti',
874
+ 782 => 'alunisu (baiculesti)',
875
+ 783 => 'anghinesti',
876
+ 784 => 'argesani',
877
+ 785 => 'manicesti',
878
+ 786 => 'stejari',
879
+ 787 => 'tutana',
880
+ 788 => 'valea brazilor',
881
+ 789 => 'valea lui enache',
882
+ 790 => 'zigoneni',
883
+ 791 => 'balilesti',
884
+ 792 => 'bajesti',
885
+ 793 => 'golesti (balilesti)',
886
+ 794 => 'poienita',
887
+ 795 => 'priboaia',
888
+ 796 => 'ulita',
889
+ 797 => 'valea mare-bratia',
890
+ 798 => 'barla',
891
+ 799 => 'afrimesti',
892
+ 800 => 'badesti (barla)',
893
+ 801 => 'brabeti',
894
+ 802 => 'ciocesti',
895
+ 803 => 'malu (barla)',
896
+ 804 => 'mandra',
897
+ 805 => 'mozacenii-vale',
898
+ 806 => 'podisoru',
899
+ 807 => '?elareasca',
900
+ 808 => 'urlueni',
901
+ 809 => 'zuvelcati',
902
+ 810 => 'beleti-negresti',
903
+ 811 => 'beleti',
904
+ 812 => 'lentea',
905
+ 813 => 'negresti',
906
+ 814 => 'zgripcesti',
907
+ 815 => 'berevoesti',
908
+ 816 => 'bratia (berevoesti)',
909
+ 817 => 'gamacesti',
910
+ 818 => 'otelu',
911
+ 819 => 'bogati',
912
+ 820 => 'barloi',
913
+ 821 => 'bujoi',
914
+ 822 => 'chitesti',
915
+ 823 => 'glambocel',
916
+ 824 => 'glambocelu',
917
+ 825 => 'suseni (bogati)',
918
+ 826 => 'boteni',
919
+ 827 => 'balabani',
920
+ 828 => 'lunca',
921
+ 829 => 'muscel',
922
+ 830 => 'botesti',
923
+ 831 => 'mosteni-greci',
924
+ 832 => 'bradu',
925
+ 833 => 'geamana',
926
+ 834 => 'bradulet',
927
+ 835 => 'alunisu (bradulet)',
928
+ 836 => 'bradetu',
929
+ 837 => 'cosaci',
930
+ 838 => 'galesu',
931
+ 839 => 'piatra (bradulet)',
932
+ 840 => 'slamnesti',
933
+ 841 => 'uleni',
934
+ 842 => 'ungureni (bradulet)',
935
+ 843 => 'budeasa',
936
+ 844 => 'budeasa mare',
937
+ 845 => 'budeasa mica',
938
+ 846 => 'calotesti',
939
+ 847 => 'galasesti (budeasa)',
940
+ 848 => 'rogojina',
941
+ 849 => 'valea marului',
942
+ 850 => 'buzoesti',
943
+ 851 => 'bujoreni',
944
+ 852 => 'cornatel',
945
+ 853 => 'curteanca',
946
+ 854 => 'ionesti',
947
+ 855 => 'podeni',
948
+ 856 => 'redea',
949
+ 857 => '?erboeni',
950
+ 858 => 'tomsanca',
951
+ 859 => 'vladuta',
952
+ 860 => 'vulpesti',
953
+ 861 => 'burdea',
954
+ 862 => 'strambeni (caldararu',
955
+ 863 => 'carstieni',
956
+ 864 => 'ciocanesti',
957
+ 865 => 'glodu (calinesti)',
958
+ 866 => 'gorganu',
959
+ 867 => 'radu negru',
960
+ 868 => 'rancaciov',
961
+ 869 => 'udeni-zavoi',
962
+ 870 => 'urlucea',
963
+ 871 => 'valea corbului',
964
+ 872 => 'valeni-podgoria',
965
+ 873 => 'vranesti',
966
+ 874 => 'cateasca',
967
+ 875 => 'catanele',
968
+ 876 => 'ciresu',
969
+ 877 => 'coseri',
970
+ 878 => 'gruiu (cateasca)',
971
+ 879 => 'recea (cateasca)',
972
+ 880 => 'cepari',
973
+ 881 => 'carpenis',
974
+ 882 => 'ceparii pamanteni',
975
+ 883 => 'ceparii ungureni',
976
+ 884 => 'morasti',
977
+ 885 => '?endrulesti',
978
+ 886 => 'urluiesti',
979
+ 887 => 'valea magurei',
980
+ 888 => 'zamfiresti (cepari)',
981
+ 889 => 'cetateni',
982
+ 890 => 'laicai',
983
+ 891 => 'valea cetatuia',
984
+ 892 => 'cicanesti',
985
+ 893 => 'barasti',
986
+ 894 => 'mioarele (cicanesti)',
987
+ 895 => 'urechesti',
988
+ 896 => 'ciofrangeni',
989
+ 897 => 'burlusi',
990
+ 898 => 'lacurile',
991
+ 899 => 'piatra (ciofrangeni)',
992
+ 900 => 'schitu-matei',
993
+ 901 => 'ciomagesti',
994
+ 902 => 'beculesti',
995
+ 903 => 'bratia (ciomagesti)',
996
+ 904 => 'cungrea',
997
+ 905 => 'dogari',
998
+ 906 => 'fedelesoiu',
999
+ 907 => 'giuclani',
1000
+ 908 => 'paunesti',
1001
+ 909 => 'radutesti',
1002
+ 910 => 'cocu',
1003
+ 911 => 'barbatesti',
1004
+ 912 => 'crucisoara',
1005
+ 913 => 'facaletesti',
1006
+ 914 => 'greabanu',
1007
+ 915 => 'popesti (cocu)',
1008
+ 916 => 'rachitele de jos',
1009
+ 917 => 'rachitele de sus',
1010
+ 918 => 'corbeni',
1011
+ 919 => 'berindesti',
1012
+ 920 => 'bucsenesti',
1013
+ 921 => 'oestii pamanteni',
1014
+ 922 => 'oestii ungureni',
1015
+ 923 => 'poienari (corbeni)',
1016
+ 924 => 'rotunda',
1017
+ 925 => 'turburea',
1018
+ 926 => 'corbi',
1019
+ 927 => 'corbsori',
1020
+ 928 => 'jgheaburi',
1021
+ 929 => 'poduri',
1022
+ 930 => 'poienarei',
1023
+ 931 => 'cosesti',
1024
+ 932 => 'jupanesti',
1025
+ 933 => 'lapusani',
1026
+ 934 => 'leicesti',
1027
+ 935 => 'pacioiu',
1028
+ 936 => 'cotmeana',
1029
+ 937 => 'bascovele',
1030
+ 938 => 'bunesti (cotmeana)',
1031
+ 939 => 'dealu padurii',
1032
+ 940 => 'dragolesti',
1033
+ 941 => 'costesti (cotmeana)',
1034
+ 942 => 'lintesti',
1035
+ 943 => 'negesti',
1036
+ 944 => 'pielesti',
1037
+ 945 => 'sandulesti',
1038
+ 946 => 'spiridoni',
1039
+ 947 => 'ursoaia',
1040
+ 948 => 'varloveni',
1041
+ 949 => 'zamfiresti (cotmeana',
1042
+ 950 => 'cuca',
1043
+ 951 => 'baltata',
1044
+ 952 => 'barbalani',
1045
+ 953 => 'carcesti',
1046
+ 954 => 'cotu (cuca)',
1047
+ 955 => 'crivatu',
1048
+ 956 => 'launele de sus',
1049
+ 957 => 'macai',
1050
+ 958 => 'sinesti',
1051
+ 959 => 'stanicei',
1052
+ 960 => 'teodoresti',
1053
+ 961 => 'valea cucii',
1054
+ 962 => 'vonigeasa',
1055
+ 963 => 'davidesti',
1056
+ 964 => 'contesti',
1057
+ 965 => 'voroveni',
1058
+ 966 => 'dambovicioara',
1059
+ 967 => 'ciocanu',
1060
+ 968 => 'podu dambovitei',
1061
+ 969 => 'darmanesti',
1062
+ 970 => 'negreni',
1063
+ 971 => 'piscani',
1064
+ 972 => 'valea nandrii',
1065
+ 973 => 'valea rizii',
1066
+ 974 => 'dobresti',
1067
+ 975 => 'furesti',
1068
+ 976 => 'dragoslavele',
1069
+ 977 => 'valea hotarului',
1070
+ 978 => 'draganu',
1071
+ 979 => 'bacesti',
1072
+ 980 => 'draganu-olteni',
1073
+ 981 => 'prislopu mare',
1074
+ 982 => 'godeni',
1075
+ 983 => 'bordeieni',
1076
+ 984 => 'capu piscului (goden',
1077
+ 985 => 'cotesti',
1078
+ 986 => 'malu (godeni)',
1079
+ 987 => 'harsesti',
1080
+ 988 => 'ciobani',
1081
+ 989 => 'martalogi',
1082
+ 990 => 'hartiesti',
1083
+ 991 => 'barzesti',
1084
+ 992 => 'huluba',
1085
+ 993 => 'lespezi',
1086
+ 994 => 'lucieni',
1087
+ 995 => 'vulturesti',
1088
+ 996 => 'leordeni',
1089
+ 997 => 'baloteasca',
1090
+ 998 => 'baila',
1091
+ 999 => 'bantau',
1092
+ 1000 => 'budisteni',
1093
+ 1001 => 'carciumaresti',
1094
+ 1002 => 'ciolcesti',
1095
+ 1003 => 'ciulnita',
1096
+ 1004 => 'cotu malului',
1097
+ 1005 => 'glambocata',
1098
+ 1006 => 'glambocata-deal',
1099
+ 1007 => 'glodu (leordeni)',
1100
+ 1008 => 'moara mocanului',
1101
+ 1009 => 'schitu scoicesti',
1102
+ 1010 => 'leresti',
1103
+ 1011 => 'pojorata',
1104
+ 1012 => 'voinesti',
1105
+ 1013 => 'lunca corbului',
1106
+ 1014 => 'bumbueni',
1107
+ 1015 => 'catane',
1108
+ 1016 => 'ciesti',
1109
+ 1017 => 'langesti',
1110
+ 1018 => 'marghia de jos',
1111
+ 1019 => 'marghia de sus',
1112
+ 1020 => 'padureti',
1113
+ 1021 => 'silisteni',
1114
+ 1022 => 'malureni',
1115
+ 1023 => 'bunesti (malureni)',
1116
+ 1024 => 'pauleasca (malureni)',
1117
+ 1025 => 'toplita',
1118
+ 1026 => 'zarnesti',
1119
+ 1027 => 'maracineni',
1120
+ 1028 => 'argeselu',
1121
+ 1029 => 'merisani',
1122
+ 1030 => 'borlesti',
1123
+ 1031 => 'brateasca',
1124
+ 1032 => 'capu piscului (meris',
1125
+ 1033 => 'crampotani',
1126
+ 1034 => 'dobrogostea',
1127
+ 1035 => 'varzaru',
1128
+ 1036 => 'micesti',
1129
+ 1037 => 'branzari',
1130
+ 1038 => 'pauleasca (micesti)',
1131
+ 1039 => 'purcareni (micesti)',
1132
+ 1040 => 'mihaesti',
1133
+ 1041 => 'draghici',
1134
+ 1042 => 'furnicosi',
1135
+ 1043 => 'rudeni (mihaesti)',
1136
+ 1044 => 'valea popii (mihaest',
1137
+ 1045 => 'vacarea',
1138
+ 1046 => 'mioarele',
1139
+ 1047 => 'chilii',
1140
+ 1048 => 'cocenesti',
1141
+ 1049 => 'matau',
1142
+ 1050 => 'suslanesti',
1143
+ 1051 => 'mirosi',
1144
+ 1052 => 'surdulesti',
1145
+ 1053 => 'moraresti',
1146
+ 1054 => 'dealu obejdeanului',
1147
+ 1055 => 'dedulesti',
1148
+ 1056 => 'luminile',
1149
+ 1057 => 'mancioiu',
1150
+ 1058 => 'sapunari',
1151
+ 1059 => 'mosoaia',
1152
+ 1060 => 'ciocanai',
1153
+ 1061 => 'dealu viilor (mosoai',
1154
+ 1062 => 'hintesti',
1155
+ 1063 => 'lazaresti (mosoaia)',
1156
+ 1064 => 'smeura',
1157
+ 1065 => 'mozaceni',
1158
+ 1066 => 'babaroaga',
1159
+ 1067 => 'zidurile',
1160
+ 1068 => 'musatesti',
1161
+ 1069 => 'bolovanesti',
1162
+ 1070 => 'costesti-valsan',
1163
+ 1071 => 'prosia',
1164
+ 1072 => 'robaia',
1165
+ 1073 => 'stroesti',
1166
+ 1074 => 'valea faurului',
1167
+ 1075 => 'valea muscelului',
1168
+ 1076 => 'valea lui mas',
1169
+ 1077 => 'valsanesti',
1170
+ 1078 => 'negrasi',
1171
+ 1079 => 'barlogu',
1172
+ 1080 => 'buta',
1173
+ 1081 => 'mozacu',
1174
+ 1082 => 'nucsoara',
1175
+ 1083 => 'gruiu (nucsoara)',
1176
+ 1084 => 'sboghitesti',
1177
+ 1085 => 'slatina',
1178
+ 1086 => 'oarja',
1179
+ 1087 => 'ceausesti',
1180
+ 1088 => 'badesti (pietrosani)',
1181
+ 1089 => 'ganesti',
1182
+ 1090 => 'retevoiesti',
1183
+ 1091 => 'varzaroaia',
1184
+ 1092 => 'poiana lacului',
1185
+ 1093 => 'catunasi',
1186
+ 1094 => 'cepari (poiana lacul',
1187
+ 1095 => 'dealu orasului',
1188
+ 1096 => 'dealu viilor (poiana',
1189
+ 1097 => 'dinculesti',
1190
+ 1098 => 'galeteanu',
1191
+ 1099 => 'gardinesti',
1192
+ 1100 => 'galcesti',
1193
+ 1101 => 'metofu',
1194
+ 1102 => 'paduroiu din deal',
1195
+ 1103 => 'paduroiu din vale',
1196
+ 1104 => 'samara',
1197
+ 1105 => 'poienarii de arges',
1198
+ 1106 => 'ceauresti',
1199
+ 1107 => 'ioanicesti',
1200
+ 1108 => 'poienari (poienarii ',
1201
+ 1109 => 'poienarii de muscel',
1202
+ 1110 => 'jugur',
1203
+ 1111 => '?erbanesti (poienari',
1204
+ 1112 => 'valea ?ndarat',
1205
+ 1113 => 'palanga',
1206
+ 1114 => 'purcareni (popesti)',
1207
+ 1115 => 'raca',
1208
+ 1116 => 'slobozia (popesti)',
1209
+ 1117 => 'priboieni',
1210
+ 1118 => 'albotele',
1211
+ 1119 => 'paraschivesti',
1212
+ 1120 => 'pitoi',
1213
+ 1121 => 'samaila',
1214
+ 1122 => 'valea mare',
1215
+ 1123 => 'valea nenii',
1216
+ 1124 => 'valea popii (priboie',
1217
+ 1125 => 'ratesti',
1218
+ 1126 => 'ciupa-manciulescu',
1219
+ 1127 => 'furduesti',
1220
+ 1128 => 'mavrodolu',
1221
+ 1129 => 'nejlovelu',
1222
+ 1130 => 'patuleni',
1223
+ 1131 => 'tigveni (ratesti)',
1224
+ 1132 => 'recea',
1225
+ 1133 => 'deagu de jos',
1226
+ 1134 => 'deagu de sus',
1227
+ 1135 => 'orodel',
1228
+ 1136 => 'rociu',
1229
+ 1137 => 'gliganu de jos',
1230
+ 1138 => 'gliganu de sus',
1231
+ 1139 => '?erbanesti (rociu)',
1232
+ 1140 => 'rucar',
1233
+ 1141 => 'satic',
1234
+ 1142 => 'salatrucu',
1235
+ 1143 => 'valeni',
1236
+ 1144 => 'sapata',
1237
+ 1145 => 'banaresti',
1238
+ 1146 => 'dealu bradului',
1239
+ 1147 => 'gainusa',
1240
+ 1148 => 'martesti',
1241
+ 1149 => 'popesti (sapata)',
1242
+ 1150 => 'turcesti',
1243
+ 1151 => 'schitu golesti',
1244
+ 1152 => 'burnesti',
1245
+ 1153 => 'costita',
1246
+ 1154 => 'lazaresti (schitu go',
1247
+ 1155 => 'loturi',
1248
+ 1156 => 'valea pechii',
1249
+ 1157 => 'nigrisoara',
1250
+ 1158 => 'stalpeni',
1251
+ 1159 => 'dealu frumos',
1252
+ 1160 => 'livezeni',
1253
+ 1161 => 'ogrezea',
1254
+ 1162 => 'opresti',
1255
+ 1163 => 'pitigaia',
1256
+ 1164 => 'radesti',
1257
+ 1165 => 'badeni',
1258
+ 1166 => 'cotenesti',
1259
+ 1167 => 'lunca gartii',
1260
+ 1168 => 'piatra (stoenesti)',
1261
+ 1169 => 'slobozia (stoenesti)',
1262
+ 1170 => 'valea badenilor',
1263
+ 1171 => 'stolnici',
1264
+ 1172 => 'cochinesti',
1265
+ 1173 => 'cotmeana (stolnici)',
1266
+ 1174 => 'falfani',
1267
+ 1175 => 'izbasesti',
1268
+ 1176 => 'vlascuta',
1269
+ 1177 => 'burdesti',
1270
+ 1178 => 'cersani',
1271
+ 1179 => 'chiritesti (suseni)',
1272
+ 1180 => 'galasesti (suseni)',
1273
+ 1181 => 'odaeni',
1274
+ 1182 => 'strambeni (suseni)',
1275
+ 1183 => '?tefanesti (suseni)',
1276
+ 1184 => 'tutulesti',
1277
+ 1185 => '?tefan cel mare',
1278
+ 1186 => 'glavacioc',
1279
+ 1187 => '?tefanesti',
1280
+ 1188 => 'enculesti',
1281
+ 1189 => 'golesti (?tefanesti)',
1282
+ 1190 => '?tefanestii noi',
1283
+ 1191 => 'valea mare-podgoria',
1284
+ 1192 => 'viisoara',
1285
+ 1193 => 'zavoi',
1286
+ 1194 => '?uici',
1287
+ 1195 => 'paltenu',
1288
+ 1196 => 'pauleni',
1289
+ 1197 => 'rudeni (?uici)',
1290
+ 1198 => 'valea calului',
1291
+ 1199 => 'teiu',
1292
+ 1200 => 'lesile',
1293
+ 1201 => 'tigveni',
1294
+ 1202 => 'badislava',
1295
+ 1203 => 'balilesti (tigveni)',
1296
+ 1204 => 'barsestii de jos',
1297
+ 1205 => 'barsestii de sus',
1298
+ 1206 => 'blaju',
1299
+ 1207 => 'vladesti (tigveni)',
1300
+ 1208 => 'titesti',
1301
+ 1209 => 'bucsenesti-lotasi',
1302
+ 1210 => 'cismea',
1303
+ 1211 => 'valea manastirii',
1304
+ 1212 => 'valea stanii',
1305
+ 1213 => 'uda',
1306
+ 1214 => 'badulesti',
1307
+ 1215 => 'baranesti',
1308
+ 1216 => 'chiritesti (uda)',
1309
+ 1217 => 'cotu (uda)',
1310
+ 1218 => 'dealu bisericii',
1311
+ 1219 => 'dealu tolcesii',
1312
+ 1220 => 'diconesti',
1313
+ 1221 => 'gorani',
1314
+ 1222 => 'greaban',
1315
+ 1223 => 'lungulesti',
1316
+ 1224 => 'miercani',
1317
+ 1225 => 'rajletu-govora',
1318
+ 1226 => 'romana',
1319
+ 1227 => 'salistea',
1320
+ 1228 => 'ungheni',
1321
+ 1229 => 'coltu',
1322
+ 1230 => 'goia',
1323
+ 1231 => 'humele',
1324
+ 1232 => 'valea danului',
1325
+ 1233 => 'banicesti',
1326
+ 1234 => 'bolculesti',
1327
+ 1235 => 'borobanesti',
1328
+ 1236 => 'vernesti',
1329
+ 1237 => 'valea iasului',
1330
+ 1238 => 'badila',
1331
+ 1239 => 'barbalatesti',
1332
+ 1240 => 'borovinesti',
1333
+ 1241 => 'cerbureni',
1334
+ 1242 => 'mustatesti',
1335
+ 1243 => 'ruginoasa',
1336
+ 1244 => 'ungureni (valea iasu',
1337
+ 1245 => 'valea uleiului',
1338
+ 1246 => 'valea mare-pravat',
1339
+ 1247 => 'bilcesti',
1340
+ 1248 => 'colnic',
1341
+ 1249 => 'fantanea',
1342
+ 1250 => 'gura pravat',
1343
+ 1251 => 'namaesti',
1344
+ 1252 => 'pietroasa',
1345
+ 1253 => '?elari',
1346
+ 1254 => 'badicea',
1347
+ 1255 => 'blejani',
1348
+ 1256 => 'buretesti',
1349
+ 1257 => 'chiritesti (vedea)',
1350
+ 1258 => 'chitani',
1351
+ 1259 => 'ciuresti',
1352
+ 1260 => 'dincani',
1353
+ 1261 => 'fata',
1354
+ 1262 => 'fratici',
1355
+ 1263 => 'izvoru de jos',
1356
+ 1264 => 'izvoru de sus',
1357
+ 1265 => 'lungani',
1358
+ 1266 => 'prodani',
1359
+ 1267 => 'ratoi',
1360
+ 1268 => 'vata',
1361
+ 1269 => 'varsesti',
1362
+ 1270 => 'vetisoara',
1363
+ 1271 => 'vladesti',
1364
+ 1272 => 'coteasca',
1365
+ 1273 => 'draghescu',
1366
+ 1274 => 'putina',
1367
+ 1275 => 'buzau',
1368
+ 1276 => 'nehoiu',
1369
+ 1277 => 'basca rozilei',
1370
+ 1278 => 'chirlesti',
1371
+ 1279 => 'lunca priporului',
1372
+ 1280 => 'mlajet',
1373
+ 1281 => 'nehoiasu',
1374
+ 1282 => 'paltineni',
1375
+ 1283 => 'stanila',
1376
+ 1284 => 'vinetisu',
1377
+ 1285 => 'pogoanele',
1378
+ 1286 => 'caldarasti',
1379
+ 1287 => 'ramnicu sarat',
1380
+ 1288 => 'amaru',
1381
+ 1289 => 'campeni',
1382
+ 1290 => 'dulbanu',
1383
+ 1291 => 'lacu sinaia',
1384
+ 1292 => 'lunca (amaru)',
1385
+ 1293 => 'scorteanca',
1386
+ 1294 => 'balta alba',
1387
+ 1295 => 'amara',
1388
+ 1296 => 'baile',
1389
+ 1297 => 'stavarasti',
1390
+ 1298 => 'balaceanu',
1391
+ 1299 => 'beceni',
1392
+ 1300 => 'arbanasi',
1393
+ 1301 => 'carpinistea',
1394
+ 1302 => 'gura dimienii',
1395
+ 1303 => 'izvoru dulce (beceni',
1396
+ 1304 => 'margariti',
1397
+ 1305 => 'valea parului',
1398
+ 1306 => 'berca',
1399
+ 1307 => 'baceni',
1400
+ 1308 => 'cojanu',
1401
+ 1309 => 'joseni',
1402
+ 1310 => 'manastirea ratesti',
1403
+ 1311 => 'paclele',
1404
+ 1312 => 'plescoi',
1405
+ 1313 => 'plesesti (berca)',
1406
+ 1314 => 'satuc',
1407
+ 1315 => 'tatarligu',
1408
+ 1316 => 'valea nucului',
1409
+ 1317 => 'viforata',
1410
+ 1318 => 'bisoca',
1411
+ 1319 => 'baltagari',
1412
+ 1320 => 'lopatareasa',
1413
+ 1321 => 'plesi',
1414
+ 1322 => 'sarile',
1415
+ 1323 => '?indrila',
1416
+ 1324 => 'blajani',
1417
+ 1325 => 'soresti',
1418
+ 1326 => 'boldu',
1419
+ 1327 => 'bozioru',
1420
+ 1328 => 'buduile',
1421
+ 1329 => 'fisici',
1422
+ 1330 => 'gavanele',
1423
+ 1331 => 'nucu',
1424
+ 1332 => 'scaeni',
1425
+ 1333 => 'ulmet',
1426
+ 1334 => 'vavalucile',
1427
+ 1335 => 'bradeanu',
1428
+ 1336 => 'mitropolia',
1429
+ 1337 => 'smardan',
1430
+ 1338 => 'braesti',
1431
+ 1339 => 'bratilesti',
1432
+ 1340 => 'goidesti',
1433
+ 1341 => 'ivanetu',
1434
+ 1342 => 'parscovelu',
1435
+ 1343 => 'pinu',
1436
+ 1344 => 'greceanca',
1437
+ 1345 => 'valeanca-vilanesti',
1438
+ 1346 => 'vispesti',
1439
+ 1347 => 'alexandru odobescu',
1440
+ 1348 => 'danulesti',
1441
+ 1349 => 'mucesti-danulesti',
1442
+ 1350 => 'spidele',
1443
+ 1351 => 'toropalesti',
1444
+ 1352 => 'c.a. rosetti',
1445
+ 1353 => 'balhacu',
1446
+ 1354 => 'cotu ciorii',
1447
+ 1355 => 'lunca (c.a. rosetti)',
1448
+ 1356 => 'vizireni',
1449
+ 1357 => 'calvini',
1450
+ 1358 => 'bascenii de jos',
1451
+ 1359 => 'bascenii de sus',
1452
+ 1360 => 'canesti',
1453
+ 1361 => 'gontesti',
1454
+ 1362 => 'negosina',
1455
+ 1363 => 'pacurile',
1456
+ 1364 => '?uchea',
1457
+ 1365 => 'valea verzei',
1458
+ 1366 => 'corbu (catina)',
1459
+ 1367 => 'valea catinei',
1460
+ 1368 => 'zeletin',
1461
+ 1369 => 'cernatesti',
1462
+ 1370 => 'aldeni',
1463
+ 1371 => 'baesti',
1464
+ 1372 => 'caldarusa',
1465
+ 1373 => 'manasia',
1466
+ 1374 => 'vladeni',
1467
+ 1375 => 'zarnestii de slanic',
1468
+ 1376 => 'chiliile',
1469
+ 1377 => 'budesti',
1470
+ 1378 => 'crevelesti',
1471
+ 1379 => 'ghiocari',
1472
+ 1380 => 'glodu-petcari',
1473
+ 1381 => 'poiana pletari',
1474
+ 1382 => 'trestioara (chiliile',
1475
+ 1383 => 'chiojdu',
1476
+ 1384 => 'basca chiojdului',
1477
+ 1385 => 'catiasu',
1478
+ 1386 => 'lera',
1479
+ 1387 => 'plescioara',
1480
+ 1388 => 'poenitele',
1481
+ 1389 => 'cilibia',
1482
+ 1390 => 'gara cilibia',
1483
+ 1391 => 'manzu',
1484
+ 1392 => 'movila oii',
1485
+ 1393 => 'posta (cilibia)',
1486
+ 1394 => 'cislau',
1487
+ 1395 => 'buda craciunesti',
1488
+ 1396 => 'gura bascei',
1489
+ 1397 => 'scarisoara',
1490
+ 1398 => 'cochirleanca',
1491
+ 1399 => 'boboc',
1492
+ 1400 => 'gara bobocu',
1493
+ 1401 => 'rosioru',
1494
+ 1402 => 'tarlele',
1495
+ 1403 => 'colti',
1496
+ 1404 => 'coltii de jos',
1497
+ 1405 => 'muscelu caramanesti',
1498
+ 1406 => 'gomoesti',
1499
+ 1407 => 'pietrosu',
1500
+ 1408 => 'spataru',
1501
+ 1409 => 'anini',
1502
+ 1410 => 'balanesti',
1503
+ 1411 => 'bercesti',
1504
+ 1412 => 'cocarceni',
1505
+ 1413 => 'colteni',
1506
+ 1414 => 'fata lui nan',
1507
+ 1415 => 'glodurile',
1508
+ 1416 => 'izvoru (cozieni)',
1509
+ 1417 => 'lungesti',
1510
+ 1418 => 'pietraru',
1511
+ 1419 => 'punga',
1512
+ 1420 => 'teisu',
1513
+ 1421 => 'trestia',
1514
+ 1422 => 'valea banului',
1515
+ 1423 => 'valea roatei',
1516
+ 1424 => 'zapodia',
1517
+ 1425 => 'galbinasi',
1518
+ 1426 => 'bentu',
1519
+ 1427 => 'tabarasti',
1520
+ 1428 => 'gheraseni',
1521
+ 1429 => 'suditi (gheraseni)',
1522
+ 1430 => 'ghergheasa',
1523
+ 1431 => 'glodeanu sarat',
1524
+ 1432 => 'caldaruseanca',
1525
+ 1433 => 'ileana',
1526
+ 1434 => 'pitulicea',
1527
+ 1435 => 'glodeanu-silistea',
1528
+ 1436 => 'casota',
1529
+ 1437 => 'carligu mare',
1530
+ 1438 => 'carligu mic',
1531
+ 1439 => 'corbu (glodeanu-sili',
1532
+ 1440 => 'cotorca',
1533
+ 1441 => 'satu nou (glodeanu-s',
1534
+ 1442 => 'vacareasca',
1535
+ 1443 => 'grebanu',
1536
+ 1444 => 'homesti',
1537
+ 1445 => 'livada',
1538
+ 1446 => 'livada mica',
1539
+ 1447 => 'plevna',
1540
+ 1448 => 'zaplazi',
1541
+ 1449 => 'gura teghii',
1542
+ 1450 => 'furtunesti',
1543
+ 1451 => 'nemertea',
1544
+ 1452 => 'paltinis',
1545
+ 1453 => 'secuiu',
1546
+ 1454 => 'vadu oii',
1547
+ 1455 => 'largu',
1548
+ 1456 => 'scarlatesti',
1549
+ 1457 => 'lopatari',
1550
+ 1458 => 'fundata',
1551
+ 1459 => 'luncile',
1552
+ 1460 => 'pestritu',
1553
+ 1461 => 'plaiu nucului',
1554
+ 1462 => 'plostina',
1555
+ 1463 => 'potecu',
1556
+ 1464 => 'sareni',
1557
+ 1465 => 'terca',
1558
+ 1466 => 'luciu',
1559
+ 1467 => 'caragele',
1560
+ 1468 => 'ciuta',
1561
+ 1469 => 'unguriu',
1562
+ 1470 => 'capatanesti',
1563
+ 1471 => 'potoceni',
1564
+ 1472 => 'margaritesti',
1565
+ 1473 => 'campulungeanca',
1566
+ 1474 => 'fantanele (margarite',
1567
+ 1475 => 'manzalesti',
1568
+ 1476 => 'beslii',
1569
+ 1477 => 'bustea',
1570
+ 1478 => 'ghizdita',
1571
+ 1479 => 'gura badicului',
1572
+ 1480 => 'jghiab',
1573
+ 1481 => 'plavatu',
1574
+ 1482 => 'poiana valcului',
1575
+ 1483 => 'satu vechi',
1576
+ 1484 => 'trestioara (manzales',
1577
+ 1485 => 'valea cotoarei',
1578
+ 1486 => 'merei',
1579
+ 1487 => 'ciobanoaia',
1580
+ 1488 => 'dealu viei',
1581
+ 1489 => 'dobrilesti',
1582
+ 1490 => 'gura saratii',
1583
+ 1491 => 'izvoru dulce (merei)',
1584
+ 1492 => 'nenciulesti',
1585
+ 1493 => 'ograzile',
1586
+ 1494 => 'sarata-monteoru',
1587
+ 1495 => 'valea putului merei',
1588
+ 1496 => 'coltaneni',
1589
+ 1497 => 'florica',
1590
+ 1498 => 'margineanu',
1591
+ 1499 => 'satu nou (mihailesti',
1592
+ 1500 => 'movila banului',
1593
+ 1501 => 'cioranca',
1594
+ 1502 => 'limpezis',
1595
+ 1503 => 'murgesti',
1596
+ 1504 => 'batogu',
1597
+ 1505 => 'valea ratei',
1598
+ 1506 => 'naeni',
1599
+ 1507 => 'fantanele (naeni)',
1600
+ 1508 => 'fintesti',
1601
+ 1509 => 'prosca',
1602
+ 1510 => 'varf',
1603
+ 1511 => 'capu satului',
1604
+ 1512 => 'corneanu',
1605
+ 1513 => 'lacu',
1606
+ 1514 => 'piatra alba',
1607
+ 1515 => 'posobesti',
1608
+ 1516 => 'scorosesti',
1609
+ 1517 => 'valea fantanei',
1610
+ 1518 => 'valea ?tefanului',
1611
+ 1519 => 'padina',
1612
+ 1520 => 'tatulesti',
1613
+ 1521 => 'pardosi',
1614
+ 1522 => 'chiperu',
1615
+ 1523 => 'costomiru',
1616
+ 1524 => 'valea ?chiopului',
1617
+ 1525 => 'valea lui lalu',
1618
+ 1526 => 'panatau',
1619
+ 1527 => 'begu',
1620
+ 1528 => 'lacu cu anini',
1621
+ 1529 => 'maguricea',
1622
+ 1530 => 'plaisor',
1623
+ 1531 => 'rapile',
1624
+ 1532 => 'sibiciu de jos',
1625
+ 1533 => 'tega',
1626
+ 1534 => 'zaharesti',
1627
+ 1535 => 'patarlagele',
1628
+ 1536 => 'calea chiojdului',
1629
+ 1537 => 'crang',
1630
+ 1538 => 'fundaturile',
1631
+ 1539 => 'lunca (patarlagele)',
1632
+ 1540 => 'manastirea',
1633
+ 1541 => 'maruntisu',
1634
+ 1542 => 'sibiciu de sus',
1635
+ 1543 => 'valea lupului',
1636
+ 1544 => 'valea sibiciului',
1637
+ 1545 => 'valea viei',
1638
+ 1546 => 'parscov',
1639
+ 1547 => 'curcanesti',
1640
+ 1548 => 'lunca frumoasa',
1641
+ 1549 => 'olesesti',
1642
+ 1550 => 'parjolesti',
1643
+ 1551 => 'robesti',
1644
+ 1552 => 'tarcov',
1645
+ 1553 => 'tocileni',
1646
+ 1554 => 'valea purcarului',
1647
+ 1555 => 'pietroasele',
1648
+ 1556 => 'caltesti',
1649
+ 1557 => 'clondiru de sus',
1650
+ 1558 => 'dara',
1651
+ 1559 => 'pietroasa mica',
1652
+ 1560 => '?aranga',
1653
+ 1561 => 'cotatcu',
1654
+ 1562 => 'oratia',
1655
+ 1563 => 'plesesti (podgoria)',
1656
+ 1564 => 'tabacari',
1657
+ 1565 => 'posta calnau',
1658
+ 1566 => 'aliceni',
1659
+ 1567 => 'coconari',
1660
+ 1568 => 'potarnichesti',
1661
+ 1569 => 'suditi (posta calnau',
1662
+ 1570 => 'zilisteanca',
1663
+ 1571 => 'puiesti',
1664
+ 1572 => 'dascalesti',
1665
+ 1573 => 'lunca (puiesti)',
1666
+ 1574 => 'macrina',
1667
+ 1575 => 'nicolesti',
1668
+ 1576 => 'plopi',
1669
+ 1577 => 'puiestii de jos',
1670
+ 1578 => 'puiestii de sus',
1671
+ 1579 => 'racoviteni',
1672
+ 1580 => 'budrea',
1673
+ 1581 => 'petrisoru',
1674
+ 1582 => 'ramnicelu',
1675
+ 1583 => 'fotin',
1676
+ 1584 => '?tiubei',
1677
+ 1585 => 'robeasca',
1678
+ 1586 => 'mosesti',
1679
+ 1587 => 'rusetu',
1680
+ 1588 => 'sergent ionel ?tefan',
1681
+ 1589 => 'sageata',
1682
+ 1590 => 'banita',
1683
+ 1591 => 'beilic',
1684
+ 1592 => 'bordusani',
1685
+ 1593 => 'dambroca',
1686
+ 1594 => 'gavanesti',
1687
+ 1595 => 'movilita',
1688
+ 1596 => 'sahateni',
1689
+ 1597 => 'istrita de jos',
1690
+ 1598 => 'vintileanca',
1691
+ 1599 => 'sapoca',
1692
+ 1600 => 'matesti',
1693
+ 1601 => 'sarulesti',
1694
+ 1602 => 'caratnau de jos',
1695
+ 1603 => 'caratnau de sus',
1696
+ 1604 => 'goicelu',
1697
+ 1605 => 'sarile-catun',
1698
+ 1606 => 'valea larga-sarulest',
1699
+ 1607 => 'valea stanei',
1700
+ 1608 => 'scortoasa',
1701
+ 1609 => 'balta tocila',
1702
+ 1610 => 'beciu',
1703
+ 1611 => 'dalma',
1704
+ 1612 => 'deleni',
1705
+ 1613 => 'golu grabicina',
1706
+ 1614 => 'grabicina de jos',
1707
+ 1615 => 'grabicina de sus',
1708
+ 1616 => 'plopeasa',
1709
+ 1617 => 'policiori',
1710
+ 1618 => 'scutelnici',
1711
+ 1619 => 'arcanu',
1712
+ 1620 => 'bragareasa',
1713
+ 1621 => 'lipanescu',
1714
+ 1622 => 'siriu',
1715
+ 1623 => 'casoca',
1716
+ 1624 => 'coltu pietrii',
1717
+ 1625 => 'gura siriului',
1718
+ 1626 => 'muscelusa',
1719
+ 1627 => 'lunca jaristei',
1720
+ 1628 => 'smeeni',
1721
+ 1629 => 'balaia',
1722
+ 1630 => 'caltuna',
1723
+ 1631 => 'moisica',
1724
+ 1632 => 'udati-lucieni',
1725
+ 1633 => 'udati-manzu',
1726
+ 1634 => 'tisau',
1727
+ 1635 => 'barbuncesti',
1728
+ 1636 => 'grajdana',
1729
+ 1637 => 'hales',
1730
+ 1638 => 'izvoranu',
1731
+ 1639 => 'izvoru (tisau)',
1732
+ 1640 => 'leiculesti',
1733
+ 1641 => 'padurenii',
1734
+ 1642 => 'strezeni',
1735
+ 1643 => 'valea salciilor',
1736
+ 1644 => 'topliceni',
1737
+ 1645 => 'babeni',
1738
+ 1646 => 'ceairu',
1739
+ 1647 => 'gura fagetului',
1740
+ 1648 => 'posta (topliceni)',
1741
+ 1649 => 'raducesti',
1742
+ 1650 => 'tintesti',
1743
+ 1651 => 'maxenu',
1744
+ 1652 => 'odaia banului',
1745
+ 1653 => 'pogonele',
1746
+ 1654 => 'ulmeni',
1747
+ 1655 => 'baltareti',
1748
+ 1656 => 'clondiru',
1749
+ 1657 => 'sarata',
1750
+ 1658 => 'valcele',
1751
+ 1659 => 'vadu pasii',
1752
+ 1660 => 'bajani',
1753
+ 1661 => 'focsanei',
1754
+ 1662 => 'gura calnaului',
1755
+ 1663 => 'valea ramnicului',
1756
+ 1664 => 'oreavul',
1757
+ 1665 => 'rubla',
1758
+ 1666 => 'valea salciei',
1759
+ 1667 => 'modreni',
1760
+ 1668 => 'valea salciei-catun',
1761
+ 1669 => 'bradeanca',
1762
+ 1670 => 'carlomanesti',
1763
+ 1671 => 'mierea',
1764
+ 1672 => 'nenciu',
1765
+ 1673 => 'niscov',
1766
+ 1674 => 'sasenii noi',
1767
+ 1675 => 'sasenii vechi',
1768
+ 1676 => 'sasenii pe vale',
1769
+ 1677 => 'zoresti',
1770
+ 1678 => 'vintila voda',
1771
+ 1679 => 'bodinesti',
1772
+ 1680 => 'coca-antimiresti',
1773
+ 1681 => 'coca-niculesti',
1774
+ 1682 => 'niculesti',
1775
+ 1683 => 'petrachesti',
1776
+ 1684 => 'podu muncii',
1777
+ 1685 => 'sarbesti',
1778
+ 1686 => 'smeesti',
1779
+ 1687 => 'viperesti',
1780
+ 1688 => 'palici',
1781
+ 1689 => 'rusavat',
1782
+ 1690 => 'tronari',
1783
+ 1691 => 'comisoaia',
1784
+ 1692 => 'pruneni',
1785
+ 1693 => 'vadu soresti',
1786
+ 1694 => 'ziduri',
1787
+ 1695 => 'costieni',
1788
+ 1696 => 'cuculeasa',
1789
+ 1697 => 'heliade radulescu',
1790
+ 1698 => 'lanurile',
1791
+ 1699 => 'zoita',
1792
+ 1700 => 'targoviste',
1793
+ 1701 => 'fieni',
1794
+ 1702 => 'gaesti',
1795
+ 1703 => 'moreni',
1796
+ 1704 => 'pucioasa',
1797
+ 1705 => 'bela',
1798
+ 1706 => 'diaconesti',
1799
+ 1707 => 'glodeni (pucioasa)',
1800
+ 1708 => 'malurile',
1801
+ 1709 => 'miculesti',
1802
+ 1710 => 'pucioasa-sat',
1803
+ 1711 => 'titu',
1804
+ 1712 => 'fusea',
1805
+ 1713 => 'hagioaica',
1806
+ 1714 => 'mereni (titu)',
1807
+ 1715 => 'salcuta',
1808
+ 1716 => 'sateni',
1809
+ 1717 => 'baleni',
1810
+ 1718 => 'baleni-sarbi',
1811
+ 1719 => 'baleni-romani',
1812
+ 1720 => 'barbuletu',
1813
+ 1721 => 'dupa deal',
1814
+ 1722 => 'gura barbuletului',
1815
+ 1723 => 'pietrari',
1816
+ 1724 => 'rau alb de jos',
1817
+ 1725 => 'rau alb de sus',
1818
+ 1726 => '?ipot',
1819
+ 1727 => 'valea',
1820
+ 1728 => 'bezdead',
1821
+ 1729 => 'brosteni (bezdead)',
1822
+ 1730 => 'costisata',
1823
+ 1731 => 'magura (bezdead)',
1824
+ 1732 => 'valea morii',
1825
+ 1733 => 'bilciuresti',
1826
+ 1734 => 'suseni-socetu',
1827
+ 1735 => 'savesti',
1828
+ 1736 => 'priboiu (branesti)',
1829
+ 1737 => 'brezoaele',
1830
+ 1738 => 'brezoaia',
1831
+ 1739 => 'dealu mare',
1832
+ 1740 => 'valea leurzii',
1833
+ 1741 => 'habeni',
1834
+ 1742 => 'ratoaia',
1835
+ 1743 => 'butimanu',
1836
+ 1744 => 'barbuceanu',
1837
+ 1745 => 'lucianca',
1838
+ 1746 => 'ungureni (butimanu)',
1839
+ 1747 => 'aninosani',
1840
+ 1748 => 'candesti-deal',
1841
+ 1749 => 'candesti-vale',
1842
+ 1750 => 'dragodanesti',
1843
+ 1751 => 'valea mare (candesti',
1844
+ 1752 => 'cretu',
1845
+ 1753 => 'decindea',
1846
+ 1754 => 'urziceanca',
1847
+ 1755 => 'vizuresti',
1848
+ 1756 => 'cobia',
1849
+ 1757 => 'blidari',
1850
+ 1758 => 'calugareni (cobia)',
1851
+ 1759 => 'capsuna',
1852
+ 1760 => 'cobiuta',
1853
+ 1761 => 'craciunesti',
1854
+ 1762 => 'frasin-deal',
1855
+ 1763 => 'frasin-vale',
1856
+ 1764 => 'gherghitesti',
1857
+ 1765 => 'cojasca',
1858
+ 1766 => 'comisani',
1859
+ 1767 => 'lazuri',
1860
+ 1768 => 'calugareni (contesti',
1861
+ 1769 => 'crangasi',
1862
+ 1770 => 'gamanesti',
1863
+ 1771 => 'helesteu',
1864
+ 1772 => 'mereni (contesti)',
1865
+ 1773 => 'corbii mari',
1866
+ 1774 => 'baraceni',
1867
+ 1775 => 'grozavesti',
1868
+ 1776 => 'moara din groapa',
1869
+ 1777 => 'petresti (corbii mar',
1870
+ 1778 => 'podu corbencii',
1871
+ 1779 => 'ungureni (corbii mar',
1872
+ 1780 => 'vadu stanchii',
1873
+ 1781 => 'cornatelu',
1874
+ 1782 => 'bolovani',
1875
+ 1783 => 'corni',
1876
+ 1784 => 'cornesti',
1877
+ 1785 => 'bujoreanca',
1878
+ 1786 => 'catunu (cornesti)',
1879
+ 1787 => 'cristeasca',
1880
+ 1788 => 'hodarasti',
1881
+ 1789 => 'ibrianu',
1882
+ 1790 => 'postarnacu',
1883
+ 1791 => 'ungureni (cornesti)',
1884
+ 1792 => 'costestii din vale',
1885
+ 1793 => 'crangurile de jos',
1886
+ 1794 => 'crangurile de sus',
1887
+ 1795 => 'patroaia-deal',
1888
+ 1796 => 'patroaia-vale',
1889
+ 1797 => 'potlogeni-vale',
1890
+ 1798 => 'voia',
1891
+ 1799 => 'crevedia',
1892
+ 1800 => 'cocani',
1893
+ 1801 => 'darza',
1894
+ 1802 => 'samurcasi',
1895
+ 1803 => 'marginenii de sus',
1896
+ 1804 => 'dobra',
1897
+ 1805 => 'marcesti',
1898
+ 1806 => 'doicesti',
1899
+ 1807 => 'dragodana',
1900
+ 1808 => 'burduca',
1901
+ 1809 => 'cuparu',
1902
+ 1810 => 'picior de munte',
1903
+ 1811 => 'dragomiresti',
1904
+ 1812 => 'decindeni',
1905
+ 1813 => 'geangoesti',
1906
+ 1814 => 'ungureni (dragomires',
1907
+ 1815 => 'finta',
1908
+ 1816 => 'bechinesti',
1909
+ 1817 => 'finta mare',
1910
+ 1818 => 'finta veche',
1911
+ 1819 => 'gheboaia',
1912
+ 1820 => 'glodeni',
1913
+ 1821 => 'gusoiu',
1914
+ 1822 => 'laculete',
1915
+ 1823 => 'livezile (glodeni)',
1916
+ 1824 => 'malu mierii',
1917
+ 1825 => 'gura foii',
1918
+ 1826 => 'bumbuia',
1919
+ 1827 => 'gura ocnitei',
1920
+ 1828 => 'adanca',
1921
+ 1829 => 'ochiuri',
1922
+ 1830 => 'sacueni',
1923
+ 1831 => 'gura ?utii',
1924
+ 1832 => 'sperieteni',
1925
+ 1833 => 'butoiu de jos',
1926
+ 1834 => 'butoiu de sus',
1927
+ 1835 => 'magura (hulubesti)',
1928
+ 1836 => 'valea dadei',
1929
+ 1837 => 'i. l. caragiale',
1930
+ 1838 => 'ghirdoveni',
1931
+ 1839 => 'mija',
1932
+ 1840 => 'iedera',
1933
+ 1841 => 'cricovu dulce',
1934
+ 1842 => 'iedera de jos',
1935
+ 1843 => 'iedera de sus',
1936
+ 1844 => 'olteni (lucieni)',
1937
+ 1845 => 'raciu',
1938
+ 1846 => 'silistea (lucieni)',
1939
+ 1847 => '?uta seaca',
1940
+ 1848 => 'ludesti',
1941
+ 1849 => 'milosari',
1942
+ 1850 => 'potocelu',
1943
+ 1851 => 'scheiu de jos',
1944
+ 1852 => 'scheiu de sus',
1945
+ 1853 => 'telesti',
1946
+ 1854 => 'lunguletu',
1947
+ 1855 => 'oreasca',
1948
+ 1856 => 'serdanu',
1949
+ 1857 => 'malu cu flori',
1950
+ 1858 => 'capu coastei',
1951
+ 1859 => 'miclosanii mari',
1952
+ 1860 => 'miclosanii mici',
1953
+ 1861 => 'dragaesti-pamanteni',
1954
+ 1862 => 'dragaesti-ungureni',
1955
+ 1863 => 'matasaru',
1956
+ 1864 => 'cretulesti',
1957
+ 1865 => 'odaia turcului',
1958
+ 1866 => 'poroinica',
1959
+ 1867 => 'putu cu salcie',
1960
+ 1868 => 'salcioara (matasaru)',
1961
+ 1869 => 'tetcoiu',
1962
+ 1870 => 'mogosani',
1963
+ 1871 => 'chirca',
1964
+ 1872 => 'cojocaru',
1965
+ 1873 => 'merii',
1966
+ 1874 => 'zavoiu',
1967
+ 1875 => 'moroeni',
1968
+ 1876 => 'lunca (moroeni)',
1969
+ 1877 => 'pucheni (moroeni)',
1970
+ 1878 => 'morteni',
1971
+ 1879 => 'motaieni',
1972
+ 1880 => 'cucuteni',
1973
+ 1881 => 'ciocanari',
1974
+ 1882 => 'movila (niculesti)',
1975
+ 1883 => 'nucet',
1976
+ 1884 => 'cazaci',
1977
+ 1885 => 'ilfoveni',
1978
+ 1886 => 'ocnita',
1979
+ 1887 => 'odobesti',
1980
+ 1888 => 'brancoveanu',
1981
+ 1889 => 'crovu',
1982
+ 1890 => 'miulesti',
1983
+ 1891 => 'gherghesti',
1984
+ 1892 => 'greci',
1985
+ 1893 => 'potlogeni-deal',
1986
+ 1894 => 'puntea de greci',
1987
+ 1895 => 'pietrosita',
1988
+ 1896 => 'potlogi',
1989
+ 1897 => 'pitaru',
1990
+ 1898 => 'podu cristinii',
1991
+ 1899 => 'vlasceni',
1992
+ 1900 => 'produlesti',
1993
+ 1901 => 'brosteni (produlesti',
1994
+ 1902 => 'costestii din deal',
1995
+ 1903 => 'pucheni',
1996
+ 1904 => 'bradatel',
1997
+ 1905 => 'meisoare',
1998
+ 1906 => 'varfureni',
1999
+ 1907 => 'racari',
2000
+ 1908 => 'colacu',
2001
+ 1909 => 'ghergani',
2002
+ 1910 => 'mavrodin',
2003
+ 1911 => 'sabiesti',
2004
+ 1912 => 'razvad',
2005
+ 1913 => 'valea voievozilor',
2006
+ 1914 => 'ferestre',
2007
+ 1915 => 'piatra',
2008
+ 1916 => 'silistea (runcu)',
2009
+ 1917 => 'catunu (salcioara)',
2010
+ 1918 => 'cuza voda',
2011
+ 1919 => 'ghinesti',
2012
+ 1920 => 'mircea voda',
2013
+ 1921 => 'movila (salcioara)',
2014
+ 1922 => 'podu rizii',
2015
+ 1923 => 'slobozia moara',
2016
+ 1924 => '?elaru',
2017
+ 1925 => 'fierbinti',
2018
+ 1926 => 'glogoveanu',
2019
+ 1927 => '?otanga',
2020
+ 1928 => 'teis',
2021
+ 1929 => 'tartasesti',
2022
+ 1930 => 'baldana',
2023
+ 1931 => 'gulia',
2024
+ 1932 => 'caprioru',
2025
+ 1933 => 'gheboieni',
2026
+ 1934 => 'priboiu (tatarani)',
2027
+ 1935 => 'uliesti',
2028
+ 1936 => 'croitori',
2029
+ 1937 => 'hanu lui pala',
2030
+ 1938 => 'manastioara',
2031
+ 1939 => 'olteni (uliesti)',
2032
+ 1940 => 'ragu',
2033
+ 1941 => 'stavropolia',
2034
+ 1942 => 'colanu',
2035
+ 1943 => 'dimoiu',
2036
+ 1944 => 'matraca',
2037
+ 1945 => 'nisipurile',
2038
+ 1946 => 'valea lunga',
2039
+ 1947 => 'izvoru (valea lunga)',
2040
+ 1948 => 'mosia mica',
2041
+ 1949 => '?erbaneasa',
2042
+ 1950 => '?tubeie tisa',
2043
+ 1951 => 'valea lunga-gorgota',
2044
+ 1952 => 'valea lunga-ogrea',
2045
+ 1953 => 'valea mare (valea lu',
2046
+ 1954 => 'valea lunga-cricov',
2047
+ 1955 => 'valea lui dan',
2048
+ 1956 => 'feteni',
2049
+ 1957 => 'garleni',
2050
+ 1958 => 'livezile (valea mare',
2051
+ 1959 => 'saru',
2052
+ 1960 => 'stratonesti',
2053
+ 1961 => 'valea caselor',
2054
+ 1962 => 'vacaresti',
2055
+ 1963 => 'bratestii de jos',
2056
+ 1964 => 'bungetu',
2057
+ 1965 => 'persinari',
2058
+ 1966 => 'valeni-dambovita',
2059
+ 1967 => 'mesteacan',
2060
+ 1968 => 'varfuri',
2061
+ 1969 => 'carlanesti',
2062
+ 1970 => 'cojoiu',
2063
+ 1971 => 'merisoru',
2064
+ 1972 => 'statesti',
2065
+ 1973 => '?uvita',
2066
+ 1974 => 'ulmetu',
2067
+ 1975 => 'visina',
2068
+ 1976 => 'brosteni (visina)',
2069
+ 1977 => 'izvoru (visina)',
2070
+ 1978 => 'rascaeti',
2071
+ 1979 => 'vultureanca',
2072
+ 1980 => 'visinesti',
2073
+ 1981 => 'dospinesti',
2074
+ 1982 => 'sultanu',
2075
+ 1983 => 'urseiu',
2076
+ 1984 => 'gemenea-bratulesti',
2077
+ 1985 => 'lunca (voinesti)',
2078
+ 1986 => 'manga',
2079
+ 1987 => 'manjina',
2080
+ 1988 => 'suduleni',
2081
+ 1989 => 'vulcana-bai',
2082
+ 1990 => 'nicolaesti',
2083
+ 1991 => 'vulcana de sus',
2084
+ 1992 => 'vulcana-pandele',
2085
+ 1993 => 'gura vulcanei',
2086
+ 1994 => 'laculete-gara',
2087
+ 1995 => 'toculesti',
2088
+ 1996 => 'alexandria',
2089
+ 1997 => 'rosiori de vede',
2090
+ 1998 => 'turnu magurele',
2091
+ 1999 => 'videle',
2092
+ 2000 => 'cosoaia',
2093
+ 2001 => 'zimnicea',
2094
+ 2002 => 'balaci',
2095
+ 2003 => 'burdeni',
2096
+ 2004 => 'tecuci',
2097
+ 2005 => 'babaita',
2098
+ 2006 => 'clanita',
2099
+ 2007 => 'merisani (babaita)',
2100
+ 2008 => 'blejesti',
2101
+ 2009 => 'baciu',
2102
+ 2010 => 'sericu',
2103
+ 2011 => 'bogdana',
2104
+ 2012 => 'brosteanca',
2105
+ 2013 => 'urluiu',
2106
+ 2014 => 'botoroaga',
2107
+ 2015 => 'calugaru',
2108
+ 2016 => 'tarnava',
2109
+ 2017 => 'valea ciresului',
2110
+ 2018 => 'branceni',
2111
+ 2019 => 'darvas',
2112
+ 2020 => 'prunaru',
2113
+ 2021 => 'bujoru',
2114
+ 2022 => 'buzescu',
2115
+ 2023 => 'antonesti',
2116
+ 2024 => 'copaceanca',
2117
+ 2025 => 'licuriciu',
2118
+ 2026 => 'marita',
2119
+ 2027 => 'calmatuiu',
2120
+ 2028 => 'bujoru (calmatuiu)',
2121
+ 2029 => 'caravaneti',
2122
+ 2030 => 'nicolae balcescu',
2123
+ 2031 => 'calmatuiu de sus',
2124
+ 2032 => 'bacalesti',
2125
+ 2033 => 'ionascu',
2126
+ 2034 => 'cervenia',
2127
+ 2035 => 'ciolanesti',
2128
+ 2036 => 'baldovinesti',
2129
+ 2037 => 'ciolanestii din deal',
2130
+ 2038 => 'ciolanestii din vale',
2131
+ 2039 => 'ciuperceni',
2132
+ 2040 => 'cosmesti',
2133
+ 2041 => 'ciuperceni (cosmesti',
2134
+ 2042 => 'crangeni',
2135
+ 2043 => 'balta sarata',
2136
+ 2044 => 'dorobantu',
2137
+ 2045 => 'stejaru (crangeni)',
2138
+ 2046 => 'crangu',
2139
+ 2047 => 'dracea',
2140
+ 2048 => 'secara',
2141
+ 2049 => 'zlata',
2142
+ 2050 => 'crevenicu',
2143
+ 2051 => 'radulesti',
2144
+ 2052 => 'didesti',
2145
+ 2053 => '?nsuratei',
2146
+ 2054 => 'dobrotesti',
2147
+ 2055 => 'merisani (dobrotesti',
2148
+ 2056 => 'dracsenei',
2149
+ 2057 => 'beuca',
2150
+ 2058 => 'dracsani',
2151
+ 2059 => 'odobeasca',
2152
+ 2060 => 'satul vechi',
2153
+ 2061 => 'draganesti de vede',
2154
+ 2062 => 'magura cu liliac',
2155
+ 2063 => 'draganesti-vlasca',
2156
+ 2064 => 'comoara',
2157
+ 2065 => 'vaceni',
2158
+ 2066 => 'frumoasa',
2159
+ 2067 => 'pauleasca',
2160
+ 2068 => 'furculesti',
2161
+ 2069 => 'mosteni (furculesti)',
2162
+ 2070 => 'spatarei',
2163
+ 2071 => 'voievoda',
2164
+ 2072 => 'galateni',
2165
+ 2073 => 'bascoveni',
2166
+ 2074 => 'gradisteanca',
2167
+ 2075 => 'gratia',
2168
+ 2076 => 'ciurari-deal',
2169
+ 2077 => 'draghinesti',
2170
+ 2078 => 'moldoveni',
2171
+ 2079 => 'lisa',
2172
+ 2080 => 'lita',
2173
+ 2081 => 'pleasov',
2174
+ 2082 => 'saelele',
2175
+ 2083 => 'paru rotund',
2176
+ 2084 => 'guruieni',
2177
+ 2085 => 'maldaeni',
2178
+ 2086 => 'marzanesti',
2179
+ 2087 => 'cernetu',
2180
+ 2088 => 'teleormanu',
2181
+ 2089 => 'mereni',
2182
+ 2090 => 'merenii de jos',
2183
+ 2091 => 'merenii de sus',
2184
+ 2092 => '?tefeni',
2185
+ 2093 => 'nanov',
2186
+ 2094 => 'nasturelu',
2187
+ 2095 => 'zimnicele',
2188
+ 2096 => 'necsesti',
2189
+ 2097 => 'gardesti',
2190
+ 2098 => 'perii brosteni',
2191
+ 2099 => 'orbeasca',
2192
+ 2100 => 'orbeasca de jos',
2193
+ 2101 => 'orbeasca de sus',
2194
+ 2102 => 'peretu',
2195
+ 2103 => 'plopii-slavitesti',
2196
+ 2104 => 'brancoveanca',
2197
+ 2105 => 'plosca',
2198
+ 2106 => 'poeni',
2199
+ 2107 => 'banov',
2200
+ 2108 => 'catunu',
2201
+ 2109 => 'preajba',
2202
+ 2110 => 'tavarlau',
2203
+ 2111 => 'vatasi',
2204
+ 2112 => 'poroschia',
2205
+ 2113 => 'calomfiresti',
2206
+ 2114 => 'baduleasa',
2207
+ 2115 => 'carlomanu',
2208
+ 2116 => 'radoiesti',
2209
+ 2117 => 'radoiesti-deal',
2210
+ 2118 => 'radoiesti-vale',
2211
+ 2119 => 'rasmiresti',
2212
+ 2120 => 'ludaneasca',
2213
+ 2121 => 'tudor vladimirescu',
2214
+ 2122 => 'saceni',
2215
+ 2123 => 'butculesti',
2216
+ 2124 => 'ciurari',
2217
+ 2125 => 'sarbeni',
2218
+ 2126 => 'sarbenii de jos',
2219
+ 2127 => 'udeni',
2220
+ 2128 => 'scrioastea',
2221
+ 2129 => 'brebina',
2222
+ 2130 => 'cucueti',
2223
+ 2131 => 'viile',
2224
+ 2132 => 'scurtu mare',
2225
+ 2133 => 'albeni',
2226
+ 2134 => 'dracesti',
2227
+ 2135 => 'negrilesti',
2228
+ 2136 => 'scurtu-slavesti',
2229
+ 2137 => 'valea postei',
2230
+ 2138 => 'seaca',
2231
+ 2139 => 'navodari',
2232
+ 2140 => 'segarcea-vale',
2233
+ 2141 => 'olteanca',
2234
+ 2142 => 'segarcea-deal',
2235
+ 2143 => 'sfintesti',
2236
+ 2144 => 'butesti',
2237
+ 2145 => 'purani (silistea)',
2238
+ 2146 => 'puranii de sus',
2239
+ 2147 => 'silistea mica',
2240
+ 2148 => 'silistea gumesti',
2241
+ 2149 => 'slobozia mandra',
2242
+ 2150 => 'uda-clocociov',
2243
+ 2151 => 'uda-paciurea',
2244
+ 2152 => 'smardioasa',
2245
+ 2153 => '?oimu',
2246
+ 2154 => 'bratcovu',
2247
+ 2155 => 'socetu',
2248
+ 2156 => 'suhaia',
2249
+ 2157 => '?torobaneasa',
2250
+ 2158 => 'beiu',
2251
+ 2159 => 'talpa',
2252
+ 2160 => 'linia costii',
2253
+ 2161 => 'rotaresti',
2254
+ 2162 => 'talpa postei',
2255
+ 2163 => 'talpa-bascoveni',
2256
+ 2164 => 'talpa-ograzile',
2257
+ 2165 => 'tatarastii de jos',
2258
+ 2166 => 'lada',
2259
+ 2167 => 'negrenii de sus',
2260
+ 2168 => 'negrenii-osebiti',
2261
+ 2169 => 'obartu',
2262
+ 2170 => 'slavesti',
2263
+ 2171 => 'tatarastii de sus',
2264
+ 2172 => 'udupu',
2265
+ 2173 => 'traian',
2266
+ 2174 => 'trivalea-mosteni',
2267
+ 2175 => 'bratasani',
2268
+ 2176 => 'deparati',
2269
+ 2177 => 'troianul',
2270
+ 2178 => 'dulceni',
2271
+ 2179 => 'vatra',
2272
+ 2180 => 'vartoape',
2273
+ 2181 => 'garagau',
2274
+ 2182 => 'vartoapele de jos',
2275
+ 2183 => 'vartoapele de sus',
2276
+ 2184 => 'cosoteni',
2277
+ 2185 => 'dulceanca',
2278
+ 2186 => 'vitanesti',
2279
+ 2187 => 'purani (vitanesti)',
2280
+ 2188 => 'schitu poienari',
2281
+ 2189 => 'silistea (vitanesti)',
2282
+ 2190 => 'zambreasca',
2283
+ 2191 => 'facai',
2284
+ 2192 => 'mofleni',
2285
+ 2193 => 'popoveni',
2286
+ 2194 => '?imnicu de jos',
2287
+ 2195 => 'craiova',
2288
+ 2196 => 'bailesti',
2289
+ 2197 => 'balasan',
2290
+ 2198 => 'calafat',
2291
+ 2199 => 'basarabi',
2292
+ 2200 => 'ciupercenii vechi',
2293
+ 2201 => 'golenti',
2294
+ 2202 => 'filiasi',
2295
+ 2203 => 'almajel',
2296
+ 2204 => 'balta',
2297
+ 2205 => 'braniste (filiasi)',
2298
+ 2206 => 'fratostita',
2299
+ 2207 => 'racarii de sus',
2300
+ 2208 => 'uscaci',
2301
+ 2209 => '?egarcea',
2302
+ 2210 => 'boureni',
2303
+ 2211 => 'covei',
2304
+ 2212 => 'almaj',
2305
+ 2213 => 'beharca',
2306
+ 2214 => 'bogea',
2307
+ 2215 => 'cotofenii din fata',
2308
+ 2216 => 'mosneni',
2309
+ 2217 => '?itoaia',
2310
+ 2218 => 'amarastii de jos',
2311
+ 2219 => 'ocolna',
2312
+ 2220 => 'prapor',
2313
+ 2221 => 'amarastii de sus',
2314
+ 2222 => 'nisipuri',
2315
+ 2223 => 'zvorsca',
2316
+ 2224 => 'apele vii',
2317
+ 2225 => 'argetoaia',
2318
+ 2226 => 'baranu',
2319
+ 2227 => 'berbesu',
2320
+ 2228 => 'iordachesti',
2321
+ 2229 => 'leordoasa',
2322
+ 2230 => 'malumnic',
2323
+ 2231 => 'novac',
2324
+ 2232 => 'piria',
2325
+ 2233 => 'poiana fantanii',
2326
+ 2234 => 'teascu din deal',
2327
+ 2235 => 'barca',
2328
+ 2236 => 'bechet',
2329
+ 2237 => 'bistret',
2330
+ 2238 => 'bistretu nou',
2331
+ 2239 => 'brandusa',
2332
+ 2240 => 'botosesti-paia',
2333
+ 2241 => 'brabova',
2334
+ 2242 => 'caraiman',
2335
+ 2243 => 'mosna',
2336
+ 2244 => 'rachita de jos',
2337
+ 2245 => 'urdinita',
2338
+ 2246 => 'voita',
2339
+ 2247 => 'bralostita',
2340
+ 2248 => 'ciocanele',
2341
+ 2249 => 'sfircea',
2342
+ 2250 => 'valea fantanilor',
2343
+ 2251 => 'bratovoesti',
2344
+ 2252 => 'badosi',
2345
+ 2253 => 'georocu mare',
2346
+ 2254 => 'prunet',
2347
+ 2255 => 'rojiste',
2348
+ 2256 => 'tamburesti',
2349
+ 2257 => 'bradesti',
2350
+ 2258 => 'bradestii batrani',
2351
+ 2259 => 'meteu',
2352
+ 2260 => 'racarii de jos',
2353
+ 2261 => 'tatomiresti',
2354
+ 2262 => 'breasta',
2355
+ 2263 => 'cotu',
2356
+ 2264 => 'crovna',
2357
+ 2265 => 'obedin',
2358
+ 2266 => 'rosieni',
2359
+ 2267 => 'valea lungului',
2360
+ 2268 => 'bucovat',
2361
+ 2269 => 'carligei',
2362
+ 2270 => 'italieni',
2363
+ 2271 => 'leamna de jos',
2364
+ 2272 => 'leamna de sus',
2365
+ 2273 => 'palilula',
2366
+ 2274 => 'sarbatoarea',
2367
+ 2275 => 'bulzesti',
2368
+ 2276 => 'fratila',
2369
+ 2277 => 'gura racului',
2370
+ 2278 => '?nfratirea',
2371
+ 2279 => 'piscu lung',
2372
+ 2280 => 'prejoi',
2373
+ 2281 => 'saliste',
2374
+ 2282 => 'seculesti',
2375
+ 2283 => 'stoicesti',
2376
+ 2284 => 'calopar',
2377
+ 2285 => 'bazdana',
2378
+ 2286 => 'belcinu',
2379
+ 2287 => 'panaghia',
2380
+ 2288 => 'salcuta (calopar)',
2381
+ 2289 => 'caraula',
2382
+ 2290 => 'carpen',
2383
+ 2291 => 'cleanov',
2384
+ 2292 => 'geblesti',
2385
+ 2293 => 'castranova',
2386
+ 2294 => 'puturi',
2387
+ 2295 => 'calarasi',
2388
+ 2296 => 'celaru',
2389
+ 2297 => 'ghizdavesti',
2390
+ 2298 => 'marotinu de jos',
2391
+ 2299 => 'marotinu de sus',
2392
+ 2300 => 'soreni',
2393
+ 2301 => 'cerat',
2394
+ 2302 => 'malaica',
2395
+ 2303 => 'cornita',
2396
+ 2304 => 'rasnicu batran',
2397
+ 2305 => 'rasnicu oghian',
2398
+ 2306 => 'tiu',
2399
+ 2307 => 'cetate',
2400
+ 2308 => 'cioroiasi',
2401
+ 2309 => 'cetatuia (cioroiasi)',
2402
+ 2310 => 'cioroiu nou',
2403
+ 2311 => 'ciupercenii noi',
2404
+ 2312 => 'cosoveni',
2405
+ 2313 => 'carcea',
2406
+ 2314 => 'cotofenii din dos',
2407
+ 2315 => 'mihaita',
2408
+ 2316 => 'potmeltu',
2409
+ 2317 => 'daneti',
2410
+ 2318 => 'braniste (daneti)',
2411
+ 2319 => 'locusteni',
2412
+ 2320 => 'dabuleni',
2413
+ 2321 => 'chiasu',
2414
+ 2322 => 'desa',
2415
+ 2323 => 'diosti',
2416
+ 2324 => 'radomir',
2417
+ 2325 => 'caciulatesti',
2418
+ 2326 => 'georocel',
2419
+ 2327 => 'murta',
2420
+ 2328 => 'toceni',
2421
+ 2329 => 'dragotesti',
2422
+ 2330 => 'benesti',
2423
+ 2331 => 'bobeanu',
2424
+ 2332 => 'buzduc',
2425
+ 2333 => 'popanzalesti',
2426
+ 2334 => 'dranic',
2427
+ 2335 => 'booveni',
2428
+ 2336 => 'foisor',
2429
+ 2337 => 'padea',
2430
+ 2338 => 'farcas',
2431
+ 2339 => 'amarasti',
2432
+ 2340 => 'golumbelu',
2433
+ 2341 => 'golumbu',
2434
+ 2342 => 'moflesti',
2435
+ 2343 => 'nistoi',
2436
+ 2344 => 'plopu-amarasti',
2437
+ 2345 => 'putinei',
2438
+ 2346 => 'soceni',
2439
+ 2347 => 'talpas',
2440
+ 2348 => 'galicea mare',
2441
+ 2349 => 'gangiova',
2442
+ 2350 => 'comosteni',
2443
+ 2351 => 'ghercesti',
2444
+ 2352 => 'garlesti',
2445
+ 2353 => 'luncsoru',
2446
+ 2354 => 'ungureni',
2447
+ 2355 => 'ungurenii mici',
2448
+ 2356 => 'gighera',
2449
+ 2357 => 'nedeia',
2450
+ 2358 => 'zaval',
2451
+ 2359 => 'giubega',
2452
+ 2360 => 'galiciuica',
2453
+ 2361 => 'giurgita',
2454
+ 2362 => 'filaret',
2455
+ 2363 => 'gogosu',
2456
+ 2364 => 'gogosita',
2457
+ 2365 => '?tefanel',
2458
+ 2366 => 'goicea',
2459
+ 2367 => 'carna',
2460
+ 2368 => 'goiesti',
2461
+ 2369 => 'adancata',
2462
+ 2370 => 'fantani',
2463
+ 2371 => 'gruita',
2464
+ 2372 => 'malaesti',
2465
+ 2373 => 'muereni',
2466
+ 2374 => 'pometesti',
2467
+ 2375 => 'popeasa',
2468
+ 2376 => 'tandara',
2469
+ 2377 => 'vladimir',
2470
+ 2378 => 'zlatari',
2471
+ 2379 => 'grecesti',
2472
+ 2380 => 'barboi',
2473
+ 2381 => 'busu',
2474
+ 2382 => 'busuletu',
2475
+ 2383 => 'gropanele',
2476
+ 2384 => 'isalnita',
2477
+ 2385 => 'izvoare',
2478
+ 2386 => 'corlate',
2479
+ 2387 => 'domnu tudor',
2480
+ 2388 => 'leu',
2481
+ 2389 => 'lipovu',
2482
+ 2390 => 'lipovu de sus',
2483
+ 2391 => 'maglavit',
2484
+ 2392 => 'hunia',
2485
+ 2393 => 'malu mare',
2486
+ 2394 => 'ghindeni',
2487
+ 2395 => 'macesu de jos',
2488
+ 2396 => 'macesu de sus',
2489
+ 2397 => 'marsani',
2490
+ 2398 => 'melinesti',
2491
+ 2399 => 'bodaiesti',
2492
+ 2400 => 'bodaiestii de sus',
2493
+ 2401 => 'muierusu',
2494
+ 2402 => 'odoleni',
2495
+ 2403 => 'ohaba',
2496
+ 2404 => 'spineni',
2497
+ 2405 => 'valea muierii de jos',
2498
+ 2406 => 'mischii',
2499
+ 2407 => 'gogosesti',
2500
+ 2408 => 'mlecanesti',
2501
+ 2409 => 'motoci',
2502
+ 2410 => 'motatei',
2503
+ 2411 => 'dobridor',
2504
+ 2412 => 'motatei-gara',
2505
+ 2413 => 'murgasi',
2506
+ 2414 => 'balota de jos',
2507
+ 2415 => 'balota de sus',
2508
+ 2416 => 'gaia',
2509
+ 2417 => 'picaturile',
2510
+ 2418 => 'rupturile',
2511
+ 2419 => 'velesti',
2512
+ 2420 => 'negoi',
2513
+ 2421 => 'catanele noi',
2514
+ 2422 => 'bechet (orodel)',
2515
+ 2423 => 'calugarei',
2516
+ 2424 => 'ostroveni',
2517
+ 2425 => 'listeava',
2518
+ 2426 => 'perisor',
2519
+ 2427 => 'maracinele',
2520
+ 2428 => 'langa',
2521
+ 2429 => 'piscu vechi',
2522
+ 2430 => 'ghidici',
2523
+ 2431 => 'pisculet',
2524
+ 2432 => 'plenita',
2525
+ 2433 => 'castrele traiane',
2526
+ 2434 => 'podari',
2527
+ 2435 => 'balta verde',
2528
+ 2436 => 'braniste (podari)',
2529
+ 2437 => 'livezi',
2530
+ 2438 => 'tunarii noi',
2531
+ 2439 => 'tunarii vechi',
2532
+ 2440 => 'bucicani',
2533
+ 2441 => 'carstovani',
2534
+ 2442 => 'frasin',
2535
+ 2443 => 'milovan',
2536
+ 2444 => 'plesoi',
2537
+ 2445 => 'predestii mici',
2538
+ 2446 => 'radovan',
2539
+ 2447 => 'fantanele (radovan)',
2540
+ 2448 => '?ntorsura',
2541
+ 2449 => 'rast',
2542
+ 2450 => 'robanesti',
2543
+ 2451 => 'bojoiu',
2544
+ 2452 => 'golfin',
2545
+ 2453 => 'lacrita mare',
2546
+ 2454 => 'lacrita mica',
2547
+ 2455 => 'robanestii de jos',
2548
+ 2456 => 'robanestii de sus',
2549
+ 2457 => 'sadova',
2550
+ 2458 => 'piscu sadovei',
2551
+ 2459 => 'marza',
2552
+ 2460 => 'plopsor',
2553
+ 2461 => 'tencanau',
2554
+ 2462 => 'scaesti',
2555
+ 2463 => 'valea lui patru',
2556
+ 2464 => 'seaca de camp',
2557
+ 2465 => 'piscu nou',
2558
+ 2466 => 'seaca de padure',
2559
+ 2467 => 'rachita de sus',
2560
+ 2468 => 'veleni',
2561
+ 2469 => 'secu',
2562
+ 2470 => 'comanicea',
2563
+ 2471 => 'smadovicioara de sec',
2564
+ 2472 => '?umandra',
2565
+ 2473 => 'silistea crucii',
2566
+ 2474 => 'sopot',
2567
+ 2475 => 'belot',
2568
+ 2476 => 'cernat',
2569
+ 2477 => 'pereni',
2570
+ 2478 => 'pietroaia',
2571
+ 2479 => 'sarsca',
2572
+ 2480 => '?imnicu de sus',
2573
+ 2481 => 'dudovicesti',
2574
+ 2482 => 'dutulesti',
2575
+ 2483 => 'izvor',
2576
+ 2484 => 'jieni',
2577
+ 2485 => 'milesti',
2578
+ 2486 => 'teasc',
2579
+ 2487 => 'secui',
2580
+ 2488 => 'terpezita',
2581
+ 2489 => 'caciulatu',
2582
+ 2490 => 'caruia',
2583
+ 2491 => 'floran',
2584
+ 2492 => 'lazu',
2585
+ 2493 => 'teslui',
2586
+ 2494 => 'cosereni',
2587
+ 2495 => 'fantanele (teslui)',
2588
+ 2496 => 'preajba de jos',
2589
+ 2497 => 'preajba de padure',
2590
+ 2498 => 'tartal',
2591
+ 2499 => 'urieni',
2592
+ 2500 => 'viisoara-mosneni',
2593
+ 2501 => 'tuglui',
2594
+ 2502 => 'jiul',
2595
+ 2503 => 'unirea',
2596
+ 2504 => 'urzicuta',
2597
+ 2505 => 'urzica mare',
2598
+ 2506 => 'valea stanciului',
2599
+ 2507 => 'horezu-poenari',
2600
+ 2508 => 'vartop',
2601
+ 2509 => 'varvoru de jos',
2602
+ 2510 => 'bujor',
2603
+ 2511 => 'ciutura',
2604
+ 2512 => 'criva',
2605
+ 2513 => 'dobromira',
2606
+ 2514 => 'dragoaia',
2607
+ 2515 => 'gabru',
2608
+ 2516 => 'varvor',
2609
+ 2517 => 'vela',
2610
+ 2518 => 'bucovicior',
2611
+ 2519 => 'cetatuia (vela)',
2612
+ 2520 => 'desnatui',
2613
+ 2521 => 'gubaucea',
2614
+ 2522 => 'seglet',
2615
+ 2523 => 'suharu',
2616
+ 2524 => 'verbita',
2617
+ 2525 => 'verbicioara',
2618
+ 2526 => 'barsesti',
2619
+ 2527 => 'dragoeni',
2620
+ 2528 => 'iezureni',
2621
+ 2529 => 'polata',
2622
+ 2530 => 'preajba mare',
2623
+ 2531 => 'ursati',
2624
+ 2532 => 'targu-jiu',
2625
+ 2533 => 'bumbesti-jiu',
2626
+ 2534 => 'curtisoara',
2627
+ 2535 => 'lazaresti',
2628
+ 2536 => 'plesa',
2629
+ 2537 => 'tetila',
2630
+ 2538 => 'motru',
2631
+ 2539 => 'dealu pomilor',
2632
+ 2540 => 'horasti',
2633
+ 2541 => 'leurda',
2634
+ 2542 => 'lupoita',
2635
+ 2543 => 'rapa',
2636
+ 2544 => 'rosiuta',
2637
+ 2545 => 'hirisesti',
2638
+ 2546 => 'pociovalistea',
2639
+ 2547 => 'sitesti',
2640
+ 2548 => 'rovinari',
2641
+ 2549 => 'targu carbunesti',
2642
+ 2550 => 'blahnita de jos',
2643
+ 2551 => 'carbunesti-sat',
2644
+ 2552 => 'cojani',
2645
+ 2553 => 'curteana',
2646
+ 2554 => 'floresteni',
2647
+ 2555 => 'macesu',
2648
+ 2556 => 'pojogeni',
2649
+ 2557 => 'rogojeni',
2650
+ 2558 => 'ticleni',
2651
+ 2559 => 'barzeiu de gilort',
2652
+ 2560 => 'bolbocesti',
2653
+ 2561 => 'doseni',
2654
+ 2562 => 'mirosloveni',
2655
+ 2563 => 'prunesti',
2656
+ 2564 => 'alimpesti',
2657
+ 2565 => 'ciupercenii de oltet',
2658
+ 2566 => 'corsoru',
2659
+ 2567 => 'bobaia',
2660
+ 2568 => 'groserea',
2661
+ 2569 => 'sterpoaia',
2662
+ 2570 => 'arcani',
2663
+ 2571 => 'campofeni',
2664
+ 2572 => 'sanatesti',
2665
+ 2573 => 'stroiesti',
2666
+ 2574 => 'baia de fier',
2667
+ 2575 => 'cernadia',
2668
+ 2576 => 'voitestii din vale',
2669
+ 2577 => 'canepesti',
2670
+ 2578 => 'voitestii din deal',
2671
+ 2579 => 'balesti',
2672
+ 2580 => 'ceauru',
2673
+ 2581 => 'rasova',
2674
+ 2582 => 'stolojani',
2675
+ 2583 => 'talpasesti',
2676
+ 2584 => 'tamasesti',
2677
+ 2585 => 'voinigesti',
2678
+ 2586 => 'musculesti',
2679
+ 2587 => 'socu',
2680
+ 2588 => 'cocoreni',
2681
+ 2589 => 'moi',
2682
+ 2590 => 'pesteana-jiu',
2683
+ 2591 => 'vladuleni',
2684
+ 2592 => 'bengesti-ciocadia',
2685
+ 2593 => 'balcesti',
2686
+ 2594 => 'bengesti',
2687
+ 2595 => 'bircii',
2688
+ 2596 => 'ciocadia',
2689
+ 2597 => 'berlesti',
2690
+ 2598 => 'barzeiu',
2691
+ 2599 => 'lihulesti',
2692
+ 2600 => 'parau viu',
2693
+ 2601 => 'scrada',
2694
+ 2602 => 'scurtu',
2695
+ 2603 => 'bolbosi',
2696
+ 2604 => 'balacesti',
2697
+ 2605 => 'bolboasa',
2698
+ 2606 => 'igirosu',
2699
+ 2607 => 'miclosu',
2700
+ 2608 => 'ohaba-jiu',
2701
+ 2609 => 'borascu',
2702
+ 2610 => 'baniu',
2703
+ 2611 => 'calaparu',
2704
+ 2612 => 'gura-menti',
2705
+ 2613 => 'mentii din dos',
2706
+ 2614 => 'miluta',
2707
+ 2615 => 'scorusu',
2708
+ 2616 => 'badesti',
2709
+ 2617 => 'brebenei',
2710
+ 2618 => 'capu dealului',
2711
+ 2619 => 'gilortu',
2712
+ 2620 => 'parau',
2713
+ 2621 => 'bumbesti-pitic',
2714
+ 2622 => 'poienari',
2715
+ 2623 => 'bustuchin',
2716
+ 2624 => 'cionti',
2717
+ 2625 => 'motorgi',
2718
+ 2626 => 'namete',
2719
+ 2627 => 'poiana-seciuri',
2720
+ 2628 => 'pojaru',
2721
+ 2629 => 'valea pojarului',
2722
+ 2630 => 'capreni',
2723
+ 2631 => 'bulbuceni',
2724
+ 2632 => 'dealu spirei',
2725
+ 2633 => 'catunele',
2726
+ 2634 => 'dealu viilor',
2727
+ 2635 => 'lupoaia',
2728
+ 2636 => 'steic',
2729
+ 2637 => 'valea perilor',
2730
+ 2638 => 'calnic',
2731
+ 2639 => 'calnicu de sus',
2732
+ 2640 => 'didilesti',
2733
+ 2641 => 'galesoaia',
2734
+ 2642 => 'hodoreasca',
2735
+ 2643 => 'pieptani',
2736
+ 2644 => 'pinoasa',
2737
+ 2645 => 'stejerei',
2738
+ 2646 => 'valceaua',
2739
+ 2647 => 'boboiesti',
2740
+ 2648 => 'pesteana-vulcan',
2741
+ 2649 => 'priporu',
2742
+ 2650 => 'stramba-vulcan',
2743
+ 2651 => 'vartopu',
2744
+ 2652 => 'zorzila',
2745
+ 2653 => 'crasna',
2746
+ 2654 => 'aninisu din deal',
2747
+ 2655 => 'aninisu din vale',
2748
+ 2656 => 'buzesti',
2749
+ 2657 => 'carpinis',
2750
+ 2658 => 'crasna din deal',
2751
+ 2659 => 'dragoiesti',
2752
+ 2660 => 'radosi',
2753
+ 2661 => 'cruset',
2754
+ 2662 => 'bojinu',
2755
+ 2663 => 'marinesti',
2756
+ 2664 => 'maiag',
2757
+ 2665 => 'miericeaua',
2758
+ 2666 => 'slavuta',
2759
+ 2667 => 'urda de jos',
2760
+ 2668 => 'valuta',
2761
+ 2669 => 'danciulesti',
2762
+ 2670 => 'bibulesti',
2763
+ 2671 => 'halangesti',
2764
+ 2672 => 'obarsia',
2765
+ 2673 => 'petrachei',
2766
+ 2674 => 'radinesti',
2767
+ 2675 => 'zaicoiu',
2768
+ 2676 => 'danesti',
2769
+ 2677 => 'barza',
2770
+ 2678 => 'botorogi',
2771
+ 2679 => 'bratuia',
2772
+ 2680 => 'bucureasa',
2773
+ 2681 => 'merfulesti',
2774
+ 2682 => '?asa',
2775
+ 2683 => 'trocani',
2776
+ 2684 => 'corobai',
2777
+ 2685 => 'dragutesti',
2778
+ 2686 => 'carbesti',
2779
+ 2687 => 'dambova',
2780
+ 2688 => 'iasi-gorj',
2781
+ 2689 => 'talvesti',
2782
+ 2690 => 'farcasesti',
2783
+ 2691 => 'farcasesti-mosneni',
2784
+ 2692 => 'pesteana de jos',
2785
+ 2693 => 'rogojel',
2786
+ 2694 => 'rosia-jiu',
2787
+ 2695 => 'timiseni',
2788
+ 2696 => 'valea cu apa',
2789
+ 2697 => 'glogova',
2790
+ 2698 => 'camuiesti',
2791
+ 2699 => 'clesnesti',
2792
+ 2700 => 'iormanesti',
2793
+ 2701 => 'olteanu',
2794
+ 2702 => 'godinesti',
2795
+ 2703 => 'arjoci',
2796
+ 2704 => 'calcesti',
2797
+ 2705 => 'chiliu',
2798
+ 2706 => 'parau de pripor',
2799
+ 2707 => 'parau de vale',
2800
+ 2708 => 'ratez',
2801
+ 2709 => 'hurezani',
2802
+ 2710 => 'busuioci',
2803
+ 2711 => 'pegeni',
2804
+ 2712 => 'totea de hurezani',
2805
+ 2713 => 'gura ?usitei',
2806
+ 2714 => 'iliesti',
2807
+ 2715 => 'picu',
2808
+ 2716 => 'boia',
2809
+ 2717 => 'parau boia',
2810
+ 2718 => 'vidin',
2811
+ 2719 => 'viersani',
2812
+ 2720 => 'lelesti',
2813
+ 2721 => 'rasovita',
2814
+ 2722 => 'licurici',
2815
+ 2723 => 'frumusei',
2816
+ 2724 => 'totea',
2817
+ 2725 => 'logresti',
2818
+ 2726 => 'coltesti',
2819
+ 2727 => 'frunza',
2820
+ 2728 => 'logresti-mosteni',
2821
+ 2729 => 'maru',
2822
+ 2730 => 'targu logresti',
2823
+ 2731 => 'matasari',
2824
+ 2732 => 'bradetel',
2825
+ 2733 => 'croici',
2826
+ 2734 => 'runcurel',
2827
+ 2735 => 'musetesti',
2828
+ 2736 => 'arseni',
2829
+ 2737 => 'barcaciu',
2830
+ 2738 => 'gamani',
2831
+ 2739 => 'grui',
2832
+ 2740 => 'stancesti-larga',
2833
+ 2741 => 'negomir',
2834
+ 2742 => 'artanu',
2835
+ 2743 => 'bohorel',
2836
+ 2744 => 'condeiesti',
2837
+ 2745 => 'nucetu',
2838
+ 2746 => 'orzu',
2839
+ 2747 => 'paltinu',
2840
+ 2748 => 'raci',
2841
+ 2749 => 'valea racilor',
2842
+ 2750 => 'pades',
2843
+ 2751 => 'apa neagra',
2844
+ 2752 => 'cerna-sat',
2845
+ 2753 => 'closani',
2846
+ 2754 => 'motru sec',
2847
+ 2755 => 'orzesti',
2848
+ 2756 => 'vaieni',
2849
+ 2757 => 'pestisani',
2850
+ 2758 => 'borosteni',
2851
+ 2759 => 'bradiceni',
2852
+ 2760 => 'francesti',
2853
+ 2761 => 'gureni',
2854
+ 2762 => 'hobita',
2855
+ 2763 => 'seuca',
2856
+ 2764 => 'brosteni',
2857
+ 2765 => 'brostenii de sus',
2858
+ 2766 => 'ceplea',
2859
+ 2767 => 'cursaru',
2860
+ 2768 => 'piscuri',
2861
+ 2769 => 'sardanesti',
2862
+ 2770 => 'polovragi',
2863
+ 2771 => 'prigoria',
2864
+ 2772 => 'bucsana',
2865
+ 2773 => 'burlani',
2866
+ 2774 => 'calugareasa',
2867
+ 2775 => 'dobrana',
2868
+ 2776 => 'zorlesti',
2869
+ 2777 => 'rosia de amaradia',
2870
+ 2778 => 'becheni',
2871
+ 2779 => 'ruget',
2872
+ 2780 => 'seciurile',
2873
+ 2781 => 'baltisoara',
2874
+ 2782 => 'dobrita',
2875
+ 2783 => 'rachiti',
2876
+ 2784 => 'samarinesti',
2877
+ 2785 => 'bazavani',
2878
+ 2786 => 'boca',
2879
+ 2787 => 'duculesti',
2880
+ 2788 => 'larga',
2881
+ 2789 => 'tirioi',
2882
+ 2790 => 'valea bisericii',
2883
+ 2791 => 'valea mica',
2884
+ 2792 => 'sacelu',
2885
+ 2793 => 'blahnita de sus',
2886
+ 2794 => 'haiesti',
2887
+ 2795 => 'jeristea',
2888
+ 2796 => 'magheresti',
2889
+ 2797 => 'saulesti',
2890
+ 2798 => 'bibesti',
2891
+ 2799 => 'dolcesti',
2892
+ 2800 => 'purcaru',
2893
+ 2801 => 'arsuri',
2894
+ 2802 => 'gornacel',
2895
+ 2803 => 'pajistele',
2896
+ 2804 => 'sambotin',
2897
+ 2805 => 'scoarta',
2898
+ 2806 => 'bobu',
2899
+ 2807 => 'budieni',
2900
+ 2808 => 'campu mare',
2901
+ 2809 => 'ceratu de copacioasa',
2902
+ 2810 => 'copacioasa',
2903
+ 2811 => 'lintea',
2904
+ 2812 => 'pistestii din deal',
2905
+ 2813 => 'slivilesti',
2906
+ 2814 => 'cojmanesti',
2907
+ 2815 => 'stramtu',
2908
+ 2816 => 'sura',
2909
+ 2817 => '?iacu',
2910
+ 2818 => '?tiucani',
2911
+ 2819 => 'tehomir',
2912
+ 2820 => 'alexeni',
2913
+ 2821 => 'balani',
2914
+ 2822 => 'calesti',
2915
+ 2823 => 'curpen',
2916
+ 2824 => 'mazaroi',
2917
+ 2825 => 'obreja',
2918
+ 2826 => 'parvulesti',
2919
+ 2827 => 'vaidei',
2920
+ 2828 => 'valari',
2921
+ 2829 => 'balosani',
2922
+ 2830 => 'dealu leului',
2923
+ 2831 => 'piscoiu',
2924
+ 2832 => 'popesti-stejari',
2925
+ 2833 => 'stoina',
2926
+ 2834 => 'ciorari',
2927
+ 2835 => 'mielusei',
2928
+ 2836 => 'paisani',
2929
+ 2837 => 'toiaga',
2930
+ 2838 => 'urda de sus',
2931
+ 2839 => 'buduhala',
2932
+ 2840 => '?omanesti',
2933
+ 2841 => 'tismana',
2934
+ 2842 => 'celei',
2935
+ 2843 => 'gornovita',
2936
+ 2844 => 'isvarna',
2937
+ 2845 => 'pocruia',
2938
+ 2846 => 'racoti',
2939
+ 2847 => 'sohodol',
2940
+ 2848 => 'topesti',
2941
+ 2849 => 'vanata',
2942
+ 2850 => 'cocorova',
2943
+ 2851 => 'spahii',
2944
+ 2852 => 'turceni',
2945
+ 2853 => 'garbovu',
2946
+ 2854 => 'jiltu',
2947
+ 2855 => 'stramba-jiu',
2948
+ 2856 => 'turcinesti',
2949
+ 2857 => 'cartiu',
2950
+ 2858 => 'horezu',
2951
+ 2859 => 'rugi',
2952
+ 2860 => 'arpadia',
2953
+ 2861 => 'chiciora',
2954
+ 2862 => 'urdari',
2955
+ 2863 => 'hotaroasa',
2956
+ 2864 => 'vagiulesti',
2957
+ 2865 => 'carciu',
2958
+ 2866 => 'covrigi',
2959
+ 2867 => 'murgilesti',
2960
+ 2868 => 'valea motrului',
2961
+ 2869 => 'andreesti',
2962
+ 2870 => 'valea desului',
2963
+ 2871 => 'dudasu schelei',
2964
+ 2872 => 'schela cladovei',
2965
+ 2873 => 'drobeta-turnu s',
2966
+ 2874 => 'baia de arama',
2967
+ 2875 => 'bratilovu',
2968
+ 2876 => 'marasesti',
2969
+ 2877 => 'negoesti',
2970
+ 2878 => 'pistrita',
2971
+ 2879 => 'titerlesti',
2972
+ 2880 => 'orsova',
2973
+ 2881 => 'strehaia',
2974
+ 2882 => 'ciochiuta',
2975
+ 2883 => 'comanda',
2976
+ 2884 => 'hurducesti',
2977
+ 2885 => 'lunca banului',
2978
+ 2886 => 'menti',
2979
+ 2887 => 'motruleni',
2980
+ 2888 => 'slatinicu mare',
2981
+ 2889 => 'slatinicu mic',
2982
+ 2890 => 'vanju mare',
2983
+ 2891 => 'bucura',
2984
+ 2892 => 'orevita mare',
2985
+ 2893 => 'portile de fier ii',
2986
+ 2894 => 'bala',
2987
+ 2895 => 'bala de sus',
2988
+ 2896 => 'bratesul',
2989
+ 2897 => 'brativoesti',
2990
+ 2898 => 'carsu',
2991
+ 2899 => 'comanesti',
2992
+ 2900 => 'crainici',
2993
+ 2901 => 'iupca',
2994
+ 2902 => 'molani',
2995
+ 2903 => 'rudina',
2996
+ 2904 => 'runcusoru',
2997
+ 2905 => 'vidimiresti',
2998
+ 2906 => 'coada cornetului',
2999
+ 2907 => 'nevatu',
3000
+ 2908 => 'prejna',
3001
+ 2909 => 'sfodea',
3002
+ 2910 => 'balacita',
3003
+ 2911 => 'gvardinita',
3004
+ 2912 => 'bacles',
3005
+ 2913 => 'corzu',
3006
+ 2914 => 'giura',
3007
+ 2915 => 'petra',
3008
+ 2916 => 'podu grosului',
3009
+ 2917 => 'selistiuta',
3010
+ 2918 => 'smadovita',
3011
+ 2919 => 'balvanesti',
3012
+ 2920 => 'balvanestii de jos',
3013
+ 2921 => 'calinestii de jos',
3014
+ 2922 => 'calinestii de sus',
3015
+ 2923 => 'parlagele',
3016
+ 2924 => 'breznita-motru',
3017
+ 2925 => 'cosovat',
3018
+ 2926 => 'fauroaia',
3019
+ 2927 => 'talapanu',
3020
+ 2928 => 'valea teiului',
3021
+ 2929 => 'breznita-ocol',
3022
+ 2930 => 'jidostita',
3023
+ 2931 => 'magheru',
3024
+ 2932 => '?usita (breznita-oco',
3025
+ 2933 => 'luncsoara',
3026
+ 2934 => 'lupsa de jos',
3027
+ 2935 => 'lupsa de sus',
3028
+ 2936 => 'meris',
3029
+ 2937 => 'burila mare',
3030
+ 2938 => 'izvoru frumos',
3031
+ 2939 => 'tiganasi',
3032
+ 2940 => 'vrancea',
3033
+ 2941 => 'butoiesti',
3034
+ 2942 => 'arginesti',
3035
+ 2943 => 'buicesti',
3036
+ 2944 => 'gura motrului',
3037
+ 2945 => 'jugastru',
3038
+ 2946 => 'pluta',
3039
+ 2947 => 'tantaru',
3040
+ 2948 => 'cazanesti',
3041
+ 2949 => 'ercea',
3042
+ 2950 => 'garbovatu de sus',
3043
+ 2951 => 'govodarva',
3044
+ 2952 => 'ilovu',
3045
+ 2953 => 'jignita',
3046
+ 2954 => 'paltinisu',
3047
+ 2955 => 'rosia',
3048
+ 2956 => 'severinesti',
3049
+ 2957 => 'valea cosustei',
3050
+ 2958 => 'bunoaica',
3051
+ 2959 => 'negrusa',
3052
+ 2960 => 'corcova',
3053
+ 2961 => 'breta',
3054
+ 2962 => 'cernaia',
3055
+ 2963 => 'cordun',
3056
+ 2964 => 'croica',
3057
+ 2965 => 'garbovatu de jos',
3058
+ 2966 => 'imoasa',
3059
+ 2967 => 'jirov',
3060
+ 2968 => 'maru rosu',
3061
+ 2969 => 'puscasu',
3062
+ 2970 => 'vladasesti',
3063
+ 2971 => 'corlatel',
3064
+ 2972 => 'valea anilor',
3065
+ 2973 => 'cujmir',
3066
+ 2974 => 'aurora',
3067
+ 2975 => 'cujmiru mic',
3068
+ 2976 => 'gemeni',
3069
+ 2977 => 'devesel',
3070
+ 2978 => 'batoti',
3071
+ 2979 => 'bistretu',
3072
+ 2980 => 'dunarea mica',
3073
+ 2981 => 'scapau',
3074
+ 2982 => 'dubova',
3075
+ 2983 => 'baia noua',
3076
+ 2984 => 'eibenthal',
3077
+ 2985 => 'albulesti',
3078
+ 2986 => 'bragleasa',
3079
+ 2987 => 'dumbrava de jos',
3080
+ 2988 => 'dumbrava de mijloc',
3081
+ 2989 => 'dumbrava de sus',
3082
+ 2990 => 'golineasa',
3083
+ 2991 => 'higiu',
3084
+ 2992 => 'rocsoreni',
3085
+ 2993 => 'valea marcului',
3086
+ 2994 => 'varodia',
3087
+ 2995 => 'vladica',
3088
+ 2996 => 'eselnita',
3089
+ 2997 => 'gardoaia',
3090
+ 2998 => 'pesteana',
3091
+ 2999 => 'pestenuta',
3092
+ 3000 => 'zegujani',
3093
+ 3001 => 'garla mare',
3094
+ 3002 => 'vrata',
3095
+ 3003 => 'godeanu',
3096
+ 3004 => 'marga',
3097
+ 3005 => '?iroca',
3098
+ 3006 => 'burila mica',
3099
+ 3007 => 'ostrovu mare',
3100
+ 3008 => 'baltanele (greci)',
3101
+ 3009 => 'blidaru',
3102
+ 3010 => 'salatruc',
3103
+ 3011 => 'valea petrii',
3104
+ 3012 => 'grozesti',
3105
+ 3013 => 'carceni',
3106
+ 3014 => 'pasarani',
3107
+ 3015 => '?usita (grozesti)',
3108
+ 3016 => 'gruia',
3109
+ 3017 => 'poiana gruii',
3110
+ 3018 => 'hinova',
3111
+ 3019 => 'bistrita',
3112
+ 3020 => 'carjei',
3113
+ 3021 => 'ostrovu corbului',
3114
+ 3022 => 'husnicioara',
3115
+ 3023 => 'alunisul',
3116
+ 3024 => 'baditesti',
3117
+ 3025 => 'borogea',
3118
+ 3026 => 'celnata',
3119
+ 3027 => 'dumbravita',
3120
+ 3028 => 'marmanu',
3121
+ 3029 => 'opranesti',
3122
+ 3030 => 'peri',
3123
+ 3031 => 'priboiesti',
3124
+ 3032 => 'selisteni',
3125
+ 3033 => 'ilovat',
3126
+ 3034 => 'budanesti',
3127
+ 3035 => 'cracu lung',
3128
+ 3036 => 'dalbocita',
3129
+ 3037 => 'firizu',
3130
+ 3038 => 'racova',
3131
+ 3039 => 'ilovita',
3132
+ 3040 => 'bahna',
3133
+ 3041 => 'moisesti',
3134
+ 3042 => 'isverna',
3135
+ 3043 => 'busesti',
3136
+ 3044 => 'cerna-varf',
3137
+ 3045 => 'draghesti',
3138
+ 3046 => 'giurgiani',
3139
+ 3047 => 'nadanova',
3140
+ 3048 => 'selistea',
3141
+ 3049 => 'turtaba',
3142
+ 3050 => 'izvoru barzii',
3143
+ 3051 => 'halanga',
3144
+ 3052 => 'rascolesti',
3145
+ 3053 => 'schinteiesti',
3146
+ 3054 => 'schitu topolnitei',
3147
+ 3055 => 'jiana',
3148
+ 3056 => 'cioroboreni',
3149
+ 3057 => 'danceu',
3150
+ 3058 => 'jiana mare',
3151
+ 3059 => 'jiana veche',
3152
+ 3060 => 'livezile',
3153
+ 3061 => 'izvoralu de jos',
3154
+ 3062 => 'izvoru anestilor',
3155
+ 3063 => 'petris',
3156
+ 3064 => 'valea izvorului',
3157
+ 3065 => 'malovat',
3158
+ 3066 => '23-aug',
3159
+ 3067 => 'barda',
3160
+ 3068 => 'bobaita',
3161
+ 3069 => 'obarsia de camp',
3162
+ 3070 => 'izimsa',
3163
+ 3071 => 'obarsia-closani',
3164
+ 3072 => 'godeanu (obarsia-clo',
3165
+ 3073 => 'oprisor',
3166
+ 3074 => 'prisaceaua',
3167
+ 3075 => 'biban',
3168
+ 3076 => 'iablanita',
3169
+ 3077 => 'padina mare',
3170
+ 3078 => 'padina mica',
3171
+ 3079 => 'slasoma',
3172
+ 3080 => 'patulele',
3173
+ 3081 => 'viasu',
3174
+ 3082 => 'gornenti',
3175
+ 3083 => 'malarisca',
3176
+ 3084 => 'ponoarele',
3177
+ 3085 => 'baluta',
3178
+ 3086 => 'baraiacu',
3179
+ 3087 => 'branzeni',
3180
+ 3088 => 'buicani',
3181
+ 3089 => 'ceptureni',
3182
+ 3090 => 'cracu muntelui',
3183
+ 3091 => 'delureni',
3184
+ 3092 => 'gardaneasa',
3185
+ 3093 => 'gheorghesti',
3186
+ 3094 => 'ludu',
3187
+ 3095 => 'proitesti',
3188
+ 3096 => 'raiculesti',
3189
+ 3097 => '?ipotu (ponoarele)',
3190
+ 3098 => 'valea ursului (ponoa',
3191
+ 3099 => 'poroina mare',
3192
+ 3100 => 'fantanile negre',
3193
+ 3101 => 'stignita',
3194
+ 3102 => '?ipotu (poroina mare',
3195
+ 3103 => 'pristol',
3196
+ 3104 => 'cozia',
3197
+ 3105 => 'prunisor',
3198
+ 3106 => 'arvatesti',
3199
+ 3107 => 'balota',
3200
+ 3108 => 'baltanele (prunisor)',
3201
+ 3109 => 'cervenita',
3202
+ 3110 => 'fantana domneasca',
3203
+ 3111 => 'garnita',
3204
+ 3112 => 'ghelmegioaia',
3205
+ 3113 => 'gutu',
3206
+ 3114 => 'igiroasa',
3207
+ 3115 => 'lumnic',
3208
+ 3116 => 'mijarca',
3209
+ 3117 => 'zegaia',
3210
+ 3118 => 'punghina',
3211
+ 3119 => 'cearangu',
3212
+ 3120 => 'drincea',
3213
+ 3121 => 'rogova',
3214
+ 3122 => 'poroinita',
3215
+ 3123 => 'stangaceaua',
3216
+ 3124 => 'barlogeni',
3217
+ 3125 => 'breznicioara',
3218
+ 3126 => 'ceranganul',
3219
+ 3127 => 'fata motrului',
3220
+ 3128 => 'posta veche',
3221
+ 3129 => 'satu mare',
3222
+ 3130 => 'tarsa',
3223
+ 3131 => 'svinita',
3224
+ 3132 => '?imian',
3225
+ 3133 => 'cerneti',
3226
+ 3134 => 'dedovita noua',
3227
+ 3135 => 'dedovita veche',
3228
+ 3136 => 'dudasu',
3229
+ 3137 => 'erghevita',
3230
+ 3138 => 'poroina',
3231
+ 3139 => 'valea copcii',
3232
+ 3140 => '?isesti',
3233
+ 3141 => 'caramidaru',
3234
+ 3142 => 'ciovarnasani',
3235
+ 3143 => 'craguesti',
3236
+ 3144 => 'noaptesa',
3237
+ 3145 => '?ovarna',
3238
+ 3146 => 'studina',
3239
+ 3147 => 'tamna',
3240
+ 3148 => 'adunatii teiului',
3241
+ 3149 => 'boceni',
3242
+ 3150 => 'colaret',
3243
+ 3151 => 'cremenea',
3244
+ 3152 => 'fata cremenii',
3245
+ 3153 => 'izvoralu',
3246
+ 3154 => 'manu',
3247
+ 3155 => 'pavat',
3248
+ 3156 => 'valea ursului (tamna',
3249
+ 3157 => 'goanta',
3250
+ 3158 => 'rosiori',
3251
+ 3159 => 'vanjulet',
3252
+ 3160 => 'hotarani',
3253
+ 3161 => 'vladaia',
3254
+ 3162 => 'scorila',
3255
+ 3163 => '?tircovita',
3256
+ 3164 => 'voloiac',
3257
+ 3165 => 'cotoroaia',
3258
+ 3166 => 'lac',
3259
+ 3167 => 'ruptura',
3260
+ 3168 => 'sperlesti',
3261
+ 3169 => 'titirigi',
3262
+ 3170 => 'valea buna',
3263
+ 3171 => 'voloicel',
3264
+ 3172 => 'cireasov',
3265
+ 3173 => 'bals',
3266
+ 3174 => 'caracal',
3267
+ 3175 => 'corabia',
3268
+ 3176 => 'draganesti-olt',
3269
+ 3177 => 'comani',
3270
+ 3178 => 'piatra-olt',
3271
+ 3179 => 'bistrita noua',
3272
+ 3180 => 'criva de jos',
3273
+ 3181 => 'criva de sus',
3274
+ 3182 => 'enosesti',
3275
+ 3183 => 'scornicesti',
3276
+ 3184 => 'baltati',
3277
+ 3185 => 'chiteasca',
3278
+ 3186 => 'constantinesti',
3279
+ 3187 => 'jitaru',
3280
+ 3188 => 'margineni-slobozia',
3281
+ 3189 => 'mihailesti-popesti',
3282
+ 3190 => 'rusciori',
3283
+ 3191 => '?uica',
3284
+ 3192 => 'teius',
3285
+ 3193 => 'baleasa',
3286
+ 3194 => 'damburile',
3287
+ 3195 => 'gubandru',
3288
+ 3196 => 'pietris',
3289
+ 3197 => 'babiciu',
3290
+ 3198 => 'barastii de cepturi',
3291
+ 3199 => 'barastii de vede',
3292
+ 3200 => 'boroesti',
3293
+ 3201 => 'motoesti',
3294
+ 3202 => 'popesti (barasti)',
3295
+ 3203 => 'branet',
3296
+ 3204 => 'belgun',
3297
+ 3205 => 'chintesti',
3298
+ 3206 => 'govora',
3299
+ 3207 => 'leotesti',
3300
+ 3208 => 'mirila',
3301
+ 3209 => 'brastavatu',
3302
+ 3210 => 'crusovu',
3303
+ 3211 => 'brancoveni',
3304
+ 3212 => 'margheni',
3305
+ 3213 => 'ociogi',
3306
+ 3214 => 'valeni (brancoveni)',
3307
+ 3215 => 'brebeni',
3308
+ 3216 => 'bucinisu',
3309
+ 3217 => 'bucinisu mic',
3310
+ 3218 => 'carlogani',
3311
+ 3219 => 'scorbura',
3312
+ 3220 => 'stupina',
3313
+ 3221 => 'cezieni',
3314
+ 3222 => 'bondrea',
3315
+ 3223 => 'cilieni',
3316
+ 3224 => 'colonesti',
3317
+ 3225 => 'barasti (colonesti)',
3318
+ 3226 => 'batareni',
3319
+ 3227 => 'carstani',
3320
+ 3228 => 'chelbesti',
3321
+ 3229 => 'guesti',
3322
+ 3230 => 'maruntei (colonesti)',
3323
+ 3231 => 'navargeni',
3324
+ 3232 => 'vlaici',
3325
+ 3233 => 'corbu',
3326
+ 3234 => 'burdulesti',
3327
+ 3235 => 'milcoveni',
3328
+ 3236 => 'coteana',
3329
+ 3237 => 'crampoia',
3330
+ 3238 => 'cepesti',
3331
+ 3239 => 'ibanesti',
3332
+ 3240 => 'miesti',
3333
+ 3241 => 'otestii de jos',
3334
+ 3242 => 'otestii de sus',
3335
+ 3243 => 'dobrotinet',
3336
+ 3244 => 'linia din vale',
3337
+ 3245 => 'proaspeti',
3338
+ 3246 => 'raitiu',
3339
+ 3247 => 'daneasa',
3340
+ 3248 => 'berindei',
3341
+ 3249 => 'cioflanu',
3342
+ 3250 => 'pestra',
3343
+ 3251 => 'deveselu',
3344
+ 3252 => 'comanca',
3345
+ 3253 => 'dobretu',
3346
+ 3254 => 'curtisoara (dobretu)',
3347
+ 3255 => 'dobrosloveni',
3348
+ 3256 => 'frasinetu',
3349
+ 3257 => 'potopinu',
3350
+ 3258 => 'resca',
3351
+ 3259 => 'rescuta',
3352
+ 3260 => 'dobroteasa',
3353
+ 3261 => 'batia',
3354
+ 3262 => 'dobrun',
3355
+ 3263 => 'osica de jos',
3356
+ 3264 => 'rosienii mari',
3357
+ 3265 => 'rosienii mici',
3358
+ 3266 => 'draghiceni',
3359
+ 3267 => 'liiceni',
3360
+ 3268 => 'fagetelu',
3361
+ 3269 => 'bagesti',
3362
+ 3270 => 'chilia',
3363
+ 3271 => 'isaci',
3364
+ 3272 => 'pielcani',
3365
+ 3273 => 'falcoiu',
3366
+ 3274 => 'cioroiasu',
3367
+ 3275 => 'cioroiu',
3368
+ 3276 => 'farcasele',
3369
+ 3277 => 'farcasu de jos',
3370
+ 3278 => 'dranovatu',
3371
+ 3279 => 'oltisoru',
3372
+ 3280 => 'garcov',
3373
+ 3281 => 'ursa',
3374
+ 3282 => 'giuvarasti',
3375
+ 3283 => 'gostavatu',
3376
+ 3284 => 'slaveni',
3377
+ 3285 => 'petculesti',
3378
+ 3286 => 'runcu mare',
3379
+ 3287 => 'satu nou (gradinari)',
3380
+ 3288 => 'grojdibodu',
3381
+ 3289 => 'hotaru',
3382
+ 3290 => 'ianca',
3383
+ 3291 => 'potelu',
3384
+ 3292 => 'iancu jianu',
3385
+ 3293 => 'dobriceni',
3386
+ 3294 => 'preotesti',
3387
+ 3295 => 'floru',
3388
+ 3296 => 'izbiceni',
3389
+ 3297 => 'alimanesti',
3390
+ 3298 => 'leleasca',
3391
+ 3299 => 'greeresti',
3392
+ 3300 => 'mierlicesti',
3393
+ 3301 => 'tonesti (leleasca)',
3394
+ 3302 => 'tufaru',
3395
+ 3303 => 'ursi',
3396
+ 3304 => 'maruntei',
3397
+ 3305 => 'busca',
3398
+ 3306 => 'milcov',
3399
+ 3307 => 'ipotesti',
3400
+ 3308 => 'milcovu din deal',
3401
+ 3309 => 'milcovu din vale',
3402
+ 3310 => 'morunglav',
3403
+ 3311 => 'barasti (morunglav)',
3404
+ 3312 => 'ghiosani',
3405
+ 3313 => 'morunesti',
3406
+ 3314 => 'movileni',
3407
+ 3315 => 'bacea',
3408
+ 3316 => 'nicolae titulescu',
3409
+ 3317 => 'ghimpeteni',
3410
+ 3318 => 'ghimpetenii noi',
3411
+ 3319 => 'campu parului',
3412
+ 3320 => 'obarsia noua',
3413
+ 3321 => 'tabonu',
3414
+ 3322 => 'oboga',
3415
+ 3323 => 'calui',
3416
+ 3324 => 'gura caluiu',
3417
+ 3325 => 'oporelu',
3418
+ 3326 => 'beria de jos',
3419
+ 3327 => 'beria de sus',
3420
+ 3328 => 'optasi-magura',
3421
+ 3329 => 'optasi',
3422
+ 3330 => 'orlea',
3423
+ 3331 => 'gura padinii',
3424
+ 3332 => 'orlea noua',
3425
+ 3333 => 'satu nou (orlea)',
3426
+ 3334 => 'osica de sus',
3427
+ 3335 => 'greci (osica de sus)',
3428
+ 3336 => 'ostrov',
3429
+ 3337 => 'tomeni',
3430
+ 3338 => 'parscoveni',
3431
+ 3339 => 'butoi',
3432
+ 3340 => '?oparlita',
3433
+ 3341 => 'perieti',
3434
+ 3342 => 'magura (perieti)',
3435
+ 3343 => 'mierlestii de sus',
3436
+ 3344 => 'plesoiu',
3437
+ 3345 => 'arcesti',
3438
+ 3346 => 'arcesti-cot',
3439
+ 3347 => 'cocorasti',
3440
+ 3348 => 'doba',
3441
+ 3349 => 'schitu din deal',
3442
+ 3350 => 'schitu din vale',
3443
+ 3351 => 'poboru',
3444
+ 3352 => 'creti',
3445
+ 3353 => 'seaca (poboru)',
3446
+ 3354 => 'surpeni',
3447
+ 3355 => 'potcoava',
3448
+ 3356 => 'potcoava-falcoeni',
3449
+ 3357 => 'trufinesti',
3450
+ 3358 => 'valea merilor',
3451
+ 3359 => 'saltanesti',
3452
+ 3360 => 'radomiresti',
3453
+ 3361 => 'craciunei',
3454
+ 3362 => 'redisoara',
3455
+ 3363 => 'valea soarelui',
3456
+ 3364 => 'rusanesti',
3457
+ 3365 => 'samburesti',
3458
+ 3366 => 'cerbeni',
3459
+ 3367 => 'ionicesti',
3460
+ 3368 => 'launele',
3461
+ 3369 => 'manulesti',
3462
+ 3370 => 'stanuleasa (sambures',
3463
+ 3371 => 'tonesti (samburesti)',
3464
+ 3372 => 'plaviceni',
3465
+ 3373 => 'rudari',
3466
+ 3374 => 'greci (schitu)',
3467
+ 3375 => 'slatioara',
3468
+ 3376 => 'optasani',
3469
+ 3377 => 'profa',
3470
+ 3378 => 'vineti',
3471
+ 3379 => 'sprancenata',
3472
+ 3380 => 'frunzaru',
3473
+ 3381 => 'uria',
3474
+ 3382 => 'stoicanesti',
3475
+ 3383 => 'strejesti',
3476
+ 3384 => 'mamura',
3477
+ 3385 => 'strejestii de sus',
3478
+ 3386 => 'arvateasca',
3479
+ 3387 => 'gradinile',
3480
+ 3388 => 'plaviceanca',
3481
+ 3389 => 'studinita',
3482
+ 3390 => '?erbanesti',
3483
+ 3391 => 'strugurelu',
3484
+ 3392 => '?erbanestii de sus',
3485
+ 3393 => 'ianca noua',
3486
+ 3394 => 'barbalai',
3487
+ 3395 => 'magura (tatulesti)',
3488
+ 3396 => 'mircesti',
3489
+ 3397 => 'momaiu',
3490
+ 3398 => 'cherlestii mosteni',
3491
+ 3399 => 'cherlestii din deal',
3492
+ 3400 => 'comanita',
3493
+ 3401 => 'corbu (teslui)',
3494
+ 3402 => 'schitu deleni',
3495
+ 3403 => 'tia mare',
3496
+ 3404 => 'doanca',
3497
+ 3405 => 'potlogeni',
3498
+ 3406 => 'topana',
3499
+ 3407 => 'candelesti',
3500
+ 3408 => 'cioraca',
3501
+ 3409 => 'cojgarei',
3502
+ 3410 => 'stoborasti',
3503
+ 3411 => 'urzica',
3504
+ 3412 => 'stavaru',
3505
+ 3413 => 'turia',
3506
+ 3414 => 'zorleasca',
3507
+ 3415 => 'vadastra',
3508
+ 3416 => 'visina noua',
3509
+ 3417 => 'vadastrita',
3510
+ 3418 => 'popesti (valeni)',
3511
+ 3419 => 'tirisneag',
3512
+ 3420 => 'valcelele de sus',
3513
+ 3421 => 'verguleasa',
3514
+ 3422 => 'dumitresti',
3515
+ 3423 => 'poganu',
3516
+ 3424 => 'valea fetei',
3517
+ 3425 => 'vanesti',
3518
+ 3426 => 'vitomiresti',
3519
+ 3427 => 'bulimanu',
3520
+ 3428 => 'dejesti',
3521
+ 3429 => 'donesti',
3522
+ 3430 => 'stanuleasa (vitomire',
3523
+ 3431 => 'trepteni',
3524
+ 3432 => 'vladila',
3525
+ 3433 => 'frasinet-gara',
3526
+ 3434 => 'vladila noua',
3527
+ 3435 => 'voineasa',
3528
+ 3436 => 'blaj',
3529
+ 3437 => 'rusanestii de sus',
3530
+ 3438 => 'vulpeni',
3531
+ 3439 => 'cotorbesti',
3532
+ 3440 => 'gropsani',
3533
+ 3441 => 'mardale',
3534
+ 3442 => 'pescaresti',
3535
+ 3443 => 'plopsorelu',
3536
+ 3444 => 'prisaca',
3537
+ 3445 => 'simniceni',
3538
+ 3446 => 'tabaci',
3539
+ 3447 => 'valea satului',
3540
+ 3448 => 'dienci',
3541
+ 3449 => 'valea lui alb',
3542
+ 3450 => 'vlangaresti',
3543
+ 3451 => 'aranghel',
3544
+ 3452 => 'cazanesti (ramnicu v',
3545
+ 3453 => 'copacelu',
3546
+ 3454 => 'dealu malului',
3547
+ 3455 => 'priba',
3548
+ 3456 => 'stolniceni',
3549
+ 3457 => 'troian',
3550
+ 3458 => 'ramnicu valcea',
3551
+ 3459 => 'raureni',
3552
+ 3460 => 'bonciu',
3553
+ 3461 => 'paduretu',
3554
+ 3462 => 'romani',
3555
+ 3463 => 'valea mare (babeni)',
3556
+ 3464 => 'baile govora',
3557
+ 3465 => 'curaturile',
3558
+ 3466 => 'gatejesti',
3559
+ 3467 => 'prajila',
3560
+ 3468 => 'baile olanesti',
3561
+ 3469 => 'gurguiata',
3562
+ 3470 => 'livadia',
3563
+ 3471 => 'mosoroasa',
3564
+ 3472 => 'olanesti',
3565
+ 3473 => 'gorunesti (balcesti)',
3566
+ 3474 => 'otetelisu',
3567
+ 3475 => 'satu poieni',
3568
+ 3476 => 'brezoi',
3569
+ 3477 => 'draganesti (brezoi)',
3570
+ 3478 => 'golotreni',
3571
+ 3479 => 'pascoaia',
3572
+ 3480 => 'proieni',
3573
+ 3481 => 'valea lui stan',
3574
+ 3482 => 'varatica',
3575
+ 3483 => 'calimanesti',
3576
+ 3484 => 'caciulata',
3577
+ 3485 => 'jiblea noua',
3578
+ 3486 => 'jiblea veche',
3579
+ 3487 => 'pausa',
3580
+ 3488 => 'seaca (calimanesti)',
3581
+ 3489 => 'dragasani',
3582
+ 3490 => 'valea caselor (draga',
3583
+ 3491 => 'zarneni',
3584
+ 3492 => 'zlatarei',
3585
+ 3493 => 'ifrimesti',
3586
+ 3494 => 'ramesti (horezu)',
3587
+ 3495 => 'romanii de jos',
3588
+ 3496 => 'romanii de sus',
3589
+ 3497 => 'tanasesti',
3590
+ 3498 => 'ursani',
3591
+ 3499 => 'ocnele mari',
3592
+ 3500 => 'cosota',
3593
+ 3501 => 'gura suhasului',
3594
+ 3502 => 'lunca (ocnele mari)',
3595
+ 3503 => 'teica',
3596
+ 3504 => 'alunu',
3597
+ 3505 => 'bodesti (alunu)',
3598
+ 3506 => 'igoiu',
3599
+ 3507 => 'ilaciu',
3600
+ 3508 => 'ocracu',
3601
+ 3509 => 'meresesti',
3602
+ 3510 => 'nemoiu',
3603
+ 3511 => 'teiul',
3604
+ 3512 => 'bodesti (barbatesti)',
3605
+ 3513 => 'negrulesti',
3606
+ 3514 => 'berbesti',
3607
+ 3515 => 'damteni',
3608
+ 3516 => 'dealu alunis',
3609
+ 3517 => 'rosioara',
3610
+ 3518 => 'targu gangulesti',
3611
+ 3519 => 'valea mare (berbesti',
3612
+ 3520 => 'berislavesti',
3613
+ 3521 => 'bradisor',
3614
+ 3522 => 'dangesti',
3615
+ 3523 => 'radacinesti',
3616
+ 3524 => 'scaueni',
3617
+ 3525 => 'stoenesti (berislave',
3618
+ 3526 => 'boisoara',
3619
+ 3527 => 'bumbuesti',
3620
+ 3528 => 'barsesti (budesti)',
3621
+ 3529 => 'bercioiu',
3622
+ 3530 => 'linia (budesti)',
3623
+ 3531 => 'piscu pietrei',
3624
+ 3532 => 'racovita (budesti)',
3625
+ 3533 => 'ruda',
3626
+ 3534 => 'bogdanesti (bujoreni',
3627
+ 3535 => 'lunca (bujoreni)',
3628
+ 3536 => 'malu alb',
3629
+ 3537 => 'malu vartop',
3630
+ 3538 => 'bunesti',
3631
+ 3539 => 'coasta mare',
3632
+ 3540 => 'firesti',
3633
+ 3541 => 'rapanesti',
3634
+ 3542 => 'titireci',
3635
+ 3543 => 'caineni',
3636
+ 3544 => 'cainenii mari',
3637
+ 3545 => 'cainenii mici',
3638
+ 3546 => 'greblesti',
3639
+ 3547 => 'priloage',
3640
+ 3548 => 'rau vadului',
3641
+ 3549 => 'cernisoara',
3642
+ 3550 => 'armasesti',
3643
+ 3551 => 'madulari (cernisoara',
3644
+ 3552 => 'modoia',
3645
+ 3553 => 'sarsanesti',
3646
+ 3554 => 'bondoci',
3647
+ 3555 => 'hotarasa',
3648
+ 3556 => 'vetelu',
3649
+ 3557 => 'pietreni',
3650
+ 3558 => 'varatici',
3651
+ 3559 => 'creteni',
3652
+ 3560 => 'mrenesti',
3653
+ 3561 => 'streminoasa',
3654
+ 3562 => 'daesti',
3655
+ 3563 => 'babuesti',
3656
+ 3564 => 'sanbotin',
3657
+ 3565 => 'danicei',
3658
+ 3566 => 'ceretu',
3659
+ 3567 => 'ciresul',
3660
+ 3568 => 'dealu launele',
3661
+ 3569 => 'dealu scheiului',
3662
+ 3570 => 'dragulesti',
3663
+ 3571 => 'glodu',
3664
+ 3572 => 'gura crucilor',
3665
+ 3573 => 'launele de jos',
3666
+ 3574 => 'linia pe vale',
3667
+ 3575 => 'valea scheiului',
3668
+ 3576 => 'dragoesti',
3669
+ 3577 => 'geamana (dragoesti)',
3670
+ 3578 => 'fauresti',
3671
+ 3579 => 'babeni-oltetu',
3672
+ 3580 => 'budesti (fauresti)',
3673
+ 3581 => 'bungetani',
3674
+ 3582 => 'colelia',
3675
+ 3583 => 'diculesti',
3676
+ 3584 => 'gainesti',
3677
+ 3585 => 'marcusu',
3678
+ 3586 => 'fartatesti',
3679
+ 3587 => 'afanata',
3680
+ 3588 => 'becsani',
3681
+ 3589 => 'catetu',
3682
+ 3590 => 'cuci',
3683
+ 3591 => 'dancai',
3684
+ 3592 => 'dejoi',
3685
+ 3593 => 'dozesti',
3686
+ 3594 => 'garnicet',
3687
+ 3595 => 'giulesti',
3688
+ 3596 => 'giulestii de sus',
3689
+ 3597 => 'maricesti',
3690
+ 3598 => 'nisipi',
3691
+ 3599 => 'popesti (fartatesti)',
3692
+ 3600 => 'stanculesti',
3693
+ 3601 => '?otani',
3694
+ 3602 => 'tanislavi',
3695
+ 3603 => 'balutoaia',
3696
+ 3604 => 'cosani',
3697
+ 3605 => 'dezrobiti',
3698
+ 3606 => 'genuneni',
3699
+ 3607 => 'manailesti',
3700
+ 3608 => 'surpatele',
3701
+ 3609 => 'galicea',
3702
+ 3610 => 'bratia din deal',
3703
+ 3611 => 'bratia din vale',
3704
+ 3612 => 'cocoru',
3705
+ 3613 => 'cremenari',
3706
+ 3614 => 'dealu mare (galicea)',
3707
+ 3615 => 'valea raului',
3708
+ 3616 => 'ghioroiu',
3709
+ 3617 => 'cazanesti (ghioroiu)',
3710
+ 3618 => '?tirbesti',
3711
+ 3619 => 'glavile',
3712
+ 3620 => 'jarostea',
3713
+ 3621 => 'olteanca (glavile)',
3714
+ 3622 => 'voiculeasa',
3715
+ 3623 => 'golesti',
3716
+ 3624 => 'aldesti',
3717
+ 3625 => 'coasta (golesti)',
3718
+ 3626 => 'draganesti (golesti)',
3719
+ 3627 => 'gibesti',
3720
+ 3628 => 'giurgiuveni',
3721
+ 3629 => 'opatesti',
3722
+ 3630 => 'poenita',
3723
+ 3631 => 'popesti (golesti)',
3724
+ 3632 => 'tulei-campeni',
3725
+ 3633 => 'vatasesti',
3726
+ 3634 => 'dobricea',
3727
+ 3635 => 'linia (gradistea)',
3728
+ 3636 => 'obislavu',
3729
+ 3637 => 'strachinesti',
3730
+ 3638 => 'tuturu',
3731
+ 3639 => 'valea gradistei',
3732
+ 3640 => 'gusoeni',
3733
+ 3641 => 'burdalesti',
3734
+ 3642 => 'dealu mare (gusoeni)',
3735
+ 3643 => 'gusoianca',
3736
+ 3644 => 'sparleni',
3737
+ 3645 => 'dealu mare (ionesti)',
3738
+ 3646 => 'delureni (ionesti)',
3739
+ 3647 => 'fiscalia',
3740
+ 3648 => 'fotesti',
3741
+ 3649 => 'guguianca',
3742
+ 3650 => 'marcea',
3743
+ 3651 => 'prodanesti',
3744
+ 3652 => 'lalosu',
3745
+ 3653 => 'berbesti (lalosu)',
3746
+ 3654 => 'ghindari',
3747
+ 3655 => 'mologesti',
3748
+ 3656 => 'oltetani',
3749
+ 3657 => 'portaresti',
3750
+ 3658 => 'ladesti',
3751
+ 3659 => 'cermegesti (ladesti)',
3752
+ 3660 => 'chiricesti',
3753
+ 3661 => 'ciumagi',
3754
+ 3662 => 'dealu corni',
3755
+ 3663 => 'maldaresti (ladesti)',
3756
+ 3664 => 'olteanca (ladesti)',
3757
+ 3665 => 'pasculesti',
3758
+ 3666 => 'popesti (ladesti)',
3759
+ 3667 => 'lapusata',
3760
+ 3668 => 'beresti',
3761
+ 3669 => 'mijati',
3762
+ 3670 => '?erbanesti (lapusata',
3763
+ 3671 => 'parausani',
3764
+ 3672 => 'paraienii de jos',
3765
+ 3673 => 'paraienii de mijloc',
3766
+ 3674 => 'paraienii de sus',
3767
+ 3675 => 'plesoiu (livezi)',
3768
+ 3676 => 'tina',
3769
+ 3677 => 'carcadiesti',
3770
+ 3678 => 'fumureni',
3771
+ 3679 => 'gantulei',
3772
+ 3680 => 'stanesti-lunca',
3773
+ 3681 => 'malaia',
3774
+ 3682 => 'ciungetu',
3775
+ 3683 => 'mateesti',
3776
+ 3684 => 'maciuca',
3777
+ 3685 => 'bocsa',
3778
+ 3686 => 'botorani',
3779
+ 3687 => 'maciuceni',
3780
+ 3688 => 'maldaresti (maciuca)',
3781
+ 3689 => 'oveselu',
3782
+ 3690 => 'popesti (maciuca)',
3783
+ 3691 => '?tefanesti (maciuca)',
3784
+ 3692 => 'zavoieni',
3785
+ 3693 => 'madulari',
3786
+ 3694 => 'balsoara',
3787
+ 3695 => 'bantesti',
3788
+ 3696 => 'dimulesti',
3789
+ 3697 => 'iacovile',
3790
+ 3698 => 'mamu',
3791
+ 3699 => 'maldaresti',
3792
+ 3700 => 'maldarestii de jos',
3793
+ 3701 => 'rosoveni',
3794
+ 3702 => 'telechesti',
3795
+ 3703 => 'arsanca',
3796
+ 3704 => 'barsesti (mihaesti)',
3797
+ 3705 => 'buleta',
3798
+ 3706 => 'gurisoara',
3799
+ 3707 => 'munteni',
3800
+ 3708 => 'rugetu (mihaesti)',
3801
+ 3709 => 'stuparei',
3802
+ 3710 => 'vulpuesti',
3803
+ 3711 => 'milcoiu',
3804
+ 3712 => 'cazanesti (milcoiu)',
3805
+ 3713 => 'ciutesti',
3806
+ 3714 => '?uricaru',
3807
+ 3715 => 'tepsenari',
3808
+ 3716 => 'muereasca',
3809
+ 3717 => 'andreiesti',
3810
+ 3718 => 'francesti-coasta',
3811
+ 3719 => 'muereasca de sus',
3812
+ 3720 => 'pripoara',
3813
+ 3721 => '?uta',
3814
+ 3722 => 'corbii din vale',
3815
+ 3723 => 'dosu raului',
3816
+ 3724 => 'galtofani',
3817
+ 3725 => 'ginerica',
3818
+ 3726 => 'linia hanului',
3819
+ 3727 => 'mazararu',
3820
+ 3728 => 'mangureni',
3821
+ 3729 => 'plesoiu (nicolae bal',
3822
+ 3730 => 'popesti (nicolae bal',
3823
+ 3731 => 'rotarasti',
3824
+ 3732 => 'tufanii',
3825
+ 3733 => 'valea balceasca',
3826
+ 3734 => 'olanu',
3827
+ 3735 => 'casa veche',
3828
+ 3736 => 'cioboti',
3829
+ 3737 => 'dragioiu',
3830
+ 3738 => 'orlesti',
3831
+ 3739 => 'auresti',
3832
+ 3740 => 'procopoaia',
3833
+ 3741 => 'scaiosi',
3834
+ 3742 => 'silea',
3835
+ 3743 => 'otesani',
3836
+ 3744 => 'bogdanesti (otesani)',
3837
+ 3745 => 'carstanesti',
3838
+ 3746 => 'cucesti',
3839
+ 3747 => 'sub deal',
3840
+ 3748 => 'pausesti',
3841
+ 3749 => 'barcanele',
3842
+ 3750 => 'buzdugan',
3843
+ 3751 => 'cernelele',
3844
+ 3752 => 'pausesti-otasau',
3845
+ 3753 => '?erbanesti (pausesti',
3846
+ 3754 => '?olicesti',
3847
+ 3755 => 'valeni (pausesti)',
3848
+ 3756 => 'pausesti-maglasi',
3849
+ 3757 => 'coasta (pausesti-mag',
3850
+ 3758 => 'pietrari (pausesti-m',
3851
+ 3759 => 'ulmetel',
3852
+ 3760 => 'valea cheii',
3853
+ 3761 => 'vladuceni',
3854
+ 3762 => 'perisani',
3855
+ 3763 => 'baiasu',
3856
+ 3764 => 'bratovesti',
3857
+ 3765 => 'cucoiu',
3858
+ 3766 => 'mlaceni',
3859
+ 3767 => 'pripoare',
3860
+ 3768 => 'spinu',
3861
+ 3769 => 'surdoiu',
3862
+ 3770 => 'pesceana',
3863
+ 3771 => 'cermegesti (pesceana',
3864
+ 3772 => 'negraia',
3865
+ 3773 => 'roesti (pesceana)',
3866
+ 3774 => 'pietrarii de sus',
3867
+ 3775 => 'curtea',
3868
+ 3776 => 'daesti (popesti)',
3869
+ 3777 => 'firijba',
3870
+ 3778 => 'meieni',
3871
+ 3779 => 'ursi (popesti)',
3872
+ 3780 => 'valea caselor (popes',
3873
+ 3781 => 'prundeni',
3874
+ 3782 => 'barbuceni',
3875
+ 3783 => 'calina',
3876
+ 3784 => 'zavideni',
3877
+ 3785 => 'blanoiu',
3878
+ 3786 => 'bradu-clocotici',
3879
+ 3787 => 'copaceni (racovita)',
3880
+ 3788 => 'gruiu lupului',
3881
+ 3789 => 'roesti',
3882
+ 3790 => 'baiasa',
3883
+ 3791 => 'bajenari',
3884
+ 3792 => 'barbarigeni',
3885
+ 3793 => 'ciocaltei',
3886
+ 3794 => 'cueni',
3887
+ 3795 => 'frasina',
3888
+ 3796 => 'piscu scoartei',
3889
+ 3797 => 'rapa caramizii',
3890
+ 3798 => 'saioci',
3891
+ 3799 => 'rosiile',
3892
+ 3800 => 'balaciu',
3893
+ 3801 => 'cherasti',
3894
+ 3802 => 'hotaroaia',
3895
+ 3803 => 'lupuiesti',
3896
+ 3804 => 'pasarei',
3897
+ 3805 => 'pertesti',
3898
+ 3806 => 'plesesti',
3899
+ 3807 => 'ratalesti',
3900
+ 3808 => 'zgubea',
3901
+ 3809 => 'caligi',
3902
+ 3810 => 'gropeni',
3903
+ 3811 => 'snamana',
3904
+ 3812 => 'surpati',
3905
+ 3813 => 'valea babei',
3906
+ 3814 => 'varateci',
3907
+ 3815 => 'salatrucel',
3908
+ 3816 => 'patesti',
3909
+ 3817 => 'seaca (salatrucel)',
3910
+ 3818 => '?erbanesti (salatruc',
3911
+ 3819 => 'scundu',
3912
+ 3820 => 'avramesti',
3913
+ 3821 => 'ciucheti',
3914
+ 3822 => 'mijlocu',
3915
+ 3823 => 'popesti (sinesti)',
3916
+ 3824 => 'coasta cerbului',
3917
+ 3825 => 'gorunesti (slatioara',
3918
+ 3826 => 'milostea',
3919
+ 3827 => 'mogesti',
3920
+ 3828 => 'rugetu (slatioara)',
3921
+ 3829 => 'cioponesti',
3922
+ 3830 => 'cuculesti',
3923
+ 3831 => 'garnicetu',
3924
+ 3832 => 'linia dealului',
3925
+ 3833 => 'suiesti',
3926
+ 3834 => 'varleni',
3927
+ 3835 => 'budurasti',
3928
+ 3836 => 'gruieri',
3929
+ 3837 => 'neghinesti',
3930
+ 3838 => 'piscu mare',
3931
+ 3839 => 'popesti (stoenesti)',
3932
+ 3840 => 'zmeuratu',
3933
+ 3841 => 'stoilesti',
3934
+ 3842 => 'balomireasa',
3935
+ 3843 => 'barsoiu',
3936
+ 3844 => 'bulagei',
3937
+ 3845 => 'delureni (stoilesti)',
3938
+ 3846 => 'geamana (stoilesti)',
3939
+ 3847 => 'ghiobesti',
3940
+ 3848 => 'giuroiu',
3941
+ 3849 => 'izvoru rece (stoiles',
3942
+ 3850 => 'netesti',
3943
+ 3851 => 'obogeni',
3944
+ 3852 => 'stanesti (stoilesti)',
3945
+ 3853 => 'ursi (stoilesti)',
3946
+ 3854 => 'vladulesti',
3947
+ 3855 => 'dianu',
3948
+ 3856 => 'obrocesti',
3949
+ 3857 => 'pojogi-cerna',
3950
+ 3858 => 'sutesti',
3951
+ 3859 => 'borosesti',
3952
+ 3860 => 'cetateaua',
3953
+ 3861 => 'izvorasu',
3954
+ 3862 => 'mazili',
3955
+ 3863 => 'mitrofani',
3956
+ 3864 => 'racu',
3957
+ 3865 => 'verdea',
3958
+ 3866 => '?irineasa',
3959
+ 3867 => 'aricioaia',
3960
+ 3868 => 'ciorasti',
3961
+ 3869 => 'slavitesti',
3962
+ 3870 => 'valea alunisului',
3963
+ 3871 => 'condoiesti',
3964
+ 3872 => 'dobrusa',
3965
+ 3873 => '?erbanesti (?tefanes',
3966
+ 3874 => '?usani',
3967
+ 3875 => 'ramesti (?usani)',
3968
+ 3876 => 'sarbi',
3969
+ 3877 => 'stoiculesti',
3970
+ 3878 => 'usurei',
3971
+ 3879 => 'tetoiu',
3972
+ 3880 => 'baroiu',
3973
+ 3881 => 'budele',
3974
+ 3882 => 'maneasa',
3975
+ 3883 => 'popesti (tetoiu)',
3976
+ 3884 => 'tepesti',
3977
+ 3885 => 'baltateni',
3978
+ 3886 => 'bogdanesti (tomsani)',
3979
+ 3887 => 'chiceni',
3980
+ 3888 => 'folestii de jos',
3981
+ 3889 => 'miresti',
3982
+ 3890 => 'folestii de sus',
3983
+ 3891 => 'vaideeni',
3984
+ 3892 => 'cerna',
3985
+ 3893 => 'cornet',
3986
+ 3894 => 'izvoru rece (vaideen',
3987
+ 3895 => 'batasani',
3988
+ 3896 => 'delureni (valea mare',
3989
+ 3897 => 'margineni',
3990
+ 3898 => 'fundatura',
3991
+ 3899 => 'trundin',
3992
+ 3900 => 'voicesti',
3993
+ 3901 => 'tighina',
3994
+ 3902 => 'voicestii din vale',
3995
+ 3903 => 'valea macesului',
3996
+ 3904 => 'voinesita',
3997
+ 3905 => 'zatreni',
3998
+ 3906 => 'butanu',
3999
+ 3907 => 'ciortesti',
4000
+ 3908 => 'contea',
4001
+ 3909 => 'dealu glameia',
4002
+ 3910 => 'dealu valeni',
4003
+ 3911 => 'fauresti (zatreni)',
4004
+ 3912 => 'lacusteni',
4005
+ 3913 => 'lacustenii de jos',
4006
+ 3914 => 'lacustenii de sus',
4007
+ 3915 => 'manicea',
4008
+ 3916 => 'mecea',
4009
+ 3917 => 'oltetu',
4010
+ 3918 => 'sascioara',
4011
+ 3919 => 'stanomiru',
4012
+ 3920 => 'valea valeni',
4013
+ 3921 => 'valeni (zatreni)',
4014
+ 3922 => 'zatrenii de sus',
4015
+ 3923 => 'timisoara',
4016
+ 3924 => 'buzias',
4017
+ 3925 => 'bacova',
4018
+ 3926 => 'silagiu',
4019
+ 3927 => 'deta',
4020
+ 3928 => 'opatita',
4021
+ 3929 => 'begheiu mic',
4022
+ 3930 => 'bichigi',
4023
+ 3931 => 'bunea mare',
4024
+ 3932 => 'bunea mica',
4025
+ 3933 => 'colonia mica',
4026
+ 3934 => 'povargina',
4027
+ 3935 => 'temeresti',
4028
+ 3936 => 'jimbolia',
4029
+ 3937 => 'lugoj',
4030
+ 3938 => 'maguri',
4031
+ 3939 => 'tapia',
4032
+ 3940 => 'sannicolau mare',
4033
+ 3941 => 'balint',
4034
+ 3942 => 'bodo',
4035
+ 3943 => 'fadimac',
4036
+ 3944 => 'banloc',
4037
+ 3945 => 'dolat',
4038
+ 3946 => 'ofsenita',
4039
+ 3947 => 'partos',
4040
+ 3948 => 'soca',
4041
+ 3949 => 'lapusnic',
4042
+ 3950 => 'radmanesti',
4043
+ 3951 => 'spata',
4044
+ 3952 => 'barna',
4045
+ 3953 => 'botinesti',
4046
+ 3954 => 'drinova',
4047
+ 3955 => 'juresti',
4048
+ 3956 => 'poganesti',
4049
+ 3957 => 'sarazani',
4050
+ 3958 => 'beba veche',
4051
+ 3959 => 'cherestur',
4052
+ 3960 => 'pordeanu',
4053
+ 3961 => 'becicherecu mic',
4054
+ 3962 => 'dudestii noi',
4055
+ 3963 => 'belint',
4056
+ 3964 => 'babsa',
4057
+ 3965 => 'chizatau',
4058
+ 3966 => 'gruni',
4059
+ 3967 => 'bethausen',
4060
+ 3968 => 'cladova',
4061
+ 3969 => 'cliciova',
4062
+ 3970 => 'cutina',
4063
+ 3971 => 'leucusesti',
4064
+ 3972 => 'nevrincea',
4065
+ 3973 => 'biled',
4066
+ 3974 => 'uihei',
4067
+ 3975 => '?andra',
4068
+ 3976 => 'bogda',
4069
+ 3977 => 'altringen',
4070
+ 3978 => 'buzad',
4071
+ 3979 => 'charlotenburg',
4072
+ 3980 => 'comeat',
4073
+ 3981 => 'sintar',
4074
+ 3982 => 'boldur',
4075
+ 3983 => 'jabar',
4076
+ 3984 => 'ohaba-forgaci',
4077
+ 3985 => 'sinersig',
4078
+ 3986 => 'brestovat',
4079
+ 3987 => 'cosarii',
4080
+ 3988 => 'hodos (brestovat)',
4081
+ 3989 => 'lucaret',
4082
+ 3990 => 'tes',
4083
+ 3991 => 'iecea mare',
4084
+ 3992 => 'iecea mica',
4085
+ 3993 => 'cenad',
4086
+ 3994 => 'cenei',
4087
+ 3995 => 'bobda',
4088
+ 3996 => 'checea',
4089
+ 3997 => 'cheveresu mare',
4090
+ 3998 => 'dragsina',
4091
+ 3999 => 'vucova',
4092
+ 4000 => 'ciacova',
4093
+ 4001 => 'cebza',
4094
+ 4002 => 'gad',
4095
+ 4003 => 'ghilad',
4096
+ 4004 => 'macedonia',
4097
+ 4005 => 'obad',
4098
+ 4006 => 'petroman',
4099
+ 4007 => 'comlosu mare',
4100
+ 4008 => 'comlosu mic',
4101
+ 4009 => 'lunga',
4102
+ 4010 => 'costeiu',
4103
+ 4011 => 'hezeris',
4104
+ 4012 => 'paru',
4105
+ 4013 => 'tipari',
4106
+ 4014 => 'valea lunga romana',
4107
+ 4015 => 'criciova',
4108
+ 4016 => 'ciresu mic',
4109
+ 4017 => 'jdioara',
4110
+ 4018 => 'cosava',
4111
+ 4019 => 'homojdia',
4112
+ 4020 => 'darova',
4113
+ 4021 => 'hodos (darova)',
4114
+ 4022 => 'sacosu mare',
4115
+ 4023 => 'denta',
4116
+ 4024 => 'brestea',
4117
+ 4025 => 'rovinita mare',
4118
+ 4026 => 'rovinita mica',
4119
+ 4027 => 'dudestii vechi',
4120
+ 4028 => 'cheglevici',
4121
+ 4029 => 'colonia bulgara',
4122
+ 4030 => 'valcani',
4123
+ 4031 => 'bucovat (dumbrava)',
4124
+ 4032 => 'rachita',
4125
+ 4033 => 'fardea',
4126
+ 4034 => 'dragsinesti',
4127
+ 4035 => 'gladna montana',
4128
+ 4036 => 'gladna romana',
4129
+ 4037 => 'hauzesti',
4130
+ 4038 => 'matnicu mic',
4131
+ 4039 => 'zolt',
4132
+ 4040 => 'foeni',
4133
+ 4041 => 'cruceni',
4134
+ 4042 => 'gavojdia',
4135
+ 4043 => 'jena',
4136
+ 4044 => 'lugojel',
4137
+ 4045 => 'salbagel',
4138
+ 4046 => 'gataia',
4139
+ 4047 => 'berecuta',
4140
+ 4048 => 'birda',
4141
+ 4049 => 'butin',
4142
+ 4050 => 'manastire',
4143
+ 4051 => 'percosova',
4144
+ 4052 => 'sangeorge',
4145
+ 4053 => 'sculia',
4146
+ 4054 => '?emlacu mare',
4147
+ 4055 => '?emlacu mic',
4148
+ 4056 => 'ghiroda',
4149
+ 4057 => 'giarmata-vii',
4150
+ 4058 => 'ghizela',
4151
+ 4059 => 'hisias',
4152
+ 4060 => 'paniova',
4153
+ 4061 => '?anovita',
4154
+ 4062 => 'giarmata',
4155
+ 4063 => 'cerneteaz',
4156
+ 4064 => 'giera',
4157
+ 4065 => 'granicerii',
4158
+ 4066 => 'toager',
4159
+ 4067 => 'giroc',
4160
+ 4068 => 'chisoda',
4161
+ 4069 => 'giulvaz',
4162
+ 4070 => 'crai nou',
4163
+ 4071 => 'ivanda',
4164
+ 4072 => 'rudna',
4165
+ 4073 => 'jamu mare',
4166
+ 4074 => 'clopodia',
4167
+ 4075 => 'ferendia',
4168
+ 4076 => 'gherman',
4169
+ 4077 => 'latunas',
4170
+ 4078 => 'jebel',
4171
+ 4079 => 'padureni (jebel)',
4172
+ 4080 => 'lenauheim',
4173
+ 4081 => 'bulgarus',
4174
+ 4082 => 'grabat',
4175
+ 4083 => 'liebling',
4176
+ 4084 => 'iosif',
4177
+ 4085 => 'lovrin',
4178
+ 4086 => 'gottlob',
4179
+ 4087 => 'vizejdia',
4180
+ 4088 => 'tomnatic',
4181
+ 4089 => 'margina',
4182
+ 4090 => 'breazova',
4183
+ 4091 => 'bulza',
4184
+ 4092 => 'cosevita',
4185
+ 4093 => 'costeiu de sus',
4186
+ 4094 => 'nemesesti',
4187
+ 4095 => 'zorani',
4188
+ 4096 => 'masloc',
4189
+ 4097 => 'alios',
4190
+ 4098 => 'fibis',
4191
+ 4099 => 'remetea mica',
4192
+ 4100 => 'manastiur',
4193
+ 4101 => 'padurani',
4194
+ 4102 => 'remetea-lunca',
4195
+ 4103 => 'topla',
4196
+ 4104 => 'moravita',
4197
+ 4105 => 'dejan',
4198
+ 4106 => 'gaiu mic',
4199
+ 4107 => 'stamora germana',
4200
+ 4108 => 'mosnita noua',
4201
+ 4109 => 'albina',
4202
+ 4110 => 'mosnita veche',
4203
+ 4111 => 'rudicica',
4204
+ 4112 => 'urseni',
4205
+ 4113 => 'nadrag',
4206
+ 4114 => 'nitchidorf',
4207
+ 4115 => 'blajova',
4208
+ 4116 => 'duboz',
4209
+ 4117 => 'ohaba lunga',
4210
+ 4118 => 'dubesti',
4211
+ 4119 => 'iersnic',
4212
+ 4120 => 'ohaba romana',
4213
+ 4121 => 'ortisoara',
4214
+ 4122 => 'calacea',
4215
+ 4123 => 'seceani',
4216
+ 4124 => 'peciu nou',
4217
+ 4125 => 'dinias',
4218
+ 4126 => 'sanmartinu sarbesc',
4219
+ 4127 => 'periam',
4220
+ 4128 => 'pesac',
4221
+ 4129 => 'crivina de sus',
4222
+ 4130 => 'farasesti',
4223
+ 4131 => 'poieni',
4224
+ 4132 => 'pischia',
4225
+ 4133 => 'bencecu de jos',
4226
+ 4134 => 'bencecu de sus',
4227
+ 4135 => 'murani',
4228
+ 4136 => 'salciua noua',
4229
+ 4137 => 'capat',
4230
+ 4138 => 'ficatar',
4231
+ 4139 => 'hitias',
4232
+ 4140 => 'sarbova',
4233
+ 4141 => 'recas',
4234
+ 4142 => 'bazos',
4235
+ 4143 => 'herneacova',
4236
+ 4144 => 'izvin',
4237
+ 4145 => 'nadas',
4238
+ 4146 => 'petrovaselo',
4239
+ 4147 => 'stanciova',
4240
+ 4148 => 'remetea mare',
4241
+ 4149 => 'bazosu nou',
4242
+ 4150 => 'bucovat (remetea mar',
4243
+ 4151 => 'ianova',
4244
+ 4152 => 'sacosu turcesc',
4245
+ 4153 => 'berini',
4246
+ 4154 => 'icloda',
4247
+ 4155 => 'otvesti',
4248
+ 4156 => 'stamora romana',
4249
+ 4157 => 'uliuc',
4250
+ 4158 => 'unip',
4251
+ 4159 => 'satchinez',
4252
+ 4160 => 'barateaz',
4253
+ 4161 => 'hodoni',
4254
+ 4162 => 'sacalaz',
4255
+ 4163 => 'beregsau mare',
4256
+ 4164 => 'beregsau mic',
4257
+ 4165 => 'sanandrei',
4258
+ 4166 => 'carani',
4259
+ 4167 => 'covaci',
4260
+ 4168 => 'sanmihaiu roman',
4261
+ 4169 => 'sanmihaiu german',
4262
+ 4170 => 'utvin',
4263
+ 4171 => 'sanpetru mare',
4264
+ 4172 => 'igris',
4265
+ 4173 => 'saravale',
4266
+ 4174 => 'secas',
4267
+ 4175 => 'cheches',
4268
+ 4176 => 'crivobara',
4269
+ 4177 => 'vizma',
4270
+ 4178 => '?ag',
4271
+ 4179 => 'parta',
4272
+ 4180 => '?tiuca',
4273
+ 4181 => 'olosag',
4274
+ 4182 => 'zgribesti',
4275
+ 4183 => 'teremia mare',
4276
+ 4184 => 'nerau',
4277
+ 4185 => 'teremia mica',
4278
+ 4186 => 'tomesti',
4279
+ 4187 => 'balosesti',
4280
+ 4188 => 'colonia fabricii',
4281
+ 4189 => 'luncanii de jos',
4282
+ 4190 => 'luncanii de sus',
4283
+ 4191 => 'topolovatu mare',
4284
+ 4192 => 'cralovat',
4285
+ 4193 => 'ictar-budinti',
4286
+ 4194 => 'iosifalau',
4287
+ 4195 => 'sustra',
4288
+ 4196 => 'topolovatu mic',
4289
+ 4197 => 'tormac',
4290
+ 4198 => 'cadar',
4291
+ 4199 => '?ipet',
4292
+ 4200 => 'traian vuia',
4293
+ 4201 => 'jupani',
4294
+ 4202 => 'sudrias',
4295
+ 4203 => 'surducu mic',
4296
+ 4204 => 'susani',
4297
+ 4205 => 'uivar',
4298
+ 4206 => 'iohanisfeld',
4299
+ 4207 => 'otelec',
4300
+ 4208 => 'pustinis',
4301
+ 4209 => 'rauti',
4302
+ 4210 => 'sanmartinu maghiar',
4303
+ 4211 => 'varias',
4304
+ 4212 => 'gelu',
4305
+ 4213 => 'sanpetru mic',
4306
+ 4214 => 'victor vlad delamari',
4307
+ 4215 => 'herendesti',
4308
+ 4216 => 'honorici',
4309
+ 4217 => 'padureni (victor vla',
4310
+ 4218 => 'petroasa mare',
4311
+ 4219 => 'pini',
4312
+ 4220 => 'visag',
4313
+ 4221 => 'voiteg',
4314
+ 4222 => 'folea',
4315
+ 4223 => 'arad',
4316
+ 4224 => 'chisineu-cris',
4317
+ 4225 => 'nadab',
4318
+ 4226 => 'curtici',
4319
+ 4227 => 'dorobanti',
4320
+ 4228 => 'ineu',
4321
+ 4229 => 'mocrea',
4322
+ 4230 => 'lipova',
4323
+ 4231 => 'radna',
4324
+ 4232 => '?oimos',
4325
+ 4233 => 'nadlac',
4326
+ 4234 => 'pancota',
4327
+ 4235 => 'maderat',
4328
+ 4236 => 'sebis',
4329
+ 4237 => 'donceni',
4330
+ 4238 => 'salajeni',
4331
+ 4239 => 'almas',
4332
+ 4240 => 'cil',
4333
+ 4241 => 'joia mare',
4334
+ 4242 => 'apateu',
4335
+ 4243 => 'berechiu',
4336
+ 4244 => 'motiori',
4337
+ 4245 => 'archis',
4338
+ 4246 => 'groseni',
4339
+ 4247 => 'nermis',
4340
+ 4248 => 'bata',
4341
+ 4249 => 'bacau de mijloc',
4342
+ 4250 => 'bulci',
4343
+ 4251 => 'tela',
4344
+ 4252 => 'barsa',
4345
+ 4253 => 'hodis',
4346
+ 4254 => 'voivodeni',
4347
+ 4255 => 'barzava',
4348
+ 4256 => 'batuta',
4349
+ 4257 => 'capruta',
4350
+ 4258 => 'grosii noi',
4351
+ 4259 => 'lalasint',
4352
+ 4260 => 'monorostia',
4353
+ 4261 => 'slatina de mures',
4354
+ 4262 => 'beliu',
4355
+ 4263 => 'bochia',
4356
+ 4264 => 'secaci',
4357
+ 4265 => 'tagadau',
4358
+ 4266 => 'vasile goldis',
4359
+ 4267 => 'birchis',
4360
+ 4268 => 'capalnas',
4361
+ 4269 => 'virismort',
4362
+ 4270 => 'bocsig',
4363
+ 4271 => 'manerau',
4364
+ 4272 => 'rapsig',
4365
+ 4273 => 'brazii',
4366
+ 4274 => 'buceava-?oimus',
4367
+ 4275 => 'iacobini',
4368
+ 4276 => 'madrigesti',
4369
+ 4277 => 'buteni',
4370
+ 4278 => 'berindia',
4371
+ 4279 => 'cuied',
4372
+ 4280 => 'paulian',
4373
+ 4281 => 'carand',
4374
+ 4282 => 'cermei',
4375
+ 4283 => 'avram iancu (cermei)',
4376
+ 4284 => '?omosches',
4377
+ 4285 => 'chisindia',
4378
+ 4286 => 'paiuseni',
4379
+ 4287 => 'vasoaia',
4380
+ 4288 => 'conop',
4381
+ 4289 => 'belotint',
4382
+ 4290 => 'chelmac',
4383
+ 4291 => 'milova',
4384
+ 4292 => 'odvos',
4385
+ 4293 => 'covasint',
4386
+ 4294 => 'craiva',
4387
+ 4295 => 'chislaca',
4388
+ 4296 => 'ciuntesti',
4389
+ 4297 => 'coroi',
4390
+ 4298 => 'maraus',
4391
+ 4299 => 'rogoz de beliu',
4392
+ 4300 => 'stoinesti',
4393
+ 4301 => 'susag',
4394
+ 4302 => '?iad',
4395
+ 4303 => 'talmaci',
4396
+ 4304 => 'dezna',
4397
+ 4305 => 'buhani',
4398
+ 4306 => 'laz',
4399
+ 4307 => 'neagra',
4400
+ 4308 => 'slatina de cris',
4401
+ 4309 => 'dieci',
4402
+ 4310 => 'cociuba',
4403
+ 4311 => 'crocna',
4404
+ 4312 => 'revetis',
4405
+ 4313 => 'frumuseni',
4406
+ 4314 => 'tisa noua',
4407
+ 4315 => 'felnac',
4408
+ 4316 => 'bodrogu nou',
4409
+ 4317 => 'zadareni',
4410
+ 4318 => 'ghioroc',
4411
+ 4319 => 'cuvin',
4412
+ 4320 => 'minis',
4413
+ 4321 => 'graniceri',
4414
+ 4322 => '?iclau',
4415
+ 4323 => 'gurahont',
4416
+ 4324 => 'bontesti',
4417
+ 4325 => 'dulcele',
4418
+ 4326 => 'fenis',
4419
+ 4327 => 'hontisor',
4420
+ 4328 => 'iosas',
4421
+ 4329 => 'mustesti',
4422
+ 4330 => 'pescari',
4423
+ 4331 => 'valea mare (gurahont',
4424
+ 4332 => 'zimbru',
4425
+ 4333 => 'halmagiu',
4426
+ 4334 => 'brusturi',
4427
+ 4335 => 'cristesti',
4428
+ 4336 => 'leasa',
4429
+ 4337 => 'lestioara',
4430
+ 4338 => 'tarmure',
4431
+ 4339 => 'halmagel',
4432
+ 4340 => 'tarnavita',
4433
+ 4341 => 'tohesti',
4434
+ 4342 => 'hasmas',
4435
+ 4343 => 'agrisu mic',
4436
+ 4344 => 'botfei',
4437
+ 4345 => 'clit',
4438
+ 4346 => 'urvisu de beliu',
4439
+ 4347 => 'ignesti',
4440
+ 4348 => 'minead',
4441
+ 4349 => 'nadalbesti',
4442
+ 4350 => 'iratosu',
4443
+ 4351 => 'variasu mare',
4444
+ 4352 => 'variasu mic',
4445
+ 4353 => 'sanleani',
4446
+ 4354 => 'macea',
4447
+ 4355 => 'sanmartin',
4448
+ 4356 => 'misca',
4449
+ 4357 => 'zerindu mic',
4450
+ 4358 => 'moneasa',
4451
+ 4359 => 'ranusa',
4452
+ 4360 => 'sintea mica',
4453
+ 4361 => 'paulis',
4454
+ 4362 => 'baratca',
4455
+ 4363 => 'sambateni',
4456
+ 4364 => 'pecica',
4457
+ 4365 => 'bodrogu vechi',
4458
+ 4366 => 'sederhat',
4459
+ 4367 => 'turnu',
4460
+ 4368 => 'peregu mare',
4461
+ 4369 => 'peregu mic',
4462
+ 4370 => 'corbesti',
4463
+ 4371 => 'ilteu',
4464
+ 4372 => 'rosia noua',
4465
+ 4373 => 'seliste',
4466
+ 4374 => 'pilu',
4467
+ 4375 => 'varsand',
4468
+ 4376 => 'plescuta',
4469
+ 4377 => 'aciuta',
4470
+ 4378 => 'rostoci',
4471
+ 4379 => 'talagiu',
4472
+ 4380 => 'savarsin',
4473
+ 4381 => 'caprioara',
4474
+ 4382 => 'cuias',
4475
+ 4383 => 'halalis',
4476
+ 4384 => 'parnesti',
4477
+ 4385 => 'temesesti',
4478
+ 4386 => 'toc',
4479
+ 4387 => 'troas',
4480
+ 4388 => 'valea mare (savarsin',
4481
+ 4389 => 'santana',
4482
+ 4390 => 'caporal alexa',
4483
+ 4391 => 'secusigiu',
4484
+ 4392 => 'munar',
4485
+ 4393 => 'sanpetru german',
4486
+ 4394 => 'seleus',
4487
+ 4395 => 'iermata',
4488
+ 4396 => 'moroda',
4489
+ 4397 => 'semlac',
4490
+ 4398 => 'sintea mare',
4491
+ 4399 => 'adea',
4492
+ 4400 => 'tipar',
4493
+ 4401 => 'socodor',
4494
+ 4402 => '?agu',
4495
+ 4403 => 'firiteaz',
4496
+ 4404 => 'fiscut',
4497
+ 4405 => 'hunedoara timisana',
4498
+ 4406 => '?eitin',
4499
+ 4407 => '?epreus',
4500
+ 4408 => '?icula',
4501
+ 4409 => 'cherelus',
4502
+ 4410 => 'gurba',
4503
+ 4411 => '?ilindia',
4504
+ 4412 => 'camna',
4505
+ 4413 => 'iercoseni',
4506
+ 4414 => 'luguzau',
4507
+ 4415 => 'satu mic',
4508
+ 4416 => '?imand',
4509
+ 4417 => '?iria',
4510
+ 4418 => 'galsa',
4511
+ 4419 => 'masca',
4512
+ 4420 => '?istarovat',
4513
+ 4421 => 'cuvesdia',
4514
+ 4422 => 'labasint',
4515
+ 4423 => '?ofronea',
4516
+ 4424 => 'sanpaul',
4517
+ 4425 => 'taut',
4518
+ 4426 => 'minisel',
4519
+ 4427 => 'minisu de sus',
4520
+ 4428 => 'tarnova',
4521
+ 4429 => 'araneag',
4522
+ 4430 => 'chier',
4523
+ 4431 => 'draut',
4524
+ 4432 => 'dud',
4525
+ 4433 => 'agrisu mare',
4526
+ 4434 => 'ususau',
4527
+ 4435 => 'bruznic',
4528
+ 4436 => 'dorgos',
4529
+ 4437 => 'patars',
4530
+ 4438 => 'zabalt',
4531
+ 4439 => 'varadia de mures',
4532
+ 4440 => 'baia',
4533
+ 4441 => 'julita',
4534
+ 4442 => 'lupesti',
4535
+ 4443 => 'stejar',
4536
+ 4444 => 'avram iancu (varfuri',
4537
+ 4445 => 'magulicea',
4538
+ 4446 => 'mermesti',
4539
+ 4447 => 'vinga',
4540
+ 4448 => 'mailat',
4541
+ 4449 => 'manastur',
4542
+ 4450 => 'vladimirescu',
4543
+ 4451 => 'cicir',
4544
+ 4452 => 'horia',
4545
+ 4453 => 'mandruloc',
4546
+ 4454 => 'zabrani',
4547
+ 4455 => 'chesint',
4548
+ 4456 => 'neudorf',
4549
+ 4457 => 'zarand',
4550
+ 4458 => 'cintei',
4551
+ 4459 => 'zerind',
4552
+ 4460 => 'iermata neagra',
4553
+ 4461 => 'zimandu nou',
4554
+ 4462 => 'andrei ?aguna',
4555
+ 4463 => 'zimandcuz',
4556
+ 4464 => 'cuptoare (resita)',
4557
+ 4465 => 'doman',
4558
+ 4466 => 'moniom',
4559
+ 4467 => 'terova',
4560
+ 4468 => 'resita',
4561
+ 4469 => 'anina',
4562
+ 4470 => 'steierdorf',
4563
+ 4471 => 'baile herculane',
4564
+ 4472 => 'pecinisca',
4565
+ 4473 => 'caransebes',
4566
+ 4474 => 'jupa',
4567
+ 4475 => 'moldova noua',
4568
+ 4476 => 'macesti',
4569
+ 4477 => 'moldovita',
4570
+ 4478 => 'moldova veche',
4571
+ 4479 => 'oravita',
4572
+ 4480 => 'agadici',
4573
+ 4481 => 'bradisoru de jos',
4574
+ 4482 => 'ciclova montana',
4575
+ 4483 => 'marila',
4576
+ 4484 => 'rachitova',
4577
+ 4485 => 'otelu rosu',
4578
+ 4486 => 'ciresa',
4579
+ 4487 => 'mal',
4580
+ 4488 => 'armenis',
4581
+ 4489 => 'fenes',
4582
+ 4490 => 'sat batran',
4583
+ 4491 => 'sub margine',
4584
+ 4492 => 'bania',
4585
+ 4493 => 'garbovat',
4586
+ 4494 => 'bautar',
4587
+ 4495 => 'bucova',
4588
+ 4496 => 'cornisoru',
4589
+ 4497 => 'preveciori',
4590
+ 4498 => 'berliste',
4591
+ 4499 => 'iam',
4592
+ 4500 => 'rusova noua',
4593
+ 4501 => 'rusova veche',
4594
+ 4502 => 'berzasca',
4595
+ 4503 => 'bigar',
4596
+ 4504 => 'cozla',
4597
+ 4505 => 'drencova',
4598
+ 4506 => 'liubcova',
4599
+ 4507 => 'berzovia',
4600
+ 4508 => 'fizes',
4601
+ 4509 => 'ghertenis',
4602
+ 4510 => 'bolvasnita',
4603
+ 4511 => 'varciorova',
4604
+ 4512 => 'bozovici',
4605
+ 4513 => 'poneasca',
4606
+ 4514 => 'prilipet',
4607
+ 4515 => 'valea minisului',
4608
+ 4516 => 'apadia',
4609
+ 4517 => 'valeadeni',
4610
+ 4518 => 'brebu nou',
4611
+ 4519 => 'garana',
4612
+ 4520 => 'buchin',
4613
+ 4521 => 'lindenfeld',
4614
+ 4522 => 'prisian',
4615
+ 4523 => 'valea timisului',
4616
+ 4524 => 'bucosnita',
4617
+ 4525 => 'golet',
4618
+ 4526 => 'petrosnita',
4619
+ 4527 => 'valisoara',
4620
+ 4528 => 'carasova',
4621
+ 4529 => 'iabalcea',
4622
+ 4530 => 'nermed',
4623
+ 4531 => '?tinapari',
4624
+ 4532 => 'ciclova romana',
4625
+ 4533 => 'ilidia',
4626
+ 4534 => 'socolari',
4627
+ 4535 => 'ciuchici',
4628
+ 4536 => 'macoviste (ciuchici)',
4629
+ 4537 => 'nicolint',
4630
+ 4538 => 'petrilova',
4631
+ 4539 => 'ciudanovita',
4632
+ 4540 => 'jitin',
4633
+ 4541 => 'constantin daicovici',
4634
+ 4542 => 'cavaran',
4635
+ 4543 => 'maciova',
4636
+ 4544 => 'matnicu mare',
4637
+ 4545 => 'pestere',
4638
+ 4546 => 'zagujeni',
4639
+ 4547 => 'copacele',
4640
+ 4548 => 'ohaba-matnic',
4641
+ 4549 => 'ruginosu',
4642
+ 4550 => 'cornea',
4643
+ 4551 => 'crusovat',
4644
+ 4552 => 'cuptoare (cornea)',
4645
+ 4553 => 'macoviste (cornea)',
4646
+ 4554 => 'cornereva',
4647
+ 4555 => 'bogaltin',
4648
+ 4556 => 'bojia',
4649
+ 4557 => 'borugi',
4650
+ 4558 => 'camena',
4651
+ 4559 => 'ciresel',
4652
+ 4560 => 'costis',
4653
+ 4561 => 'cracu mare',
4654
+ 4562 => 'cracu teiului',
4655
+ 4563 => 'dobraia',
4656
+ 4564 => 'dolina',
4657
+ 4565 => 'hora mare',
4658
+ 4566 => 'hora mica',
4659
+ 4567 => 'inelet',
4660
+ 4568 => 'lunca florii',
4661
+ 4569 => 'lunca zaicii',
4662
+ 4570 => 'negiudin',
4663
+ 4571 => 'obita',
4664
+ 4572 => 'pogara',
4665
+ 4573 => 'pogara de sus',
4666
+ 4574 => 'poiana lunga',
4667
+ 4575 => 'prisacina',
4668
+ 4576 => 'prislop (cornereva)',
4669
+ 4577 => 'rustin',
4670
+ 4578 => 'strugasca',
4671
+ 4579 => 'studena',
4672
+ 4580 => 'sub crang',
4673
+ 4581 => 'sub plai',
4674
+ 4582 => 'tatu',
4675
+ 4583 => 'zanogi',
4676
+ 4584 => 'zbegu',
4677
+ 4585 => 'zmogotin',
4678
+ 4586 => 'zoina',
4679
+ 4587 => 'coronini',
4680
+ 4588 => 'sfanta elena',
4681
+ 4589 => 'dalboset',
4682
+ 4590 => 'barz',
4683
+ 4591 => 'boina',
4684
+ 4592 => 'boinita',
4685
+ 4593 => 'prislop (dalboset)',
4686
+ 4594 => 'resita mica',
4687
+ 4595 => '?opotu vechi',
4688
+ 4596 => 'doclin',
4689
+ 4597 => 'binis',
4690
+ 4598 => 'tirol',
4691
+ 4599 => 'dognecea',
4692
+ 4600 => 'domasnea',
4693
+ 4601 => 'canicea',
4694
+ 4602 => 'eftimie murgu',
4695
+ 4603 => 'ezeris',
4696
+ 4604 => 'farliug',
4697
+ 4605 => 'dezesti',
4698
+ 4606 => 'duleu',
4699
+ 4607 => 'remetea-poganici',
4700
+ 4608 => 'scaius',
4701
+ 4609 => 'forotic',
4702
+ 4610 => 'brezon',
4703
+ 4611 => 'comoraste',
4704
+ 4612 => 'surducu mare',
4705
+ 4613 => 'garnic',
4706
+ 4614 => 'padina matei',
4707
+ 4615 => 'glimboca',
4708
+ 4616 => 'goruia',
4709
+ 4617 => 'garliste',
4710
+ 4618 => 'giurgiova',
4711
+ 4619 => 'greoni',
4712
+ 4620 => 'globu craiovei',
4713
+ 4621 => 'petnic',
4714
+ 4622 => 'lapusnicel',
4715
+ 4623 => 'parvova',
4716
+ 4624 => '?umita',
4717
+ 4625 => 'lapusnicu mare',
4718
+ 4626 => 'moceris',
4719
+ 4627 => 'luncavita',
4720
+ 4628 => 'verendin',
4721
+ 4629 => 'lupac',
4722
+ 4630 => 'clocotici',
4723
+ 4631 => 'rafnic',
4724
+ 4632 => 'vodnic',
4725
+ 4633 => 'vama marga',
4726
+ 4634 => 'maureni',
4727
+ 4635 => '?osdea',
4728
+ 4636 => 'mehadia',
4729
+ 4637 => 'globurau',
4730
+ 4638 => 'plugova',
4731
+ 4639 => 'valea bolvasnita',
4732
+ 4640 => 'mehadica',
4733
+ 4641 => 'naidas',
4734
+ 4642 => 'lescovita',
4735
+ 4643 => 'iaz',
4736
+ 4644 => 'var',
4737
+ 4645 => 'ocna de fier',
4738
+ 4646 => 'cornutel',
4739
+ 4647 => 'delinesti',
4740
+ 4648 => 'ohabita',
4741
+ 4649 => 'pojejena',
4742
+ 4650 => 'belobresca',
4743
+ 4651 => 'divici',
4744
+ 4652 => 'radimna',
4745
+ 4653 => '?usca',
4746
+ 4654 => 'prigor',
4747
+ 4655 => 'borlovenii noi',
4748
+ 4656 => 'borlovenii vechi',
4749
+ 4657 => 'patas',
4750
+ 4658 => 'putna',
4751
+ 4659 => 'ramna',
4752
+ 4660 => 'barbosu',
4753
+ 4661 => 'valeapai',
4754
+ 4662 => 'racasdia',
4755
+ 4663 => 'vraniut',
4756
+ 4664 => 'rusca montana',
4757
+ 4665 => 'ruschita',
4758
+ 4666 => 'sacu',
4759
+ 4667 => 'salbagelu nou',
4760
+ 4668 => 'tincova',
4761
+ 4669 => 'sasca montana',
4762
+ 4670 => 'bogodint',
4763
+ 4671 => 'potoc',
4764
+ 4672 => 'sasca romana',
4765
+ 4673 => 'slatina-nera',
4766
+ 4674 => 'sichevita',
4767
+ 4675 => 'brestelnic',
4768
+ 4676 => 'camenita',
4769
+ 4677 => 'carsie',
4770
+ 4678 => 'cracu almaj',
4771
+ 4679 => 'crusovita',
4772
+ 4680 => 'frasinis',
4773
+ 4681 => 'gornea',
4774
+ 4682 => 'liborajdea',
4775
+ 4683 => 'lucacevat',
4776
+ 4684 => 'martinovat',
4777
+ 4685 => 'ogasu podului',
4778
+ 4686 => 'streneac',
4779
+ 4687 => 'valea orevita',
4780
+ 4688 => 'valea ravensca',
4781
+ 4689 => 'valea sichevitei',
4782
+ 4690 => 'zanou',
4783
+ 4691 => 'zasloane',
4784
+ 4692 => 'slatina-timis',
4785
+ 4693 => 'ilova',
4786
+ 4694 => 'sadova noua',
4787
+ 4695 => 'sadova veche',
4788
+ 4696 => 'socol',
4789
+ 4697 => 'bazias',
4790
+ 4698 => 'campia',
4791
+ 4699 => 'parneaura',
4792
+ 4700 => '?opotu nou',
4793
+ 4701 => 'carsa rosie',
4794
+ 4702 => 'dristie',
4795
+ 4703 => 'poienile boinei',
4796
+ 4704 => 'ravensca',
4797
+ 4705 => 'stancilova',
4798
+ 4706 => 'urcu',
4799
+ 4707 => 'valea rachitei',
4800
+ 4708 => 'valea rosie',
4801
+ 4709 => 'bratova',
4802
+ 4710 => 'teregova',
4803
+ 4711 => 'rusca',
4804
+ 4712 => 'ticvaniu mare',
4805
+ 4713 => 'carnecea',
4806
+ 4714 => 'secaseni',
4807
+ 4715 => 'ticvaniu mic',
4808
+ 4716 => 'toplet',
4809
+ 4717 => 'turnu ruieni',
4810
+ 4718 => 'borlova',
4811
+ 4719 => 'cicleni',
4812
+ 4720 => 'dalci',
4813
+ 4721 => 'zervesti',
4814
+ 4722 => 'zlagna',
4815
+ 4723 => 'valiug',
4816
+ 4724 => 'varadia',
4817
+ 4725 => 'mercina',
4818
+ 4726 => 'vermes',
4819
+ 4727 => 'ersig',
4820
+ 4728 => 'izgar',
4821
+ 4729 => 'vrani',
4822
+ 4730 => 'ciortea',
4823
+ 4731 => 'iertof',
4824
+ 4732 => 'poiana marului',
4825
+ 4733 => 'valea bistrei',
4826
+ 4734 => 'voislova',
4827
+ 4735 => 'zlatita',
4828
+ 4736 => 'zorlentu mare',
4829
+ 4737 => 'zorlencior',
4830
+ 4738 => 'archia',
4831
+ 4739 => 'barcea mica',
4832
+ 4740 => 'cristur',
4833
+ 4741 => 'santuhalm',
4834
+ 4742 => 'deva',
4835
+ 4743 => 'bos',
4836
+ 4744 => 'gros',
4837
+ 4745 => 'hasdat',
4838
+ 4746 => 'pestisu mare',
4839
+ 4747 => 'racastia',
4840
+ 4748 => 'hunedoara',
4841
+ 4749 => 'dalja mare',
4842
+ 4750 => 'dalja mica',
4843
+ 4751 => 'pestera (petrosani)',
4844
+ 4752 => 'slatinioara',
4845
+ 4753 => 'petrosani',
4846
+ 4754 => 'iscroni',
4847
+ 4755 => 'brad',
4848
+ 4756 => 'mesteacan (brad)',
4849
+ 4757 => 'potingani',
4850
+ 4758 => 'ruda-brad',
4851
+ 4759 => 'taratel',
4852
+ 4760 => 'calan',
4853
+ 4761 => 'batiz',
4854
+ 4762 => 'calanu mic',
4855
+ 4763 => 'grid',
4856
+ 4764 => 'nadastia de jos',
4857
+ 4765 => 'nadastia de sus',
4858
+ 4766 => 'ohaba streiului',
4859
+ 4767 => 'sancrai',
4860
+ 4768 => 'santamaria de piatra',
4861
+ 4769 => 'strei',
4862
+ 4770 => 'strei-sacel',
4863
+ 4771 => 'streisangeorgiu',
4864
+ 4772 => 'valea sangeorgiului',
4865
+ 4773 => 'geoagiu',
4866
+ 4774 => 'aurel vlaicu',
4867
+ 4775 => 'bacaia',
4868
+ 4776 => 'bozes',
4869
+ 4777 => 'cigmau',
4870
+ 4778 => 'gelmar',
4871
+ 4779 => 'homorod',
4872
+ 4780 => 'mermezeu-valeni',
4873
+ 4781 => 'renghet',
4874
+ 4782 => 'valeni (geoagiu)',
4875
+ 4783 => 'geoagiu-bai',
4876
+ 4784 => 'hateg',
4877
+ 4785 => 'nalatvad',
4878
+ 4786 => 'silvasu de jos',
4879
+ 4787 => 'silvasu de sus',
4880
+ 4788 => 'lupeni',
4881
+ 4789 => 'orastie',
4882
+ 4790 => 'petrila',
4883
+ 4791 => 'cimpa',
4884
+ 4792 => 'jiet',
4885
+ 4793 => 'rascoala',
4886
+ 4794 => 'tirici',
4887
+ 4795 => 'simeria',
4888
+ 4796 => 'barcea mare',
4889
+ 4797 => 'santandrei',
4890
+ 4798 => 'simeria veche',
4891
+ 4799 => '?aulesti',
4892
+ 4800 => 'uroi',
4893
+ 4801 => 'uricani',
4894
+ 4802 => 'campu lui neag',
4895
+ 4803 => 'valea de brazi',
4896
+ 4804 => 'vulcan',
4897
+ 4805 => 'dealu babii',
4898
+ 4806 => 'jiu-paroseni',
4899
+ 4807 => 'baia de cris',
4900
+ 4808 => 'baldovin',
4901
+ 4809 => 'caraci',
4902
+ 4810 => 'carastau',
4903
+ 4811 => 'lunca (baia de cris)',
4904
+ 4812 => 'risca',
4905
+ 4813 => 'risculita',
4906
+ 4814 => 'tebea',
4907
+ 4815 => 'valeni (baia de cris',
4908
+ 4816 => 'balsa',
4909
+ 4817 => 'almasu mic de munte',
4910
+ 4818 => 'ardeu',
4911
+ 4819 => 'galbina',
4912
+ 4820 => 'mada',
4913
+ 4821 => 'oprisesti',
4914
+ 4822 => 'stauini',
4915
+ 4823 => 'techereu',
4916
+ 4824 => 'valisoara (balsa)',
4917
+ 4825 => 'baru',
4918
+ 4826 => 'petros',
4919
+ 4827 => 'bacia',
4920
+ 4828 => 'petreni',
4921
+ 4829 => 'tampa',
4922
+ 4830 => 'totia',
4923
+ 4831 => 'baita',
4924
+ 4832 => 'barbura',
4925
+ 4833 => 'cainelu de sus',
4926
+ 4834 => 'hartagani',
4927
+ 4835 => 'lunca (baita)',
4928
+ 4836 => 'ormindea',
4929
+ 4837 => 'pestera (baita)',
4930
+ 4838 => 'crivadia',
4931
+ 4839 => 'merisor (banita)',
4932
+ 4840 => 'batrana',
4933
+ 4841 => 'fata rosie',
4934
+ 4842 => 'rachitaua',
4935
+ 4843 => 'beriu',
4936
+ 4844 => 'castau',
4937
+ 4845 => 'cucuis',
4938
+ 4846 => 'orastioara de jos',
4939
+ 4847 => 'poieni (beriu)',
4940
+ 4848 => 'sereca',
4941
+ 4849 => 'sibisel (beriu)',
4942
+ 4850 => 'blajeni',
4943
+ 4851 => 'blajeni-vulcan',
4944
+ 4852 => 'cris',
4945
+ 4853 => 'dragu-brad',
4946
+ 4854 => 'grosuri',
4947
+ 4855 => 'ret',
4948
+ 4856 => 'bosorod',
4949
+ 4857 => 'alun (bosorod)',
4950
+ 4858 => 'chitid',
4951
+ 4859 => 'cioclovina',
4952
+ 4860 => 'luncani',
4953
+ 4861 => 'prihodiste (bosorod)',
4954
+ 4862 => 'ursici',
4955
+ 4863 => 'branisca',
4956
+ 4864 => 'barastii iliei',
4957
+ 4865 => 'boz',
4958
+ 4866 => 'cabesti',
4959
+ 4867 => 'furcsoara',
4960
+ 4868 => 'gialacuta',
4961
+