tig_postnl - Version 1.4.1

Version Notes

==== v1.4.1 ====
==== New features ====
- Completely redesigned the configuration page of the extension!
- The extension's configuration page has now been split into a wizard-style menu for the core settings and a separate advanced options menu.

==== Improvements ====
- Added forwards compatibility to Magento 1.6 for advanced configuration field dependencies and other features that were introduced in Magento 1.7.
- Only stated address fee will now be hidden if the fee is less than 1 cent.
- Delivery days will now show 'as soon as possible' as the delivery time when no delivery days are available.
- The status update cron will now run 3 times a day. Before it was only 2 times a day.
- Added additional transactional email parameters to the track & trace email.

==== Bug fixes ====
- Only stated address option is no longer available for letter box orders.
- Removed two legacy references to css files from the frontend's layout XML file.
- Fixed a problem where the delivery option fee would not be reset if delivery options became unavailable during checkout.
- Fixed the delivery options responsive design in OneStepCheckout on older versions of Magento.
- Fixed an issue that prevented the order grid from being filtered on the order ID column.
- International track & trace URL's now use PostNL's new track & trace URL syntax. The old syntax is no longer supported by PostNL.
- Fixed a PHP warning level error that could occur if no additional options were saved for a PostNL order.

==== v1.4.0 ====
==== New features ====
- Added a new responsive design for PostNL delivery options.
- Added the option to specify on which days of the week the merchant will ship orders.
- Added the option to print packing slips directly from the order detail page.
- Added the option for customers to choose whether their order can be delivered to their neighbours in case they are not home during the delivery.
- Added a new PostNL rate type that allows merchants to finely tune their shipping costs.
- Added the option to charge a separate shipping rate for letter box parcels.

==== Improvements ====
- Modified a lot of heavy loading functionality in order to improve performance.
- PostNL Checkout will now check if an order is a letter box parcel before deciding whether PostNL Checkout should be available.
- In order to decrease server load during the extension's installation or upgrade, modifying product attributes is now handled by a temporary cron job.
- A comment will now be added to the order and shipment page when the PostNL track & trace email is sent.
- Evening delivery will no longer be available for letter box parcel orders.

==== Bug fixes ====
- FIxed the filter functionality of the order grid's confirm date column.
- Fixed a problem where the extra cover amount was missing when extra cover was used as a default shipping option.
- Fixed a problem where adding coupon codes in OneStepCheckout would disable delivery options.
- PostNL Checkout's weight calculation will no longer assume all items are weightless when a free shipping cart rule is active.
- Fixed a problem in the CMS page source model causing errors.
- Fixed a problem where tax calculation would not work as expected when tax calculation was set to before discount.
- Fixed a problem where it would be impossible to use the create shipment mass action when certain product options were disabled.
- Fixed problem where shipping to EPS countries could cause errors.
- Fixed an issue where the COD payment method would be hidden for regular shipments.
- Fixed an issue where the print labels mass action would also confirm the shipment
- Adding a new address in multi-address checkout will no longer cause errors when postcode check has been enabled.
- Fixed a bug in the updatePostnlOrder observer that caused errors when ordering virtual orders.

==== v1.3.1 ====
==== Bug fixes ====
- Confirm dates will no longer be shown as always being in the future.
- Added additional checks to prevent deleted Magento orders and shipments from causing errors.
- Prevented VAT amounts from being shown twice on the checkout page.
- It is no longer impossible to create multi-parcel shipments when 'letter box calculation mode' is set to automatic.
- Prevented COD fees from causing errors on the invoice page in the backend.

==== v1.3.0 ====
==== New features ====
- Added the option to ship orders as letter box parcels. Letter box parcels are shipped using the regular mail service and can be shipped at a reduced rate. It's possible to let the PostNL extension determine when an order qualifies as a letter box parcel or to decide this manually when creating a shipment in Magento.
- Added a new PostNL COD payment method that is fully integrated in the other PostNL services offered by the extension. It's possible to charge an additional fee to customers for using PostNL COD. It's also possible to have the extension automatically invoice COD orders once they have been delivered to the customer.
- Added a new PostNL packing slip. This packing slip may contain the PostNL shipping label, allowing you to use the packing slip as the shipping label for the parcel.
- Added the option to enable or disable delivery options at the product level.
- Added the ability to convert existing shipments to a letter box parcel or to a regular parcel as long as they have not been received by PostNL.
- Added the ability to change the selected shipping option for a shipment as long as it has not yet been received by PostNL.
- Added the option to use additional shipping methods for PostNL.
- Added the option to create a shipment, confirm it and print it's shipping labels for an order straight from the order grid in a single click.

==== Improvements ====
- It's now possible to enable or disable time frames separately from delivery days.
- You can now specify the cut-off time in minutes as well as hours.
- You can now view an order's confirm date, confirm status and shipping phase in the order grid.
- Additional information regarding the chosen delivery option is now shown on the order detail page.
- Added a button to download all PostNL debug log files to the PostNL configuration page.
- The 'create shipments' massaction interface has been modified so that only valid options are displayed.
- Errors that occur whilst processing multiple shipments or orders will no longer stop the entire process. Instead the remaining orders and shipments will be processed and an error message specifying which orders or shipments caused an error will be displayed afterwards.
- The first and last name fields are no longer mandatory for the sender's address fields in the PostNL configuration.
- Spaces are now allowed in postcodes.

==== Bug fixes ====
- Deleting orders from Magento should no longer cause errors when processing PostNL shipments.
- The PostNL shipping method will no longer be selected by default.
- Greece will now be processed with EPS, instead of GlobalPack.
- Upgrade and install scripts will now check if certain columns and attributes exist before modifying them.
- The progress bar on the Onepage Checkout page will now correctly update the shipping costs when the customer has chosen a delivery option that charges an additional fee.
- Creating shipments for which no default shipping option is selected will no longer cause errors.

==== v1.2.2 ====
==== New features ====
- Added the option to send a copy of the track & trace email to a specified email address.

==== Improvements ====
- Performance of the entire extension has been improved. The extension will now attempt to cache several configuration values.
- Label printing will now always follow the 'label size' configuration setting.

==== Bug fixes ====
- Fixed several small html errors in the track & trace email template.
- Fixed an SQL error that could occur when filtering the 'store' column in the order and shipment grids.

==== v1.2.1 ====
==== Release highlights ====
- The extension now fully supports Magento 1.9 and 1.14!

==== Minor improvements ====
- Added additional checks to prevent errors when Magento's layout has been altered or PostNL's layout has not been uploaded properly.
- Added additional compatibility enhancements for MultiSafePay and other PSP extensions.
- Improved several minor texts and translations.

==== Bug fixes ====
- Fixed an issue that prevented MijnPakket login data from being cached.
- Fixed an issue where using PostNL-only features on non-PostNL shipments would cause an error.
- Fixed an issue where PostNL's feed messages would be loaded in the wrong order.
- Fixed an issue where several notifications would be added to Magento when installing an unsupported version of Magento with the PostNL extension.
- Fixed an issue with EPS comb-labels. EPS combi-labels were rotated by 90 degrees, causing overlapping issues with other labels being printed.

==== v1.2.0 =====
==== New features ====
- Added delivery options to the checkout flow. Customers can now choose where, when and how they want their order shipped when choosing their preferred shipping method.
- Added support for evening delivery, early pickup locations and parcel dispenser locations.
- Added Dutch postcode validation support.
- Added the option to create a parcelware export csv file directly from the Magento backend.
- Added a MijnPakket login feature. Customers who have a MijnPakket account can use this feature to automatically fill in their preferred billing and shipping address.

==== Minor improvements ====
- Refactored the label printing functionality. Shipping labels will now be opened in a separate window from where they may be printed or downloaded.
- Added the option to select where on an A4 page the shipping labels will start printing. This allows you to re-use partially used sticker-sheets.
- Added many new customization options for the shipment grid in the Magento backend.
- Added the ability to view and edit a chosen post office delivery address from the Magento backend.
- Added the option to only show the PostNL Checkout feature to customers who have a MijnPakket account.
- Refactored many sections of the source code to improve readability and extensibility.
- Moved several configuration settings.
- Merged the 'test/live mode' settings of PostNl Checkout and Label Printing & Confirming functionality. There is now a single option to set the entire extension to test or live mode.
- Added the option to upload separate csv files for the PostNL shipping method in 'table rate' configuration.

==== Bug fixes ====
- Fixed an issue where it was not possible to choose to only manually send track & trace information.
- Fixed several typos and translation errors.

==== v1.1.5 =====

==== Bug fixes ====
- Fixed a problem with account validation only using test mode account credentials
- Made a minor security improvement to the notification system.
- Fixed an issue where shipments could not be confirmed if the shipping address did not have an email address.
- Fixed an issue where PostNl Checkout would incorrectly identify a product as being out of stock.
- Fixed an issue where for some shops PostNl Checkout would not function due to incorrect usage of https in an http environment.

==== v1.1.4 =====

==== New features ====
- Added a default test account to the extension. New installation will automatically have a PostNL test account pre-configured.
- Added the option to undo a confirmation as long as the shipment has not been received by PostNL.
- Added the option to delete shipping labels. This allows you to correct an address after a shipping label has been printed. Before this change if you noticed an error in the address after you had already printed a shipping label, you had to place en entire new order to correct it. Now you can simply delete the shipping label, edit the address and print a new shipping label with the new address.

==== Minor change ====
- The validate settings button in the extension’s configuration page now also validates settings while the extension is set to test mode.
- Removed the 'EU Pack Standard (Belgium only, no signature)' product option. If you use this option, please contact the Total Internet Group servicedesk.
- The extension's test mode is now available by default. In earlier versions you had to allow test mode through a setting under advanced options.
- When a confirmation expires, the barcode's track & trace link will now also be removed.
- Improved various texts and translations.

==== Bug fixes ====
- Solved an issue where certain configurations of the PostNL shipping method would only appear if the Magento tablerates shipping method was also active.
- Solved an issue where filtering the order and shipment grids in the Magento backend on certain columns would cause an error.
- Solved an issue where the shipment status cron would stop as soon as it encountered an error, rather than continue processing the remaining shipments.
- Solved an issue where you could not confirm a shipment without a barcode due to process locking when developer mode is active.
- Solved issue in Safari where labels would be printed as .pdf.html, rather than just .pdf files.

==== v1.1.3 ====

- FIxed an issue with the extension's activation procedure.

==== v1.1.2 ====

- Updated manual.

==== v1.1.1 ====

- Fixed issue where filtering the first column of the shipment grid could cause errors.
- Removed PHP extension dependencies from the PostNL extension packages. Magento connect would sometimes falsely report a PHP extension as missing preventing the PostNL extension from being installed.

==== v1.1.0 ====

- First public release.

==== v1.0.8 ====

- Improved compatibility with Magento 1.6 and 1.11.

==== v1.0.7 ====

- Improved configuration fields.
- Improved translations.

==== v1.0.6 ====

- Improved shipment grid interface. It shoulod now be more clear which shipments have been confirmed and when they should be handed over to PostNL.
- Improved PostNL Checkout payment method handling. The Checkout summary page should now remember your chosen bank when you attempt to pay using iDEAL. 100% support for all payment methods is not guaranteed.

==== v1.0.5 ====

- Several bug fixes.
- Improved configuration interface.

==== v1.0.4 ====

- Several minor bug fixes.
- Improved Dutch translations.
- Added additional information to several fields in system/config.

==== v1.0.3 ====

- Several bug fixes. Including an issue preventing the extension from functioning properly with the compiler active.
- Several improvements to the Dutch translations.
- Improved the extension's system > config interface
- Added the Klarna payment method to PostNL Checkout

==== v1.0.2 ====

- A large number of bug fixes and general improvements
- Improved error handling. Almost all errors will now automatically provide you with a link where you can find more information and a possible solution.

==== v1.0.1 ====

- Added a filter to the possible product options you may select, based on the selected orders when mass-creating shipments from the order grid.
- Improved several translations.
- Fixed several minor bugs.

==== v1.0.0 ====

This is the initial beta release of the extension. If you have any questions, please contact the Total Internet Group Servicedesk

Download this release

Release Info

Developer TIG
Extension tig_postnl
Version 1.4.1
Comparing to
See all releases


Code changes from version 1.3.1 to 1.4.1

Files changed (257) hide show
  1. app/code/community/TIG/PostNL/Block/Adminhtml/Carrier/Postnl/Matrixrate/Grid.php +147 -0
  2. app/code/community/TIG/PostNL/Block/Adminhtml/Carrier/Postnl/Tablerate/Grid.php +4 -5
  3. app/code/community/TIG/PostNL/Block/Adminhtml/CronNotification.php +3 -3
  4. app/code/community/TIG/PostNL/Block/Adminhtml/LogNotification.php +3 -3
  5. app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Items/Column/Qty.php +3 -3
  6. app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/Create/Totals/CodFee.php +3 -3
  7. app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/Creditmemo/Create/CodFee.php +3 -3
  8. app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/Creditmemo/Totals/CodFee.php +3 -3
  9. app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/Invoice/Totals/CodFee.php +3 -3
  10. app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/ProductOptions.php +3 -3
  11. app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/Shipment/Create/ShipmentOptions.php +4 -4
  12. app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/Shipment/View/DeliveryOptions.php +69 -3
  13. app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/Shipment/View/ShippingStatus.php +3 -3
  14. app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/Shipment/View/Tab/StatusHistory.php +3 -3
  15. app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/Shipment/View/Tabs.php +3 -3
  16. app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/Totals/CodFee.php +3 -3
  17. app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/View/DeliveryOptions.php +47 -3
  18. app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form.php +42 -6
  19. app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/ActivateButton.php +5 -5
  20. app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/ActivatedFieldHeader.php +6 -4
  21. app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/Anchor.php +3 -3
  22. app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/Checkbox.php +111 -0
  23. app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/ConfigCheck.php +4 -4
  24. app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/HourMinute.php +22 -9
  25. app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/InfoBox.php +3 -3
  26. app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/MatrixrateExport.php +82 -0
  27. app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/MatrixrateImport.php +59 -0
  28. app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/Obscure.php +3 -3
  29. app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/PackingSlipItemColumns.php +3 -3
  30. app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/Radios.php +171 -0
  31. app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/SplitAddressCheck.php +24 -13
  32. app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/SupportTab.php +85 -43
  33. app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/TablerateExport.php +3 -3
  34. app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/TablerateImport.php +3 -3
  35. app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/TextBox/Abstract.php +3 -3
  36. app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/ValidateButton.php +3 -3
  37. app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/WarningBox.php +3 -3
  38. app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/WizardSaveButton.php +151 -0
  39. app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Fieldset.php +168 -3
  40. app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Js.php +183 -0
  41. app/code/community/TIG/PostNL/Block/Adminhtml/Template.php +3 -3
  42. app/code/community/TIG/PostNL/Block/Adminhtml/UpgradeNotification.php +70 -0
  43. app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Form/Element/Dependence.php +76 -0
  44. app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/Action.php +3 -3
  45. app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/Barcode.php +3 -3
  46. app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/ConfirmDate.php +3 -3
  47. app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/ConfirmStatus.php +3 -3
  48. app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/CountryArray.php +88 -0
  49. app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/DeliveryDate.php +3 -3
  50. app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/OrderConfirmDate.php +26 -15
  51. app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/OrderConfirmStatus.php +3 -3
  52. app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/OrderType.php +9 -4
  53. app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/ShipmentType.php +3 -3
  54. app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/ShippingDescription.php +3 -3
  55. app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/ShippingPhase.php +3 -3
  56. app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/Time.php +3 -3
  57. app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/Translate.php +3 -3
  58. app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/Type/Abstract.php +39 -3
  59. app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/YesNo.php +3 -3
  60. app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Massaction/Item/Additional/LabelStartPos.php +3 -3
  61. app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Massaction/Item/Additional/ProductOptions.php +3 -3
  62. app/code/community/TIG/PostNL/Block/Adminhtml/WindowsTheme.php +3 -3
  63. app/code/community/TIG/PostNL/Block/Checkout/Cart/CheckoutLink.php +43 -8
  64. app/code/community/TIG/PostNL/Block/Checkout/Cart/Js.php +21 -20
  65. app/code/community/TIG/PostNL/Block/Checkout/Summary.php +3 -3
  66. app/code/community/TIG/PostNL/Block/Core/JsTranslate.php +3 -3
  67. app/code/community/TIG/PostNL/Block/Core/ShippingStatus.php +68 -13
  68. app/code/community/TIG/PostNL/Block/Core/Template.php +3 -3
  69. app/code/community/TIG/PostNL/Block/DeliveryOptions/Checkout/AddPhoneNumber.php +3 -3
  70. app/code/community/TIG/PostNL/Block/DeliveryOptions/Checkout/DeliveryOptions.php +237 -22
  71. app/code/community/TIG/PostNL/Block/DeliveryOptions/Js.php +3 -3
  72. app/code/community/TIG/PostNL/Block/DeliveryOptions/Template.php +3 -3
  73. app/code/community/TIG/PostNL/Block/DeliveryOptions/Theme.php +68 -11
  74. app/code/community/TIG/PostNL/Block/Mijnpakket/AccountNotification.php +5 -5
  75. app/code/community/TIG/PostNL/Block/Mijnpakket/Js.php +11 -11
  76. app/code/community/TIG/PostNL/Block/Mijnpakket/LoginButton.php +9 -9
  77. app/code/community/TIG/PostNL/Block/Mijnpakket/OrderSuccessJs.php +3 -3
  78. app/code/community/TIG/PostNL/Block/Payment/Checkout/Total/CodFee.php +3 -3
  79. app/code/community/TIG/PostNL/Block/Payment/Form/Cod.php +3 -3
  80. app/code/community/TIG/PostNL/Block/Payment/Info.php +3 -3
  81. app/code/community/TIG/PostNL/Block/Payment/Sales/Order/Creditmemo/Totals/CodFee.php +3 -3
  82. app/code/community/TIG/PostNL/Block/Payment/Sales/Order/Invoice/Totals/CodFee.php +3 -3
  83. app/code/community/TIG/PostNL/Block/Payment/Sales/Order/Totals/CodFee.php +3 -3
  84. app/code/community/TIG/PostNL/Controller/Adminhtml/Config.php +59 -0
  85. app/code/community/TIG/PostNL/Controller/Adminhtml/Shipment.php +416 -33
  86. app/code/community/TIG/PostNL/Exception.php +3 -3
  87. app/code/community/TIG/PostNL/Helper/AddressValidation.php +35 -22
  88. app/code/community/TIG/PostNL/Helper/Carrier.php +159 -68
  89. app/code/community/TIG/PostNL/Helper/Checkout.php +22 -29
  90. app/code/community/TIG/PostNL/Helper/Cif.php +18 -5
  91. app/code/community/TIG/PostNL/Helper/Data.php +191 -36
  92. app/code/community/TIG/PostNL/Helper/DeliveryOptions.php +701 -112
  93. app/code/community/TIG/PostNL/Helper/Mijnpakket.php +3 -3
  94. app/code/community/TIG/PostNL/Helper/Parcelware.php +3 -3
  95. app/code/community/TIG/PostNL/Helper/Payment.php +39 -196
  96. app/code/community/TIG/PostNL/Helper/Webservices.php +3 -3
  97. app/code/community/TIG/PostNL/Model/AddressValidation/Cendris.php +3 -3
  98. app/code/community/TIG/PostNL/Model/AddressValidation/Cendris/Abstract.php +3 -3
  99. app/code/community/TIG/PostNL/Model/AddressValidation/Observer/AddressBook.php +3 -3
  100. app/code/community/TIG/PostNL/Model/AddressValidation/Observer/OneStepCheckout.php +3 -3
  101. app/code/community/TIG/PostNL/Model/AddressValidation/Observer/Onepage.php +3 -3
  102. app/code/community/TIG/PostNL/Model/AddressValidation/System/Config/Backend/ValidateAccount.php +22 -5
  103. app/code/community/TIG/PostNL/Model/Admin/Inbox.php +3 -3
  104. app/code/community/TIG/PostNL/Model/Admin/Logging/Handler/Postnl.php +3 -3
  105. app/code/community/TIG/PostNL/Model/Admin/Logging/Observer.php +3 -3
  106. app/code/community/TIG/PostNL/Model/Adminhtml/Form/Element/Checkbox.php +3 -3
  107. app/code/community/TIG/PostNL/Model/Adminhtml/Observer/OrderGrid.php +316 -175
  108. app/code/community/TIG/PostNL/Model/Adminhtml/Observer/ShipmentGrid.php +40 -63
  109. app/code/community/TIG/PostNL/Model/Adminhtml/Observer/ShipmentView.php +54 -10
  110. app/code/community/TIG/PostNL/Model/Adminhtml/Observer/SystemConfig.php +4 -6
  111. app/code/community/TIG/PostNL/Model/Adminhtml/Support/Logs.php +3 -3
  112. app/code/community/TIG/PostNL/Model/Adminhtml/System/Config/Source/OrderGridColumns.php +3 -3
  113. app/code/community/TIG/PostNL/Model/Adminhtml/System/Config/Source/OrderGridMassaction.php +7 -3
  114. app/code/community/TIG/PostNL/Model/Adminhtml/System/Config/Source/ShipmentGridColumns.php +3 -3
  115. app/code/community/TIG/PostNL/Model/Adminhtml/System/Config/Source/ShipmentGridMassaction.php +3 -3
  116. app/code/community/TIG/PostNL/Model/Carrier/Matrixrate.php +57 -0
  117. app/code/community/TIG/PostNL/Model/Carrier/Postnl.php +176 -11
  118. app/code/community/TIG/PostNL/Model/Carrier/Quote/Address/Total/Shipping.php +13 -19
  119. app/code/community/TIG/PostNL/Model/Carrier/Resource/Matrixrate.php +588 -0
  120. app/code/community/TIG/PostNL/Model/Carrier/Resource/Matrixrate/Collection.php +73 -0
  121. app/code/community/TIG/PostNL/Model/Carrier/Resource/Tablerate.php +3 -3
  122. app/code/community/TIG/PostNL/Model/Carrier/Resource/Tablerate/Collection.php +3 -3
  123. app/code/community/TIG/PostNL/Model/Carrier/System/Config/Backend/Matrixrate.php +48 -0
  124. app/code/community/TIG/PostNL/Model/Carrier/System/Config/Backend/Tablerate.php +3 -3
  125. app/code/community/TIG/PostNL/Model/Carrier/System/Config/Source/RateType.php +7 -3
  126. app/code/community/TIG/PostNL/Model/Carrier/System/Config/Source/TablerateSource.php +3 -3
  127. app/code/community/TIG/PostNL/Model/Carrier/Tablerate.php +3 -3
  128. app/code/community/TIG/PostNL/Model/Checkout/Cif.php +5 -5
  129. app/code/community/TIG/PostNL/Model/Checkout/Observer/Order.php +3 -3
  130. app/code/community/TIG/PostNL/Model/Checkout/Observer/Shipment.php +3 -3
  131. app/code/community/TIG/PostNL/Model/Checkout/Order.php +3 -3
  132. app/code/community/TIG/PostNL/Model/Checkout/Service.php +14 -14
  133. app/code/community/TIG/PostNL/Model/Checkout/System/Config/Source/ActivePaymentMethods.php +3 -3
  134. app/code/community/TIG/PostNL/Model/Checkout/System/Config/Source/CmsPage.php +11 -8
  135. app/code/community/TIG/PostNL/Model/Core/Cache.php +15 -3
  136. app/code/community/TIG/PostNL/Model/Core/Cif.php +115 -75
  137. app/code/community/TIG/PostNL/Model/Core/Cif/Abstract.php +63 -18
  138. app/code/community/TIG/PostNL/Model/Core/Cif/Exception.php +3 -3
  139. app/code/community/TIG/PostNL/Model/Core/Label.php +3 -3
  140. app/code/community/TIG/PostNL/Model/Core/Observer/Barcode.php +8 -8
  141. app/code/community/TIG/PostNL/Model/Core/Observer/Cache.php +3 -3
  142. app/code/community/TIG/PostNL/Model/Core/Observer/Cron.php +147 -9
  143. app/code/community/TIG/PostNL/Model/Core/Observer/SaveShipment.php +3 -3
  144. app/code/community/TIG/PostNL/Model/Core/Order.php +144 -3
  145. app/code/community/TIG/PostNL/Model/Core/PackingSlip.php +6 -5
  146. app/code/community/TIG/PostNL/Model/Core/Packingslip/Pdf/Items/Invoice/Default.php +3 -3
  147. app/code/community/TIG/PostNL/Model/Core/Resource/Order.php +3 -3
  148. app/code/community/TIG/PostNL/Model/Core/Resource/Order/Collection.php +3 -3
  149. app/code/community/TIG/PostNL/Model/Core/Resource/Shipment.php +3 -3
  150. app/code/community/TIG/PostNL/Model/Core/Resource/Shipment/Barcode.php +3 -3
  151. app/code/community/TIG/PostNL/Model/Core/Resource/Shipment/Barcode/Collection.php +3 -3
  152. app/code/community/TIG/PostNL/Model/Core/Resource/Shipment/Collection.php +3 -3
  153. app/code/community/TIG/PostNL/Model/Core/Resource/Shipment/Label.php +3 -3
  154. app/code/community/TIG/PostNL/Model/Core/Resource/Shipment/Label/Collection.php +3 -3
  155. app/code/community/TIG/PostNL/Model/Core/Resource/Shipment/Status/History.php +3 -3
  156. app/code/community/TIG/PostNL/Model/Core/Resource/Shipment/Status/History/Collection.php +3 -3
  157. app/code/community/TIG/PostNL/Model/Core/Service.php +3 -3
  158. app/code/community/TIG/PostNL/Model/Core/Service/InvoiceDummy.php +3 -3
  159. app/code/community/TIG/PostNL/Model/Core/Service/OrderDummy.php +3 -3
  160. app/code/community/TIG/PostNL/Model/Core/Shipment.php +337 -119
  161. app/code/community/TIG/PostNL/Model/Core/Shipment/Barcode.php +3 -3
  162. app/code/community/TIG/PostNL/Model/Core/Shipment/Label.php +3 -3
  163. app/code/community/TIG/PostNL/Model/Core/Shipment/Process.php +3 -3
  164. app/code/community/TIG/PostNL/Model/Core/Shipment/Status/History.php +3 -3
  165. app/code/community/TIG/PostNL/Model/Core/System/Config/Backend/HourMinute.php +3 -3
  166. app/code/community/TIG/PostNL/Model/Core/System/Config/Backend/Image/Pdf.php +3 -3
  167. app/code/community/TIG/PostNL/Model/Core/System/Config/Backend/ValidateDefaultOption.php +4 -4
  168. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/AllProductOptions.php +55 -34
  169. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/Attributes.php +4 -3
  170. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/BuspakjeProductOptions.php +3 -3
  171. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/CheckoutExtensions.php +66 -0
  172. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/CommentType.php +3 -3
  173. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/CutOffTime.php +3 -3
  174. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/DebugMode.php +3 -3
  175. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/Direction.php +3 -3
  176. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/EuProductOptions.php +13 -9
  177. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/GlobalProductOptions.php +3 -3
  178. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/GlobalpackShipmentType.php +3 -3
  179. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/HourMinute.php +3 -3
  180. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/LabelSize.php +5 -5
  181. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/ManualAutomatic.php +3 -3
  182. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/PackingSlipItemFields.php +3 -3
  183. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/PakjeGemakProductOptions.php +3 -3
  184. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/PakketautomaatProductOptions.php +3 -3
  185. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/ProductOptions/Abstract.php +4 -4
  186. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/ReferenceType.php +3 -3
  187. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/ShippingDays.php +78 -0
  188. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/ShippingDuration.php +3 -3
  189. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/ShippingMethods.php +3 -3
  190. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/StandardProductOptions.php +99 -73
  191. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/StreetField.php +3 -3
  192. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/StreetFieldWithDefault.php +3 -3
  193. app/code/community/TIG/PostNL/Model/Core/System/Config/Source/WeightUnit.php +4 -6
  194. app/code/community/TIG/PostNL/Model/DeliveryOptions/Cif.php +6 -6
  195. app/code/community/TIG/PostNL/Model/DeliveryOptions/Observer/ShippingMethodAvailable.php +58 -8
  196. app/code/community/TIG/PostNL/Model/DeliveryOptions/Observer/UpdatePostnlOrder.php +78 -7
  197. app/code/community/TIG/PostNL/Model/DeliveryOptions/Product/Attribute/Source/ShippingDuration.php +3 -3
  198. app/code/community/TIG/PostNL/Model/DeliveryOptions/Service.php +64 -14
  199. app/code/community/TIG/PostNL/Model/DeliveryOptions/System/Config/Backend/ValidateFee.php +3 -3
  200. app/code/community/TIG/PostNL/Model/DeliveryOptions/System/Config/Source/DeliveryDaysNumber.php +3 -3
  201. app/code/community/TIG/PostNL/Model/DeliveryOptions/System/Config/Source/Themes.php +3 -3
  202. app/code/community/TIG/PostNL/Model/ExtensionControl/Feed.php +3 -3
  203. app/code/community/TIG/PostNL/Model/ExtensionControl/Observer/Cron.php +3 -3
  204. app/code/community/TIG/PostNL/Model/ExtensionControl/Webservices.php +89 -25
  205. app/code/community/TIG/PostNL/Model/ExtensionControl/Webservices/Abstract.php +5 -5
  206. app/code/community/TIG/PostNL/Model/Inbox.php +3 -3
  207. app/code/community/TIG/PostNL/Model/Mijnpakket/Cif.php +3 -3
  208. app/code/community/TIG/PostNL/Model/Mijnpakket/Service.php +3 -3
  209. app/code/community/TIG/PostNL/Model/Parcelware/Export.php +3 -3
  210. app/code/community/TIG/PostNL/Model/Payment/Cod.php +3 -3
  211. app/code/community/TIG/PostNL/Model/Payment/Observer/Cod.php +3 -3
  212. app/code/community/TIG/PostNL/Model/Payment/Order/Creditmemo/Total/CodFee.php +4 -4
  213. app/code/community/TIG/PostNL/Model/Payment/Order/Creditmemo/Total/CodFee/Abstract.php +3 -3
  214. app/code/community/TIG/PostNL/Model/Payment/Order/Creditmemo/Total/CodFeeTax.php +3 -3
  215. app/code/community/TIG/PostNL/Model/Payment/Order/Invoice/Total/CodFee.php +3 -3
  216. app/code/community/TIG/PostNL/Model/Payment/Order/Invoice/Total/CodFeeTax.php +3 -3
  217. app/code/community/TIG/PostNL/Model/Payment/Order/Invoice/Total/Subtotal.php +3 -3
  218. app/code/community/TIG/PostNL/Model/Payment/Order/Pdf/Total/CodFee.php +3 -3
  219. app/code/community/TIG/PostNL/Model/Payment/Order/Pdf/Total/Grandtotal.php +3 -3
  220. app/code/community/TIG/PostNL/Model/Payment/Order/Pdf/Total/Tax.php +3 -3
  221. app/code/community/TIG/PostNL/Model/Payment/Quote/Address/Total/CodFee.php +3 -3
  222. app/code/community/TIG/PostNL/Model/Payment/Quote/Address/Total/CodFee/Abstract.php +16 -3
  223. app/code/community/TIG/PostNL/Model/Payment/Quote/Address/Total/CodFeeTax.php +6 -6
  224. app/code/community/TIG/PostNL/Model/Payment/Service.php +252 -0
  225. app/code/community/TIG/PostNL/Model/Payment/System/Config/Source/CodFeeTaxClass.php +3 -3
  226. app/code/community/TIG/PostNL/Model/Resource/Catalog/Product.php +3 -3
  227. app/code/community/TIG/PostNL/Model/Resource/Db/Abstract.php +3 -3
  228. app/code/community/TIG/PostNL/Model/Resource/Db/Collection/Postnl.php +3 -3
  229. app/code/community/TIG/PostNL/Model/Resource/Order/Grid/Collection.php +3 -3
  230. app/code/community/TIG/PostNL/Model/Resource/Order/Shipment/Grid/Collection.php +3 -3
  231. app/code/community/TIG/PostNL/Model/Resource/Setup.php +323 -56
  232. app/code/community/TIG/PostNL/Model/System/Config/Backend/Checkbox.php +55 -0
  233. app/code/community/TIG/PostNL/Model/System/Config/Source/Testlive.php +12 -4
  234. app/code/community/TIG/PostNL/Model/System/Config/Source/Yesno.php +3 -3
  235. app/code/community/TIG/PostNL/controllers/AddressValidationController.php +3 -3
  236. app/code/community/TIG/PostNL/controllers/Adminhtml/ConfigController.php +185 -4
  237. app/code/community/TIG/PostNL/controllers/Adminhtml/ExtensionControlController.php +64 -7
  238. app/code/community/TIG/PostNL/controllers/Adminhtml/ShipmentController.php +132 -195
  239. app/code/community/TIG/PostNL/controllers/CheckoutController.php +8 -8
  240. app/code/community/TIG/PostNL/controllers/DeliveryOptionsController.php +11 -6
  241. app/code/community/TIG/PostNL/controllers/MijnpakketController.php +3 -3
  242. app/code/community/TIG/PostNL/data/postnl_setup/data-install-1.0.0.php +3 -3
  243. app/code/community/TIG/PostNL/data/postnl_setup/data-install-1.0.3.php +3 -3
  244. app/code/community/TIG/PostNL/data/postnl_setup/data-install-1.1.4.php +3 -3
  245. app/code/community/TIG/PostNL/data/postnl_setup/data-install-1.3.0.php +5 -3
  246. app/code/community/TIG/PostNL/data/postnl_setup/data-install-1.4.0.php +158 -0
  247. app/code/community/TIG/PostNL/data/postnl_setup/data-install-1.4.1.php +158 -0
  248. app/code/community/TIG/PostNL/data/postnl_setup/data-upgrade-1.1.5-1.2.0.php +3 -3
  249. app/code/community/TIG/PostNL/data/postnl_setup/data-upgrade-1.2.2-1.3.0.php +7 -3
  250. app/code/community/TIG/PostNL/data/postnl_setup/data-upgrade-1.2.2-1.4.0.php +230 -0
  251. app/code/community/TIG/PostNL/data/postnl_setup/data-upgrade-1.3.1-1.4.0.php +116 -0
  252. app/code/community/TIG/PostNL/data/postnl_setup/data-upgrade-1.4.0-1.4.1.php +129 -0
  253. app/code/community/TIG/PostNL/etc/adminhtml.xml +3 -3
  254. app/code/community/TIG/PostNL/etc/config.xml +459 -336
  255. app/code/community/TIG/PostNL/etc/jstranslator.xml +18 -3
  256. app/code/community/TIG/PostNL/etc/logging.xml +3 -3
  257. app/code/community/TIG/PostNL/etc/system.xml +480 -542
app/code/community/TIG/PostNL/Block/Adminhtml/Carrier/Postnl/Matrixrate/Grid.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ class TIG_PostNL_Block_Adminhtml_Carrier_Postnl_Matrixrate_Grid
40
+ extends Mage_Adminhtml_Block_Shipping_Carrier_Tablerate_Grid
41
+ {
42
+ /**
43
+ * Define grid properties.
44
+ */
45
+ public function __construct()
46
+ {
47
+ parent::__construct();
48
+ $this->setId('postnlShippingMatrixrateGrid');
49
+ $this->_exportPageSize = 10000;
50
+ }
51
+
52
+ /**
53
+ * Prepare shipping table rate collection
54
+ *
55
+ * @return Mage_Adminhtml_Block_Widget_Grid
56
+ */
57
+ protected function _prepareCollection()
58
+ {
59
+ $collection = Mage::getResourceModel('postnl_carrier/matrixrate_collection');
60
+ $collection->setWebsiteFilter($this->getWebsiteId());
61
+
62
+ $this->setCollection($collection);
63
+ return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
64
+ }
65
+
66
+ /**
67
+ * Prepare table columns
68
+ *
69
+ * @return Mage_Adminhtml_Block_Widget_Grid
70
+ */
71
+ protected function _prepareColumns()
72
+ {
73
+ $this->addColumn(
74
+ 'dest_country',
75
+ array(
76
+ 'header' => $this->__('Country'),
77
+ 'index' => 'dest_country_id',
78
+ 'default' => '*',
79
+ 'renderer' => 'postnl_adminhtml/widget_grid_column_renderer_countryArray'
80
+ )
81
+ );
82
+
83
+ $this->addColumn(
84
+ 'dest_region',
85
+ array(
86
+ 'header' => $this->__('Region/State'),
87
+ 'index' => 'dest_region',
88
+ 'default' => '*',
89
+ )
90
+ );
91
+
92
+ $this->addColumn(
93
+ 'dest_zip',
94
+ array(
95
+ 'header' => $this->__('Zip/Postal Code'),
96
+ 'index' => 'dest_zip',
97
+ 'default' => '*',
98
+ )
99
+ );
100
+
101
+ $this->addColumn(
102
+ 'weight',
103
+ array(
104
+ 'header' => $this->__('Minimum Order Weight'),
105
+ 'index' => 'weight',
106
+ 'default' => 0,
107
+ )
108
+ );
109
+
110
+ $this->addColumn(
111
+ 'subtotal',
112
+ array(
113
+ 'header' => $this->__('Minimum Order Amount'),
114
+ 'index' => 'subtotal',
115
+ 'default' => 0,
116
+ )
117
+ );
118
+
119
+ $this->addColumn(
120
+ 'qty',
121
+ array(
122
+ 'header' => $this->__('Minimum Quantity'),
123
+ 'index' => 'qty',
124
+ 'default' => 0,
125
+ )
126
+ );
127
+
128
+ $this->addColumn(
129
+ 'parcel_type',
130
+ array(
131
+ 'header' => $this->__('Parcel Type'),
132
+ 'index' => 'parcel_type',
133
+ 'default' => '*',
134
+ )
135
+ );
136
+
137
+ $this->addColumn(
138
+ 'price',
139
+ array(
140
+ 'header' => $this->__('Shipping Price'),
141
+ 'index' => 'price',
142
+ )
143
+ );
144
+
145
+ return Mage_Adminhtml_Block_Widget_Grid::_prepareColumns();
146
+ }
147
+ }
app/code/community/TIG/PostNL/Block/Adminhtml/Carrier/Postnl/Tablerate/Grid.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Carrier_Postnl_Tablerate_Grid
@@ -42,11 +42,10 @@ class TIG_PostNL_Block_Adminhtml_Carrier_Postnl_Tablerate_Grid
42
  /**
43
  * Prepare shipping table rate collection
44
  *
45
- * @return Mage_Adminhtml_Block_Shipping_Carrier_Tablerate_Grid
46
  */
47
  protected function _prepareCollection()
48
  {
49
- /** @var $collection Mage_Shipping_Model_Mysql4_Carrier_Tablerate_Collection */
50
  $collection = Mage::getResourceModel('postnl_carrier/tablerate_collection');
51
  $collection->setConditionFilter($this->getConditionName())
52
  ->setWebsiteFilter($this->getWebsiteId());
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Carrier_Postnl_Tablerate_Grid
42
  /**
43
  * Prepare shipping table rate collection
44
  *
45
+ * @return Mage_Adminhtml_Block_Widget_Grid
46
  */
47
  protected function _prepareCollection()
48
  {
 
49
  $collection = Mage::getResourceModel('postnl_carrier/tablerate_collection');
50
  $collection->setConditionFilter($this->getConditionName())
51
  ->setWebsiteFilter($this->getWebsiteId());
app/code/community/TIG/PostNL/Block/Adminhtml/CronNotification.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_CronNotification extends TIG_PostNL_Block_Adminhtml_Template
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_CronNotification extends TIG_PostNL_Block_Adminhtml_Template
app/code/community/TIG/PostNL/Block/Adminhtml/LogNotification.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasMaxLogSize()
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasMaxLogSize()
app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Items/Column/Qty.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Sales_Items_Column_Qty extends Mage_Adminhtml_Block_Sales_Items_Column_Qty
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Sales_Items_Column_Qty extends Mage_Adminhtml_Block_Sales_Items_Column_Qty
app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/Create/Totals/CodFee.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method Varien_Object getTotal()
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method Varien_Object getTotal()
app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/Creditmemo/Create/CodFee.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Sales_Order_Creditmemo_Create_CodFee extends Mage_Adminhtml_Block_Template
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Sales_Order_Creditmemo_Create_CodFee extends Mage_Adminhtml_Block_Template
app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/Creditmemo/Totals/CodFee.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Sales_Order_Creditmemo_Totals_CodFee
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Sales_Order_Creditmemo_Totals_CodFee
app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/Invoice/Totals/CodFee.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Sales_Order_Invoice_Totals_CodFee
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Sales_Order_Invoice_Totals_CodFee
app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/ProductOptions.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasExtraCoverProductOptions()
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasExtraCoverProductOptions()
app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/Shipment/Create/ShipmentOptions.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasShipment()
@@ -51,7 +51,7 @@ class TIG_PostNL_Block_Adminhtml_Sales_Order_Shipment_Create_ShipmentOptions ext
51
  /**
52
  * Xpath to the buspakje calculation mode setting.
53
  */
54
- const XPATH_BUSPAKJE_CALC_MODE = 'postnl/cif_labels_and_confirming/buspakje_calculation_mode';
55
 
56
  /**
57
  * @var string
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasShipment()
51
  /**
52
  * Xpath to the buspakje calculation mode setting.
53
  */
54
+ const XPATH_BUSPAKJE_CALC_MODE = 'postnl/delivery_options/buspakje_calculation_mode';
55
 
56
  /**
57
  * @var string
app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/Shipment/View/DeliveryOptions.php CHANGED
@@ -25,20 +25,22 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasPostnlShipment()
 
40
  *
41
  * @method TIG_PostNL_Block_Adminhtml_Sales_Order_View_DeliveryOptions setPostnlShipment(TIG_PostNL_Model_Core_Shipment $value)
 
42
  * @method TIG_PostNL_Block_Adminhtml_Sales_Order_View_DeliveryOptions setIsCod(boolean $value)
43
  * @method TIG_PostNL_Block_Adminhtml_Sales_Order_View_DeliveryOptions setSubType(string $value)
44
  *
@@ -99,6 +101,23 @@ class TIG_PostNL_Block_Adminhtml_Sales_Order_Shipment_View_DeliveryOptions
99
  return $postnlShipment;
100
  }
101
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  /**
103
  * Get available product options for the current shipment.
104
  *
@@ -243,4 +262,51 @@ class TIG_PostNL_Block_Adminhtml_Sales_Order_Shipment_View_DeliveryOptions
243
 
244
  return $url;
245
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasPostnlShipment()
40
+ * @method boolean hasPostnlOrder()
41
  *
42
  * @method TIG_PostNL_Block_Adminhtml_Sales_Order_View_DeliveryOptions setPostnlShipment(TIG_PostNL_Model_Core_Shipment $value)
43
+ * @method TIG_PostNL_Block_Adminhtml_Sales_Order_View_DeliveryOptions setPostnlOrder(TIG_PostNL_Model_Core_Order $value)
44
  * @method TIG_PostNL_Block_Adminhtml_Sales_Order_View_DeliveryOptions setIsCod(boolean $value)
45
  * @method TIG_PostNL_Block_Adminhtml_Sales_Order_View_DeliveryOptions setSubType(string $value)
46
  *
101
  return $postnlShipment;
102
  }
103
 
104
+ /**
105
+ * @return TIG_PostNL_Model_Core_Order|false
106
+ */
107
+ public function getPostnlOrder()
108
+ {
109
+ if ($this->hasPostnlOrder()) {
110
+ return $this->_getData('postnl_order');
111
+ }
112
+
113
+ $postnlShipment = $this->getPostnlShipment();
114
+
115
+ $postnlOrder = $postnlShipment->getPostnlOrder();
116
+
117
+ $this->setPostnlOrder($postnlOrder);
118
+ return $postnlOrder;
119
+ }
120
+
121
  /**
122
  * Get available product options for the current shipment.
123
  *
262
 
263
  return $url;
264
  }
265
+
266
+ /**
267
+ * Check if the customer chose any additional options during checkout.
268
+ *
269
+ * @return bool
270
+ */
271
+ public function hasExtraOptions()
272
+ {
273
+ $postnlOrder = $this->getPostnlOrder();
274
+ if (!$postnlOrder || !$postnlOrder->getId()) {
275
+ return false;
276
+ }
277
+
278
+ $hasOptions = $postnlOrder->hasOptions();
279
+ return $hasOptions;
280
+ }
281
+
282
+ /**
283
+ * Get additional options the customer chose during checkout.
284
+ *
285
+ * @return array
286
+ */
287
+ public function getFormattedExtraOptions()
288
+ {
289
+ $postnlOptions = $this->getPostnlOrder();
290
+
291
+ $options = $postnlOptions->getOptions();
292
+ if (!$options) {
293
+ return array();
294
+ }
295
+
296
+ $formattedOptions = array();
297
+ foreach ($options as $option => $value) {
298
+ if (!$value) {
299
+ continue;
300
+ }
301
+
302
+ switch ($option) {
303
+ case 'only_stated_address':
304
+ $formattedOptions[] = $this->__('deliver to stated address only');
305
+ break;
306
+ //no default
307
+ }
308
+ }
309
+
310
+ return $formattedOptions;
311
+ }
312
  }
app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/Shipment/View/ShippingStatus.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Sales_Order_Shipment_View_ShippingStatus extends TIG_PostNL_Block_Adminhtml_Template
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Sales_Order_Shipment_View_ShippingStatus extends TIG_PostNL_Block_Adminhtml_Template
app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/Shipment/View/Tab/StatusHistory.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Sales_Order_Shipment_View_Tab_StatusHistory extends Mage_Adminhtml_Block_Widget_Grid
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Sales_Order_Shipment_View_Tab_StatusHistory extends Mage_Adminhtml_Block_Widget_Grid
app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/Shipment/View/Tabs.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Sales_Order_Shipment_View_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Sales_Order_Shipment_View_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/Totals/CodFee.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Sales_Order_Totals_CodFee extends Mage_Adminhtml_Block_Sales_Order_Totals
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Sales_Order_Totals_CodFee extends Mage_Adminhtml_Block_Sales_Order_Totals
app/code/community/TIG/PostNL/Block/Adminhtml/Sales/Order/View/DeliveryOptions.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasOrder()
@@ -173,4 +173,48 @@ class TIG_PostNL_Block_Adminhtml_Sales_Order_View_DeliveryOptions extends TIG_Po
173
  $subType .= ' + ' . $this->__('COD');
174
  return $subType;
175
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasOrder()
173
  $subType .= ' + ' . $this->__('COD');
174
  return $subType;
175
  }
176
+
177
+ /**
178
+ * Check if the customer chose any additional options during checkout.
179
+ *
180
+ * @return bool
181
+ */
182
+ public function hasExtraOptions()
183
+ {
184
+ $postnlOrder = $this->getPostnlOrder();
185
+
186
+ $hasOptions = $postnlOrder->hasOptions();
187
+ return $hasOptions;
188
+ }
189
+
190
+ /**
191
+ * Get additional options the customer chose during checkout.
192
+ *
193
+ * @return array
194
+ */
195
+ public function getFormattedExtraOptions()
196
+ {
197
+ $postnlOptions = $this->getPostnlOrder();
198
+
199
+ $options = $postnlOptions->getOptions();
200
+ if (!$options) {
201
+ return array();
202
+ }
203
+
204
+ $formattedOptions = array();
205
+ foreach ($options as $option => $value) {
206
+ if (!$value) {
207
+ continue;
208
+ }
209
+
210
+ switch ($option) {
211
+ case 'only_stated_address':
212
+ $formattedOptions[] = $this->__('deliver to stated address only');
213
+ break;
214
+ //no default
215
+ }
216
+ }
217
+
218
+ return $formattedOptions;
219
+ }
220
  }
app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasFieldsetParam()
@@ -382,9 +382,9 @@ class TIG_PostNL_Block_Adminhtml_System_Config_Form extends Mage_Adminhtml_Block
382
  . '_' . $fieldPrefix
383
  . $dependentFieldNameValue;
384
  $shouldBeAddedDependence = true;
385
- $dependentValue = (string)(isset($dependent->value) ? $dependent->value : $dependent);
386
- if (isset($dependent['separator'])) {
387
- $dependentValue = explode((string)$dependent['separator'], $dependentValue);
388
  }
389
  $dependentFieldName = $fieldPrefix . $dependent->getName();
390
  $dependentField = $dependentFieldGroup->fields->$dependentFieldName;
@@ -493,4 +493,40 @@ class TIG_PostNL_Block_Adminhtml_System_Config_Form extends Mage_Adminhtml_Block
493
 
494
  return $this;
495
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
496
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasFieldsetParam()
382
  . '_' . $fieldPrefix
383
  . $dependentFieldNameValue;
384
  $shouldBeAddedDependence = true;
385
+ $dependentValue = (string) (isset($dependent->value) ? $dependent->value : $dependent);
386
+ if (isset($dependent->separator)) {
387
+ $dependentValue = explode((string) $dependent->separator, $dependentValue);
388
  }
389
  $dependentFieldName = $fieldPrefix . $dependent->getName();
390
  $dependentField = $dependentFieldGroup->fields->$dependentFieldName;
493
 
494
  return $this;
495
  }
496
+
497
+ /**
498
+ * Add a new checkbox element type.
499
+ *
500
+ * @return array
501
+ */
502
+ protected function _getAdditionalElementTypes()
503
+ {
504
+ $elementTypes = parent::_getAdditionalElementTypes();
505
+ $elementTypes['checkbox'] = Mage::getConfig()
506
+ ->getBlockClassName('postnl_adminhtml/system_config_form_field_checkbox');
507
+
508
+ $elementTypes['wizard_save_button'] = Mage::getConfig()
509
+ ->getBlockClassName(
510
+ 'postnl_adminhtml/system_config_form_field_wizardSaveButton'
511
+ );
512
+
513
+ $elementTypes['postnl_radios'] = Mage::getConfig()
514
+ ->getBlockClassName('postnl_adminhtml/system_config_form_field_radios');
515
+
516
+ return $elementTypes;
517
+ }
518
+
519
+ /**
520
+ * Return dependency block object
521
+ *
522
+ * @return TIG_PostNL_Block_Adminhtml_Widget_Form_Element_Dependence
523
+ */
524
+ protected function _getDependence()
525
+ {
526
+ if (!$this->getChild('element_dependense')){
527
+ $this->setChild('element_dependense',
528
+ $this->getLayout()->createBlock('postnl_adminhtml/widget_form_element_dependence'));
529
+ }
530
+ return $this->getChild('element_dependense');
531
+ }
532
  }
app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/ActivateButton.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_ActivateButton setElement(Varien_Data_Form_Element_Abstract $value)
@@ -60,9 +60,9 @@ class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_ActivateButton
60
 
61
  $isActivated = Mage::getStoreConfig(self::XPATH_IS_ACTIVATED, Mage_Core_Model_App::ADMIN_STORE_ID);
62
  if ($isActivated === '1') {
63
- $label = $this->__('Finish activation');
64
  } else {
65
- $label = $this->__('Activate the extension');
66
  }
67
 
68
  $html = $this->getLayout()->createBlock('adminhtml/widget_button')
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_ActivateButton setElement(Varien_Data_Form_Element_Abstract $value)
60
 
61
  $isActivated = Mage::getStoreConfig(self::XPATH_IS_ACTIVATED, Mage_Core_Model_App::ADMIN_STORE_ID);
62
  if ($isActivated === '1') {
63
+ $label = $this->__('Finish registration');
64
  } else {
65
+ $label = $this->__('Send security keys');
66
  }
67
 
68
  $html = $this->getLayout()->createBlock('adminhtml/widget_button')
app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/ActivatedFieldHeader.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_ActivatedFieldHeader
@@ -87,7 +87,9 @@ class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_ActivatedFieldHeader
87
 
88
  $url = $this->getUrl('postnl_admin/adminhtml_extensionControl/showActivationFields', $urlParams);
89
  $onclick = "confirmSetLocation('"
90
- . $this->__("Are you sure? The PostNL extension will not function until you\'ve reactivated the extension.")
 
 
91
  . "', '"
92
  . $url
93
  . "');";
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_ActivatedFieldHeader
87
 
88
  $url = $this->getUrl('postnl_admin/adminhtml_extensionControl/showActivationFields', $urlParams);
89
  $onclick = "confirmSetLocation('"
90
+ . $this->__(
91
+ "Are you sure? The PostNL extension will not function until you\'ve registered the extension."
92
+ )
93
  . "', '"
94
  . $url
95
  . "');";
app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/Anchor.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_Anchor
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_Anchor
app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/Checkbox.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ *
39
+ * @method mixed getValue()
40
+ */
41
+ class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_Checkbox extends Varien_Data_Form_Element_Checkbox
42
+ {
43
+ /**
44
+ * Check if the element should be checked before rendering the element.
45
+ *
46
+ * @return string
47
+ */
48
+ public function getElementHtml()
49
+ {
50
+ $this->getIsChecked();
51
+
52
+ $html = parent::getElementHtml();
53
+
54
+ /**
55
+ * Render a second, hidden element to store the checkbox's unchecked value.
56
+ */
57
+ $html .= "<input type='hidden' name='{$this->getName()}' id='{$this->getHtmlId()}_hidden'"
58
+ . " value='{$this->getValue()}'/>";
59
+
60
+ return $html;
61
+ }
62
+
63
+ /**
64
+ * Add some JS to store the checkbox's empty value in a hidden element.
65
+ *
66
+ * @return string
67
+ */
68
+ public function getAfterElementHtml()
69
+ {
70
+ $html = '
71
+ <script type="text/javascript">
72
+ //<![CDATA[
73
+ $("' . $this->getHtmlId() . '").observe("change", function() {
74
+ var element = $("' . $this->getHtmlId() . '");
75
+ var hiddenElement = $("' . $this->getHtmlId() . '_hidden");
76
+ if (element.checked) {
77
+ hiddenElement.setValue(1);
78
+ } else {
79
+ hiddenElement.setValue(0);
80
+ }
81
+ });
82
+ //]]>
83
+ </script>';
84
+
85
+ return $html;
86
+ }
87
+
88
+ /**
89
+ * Return check status of checkbox
90
+ *
91
+ * @return boolean
92
+ */
93
+ public function getIsChecked() {
94
+ if ($this->hasData('checked')) {
95
+ return $this->getData('checked');
96
+ }
97
+
98
+ /**
99
+ * Get the current element's value.
100
+ */
101
+ $value = $this->getValue();
102
+ if (is_object($value) && $value instanceof Mage_Core_Model_Config_Element) {
103
+ $value = $value->__toString();
104
+ }
105
+
106
+ $checked = (bool) $value;
107
+
108
+ $this->setIsChecked($checked);
109
+ return $checked;
110
+ }
111
+ }
app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/ConfigCheck.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasPostnlHelper()
@@ -50,7 +50,7 @@ class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_ConfigCheck
50
  /**
51
  * XML paths to use GlobalPack/Checkout settings.
52
  */
53
- const XPATH_USE_GLOBALPACK = 'postnl/cif/use_globalpack';
54
  const XPATH_USE_CHECKOUT = 'postnl/cif/use_checkout';
55
 
56
  /**
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasPostnlHelper()
50
  /**
51
  * XML paths to use GlobalPack/Checkout settings.
52
  */
53
+ const XPATH_USE_GLOBALPACK = 'postnl/cif_globalpack_settings/use_globalpack';
54
  const XPATH_USE_CHECKOUT = 'postnl/cif/use_checkout';
55
 
56
  /**
app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/HourMinute.php CHANGED
@@ -25,21 +25,20 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_HourMinute
40
  extends Mage_Adminhtml_Block_System_Config_Form_Field
41
  {
42
-
43
  /**
44
  * Enter description here...
45
  *
@@ -52,15 +51,11 @@ class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_HourMinute
52
 
53
  $html = '<td class="label"><label for="'.$id.'">'.$element->getLabel().'</label></td>';
54
 
55
- //$isDefault = !$this->getRequest()->getParam('website') && !$this->getRequest()->getParam('store');
56
- $isMultiple = $element->getExtType()==='multiple';
57
-
58
  // replace [value] with [inherit]
59
  $namePrefix = preg_replace('#\[value\](\[\])?$#', '', $element->getName());
60
 
61
- $options = $element->getValues();
62
-
63
  $addInheritCheckbox = false;
 
64
  if ($element->getCanUseWebsiteValue()) {
65
  $addInheritCheckbox = true;
66
  $checkboxLabel = Mage::helper('adminhtml')->__('Use Website');
@@ -70,6 +65,7 @@ class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_HourMinute
70
  $checkboxLabel = Mage::helper('adminhtml')->__('Use Default');
71
  }
72
 
 
73
  if ($addInheritCheckbox) {
74
  $inherit = $element->getInherit()==1 ? 'checked="checked"' : '';
75
  if ($inherit) {
@@ -233,4 +229,21 @@ class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_HourMinute
233
 
234
  return $attributes;
235
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_HourMinute
40
  extends Mage_Adminhtml_Block_System_Config_Form_Field
41
  {
 
42
  /**
43
  * Enter description here...
44
  *
51
 
52
  $html = '<td class="label"><label for="'.$id.'">'.$element->getLabel().'</label></td>';
53
 
 
 
 
54
  // replace [value] with [inherit]
55
  $namePrefix = preg_replace('#\[value\](\[\])?$#', '', $element->getName());
56
 
 
 
57
  $addInheritCheckbox = false;
58
+ $checkboxLabel = '';
59
  if ($element->getCanUseWebsiteValue()) {
60
  $addInheritCheckbox = true;
61
  $checkboxLabel = Mage::helper('adminhtml')->__('Use Website');
65
  $checkboxLabel = Mage::helper('adminhtml')->__('Use Default');
66
  }
67
 
68
+ $inherit = '';
69
  if ($addInheritCheckbox) {
70
  $inherit = $element->getInherit()==1 ? 'checked="checked"' : '';
71
  if ($inherit) {
229
 
230
  return $attributes;
231
  }
232
+
233
+ /**
234
+ * Decorate field row html.
235
+ *
236
+ * Extended, because this method is only present in Magento since v1.7.0.1.
237
+ *
238
+ * @param Varien_Data_Form_Element_Abstract $element
239
+ * @param string $html
240
+ *
241
+ * @return string
242
+ *
243
+ * @see Mage_Adminhtml_Block_System_Config_Form_Field::_decorateRowHtml()
244
+ */
245
+ protected function _decorateRowHtml($element, $html)
246
+ {
247
+ return '<tr id="row_' . $element->getHtmlId() . '">' . $html . '</tr>';
248
+ }
249
  }
app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/InfoBox.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_InfoBox
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_InfoBox
app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/MatrixrateExport.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_MatrixrateExport
40
+ extends Mage_Adminhtml_Block_System_Config_Form_Field
41
+ implements Varien_Data_Form_Element_Renderer_Interface
42
+ {
43
+ /**
44
+ * @param Varien_Data_Form_Element_Abstract $element
45
+ *
46
+ * @return string
47
+ */
48
+ public function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
49
+ {
50
+ $buttonBlock = $this->getLayout()->createBlock('adminhtml/widget_button');
51
+
52
+ $params = array(
53
+ 'website' => $buttonBlock->getRequest()->getParam('website')
54
+ );
55
+
56
+ $onClick = 'setLocation(\''
57
+ . Mage::helper('adminhtml')->getUrl("postnl_admin/adminhtml_config/exportMatrixrates", $params)
58
+ . '\')';
59
+
60
+ $data = array(
61
+ 'label' => Mage::helper('postnl')->__('Export CSV'),
62
+ 'onclick' => $onClick,
63
+ 'id' => $element->getHtmlId(),
64
+ 'type' => 'button',
65
+ 'class' => 'scalable postnl-button',
66
+ );
67
+
68
+ $html = $buttonBlock->setData($data)->toHtml();
69
+
70
+ return $html;
71
+ }
72
+
73
+ /**
74
+ * @param Varien_Data_Form_Element_Abstract $element
75
+ *
76
+ * @return string
77
+ */
78
+ public function render(Varien_Data_Form_Element_Abstract $element)
79
+ {
80
+ return parent::render($element);
81
+ }
82
+ }
app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/MatrixrateImport.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_MatrixrateImport
40
+ extends Mage_Adminhtml_Block_System_Config_Form_Field
41
+ implements Varien_Data_Form_Element_Renderer_Interface
42
+ {
43
+ /**
44
+ * Render the element.
45
+ *
46
+ * @param Varien_Data_Form_Element_Abstract $element
47
+ *
48
+ * @return string
49
+ */
50
+ public function render(Varien_Data_Form_Element_Abstract $element)
51
+ {
52
+ $element->setType('file')
53
+ ->removeClass('input-text');
54
+
55
+ $html = parent::render($element);
56
+
57
+ return $html;
58
+ }
59
+ }
app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/Obscure.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_Obscure
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_Obscure
app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/PackingSlipItemColumns.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_PackingSlipItemColumns
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_PackingSlipItemColumns
app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/Radios.php ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ *
39
+ * @method string getValue()
40
+ * @method array|null getValues()
41
+ */
42
+ class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_Radios extends Varien_Data_Form_Element_Radios
43
+ {
44
+ /**
45
+ * Get this element's HTML output.
46
+ *
47
+ * @return string
48
+ */
49
+ public function getElementHtml()
50
+ {
51
+ $html = '';
52
+ $value = $this->getValue();
53
+ $values = $this->getValues();
54
+ if (is_array($values)) {
55
+ foreach ($values as $option) {
56
+ $html.= $this->_optionToHtml($option, $value);
57
+ }
58
+ }
59
+
60
+ $html .= "<input type='hidden' name='{$this->getName()}' value='{$value}' id='{$this->getHtmlId()}'/>";
61
+
62
+ $html.= $this->getAfterElementHtml();
63
+ return $html;
64
+ }
65
+
66
+ /**
67
+ * Add some JS to store the selected radio button's value in a hidden element.
68
+ *
69
+ * @return string
70
+ */
71
+ public function getAfterElementHtml()
72
+ {
73
+ $html = '
74
+ <script type="text/javascript">
75
+ //<![CDATA[
76
+ $$(\'input[name="' . $this->getName() . '"][type="radio"]\').each(function(element) {
77
+ element.observe("click", function(event) {
78
+ var selectedRadioButton = $$(\'input[name="' . $this->getName() . '"][type="radio"]:checked\')[0];
79
+
80
+ if (selectedRadioButton) {
81
+ $("' . $this->getHtmlId() . '").setValue(selectedRadioButton.getValue());
82
+ }
83
+
84
+ if (formElementDependenceController) {
85
+ var elementsMap = formElementDependenceController.elementsMap;
86
+ for (var idTo in elementsMap) {
87
+ for (var idFrom in elementsMap[idTo]) {
88
+ if (idFrom == "' . $this->getHtmlId() . '") {
89
+ formElementDependenceController.trackChange(
90
+ event,
91
+ idTo,
92
+ elementsMap[idTo]
93
+ );
94
+ }
95
+ }
96
+ }
97
+ }
98
+ });
99
+ });
100
+ //]]>
101
+ </script>';
102
+
103
+ return $html;
104
+ }
105
+
106
+ /**
107
+ * Get the html for each individual radio button.
108
+ *
109
+ * @param array|Varien_Object $option
110
+ * @param string $selected
111
+ *
112
+ * @return string
113
+ */
114
+ protected function _optionToHtml($option, $selected)
115
+ {
116
+ $html = '<div class="wrapper-radio">';
117
+ $html .= '<input type="radio"'.$this->serialize(array('name', 'class', 'style', 'disabled'));
118
+ if (is_array($option)) {
119
+ $html.= 'value="'
120
+ . $this->_escape($option['value'])
121
+ . '" id="'
122
+ . $this->getHtmlId()
123
+ . $option['value']
124
+ . '"';
125
+
126
+ if ($option['value'] == $selected) {
127
+ $html .= ' checked="checked"';
128
+ }
129
+
130
+ $html .= ' />';
131
+
132
+ $html .= '<label class="inline" for="'
133
+ . $this->getHtmlId()
134
+ . $option['value']
135
+ . '">'
136
+ . $option['label']
137
+ . '</label>';
138
+ } else if ($option instanceof Varien_Object) {
139
+ $html .= 'id="'
140
+ . $this->getHtmlId()
141
+ . $option->getValue()
142
+ . '"'
143
+ . $option->serialize(
144
+ array(
145
+ 'label',
146
+ 'title',
147
+ 'value',
148
+ 'class',
149
+ 'style',
150
+ )
151
+ );
152
+
153
+ if (in_array($option->getValue(), $selected)) {
154
+ $html .= ' checked="checked"';
155
+ }
156
+
157
+ $html .= ' />';
158
+
159
+ $html .= '<label class="inline" for="'
160
+ . $this->getHtmlId()
161
+ . $option->getValue()
162
+ . '">'
163
+ . $option->getLabel()
164
+ . '</label>';
165
+ }
166
+
167
+ $html.= '</div>';
168
+
169
+ return $html;
170
+ }
171
+ }
app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/SplitAddressCheck.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_SplitAddressCheck
@@ -42,8 +42,9 @@ class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_SplitAddressCheck
42
  /**
43
  * Xpaths to split street configuration options.
44
  */
45
- const XPATH_SPLIT_STREET = 'postnl/cif_address/split_street';
46
- const XPATH_USE_POSTCODE_CHECK = 'postnl/cif_address/use_postcode_check';
 
47
 
48
  /**
49
  * @var string
@@ -70,21 +71,31 @@ class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_SplitAddressCheck
70
  * Check if the split_street field is enabled based on the current scope
71
  */
72
  if ($request->getParam('store')) {
73
- $usePostcodeCheck = Mage::getStoreConfigFlag(self::XPATH_USE_POSTCODE_CHECK, $request->getparam('store'));
74
- $splitStreet = Mage::getStoreConfigFlag(self::XPATH_SPLIT_STREET, $request->getparam('store'));
 
 
 
75
  } elseif ($request->getParam('website')) {
76
  $website = Mage::getModel('core/website')->load($request->getparam('website'), 'code');
77
- $usePostcodeCheck = (bool) $website->getConfig(self::XPATH_USE_POSTCODE_CHECK, $website->getId());
78
- $splitStreet = (bool) $website->getConfig(self::XPATH_SPLIT_STREET, $website->getId());
 
 
79
  } else {
80
- $usePostcodeCheck = Mage::getStoreConfigFlag(self::XPATH_USE_POSTCODE_CHECK, Mage_Core_Model_App::ADMIN_STORE_ID);
81
- $splitStreet = Mage::getStoreConfigFlag(self::XPATH_SPLIT_STREET, Mage_Core_Model_App::ADMIN_STORE_ID);
 
 
 
82
  }
83
 
84
- if ($usePostcodeCheck || $splitStreet) {
 
 
85
  return true;
86
  }
87
 
88
- return false;
89
  }
90
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_SplitAddressCheck
42
  /**
43
  * Xpaths to split street configuration options.
44
  */
45
+ const XPATH_SPLIT_STREET = 'postnl/cif_labels_and_confirming/split_street';
46
+ const XPATH_USE_POSTCODE_CHECK = 'postnl/cif_labels_and_confirming/use_postcode_check';
47
+ const XPATH_CHECKOUT_EXTENSION = 'postnl/cif_address/checkout_extension';
48
 
49
  /**
50
  * @var string
71
  * Check if the split_street field is enabled based on the current scope
72
  */
73
  if ($request->getParam('store')) {
74
+ $store = $request->getparam('store');
75
+
76
+ $checkoutExtension = Mage::getStoreConfig(self::XPATH_CHECKOUT_EXTENSION, $store);
77
+ $usePostcodeCheck = Mage::getStoreConfigFlag(self::XPATH_USE_POSTCODE_CHECK, $store);
78
+ $splitStreet = Mage::getStoreConfigFlag(self::XPATH_SPLIT_STREET, $store);
79
  } elseif ($request->getParam('website')) {
80
  $website = Mage::getModel('core/website')->load($request->getparam('website'), 'code');
81
+
82
+ $checkoutExtension = $website->getConfig(self::XPATH_CHECKOUT_EXTENSION, $website->getId());
83
+ $usePostcodeCheck = (bool) $website->getConfig(self::XPATH_USE_POSTCODE_CHECK, $website->getId());
84
+ $splitStreet = (bool) $website->getConfig(self::XPATH_SPLIT_STREET, $website->getId());
85
  } else {
86
+ $store = Mage_Core_Model_App::ADMIN_STORE_ID;
87
+
88
+ $checkoutExtension = Mage::getStoreConfig(self::XPATH_CHECKOUT_EXTENSION, $store);
89
+ $usePostcodeCheck = Mage::getStoreConfigFlag(self::XPATH_USE_POSTCODE_CHECK, $store);
90
+ $splitStreet = Mage::getStoreConfigFlag(self::XPATH_SPLIT_STREET, $store);
91
  }
92
 
93
+ if ((!$checkoutExtension || $checkoutExtension == 'other') && !$splitStreet) {
94
+ return false;
95
+ } elseif ($checkoutExtension && $checkoutExtension != 'other' && $splitStreet) {
96
  return true;
97
  }
98
 
99
+ return $usePostcodeCheck;
100
  }
101
  }
app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/SupportTab.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_SupportTab
@@ -45,10 +45,14 @@ class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_SupportTab
45
  protected $_eventPrefix = 'postnl_adminhtml_system_config_form_field_supporttab';
46
 
47
  /**
48
- * Css files loaded for PostNL's system > config section
49
  */
50
- const SYSTEM_CONFIG_EDIT_CSS_FILE = 'css/TIG/PostNL/system_config_edit_postnl.css';
51
- const MAGENTO_16_CSS_FILE = 'css/TIG/PostNL/system_config_edit_postnl_magento16.css';
 
 
 
 
52
 
53
  /**
54
  * Template file used
@@ -58,44 +62,82 @@ class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_SupportTab
58
  protected $_template = 'TIG/PostNL/system/config/form/field/support_tab.phtml';
59
 
60
  /**
61
- * Add a new css file to the head. We couldn't do this from layout.xml, because it would have loaded
62
- * for all System > Config pages, rather than just PostNL's section.
63
- *
64
- * @return Mage_Adminhtml_Block_Abstract::_prepareLayout()
65
- *
66
- * @see Mage_Adminhtml_Block_Abstract::_prepareLayout()
 
 
 
 
 
67
  */
68
- protected function _prepareLayout()
69
  {
70
- $this->getLayout()
71
- ->getBlock('head')
72
- ->addCss(self::SYSTEM_CONFIG_EDIT_CSS_FILE);
73
-
74
- /**
75
- * For Magento 1.6 and 1.11 we need to add another css file.
76
- */
77
- $helper = Mage::helper('postnl');
78
- $isEnterprise = $helper->isEnterprise();
79
-
80
- /**
81
- * Get the minimum version requirement for the current Magento edition.
82
- */
83
- if($isEnterprise) {
84
- $minimumVersion = '1.12.0.0';
85
- } else {
86
- $minimumVersion = '1.7.0.0';
87
- }
88
-
89
- /**
90
- * Check if the current version is below the minimum version requirement.
91
- */
92
- $isBelowMinimumVersion = version_compare(Mage::getVersion(), $minimumVersion, '<');
93
- if ($isBelowMinimumVersion) {
94
- $this->getLayout()
95
- ->getBlock('head')
96
- ->addCss(self::MAGENTO_16_CSS_FILE);
97
- }
98
-
99
- return parent::_prepareLayout();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  }
101
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_SupportTab
45
  protected $_eventPrefix = 'postnl_adminhtml_system_config_form_field_supporttab';
46
 
47
  /**
48
+ * Xpaths to URLs used in the support tab.
49
  */
50
+ const POSTNL_REGISTER_URL_XPATH = 'postnl/general/postnl_register_url';
51
+ const KNOWLEDGEBASE_URL_XPATH = 'postnl/general/knowledgebase_url';
52
+ const NEW_TICKET_URL_XPATH = 'postnl/general/new_ticket_url';
53
+ const INSTALLATION_MANUAL_URL_XPATH = 'postnl/general/installation_manual_url';
54
+ const USER_GUIDE_URL_XPATH = 'postnl/general/user_guide_url';
55
+ const KB_URL_XPATH = 'postnl/general/kb_url';
56
 
57
  /**
58
  * Template file used
62
  protected $_template = 'TIG/PostNL/system/config/form/field/support_tab.phtml';
63
 
64
  /**
65
+ * @return string
66
+ */
67
+ public function getVersion()
68
+ {
69
+ $version = Mage::helper('postnl')->getModuleVersion();
70
+
71
+ return $version;
72
+ }
73
+
74
+ /**
75
+ * @return string
76
  */
77
+ public function getPostnlRegisterUrl()
78
  {
79
+ $url = Mage::getStoreConfig(self::POSTNL_REGISTER_URL_XPATH, Mage_Core_Model_App::ADMIN_STORE_ID);
80
+
81
+ return $url;
82
+ }
83
+
84
+ /**
85
+ * @return string
86
+ */
87
+ public function getKnowledgebaseUrl()
88
+ {
89
+ $url = Mage::getStoreConfig(self::KNOWLEDGEBASE_URL_XPATH, Mage_Core_Model_App::ADMIN_STORE_ID);
90
+
91
+ return $url;
92
+ }
93
+
94
+ /**
95
+ * @return string
96
+ */
97
+ public function getNewTicketUrl()
98
+ {
99
+ $url = Mage::getStoreConfig(self::NEW_TICKET_URL_XPATH, Mage_Core_Model_App::ADMIN_STORE_ID);
100
+
101
+ return $url;
102
+ }
103
+
104
+ /**
105
+ * @return string
106
+ */
107
+ public function getInstallationManualUrl()
108
+ {
109
+ $url = Mage::getStoreConfig(self::INSTALLATION_MANUAL_URL_XPATH, Mage_Core_Model_App::ADMIN_STORE_ID);
110
+
111
+ return $url;
112
+ }
113
+
114
+ /**
115
+ * @return string
116
+ */
117
+ public function getUserGuideUrl()
118
+ {
119
+ $url = Mage::getStoreConfig(self::USER_GUIDE_URL_XPATH, Mage_Core_Model_App::ADMIN_STORE_ID);
120
+
121
+ return $url;
122
+ }
123
+
124
+ /**
125
+ * @return string
126
+ */
127
+ public function getChangelogUrl()
128
+ {
129
+ $url = Mage::helper('postnl')->getChangelogUrl();
130
+
131
+ return $url;
132
+ }
133
+
134
+ /**
135
+ * @return string
136
+ */
137
+ public function getKbUrl()
138
+ {
139
+ $url = Mage::getStoreConfig(self::KB_URL_XPATH, Mage_Core_Model_App::ADMIN_STORE_ID);
140
+
141
+ return $url;
142
  }
143
  }
app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/TablerateExport.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_TablerateExport
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_TablerateExport
app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/TablerateImport.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_TablerateImport
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_TablerateImport
app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/TextBox/Abstract.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method Varien_Data_Form_Element_Abstract getElement()
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method Varien_Data_Form_Element_Abstract getElement()
app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/ValidateButton.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_ValidateButton
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_ValidateButton
app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/WarningBox.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_WarningBox
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_WarningBox
app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Field/WizardSaveButton.php ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ *
39
+ * @method TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_ActivateButton setElement(Varien_Data_Form_Element_Abstract $value)
40
+ */
41
+ class TIG_PostNL_Block_Adminhtml_System_Config_Form_Field_WizardSaveButton
42
+ extends Mage_Adminhtml_Block_System_Config_Form_Field
43
+ implements Varien_Data_Form_Element_Renderer_Interface
44
+ {
45
+ /**
46
+ * Get the element's html.
47
+ *
48
+ * @param Varien_Data_Form_Element_Abstract $element
49
+ *
50
+ * @return string
51
+ */
52
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
53
+ {
54
+ $this->setElement($element);
55
+
56
+ $elementOriginalData = $element->getOriginalData();
57
+
58
+ /**
59
+ * Get the next step rel that will be used as a parameter for the button's on click event.
60
+ */
61
+ $nextStepRel = '';
62
+ if (isset($elementOriginalData['next_step_rel'])) {
63
+ $nextStepRel = $elementOriginalData['next_step_rel'];
64
+ }
65
+
66
+ /**
67
+ * Get the current step's rel as well.
68
+ *
69
+ * @var Varien_Data_Form_Element_Fieldset $container
70
+ */
71
+ $currentStepRel = '';
72
+ $container = $element->getContainer();
73
+ if ($container) {
74
+ $currentStepRel = $container->getHtmlId();
75
+ }
76
+
77
+ /**
78
+ * Create a new button and return the html output.
79
+ *
80
+ * @var Mage_Adminhtml_Block_Widget_Button $button
81
+ */
82
+ $button = $this->getLayout()
83
+ ->createBlock('adminhtml/widget_button');
84
+
85
+ $html = $button->setType('button')
86
+ ->setId($element->getHtmlId())
87
+ ->setClass('scalable postnl-button')
88
+ ->setLabel($element->getLabel())
89
+ ->setOnClick("postnlWizardSaveAndContinue('{$nextStepRel}', '{$currentStepRel}')")
90
+ ->toHtml();
91
+
92
+ return $html;
93
+ }
94
+
95
+ /**
96
+ * Render the element without a scope and label.
97
+ *
98
+ * @param Varien_Data_Form_Element_Abstract $element
99
+ * @return string
100
+ *
101
+ * @see parent::render()
102
+ */
103
+ public function render(Varien_Data_Form_Element_Abstract $element)
104
+ {
105
+ $html = '<td class="label"></td>';
106
+
107
+ if ($element->getTooltip()) {
108
+ $html .= '<td class="value with-tooltip">';
109
+ $html .= $this->_getElementHtml($element);
110
+ $html .= '<div class="field-tooltip"><div>' . $element->getTooltip() . '</div></div>';
111
+ } else {
112
+ $html .= '<td class="value">';
113
+ $html .= $this->_getElementHtml($element);
114
+ };
115
+
116
+ if ($element->getComment()) {
117
+ $html.= '<p class="note"><span>'.$element->getComment().'</span></p>';
118
+ }
119
+
120
+ $html.= '</td>';
121
+
122
+ $html.= '<td class="scope-label"></td>';
123
+
124
+ $html.= '<td class="">';
125
+ if ($element->getHint()) {
126
+ $html.= '<div class="hint" >';
127
+ $html.= '<div style="display: none;">' . $element->getHint() . '</div>';
128
+ $html.= '</div>';
129
+ }
130
+ $html.= '</td>';
131
+
132
+ return $this->_decorateRowHtml($element, $html);
133
+ }
134
+
135
+ /**
136
+ * Decorate field row html.
137
+ *
138
+ * Extended, because this method is only present in Magento since v1.7.0.1.
139
+ *
140
+ * @param Varien_Data_Form_Element_Abstract $element
141
+ * @param string $html
142
+ *
143
+ * @return string
144
+ *
145
+ * @see Mage_Adminhtml_Block_System_Config_Form_Field::_decorateRowHtml()
146
+ */
147
+ protected function _decorateRowHtml($element, $html)
148
+ {
149
+ return '<tr id="row_' . $element->getHtmlId() . '">' . $html . '</tr>';
150
+ }
151
+ }
app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Form/Fieldset.php CHANGED
@@ -25,16 +25,18 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
 
 
38
  */
39
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Fieldset extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
40
  {
@@ -60,4 +62,167 @@ class TIG_PostNL_Block_Adminhtml_System_Config_Form_Fieldset extends Mage_Adminh
60
 
61
  return $commentHtml;
62
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ *
39
+ * This entire class is extended from Magento's core class for backwards compatibility on Magento 1.6.
40
  */
41
  class TIG_PostNL_Block_Adminhtml_System_Config_Form_Fieldset extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
42
  {
62
 
63
  return $commentHtml;
64
  }
65
+
66
+ /**
67
+ * Render fieldset html
68
+ *
69
+ * @param Varien_Data_Form_Element_Abstract $element
70
+ * @return string
71
+ */
72
+ public function render(Varien_Data_Form_Element_Abstract $element)
73
+ {
74
+ $this->setElement($element);
75
+ $html = $this->_getHeaderHtml($element);
76
+
77
+ foreach ($element->getSortedElements() as $field) {
78
+ $html.= $field->toHtml();
79
+ }
80
+
81
+ $html .= $this->_getFooterHtml($element);
82
+
83
+ return $html;
84
+ }
85
+
86
+ /**
87
+ * Return header html for fieldset
88
+ *
89
+ * @param Varien_Data_Form_Element_Abstract $element
90
+ * @return string
91
+ */
92
+ protected function _getHeaderHtml($element)
93
+ {
94
+ if ($element->getIsNested()) {
95
+ $html = '<tr class="nested"><td colspan="4"><div class="' . $this->_getFrontendClass($element) . '">';
96
+ } else {
97
+ $html = '<div class="' . $this->_getFrontendClass($element) . '">';
98
+ }
99
+
100
+ $html .= $this->_getHeaderTitleHtml($element);
101
+
102
+ $html .= '<input id="'.$element->getHtmlId() . '-state" name="config_state[' . $element->getId()
103
+ . ']" type="hidden" value="' . (int)$this->_getCollapseState($element) . '" />';
104
+ $html .= '<fieldset class="' . $this->_getFieldsetCss($element) . '" id="' . $element->getHtmlId() . '">';
105
+ $html .= '<legend>' . $element->getLegend() . '</legend>';
106
+
107
+ $html .= $this->_getHeaderCommentHtml($element);
108
+
109
+ // field label column
110
+ $html .= '<table cellspacing="0" class="form-list"><colgroup class="label" /><colgroup class="value" />';
111
+ if ($this->getRequest()->getParam('website') || $this->getRequest()->getParam('store')) {
112
+ $html .= '<colgroup class="use-default" />';
113
+ }
114
+ $html .= '<colgroup class="scope-label" /><colgroup class="" /><tbody>';
115
+
116
+ return $html;
117
+ }
118
+
119
+ /**
120
+ * Get frontend class
121
+ *
122
+ * @param Varien_Data_Form_Element_Abstract $element
123
+ * @return string
124
+ */
125
+ protected function _getFrontendClass($element)
126
+ {
127
+ $frontendClass = (string)$this->getGroup($element)->frontend_class;
128
+ return 'section-config' . (empty($frontendClass) ? '' : (' ' . $frontendClass));
129
+ }
130
+
131
+ /**
132
+ * Get group xml data of the element
133
+ *
134
+ * @param null|Varien_Data_Form_Element_Abstract $element
135
+ * @return Mage_Core_Model_Config_Element
136
+ */
137
+ public function getGroup($element = null)
138
+ {
139
+ if (is_null($element)) {
140
+ $element = $this->getElement();
141
+ }
142
+ if ($element && $element->getGroup() instanceof Mage_Core_Model_Config_Element) {
143
+ return $element->getGroup();
144
+ }
145
+
146
+ return new Mage_Core_Model_Config_Element('<config/>');
147
+ }
148
+
149
+ /**
150
+ * Return header title part of html for fieldset
151
+ *
152
+ * @param Varien_Data_Form_Element_Abstract $element
153
+ * @return string
154
+ */
155
+ protected function _getHeaderTitleHtml($element)
156
+ {
157
+ return '<div class="entry-edit-head collapseable" ><a id="' . $element->getHtmlId()
158
+ . '-head" href="#" onclick="Fieldset.toggleCollapse(\'' . $element->getHtmlId() . '\', \''
159
+ . $this->getUrl('*/*/state') . '\'); return false;">' . $element->getLegend() . '</a></div>';
160
+ }
161
+
162
+ /**
163
+ * Return full css class name for form fieldset
164
+ *
165
+ * @param null|Varien_Data_Form_Element_Abstract $element
166
+ * @return string
167
+ */
168
+ protected function _getFieldsetCss($element = null)
169
+ {
170
+ $configCss = (string)$this->getGroup($element)->fieldset_css;
171
+ return 'config collapseable' . ($configCss ? ' ' . $configCss : '');
172
+ }
173
+
174
+ /**
175
+ * Return footer html for fieldset
176
+ * Add extra tooltip comments to elements
177
+ *
178
+ * @param Varien_Data_Form_Element_Abstract $element
179
+ * @return string
180
+ */
181
+ protected function _getFooterHtml($element)
182
+ {
183
+ $tooltipsExist = false;
184
+ $html = '</tbody></table>';
185
+ $html .= '</fieldset>' . $this->_getExtraJs($element, $tooltipsExist);
186
+
187
+ if ($element->getIsNested()) {
188
+ $html .= '</div></td></tr>';
189
+ } else {
190
+ $html .= '</div>';
191
+ }
192
+ return $html;
193
+ }
194
+
195
+ /**
196
+ * Return js code for fieldset:
197
+ * - observe fieldset rows;
198
+ * - apply collapse;
199
+ *
200
+ * @param Varien_Data_Form_Element_Abstract $element
201
+ * @param bool $tooltipsExist Init tooltips observer or not
202
+ * @return string
203
+ */
204
+ protected function _getExtraJs($element, $tooltipsExist = false)
205
+ {
206
+ $id = $element->getHtmlId();
207
+ $js = "Fieldset.applyCollapse('{$id}');";
208
+ return Mage::helper('adminhtml/js')->getScript($js);
209
+ }
210
+
211
+ /**
212
+ * Collapsed or expanded fieldset when page loaded?
213
+ *
214
+ * @param Varien_Data_Form_Element_Abstract $element
215
+ * @return bool|int
216
+ */
217
+ protected function _getCollapseState($element)
218
+ {
219
+ if ($element->getExpanded() !== null) {
220
+ return 1;
221
+ }
222
+ $extra = Mage::getSingleton('admin/session')->getUser()->getExtra();
223
+ if (isset($extra['configState'][$element->getId()])) {
224
+ return $extra['configState'][$element->getId()];
225
+ }
226
+ return false;
227
+ }
228
  }
app/code/community/TIG/PostNL/Block/Adminhtml/System/Config/Js.php ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ class TIG_PostNL_Block_Adminhtml_System_Config_Js extends TIG_PostNL_Block_Adminhtml_Template
40
+ {
41
+ /**
42
+ * @var string
43
+ */
44
+ protected $_eventPrefix = 'postnl_adminhtml_system_config_js';
45
+
46
+ /**
47
+ * Css files loaded for PostNL's system > config section
48
+ */
49
+ const SYSTEM_CONFIG_EDIT_CSS_FILE = 'css/TIG/PostNL/system_config_edit_postnl.css';
50
+ const MAGENTO_16_CSS_FILE = 'css/TIG/PostNL/system_config_edit_postnl_magento16.css';
51
+
52
+ /**
53
+ * Minimum versions required for certain css changes.
54
+ */
55
+ const MIN_ENTERPRISE_VERSION = '1.12.0.0';
56
+ const MIN_COMMUNITY_VERSION = '1.7.0.0';
57
+
58
+ /**
59
+ * Add a new css file to the head. We cannot do this from layout.xml, because it would have loaded for all System >
60
+ * Config pages, rather than just PostNL's section.
61
+ *
62
+ * @return Mage_Adminhtml_Block_Abstract::_prepareLayout()
63
+ *
64
+ * @see Mage_Adminhtml_Block_Abstract::_prepareLayout()
65
+ */
66
+ protected function _prepareLayout()
67
+ {
68
+ if ($this->getRequest()->getParam('section') != 'postnl') {
69
+ return parent::_prepareLayout();
70
+ }
71
+
72
+ /**
73
+ * @var Mage_Adminhtml_Block_Page_Head $head
74
+ */
75
+ $head = $this->getLayout()
76
+ ->getBlock('head');
77
+
78
+ $head->addCss(self::SYSTEM_CONFIG_EDIT_CSS_FILE);
79
+ $head->addItem('skin_js', 'js/TIG/PostNL/configuration.js');
80
+ $head->removeItem('js', 'mage/adminhtml/form.js');
81
+ $head->addItem('skin_js', 'js/TIG/PostNL/form.js');
82
+
83
+ /**
84
+ * For Magento 1.6 and 1.11 we need to add another css file.
85
+ */
86
+ $helper = Mage::helper('postnl');
87
+ $isEnterprise = $helper->isEnterprise();
88
+
89
+ /**
90
+ * Get the minimum version requirement for the current Magento edition.
91
+ */
92
+ if($isEnterprise) {
93
+ $minimumVersion = self::MIN_ENTERPRISE_VERSION;
94
+ } else {
95
+ $minimumVersion = self::MIN_COMMUNITY_VERSION;
96
+ }
97
+
98
+ /**
99
+ * Check if the current version is below the minimum version requirement.
100
+ */
101
+ $isBelowMinimumVersion = version_compare(Mage::getVersion(), $minimumVersion, '<');
102
+ if ($isBelowMinimumVersion) {
103
+ $head->addCss(self::MAGENTO_16_CSS_FILE);
104
+ }
105
+
106
+ return parent::_prepareLayout();
107
+ }
108
+
109
+ /**
110
+ * Get the current wizard step as saved for the current admin user.
111
+ *
112
+ * @return string
113
+ */
114
+ public function getCurrentWizardStep()
115
+ {
116
+ /**
117
+ * Get the current admin user and it's saved extra data.
118
+ */
119
+ $adminUser = Mage::getSingleton('admin/session')->getUser();
120
+ $extra = $adminUser->getExtra();
121
+
122
+ /**
123
+ * If no data exists or the data we want is not set, return an empty string.
124
+ */
125
+ if (!$extra || !isset($extra['postnl']['current_wizard_step'])) {
126
+ return '';
127
+ }
128
+
129
+ /**
130
+ * Get the saved step and return it.
131
+ */
132
+ $currentWizardStep = $extra['postnl']['current_wizard_step'];
133
+ return $currentWizardStep;
134
+ }
135
+
136
+ /**
137
+ * Get the save wizard step URL for the current scope.
138
+ *
139
+ * @return string
140
+ *
141
+ * @throws Exception
142
+ */
143
+ public function getSaveWizardStepUrl()
144
+ {
145
+ /**
146
+ * Get the current scope data for the URL.
147
+ */
148
+ $urlParams = array('_secure' => true);
149
+ if ($this->getRequest()->getParam('section')) {
150
+ $urlParams['section'] = $this->getRequest()->getParam('section');
151
+ }
152
+
153
+ if ($this->getRequest()->getParam('website')) {
154
+ $urlParams['website'] = $this->getRequest()->getParam('website');
155
+ }
156
+
157
+ if ($this->getRequest()->getParam('store')) {
158
+ $urlParams['store'] = $this->getRequest()->getParam('store');
159
+ }
160
+
161
+ /**
162
+ * Build the URL.
163
+ */
164
+ $url = $this->getUrl('postnl_admin/adminhtml_config/saveWizardStep', $urlParams);
165
+
166
+ return $url;
167
+ }
168
+
169
+ /**
170
+ * Render this block only for the PostNL section.
171
+ *
172
+ * @return string
173
+ * @throws Exception
174
+ */
175
+ protected function _toHtml()
176
+ {
177
+ if ($this->getRequest()->getParam('section') != 'postnl') {
178
+ return '';
179
+ }
180
+
181
+ return parent::_toHtml();
182
+ }
183
+ }
app/code/community/TIG/PostNL/Block/Adminhtml/Template.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  abstract class TIG_PostNL_Block_Adminhtml_Template extends Mage_Adminhtml_Block_Abstract
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  abstract class TIG_PostNL_Block_Adminhtml_Template extends Mage_Adminhtml_Block_Abstract
app/code/community/TIG/PostNL/Block/Adminhtml/UpgradeNotification.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ class TIG_PostNL_Block_Adminhtml_UpgradeNotification extends TIG_PostNL_Block_Adminhtml_Template
40
+ {
41
+ /**
42
+ * Xpath to PostNL update product attribute cron expression.
43
+ */
44
+ const XPATH_POSTNL_UPDADE_PRODUCT_ATTRIBUTE_CRON_EXPR = 'crontab/jobs/postnl_update_product_attribute/schedule/cron_expr';
45
+
46
+ /**
47
+ * @var string
48
+ */
49
+ protected $_eventPrefix = 'postnl_adminhtml_upgradenotification';
50
+
51
+ /**
52
+ * Check to see if the PostNL extension is currently being upgraded.
53
+ *
54
+ * @return boolean
55
+ */
56
+ public function isUpgradeActive()
57
+ {
58
+ /**
59
+ * Check if the cron job has an expression. This will indicate if it is still working or if it has already
60
+ * finished.
61
+ */
62
+ $cronjob = Mage::getStoreConfig(self::XPATH_POSTNL_UPDADE_PRODUCT_ATTRIBUTE_CRON_EXPR);
63
+
64
+ if (empty($cronjob)) {
65
+ return false;
66
+ }
67
+
68
+ return true;
69
+ }
70
+ }
app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Form/Element/Dependence.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ *
39
+ * Form element dependencies mapper
40
+ * Assumes that one element may depend on other element values.
41
+ * Will toggle as "enabled" only if all elements it depends from toggle as true.
42
+ */
43
+ class TIG_PostNL_Block_Adminhtml_Widget_Form_Element_Dependence
44
+ extends Mage_Adminhtml_Block_Widget_Form_Element_Dependence
45
+ {
46
+ /**
47
+ * Register field name dependence one from each other by specified values
48
+ *
49
+ * @param string $fieldName
50
+ * @param string $fieldNameFrom
51
+ * @param string|array $refValues
52
+ * @return Mage_Adminhtml_Block_Widget_Form_Element_Dependence
53
+ */
54
+ public function addFieldDependence($fieldName, $fieldNameFrom, $refValues)
55
+ {
56
+ $this->_depends[$fieldName][$fieldNameFrom] = $refValues;
57
+ return $this;
58
+ }
59
+
60
+ /**
61
+ * HTML output getter
62
+ *
63
+ * @return string
64
+ */
65
+ protected function _toHtml()
66
+ {
67
+ if (!$this->_depends) {
68
+ return '';
69
+ }
70
+ return '<script type="text/javascript">'
71
+ . 'var formElementDependenceController = new FormElementDependenceController('
72
+ . $this->_getDependsJson()
73
+ . ($this->_configOptions ? ', ' . Mage::helper('core')->jsonEncode($this->_configOptions) : '')
74
+ . '); </script>';
75
+ }
76
+ }
app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/Action.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_Action
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_Action
app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/Barcode.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_Barcode
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_Barcode
app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/ConfirmDate.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_ConfirmDate
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_ConfirmDate
app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/ConfirmStatus.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_ConfirmStatus
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_ConfirmStatus
app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/CountryArray.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_CountryArray
40
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
41
+ {
42
+ /**
43
+ * @var array
44
+ */
45
+ protected $_countries;
46
+
47
+ /**
48
+ * Get an array of country codes.
49
+ *
50
+ * @return array
51
+ */
52
+ public function getCountries()
53
+ {
54
+ if ($this->_countries) {
55
+ return $this->_countries;
56
+ }
57
+
58
+ /** @var $collection Mage_Directory_Model_Resource_Country_Collection */
59
+ $collection = Mage::getResourceModel('directory/country_collection');
60
+ foreach ($collection->getData() as $row) {
61
+ $this->_countries[$row['iso2_code']] = $row['iso3_code'];
62
+ }
63
+
64
+ return $this->_countries;
65
+ }
66
+
67
+ /**
68
+ * Render column for export
69
+ *
70
+ * @param Varien_Object $row
71
+ * @return string
72
+ */
73
+ public function renderExport(Varien_Object $row)
74
+ {
75
+ $value = $row->getDataUsingMethod($this->getColumn()->getIndex());
76
+
77
+ $formattedCountryArray = array();
78
+ $iso3Countries = $this->getCountries();
79
+ $countries = explode(',', $value);
80
+ foreach ($countries as $country) {
81
+ if (isset($iso3Countries[$country])) {
82
+ $formattedCountryArray[] = $iso3Countries[$country];
83
+ }
84
+ }
85
+
86
+ return implode(',', $formattedCountryArray);
87
+ }
88
+ }
app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/DeliveryDate.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_DeliveryDate
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_DeliveryDate
app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/OrderConfirmDate.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_OrderConfirmDate
@@ -58,29 +58,40 @@ class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_OrderConfirmDate
58
  return '';
59
  }
60
 
61
- $value = $row->getData($this->getColumn()->getIndex());
 
62
 
63
  /**
64
  * If we have no value, then no delivery date was chosen by the customer. In this case we can calculate when the
65
  * order could be shipped.
66
  */
67
  if (!$value) {
68
- $deliveryDate = Mage::helper('postnl/deliveryOptions')->getDeliveryDate(
69
  $row->getCreatedAt(),
70
  $row->getStoreId()
71
  );
72
 
73
- $deliveryDate = new DateTime($deliveryDate);
74
- $value = $deliveryDate->sub(new DateInterval('P1D'));
75
  } else {
76
  $value = new DateTime($value);
77
  }
78
 
 
 
 
 
 
 
 
 
 
 
79
  $now = new DateTime();
80
  $now->setTimestamp(Mage::getModel('core/date')->gmtTimestamp());
81
 
82
  /**
83
- * Check if the shipment should be confirmed somewhere in the future
84
  */
85
  $diff = $now->diff($value);
86
  if (
@@ -88,7 +99,7 @@ class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_OrderConfirmDate
88
  || ($diff->days == 0 && $diff->h < 24) && $diff->invert
89
  ) {
90
  /**
91
- * Get the number of days until the shipment should be confirmed
92
  */
93
  $diffDays = $diff->format('%a');
94
 
@@ -100,25 +111,25 @@ class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_OrderConfirmDate
100
  }
101
 
102
  /**
103
- * Check if the shipment should be confirmed today
104
  */
105
  if ($diffDays == 0) {
106
- return Mage::helper('postnl')->__('Today');
107
  }
108
 
109
  /**
110
- * Check if it should be confirmed tomorrow
111
  */
112
  if ($diffDays == 1) {
113
- $renderedValue = Mage::helper('postnl')->__('Tomorrow');
114
 
115
  return $renderedValue;
116
  }
117
 
118
  /**
119
- * Render the number of days before the shipment should be confirmed
120
  */
121
- $renderedValue = Mage::helper('postnl')->__('%s days from now', $diffDays);
122
 
123
  return $renderedValue;
124
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_OrderConfirmDate
58
  return '';
59
  }
60
 
61
+ $helper = Mage::helper('postnl/deliveryOptions');
62
+ $value = $row->getData($this->getColumn()->getIndex());
63
 
64
  /**
65
  * If we have no value, then no delivery date was chosen by the customer. In this case we can calculate when the
66
  * order could be shipped.
67
  */
68
  if (!$value) {
69
+ $deliveryDate = $helper->getDeliveryDate(
70
  $row->getCreatedAt(),
71
  $row->getStoreId()
72
  );
73
 
74
+ $value = $helper->getValidDeliveryDate($deliveryDate)
75
+ ->sub(new DateInterval('P1D'));
76
  } else {
77
  $value = new DateTime($value);
78
  }
79
 
80
+ /**
81
+ * Check if the confirm date is valid.
82
+ */
83
+ $value = $helper->getValidConfirmDate($value);
84
+
85
+ /**
86
+ * Update the row's value for the decorator later.
87
+ */
88
+ $row->setData($this->getColumn()->getIndex(), $value->format('Y-m-d H:i:s'));
89
+
90
  $now = new DateTime();
91
  $now->setTimestamp(Mage::getModel('core/date')->gmtTimestamp());
92
 
93
  /**
94
+ * Check if the shipment should be confirmed somewhere in the future.
95
  */
96
  $diff = $now->diff($value);
97
  if (
99
  || ($diff->days == 0 && $diff->h < 24) && $diff->invert
100
  ) {
101
  /**
102
+ * Get the number of days until the shipment should be confirmed.
103
  */
104
  $diffDays = $diff->format('%a');
105
 
111
  }
112
 
113
  /**
114
+ * Check if the shipment should be confirmed today.
115
  */
116
  if ($diffDays == 0) {
117
+ return $helper->__('Today');
118
  }
119
 
120
  /**
121
+ * Check if it should be confirmed tomorrow.
122
  */
123
  if ($diffDays == 1) {
124
+ $renderedValue = $helper->__('Tomorrow');
125
 
126
  return $renderedValue;
127
  }
128
 
129
  /**
130
+ * Render the number of days before the shipment should be confirmed.
131
  */
132
+ $renderedValue = $helper->__('%s days from now', $diffDays);
133
 
134
  return $renderedValue;
135
  }
app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/OrderConfirmStatus.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_OrderConfirmStatus
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_OrderConfirmStatus
app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/OrderType.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_OrderType
@@ -85,13 +85,18 @@ class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_OrderType
85
  'product_code' => $productCodes[$key],
86
  )
87
  );
88
- $renderedValues[] = $this->getShipmentTypeRenderedValue($type, $rowDummy);
 
 
 
 
89
  }
90
 
91
  return implode('<br />', $renderedValues);
92
  }
93
 
94
  $renderedValue = $this->getOrderTypeRenderedValue($value, $row);
 
95
 
96
  return $renderedValue;
97
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_OrderType
85
  'product_code' => $productCodes[$key],
86
  )
87
  );
88
+
89
+ $renderedValue = $this->getShipmentTypeRenderedValue($type, $rowDummy);
90
+ $renderedValue = $this->_addOptionComments($renderedValue, $row);
91
+
92
+ $renderedValues[] = $renderedValue;
93
  }
94
 
95
  return implode('<br />', $renderedValues);
96
  }
97
 
98
  $renderedValue = $this->getOrderTypeRenderedValue($value, $row);
99
+ $renderedValue = $this->_addOptionComments($renderedValue, $row);
100
 
101
  return $renderedValue;
102
  }
app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/ShipmentType.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_ShipmentType
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_ShipmentType
app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/ShippingDescription.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_ShippingDescription
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_ShippingDescription
app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/ShippingPhase.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_ShippingPhase
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_ShippingPhase
app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/Time.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_Time
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_Time
app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/Translate.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_Translate
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_Translate
app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/Type/Abstract.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_Type_Abstract
@@ -48,6 +48,7 @@ class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_Type_Abstract
48
  const IS_PAKKETAUTOMAAT_COLUMN = 'is_pakketautomaat';
49
  const DELIVERY_OPTION_TYPE_COLUMN = 'delivery_option_type';
50
  const PAYMENT_METHOD_COLUMN = 'payment_method';
 
51
 
52
  /**
53
  * Renders a type column for a shipment type.
@@ -410,4 +411,39 @@ class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_Type_Abstract
410
 
411
  return $isCod;
412
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
413
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_Type_Abstract
48
  const IS_PAKKETAUTOMAAT_COLUMN = 'is_pakketautomaat';
49
  const DELIVERY_OPTION_TYPE_COLUMN = 'delivery_option_type';
50
  const PAYMENT_METHOD_COLUMN = 'payment_method';
51
+ const OPTIONS_COLUMN = 'options';
52
 
53
  /**
54
  * Renders a type column for a shipment type.
411
 
412
  return $isCod;
413
  }
414
+
415
+ /**
416
+ * Add additional comments for chosen options. Currently only the 'only_stated_address' option is supported, but
417
+ * this will likely be expanded in future releases.
418
+ *
419
+ * @param string $html
420
+ * @param Varien_Object $row
421
+ *
422
+ * @return mixed
423
+ */
424
+ protected function _addOptionComments($html, Varien_Object $row)
425
+ {
426
+ $options = $row->getData(self::OPTIONS_COLUMN);
427
+ if (empty($options)) {
428
+ return $html;
429
+ }
430
+
431
+ $helper = Mage::helper('postnl');
432
+
433
+ $options = unserialize($options);
434
+ foreach ($options as $option => $value) {
435
+ if (!$value) {
436
+ continue;
437
+ }
438
+
439
+ switch ($option) {
440
+ case 'only_stated_address':
441
+ $html .= '<br /><em>(' . $helper->__('deliver to stated address only') . ')</em>';
442
+ break;
443
+ //no default
444
+ }
445
+ }
446
+
447
+ return $html;
448
+ }
449
  }
app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Column/Renderer/YesNo.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_YesNo
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Column_Renderer_YesNo
app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Massaction/Item/Additional/LabelStartPos.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * Observer to edit the sales > shipments grid
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * Observer to edit the sales > shipments grid
app/code/community/TIG/PostNL/Block/Adminhtml/Widget/Grid/Massaction/Item/Additional/ProductOptions.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Massaction_Item_Additional_ProductOptions
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Adminhtml_Widget_Grid_Massaction_Item_Additional_ProductOptions
app/code/community/TIG/PostNL/Block/Adminhtml/WindowsTheme.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasIsOldMagento()
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasIsOldMagento()
app/code/community/TIG/PostNL/Block/Checkout/Cart/CheckoutLink.php CHANGED
@@ -25,21 +25,26 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasPublicWebshopId()
40
- * @method TIG_PostNL_Block_Checkout_Cart_CheckoutLink setPublicWebshopId(string $value)
41
  * @method boolean hasDoLoginCheck()
 
 
 
 
42
  * @method TIG_PostNL_Block_Checkout_Cart_CheckoutLink setDoLoginCheck(boolean $value)
 
 
43
  */
44
  class TIG_PostNL_Block_Checkout_Cart_CheckoutLink extends TIG_PostNL_Block_Core_Template
45
  {
@@ -51,8 +56,8 @@ class TIG_PostNL_Block_Checkout_Cart_CheckoutLink extends TIG_PostNL_Block_Core_
51
  /**
52
  * Base URLs of the checkout button.
53
  */
54
- const CHECKOUT_BUTTON_TEST_BASE_URL = 'https://tppcb-sandbox.e-id.nl/Button/Checkout';
55
- const CHECKOUT_BUTTON_LIVE_BASE_URL = 'https://checkout.postnl.nl/Button/Checkout';
56
 
57
  /**
58
  * Xpath to public webshop ID setting.
@@ -81,6 +86,36 @@ class TIG_PostNL_Block_Checkout_Cart_CheckoutLink extends TIG_PostNL_Block_Core_
81
  return $url;
82
  }
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  /**
85
  * Returns whether or not we need to check if the current customer is logged in with mijnpakket before showing
86
  * PostNL Checkout.
@@ -179,9 +214,9 @@ class TIG_PostNL_Block_Checkout_Cart_CheckoutLink extends TIG_PostNL_Block_Core_
179
  public function getSrc($forceDisabled = false)
180
  {
181
  if (Mage::helper('postnl/checkout')->isTestMode()) {
182
- $baseUrl = self::CHECKOUT_BUTTON_TEST_BASE_URL;
183
  } else {
184
- $baseUrl = self::CHECKOUT_BUTTON_LIVE_BASE_URL;
185
  }
186
 
187
  $webshopId = $this->getPublicWebshopId();
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasPublicWebshopId()
 
40
  * @method boolean hasDoLoginCheck()
41
+ * @method boolean hasButtonTestBaseUrl()
42
+ * @method boolean hasButtonLiveBaseUrl()
43
+ *
44
+ * @method TIG_PostNL_Block_Checkout_Cart_CheckoutLink setPublicWebshopId(string $value)
45
  * @method TIG_PostNL_Block_Checkout_Cart_CheckoutLink setDoLoginCheck(boolean $value)
46
+ * @method TIG_PostNL_Block_Checkout_Cart_CheckoutLink setButtonTestBaseUrl(string $value)
47
+ * @method TIG_PostNL_Block_Checkout_Cart_CheckoutLink setButtonLiveBaseUrl(string $value)
48
  */
49
  class TIG_PostNL_Block_Checkout_Cart_CheckoutLink extends TIG_PostNL_Block_Core_Template
50
  {
56
  /**
57
  * Base URLs of the checkout button.
58
  */
59
+ const CHECKOUT_BUTTON_TEST_BASE_URL_XPATH = 'postnl/checkout/checkout_button_test_base_url';
60
+ const CHECKOUT_BUTTON_LIVE_BASE_URL_XPATH = 'postnl/checkout/checkout_button_live_base_url';
61
 
62
  /**
63
  * Xpath to public webshop ID setting.
86
  return $url;
87
  }
88
 
89
+ /**
90
+ * @return string
91
+ */
92
+ public function getButtonTestBaseUrl()
93
+ {
94
+ if ($this->hasButtonTestBaseUrl()) {
95
+ return $this->_getData('button_test_base_url');
96
+ }
97
+
98
+ $baseUrl = Mage::getStoreConfig(self::CHECKOUT_BUTTON_TEST_BASE_URL_XPATH);
99
+
100
+ $this->setButtonTestBaseUrl($baseUrl);
101
+ return $baseUrl;
102
+ }
103
+
104
+ /**
105
+ * @return string
106
+ */
107
+ public function getButtonLiveBaseUrl()
108
+ {
109
+ if ($this->hasButtonLiveBaseUrl()) {
110
+ return $this->_getData('button_live_base_url');
111
+ }
112
+
113
+ $baseUrl = Mage::getStoreConfig(self::CHECKOUT_BUTTON_LIVE_BASE_URL_XPATH);
114
+
115
+ $this->setButtonLiveBaseUrl($baseUrl);
116
+ return $baseUrl;
117
+ }
118
+
119
  /**
120
  * Returns whether or not we need to check if the current customer is logged in with mijnpakket before showing
121
  * PostNL Checkout.
214
  public function getSrc($forceDisabled = false)
215
  {
216
  if (Mage::helper('postnl/checkout')->isTestMode()) {
217
+ $baseUrl = $this->getButtonTestBaseUrl();
218
  } else {
219
+ $baseUrl = $this->getButtonLiveBaseUrl();;
220
  }
221
 
222
  $webshopId = $this->getPublicWebshopId();
app/code/community/TIG/PostNL/Block/Checkout/Cart/Js.php CHANGED
@@ -25,27 +25,28 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasWebshopId()
40
- * @method TIG_PostNL_Block_Checkout_Cart_Js setWebshopId(string $value)
41
  * @method boolean hasCheckoutJsUrl()
42
- * @method TIG_PostNL_Block_Checkout_Cart_Js setCheckoutJsUrl(string $value)
43
  * @method boolean hasCheckoutPremiumJsUrl()
44
- * @method TIG_PostNL_Block_Checkout_Cart_Js setCheckoutPremiumJsUrl(string $value)
45
  * @method boolean hasEnvironment()
46
- * @method TIG_PostNL_Block_Checkout_Cart_Js setEnvironment(string $value)
47
  * @method boolean hasContinueUrl()
 
48
  * @method TIG_PostNL_Block_Checkout_Cart_Js setContinueUrl(string $value)
 
 
 
 
49
  */
50
  class TIG_PostNL_Block_Checkout_Cart_Js extends TIG_PostNL_Block_Core_Template
51
  {
@@ -55,31 +56,31 @@ class TIG_PostNL_Block_Checkout_Cart_Js extends TIG_PostNL_Block_Core_Template
55
  protected $_eventPrefix = 'postnl_checkout_cart_js';
56
 
57
  /**
58
- * XML path for webshop ID setting
59
  */
60
  const XPATH_PUBLIC_WEBSHOP_ID = 'postnl/cif/public_webshop_id';
61
 
62
  /**
63
- * XML path of show_summary_page setting
64
  */
65
  const XPATH_SHOW_SUMMARY_PAGE = 'postnl/checkout/show_summary_page';
66
 
67
  /**
68
- * URLs of the primary PostNL Checkout JS files for test and live mode
69
  */
70
- const TEST_CHECKOUT_JS_URL = 'https://tppwscheckout-sandbox.e-id.nl/Checkout2/Scripts/Checkout.js';
71
- const LIVE_CHECKOUT_JS_URL = 'https://mijnpakket.postnl.nl/Checkout2/Scripts/Checkout.js';
72
- const TEST_CHECKOUT_PREMIUM_JS_URL = 'https://tppwscheckout-sandbox.e-id.nl/Checkout2/CheckoutPremium.js';
73
- const LIVE_CHECKOUT_PREMIUM_JS_URL = 'https://mijnpakket.postnl.nl/Checkout2/CheckoutPremium.js';
74
 
75
  /**
76
- * Possible PostNL Checkout environments
77
  */
78
  const TEST_ENVIRONMENT = 'PostNL_OP_Checkout.environment_sandbox';
79
  const LIVE_ENVIRONMENT = 'PostNL_OP_Checkout.environment_production';
80
 
81
  /**
82
- * Gets the current store's webshop ID
83
  *
84
  * @return string
85
  */
@@ -111,13 +112,13 @@ class TIG_PostNL_Block_Checkout_Cart_Js extends TIG_PostNL_Block_Core_Template
111
  $storeId = Mage::app()->getStore()->getId();
112
 
113
  if (Mage::helper('postnl/checkout')->isTestMode($storeId)) {
114
- $url = self::TEST_CHECKOUT_JS_URL;
115
 
116
  $this->setCheckoutJsUrl($url);
117
  return $url;
118
  }
119
 
120
- $url = self::LIVE_CHECKOUT_JS_URL;
121
 
122
  $this->setCheckoutJsUrl($url);
123
  return $url;
@@ -137,13 +138,13 @@ class TIG_PostNL_Block_Checkout_Cart_Js extends TIG_PostNL_Block_Core_Template
137
  $storeId = Mage::app()->getStore()->getId();
138
 
139
  if (Mage::helper('postnl/checkout')->isTestMode($storeId)) {
140
- $url = self::TEST_CHECKOUT_PREMIUM_JS_URL;
141
 
142
  $this->setCheckoutPremiumJsUrl($url);
143
  return $url;
144
  }
145
 
146
- $url = self::LIVE_CHECKOUT_PREMIUM_JS_URL;
147
 
148
  $this->setCheckoutPremiumJsUrl($url);
149
  return $url;
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasWebshopId()
 
40
  * @method boolean hasCheckoutJsUrl()
 
41
  * @method boolean hasCheckoutPremiumJsUrl()
 
42
  * @method boolean hasEnvironment()
 
43
  * @method boolean hasContinueUrl()
44
+ *
45
  * @method TIG_PostNL_Block_Checkout_Cart_Js setContinueUrl(string $value)
46
+ * @method TIG_PostNL_Block_Checkout_Cart_Js setEnvironment(string $value)
47
+ * @method TIG_PostNL_Block_Checkout_Cart_Js setCheckoutPremiumJsUrl(string $value)
48
+ * @method TIG_PostNL_Block_Checkout_Cart_Js setCheckoutJsUrl(string $value)
49
+ * @method TIG_PostNL_Block_Checkout_Cart_Js setWebshopId(string $value)
50
  */
51
  class TIG_PostNL_Block_Checkout_Cart_Js extends TIG_PostNL_Block_Core_Template
52
  {
56
  protected $_eventPrefix = 'postnl_checkout_cart_js';
57
 
58
  /**
59
+ * XML path for webshop ID setting.
60
  */
61
  const XPATH_PUBLIC_WEBSHOP_ID = 'postnl/cif/public_webshop_id';
62
 
63
  /**
64
+ * XML path of show_summary_page setting.
65
  */
66
  const XPATH_SHOW_SUMMARY_PAGE = 'postnl/checkout/show_summary_page';
67
 
68
  /**
69
+ * URLs of the primary PostNL Checkout JS files for test and live mode.
70
  */
71
+ const TEST_CHECKOUT_JS_URL_XPATH = 'postnl/checkout/test_checkout_js_url';
72
+ const LIVE_CHECKOUT_JS_URL_XPATH = 'postnl/checkout/live_checkout_js_url';
73
+ const TEST_CHECKOUT_PREMIUM_JS_URL_XPATH = 'postnl/checkout/test_checkout_premium_js_url';
74
+ const LIVE_CHECKOUT_PREMIUM_JS_URL_XPATH = 'postnl/checkout/live_checkout_premium_js_url';
75
 
76
  /**
77
+ * Possible PostNL Checkout environments.
78
  */
79
  const TEST_ENVIRONMENT = 'PostNL_OP_Checkout.environment_sandbox';
80
  const LIVE_ENVIRONMENT = 'PostNL_OP_Checkout.environment_production';
81
 
82
  /**
83
+ * Gets the current store's webshop ID.
84
  *
85
  * @return string
86
  */
112
  $storeId = Mage::app()->getStore()->getId();
113
 
114
  if (Mage::helper('postnl/checkout')->isTestMode($storeId)) {
115
+ $url = Mage::getStoreConfig(self::TEST_CHECKOUT_JS_URL_XPATH);
116
 
117
  $this->setCheckoutJsUrl($url);
118
  return $url;
119
  }
120
 
121
+ $url = Mage::getStoreConfig(self::LIVE_CHECKOUT_JS_URL_XPATH);
122
 
123
  $this->setCheckoutJsUrl($url);
124
  return $url;
138
  $storeId = Mage::app()->getStore()->getId();
139
 
140
  if (Mage::helper('postnl/checkout')->isTestMode($storeId)) {
141
+ $url = Mage::getStoreConfig(self::TEST_CHECKOUT_PREMIUM_JS_URL_XPATH);
142
 
143
  $this->setCheckoutPremiumJsUrl($url);
144
  return $url;
145
  }
146
 
147
+ $url = Mage::getStoreConfig(self::LIVE_CHECKOUT_PREMIUM_JS_URL_XPATH);
148
 
149
  $this->setCheckoutPremiumJsUrl($url);
150
  return $url;
app/code/community/TIG/PostNL/Block/Checkout/Summary.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Checkout_Summary extends Mage_Sales_Block_Items_Abstract
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Checkout_Summary extends Mage_Sales_Block_Items_Abstract
app/code/community/TIG/PostNL/Block/Core/JsTranslate.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Core_JsTranslate extends TIG_PostNL_Block_Core_Template
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Core_JsTranslate extends TIG_PostNL_Block_Core_Template
app/code/community/TIG/PostNL/Block/Core/ShippingStatus.php CHANGED
@@ -25,16 +25,24 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
 
 
 
 
 
 
 
 
38
  */
39
  class TIG_PostNL_Block_Core_ShippingStatus extends TIG_PostNL_Block_Core_Template
40
  {
@@ -43,6 +51,26 @@ class TIG_PostNL_Block_Core_ShippingStatus extends TIG_PostNL_Block_Core_Templat
43
  */
44
  protected $_eventPrefix = 'postnl_core_shippingstatus';
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  /**
47
  * Checks if a given shipment has been confirmed with PostNL
48
  *
@@ -50,13 +78,12 @@ class TIG_PostNL_Block_Core_ShippingStatus extends TIG_PostNL_Block_Core_Templat
50
  *
51
  * @return boolean
52
  */
53
- public function isConfirmed($shipment)
54
  {
55
- /**
56
- * @var TIG_PostNL_Model_Core_Shipment $postnlShipment
57
- */
58
- $postnlShipment = Mage::getModel('postnl_core/shipment')->load($shipment->getId(), 'shipment_id');
59
- if ($postnlShipment->getConfirmStatus() == $postnlShipment::CONFIRM_STATUS_CONFIRMED) {
60
  return true;
61
  }
62
 
@@ -70,9 +97,13 @@ class TIG_PostNL_Block_Core_ShippingStatus extends TIG_PostNL_Block_Core_Templat
70
  *
71
  * @return string
72
  */
73
- public function getConfirmedAt($shipment)
74
  {
75
- $postnlShipment = Mage::getModel('postnl_core/shipment')->load($shipment->getId(), 'shipment_id');
 
 
 
 
76
 
77
  $confirmedAt = Mage::helper('core')->formatDate($postnlShipment->getConfirmedAt(), 'medium', false);
78
 
@@ -86,9 +117,13 @@ class TIG_PostNL_Block_Core_ShippingStatus extends TIG_PostNL_Block_Core_Templat
86
  *
87
  * @return boolean
88
  */
89
- public function getTrackingUrl($shipment)
90
  {
91
- $postnlShipment = Mage::getModel('postnl_core/shipment')->load($shipment->getId(), 'shipment_id');
 
 
 
 
92
 
93
  $barcodeUrl = $postnlShipment->getBarcodeUrl(true);
94
 
@@ -99,6 +134,26 @@ class TIG_PostNL_Block_Core_ShippingStatus extends TIG_PostNL_Block_Core_Templat
99
  return $trackingUrl;
100
  }
101
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  /**
103
  * Check if the PostNL module is enabled. Otherwise return an empty string.
104
  *
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ *
39
+ * @method boolean hasPostnlShipment()
40
+ * @method boolean hasShipment()
41
+ *
42
+ * @method TIG_PostNL_Block_Core_ShippingStatus setPostnlShipment(TIG_PostNL_Model_Core_Shipment $value)
43
+ * @method TIG_PostNL_Block_Core_ShippingStatus setShipment(Mage_Sales_Model_Order_Shipment $value)
44
+ *
45
+ * @method Mage_Sales_Model_Order_Shipment getShipment()
46
  */
47
  class TIG_PostNL_Block_Core_ShippingStatus extends TIG_PostNL_Block_Core_Template
48
  {
51
  */
52
  protected $_eventPrefix = 'postnl_core_shippingstatus';
53
 
54
+ /**
55
+ * @return TIG_PostNL_Model_Core_Shipment
56
+ */
57
+ public function getPostnlShipment()
58
+ {
59
+ if ($this->hasPostnlShipment()) {
60
+ return $this->_getData('postnl_shipment');
61
+ }
62
+
63
+ if (!$this->hasShipment()) {
64
+ return false;
65
+ }
66
+
67
+ $shipment = $this->getShipment();
68
+ $postnlShipment = Mage::getModel('postnl_core/shipment')->load($shipment->getId(), 'shipment_id');
69
+
70
+ $this->setPostnlShipment($postnlShipment);
71
+ return $postnlShipment;
72
+ }
73
+
74
  /**
75
  * Checks if a given shipment has been confirmed with PostNL
76
  *
78
  *
79
  * @return boolean
80
  */
81
+ public function isConfirmed()
82
  {
83
+ $postnlShipment = $this->getPostnlShipment();
84
+ if ($postnlShipment
85
+ && $postnlShipment->getConfirmStatus() == $postnlShipment::CONFIRM_STATUS_CONFIRMED
86
+ ) {
 
87
  return true;
88
  }
89
 
97
  *
98
  * @return string
99
  */
100
+ public function getConfirmedAt()
101
  {
102
+ $postnlShipment = $this->getPostnlShipment();
103
+
104
+ if (!$postnlShipment) {
105
+ return false;
106
+ }
107
 
108
  $confirmedAt = Mage::helper('core')->formatDate($postnlShipment->getConfirmedAt(), 'medium', false);
109
 
117
  *
118
  * @return boolean
119
  */
120
+ public function getTrackingUrl()
121
  {
122
+ $postnlShipment = $this->getPostnlShipment();
123
+
124
+ if (!$postnlShipment) {
125
+ return '';
126
+ }
127
 
128
  $barcodeUrl = $postnlShipment->getBarcodeUrl(true);
129
 
134
  return $trackingUrl;
135
  }
136
 
137
+ /**
138
+ * @return array|TIG_PostNL_Model_Core_Resource_Shipment_Collection
139
+ */
140
+ public function getPostnlShipments()
141
+ {
142
+ /**
143
+ * @var Mage_Sales_Model_Resource_Order_Shipment_Collection $shipments
144
+ */
145
+ $shipments = Mage::registry('current_order')->getShipmentsCollection();
146
+ if (!$shipments) {
147
+ return array();
148
+ }
149
+
150
+ $shipmentsIds = $shipments->getColumnValues('entity_id');
151
+ $postnlShipments = Mage::getResourceModel('postnl_core/shipment_collection')
152
+ ->addFieldToFilter('shipment_id', array('in' => $shipmentsIds));
153
+
154
+ return $postnlShipments;
155
+ }
156
+
157
  /**
158
  * Check if the PostNL module is enabled. Otherwise return an empty string.
159
  *
app/code/community/TIG/PostNL/Block/Core/Template.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  abstract class TIG_PostNL_Block_Core_Template extends Mage_Core_Block_Template
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  abstract class TIG_PostNL_Block_Core_Template extends Mage_Core_Block_Template
app/code/community/TIG/PostNL/Block/DeliveryOptions/Checkout/AddPhoneNumber.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasPhoneNumber()
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasPhoneNumber()
app/code/community/TIG/PostNL/Block/DeliveryOptions/Checkout/DeliveryOptions.php CHANGED
@@ -25,22 +25,30 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
- * @method string getMethodName()
40
  * @method TIG_PostNL_Block_DeliveryOptions_Checkout_DeliveryOptions setStreetnameField(int $value)
41
  * @method TIG_PostNL_Block_DeliveryOptions_Checkout_DeliveryOptions setHousenumberField(int $value)
42
- * @method boolean hasTaxDisplayType()
43
  * @method TIG_PostNL_Block_DeliveryOptions_Checkout_DeliveryOptions setTaxDisplayType(int $value)
 
 
 
 
 
 
 
 
 
 
44
  */
45
  class TIG_PostNL_Block_DeliveryOptions_Checkout_DeliveryOptions extends TIG_PostNL_Block_DeliveryOptions_Template
46
  {
@@ -54,6 +62,16 @@ class TIG_PostNL_Block_DeliveryOptions_Checkout_DeliveryOptions extends TIG_Post
54
  */
55
  const XPATH_ALLOW_STREETVIEW = 'postnl/delivery_options/allow_streetview';
56
 
 
 
 
 
 
 
 
 
 
 
57
  /**
58
  * Currently selected shipping address.
59
  *
@@ -82,6 +100,73 @@ class TIG_PostNL_Block_DeliveryOptions_Checkout_DeliveryOptions extends TIG_Post
82
  return $this;
83
  }
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  /**
86
  * Gets the current quote.
87
  *
@@ -240,29 +325,36 @@ class TIG_PostNL_Block_DeliveryOptions_Checkout_DeliveryOptions extends TIG_Post
240
  }
241
 
242
  /**
243
- * Get the fee charged for evening timeframes.
244
  *
245
- * @param boolean $formatted
246
- * @param boolean $includingTax
247
  *
248
- * @return float
249
  */
250
- public function getEveningFee($formatted = false, $includingTax = true)
251
  {
252
- return Mage::helper('postnl/deliveryOptions')->getEveningFee($formatted, $includingTax);
 
 
 
 
 
 
253
  }
254
 
255
  /**
256
- * Get the fee charged for PakjeGemak Express.
257
  *
258
- * @param boolean $formatted
259
- * @param boolean $includingTax
 
 
260
  *
261
- * @return float
262
  */
263
- public function getExpressFee($formatted = false, $includingTax = true)
264
  {
265
- return Mage::helper('postnl/deliveryOptions')->getExpressFee($formatted, $includingTax);
266
  }
267
 
268
  /**
@@ -281,6 +373,9 @@ class TIG_PostNL_Block_DeliveryOptions_Checkout_DeliveryOptions extends TIG_Post
281
  case 'express':
282
  $fee = $this->getExpressFee(false, $includingTax);
283
  break;
 
 
 
284
  default:
285
  return 0;
286
  }
@@ -305,6 +400,9 @@ class TIG_PostNL_Block_DeliveryOptions_Checkout_DeliveryOptions extends TIG_Post
305
  case 'express':
306
  $feeText = $this->getExpressFee(true, $includingTax);
307
  break;
 
 
 
308
  default:
309
  return 0;
310
  }
@@ -312,6 +410,66 @@ class TIG_PostNL_Block_DeliveryOptions_Checkout_DeliveryOptions extends TIG_Post
312
  return $feeText;
313
  }
314
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
315
  /**
316
  * Get the field used for the address's streetname.
317
  *
@@ -467,6 +625,17 @@ class TIG_PostNL_Block_DeliveryOptions_Checkout_DeliveryOptions extends TIG_Post
467
  return $streetviewAllowed;
468
  }
469
 
 
 
 
 
 
 
 
 
 
 
 
470
  /**
471
  * Checks whether the current theme uses cufon.
472
  *
@@ -497,6 +666,50 @@ class TIG_PostNL_Block_DeliveryOptions_Checkout_DeliveryOptions extends TIG_Post
497
  return false;
498
  }
499
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
500
  /**
501
  * Get whether this order is a buspakje order.
502
  *
@@ -504,12 +717,12 @@ class TIG_PostNL_Block_DeliveryOptions_Checkout_DeliveryOptions extends TIG_Post
504
  */
505
  public function getIsBuspakje()
506
  {
 
 
507
  /**
508
- * Check if the buspakje calculation mode is set to automatic.
509
  */
510
- $helper = Mage::helper('postnl');
511
- $calculationMode = $helper->getBuspakjeCalculationMode();
512
- if ($calculationMode != 'automatic') {
513
  return false;
514
  }
515
 
@@ -517,7 +730,7 @@ class TIG_PostNL_Block_DeliveryOptions_Checkout_DeliveryOptions extends TIG_Post
517
  * Check if the current quote fits as a letter box parcel.
518
  */
519
  $quote = Mage::getSingleton('checkout/session')->getQuote();
520
- if (!$helper->fitsAsBuspakje($quote->getAllItems())) {
521
  return false;
522
  }
523
 
@@ -587,6 +800,8 @@ class TIG_PostNL_Block_DeliveryOptions_Checkout_DeliveryOptions extends TIG_Post
587
  $response = $cif->setStoreId(Mage::app()->getStore()->getId())
588
  ->getDeliveryDate($postcode, $quote);
589
 
 
 
590
  return $response;
591
  }
592
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
 
39
  * @method TIG_PostNL_Block_DeliveryOptions_Checkout_DeliveryOptions setStreetnameField(int $value)
40
  * @method TIG_PostNL_Block_DeliveryOptions_Checkout_DeliveryOptions setHousenumberField(int $value)
 
41
  * @method TIG_PostNL_Block_DeliveryOptions_Checkout_DeliveryOptions setTaxDisplayType(int $value)
42
+ * @method TIG_PostNL_Block_DeliveryOptions_Checkout_DeliveryOptions setMethodName(string $value)
43
+ * @method TIG_PostNL_Block_DeliveryOptions_Checkout_DeliveryOptions setMethodRate(float $value)
44
+ * @method TIG_PostNL_Block_DeliveryOptions_Checkout_DeliveryOptions setMethodCode(string $value)
45
+ *
46
+ * @method boolean hasTaxDisplayType()
47
+ * @method boolean hasMethodName()
48
+ * @method boolean hasMethodRate()
49
+ * @method boolean hasMethodCode()
50
+ *
51
+ * @method Mage_Sales_Model_Quote_Address_Rate getRate()
52
  */
53
  class TIG_PostNL_Block_DeliveryOptions_Checkout_DeliveryOptions extends TIG_PostNL_Block_DeliveryOptions_Template
54
  {
62
  */
63
  const XPATH_ALLOW_STREETVIEW = 'postnl/delivery_options/allow_streetview';
64
 
65
+ /**
66
+ * Xpath to the 'stated_address_only_checked' setting.
67
+ */
68
+ const XPATH_STATED_ADDRESS_ONLY_CHECKED = 'postnl/delivery_options/stated_address_only_checked';
69
+
70
+ /**
71
+ * Shipping method code used by PostNL matrix rate.
72
+ */
73
+ const POSTNL_MATRIX_RATE_CODE = 'postnl_matrixrate';
74
+
75
  /**
76
  * Currently selected shipping address.
77
  *
100
  return $this;
101
  }
102
 
103
+ /**
104
+ * Get the current shipping method's name.
105
+ *
106
+ * @return string
107
+ */
108
+ public function getMethodName()
109
+ {
110
+ if ($this->hasMethodName()) {
111
+ return $this->_getData('method_name');
112
+ }
113
+
114
+ $rate = $this->getRate();
115
+ if (!$rate) {
116
+ return '';
117
+ }
118
+
119
+ $methodCode = $this->getMethodCode();
120
+ $methodName = 's_method_' . $methodCode;
121
+
122
+ $this->setMethodName($methodName);
123
+ return $methodName;
124
+ }
125
+
126
+ /**
127
+ * Get the current shipping method's rate.
128
+ *
129
+ * @return float|int
130
+ */
131
+ public function getMethodRate()
132
+ {
133
+ if ($this->hasMethodRate()) {
134
+ return $this->_getData('method_rate');
135
+ }
136
+
137
+ $rate = $this->getRate();
138
+ if (!$rate) {
139
+ return 0;
140
+ }
141
+
142
+ $methodRate = $rate->getPrice();
143
+
144
+ $this->setMethodRate($methodRate);
145
+ return $methodRate;
146
+ }
147
+
148
+ /**
149
+ * Get the current shipping method's code.
150
+ *
151
+ * @return string
152
+ */
153
+ public function getMethodCode()
154
+ {
155
+ if ($this->hasMethodCode()) {
156
+ return $this->_getData('method_code');
157
+ }
158
+
159
+ $rate = $this->getRate();
160
+ if (!$rate) {
161
+ return '';
162
+ }
163
+
164
+ $methodCode = $rate->getCode();
165
+
166
+ $this->setMethodCode($methodCode);
167
+ return $methodCode;
168
+ }
169
+
170
  /**
171
  * Gets the current quote.
172
  *
325
  }
326
 
327
  /**
328
+ * Check if a fee is set for this option.
329
  *
330
+ * @param string $option
 
331
  *
332
+ * @return bool
333
  */
334
+ public function hasOptionFee($option)
335
  {
336
+ $fee = $this->getOptionFee($option);
337
+
338
+ if ($fee > 0) {
339
+ return true;
340
+ }
341
+
342
+ return false;
343
  }
344
 
345
  /**
346
+ * Gets the configured fee for a specified option.
347
  *
348
+ * @param string $option
349
+ * @param bool $formatted
350
+ * @param bool $includingTax
351
+ * @param bool $convert
352
  *
353
+ * @return float|int
354
  */
355
+ public function getOptionFee($option, $formatted = false, $includingTax = true, $convert = true)
356
  {
357
+ return Mage::helper('postnl/deliveryOptions')->getOptionFee($option, $formatted, $includingTax, $convert);
358
  }
359
 
360
  /**
373
  case 'express':
374
  $fee = $this->getExpressFee(false, $includingTax);
375
  break;
376
+ case 'pakje_gemak':
377
+ $fee = $this->getPakjeGemakFee(false, $includingTax);
378
+ break;
379
  default:
380
  return 0;
381
  }
400
  case 'express':
401
  $feeText = $this->getExpressFee(true, $includingTax);
402
  break;
403
+ case 'pakje_gemak':
404
+ $feeText = $this->getPakjeGemakFee(true, $includingTax);
405
+ break;
406
  default:
407
  return 0;
408
  }
410
  return $feeText;
411
  }
412
 
413
+ /**
414
+ * Get the fee charged for evening timeframes.
415
+ *
416
+ * @param boolean $formatted
417
+ * @param boolean $includingTax
418
+ *
419
+ * @return float
420
+ */
421
+ public function getEveningFee($formatted = false, $includingTax = true)
422
+ {
423
+ return Mage::helper('postnl/deliveryOptions')->getEveningFee($formatted, $includingTax);
424
+ }
425
+
426
+ /**
427
+ * Get the fee charged for PakjeGemak Express.
428
+ *
429
+ * @param boolean $formatted
430
+ * @param boolean $includingTax
431
+ *
432
+ * @return float
433
+ */
434
+ public function getExpressFee($formatted = false, $includingTax = true)
435
+ {
436
+ return Mage::helper('postnl/deliveryOptions')->getExpressFee($formatted, $includingTax);
437
+ }
438
+
439
+ /**
440
+ * Get the fee for PakjeGemak locations. This is the difference between the current shipping rate and the shipping
441
+ * rate specifically for parcel.
442
+ *
443
+ * This method is only applicable for buspakje shipments where PakjeGemak locations are also allowed.
444
+ *
445
+ * @param boolean $formatted
446
+ * @param boolean $includingTax
447
+ *
448
+ * @return int
449
+ */
450
+ public function getPakjeGemakFee($formatted = false, $includingTax = true)
451
+ {
452
+ if (!$this->getIsBuspakje()) {
453
+ return 0;
454
+ }
455
+
456
+ if (!$this->canUsePakjeGemak()
457
+ && !$this->canUsePakjeGemakExpress()
458
+ && !$this->canUsePakketAutomaat()
459
+ ) {
460
+ return 0;
461
+ }
462
+
463
+ $shippingMethod = $this->getMethodCode();
464
+ if (self::POSTNL_MATRIX_RATE_CODE !== $shippingMethod) {
465
+ return 0;
466
+ }
467
+
468
+ $currentRate = $this->getMethodRate();
469
+
470
+ return Mage::helper('postnl/deliveryOptions')->getPakjeGemakFee($currentRate, $formatted, $includingTax);
471
+ }
472
+
473
  /**
474
  * Get the field used for the address's streetname.
475
  *
625
  return $streetviewAllowed;
626
  }
627
 
628
+ /**
629
+ * Check if using the responsive design is allowed.
630
+ *
631
+ * @return bool
632
+ */
633
+ public function canUseResponsive()
634
+ {
635
+ $canUseResponsive = Mage::helper('postnl/deliveryOptions')->canUseResponsive();
636
+ return $canUseResponsive;
637
+ }
638
+
639
  /**
640
  * Checks whether the current theme uses cufon.
641
  *
666
  return false;
667
  }
668
 
669
+ /**
670
+ * Check whether the 'only_stated_address' option can be shown.
671
+ *
672
+ * @return boolean
673
+ */
674
+ public function canShowOnlyStatedAddressOption()
675
+ {
676
+ $canShowOnlyStatedAddressOptions = Mage::helper('postnl/deliveryOptions')->canShowOnlyStatedAddressOption();
677
+ return $canShowOnlyStatedAddressOptions;
678
+ }
679
+
680
+ /**
681
+ * Check if the 'only_stated_address' option should be checked.
682
+ *
683
+ * @return bool
684
+ */
685
+ public function isOnlyStatedAddressOptionChecked()
686
+ {
687
+ $isOnlyStatedAddressOptionChecked = Mage::helper('postnl/deliveryOptions')->isOnlyStatedAddressOptionChecked();
688
+ return $isOnlyStatedAddressOptionChecked;
689
+ }
690
+
691
+ /**
692
+ * Check if separate rates should be shown for delivery and pick-up.
693
+ *
694
+ * @return boolean
695
+ */
696
+ public function canShowSeparateRates()
697
+ {
698
+ if (!$this->getIsBuspakje()) {
699
+ return false;
700
+ }
701
+
702
+ if (!$this->canUsePakjeGemak()) {
703
+ return false;
704
+ }
705
+
706
+ if ($this->getPakjeGemakFee() < 0.01) {
707
+ return false;
708
+ }
709
+
710
+ return true;
711
+ }
712
+
713
  /**
714
  * Get whether this order is a buspakje order.
715
  *
717
  */
718
  public function getIsBuspakje()
719
  {
720
+ $helper = Mage::helper('postnl');
721
+
722
  /**
723
+ * Check if buspakje can be used.
724
  */
725
+ if (!$helper->canUseBuspakje()) {
 
 
726
  return false;
727
  }
728
 
730
  * Check if the current quote fits as a letter box parcel.
731
  */
732
  $quote = Mage::getSingleton('checkout/session')->getQuote();
733
+ if (!$helper->quoteIsBuspakje($quote)) {
734
  return false;
735
  }
736
 
800
  $response = $cif->setStoreId(Mage::app()->getStore()->getId())
801
  ->getDeliveryDate($postcode, $quote);
802
 
803
+ $response = Mage::helper('postnl/deliveryOptions')->getValidDeliveryDate($response)->format('d-m-Y');
804
+
805
  return $response;
806
  }
807
  }
app/code/community/TIG/PostNL/Block/DeliveryOptions/Js.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasApiKey()
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasApiKey()
app/code/community/TIG/PostNL/Block/DeliveryOptions/Template.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  abstract class TIG_PostNL_Block_DeliveryOptions_Template extends TIG_PostNL_Block_Core_Template
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  abstract class TIG_PostNL_Block_DeliveryOptions_Template extends TIG_PostNL_Block_Core_Template
app/code/community/TIG/PostNL/Block/DeliveryOptions/Theme.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasIsOsc()
@@ -87,15 +87,76 @@ class TIG_PostNL_Block_DeliveryOptions_Theme extends TIG_PostNL_Block_DeliveryOp
87
  return '';
88
  }
89
 
90
- if ($this->getIsOsc()) {
91
- $file = (string) $files->onestepcheckout;
92
- } else {
93
- $file = (string) $files->onepage;
 
 
 
 
 
 
94
  }
95
 
96
  return $file;
97
  }
98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  /**
100
  * Check if PostNL delivery options are available for the current quote.
101
  *
@@ -111,10 +172,6 @@ class TIG_PostNL_Block_DeliveryOptions_Theme extends TIG_PostNL_Block_DeliveryOp
111
  return '';
112
  }
113
 
114
- if (!$this->getThemeCssFile()) {
115
- return '';
116
- }
117
-
118
  return parent::_toHtml();
119
  }
120
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasIsOsc()
87
  return '';
88
  }
89
 
90
+ $file = '';
91
+ if ($this->getIsOsc()
92
+ && isset($files->onestepcheckout)
93
+ && isset($files->onestepcheckout->main)
94
+ ) {
95
+ $file = (string) $files->onestepcheckout->main;
96
+ } elseif (isset($files->onepage)
97
+ && isset($files->onepage->main)
98
+ ) {
99
+ $file = (string) $files->onepage->main;
100
  }
101
 
102
  return $file;
103
  }
104
 
105
+ /**
106
+ * Gets a css file path for the current theme.
107
+ *
108
+ * @return array
109
+ */
110
+ public function getResponsiveThemeCssFiles()
111
+ {
112
+ $cssFiles = array();
113
+
114
+ /**
115
+ * @var Varien_Simplexml_Element $theme
116
+ */
117
+ $theme = $this->getCurrentTheme();
118
+ if (!$theme) {
119
+ return $cssFiles;
120
+ }
121
+
122
+ /**
123
+ * @var Varien_Simplexml_Element $files
124
+ */
125
+ $files = $theme->files;
126
+ if (!$files) {
127
+ return $cssFiles;
128
+ }
129
+
130
+ if ($this->getIsOsc()
131
+ && isset($files->onestepcheckout)
132
+ && isset($files->onestepcheckout->responsive)
133
+ ) {
134
+ /**
135
+ * @var Mage_Core_Model_Config_Element $cssFiles
136
+ */
137
+ $cssFiles = $files->onestepcheckout->responsive;
138
+ $cssFiles = $cssFiles->asArray();
139
+ } elseif (isset($files->onepage)
140
+ && isset($files->onepage->responsive)
141
+ ) {
142
+ /**
143
+ * @var Mage_Core_Model_Config_Element $cssFiles
144
+ */
145
+ $cssFiles = $files->onepage->responsive;
146
+ $cssFiles = $cssFiles->asArray();
147
+ }
148
+
149
+ return $cssFiles;
150
+ }
151
+
152
+ /**
153
+ * @return bool
154
+ */
155
+ public function canUseResponsive()
156
+ {
157
+ return Mage::helper('postnl/deliveryOptions')->canUseResponsive();
158
+ }
159
+
160
  /**
161
  * Check if PostNL delivery options are available for the current quote.
162
  *
172
  return '';
173
  }
174
 
 
 
 
 
175
  return parent::_toHtml();
176
  }
177
  }
app/code/community/TIG/PostNL/Block/Mijnpakket/AccountNotification.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasCanShowNotification()
@@ -63,7 +63,7 @@ class TIG_PostNL_Block_Mijnpakket_AccountNotification extends TIG_PostNL_Block_C
63
  /**
64
  * Base URL to create a new MijnPakket account.
65
  */
66
- const CREATE_ACCOUNT_BASE_URL = 'https://mijnpakket.postnl.nl/Register/RegisterFromWebshop?';
67
 
68
  /**
69
  * The webshop's public webshop ID is used to secure communications with PostNL's servers.
@@ -211,7 +211,7 @@ class TIG_PostNL_Block_Mijnpakket_AccountNotification extends TIG_PostNL_Block_C
211
  return $this->_getData('create_account_base_url');
212
  }
213
 
214
- $baseUrl = self::CREATE_ACCOUNT_BASE_URL;
215
 
216
  $this->setCreateAccountBaseUrl($baseUrl);
217
  return $baseUrl;
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasCanShowNotification()
63
  /**
64
  * Base URL to create a new MijnPakket account.
65
  */
66
+ const CREATE_ACCOUNT_BASE_URL_XPATH = 'postnl/delivery_options/create_account_base_url';
67
 
68
  /**
69
  * The webshop's public webshop ID is used to secure communications with PostNL's servers.
211
  return $this->_getData('create_account_base_url');
212
  }
213
 
214
+ $baseUrl = Mage::getStoreConfig(self::CREATE_ACCOUNT_BASE_URL_XPATH);
215
 
216
  $this->setCreateAccountBaseUrl($baseUrl);
217
  return $baseUrl;
app/code/community/TIG/PostNL/Block/Mijnpakket/Js.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasIsTestMode()
@@ -56,10 +56,10 @@ class TIG_PostNL_Block_Mijnpakket_Js extends TIG_PostNL_Block_Core_Template
56
  /**
57
  * Available URl's for PostNL's login API.
58
  */
59
- const LIVE_BASE_URL = 'https://mijnpakket.postnl.nl/';
60
- const TEST_BASE_URL = 'https://tppwscheckout-sandbox.e-id.nl/';
61
- const LOGIN_JS_PATH = 'Checkout2/Login.js';
62
- const CHECKOUT_PREMIUM_JS_PATH = 'Checkout2/CheckoutPremium.js';
63
 
64
  /**
65
  * @return boolean
@@ -89,9 +89,9 @@ class TIG_PostNL_Block_Mijnpakket_Js extends TIG_PostNL_Block_Core_Template
89
 
90
  $isTestMode = $this->getIsTestMode();
91
  if ($isTestMode) {
92
- $baseUrl = self::TEST_BASE_URL;
93
  } else {
94
- $baseUrl = self::LIVE_BASE_URL;
95
  }
96
 
97
  $this->setBaseUrl($baseUrl);
@@ -107,7 +107,7 @@ class TIG_PostNL_Block_Mijnpakket_Js extends TIG_PostNL_Block_Core_Template
107
  {
108
  $baseUrl = $this->getBaseUrl();
109
 
110
- $url = $baseUrl . self::LOGIN_JS_PATH;
111
 
112
  return $url;
113
  }
@@ -121,7 +121,7 @@ class TIG_PostNL_Block_Mijnpakket_Js extends TIG_PostNL_Block_Core_Template
121
  {
122
  $baseUrl = $this->getBaseUrl();
123
 
124
- $url = $baseUrl . self::CHECKOUT_PREMIUM_JS_PATH;
125
 
126
  return $url;
127
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasIsTestMode()
56
  /**
57
  * Available URl's for PostNL's login API.
58
  */
59
+ const LIVE_BASE_URL_XPATH = 'postnl/delivery_options/mijnpakket_live_base_url';
60
+ const TEST_BASE_URL_XPATH = 'postnl/delivery_options/mijnpakket_test_base_url';
61
+ const LOGIN_JS_PATH_XPATH = 'postnl/delivery_options/mijnpakket_login_js_path';
62
+ const CHECKOUT_PREMIUM_JS_PATH_XPATH = 'postnl/delivery_options/mijnpakket_checkout_premium_js_path';
63
 
64
  /**
65
  * @return boolean
89
 
90
  $isTestMode = $this->getIsTestMode();
91
  if ($isTestMode) {
92
+ $baseUrl = Mage::getStoreConfig(self::TEST_BASE_URL_XPATH);
93
  } else {
94
+ $baseUrl = Mage::getStoreConfig(self::LIVE_BASE_URL_XPATH);
95
  }
96
 
97
  $this->setBaseUrl($baseUrl);
107
  {
108
  $baseUrl = $this->getBaseUrl();
109
 
110
+ $url = $baseUrl . Mage::getStoreConfig(self::LOGIN_JS_PATH_XPATH);
111
 
112
  return $url;
113
  }
121
  {
122
  $baseUrl = $this->getBaseUrl();
123
 
124
+ $url = $baseUrl . Mage::getStoreConfig(self::CHECKOUT_PREMIUM_JS_PATH_XPATH);
125
 
126
  return $url;
127
  }
app/code/community/TIG/PostNL/Block/Mijnpakket/LoginButton.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasIsTestMode()
@@ -64,9 +64,9 @@ class TIG_PostNL_Block_Mijnpakket_LoginButton extends TIG_PostNL_Block_Core_Temp
64
  /**
65
  * Available URl's for PostNL's login buttons.
66
  */
67
- const LIVE_BASE_URL = 'https://checkout.postnl.nl/';
68
- const TEST_BASE_URL = 'https://tppcb-sandbox.e-id.nl/';
69
- const BUTTON_URL_PATH = 'Button/PremiumLogin';
70
 
71
  /**
72
  * @var string
@@ -101,9 +101,9 @@ class TIG_PostNL_Block_Mijnpakket_LoginButton extends TIG_PostNL_Block_Core_Temp
101
 
102
  $isTestMode = $this->getIsTestMode();
103
  if ($isTestMode) {
104
- $baseUrl = self::TEST_BASE_URL;
105
  } else {
106
- $baseUrl = self::LIVE_BASE_URL;
107
  }
108
 
109
  $this->setBaseUrl($baseUrl);
@@ -156,7 +156,7 @@ class TIG_PostNL_Block_Mijnpakket_LoginButton extends TIG_PostNL_Block_Core_Temp
156
  }
157
 
158
  $baseUrl = $this->getBaseUrl();
159
- $url = $baseUrl . self::BUTTON_URL_PATH;
160
 
161
  $url .= '?publicId=' . $this->getPublicWebshopId();
162
 
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasIsTestMode()
64
  /**
65
  * Available URl's for PostNL's login buttons.
66
  */
67
+ const LIVE_BASE_URL_XPATH = 'postnl/delivery_options/mijnpakket_login_btn_live_base_url';
68
+ const TEST_BASE_URL_XPATH = 'postnl/delivery_options/mijnpakket_login_btn_test_base_url';
69
+ const BUTTON_URL_PATH_XPATH = 'postnl/delivery_options/mijnpakket_login_btn_url_path';
70
 
71
  /**
72
  * @var string
101
 
102
  $isTestMode = $this->getIsTestMode();
103
  if ($isTestMode) {
104
+ $baseUrl = Mage::getStoreConfig(self::TEST_BASE_URL_XPATH);
105
  } else {
106
+ $baseUrl = Mage::getStoreConfig(self::LIVE_BASE_URL_XPATH);
107
  }
108
 
109
  $this->setBaseUrl($baseUrl);
156
  }
157
 
158
  $baseUrl = $this->getBaseUrl();
159
+ $url = $baseUrl . Mage::getStoreConfig(self::BUTTON_URL_PATH_XPATH);
160
 
161
  $url .= '?publicId=' . $this->getPublicWebshopId();
162
 
app/code/community/TIG/PostNL/Block/Mijnpakket/OrderSuccessJs.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasIsTestMode()
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasIsTestMode()
app/code/community/TIG/PostNL/Block/Payment/Checkout/Total/CodFee.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method Varien_Object getTotal()
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method Varien_Object getTotal()
app/code/community/TIG/PostNL/Block/Payment/Form/Cod.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Payment_Form_Cod extends Mage_Payment_Block_Form
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Payment_Form_Cod extends Mage_Payment_Block_Form
app/code/community/TIG/PostNL/Block/Payment/Info.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Payment_Info extends Mage_Payment_Block_Info
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Payment_Info extends Mage_Payment_Block_Info
app/code/community/TIG/PostNL/Block/Payment/Sales/Order/Creditmemo/Totals/CodFee.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Payment_Sales_Order_Creditmemo_Totals_CodFee extends Mage_Sales_Block_Order_Creditmemo_Totals
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Payment_Sales_Order_Creditmemo_Totals_CodFee extends Mage_Sales_Block_Order_Creditmemo_Totals
app/code/community/TIG/PostNL/Block/Payment/Sales/Order/Invoice/Totals/CodFee.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Payment_Sales_Order_Invoice_Totals_CodFee extends Mage_Sales_Block_Order_Invoice_Totals
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Payment_Sales_Order_Invoice_Totals_CodFee extends Mage_Sales_Block_Order_Invoice_Totals
app/code/community/TIG/PostNL/Block/Payment/Sales/Order/Totals/CodFee.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Payment_Sales_Order_Totals_CodFee extends Mage_Sales_Block_Order_Totals
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Block_Payment_Sales_Order_Totals_CodFee extends Mage_Sales_Block_Order_Totals
app/code/community/TIG/PostNL/Controller/Adminhtml/Config.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ class TIG_PostNL_Controller_Adminhtml_Config extends Mage_Adminhtml_Controller_Action
40
+ {
41
+ /**
42
+ * Saves the current wizard step.
43
+ *
44
+ * @param string $step
45
+ *
46
+ * @return $this
47
+ */
48
+ protected function _saveCurrentWizardStep($step)
49
+ {
50
+ $adminUser = Mage::getSingleton('admin/session')->getUser();
51
+ $extra = $adminUser->getExtra();
52
+
53
+ $extra['postnl']['current_wizard_step'] = $step;
54
+
55
+ $adminUser->saveExtra($extra);
56
+
57
+ return $this;
58
+ }
59
+ }
app/code/community/TIG/PostNL/Controller/Adminhtml/Shipment.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Controller_Adminhtml_Shipment extends Mage_Adminhtml_Controller_Action
@@ -48,6 +48,13 @@ class TIG_PostNL_Controller_Adminhtml_Shipment extends Mage_Adminhtml_Controller
48
  */
49
  protected $_warnings = array();
50
 
 
 
 
 
 
 
 
51
  /**
52
  * @return array
53
  */
@@ -180,20 +187,25 @@ class TIG_PostNL_Controller_Adminhtml_Shipment extends Mage_Adminhtml_Controller
180
  }
181
 
182
  /**
183
- * Creates a shipment of an order containing all available items
184
  *
185
- * @param int $orderId
186
  *
187
  * @return int
188
  *
189
  * @throws TIG_PostNL_Exception
190
  */
191
- protected function _createShipment($orderId)
192
  {
193
- /**
194
- * @var Mage_Sales_Model_Order $order
195
- */
196
- $order = Mage::getModel('sales/order')->load($orderId);
 
 
 
 
 
197
 
198
  if (!$order->canShip()) {
199
  throw new TIG_PostNL_Exception(
@@ -211,6 +223,106 @@ class TIG_PostNL_Controller_Adminhtml_Shipment extends Mage_Adminhtml_Controller
211
  return $shipment->getId();
212
  }
213
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214
  /**
215
  * Save shipment and order in one transaction
216
  *
@@ -229,6 +341,166 @@ class TIG_PostNL_Controller_Adminhtml_Shipment extends Mage_Adminhtml_Controller
229
  return $this;
230
  }
231
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
  /**
233
  * Retrieves the shipping label for a given shipment ID.
234
  *
@@ -295,7 +567,7 @@ class TIG_PostNL_Controller_Adminhtml_Shipment extends Mage_Adminhtml_Controller
295
  $postnlShipment->save();
296
  } else {
297
  /**
298
- * generate new shipping labels without confirming.
299
  */
300
  $postnlShipment->generateLabel()
301
  ->save();
@@ -408,44 +680,155 @@ class TIG_PostNL_Controller_Adminhtml_Shipment extends Mage_Adminhtml_Controller
408
  $shipmentIds = array($shipmentIds);
409
  }
410
 
411
- $shipments = array();
412
- foreach ($shipmentIds as $shipmentId) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
413
  /**
414
- * Load the shipment.
415
- *
416
- * @var Mage_Sales_Model_Order_Shipment|TIG_PostNL_Model_Core_Shipment|boolean $shipment
417
  */
418
- $shipment = $this->_loadShipment($shipmentId, $loadPostnlShipments);
 
 
 
 
 
419
 
420
- if (!$shipment && $throwException) {
421
  throw new TIG_PostNL_Exception(
422
  $this->__(
423
  'This action is not available for shipment #%s, because it was not shipped using PostNL.',
424
- $shipment->getIncrementId()
425
  ),
426
  'POSTNL-0009'
427
  );
428
- } elseif (!$shipment) {
429
- $this->addWarning(
430
- array(
431
- 'entity_id' => $shipmentId,
432
- 'code' => 'POSTNL-0009',
433
- 'description' => $this->__(
434
- 'This action is not available for shipment #%s, because it was not shipped using PostNL.',
435
- $shipmentId
436
- ),
437
- )
438
- );
439
-
440
- continue;
441
  }
442
 
443
- $shipments[] = $shipment;
 
 
 
 
 
 
 
 
 
444
  }
445
 
446
  return $shipments;
447
  }
448
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
449
  /**
450
  * Load a shipment based on a shipment ID.
451
  *
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Controller_Adminhtml_Shipment extends Mage_Adminhtml_Controller_Action
48
  */
49
  protected $_warnings = array();
50
 
51
+ /**
52
+ * Error counter used by certain actions.
53
+ *
54
+ * @var int
55
+ */
56
+ protected $_errors = 0;
57
+
58
  /**
59
  * @return array
60
  */
187
  }
188
 
189
  /**
190
+ * Creates a shipment of an order containing all available items.
191
  *
192
+ * @param Mage_Sales_Model_Order|int $order
193
  *
194
  * @return int
195
  *
196
  * @throws TIG_PostNL_Exception
197
  */
198
+ protected function _createShipment($order)
199
  {
200
+ if (is_numeric($order)) {
201
+ $order = Mage::getModel('sales/order')->load($order);
202
+ }
203
+
204
+ if (!is_object($order) || !($order instanceof Mage_Sales_Model_Order)) {
205
+ throw new InvalidArgumentException(
206
+ 'Order must be an instance of Mage_Sales_Model_Order or a valid entity ID.'
207
+ );
208
+ }
209
 
210
  if (!$order->canShip()) {
211
  throw new TIG_PostNL_Exception(
223
  return $shipment->getId();
224
  }
225
 
226
+ /**
227
+ * Create shipments for an array of order IDs
228
+ *
229
+ * @param array $orderIds
230
+ * @param boolean $loadExisting Flag to determine if existing shipments should be loaded. If set to false, an error
231
+ * will be thrown for shipments that have already been shipped.
232
+ *
233
+ * @return array
234
+ */
235
+ protected function _createShipments(array $orderIds, $loadExisting = false)
236
+ {
237
+ $helper = Mage::helper('postnl');
238
+
239
+ /**
240
+ * Load the requested orders. Any orders that weren't shipped using PostNL will be skipped.
241
+ */
242
+ $orders = $this->_loadOrders($orderIds);
243
+ $processedOrderIds = $orders->getColumnValues('entity_id');
244
+
245
+ /**
246
+ * Add a warning for all orders which were skipped because they weren't shipped with PostNL.
247
+ */
248
+ $missingIds = array_diff($orderIds, $processedOrderIds);
249
+ foreach ($missingIds as $missingId) {
250
+ $incrementId = Mage::getResourceModel('sales/order')->getIncrementId($missingId);
251
+ $this->addWarning(
252
+ array(
253
+ 'entity_id' => $incrementId,
254
+ 'code' => 'POSTNL-0009',
255
+ 'description' => $this->__(
256
+ 'This action is not available for order #%s, because it was not placed using PostNL.',
257
+ $incrementId
258
+ ),
259
+ )
260
+ );
261
+ $this->_errors++;
262
+ }
263
+
264
+ /**
265
+ * Create the shipments.
266
+ *
267
+ * @var Mage_Sales_Model_Order $order
268
+ */
269
+ $shipmentIds = array();
270
+ foreach ($orders as $order) {
271
+ try {
272
+ $shipmentIds[] = $this->_createShipment($order);
273
+ } catch (TIG_PostNL_Exception $e) {
274
+ if (!$loadExisting) {
275
+ $helper->logException($e);
276
+ $this->addWarning(
277
+ array(
278
+ 'entity_id' => Mage::getResourceModel('sales/order')->getIncrementId($order->getId()),
279
+ 'code' => $e->getCode(),
280
+ 'description' => $e->getMessage(),
281
+ )
282
+ );
283
+ $this->_errors++;
284
+
285
+ continue;
286
+ }
287
+ /**
288
+ * If any shipments already exist, get their IDs so they can be processed.
289
+ */
290
+ $shipmentCollection = Mage::getResourceModel('sales/order_shipment_collection');
291
+ $shipmentCollection->addFieldToSelect('entity_id')
292
+ ->addFieldToFilter('order_id', $order->getId());
293
+
294
+ if ($shipmentCollection->getSize() > 0) {
295
+ $shipmentIds = array_merge($shipmentCollection->getColumnValues('entity_id'), $shipmentIds);
296
+ } else {
297
+ /**
298
+ * If no shipments exist, add a warning message indicating the process failed for this order.
299
+ */
300
+ $helper->logException($e);
301
+ $this->addWarning(
302
+ array(
303
+ 'entity_id' => Mage::getResourceModel('sales/order')->getIncrementId($order->getId()),
304
+ 'code' => $e->getCode(),
305
+ 'description' => $e->getMessage(),
306
+ )
307
+ );
308
+ $this->_errors++;
309
+ }
310
+ } catch (Exception $e) {
311
+ $helper->logException($e);
312
+ $this->addWarning(
313
+ array(
314
+ 'entity_id' => Mage::getResourceModel('sales/order')->getIncrementId($order->getId()),
315
+ 'code' => null,
316
+ 'description' => $e->getMessage(),
317
+ )
318
+ );
319
+ $this->_errors++;
320
+ }
321
+ }
322
+
323
+ return $shipmentIds;
324
+ }
325
+
326
  /**
327
  * Save shipment and order in one transaction
328
  *
341
  return $this;
342
  }
343
 
344
+ /**
345
+ * Get the output of printing labels for an array of shipments.
346
+ *
347
+ * @param TIG_PostNL_Model_Core_Shipment[] $shipments
348
+ *
349
+ * @return string|false
350
+ *
351
+ * @throws TIG_PostNL_Exception
352
+ */
353
+ protected function _getMassLabelsOutput($shipments)
354
+ {
355
+ $helper = Mage::helper('postnl');
356
+
357
+ /**
358
+ * Get the labels from CIF.
359
+ */
360
+ $labels = array();
361
+ foreach ($shipments as $shipment) {
362
+ try {
363
+ $shipmentLabels = $this->_getLabels($shipment, true);
364
+ $labels = array_merge($labels, $shipmentLabels);
365
+ } catch (TIG_PostNL_Model_Core_Cif_Exception $e) {
366
+ Mage::helper('postnl/cif')->parseCifException($e);
367
+
368
+ $helper->logException($e);
369
+ $this->addWarning(
370
+ array(
371
+ 'entity_id' => $shipment->getShipmentIncrementId(),
372
+ 'code' => $e->getCode(),
373
+ 'description' => $e->getMessage(),
374
+ )
375
+ );
376
+ } catch (TIG_PostNL_Exception $e) {
377
+ $helper->logException($e);
378
+ $this->addWarning(
379
+ array(
380
+ 'entity_id' => $shipment->getShipmentIncrementId(),
381
+ 'code' => $e->getCode(),
382
+ 'description' => $e->getMessage(),
383
+ )
384
+ );
385
+ } catch (Exception $e) {
386
+ $helper->logException($e);
387
+ $this->addWarning(
388
+ array(
389
+ 'entity_id' => $shipment->getShipmentIncrementId(),
390
+ 'code' => null,
391
+ 'description' => $e->getMessage(),
392
+ )
393
+ );
394
+ }
395
+ }
396
+
397
+ if (!$labels) {
398
+ return false;
399
+ }
400
+
401
+ /**
402
+ * The label wills be base64 encoded strings. Convert these to a single pdf.
403
+ */
404
+ $label = Mage::getModel('postnl_core/label');
405
+ $output = $label->createPdf($labels);
406
+
407
+ return $output;
408
+ }
409
+
410
+ /**
411
+ * Get the output of printing packing slips for an array of shipments.
412
+ *
413
+ * @param TIG_PostNL_Model_Core_Shipment[] $shipments
414
+ *
415
+ * @return bool|string
416
+ *
417
+ * @throws Zend_Pdf_Exception
418
+ */
419
+ protected function _getMassPackingSlipsOutput($shipments)
420
+ {
421
+ $helper = Mage::helper('postnl');
422
+
423
+ /**
424
+ * Get the packing slip model.
425
+ */
426
+ $packingSlipModel = Mage::getModel('postnl_core/packingSlip');
427
+
428
+ /**
429
+ * Get the current memory limit as an integer in bytes. Because printing packing slips can be very memory
430
+ * intensive, we need to monitor memory usage.
431
+ */
432
+ $memoryLimit = $helper->getMemoryLimit();
433
+
434
+ /**
435
+ * Create the pdf's and add them to the main pdf object.
436
+ *
437
+ * @var TIG_PostNL_Model_Core_Shipment $shipment
438
+ */
439
+ $pdf = new Zend_Pdf();
440
+ foreach ($shipments as $shipment) {
441
+ try {
442
+ /**
443
+ * If the current memory usage exceeds 75%, end the script. Otherwise we risk other processes being
444
+ * unable to finish and throwing fatal errors.
445
+ */
446
+ $memoryUsage = memory_get_usage(true);
447
+
448
+ if ($memoryUsage / $memoryLimit > 0.75) {
449
+ throw new TIG_PostNL_Exception(
450
+ $this->__(
451
+ 'Approaching memory limit for this operation. Please select fewer shipments and try ' .
452
+ 'again.'
453
+ ),
454
+ 'POSTNL-0170'
455
+ );
456
+ }
457
+
458
+ $shipmentLabels = $this->_getLabels($shipment, true);
459
+ $packingSlipModel->createPdf($shipmentLabels, $shipment, $pdf);
460
+ } catch (TIG_PostNL_Model_Core_Cif_Exception $e) {
461
+ Mage::helper('postnl/cif')->parseCifException($e);
462
+
463
+ $helper->logException($e);
464
+ $this->addWarning(
465
+ array(
466
+ 'entity_id' => $shipment->getShipmentIncrementId(),
467
+ 'code' => $e->getCode(),
468
+ 'description' => $e->getMessage(),
469
+ )
470
+ );
471
+ } catch (TIG_PostNL_Exception $e) {
472
+ $helper->logException($e);
473
+ $this->addWarning(
474
+ array(
475
+ 'entity_id' => $shipment->getShipmentIncrementId(),
476
+ 'code' => $e->getCode(),
477
+ 'description' => $e->getMessage(),
478
+ )
479
+ );
480
+ } catch (Exception $e) {
481
+ $helper->logException($e);
482
+ $this->addWarning(
483
+ array(
484
+ 'entity_id' => $shipment->getShipmentIncrementId(),
485
+ 'code' => null,
486
+ 'description' => $e->getMessage(),
487
+ )
488
+ );
489
+ }
490
+ }
491
+ unset($shipment, $shipments, $shipmentLabels, $packingSlip, $packingSlipModel);
492
+
493
+ if (!$pdf->pages) {
494
+ return false;
495
+ }
496
+
497
+ /**
498
+ * Render the pdf as a string.
499
+ */
500
+ $output = $pdf->render();
501
+ return $output;
502
+ }
503
+
504
  /**
505
  * Retrieves the shipping label for a given shipment ID.
506
  *
567
  $postnlShipment->save();
568
  } else {
569
  /**
570
+ * Generate new shipping labels without confirming.
571
  */
572
  $postnlShipment->generateLabel()
573
  ->save();
680
  $shipmentIds = array($shipmentIds);
681
  }
682
 
683
+ $resource = Mage::getSingleton('core/resource');
684
+ $postnlShippingMethods = Mage::helper('postnl/carrier')->getPostnlShippingMethods();
685
+
686
+ /**
687
+ * This regex will filter all non-postnl shipments.
688
+ */
689
+ $postnlShippingMethodsRegex = '';
690
+ foreach ($postnlShippingMethods as $method) {
691
+ if ($postnlShippingMethodsRegex) {
692
+ $postnlShippingMethodsRegex .= '|';
693
+ } else {
694
+ $postnlShippingMethodsRegex .= '^';
695
+ }
696
+
697
+ $postnlShippingMethodsRegex .= "({$method})(_{0,1}[0-9]*)";
698
+ }
699
+
700
+ $postnlShippingMethodsRegex .= '$';
701
+
702
+ /**
703
+ * Get the requested shipments. Only shipments that have been shipped using PostNL will be returned.
704
+ */
705
+ if ($loadPostnlShipments) {
706
+ $shipments = Mage::getResourceModel('postnl_core/shipment_collection')
707
+ ->addFieldToFilter('shipment_id', array('in' => $shipmentIds))
708
+ ->addFieldToFilter(
709
+ '`order`.`shipping_method`',
710
+ array(
711
+ 'regexp' => $postnlShippingMethodsRegex
712
+ )
713
+ );
714
+
715
+ $shipments->getSelect()->joinInner(
716
+ array('order' => $resource->getTableName('sales/order')),
717
+ '`main_table`.`order_id`=`order`.`entity_id`',
718
+ array(
719
+ 'shipping_method' => 'order.shipping_method',
720
+ )
721
+ );
722
+
723
+ $processedShipmentIds = $shipments->getColumnValues('shipment_id');
724
+ } else {
725
+ $shipments = Mage::getResourceModel('sales/order_shipment_collection')
726
+ ->addFieldToFilter('main_table.entity_id', array('in' => $shipmentIds))
727
+ ->addFieldToFilter(
728
+ '`order`.`shipping_method`',
729
+ array(
730
+ 'regexp' => $postnlShippingMethodsRegex
731
+ )
732
+ );
733
+
734
+ $shipments->getSelect()->joinInner(
735
+ array('order' => $resource->getTableName('sales/order')),
736
+ '`main_table`.`order_id`=`order`.`entity_id`',
737
+ array(
738
+ 'shipping_method' => 'order.shipping_method',
739
+ )
740
+ );
741
+
742
+ $processedShipmentIds = $shipments->getColumnValues('entity_id');
743
+ }
744
+
745
+ /**
746
+ * Check if all requested IDs were processed.
747
+ */
748
+ $missingIds = array_diff($shipmentIds, $processedShipmentIds);
749
+ if (!$missingIds) {
750
+ return $shipments;
751
+ }
752
+
753
+ /**
754
+ * If any requested shipments were not found, it's because they were not shipped using PostNL.
755
+ */
756
+ $adapter = Mage::getSingleton('core/resource')->getConnection('core_read');
757
+ foreach ($missingIds as $shipmentId) {
758
  /**
759
+ * Get the shipment's increment ID. We need this, because many merchants do not know the difference between
760
+ * increment IDs and entity IDs.
 
761
  */
762
+ $bind = array(':entity_id' => $shipmentId);
763
+ $select = $adapter->select()
764
+ ->from($resource->getTableName('sales/shipment'), array("increment_id"))
765
+ ->where('entity_id = :entity_id');
766
+
767
+ $shipmentIncrementId = $adapter->fetchOne($select, $bind);
768
 
769
+ if ($throwException) {
770
  throw new TIG_PostNL_Exception(
771
  $this->__(
772
  'This action is not available for shipment #%s, because it was not shipped using PostNL.',
773
+ $shipmentIncrementId
774
  ),
775
  'POSTNL-0009'
776
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
777
  }
778
 
779
+ $this->addWarning(
780
+ array(
781
+ 'entity_id' => $shipmentIncrementId,
782
+ 'code' => 'POSTNL-0009',
783
+ 'description' => $this->__(
784
+ 'This action is not available for shipment #%s, because it was not shipped using PostNL.',
785
+ $shipmentIncrementId
786
+ ),
787
+ )
788
+ );
789
  }
790
 
791
  return $shipments;
792
  }
793
 
794
+ /**
795
+ * Load an order collection based on an array of order IDs. Non-PostNL orders will be skipped.
796
+ *
797
+ * @param array|int $orderIds
798
+ *
799
+ * @return Mage_Sales_Model_Resource_Order_Collection
800
+ */
801
+ protected function _loadOrders($orderIds)
802
+ {
803
+ if (!is_array($orderIds)) {
804
+ $orderIds = array($orderIds);
805
+ }
806
+
807
+ $postnlShippingMethods = Mage::helper('postnl/carrier')->getPostnlShippingMethods();
808
+
809
+ /**
810
+ * This regex will filter all non-postnl shipments.
811
+ */
812
+ $postnlShippingMethodsRegex = '';
813
+ foreach ($postnlShippingMethods as $method) {
814
+ if ($postnlShippingMethodsRegex) {
815
+ $postnlShippingMethodsRegex .= '|';
816
+ } else {
817
+ $postnlShippingMethodsRegex .= '^';
818
+ }
819
+
820
+ $postnlShippingMethodsRegex .= "({$method})(_{0,1}[0-9]*)";
821
+ }
822
+
823
+ $postnlShippingMethodsRegex .= '$';
824
+
825
+ $orders = Mage::getResourceModel('sales/order_collection')
826
+ ->addFieldToFilter('entity_id', array('in' => $orderIds))
827
+ ->addFieldToFilter('shipping_method', array('regexp' => $postnlShippingMethodsRegex));
828
+
829
+ return $orders;
830
+ }
831
+
832
  /**
833
  * Load a shipment based on a shipment ID.
834
  *
app/code/community/TIG/PostNL/Exception.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * General exception class for TIG_PostNL extension
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * General exception class for TIG_PostNL extension
app/code/community/TIG/PostNL/Helper/AddressValidation.php CHANGED
@@ -25,44 +25,45 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Helper_AddressValidation extends TIG_PostNL_Helper_Data
40
  {
41
  /**
42
- * XML path to use_postcode_check setting
43
  */
44
- const XPATH_USE_POSTCODE_CHECK = 'postnl/cif_address/use_postcode_check';
 
45
 
46
  /**
47
- * Constants containing XML paths to cif address configuration options
48
  */
49
- const XPATH_SPLIT_STREET = 'postnl/cif_address/split_street';
50
- const XPATH_STREETNAME_FIELD = 'postnl/cif_address/streetname_field';
51
- const XPATH_HOUSENUMBER_FIELD = 'postnl/cif_address/housenr_field';
52
- const XPATH_SPLIT_HOUSENUMBER = 'postnl/cif_address/split_housenr';
53
- const XPATH_HOUSENUMBER_EXTENSION_FIELD = 'postnl/cif_address/housenr_extension_field';
54
 
55
  /**
56
- * XML paths to flags that determine which environment allows the postcode check functionality
57
  */
58
- const XPATH_POSTCODE_CHECK_IN_CHECKOUT = 'postnl/cif_address/postcode_check_in_checkout';
59
- const XPATH_POSTCODE_CHECK_IN_ADDRESSBOOK = 'postnl/cif_address/postcode_check_in_addressbook';
60
 
61
  /**
62
- * XML paths that control some features of postcode check
63
  */
64
- const XPATH_POSTCODE_CHECK_MAX_ATTEMPTS = 'postnl/cif_address/postcode_check_max_attempts';
65
- const XPATH_POSTCODE_CHECK_TIMEOUT = 'postnl/cif_address/postcode_check_timeout';
66
 
67
  /**
68
  * Xpath to OSC street fields sort order.
@@ -70,15 +71,22 @@ class TIG_PostNL_Helper_AddressValidation extends TIG_PostNL_Helper_Data
70
  const XPATH_STREET_FIELD_SORT_ORDER = 'onestepcheckout/sortordering_fields/street';
71
 
72
  /**
73
- * Log filename to log all cendris exceptions
74
  */
75
  const CENDRIS_EXCEPTION_LOG_FILE = 'TIG_PostNL_Cendris_Exception.log';
76
 
77
  /**
78
- * Log filename to log cendris calls
79
  */
80
  const CENDRIS_DEBUG_LOG_FILE = 'TIG_PostNL_Cendris_Debug.log';
81
 
 
 
 
 
 
 
 
82
  /**
83
  * @var null|string|int
84
  */
@@ -158,7 +166,7 @@ class TIG_PostNL_Helper_AddressValidation extends TIG_PostNL_Helper_Data
158
  }
159
 
160
  if ($this->isPostcodeCheckEnabled($storeId)) {
161
- return 1;
162
  }
163
 
164
  $streetnameField = (int) Mage::getStoreConfig(self::XPATH_STREETNAME_FIELD, $storeId);
@@ -180,7 +188,7 @@ class TIG_PostNL_Helper_AddressValidation extends TIG_PostNL_Helper_Data
180
  }
181
 
182
  if ($this->isPostcodeCheckEnabled($storeId)) {
183
- return 2;
184
  }
185
 
186
  $housenumberField = (int) Mage::getStoreConfig(self::XPATH_HOUSENUMBER_FIELD, $storeId);
@@ -201,7 +209,7 @@ class TIG_PostNL_Helper_AddressValidation extends TIG_PostNL_Helper_Data
201
  }
202
 
203
  if ($this->isPostcodeCheckEnabled($storeId)) {
204
- return 3;
205
  }
206
 
207
  $housenumberExtensionField = (int) Mage::getStoreConfig(self::XPATH_HOUSENUMBER_EXTENSION_FIELD, $storeId);
@@ -277,6 +285,11 @@ class TIG_PostNL_Helper_AddressValidation extends TIG_PostNL_Helper_Data
277
  $storeId = Mage::app()->getStore()->getId();
278
  }
279
 
 
 
 
 
 
280
  $usePostcodeCheck = Mage::getStoreConfigFlag(self::XPATH_USE_POSTCODE_CHECK, $storeId);
281
  return $usePostcodeCheck;
282
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Helper_AddressValidation extends TIG_PostNL_Helper_Data
40
  {
41
  /**
42
+ * XML paths used to check if postcode check is activated.
43
  */
44
+ const XPATH_CHECKOUT_EXTENSION = 'postnl/cif_labels_and_confirming/checkout_extension';
45
+ const XPATH_USE_POSTCODE_CHECK = 'postnl/cif_labels_and_confirming/use_postcode_check';
46
 
47
  /**
48
+ * Constants containing XML paths to cif address configuration options.
49
  */
50
+ const XPATH_SPLIT_STREET = 'postnl/cif_labels_and_confirming/split_street';
51
+ const XPATH_STREETNAME_FIELD = 'postnl/cif_labels_and_confirming/streetname_field';
52
+ const XPATH_HOUSENUMBER_FIELD = 'postnl/cif_labels_and_confirming/housenr_field';
53
+ const XPATH_SPLIT_HOUSENUMBER = 'postnl/cif_labels_and_confirming/split_housenr';
54
+ const XPATH_HOUSENUMBER_EXTENSION_FIELD = 'postnl/cif_labels_and_confirming/housenr_extension_field';
55
 
56
  /**
57
+ * XML paths to flags that determine which environment allows the postcode check functionality.
58
  */
59
+ const XPATH_POSTCODE_CHECK_IN_CHECKOUT = 'postnl/cif_labels_and_confirming/postcode_check_in_checkout';
60
+ const XPATH_POSTCODE_CHECK_IN_ADDRESSBOOK = 'postnl/cif_labels_and_confirming/postcode_check_in_addressbook';
61
 
62
  /**
63
+ * XML paths that control some features of postcode check.
64
  */
65
+ const XPATH_POSTCODE_CHECK_MAX_ATTEMPTS = 'postnl/cif_labels_and_confirming/postcode_check_max_attempts';
66
+ const XPATH_POSTCODE_CHECK_TIMEOUT = 'postnl/cif_labels_and_confirming/postcode_check_timeout';
67
 
68
  /**
69
  * Xpath to OSC street fields sort order.
71
  const XPATH_STREET_FIELD_SORT_ORDER = 'onestepcheckout/sortordering_fields/street';
72
 
73
  /**
74
+ * Log filename to log all cendris exceptions.
75
  */
76
  const CENDRIS_EXCEPTION_LOG_FILE = 'TIG_PostNL_Cendris_Exception.log';
77
 
78
  /**
79
+ * Log filename to log cendris calls.
80
  */
81
  const CENDRIS_DEBUG_LOG_FILE = 'TIG_PostNL_Cendris_Debug.log';
82
 
83
+ /**
84
+ * Street lines used by postcode check.
85
+ */
86
+ const POSTCODE_CHECK_STREETNAME_FIELD = 1;
87
+ const POSTCODE_CHECK_HOUSE_NUMBER_FIELD = 2;
88
+ const POSTCODE_CHECK_HOUSE_NUMBER_EXTENSION_FIELD = 3;
89
+
90
  /**
91
  * @var null|string|int
92
  */
166
  }
167
 
168
  if ($this->isPostcodeCheckEnabled($storeId)) {
169
+ return self::POSTCODE_CHECK_STREETNAME_FIELD;
170
  }
171
 
172
  $streetnameField = (int) Mage::getStoreConfig(self::XPATH_STREETNAME_FIELD, $storeId);
188
  }
189
 
190
  if ($this->isPostcodeCheckEnabled($storeId)) {
191
+ return self::POSTCODE_CHECK_HOUSE_NUMBER_FIELD;
192
  }
193
 
194
  $housenumberField = (int) Mage::getStoreConfig(self::XPATH_HOUSENUMBER_FIELD, $storeId);
209
  }
210
 
211
  if ($this->isPostcodeCheckEnabled($storeId)) {
212
+ return self::POSTCODE_CHECK_HOUSE_NUMBER_EXTENSION_FIELD;
213
  }
214
 
215
  $housenumberExtensionField = (int) Mage::getStoreConfig(self::XPATH_HOUSENUMBER_EXTENSION_FIELD, $storeId);
285
  $storeId = Mage::app()->getStore()->getId();
286
  }
287
 
288
+ $checkoutExtension = Mage::getStoreConfig(self::XPATH_CHECKOUT_EXTENSION, $storeId);
289
+ if (!$checkoutExtension || $checkoutExtension == 'other') {
290
+ return false;
291
+ }
292
+
293
  $usePostcodeCheck = Mage::getStoreConfigFlag(self::XPATH_USE_POSTCODE_CHECK, $storeId);
294
  return $usePostcodeCheck;
295
  }
app/code/community/TIG/PostNL/Helper/Carrier.php CHANGED
@@ -25,41 +25,39 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Helper_Carrier extends TIG_PostNL_Helper_Data
40
  {
41
  /**
42
- * Shipping carrier code used by PostNL
43
  */
44
  const POSTNL_CARRIER = 'postnl';
45
 
46
  /**
47
- * PostNL shipping methods
48
  */
49
  const POSTNL_FLATRATE_METHOD = 'flatrate';
50
  const POSTNL_TABLERATE_METHOD = 'tablerate';
 
51
 
52
  /**
53
- * Localised track and trace base URL's
54
  */
55
- const POSTNL_TRACK_AND_TRACE_NL_BASE_URL = 'https://mijnpakket.postnl.nl/Inbox/Search?';
56
- const POSTNL_TRACK_AND_TRACE_GB_BASE_URL = 'http://parcels-uk.tntpost.com/mytrackandtrace/trackandtrace.aspx?';
57
- const POSTNL_TRACK_AND_TRACE_DE_BASE_URL = 'http://parcels-de.tntpost.com/de/mytrackandtrace/TrackAndTrace.aspx?';
58
- const POSTNL_TRACK_AND_TRACE_FR_BASE_URL = 'http://parcels-fr.tntpost.com/fr/mytrackandtrace/TrackAndTrace.aspx?';
59
- const POSTNL_TRACK_AND_TRACE_INT_BASE_URL = 'http://www.postnlpakketten.nl/klantenservice/tracktrace/basicsearch.aspx?';
60
 
61
  /**
62
- * XML path to rate type setting
63
  */
64
  const XPATH_RATE_TYPE = 'carriers/postnl/rate_type';
65
 
@@ -69,7 +67,7 @@ class TIG_PostNL_Helper_Carrier extends TIG_PostNL_Helper_Data
69
  const XPATH_POSTNL_SHIPPING_METHODS = 'postnl/advanced/postnl_shipping_methods';
70
 
71
  /**
72
- * Array of possible PostNL shipping methods
73
  *
74
  * @var array
75
  */
@@ -83,7 +81,7 @@ class TIG_PostNL_Helper_Carrier extends TIG_PostNL_Helper_Data
83
  protected $_matchedMethods = array();
84
 
85
  /**
86
- * Gets an array of possible PostNL shipping methods
87
  *
88
  * @return array
89
  */
@@ -93,9 +91,21 @@ class TIG_PostNL_Helper_Carrier extends TIG_PostNL_Helper_Data
93
  return $this->_postnlShippingMethods;
94
  }
95
 
 
 
 
 
 
 
 
 
96
  $shippingMethods = Mage::getStoreConfig(self::XPATH_POSTNL_SHIPPING_METHODS, Mage::app()->getStore()->getId());
97
  $shippingMethods = explode(',', $shippingMethods);
98
 
 
 
 
 
99
  $this->setPostnlShippingMethods($shippingMethods);
100
  return $shippingMethods;
101
  }
@@ -117,6 +127,18 @@ class TIG_PostNL_Helper_Carrier extends TIG_PostNL_Helper_Data
117
  */
118
  public function getMatchedMethods()
119
  {
 
 
 
 
 
 
 
 
 
 
 
 
120
  return $this->_matchedMethods;
121
  }
122
 
@@ -129,6 +151,11 @@ class TIG_PostNL_Helper_Carrier extends TIG_PostNL_Helper_Data
129
  {
130
  $this->_matchedMethods = $matchedMethods;
131
 
 
 
 
 
 
132
  return $this;
133
  }
134
 
@@ -191,6 +218,9 @@ class TIG_PostNL_Helper_Carrier extends TIG_PostNL_Helper_Data
191
  case 'table':
192
  $shippingMethod = $carrier . '_' . self::POSTNL_TABLERATE_METHOD;
193
  break;
 
 
 
194
  default:
195
  throw new TIG_PostNL_Exception(
196
  $this->__('Invalid rate type requested: %s', $rateType),
@@ -202,6 +232,99 @@ class TIG_PostNL_Helper_Carrier extends TIG_PostNL_Helper_Data
202
  return $shippingMethod;
203
  }
204
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
  /**
206
  * Checks if a specified shipping method is a PostNL shipping method.
207
  *
@@ -245,27 +368,36 @@ class TIG_PostNL_Helper_Carrier extends TIG_PostNL_Helper_Data
245
  }
246
 
247
  /**
248
- * Constructs a PostNL track & trace url based on a barcode and the destination of the package (country and zipcode)
 
249
  *
250
- * @param string $barcode
251
- * @param mixed $destination An array or object containing the shipment's destination data
252
- * @param boolean | string $lang
253
- * @param boolean $forceNl
254
  *
255
  * @return string
256
  */
257
- public function getBarcodeUrl($barcode, $destination = false, $lang = false, $forceNl = false)
258
  {
259
  $countryCode = null;
260
  $postcode = null;
261
  if (is_array($destination)) {
 
 
 
 
262
  $countryCode = $destination['countryCode'];
263
  $postcode = $destination['postcode'];
264
- }
 
 
 
265
 
266
- if (is_object($destination) && $destination instanceof Varien_Object) {
267
  $countryCode = $destination->getCountry();
268
  $postcode = str_replace(' ', '', $destination->getPostcode());
 
 
269
  }
270
 
271
  /**
@@ -276,7 +408,7 @@ class TIG_PostNL_Helper_Carrier extends TIG_PostNL_Helper_Data
276
  && $countryCode == 'NL'
277
  )
278
  ) {
279
- $barcodeUrl = self::POSTNL_TRACK_AND_TRACE_NL_BASE_URL
280
  . '&b=' . $barcode;
281
  /**
282
  * For dutch shipments add the postcode. For international shipments add an 'international' flag
@@ -293,54 +425,13 @@ class TIG_PostNL_Helper_Carrier extends TIG_PostNL_Helper_Data
293
  return $barcodeUrl;
294
  }
295
 
296
- /**
297
- * Get localized track & trace URLs for UK, DE and FR shipments
298
- */
299
- if (isset($countryCode)
300
- && ($countryCode == 'UK'
301
- || $countryCode == 'GB'
302
- )
303
- ) {
304
- $barcodeUrl = self::POSTNL_TRACK_AND_TRACE_GB_BASE_URL
305
- . '&B=' . $barcode
306
- . '&D=GB'
307
- . '&lang=en';
308
-
309
- return $barcodeUrl;
310
- }
311
-
312
- if (isset($countryCode) && $countryCode == 'DE') {
313
- $barcodeUrl = self::POSTNL_TRACK_AND_TRACE_DE_BASE_URL
314
- . '&B=' . $barcode
315
- . '&D=DE'
316
- . '&lang=de';
317
-
318
- return $barcodeUrl;
319
- }
320
-
321
- if (isset($countryCode) && $countryCode == 'FR') {
322
- $barcodeUrl = self::POSTNL_TRACK_AND_TRACE_FR_BASE_URL
323
- . '&B=' . $barcode
324
- . '&D=FR'
325
- . '&lang=fr';
326
-
327
- return $barcodeUrl;
328
- }
329
-
330
  /**
331
  * Get a general track & trace URL for all other destinations
332
  */
333
- $barcodeUrl = self::POSTNL_TRACK_AND_TRACE_INT_BASE_URL
334
- . '&B=' . $barcode
335
- . '&I=true';
336
-
337
- if ($lang) {
338
- $barcodeUrl .= '&lang=' . strtolower($lang);
339
- }
340
-
341
- if ($countryCode) {
342
- $barcodeUrl .= '&D=' . $countryCode;
343
- }
344
 
345
  return $barcodeUrl;
346
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Helper_Carrier extends TIG_PostNL_Helper_Data
40
  {
41
  /**
42
+ * Shipping carrier code used by PostNL.
43
  */
44
  const POSTNL_CARRIER = 'postnl';
45
 
46
  /**
47
+ * PostNL shipping methods.
48
  */
49
  const POSTNL_FLATRATE_METHOD = 'flatrate';
50
  const POSTNL_TABLERATE_METHOD = 'tablerate';
51
+ const POSTNL_MATRIX_METHOD = 'matrixrate';
52
 
53
  /**
54
+ * Localised track and trace base URL's.
55
  */
56
+ const POSTNL_TRACK_AND_TRACE_NL_BASE_URL_XPATH = 'postnl/cif/track_and_trace_nl_base_url';
57
+ const POSTNL_TRACK_AND_TRACE_INT_BASE_URL_XPATH = 'postnl/cif/track_and_trace_int_base_url';
 
 
 
58
 
59
  /**
60
+ * XML path to rate type setting.
61
  */
62
  const XPATH_RATE_TYPE = 'carriers/postnl/rate_type';
63
 
67
  const XPATH_POSTNL_SHIPPING_METHODS = 'postnl/advanced/postnl_shipping_methods';
68
 
69
  /**
70
+ * Array of possible PostNL shipping methods.
71
  *
72
  * @var array
73
  */
81
  protected $_matchedMethods = array();
82
 
83
  /**
84
+ * Gets an array of possible PostNL shipping methods.
85
  *
86
  * @return array
87
  */
91
  return $this->_postnlShippingMethods;
92
  }
93
 
94
+ $cache = $this->getCache();
95
+ if ($cache && $cache->hasPostnlShippingMethods()) {
96
+ $shippingMethods = $cache->getPostnlShippingMethods();
97
+
98
+ $this->setPostnlShippingMethods($shippingMethods);
99
+ return $shippingMethods;
100
+ }
101
+
102
  $shippingMethods = Mage::getStoreConfig(self::XPATH_POSTNL_SHIPPING_METHODS, Mage::app()->getStore()->getId());
103
  $shippingMethods = explode(',', $shippingMethods);
104
 
105
+ if ($cache) {
106
+ $cache->setPostnlShippingMethods($shippingMethods);
107
+ }
108
+
109
  $this->setPostnlShippingMethods($shippingMethods);
110
  return $shippingMethods;
111
  }
127
  */
128
  public function getMatchedMethods()
129
  {
130
+ $matchedMethods = $this->_matchedMethods;
131
+ if (!empty($matchedMethods)) {
132
+ return $matchedMethods;
133
+ }
134
+
135
+ $cache = $this->getCache();
136
+ if ($cache && $cache->hasMatchedPostnlShippingMethods()) {
137
+ $this->setMatchedMethods(
138
+ $cache->getMatchedPostnlShippingMethods()
139
+ );
140
+ }
141
+
142
  return $this->_matchedMethods;
143
  }
144
 
151
  {
152
  $this->_matchedMethods = $matchedMethods;
153
 
154
+ $cache = $this->getCache();
155
+ if ($cache) {
156
+ $cache->setMatchedPostnlShippingMethods($matchedMethods);
157
+ }
158
+
159
  return $this;
160
  }
161
 
218
  case 'table':
219
  $shippingMethod = $carrier . '_' . self::POSTNL_TABLERATE_METHOD;
220
  break;
221
+ case 'matrix':
222
+ $shippingMethod = $carrier . '_' . self::POSTNL_MATRIX_METHOD;
223
+ break;
224
  default:
225
  throw new TIG_PostNL_Exception(
226
  $this->__('Invalid rate type requested: %s', $rateType),
232
  return $shippingMethod;
233
  }
234
 
235
+ /**
236
+ * Get a shipping rate for a parcel only.
237
+ *
238
+ * @param Mage_Sales_Model_Quote $quote
239
+ *
240
+ * @return Mage_Shipping_Model_Rate_Result|false
241
+ */
242
+ public function getParcelShippingRate(Mage_Sales_Model_Quote $quote)
243
+ {
244
+ $registryKey = 'postnl_parcel_shipping_rate_quote_id_' . $quote->getId();
245
+ if (Mage::registry($registryKey) !== null) {
246
+ return Mage::registry($registryKey);
247
+ }
248
+
249
+ $shippingAddress = $quote->getShippingAddress();
250
+ if (!$shippingAddress) {
251
+ Mage::register($registryKey, false);
252
+ return false;
253
+ }
254
+
255
+ $store = $quote->getStore();
256
+
257
+ /** @var $request Mage_Shipping_Model_Rate_Request */
258
+ $request = Mage::getModel('shipping/rate_request');
259
+ $request->setAllItems($shippingAddress->getAllItems());
260
+ $request->setDestCountryId($shippingAddress->getCountryId());
261
+ $request->setDestRegionId($shippingAddress->getRegionId());
262
+ $request->setDestRegionCode($shippingAddress->getRegionCode());
263
+
264
+ /**
265
+ * need to call getStreet with -1
266
+ * to get data in string instead of array
267
+ */
268
+ $request->setDestStreet($shippingAddress->getStreet($shippingAddress::DEFAULT_DEST_STREET));
269
+ $request->setDestCity($shippingAddress->getCity());
270
+ $request->setDestPostcode($shippingAddress->getPostcode());
271
+ $request->setPackageValue($shippingAddress->getBaseSubtotal());
272
+ $packageValueWithDiscount = $shippingAddress->getBaseSubtotalWithDiscount();
273
+ $request->setPackageValueWithDiscount($packageValueWithDiscount);
274
+ $request->setPackageWeight($shippingAddress->getWeight());
275
+ $request->setPackageQty($shippingAddress->getItemQty());
276
+
277
+ /**
278
+ * Need for shipping methods that use insurance based on price of physical products
279
+ */
280
+ $packagePhysicalValue = $shippingAddress->getBaseVirtualAmount();
281
+ $request->setPackagePhysicalValue($packagePhysicalValue);
282
+
283
+ $request->setFreeMethodWeight($shippingAddress->getFreeMethodWeight());
284
+
285
+ $request->setStoreId($store->getId());
286
+ $request->setWebsiteId($store->getWebsiteId());
287
+ $request->setFreeShipping($shippingAddress->getFreeShipping());
288
+ /**
289
+ * Currencies need to convert in free shipping
290
+ */
291
+ $request->setBaseCurrency($store->getBaseCurrency());
292
+ $request->setPackageCurrency($store->getCurrentCurrency());
293
+ $request->setLimitCarrier($shippingAddress->getLimitCarrier());
294
+
295
+ $request->setBaseSubtotalInclTax(
296
+ $shippingAddress->getBaseSubtotalInclTax() + $shippingAddress->getBaseExtraTaxAmount()
297
+ );
298
+ $request->setParcelType('regular');
299
+
300
+ $rawResult = Mage::getResourceModel('postnl_carrier/matrixrate')->getRate($request);
301
+ if (!$rawResult) {
302
+ Mage::register($registryKey, false);
303
+ return false;
304
+ }
305
+
306
+ /**
307
+ * Convert the raw result from the database to a shipping rate result object.
308
+ */
309
+ $carrier = Mage::getModel('postnl_carrier/postnl');
310
+ $result = Mage::getModel('shipping/rate_result');
311
+ $method = Mage::getModel('shipping/rate_result_method');
312
+
313
+ $method->setCarrier('postnl');
314
+ $method->setCarrierTitle($carrier->getConfigData('title'));
315
+
316
+ $method->setMethod('flatrate');
317
+ $method->setMethodTitle($carrier->getConfigData('name'));
318
+
319
+ $method->setPrice($rawResult['price']);
320
+ $method->setCost(0);
321
+
322
+ $result->append($method);
323
+
324
+ Mage::register($registryKey, $result);
325
+ return $result;
326
+ }
327
+
328
  /**
329
  * Checks if a specified shipping method is a PostNL shipping method.
330
  *
368
  }
369
 
370
  /**
371
+ * Constructs a PostNL track & trace url based on a barcode and the destination of the package (country and
372
+ * zipcode).
373
  *
374
+ * @param string $barcode
375
+ * @param array|Varien_Object $destination An array or object containing the shipment's destination data.
376
+ * @param boolean|string $lang This parameter is no longer used as of v1.4.1.
377
+ * @param boolean $forceNl
378
  *
379
  * @return string
380
  */
381
+ public function getBarcodeUrl($barcode, $destination, $lang = null, $forceNl = false)
382
  {
383
  $countryCode = null;
384
  $postcode = null;
385
  if (is_array($destination)) {
386
+ if (!isset($destination['countryCode']) || !isset($destination['postcode'])) {
387
+ throw new InvalidArgumentException("Destination must contain the 'countryCode' and 'postcode' keys.");
388
+ }
389
+
390
  $countryCode = $destination['countryCode'];
391
  $postcode = $destination['postcode'];
392
+ } elseif (is_object($destination) && $destination instanceof Varien_Object) {
393
+ if (!$destination->getCountry() || !$destination->getPostcode()) {
394
+ throw new InvalidArgumentException('Destination must have a country and a postcode.');
395
+ }
396
 
 
397
  $countryCode = $destination->getCountry();
398
  $postcode = str_replace(' ', '', $destination->getPostcode());
399
+ } else {
400
+ throw new InvalidArgumentException('Destination must be an array or an instance of Varien_Object.');
401
  }
402
 
403
  /**
408
  && $countryCode == 'NL'
409
  )
410
  ) {
411
+ $barcodeUrl = Mage::getStoreConfig(self::POSTNL_TRACK_AND_TRACE_NL_BASE_URL_XPATH)
412
  . '&b=' . $barcode;
413
  /**
414
  * For dutch shipments add the postcode. For international shipments add an 'international' flag
425
  return $barcodeUrl;
426
  }
427
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
428
  /**
429
  * Get a general track & trace URL for all other destinations
430
  */
431
+ $barcodeUrl = Mage::getStoreConfig(self::POSTNL_TRACK_AND_TRACE_INT_BASE_URL_XPATH)
432
+ . '/' . $barcode
433
+ . '/' . $countryCode
434
+ . '/' . $postcode;
 
 
 
 
 
 
 
435
 
436
  return $barcodeUrl;
437
  }
app/code/community/TIG/PostNL/Helper/Checkout.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
@@ -49,11 +49,6 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
49
  */
50
  const XPATH_CHECKOUT_PAYMENT_METHOD = 'postnl/checkout_payment_methods';
51
 
52
- /**
53
- * XML path to test / live mode setting
54
- */
55
- const XPATH_TEST_MODE = 'postnl/cif/mode';
56
-
57
  /**
58
  * XML path for config options used to determine whether or not PostNL Checkout is available
59
  */
@@ -264,28 +259,26 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
264
  $storeId = $quote->getStoreId();
265
 
266
  /**
267
- * Check if PostNL Checkout may be used for 'letter' orders and if not, if the quote could fit in an envelope
268
  */
269
- $showCheckoutForLetters = Mage::getStoreConfigFlag(self::XPATH_SHOW_CHECKOUT_FOR_LETTER, $storeId);
270
- if (!$showCheckoutForLetters) {
271
- $isLetterQuote = $this->quoteIsLetter($quote, $storeId);
272
- if ($isLetterQuote) {
273
- $errors = array(
274
- array(
275
- 'code' => 'POSTNL-0101',
276
- 'message' => $this->__(
277
- "The quote's total weight is below the miniumum required to use PostNL Checkout."
278
- ),
279
- )
280
- );
281
- Mage::register('postnl_checkout_is_enabled_errors', $errors);
282
- Mage::register('can_use_postnl_checkout', false);
283
- return false;
284
- }
285
  }
286
 
287
  /**
288
- * Check if PostNL Checkout may be used for out-og-stock orders and if not, whether the quote has any such products
 
289
  */
290
  $showCheckoutForBackorders = Mage::getStoreConfigFlag(self::XPATH_SHOW_CHECKOUT_FOR_BACKORDERS, $storeId);
291
  if (!$showCheckoutForBackorders) {
@@ -334,7 +327,7 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
334
  *
335
  * @return boolean
336
  *
337
- * @todo Expand this method to also check the size of products to see if they fit in an envelope
338
  */
339
  public function quoteIsLetter($quoteItems, $storeId = null)
340
  {
@@ -349,12 +342,12 @@ class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
349
  $totalWeight = 0;
350
  /** @var Mage_Sales_Model_Quote_Item $item */
351
  foreach ($quoteItems as $item) {
352
- $totalWeight += $item->getRowWeight();
353
  }
354
 
355
  $kilograms = $this->standardizeWeight($totalWeight, $storeId);
356
 
357
- if ($kilograms < 2) {
358
  return true;
359
  }
360
 
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Helper_Checkout extends TIG_PostNL_Helper_Data
49
  */
50
  const XPATH_CHECKOUT_PAYMENT_METHOD = 'postnl/checkout_payment_methods';
51
 
 
 
 
 
 
52
  /**
53
  * XML path for config options used to determine whether or not PostNL Checkout is available
54
  */
259
  $storeId = $quote->getStoreId();
260
 
261
  /**
262
+ * Check if the quote is a letter box parcel.
263
  */
264
+ $isLetterQuote = $this->quoteIsBuspakje($quote);
265
+ if ($isLetterQuote) {
266
+ $errors = array(
267
+ array(
268
+ 'code' => 'POSTNL-0101',
269
+ 'message' => $this->__(
270
+ "The quote fits as a letter box parcel."
271
+ ),
272
+ )
273
+ );
274
+ Mage::register('postnl_checkout_is_enabled_errors', $errors);
275
+ Mage::register('can_use_postnl_checkout', false);
276
+ return false;
 
 
 
277
  }
278
 
279
  /**
280
+ * Check if PostNL Checkout may be used for out-og-stock orders and if not, whether the quote has any such
281
+ * products.
282
  */
283
  $showCheckoutForBackorders = Mage::getStoreConfigFlag(self::XPATH_SHOW_CHECKOUT_FOR_BACKORDERS, $storeId);
284
  if (!$showCheckoutForBackorders) {
327
  *
328
  * @return boolean
329
  *
330
+ * @deprecated 1.3.2 This method has been replaced by TIG_PostNL_Helper_Data::isBuspakjeConfigApplicableToQuote()
331
  */
332
  public function quoteIsLetter($quoteItems, $storeId = null)
333
  {
342
  $totalWeight = 0;
343
  /** @var Mage_Sales_Model_Quote_Item $item */
344
  foreach ($quoteItems as $item) {
345
+ $totalWeight += ($item->getWeight() * $item->getQty());
346
  }
347
 
348
  $kilograms = $this->standardizeWeight($totalWeight, $storeId);
349
 
350
+ if ($kilograms < self::MAX_LETTER_BOX_PARCEL_WEIGHT) {
351
  return true;
352
  }
353
 
app/code/community/TIG/PostNL/Helper/Cif.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
 
@@ -67,12 +67,12 @@ class TIG_PostNL_Helper_Cif extends TIG_PostNL_Helper_Data
67
  /**
68
  * XML path to weight per parcel config setting
69
  */
70
- const XPATH_WEIGHT_PER_PARCEL = 'postnl/cif_labels_and_confirming/weight_per_parcel';
71
 
72
  /**
73
  * XML paths to default product options settings
74
  */
75
- const XPATH_DEFAULT_STANDARD_PRODUCT_OPTION = 'postnl/cif_product_options/default_product_option';
76
  const XPATH_DEFAULT_EU_PRODUCT_OPTION = 'postnl/cif_product_options/default_eu_product_option';
77
  const XPATH_DEFAULT_GLOBAL_PRODUCT_OPTION = 'postnl/cif_product_options/default_global_product_option';
78
  const XPATH_DEFAULT_PAKKETAUTOMAAT_PRODUCT_OPTION = 'postnl/cif_product_options/default_pakketautomaat_product_option';
@@ -1067,6 +1067,19 @@ class TIG_PostNL_Helper_Cif extends TIG_PostNL_Helper_Data
1067
  return $housenumberParts;
1068
  }
1069
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1070
  /**
1071
  * Parses a CIF exception. If the last error number is a known error, we replace the message and code with our own.
1072
  *
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
 
67
  /**
68
  * XML path to weight per parcel config setting
69
  */
70
+ const XPATH_WEIGHT_PER_PARCEL = 'postnl/packing_slip/weight_per_parcel';
71
 
72
  /**
73
  * XML paths to default product options settings
74
  */
75
+ const XPATH_DEFAULT_STANDARD_PRODUCT_OPTION = 'postnl/grid/default_product_option';
76
  const XPATH_DEFAULT_EU_PRODUCT_OPTION = 'postnl/cif_product_options/default_eu_product_option';
77
  const XPATH_DEFAULT_GLOBAL_PRODUCT_OPTION = 'postnl/cif_product_options/default_global_product_option';
78
  const XPATH_DEFAULT_PAKKETAUTOMAAT_PRODUCT_OPTION = 'postnl/cif_product_options/default_pakketautomaat_product_option';
1067
  return $housenumberParts;
1068
  }
1069
 
1070
+ /**
1071
+ * Strips non-printable ASCII characters from a string.
1072
+ *
1073
+ * @param string &$string
1074
+ */
1075
+ public function stripNonPrintableCharacters(&$string)
1076
+ {
1077
+ /**
1078
+ * Remove the first 32 ASCII characters.
1079
+ */
1080
+ $string = preg_replace('/[\x00-\x1f]/', '', $string);
1081
+ }
1082
+
1083
  /**
1084
  * Parses a CIF exception. If the last error number is a known error, we replace the message and code with our own.
1085
  *
app/code/community/TIG/PostNL/Helper/Data.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Helper_Data extends Mage_Core_Helper_Abstract
@@ -59,19 +59,9 @@ class TIG_PostNL_Helper_Data extends Mage_Core_Helper_Abstract
59
  const POSTNL_CRON_DEBUG_LOG_FILE = 'TIG_PostNL_Cron_Debug.log';
60
 
61
  /**
62
- * XML path to postnl general active/inactive setting.
63
  */
64
- const XPATH_EXTENSION_ACTIVE = 'postnl/general/active';
65
-
66
- /**
67
- * XML path to test/live mode config option.
68
- */
69
- const XPATH_TEST_MODE = 'postnl/cif/mode';
70
-
71
- /**
72
- * XML path to the test mode allowed config option.
73
- */
74
- const XPATH_TEST_MODE_ALLOWED = 'postnl/advanced/allow_test_mode';
75
 
76
  /**
77
  * XML path to debug mode config option.
@@ -91,12 +81,12 @@ class TIG_PostNL_Helper_Data extends Mage_Core_Helper_Abstract
91
  /**
92
  * XML path to use_globalpack setting.
93
  */
94
- const XPATH_USE_GLOBALPACK = 'postnl/cif/use_globalpack';
95
 
96
  /**
97
  * Xpath to use_buspakje setting.
98
  */
99
- const XPATH_USE_BUSPAKJE = 'postnl/cif_labels_and_confirming/use_buspakje';
100
 
101
  /**
102
  * XPATH to allow EPS BE only product option setting.
@@ -106,18 +96,50 @@ class TIG_PostNL_Helper_Data extends Mage_Core_Helper_Abstract
106
  /**
107
  * XML path to weight unit used
108
  */
109
- const XPATH_WEIGHT_UNIT = 'postnl/cif_labels_and_confirming/weight_unit';
110
 
111
  /**
112
  * Xpath to the buspakje calculation mode setting.
113
  */
114
- const XPATH_BUSPAKJE_CALC_MODE = 'postnl/cif_labels_and_confirming/buspakje_calculation_mode';
115
 
116
  /**
117
  * Minimum PHP version required by this extension.
118
  */
119
  const MIN_PHP_VERSION = '5.3.0';
120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  /**
122
  * Required configuration fields.
123
  *
@@ -129,13 +151,13 @@ class TIG_PostNL_Helper_Data extends Mage_Core_Helper_Abstract
129
  'postnl/cif/collection_location',
130
  'postnl/cif_labels_and_confirming/label_size',
131
  array(
132
- 'postnl/cif_sender_address/lastname',
133
- 'postnl/cif_sender_address/company',
134
  ),
135
- 'postnl/cif_sender_address/streetname',
136
- 'postnl/cif_sender_address/housenumber',
137
- 'postnl/cif_sender_address/postcode',
138
- 'postnl/cif_sender_address/city',
139
  );
140
 
141
  /**
@@ -164,9 +186,9 @@ class TIG_PostNL_Helper_Data extends Mage_Core_Helper_Abstract
164
  * @var array
165
  */
166
  protected $_globalShipmentRequiredFields = array(
167
- 'postnl/cif/use_globalpack',
168
- 'postnl/cif/global_barcode_type',
169
- 'postnl/cif/global_barcode_range',
170
  'postnl/cif_globalpack_settings/customs_value_attribute',
171
  'postnl/cif_globalpack_settings/country_of_origin_attribute',
172
  'postnl/cif_globalpack_settings/description_attribute',
@@ -207,12 +229,24 @@ class TIG_PostNL_Helper_Data extends Mage_Core_Helper_Abstract
207
  protected $_cache = null;
208
 
209
  /**
210
- * THe current server's memory limit.
 
 
 
 
 
211
  *
212
  * @var int
213
  */
214
  protected $_memoryLimit;
215
 
 
 
 
 
 
 
 
216
  /**
217
  * Get required fields array.
218
  *
@@ -253,6 +287,21 @@ class TIG_PostNL_Helper_Data extends Mage_Core_Helper_Abstract
253
  return $this->_globalShipmentRequiredFields;
254
  }
255
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
256
  /**
257
  * @param null|boolean|TIG_PostNL_Model_Core_Cache $cache
258
  *
@@ -287,6 +336,21 @@ class TIG_PostNL_Helper_Data extends Mage_Core_Helper_Abstract
287
  return $cache;
288
  }
289
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
290
  /**
291
  * @return array
292
  */
@@ -366,6 +430,30 @@ class TIG_PostNL_Helper_Data extends Mage_Core_Helper_Abstract
366
  return $debugMode;
367
  }
368
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
369
  /**
370
  * Gets a shipment's PakjeGemak address if available.
371
  *
@@ -664,6 +752,66 @@ class TIG_PostNL_Helper_Data extends Mage_Core_Helper_Abstract
664
  return true;
665
  }
666
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
667
  /**
668
  * Gets the currently configured buspakje calculation mode.
669
  *
@@ -769,7 +917,7 @@ class TIG_PostNL_Helper_Data extends Mage_Core_Helper_Abstract
769
  /**
770
  * If the combined weight of all items is more than 2 kg, this shipment is not a buspakje.
771
  */
772
- if ($totalWeight > 2) {
773
  if ($registerReason) {
774
  Mage::register('postnl_reason_not_buspakje', 'weight');
775
  }
@@ -779,7 +927,7 @@ class TIG_PostNL_Helper_Data extends Mage_Core_Helper_Abstract
779
  /**
780
  * If the combined qty ratios of the items is more than 1 this is not a buspakje.
781
  */
782
- if ($totalQtyRatio > 1) {
783
  if ($registerReason) {
784
  Mage::register('postnl_reason_not_buspakje', 'qty_ratio');
785
  }
@@ -933,6 +1081,7 @@ class TIG_PostNL_Helper_Data extends Mage_Core_Helper_Abstract
933
  case 'download_logs':
934
  $aclPath = 'system/config/postnl/download_logs';
935
  break;
 
936
  case 'print_packing_slips':
937
  $aclPath = 'postnl/shipment/actions/print_label/print_packing_slips';
938
  break;
@@ -996,7 +1145,12 @@ class TIG_PostNL_Helper_Data extends Mage_Core_Helper_Abstract
996
  $storeId = Mage::app()->getStore()->getId();
997
  }
998
 
999
- $testMode = Mage::getStoreConfigFlag(self::XPATH_TEST_MODE, $storeId);
 
 
 
 
 
1000
 
1001
  Mage::register('postnl_test_mode', $testMode);
1002
  return $testMode;
@@ -1085,7 +1239,8 @@ class TIG_PostNL_Helper_Data extends Mage_Core_Helper_Abstract
1085
  /**
1086
  * Check if the module has been enabled
1087
  */
1088
- $enabled = Mage::getStoreConfigFlag(self::XPATH_EXTENSION_ACTIVE, $storeId);
 
1089
  if ($enabled === false) {
1090
  $errors = array(
1091
  array(
@@ -1300,7 +1455,7 @@ class TIG_PostNL_Helper_Data extends Mage_Core_Helper_Abstract
1300
  * 2 - The activation procedure has been finished. The merchant has entered his keys.
1301
  */
1302
  $isActivated = Mage::getStoreConfig(self::XPATH_IS_ACTIVATED, Mage_Core_Model_App::ADMIN_STORE_ID);
1303
- if ($isActivated != 2) {
1304
  $errors[] = array(
1305
  'code' => 'POSTNL-0033',
1306
  'message' => $this->__('The extension has not been activated.'),
@@ -1533,7 +1688,7 @@ class TIG_PostNL_Helper_Data extends Mage_Core_Helper_Abstract
1533
  }
1534
 
1535
  $debugMode = $this->getDebugMode();
1536
- if ($debugMode > 1) {
1537
  return true;
1538
  }
1539
 
@@ -1552,7 +1707,7 @@ class TIG_PostNL_Helper_Data extends Mage_Core_Helper_Abstract
1552
  }
1553
 
1554
  $debugMode = $this->getDebugMode();
1555
- if ($debugMode > 0) {
1556
  return true;
1557
  }
1558
 
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Helper_Data extends Mage_Core_Helper_Abstract
59
  const POSTNL_CRON_DEBUG_LOG_FILE = 'TIG_PostNL_Cron_Debug.log';
60
 
61
  /**
62
+ * XML path to postnl mode setting.
63
  */
64
+ const XPATH_EXTENSION_MODE = 'postnl/cif/mode';
 
 
 
 
 
 
 
 
 
 
65
 
66
  /**
67
  * XML path to debug mode config option.
81
  /**
82
  * XML path to use_globalpack setting.
83
  */
84
+ const XPATH_USE_GLOBALPACK = 'postnl/cif_globalpack_settings/use_globalpack';
85
 
86
  /**
87
  * Xpath to use_buspakje setting.
88
  */
89
+ const XPATH_USE_BUSPAKJE = 'postnl/delivery_options/use_buspakje';
90
 
91
  /**
92
  * XPATH to allow EPS BE only product option setting.
96
  /**
97
  * XML path to weight unit used
98
  */
99
+ const XPATH_WEIGHT_UNIT = 'postnl/packing_slip/weight_unit';
100
 
101
  /**
102
  * Xpath to the buspakje calculation mode setting.
103
  */
104
+ const XPATH_BUSPAKJE_CALC_MODE = 'postnl/delivery_options/buspakje_calculation_mode';
105
 
106
  /**
107
  * Minimum PHP version required by this extension.
108
  */
109
  const MIN_PHP_VERSION = '5.3.0';
110
 
111
+ /**
112
+ * Xpath to the changelog URL.
113
+ */
114
+ const CHANGELOG_URL_XPATH = 'postnl/general/changelog_url';
115
+
116
+ /**
117
+ * Logging levels supported by this extension.
118
+ */
119
+ const LOGGING_EXCEPTION_ONLY = 1;
120
+ const LOGGING_FULL = 2;
121
+
122
+ /**
123
+ * Maximum weight for letter box parcels (in kilograms).
124
+ */
125
+ const MAX_LETTER_BOX_PARCEL_WEIGHT = 2;
126
+
127
+ /**
128
+ * Maximum weight for letter box parcels (in kilograms).
129
+ */
130
+ const MAX_LETTER_BOX_PARCEL_QTY_RATIO = 1;
131
+
132
+ /**
133
+ * Value the 'is_activated' setting must achieve for the extension to be considered 'activated'.
134
+ */
135
+ const EXTENSION_ACTIVE = 2;
136
+
137
+ /**
138
+ * Buspakje calculation modes.
139
+ */
140
+ const BUSPAKJE_CALCULATION_MODE_AUTOMATIC = 'automatic';
141
+ const BUSPAKJE_CALCULATION_MODE_MANUAL = 'manual';
142
+
143
  /**
144
  * Required configuration fields.
145
  *
151
  'postnl/cif/collection_location',
152
  'postnl/cif_labels_and_confirming/label_size',
153
  array(
154
+ 'postnl/cif_address/lastname',
155
+ 'postnl/cif_address/company',
156
  ),
157
+ 'postnl/cif_address/streetname',
158
+ 'postnl/cif_address/housenumber',
159
+ 'postnl/cif_address/postcode',
160
+ 'postnl/cif_address/city',
161
  );
162
 
163
  /**
186
  * @var array
187
  */
188
  protected $_globalShipmentRequiredFields = array(
189
+ 'postnl/cif_globalpack_settings/use_globalpack',
190
+ 'postnl/cif_globalpack_settings/global_barcode_type',
191
+ 'postnl/cif_globalpack_settings/global_barcode_range',
192
  'postnl/cif_globalpack_settings/customs_value_attribute',
193
  'postnl/cif_globalpack_settings/country_of_origin_attribute',
194
  'postnl/cif_globalpack_settings/description_attribute',
229
  protected $_cache = null;
230
 
231
  /**
232
+ * @var Mage_Sales_Model_Quote
233
+ */
234
+ protected $_quote;
235
+
236
+ /**
237
+ * The current server's memory limit.
238
  *
239
  * @var int
240
  */
241
  protected $_memoryLimit;
242
 
243
+ /**
244
+ * The URL of the PostNL change log.
245
+ *
246
+ * @var string
247
+ */
248
+ protected $_changelogUrl;
249
+
250
  /**
251
  * Get required fields array.
252
  *
287
  return $this->_globalShipmentRequiredFields;
288
  }
289
 
290
+ /**
291
+ * @return string
292
+ */
293
+ public function getChangelogUrl()
294
+ {
295
+ if ($this->_changelogUrl) {
296
+ return $this->_changelogUrl;
297
+ }
298
+
299
+ $changelogUrl = Mage::getStoreConfig(self::CHANGELOG_URL_XPATH, Mage_Core_Model_App::ADMIN_STORE_ID);
300
+
301
+ $this->_changelogUrl = $changelogUrl;
302
+ return $changelogUrl;
303
+ }
304
+
305
  /**
306
  * @param null|boolean|TIG_PostNL_Model_Core_Cache $cache
307
  *
336
  return $cache;
337
  }
338
 
339
+ /**
340
+ * @return Mage_Sales_Model_Quote
341
+ */
342
+ public function getQuote()
343
+ {
344
+ if ($this->_quote) {
345
+ return $this->_quote;
346
+ }
347
+
348
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
349
+
350
+ $this->_quote = $quote;
351
+ return $quote;
352
+ }
353
+
354
  /**
355
  * @return array
356
  */
430
  return $debugMode;
431
  }
432
 
433
+ /**
434
+ * Alias for TIG_PostNL_Helper_Data::getModuleVersion()
435
+ *
436
+ * @return string
437
+ *
438
+ * @see TIG_PostNL_Helper_Data::getModuleVersion
439
+ */
440
+ public function getExtensionVersion()
441
+ {
442
+ return $this->getModuleVersion();
443
+ }
444
+
445
+ /**
446
+ * Get the current version of the PostNL extension's code base.
447
+ *
448
+ * @return string
449
+ */
450
+ public function getModuleVersion()
451
+ {
452
+ $version = (string) Mage::getConfig()->getModuleConfig('TIG_PostNL')->version;
453
+
454
+ return $version;
455
+ }
456
+
457
  /**
458
  * Gets a shipment's PakjeGemak address if available.
459
  *
752
  return true;
753
  }
754
 
755
+ /**
756
+ * Alias for TIG_PostNL_Helper_Data::quoteIsBuspakje() provided for backwards compatibility.
757
+ *
758
+ * @param Mage_Sales_Model_Quote $quote
759
+ *
760
+ * @return bool
761
+ *
762
+ * @see TIG_PostNL_Helper_Data::quoteIsBuspakje()
763
+ */
764
+ public function isBuspakjeConfigApplicableToQuote(Mage_Sales_Model_Quote $quote = null)
765
+ {
766
+ return $this->quoteIsBuspakje($quote);
767
+ }
768
+
769
+ /**
770
+ * Checks if the buspakje-specific configuration is applicable to the current quote.
771
+ *
772
+ * @param Mage_Sales_Model_Quote $quote
773
+ *
774
+ * @return bool
775
+ */
776
+ public function quoteIsBuspakje(Mage_Sales_Model_Quote $quote = null)
777
+ {
778
+ if (is_null($quote)) {
779
+ $quote = $this->getQuote();
780
+ }
781
+
782
+ /**
783
+ * Form a unique registry key for the current quote (if available) so we can cache the result of this method in
784
+ * the registry.
785
+ */
786
+ $registryKey = 'is_buspakje_config_applicable_to_quote_' . $quote->getId();
787
+
788
+ /**
789
+ * Check if the result of this method has been cached in the registry.
790
+ */
791
+ if (Mage::registry($registryKey) !== null) {
792
+ return Mage::registry($registryKey);
793
+ }
794
+
795
+ /**
796
+ * If the buspakje calculation mode is set to 'manual', no further checks are required as the regular delivery
797
+ * option rules will apply.
798
+ */
799
+ if (self::BUSPAKJE_CALCULATION_MODE_AUTOMATIC != $this->getBuspakjeCalculationMode()) {
800
+ Mage::register($registryKey, false);
801
+ return false;
802
+ }
803
+
804
+ /**
805
+ * Check if the current quote would fit as a letter box parcel.
806
+ */
807
+ $quoteItems = $quote->getAllItems();
808
+
809
+ $fits = $this->fitsAsBuspakje($quoteItems);
810
+
811
+ Mage::register($registryKey, $fits);
812
+ return $fits;
813
+ }
814
+
815
  /**
816
  * Gets the currently configured buspakje calculation mode.
817
  *
917
  /**
918
  * If the combined weight of all items is more than 2 kg, this shipment is not a buspakje.
919
  */
920
+ if ($totalWeight > self::MAX_LETTER_BOX_PARCEL_WEIGHT) {
921
  if ($registerReason) {
922
  Mage::register('postnl_reason_not_buspakje', 'weight');
923
  }
927
  /**
928
  * If the combined qty ratios of the items is more than 1 this is not a buspakje.
929
  */
930
+ if ($totalQtyRatio > self::MAX_LETTER_BOX_PARCEL_QTY_RATIO) {
931
  if ($registerReason) {
932
  Mage::register('postnl_reason_not_buspakje', 'qty_ratio');
933
  }
1081
  case 'download_logs':
1082
  $aclPath = 'system/config/postnl/download_logs';
1083
  break;
1084
+ case 'print_packing_slip': //no break
1085
  case 'print_packing_slips':
1086
  $aclPath = 'postnl/shipment/actions/print_label/print_packing_slips';
1087
  break;
1145
  $storeId = Mage::app()->getStore()->getId();
1146
  }
1147
 
1148
+ $testMode = false;
1149
+ $mode = Mage::getStoreConfig(self::XPATH_EXTENSION_MODE, $storeId);
1150
+
1151
+ if ($mode === '1') {
1152
+ $testMode = true;
1153
+ }
1154
 
1155
  Mage::register('postnl_test_mode', $testMode);
1156
  return $testMode;
1239
  /**
1240
  * Check if the module has been enabled
1241
  */
1242
+ $enabled = Mage::getStoreConfigFlag(self::XPATH_EXTENSION_MODE, $storeId);
1243
+
1244
  if ($enabled === false) {
1245
  $errors = array(
1246
  array(
1455
  * 2 - The activation procedure has been finished. The merchant has entered his keys.
1456
  */
1457
  $isActivated = Mage::getStoreConfig(self::XPATH_IS_ACTIVATED, Mage_Core_Model_App::ADMIN_STORE_ID);
1458
+ if ($isActivated != self::EXTENSION_ACTIVE) {
1459
  $errors[] = array(
1460
  'code' => 'POSTNL-0033',
1461
  'message' => $this->__('The extension has not been activated.'),
1688
  }
1689
 
1690
  $debugMode = $this->getDebugMode();
1691
+ if ($debugMode >= self::LOGGING_FULL) {
1692
  return true;
1693
  }
1694
 
1707
  }
1708
 
1709
  $debugMode = $this->getDebugMode();
1710
+ if ($debugMode >= self::LOGGING_EXCEPTION_ONLY) {
1711
  return true;
1712
  }
1713
 
app/code/community/TIG/PostNL/Helper/DeliveryOptions.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @todo Cache the available delivery options in the checkout session. That way we only recalculate them if the quote
@@ -66,12 +66,14 @@ class TIG_PostNL_Helper_DeliveryOptions extends TIG_PostNL_Helper_Checkout
66
  const XPATH_ENABLE_DELIVERY_DAYS_FOR_BUSPAKJE = 'postnl/delivery_options/enable_delivery_days_for_buspakje';
67
  const XPATH_ENABLE_PAKJEGEMAK_FOR_BUSPAKJE = 'postnl/delivery_options/enable_pakjegemak_for_buspakje';
68
  const XPATH_ENABLE_PAKKETAUTOMAAT_FOR_BUSPAKJE = 'postnl/delivery_options/enable_pakketautomaat_for_buspakje';
 
69
 
70
  /**
71
  * Xpaths to extra fee config settings.
72
  */
73
- const XPATH_EVENING_TIMEFRAME_FEE = 'postnl/delivery_options/evening_timeframe_fee';
74
- const XPATH_PAKJEGEMAK_EXPRESS_FEE = 'postnl/delivery_options/pakjegemak_express_fee';
 
75
 
76
  /**
77
  * Xpath for shipping duration setting.
@@ -79,12 +81,28 @@ class TIG_PostNL_Helper_DeliveryOptions extends TIG_PostNL_Helper_Checkout
79
  const XPATH_SHIPPING_DURATION = 'postnl/cif_labels_and_confirming/shipping_duration';
80
  const XPATH_CUTOFF_TIME = 'postnl/cif_labels_and_confirming/cutoff_time';
81
  const XPATH_SUNDAY_CUTOFF_TIME = 'postnl/cif_labels_and_confirming/sunday_cutoff_time';
 
 
 
 
 
 
 
 
 
 
 
82
 
83
  /**
84
  * The time we consider to be the start of the evening.
85
  */
86
  const EVENING_TIME = 1900;
87
 
 
 
 
 
 
88
  /**
89
  * @var array
90
  */
@@ -96,11 +114,6 @@ class TIG_PostNL_Helper_DeliveryOptions extends TIG_PostNL_Helper_Checkout
96
  'PA',
97
  );
98
 
99
- /**
100
- * @var Mage_Sales_Model_Quote
101
- */
102
- protected $_quote;
103
-
104
  /**
105
  * @return array
106
  */
@@ -110,22 +123,54 @@ class TIG_PostNL_Helper_DeliveryOptions extends TIG_PostNL_Helper_Checkout
110
  }
111
 
112
  /**
113
- * @return Mage_Sales_Model_Quote
 
 
 
 
 
 
114
  */
115
- public function getQuote()
116
  {
117
- if ($this->_quote) {
118
- return $this->_quote;
 
 
119
  }
120
 
121
- $quote = Mage::getSingleton('checkout/session')->getQuote();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
 
123
- $this->_quote = $quote;
124
- return $quote;
 
 
 
 
 
 
 
 
 
 
125
  }
126
 
127
  /**
128
- * Get the fee charged for evening time frames.
129
  *
130
  * @param boolean $formatted
131
  * @param boolean $includingTax
@@ -133,44 +178,187 @@ class TIG_PostNL_Helper_DeliveryOptions extends TIG_PostNL_Helper_Checkout
133
  *
134
  * @return float
135
  */
136
- public function getEveningFee($formatted = false, $includingTax = true, $convert = true)
137
  {
138
- $storeId = Mage::app()->getStore()->getId();
139
 
140
- $eveningFee = (float) Mage::getStoreConfig(self::XPATH_EVENING_TIMEFRAME_FEE, $storeId);
 
 
141
 
142
- $price = $this->getPriceWithTax($eveningFee, $includingTax, $formatted, false);
 
 
 
143
 
144
- if ($price > 2) {
145
- $price = 0;
 
 
 
 
 
 
 
146
  }
147
 
148
  if ($convert) {
149
  $quote = $this->getQuote();
150
  $store = $quote->getStore();
151
 
152
- $price = $store->convertPrice($price, $formatted, false);
 
 
 
 
153
  }
154
 
155
  return $price;
156
  }
157
 
158
  /**
159
- * Get the fee charged for PakjeGemak Express.
160
  *
 
161
  * @param boolean $formatted
162
  * @param boolean $includingTax
163
  * @param boolean $convert
164
  *
165
- * @return float
166
  */
167
- public function getExpressFee($formatted = false, $includingTax = true, $convert = true)
168
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  $storeId = Mage::app()->getStore()->getId();
170
 
171
- $expressFee = (float) Mage::getStoreConfig(self::XPATH_PAKJEGEMAK_EXPRESS_FEE, $storeId);
 
 
 
 
 
 
 
172
 
173
- $price = $this->getPriceWithTax($expressFee, $includingTax, $formatted, false);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
 
175
  if ($price > 2) {
176
  $price = 0;
@@ -180,7 +368,11 @@ class TIG_PostNL_Helper_DeliveryOptions extends TIG_PostNL_Helper_Checkout
180
  $quote = $this->getQuote();
181
  $store = $quote->getStore();
182
 
183
- $price = $store->convertPrice($price, $formatted, false);
 
 
 
 
184
  }
185
 
186
  return $price;
@@ -407,19 +599,60 @@ class TIG_PostNL_Helper_DeliveryOptions extends TIG_PostNL_Helper_Checkout
407
  return $deliveryOptionsInfo;
408
  }
409
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
410
  /**
411
  * Get the delivery date for a specified order date.
412
  *
413
  * @param null|string $orderDate
414
  * @param null|int $storeId
415
  * @param boolean $asDays
 
 
416
  *
417
- * @return bool|string|int
418
  */
419
- public function getDeliveryDate($orderDate = null, $storeId = null, $asDays = false)
420
- {
 
421
  if (!$orderDate) {
422
- $orderDate = new DateTime(Mage::getModel('core/date')->date('Y-m-d H:i:s'));
423
  }
424
 
425
  if ($storeId === null) {
@@ -438,15 +671,9 @@ class TIG_PostNL_Helper_DeliveryOptions extends TIG_PostNL_Helper_Checkout
438
  $deliveryTime->add(new DateInterval("P{$shippingDuration}D"));
439
 
440
  /**
441
- * Get the cut-off time. This is formatted as H:i:s.
442
- */
443
- $cutOffTime = Mage::getStoreConfig(self::XPATH_CUTOFF_TIME, $storeId);
444
- $orderTime = $orderDate->format('His');
445
-
446
- /**
447
- * Check if the current time (as His) is greater than the cut-off time.
448
  */
449
- if ($orderTime > str_replace(':', '', $cutOffTime)) {
450
  $deliveryTime->add(new DateInterval('P1D'));
451
  $shippingDuration++;
452
  }
@@ -456,26 +683,217 @@ class TIG_PostNL_Helper_DeliveryOptions extends TIG_PostNL_Helper_Checkout
456
  */
457
  $deliveryDay = $deliveryTime->format('N');
458
 
 
 
 
 
 
 
 
 
 
459
  /**
460
  * If the delivery day is a monday, we need to make sure that sunday sorting is allowed. Otherwise delivery on a
461
  * monday is not possible.
462
  */
463
- if ($deliveryDay == 1 && !Mage::helper('postnl/deliveryOptions')->canUseSundaySorting()) {
 
464
  $sundayCutOffTime = Mage::getStoreConfig(self::XPATH_SUNDAY_CUTOFF_TIME, $storeId);
 
465
  if ($orderTime <= str_replace(':', '', $sundayCutOffTime)) {
466
  $deliveryTime->add(new DateInterval('P1D'));
467
  $shippingDuration++;
468
  }
 
 
 
469
  }
470
 
471
  if ($asDays) {
472
  return $shippingDuration;
473
  }
474
 
 
 
 
 
 
 
 
475
  $deliveryDate = $deliveryTime->format('Y-m-d');
476
  return $deliveryDate;
477
  }
478
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
479
  /**
480
  * Get the first possible delivery date as determined by PostNL.
481
  *
@@ -583,16 +1001,47 @@ class TIG_PostNL_Helper_DeliveryOptions extends TIG_PostNL_Helper_Checkout
583
  $durationArray = array($configDuration);
584
 
585
  /**
586
- * Loop through all products in the quote.
587
  *
588
  * @var Mage_Sales_Model_Quote_Item $item
589
  */
590
- foreach ($quote->getAllVisibleItems() as $item) {
591
- $product = Mage::getModel('catalog/product')->load($item->getProductId());
 
 
 
 
 
592
 
593
- /**
594
- * If the product has a specific shipping duration, add it to the array of durations.
595
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
596
  if ($product->hasData('postnl_shipping_duration')
597
  && $product->getData('postnl_shipping_duration') !== ''
598
  ) {
@@ -604,7 +1053,21 @@ class TIG_PostNL_Helper_DeliveryOptions extends TIG_PostNL_Helper_Checkout
604
  * Sort the array and get it's last item. This will be the highest value.
605
  */
606
  natsort($durationArray);
607
- $shippingDuration = end($durationArray);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
608
 
609
  /**
610
  * Make sure the value is between 1 and 14 days.
@@ -739,6 +1202,27 @@ class TIG_PostNL_Helper_DeliveryOptions extends TIG_PostNL_Helper_Checkout
739
  return false;
740
  }
741
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
742
  /**
743
  * Checks if PakjeGemak is available.
744
  *
@@ -834,7 +1318,7 @@ class TIG_PostNL_Helper_DeliveryOptions extends TIG_PostNL_Helper_Checkout
834
  * If the current quote fits as a letter box parcel and the calculation mode is set to 'automatic', check if
835
  * these options are available for letter box parcel orders.
836
  */
837
- if ($this->isBuspakjeConfigApplicableToQuote($quote)
838
  && !$this->canShowPakjeGemakForBuspakje($quote)
839
  ) {
840
  Mage::register($registryKey, false);
@@ -1070,7 +1554,7 @@ class TIG_PostNL_Helper_DeliveryOptions extends TIG_PostNL_Helper_Checkout
1070
  * If the current quote fits as a letter box parcel and the calculation mode is set to 'automatic', check if
1071
  * these options are available for letter box parcel orders.
1072
  */
1073
- if ($this->isBuspakjeConfigApplicableToQuote($quote)
1074
  && !$this->canShowPakketAutomaatForBuspakje($quote)
1075
  ) {
1076
  Mage::register($registryKey, false);
@@ -1224,7 +1708,7 @@ class TIG_PostNL_Helper_DeliveryOptions extends TIG_PostNL_Helper_Checkout
1224
  * If the current quote fits as a letter box parcel and the calculation mode is set to 'automatic', check if
1225
  * these options are available for letter box parcel orders.
1226
  */
1227
- if ($this->isBuspakjeConfigApplicableToQuote($quote)
1228
  && !$this->canShowDeliveryDaysForBuspakje($quote)
1229
  ) {
1230
  Mage::register($registryKey, false);
@@ -1354,12 +1838,10 @@ class TIG_PostNL_Helper_DeliveryOptions extends TIG_PostNL_Helper_Checkout
1354
  }
1355
 
1356
  /**
1357
- * If the current quote fits as a letter box parcel and the calculation mode is set to 'automatic', check if
1358
- * these options are available for letter box parcel orders.
1359
  */
1360
- if ($this->isBuspakjeConfigApplicableToQuote($quote)
1361
- && !$this->canShowAllDeliveryOptionsForBuspakje($quote)
1362
- ) {
1363
  Mage::register($registryKey, false);
1364
  return false;
1365
  }
@@ -1601,7 +2083,7 @@ class TIG_PostNL_Helper_DeliveryOptions extends TIG_PostNL_Helper_Checkout
1601
  * Check if the current quote is a letter box parcel order and if so, if delivery options are allowed for letter
1602
  * box parcel orders.
1603
  */
1604
- if ($this->isBuspakjeConfigApplicableToQuote($quote)
1605
  && !$this->canShowDeliveryOptionsForBuspakje($quote)
1606
  ) {
1607
  $errors = array(
@@ -1706,48 +2188,6 @@ class TIG_PostNL_Helper_DeliveryOptions extends TIG_PostNL_Helper_Checkout
1706
  return true;
1707
  }
1708
 
1709
- /**
1710
- * Checks if the buspakje-specific configuration is applicable to the current quote.
1711
- *
1712
- * @param Mage_Sales_Model_Quote $quote
1713
- *
1714
- * @return bool
1715
- */
1716
- public function isBuspakjeConfigApplicableToQuote(Mage_Sales_Model_Quote $quote)
1717
- {
1718
- /**
1719
- * Form a unique registry key for the current quote (if available) so we can cache the result of this method in
1720
- * the registry.
1721
- */
1722
- $registryKey = 'is_buspakje_config_applicable_to_quote_' . $quote->getId();
1723
-
1724
- /**
1725
- * Check if the result of this method has been cached in the registry.
1726
- */
1727
- if (Mage::registry($registryKey) !== null) {
1728
- return Mage::registry($registryKey);
1729
- }
1730
-
1731
- /**
1732
- * If the buspakje calculation mode is set to 'manual', no further checks are required as the regular delivery
1733
- * option rules will apply.
1734
- */
1735
- if ($this->getBuspakjeCalculationMode() != 'automatic') {
1736
- Mage::register($registryKey, false);
1737
- return false;
1738
- }
1739
-
1740
- /**
1741
- * Check if the current quote would fit as a letter box parcel.
1742
- */
1743
- $quoteItems = $quote->getAllItems();
1744
-
1745
- $fits = $this->fitsAsBuspakje($quoteItems);
1746
-
1747
- Mage::register($registryKey, $fits);
1748
- return $fits;
1749
- }
1750
-
1751
  /**
1752
  * Checks if delivery options are disabled for letter box parcel orders.
1753
  *
@@ -1981,29 +2421,169 @@ class TIG_PostNL_Helper_DeliveryOptions extends TIG_PostNL_Helper_Checkout
1981
  }
1982
 
1983
  /**
1984
- * Check if the module is set to test mode
1985
  *
1986
- * @param bool $storeId
1987
  *
1988
  * @return boolean
1989
  */
1990
- public function isTestMode($storeId = false)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1991
  {
 
 
 
 
 
 
 
 
1992
  /**
1993
  * Check if the result of this method has been cached in the registry.
1994
  */
1995
- if (Mage::registry('delivery_options_test_mode') !== null) {
1996
- return Mage::registry('delivery_options_test_mode');
 
 
 
 
 
 
 
 
 
1997
  }
1998
 
1999
- if ($storeId === false) {
2000
- $storeId = Mage::app()->getStore()->getId();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2001
  }
2002
 
2003
- $testMode = Mage::getStoreConfigFlag(self::XPATH_TEST_MODE, $storeId);
 
2004
 
2005
- Mage::register('delivery_options_test_mode', $testMode);
2006
- return $testMode;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2007
  }
2008
 
2009
  /**
@@ -2123,6 +2703,15 @@ class TIG_PostNL_Helper_DeliveryOptions extends TIG_PostNL_Helper_Checkout
2123
  $storeId = Mage::app()->getStore()->getId();
2124
  }
2125
 
 
 
 
 
 
 
 
 
 
2126
  $isActive = Mage::getStoreConfigFlag(self::XPATH_DELIVERY_OPTIONS_ACTIVE, $storeId);
2127
 
2128
  return $isActive;
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @todo Cache the available delivery options in the checkout session. That way we only recalculate them if the quote
66
  const XPATH_ENABLE_DELIVERY_DAYS_FOR_BUSPAKJE = 'postnl/delivery_options/enable_delivery_days_for_buspakje';
67
  const XPATH_ENABLE_PAKJEGEMAK_FOR_BUSPAKJE = 'postnl/delivery_options/enable_pakjegemak_for_buspakje';
68
  const XPATH_ENABLE_PAKKETAUTOMAAT_FOR_BUSPAKJE = 'postnl/delivery_options/enable_pakketautomaat_for_buspakje';
69
+ const XPATH_STATED_ADDRESS_ONLY_OPTION = 'postnl/delivery_options/stated_address_only_option';
70
 
71
  /**
72
  * Xpaths to extra fee config settings.
73
  */
74
+ const XPATH_EVENING_TIMEFRAME_FEE = 'postnl/delivery_options/evening_timeframe_fee';
75
+ const XPATH_PAKJEGEMAK_EXPRESS_FEE = 'postnl/delivery_options/pakjegemak_express_fee';
76
+ const XPATH_ONLY_STATED_ADDRESS_FEE = 'postnl/delivery_options/stated_address_only_fee';
77
 
78
  /**
79
  * Xpath for shipping duration setting.
81
  const XPATH_SHIPPING_DURATION = 'postnl/cif_labels_and_confirming/shipping_duration';
82
  const XPATH_CUTOFF_TIME = 'postnl/cif_labels_and_confirming/cutoff_time';
83
  const XPATH_SUNDAY_CUTOFF_TIME = 'postnl/cif_labels_and_confirming/sunday_cutoff_time';
84
+ const XPATH_SHIPPING_DAYS = 'postnl/cif_labels_and_confirming/shipping_days';
85
+
86
+ /**
87
+ * Xpath to the 'stated_address_only_checked' setting.
88
+ */
89
+ const XPATH_STATED_ADDRESS_ONLY_CHECKED = 'postnl/delivery_options/stated_address_only_checked';
90
+
91
+ /**
92
+ * Xpath to the responsive design setting.
93
+ */
94
+ const XPATH_RESPONSIVE = 'postnl/delivery_options/responsive';
95
 
96
  /**
97
  * The time we consider to be the start of the evening.
98
  */
99
  const EVENING_TIME = 1900;
100
 
101
+ /**
102
+ * The maximum fee amount allowed for evening and early delivery options.
103
+ */
104
+ const MAX_FEE = 2;
105
+
106
  /**
107
  * @var array
108
  */
114
  'PA',
115
  );
116
 
 
 
 
 
 
117
  /**
118
  * @return array
119
  */
123
  }
124
 
125
  /**
126
+ * Get the fee charged for evening time frames.
127
+ *
128
+ * @param boolean $formatted
129
+ * @param boolean $includingTax
130
+ * @param boolean $convert
131
+ *
132
+ * @return float
133
  */
134
+ public function getEveningFee($formatted = false, $includingTax = true, $convert = true)
135
  {
136
+ $registryKey = 'postnl_evening_fee';
137
+
138
+ if ($includingTax) {
139
+ $registryKey .= '_incl';
140
  }
141
 
142
+ if (Mage::registry($registryKey) !== null) {
143
+ $price = Mage::registry($registryKey);
144
+ } else {
145
+ $storeId = Mage::app()->getStore()->getId();
146
+
147
+ $eveningFee = (float) Mage::getStoreConfig(self::XPATH_EVENING_TIMEFRAME_FEE, $storeId);
148
+
149
+ $price = $this->getPriceWithTax($eveningFee, $includingTax, false, false);
150
+
151
+ if ($price > self::MAX_FEE) {
152
+ $price = 0;
153
+ }
154
+
155
+ Mage::register($registryKey, $price);
156
+ }
157
 
158
+ if ($convert) {
159
+ $quote = $this->getQuote();
160
+ $store = $quote->getStore();
161
+
162
+ $price = $store->convertPrice($price, false, false);
163
+ }
164
+
165
+ if ($formatted) {
166
+ $price = Mage::app()->getStore()->formatPrice($price, false);
167
+ }
168
+
169
+ return $price;
170
  }
171
 
172
  /**
173
+ * Get the fee charged for PakjeGemak Express.
174
  *
175
  * @param boolean $formatted
176
  * @param boolean $includingTax
178
  *
179
  * @return float
180
  */
181
+ public function getExpressFee($formatted = false, $includingTax = true, $convert = true)
182
  {
183
+ $registryKey = 'postnl_express_fee';
184
 
185
+ if ($includingTax) {
186
+ $registryKey .= '_incl';
187
+ }
188
 
189
+ if (Mage::registry($registryKey) !== null) {
190
+ $price = Mage::registry($registryKey);
191
+ } else {
192
+ $storeId = Mage::app()->getStore()->getId();
193
 
194
+ $expressFee = (float) Mage::getStoreConfig(self::XPATH_PAKJEGEMAK_EXPRESS_FEE, $storeId);
195
+
196
+ $price = $this->getPriceWithTax($expressFee, $includingTax, false, false);
197
+
198
+ if ($price > self::MAX_FEE) {
199
+ $price = 0;
200
+ }
201
+
202
+ Mage::register($registryKey, $price);
203
  }
204
 
205
  if ($convert) {
206
  $quote = $this->getQuote();
207
  $store = $quote->getStore();
208
 
209
+ $price = $store->convertPrice($price, false, false);
210
+ }
211
+
212
+ if ($formatted) {
213
+ $price = Mage::app()->getStore()->formatPrice($price, false);
214
  }
215
 
216
  return $price;
217
  }
218
 
219
  /**
220
+ * Get the fee for PakjeGemak locations. This is only applicable to buspakje orders.
221
  *
222
+ * @param float $currentRate
223
  * @param boolean $formatted
224
  * @param boolean $includingTax
225
  * @param boolean $convert
226
  *
227
+ * @return float|int
228
  */
229
+ public function getPakjeGemakFee($currentRate, $formatted = false, $includingTax = true, $convert = true)
230
  {
231
+ $registryKey = 'postnl_pakje_gemak_fee';
232
+
233
+ if ($includingTax) {
234
+ $registryKey .= '_incl';
235
+ }
236
+
237
+ /**
238
+ * If the current order is not a buspakje order, the fee is 0.
239
+ */
240
+ if (!$this->isBuspakjeConfigApplicableToQuote()) {
241
+ Mage::register($registryKey, 0);
242
+
243
+ return 0;
244
+ }
245
+
246
+ if (Mage::registry($registryKey) !== null) {
247
+ $price = Mage::registry($registryKey);
248
+ } else {
249
+ $pakjeGemakShippingRates = Mage::helper('postnl/carrier')->getParcelShippingRate($this->getQuote());
250
+ if (!$pakjeGemakShippingRates) {
251
+ return 0;
252
+ }
253
+
254
+ $pakjeGemakShippingRate = $pakjeGemakShippingRates->getCheapestRate();
255
+ $pakjeGemakShippingRate = $pakjeGemakShippingRate->getPrice();
256
+
257
+ $difference = $pakjeGemakShippingRate - $currentRate;
258
+
259
+ $price = $this->getPriceWithTax($difference, $includingTax, false, false);
260
+
261
+ Mage::register($registryKey, $price);
262
+ }
263
+
264
+ if ($convert) {
265
+ $quote = $this->getQuote();
266
+ $store = $quote->getStore();
267
+
268
+ $price = $store->convertPrice($price, false, false);
269
+ }
270
+
271
+
272
+ if ($formatted) {
273
+ $price = Mage::app()->getStore()->formatPrice($price, false);
274
+ }
275
+
276
+ return $price;
277
+ }
278
+
279
+ /**
280
+ * Get the fee charged for possible options saved to the PostNL order.
281
+ *
282
+ * @param TIG_PostNL_Model_Core_Order $postnlOrder
283
+ * @param bool $formatted
284
+ * @param bool $includingTax
285
+ * @param bool $convert
286
+ *
287
+ * @return float|int
288
+ */
289
+ public function getOptionsFee(TIG_PostNL_Model_Core_Order $postnlOrder, $formatted = false, $includingTax = true,
290
+ $convert = true)
291
+ {
292
+ if (!$postnlOrder->hasOptions()) {
293
+ return 0;
294
+ }
295
+
296
+ $options = $postnlOrder->getOptions();
297
+ if (empty($options)) {
298
+ return 0;
299
+ }
300
+
301
  $storeId = Mage::app()->getStore()->getId();
302
 
303
+ /**
304
+ * For upgradability reasons this is a switch, rather than an if statement.
305
+ */
306
+ $fee = 0;
307
+ foreach ($options as $option => $value) {
308
+ if (!$value) {
309
+ continue;
310
+ }
311
 
312
+ switch ($option) {
313
+ case 'only_stated_address':
314
+ $fee += (float) Mage::getStoreConfig(self::XPATH_ONLY_STATED_ADDRESS_FEE, $storeId);
315
+ break;
316
+ //no default
317
+ }
318
+ }
319
+
320
+ $price = $this->getPriceWithTax($fee, $includingTax, false, false);
321
+
322
+ if ($convert) {
323
+ $quote = $this->getQuote();
324
+ $store = $quote->getStore();
325
+
326
+ $price = $store->convertPrice($price, false, false);
327
+ }
328
+
329
+ if ($formatted) {
330
+ $price = Mage::app()->getStore()->formatPrice($price, false);
331
+ }
332
+
333
+ return $price;
334
+ }
335
+
336
+ /**
337
+ * Gets the configured fee for a specified option.
338
+ *
339
+ * @param string $option
340
+ * @param bool $formatted
341
+ * @param bool $includingTax
342
+ * @param bool $convert
343
+ *
344
+ * @return float|int
345
+ */
346
+ public function getOptionFee($option, $formatted = false, $includingTax = true, $convert = true)
347
+ {
348
+ $storeId = Mage::app()->getStore()->getId();
349
+
350
+ /**
351
+ * For upgradability reasons this is a switch, rather than an if statement.
352
+ */
353
+ $fee = 0;
354
+ switch ($option) {
355
+ case 'only_stated_address':
356
+ $fee = (float) Mage::getStoreConfig(self::XPATH_ONLY_STATED_ADDRESS_FEE, $storeId);
357
+ break;
358
+ //no default
359
+ }
360
+
361
+ $price = $this->getPriceWithTax($fee, $includingTax, false, false);
362
 
363
  if ($price > 2) {
364
  $price = 0;
368
  $quote = $this->getQuote();
369
  $store = $quote->getStore();
370
 
371
+ $price = $store->convertPrice($price, false, false);
372
+ }
373
+
374
+ if ($formatted) {
375
+ $price = Mage::app()->getStore()->formatPrice($price, false);
376
  }
377
 
378
  return $price;
599
  return $deliveryOptionsInfo;
600
  }
601
 
602
+ /**
603
+ * Check whether the specified order date is past the configured cut-off time.
604
+ *
605
+ * @param string|DateTime|null $orderDate
606
+ * @param null|int $storeId
607
+ *
608
+ * @return bool
609
+ */
610
+ public function isPastCutOffTime($orderDate = null, $storeId = null)
611
+ {
612
+ if (!$orderDate) {
613
+ $orderDate = new DateTime(Mage::getModel('core/date')->date('Y-m-d H:i:s'));
614
+ }
615
+
616
+ if ($storeId === null) {
617
+ $storeId = Mage::app()->getStore()->getId();
618
+ }
619
+
620
+ if (is_string($orderDate)) {
621
+ $orderDate = new DateTime($orderDate);
622
+ }
623
+
624
+ /**
625
+ * Get the cut-off time. This is formatted as H:i:s.
626
+ */
627
+ $cutOffTime = Mage::getStoreConfig(self::XPATH_CUTOFF_TIME, $storeId);
628
+ $orderTime = $orderDate->format('His');
629
+
630
+ /**
631
+ * Check if the current time (as His) is greater than the cut-off time.
632
+ */
633
+ if ($orderTime > str_replace(':', '', $cutOffTime)) {
634
+ return true;
635
+ }
636
+
637
+ return false;
638
+ }
639
+
640
  /**
641
  * Get the delivery date for a specified order date.
642
  *
643
  * @param null|string $orderDate
644
  * @param null|int $storeId
645
  * @param boolean $asDays
646
+ * @param boolean $asDateTime
647
+ * @param boolean $withTime
648
  *
649
+ * @return string|int|DateTime
650
  */
651
+ public function getDeliveryDate($orderDate = null, $storeId = null, $asDays = false, $asDateTime = false,
652
+ $withTime = true
653
+ ) {
654
  if (!$orderDate) {
655
+ $orderDate = new DateTime(Mage::getSingleton('core/date')->date('Y-m-d H:i:s'));
656
  }
657
 
658
  if ($storeId === null) {
671
  $deliveryTime->add(new DateInterval("P{$shippingDuration}D"));
672
 
673
  /**
674
+ * Check if the current time is greater than the cut-off time.
 
 
 
 
 
 
675
  */
676
+ if ($this->isPastCutOffTime($orderDate, $storeId)) {
677
  $deliveryTime->add(new DateInterval('P1D'));
678
  $shippingDuration++;
679
  }
683
  */
684
  $deliveryDay = $deliveryTime->format('N');
685
 
686
+ /**
687
+ * Delivery on sunday is not possible.
688
+ */
689
+ if ($deliveryDay == 7) {
690
+ $deliveryDay = 1;
691
+ $deliveryTime->add(new DateInterval('P1D'));
692
+ $shippingDuration++;
693
+ }
694
+
695
  /**
696
  * If the delivery day is a monday, we need to make sure that sunday sorting is allowed. Otherwise delivery on a
697
  * monday is not possible.
698
  */
699
+ if ($deliveryDay == 1 && Mage::helper('postnl/deliveryOptions')->canUseSundaySorting()) {
700
+ $orderTime = $orderDate->format('His');
701
  $sundayCutOffTime = Mage::getStoreConfig(self::XPATH_SUNDAY_CUTOFF_TIME, $storeId);
702
+
703
  if ($orderTime <= str_replace(':', '', $sundayCutOffTime)) {
704
  $deliveryTime->add(new DateInterval('P1D'));
705
  $shippingDuration++;
706
  }
707
+ } elseif ($deliveryDay == 1) {
708
+ $deliveryTime->add(new DateInterval('P1D'));
709
+ $shippingDuration++;
710
  }
711
 
712
  if ($asDays) {
713
  return $shippingDuration;
714
  }
715
 
716
+ if ($asDateTime) {
717
+ if (!$withTime) {
718
+ $deliveryTime->setTime(0, 0, 0);
719
+ }
720
+ return $deliveryTime;
721
+ }
722
+
723
  $deliveryDate = $deliveryTime->format('Y-m-d');
724
  return $deliveryDate;
725
  }
726
 
727
+ /**
728
+ * Check if a given delivery date is available by checking the configured shipping dates.
729
+ *
730
+ * @param string|DateTime $deliveryDate
731
+ *
732
+ * @return DateTime
733
+ *
734
+ * @todo implement sunday sorting
735
+ */
736
+ public function getValidDeliveryDate($deliveryDate)
737
+ {
738
+ if (is_string($deliveryDate)) {
739
+ $deliveryDate = new DateTime($deliveryDate);
740
+ }
741
+
742
+ if (!($deliveryDate instanceof DateTime)) {
743
+ throw new InvalidArgumentException('Date parameter must be a valid date string or DateTime object.');
744
+ }
745
+
746
+ $deliveryDay = $deliveryDate->format('N');
747
+
748
+ /**
749
+ * Get the configured shipping days.
750
+ */
751
+ $shippingDays = Mage::getStoreConfig(self::XPATH_SHIPPING_DAYS, Mage::app()->getStore()->getId());
752
+ $shippingDays = explode(',', $shippingDays);
753
+ $shippingDate = clone $deliveryDate;
754
+
755
+ $shippingDay = (int) $shippingDate->sub(new DateInterval('P1D'))->format('N');
756
+ /**
757
+ * Shipping is only available on monday through saturday.
758
+ */
759
+ if ($shippingDay < 1 || $shippingDay > 6) {
760
+ $shippingDay = 6;
761
+ }
762
+
763
+ /**
764
+ * If the shipping day is allowed, return the date.
765
+ */
766
+ if (in_array($shippingDay, $shippingDays)) {
767
+ return $deliveryDate;
768
+ }
769
+
770
+ /**
771
+ * If the delivery day is a tuesday, saturday is a valid shipping day and the first possible delivery day is the
772
+ * date specified or before then, the specified date is allowed.
773
+ *
774
+ * If we have configured that we do not ship on mondays, the following will take place:
775
+ * - If the order on friday or before, we can ship on saturday and it will be delivered on tuesday.
776
+ * - If we order on saturday and it is before the cut-off time, we can ship on saturday and it will be delivered
777
+ * on tuesday.
778
+ * - If we order on sunday or monday, we can only ship it the next saturday and it will be delivered on tuesday
779
+ * the week after.
780
+ */
781
+ if ($deliveryDay == 2
782
+ && in_array(6, $shippingDays)
783
+ && $this->getDeliveryDate(null, null, false, true, false) <= $deliveryDate
784
+ ) {
785
+ return $deliveryDate;
786
+ }
787
+
788
+ $dayArr = array(
789
+ 1 => 'monday',
790
+ 2 => 'tuesday',
791
+ 3 => 'wednesday',
792
+ 4 => 'thursday',
793
+ 5 => 'friday',
794
+ 6 => 'saturday',
795
+ 7 => 'sunday'
796
+ );
797
+
798
+ /**
799
+ * If a higher day is available, use that. I.e. the requested date is on a thursday and only friday is
800
+ * available.
801
+ */
802
+ natsort($shippingDays);
803
+ foreach ($shippingDays as $availableShippingDay) {
804
+ /**
805
+ * Skip all shipping days that are earlier than the desired shipping day.
806
+ */
807
+ if ($availableShippingDay < $shippingDay) {
808
+ continue;
809
+ }
810
+
811
+ /**
812
+ * The delivery day is always the day after the shipping day.
813
+ */
814
+ $availableDeliveryDay = $availableShippingDay + 1;
815
+
816
+ /**
817
+ * Monday and sunday are not available as delivery days.
818
+ */
819
+ if ($availableDeliveryDay < 2 || $availableDeliveryDay > 6) {
820
+ $availableDeliveryDay = 2;
821
+ }
822
+
823
+ /**
824
+ * Convert the delivery day of the week to the actual date.
825
+ */
826
+ $availableDeliveryDate = $deliveryDate->modify("next {$dayArr[$availableDeliveryDay]}");
827
+ return $availableDeliveryDate;
828
+ }
829
+
830
+ /**
831
+ * If no higher value was available, get the first possible shipping day next week.
832
+ *
833
+ * Sort the array and get the first element.
834
+ */
835
+ $availableDeliveryDay = $shippingDays[0] + 1;
836
+
837
+ /**
838
+ * Monday and sunday are not available as delivery days.
839
+ */
840
+ if ($availableDeliveryDay < 2 || $availableDeliveryDay > 6) {
841
+ $availableDeliveryDay = 2;
842
+ }
843
+
844
+ /**
845
+ * Convert the delivery day of the week to the actual date.
846
+ */
847
+ $availableDeliveryDate = $deliveryDate->modify("next {$dayArr[$availableDeliveryDay]}");
848
+ return $availableDeliveryDate;
849
+ }
850
+
851
+ /**
852
+ * Check if a given confirm date is valid and modify it if not.
853
+ *
854
+ * Currently this method only checks if the confirm date is a monday. If so it may need to be modified to a
855
+ * saturday.
856
+ *
857
+ * @param string|DateTime $date
858
+ *
859
+ * @return DateTime
860
+ */
861
+ public function getValidConfirmDate($date)
862
+ {
863
+ if (is_string($date)) {
864
+ $date = new DateTime($date);
865
+ }
866
+
867
+ if (!($date instanceof DateTime)) {
868
+ throw new InvalidArgumentException('Date parameter must be a valid date string or DateTime object.');
869
+ }
870
+
871
+ /**
872
+ * Get the configured shipping days.
873
+ */
874
+ $shippingDays = Mage::getStoreConfig(self::XPATH_SHIPPING_DAYS, Mage::app()->getStore()->getId());
875
+ $shippingDays = explode(',', $shippingDays);
876
+ $shippingDate = clone $date;
877
+
878
+ /**
879
+ * Get the current shipping day of the week (1 through 7).
880
+ */
881
+ $shippingDay = (int) $shippingDate->format('N');
882
+
883
+ /**
884
+ * Check fit he shipping day is a monday. If so, check if monday is allowed. If not, modify it to the previous
885
+ * saturday if saturdays are allowed.
886
+ */
887
+ if (!in_array($shippingDay, $shippingDays)
888
+ && $shippingDay == 1
889
+ && in_array(6, $shippingDays)
890
+ ) {
891
+ $date->modify('last saturday');
892
+ }
893
+
894
+ return $date;
895
+ }
896
+
897
  /**
898
  * Get the first possible delivery date as determined by PostNL.
899
  *
1001
  $durationArray = array($configDuration);
1002
 
1003
  /**
1004
+ * Get all items in the quote, so we can check the corresponding products.
1005
  *
1006
  * @var Mage_Sales_Model_Quote_Item $item
1007
  */
1008
+ $items = $quote->getItemsCollection();
1009
+ foreach ($items as $key => $item) {
1010
+ if ($item->isDeleted() || $item->getParentItemId()) {
1011
+ $items->removeItemByKey($key);
1012
+ }
1013
+ }
1014
+ $productIds = $items->getColumnValues('product_id');
1015
 
1016
+ if (!$productIds) {
1017
+ $duration = new Varien_Object(
1018
+ array(
1019
+ 'duration' => end($durationArray),
1020
+ 'productIds' => $productIds
1021
+ )
1022
+ );
1023
+
1024
+ Mage::dispatchEvent(
1025
+ 'postnl_delivery_options_getshippingduration',
1026
+ array(
1027
+ 'duration' => $duration
1028
+ )
1029
+ );
1030
+ return $duration->getData('duration');
1031
+ }
1032
+
1033
+ /**
1034
+ * Get all products.
1035
+ */
1036
+ $products = Mage::getResourceModel('catalog/product_collection')
1037
+ ->setStoreId($quote->getStoreId())
1038
+ ->addFieldToFilter('entity_id', array('in' => $productIds))
1039
+ ->addAttributeToSelect('postnl_shipping_duration');
1040
+
1041
+ /**
1042
+ * Get the shipping duration of all products.
1043
+ */
1044
+ foreach ($products as $product) {
1045
  if ($product->hasData('postnl_shipping_duration')
1046
  && $product->getData('postnl_shipping_duration') !== ''
1047
  ) {
1053
  * Sort the array and get it's last item. This will be the highest value.
1054
  */
1055
  natsort($durationArray);
1056
+ $duration = new Varien_Object(
1057
+ array(
1058
+ 'duration' => end($durationArray),
1059
+ 'productIds' => $productIds
1060
+ )
1061
+ );
1062
+
1063
+ Mage::dispatchEvent(
1064
+ 'postnl_delivery_options_getshippingduration',
1065
+ array(
1066
+ 'duration' => $duration
1067
+ )
1068
+ );
1069
+
1070
+ $shippingDuration = $duration->getData('duration');
1071
 
1072
  /**
1073
  * Make sure the value is between 1 and 14 days.
1202
  return false;
1203
  }
1204
 
1205
+ /**
1206
+ * Check whether the responsive design may be used for delivery options.
1207
+ *
1208
+ * @return bool
1209
+ */
1210
+ public function canUseResponsive()
1211
+ {
1212
+ $cache = $this->getCache();
1213
+ if ($cache && $cache->hasCanUseResponsiveDeliveryOptions()) {
1214
+ return $cache->getCanUseResponsiveDeliveryOptions();
1215
+ }
1216
+
1217
+ $canUseResponsive = Mage::getStoreConfigFlag(self::XPATH_RESPONSIVE, Mage::app()->getStore()->getId());
1218
+
1219
+ if ($cache) {
1220
+ $cache->setCanUseResponsiveDeliveryOptions($canUseResponsive);
1221
+ }
1222
+
1223
+ return $canUseResponsive;
1224
+ }
1225
+
1226
  /**
1227
  * Checks if PakjeGemak is available.
1228
  *
1318
  * If the current quote fits as a letter box parcel and the calculation mode is set to 'automatic', check if
1319
  * these options are available for letter box parcel orders.
1320
  */
1321
+ if ($this->quoteIsBuspakje($quote)
1322
  && !$this->canShowPakjeGemakForBuspakje($quote)
1323
  ) {
1324
  Mage::register($registryKey, false);
1554
  * If the current quote fits as a letter box parcel and the calculation mode is set to 'automatic', check if
1555
  * these options are available for letter box parcel orders.
1556
  */
1557
+ if ($this->quoteIsBuspakje($quote)
1558
  && !$this->canShowPakketAutomaatForBuspakje($quote)
1559
  ) {
1560
  Mage::register($registryKey, false);
1708
  * If the current quote fits as a letter box parcel and the calculation mode is set to 'automatic', check if
1709
  * these options are available for letter box parcel orders.
1710
  */
1711
+ if ($this->quoteIsBuspakje($quote)
1712
  && !$this->canShowDeliveryDaysForBuspakje($quote)
1713
  ) {
1714
  Mage::register($registryKey, false);
1838
  }
1839
 
1840
  /**
1841
+ * If the current quote fits as a letter box parcel and the calculation mode is set to 'automatic', timeframes
1842
+ * are not allowed.
1843
  */
1844
+ if ($this->quoteIsBuspakje($quote)) {
 
 
1845
  Mage::register($registryKey, false);
1846
  return false;
1847
  }
2083
  * Check if the current quote is a letter box parcel order and if so, if delivery options are allowed for letter
2084
  * box parcel orders.
2085
  */
2086
+ if ($this->quoteIsBuspakje($quote)
2087
  && !$this->canShowDeliveryOptionsForBuspakje($quote)
2088
  ) {
2089
  $errors = array(
2188
  return true;
2189
  }
2190
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2191
  /**
2192
  * Checks if delivery options are disabled for letter box parcel orders.
2193
  *
2421
  }
2422
 
2423
  /**
2424
+ * Check whether showing the 'only_stated_address' option is allowed.
2425
  *
2426
+ * @param boolean $checkQuote
2427
  *
2428
  * @return boolean
2429
  */
2430
+ public function canShowOnlyStatedAddressOption($checkQuote = true)
2431
+ {
2432
+ /**
2433
+ * Form a unique registry key for the current quote (if available) so we can cache the result of this method in
2434
+ * the registry.
2435
+ */
2436
+ $registryKey = 'can_show_only_stated_address_option';
2437
+
2438
+ $quote = $this->getQuote();
2439
+ if ($quote) {
2440
+ $registryKey .= '_' . $quote->getId();
2441
+ }
2442
+
2443
+ /**
2444
+ * Check if the result of this method has been cached in the registry.
2445
+ */
2446
+ if (Mage::registry($registryKey) !== null) {
2447
+ return Mage::registry($registryKey);
2448
+ }
2449
+
2450
+ if ($checkQuote) {
2451
+ /**
2452
+ * Check if these options are allowed for this specific quote.
2453
+ */
2454
+ $canUseForQuote = $this->_canShowOnlyStatedAddressOptionForQuote();
2455
+
2456
+ if (!$canUseForQuote) {
2457
+ Mage::register($registryKey, false);
2458
+ return false;
2459
+ }
2460
+ }
2461
+
2462
+ $cache = $this->getCache();
2463
+
2464
+ if ($cache && $cache->hasCanShowOnlyStatedAddressOption()) {
2465
+ /**
2466
+ * Check if the result of this method has been cached in the PostNL cache.
2467
+ */
2468
+ $allowed = $cache->getCanShowOnlyStatedAddressOption();
2469
+
2470
+ Mage::register($registryKey, $allowed);
2471
+ return $allowed;
2472
+ }
2473
+
2474
+ $allowed = $this->_canShowOnlyStatedAddressOption();
2475
+
2476
+ if ($cache) {
2477
+ /**
2478
+ * Save the result in the PostNL cache.
2479
+ */
2480
+ $cache->setCanShowOnlyStatedAddressOption($allowed)
2481
+ ->saveCache();
2482
+ }
2483
+
2484
+ Mage::register($registryKey, $allowed);
2485
+ return $allowed;
2486
+ }
2487
+
2488
+ /**
2489
+ * Check if the 'only_stated_address' option can be shown for the current quote.
2490
+ *
2491
+ * @return bool
2492
+ */
2493
+ protected function _canShowOnlyStatedAddressOptionForQuote()
2494
  {
2495
+ $quote = $this->getQuote();
2496
+
2497
+ /**
2498
+ * Form a unique registry key for the current quote (if available) so we can cache the result of this method in
2499
+ * the registry.
2500
+ */
2501
+ $registryKey = 'can_show_only_stated_address_option_for_quote_' . $quote->getId();
2502
+
2503
  /**
2504
  * Check if the result of this method has been cached in the registry.
2505
  */
2506
+ if (Mage::registry($registryKey) !== null) {
2507
+ return Mage::registry($registryKey);
2508
+ }
2509
+
2510
+ /**
2511
+ * This option is only available for Dutch shipments.
2512
+ */
2513
+ $shippingAddress = $quote->getShippingAddress();
2514
+ if ($shippingAddress->getCountryId() != 'NL') {
2515
+ Mage::register($registryKey, false);
2516
+ return false;
2517
  }
2518
 
2519
+ /**
2520
+ * This shipment cannot be used for buspakje shipments.
2521
+ */
2522
+ if ($this->quoteIsBuspakje($quote)) {
2523
+ Mage::register($registryKey, false);
2524
+ return false;
2525
+ }
2526
+
2527
+ Mage::register($registryKey, true);
2528
+ return true;
2529
+ }
2530
+
2531
+ /**
2532
+ * Check if the 'only_stated_address' option can be shown for the current config.
2533
+ *
2534
+ * @return bool
2535
+ */
2536
+ protected function _canShowOnlyStatedAddressOption()
2537
+ {
2538
+ $showOption = Mage::getStoreConfigFlag(
2539
+ self::XPATH_STATED_ADDRESS_ONLY_OPTION,
2540
+ Mage::app()->getStore()->getId()
2541
+ );
2542
+
2543
+ if (!$showOption) {
2544
+ return false;
2545
+ }
2546
+
2547
+ /**
2548
+ * Check if any valid product options are available.
2549
+ */
2550
+ $statedAddressOnlyOptions = Mage::getSingleton('postnl_core/system_config_source_allProductOptions')
2551
+ ->getOptions(array('statedAddressOnly' => true), true, true);
2552
+
2553
+ if (empty($statedAddressOnlyOptions)) {
2554
+ return false;
2555
  }
2556
 
2557
+ return true;
2558
+ }
2559
 
2560
+ /**
2561
+ * Check if the 'only_stated_address' option should be checked by default.
2562
+ *
2563
+ * @return bool
2564
+ */
2565
+ public function isOnlyStatedAddressOptionChecked()
2566
+ {
2567
+ $isOnlyStatedAddressOptionChecked = Mage::getStoreConfigFlag(
2568
+ self::XPATH_STATED_ADDRESS_ONLY_CHECKED,
2569
+ Mage::app()->getStore()->getId()
2570
+ );
2571
+
2572
+ return $isOnlyStatedAddressOptionChecked;
2573
+ }
2574
+
2575
+ /**
2576
+ * Check if the module is set to test mode
2577
+ *
2578
+ * @param bool $storeId
2579
+ *
2580
+ * @return boolean
2581
+ *
2582
+ * @deprecated v1.5.0
2583
+ */
2584
+ public function isTestMode($storeId = false)
2585
+ {
2586
+ return parent::isTestMode($storeId);
2587
  }
2588
 
2589
  /**
2703
  $storeId = Mage::app()->getStore()->getId();
2704
  }
2705
 
2706
+ $checkoutExtension = Mage::getStoreConfig(
2707
+ TIG_PostNL_Helper_AddressValidation::XPATH_CHECKOUT_EXTENSION,
2708
+ $storeId
2709
+ );
2710
+
2711
+ if (!$checkoutExtension || $checkoutExtension == 'other') {
2712
+ return false;
2713
+ }
2714
+
2715
  $isActive = Mage::getStoreConfigFlag(self::XPATH_DELIVERY_OPTIONS_ACTIVE, $storeId);
2716
 
2717
  return $isActive;
app/code/community/TIG/PostNL/Helper/Mijnpakket.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Helper_Mijnpakket extends TIG_PostNL_Helper_Data
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Helper_Mijnpakket extends TIG_PostNL_Helper_Data
app/code/community/TIG/PostNL/Helper/Parcelware.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Helper_Parcelware extends TIG_PostNL_Helper_Data
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Helper_Parcelware extends TIG_PostNL_Helper_Data
app/code/community/TIG/PostNL/Helper/Payment.php CHANGED
@@ -25,19 +25,19 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
  * @category TIG
37
  * @package TIG_PostNL
38
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
39
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
40
- * @link http://store.totalinternetgroup.nl/tig/postnl.html
41
  */
42
  class TIG_PostNL_Helper_Payment extends TIG_PostNL_Helper_Data
43
  {
@@ -56,6 +56,11 @@ class TIG_PostNL_Helper_Payment extends TIG_PostNL_Helper_Data
56
  */
57
  const POSTNL_DEBUG_LOG_FILE = 'TIG_PostNL_Payment_Debug.log';
58
 
 
 
 
 
 
59
  /**
60
  * An array of PostNL COD payment methods.
61
  *
@@ -65,6 +70,33 @@ class TIG_PostNL_Helper_Payment extends TIG_PostNL_Helper_Data
65
  'postnl_cod',
66
  );
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  /**
69
  * Gets an array of PostNL COD payment methods.
70
  *
@@ -93,12 +125,7 @@ class TIG_PostNL_Helper_Payment extends TIG_PostNL_Helper_Data
93
  }
94
 
95
  /**
96
- * Add PostNL COD fee tax info to the full tax info array.
97
- *
98
- * This is a really annoying hack to fix the problem where the full tax info does not include the custom PostNL COD
99
- * fee tax info. Magento only supports tax info from shipping tax or product tax by default
100
- * (see Mage_Tax_Helper_Data::getCalculatedTaxes()). If anybody knows of a better way to fix this (that does not
101
- * require a core rewrite) please let us know at servicedesk@totalinternetgroup.nl.
102
  *
103
  * @param array $fullInfo
104
  * @param Mage_Sales_Model_Order|Mage_Sales_Model_Order_Invoice|Mage_Sales_Model_Order_Creditmemo $source
@@ -106,195 +133,11 @@ class TIG_PostNL_Helper_Payment extends TIG_PostNL_Helper_Data
106
  *
107
  * @return array
108
  *
109
- * @see Mage_Tax_Helper_Data::getCalculatedTaxes()
110
  */
111
  public function addPostnlCodFeeTaxInfo($fullInfo, $source, Mage_Sales_Model_Order $order)
112
  {
113
- $feeTax = (float) $order->getPostnlCodFeeTax();
114
- if ($feeTax <= 0) {
115
- return $fullInfo;
116
- }
117
-
118
- /**
119
- * There are 3 possible ways to add the COD fee tax info:
120
- * - Go through all tax info records of an order and add the COD fee info to the record with the same title and
121
- * a discrepancy in the recorded and expected amount.
122
- * - Add a missing tax info record.
123
- * - Recalculate the tax info for the COD fee and update the amount of the tax record with the same title.
124
- */
125
- $orderClassName = Mage::getConfig()->getModelClassName('sales/order');
126
- if ($source instanceof $orderClassName) {
127
- $fullInfo = $this->_updateTaxAmountForTaxInfo($order, $fullInfo);
128
- } else {
129
- /**
130
- * Try to find a tax record that does not have a corresponding tax item record.
131
- */
132
- $taxItemCollection = Mage::getResourceModel('tax/sales_order_tax_item_collection');
133
- $taxItemCollection->addFieldToSelect('tax_id');
134
- $taxItemCollection->getSelect()->distinct();
135
-
136
- $taxItemIds = $taxItemCollection->getColumnValues('tax_id');
137
-
138
- $taxCollection = Mage::getResourceModel('sales/order_tax_collection')
139
- ->addFieldToFilter('order_id', array('eq' => $order->getId()))
140
- ->addFieldToFilter('tax_id', array('nin' => $taxItemIds));
141
-
142
- /**
143
- * If we have found a missing record, we need to add it with the COD fee tax info. Otherwise we need to
144
- * recreate the entire tax request for the COD fee tax so we can match the title to an existing tax item
145
- * record.
146
- */
147
- if ($taxCollection->getSize()) {
148
- $fullInfo = $this->_addPostnlCodFeeTaxInfoFromCollection($taxCollection, $fullInfo, $source);
149
- } else {
150
- $fullInfo = $this->_addPostnlCodFeeTaxInfoFromRequest($order, $fullInfo, $source);
151
- }
152
- }
153
-
154
- return $fullInfo;
155
- }
156
-
157
- /**
158
- * Add PostNL COD fee tax info by updating an incorrect tax record.
159
- *
160
- * @param Mage_Sales_Model_Order $order
161
- * @param array $fullInfo
162
- *
163
- * @return array
164
- */
165
- protected function _updateTaxAmountForTaxInfo($order, $fullInfo)
166
- {
167
- $taxCollection = Mage::getResourceModel('sales/order_tax_collection')
168
- ->addFieldToSelect('amount')
169
- ->addFieldToFilter('order_id', array('eq' => $order->getId()));
170
-
171
- /**
172
- * Go through each tax record and update the tax info entry that has the same title, but a different amount.
173
- */
174
- foreach ($taxCollection as $tax) {
175
- foreach ($fullInfo as $key => $taxInfo) {
176
- if ($tax->getTitle() == $taxInfo['title'] && $tax->getAmount() != $taxInfo['tax_amount']) {
177
- /**
178
- * Update the amounts.
179
- */
180
- $fullInfo[$key]['tax_amount'] = $tax->getAmount();
181
- $fullInfo[$key]['base_tax_amount'] = $tax->getBaseAmount();
182
- }
183
- }
184
- }
185
-
186
- return $fullInfo;
187
- }
188
-
189
- /**
190
- * Add PostNL COD fee tax info by updating or adding a missing tax record.
191
- *
192
- * @param Mage_Sales_Model_Resource_Order_Tax_Collection $taxCollection
193
- * @param array $fullInfo
194
- * @param Mage_Sales_Model_Order_Invoice|Mage_Sales_Model_Order_Creditmemo $source
195
- *
196
- * @return array
197
- */
198
- protected function _addPostnlCodFeeTaxInfoFromCollection($taxCollection, $fullInfo, $source)
199
- {
200
- /**
201
- * Go through all tax records and add the COD fee tax to the entry that has the right title. If no entry exists
202
- * with that title, add it.
203
- */
204
- foreach ($taxCollection as $tax) {
205
- foreach ($fullInfo as $key => $taxInfo) {
206
- /**
207
- * Update an existing entry.
208
- */
209
- if ($taxInfo['title'] == $tax->getTitle()) {
210
- $fullInfo[$key]['tax_amount'] += $source->getPostnlCodFeeTax();
211
- $fullInfo[$key]['base_tax_amount'] += $source->getBasePostnlCodFeeTax();
212
-
213
- break(2);
214
- }
215
- }
216
-
217
- /**
218
- * Add a missing entry.
219
- */
220
- $fullInfo[] = array(
221
- 'tax_amount' => $source->getPostnlCodFeeTax(),
222
- 'base_tax_amount' => $source->getBasePostnlCodFeeTax(),
223
- 'title' => $tax->getTitle(),
224
- 'percent' => $tax->getPercent(),
225
- );
226
- }
227
-
228
- return $fullInfo;
229
- }
230
-
231
- /**
232
- * Add PostNL COD fee tax info by recreating the tax request.
233
- *
234
- * @param Mage_Sales_Model_Order $order
235
- * @param array $fullInfo
236
- * @param Mage_Sales_Model_Order_Invoice|Mage_Sales_Model_Order_Creditmemo $source
237
- *
238
- * @return array
239
- */
240
- protected function _addPostnlCodFeeTaxInfoFromRequest($order, $fullInfo, $source)
241
- {
242
- $store = $order->getStore();
243
- $taxCalculation = Mage::getSingleton('tax/calculation');
244
-
245
- /**
246
- * Recalculate the tax request.
247
- */
248
- $customerTaxClass = $order->getCustomerTaxClassId();
249
- $shippingAddress = $order->getShippingAddress();
250
- $billingAddress = $order->getBillingAddress();
251
- $codTaxClass = Mage::getStoreConfig(self::XPATH_COD_FEE_TAX_CLASS, $store);
252
-
253
- $taxRequest = $taxCalculation->getRateRequest(
254
- $shippingAddress,
255
- $billingAddress,
256
- $customerTaxClass,
257
- $store
258
- );
259
-
260
- $taxRequest->setProductClassId($codTaxClass);
261
-
262
- /**
263
- * If the tax request fails, there is nothing more we can do. This might occur, if the tax rules have been
264
- * changed since this order was placed. Unfortunately there is nothing we can do about this.
265
- */
266
- if (!$taxRequest) {
267
- return $fullInfo;
268
- }
269
-
270
- /**
271
- * Get the applied rates.
272
- */
273
- $appliedRates = Mage::getSingleton('tax/calculation')
274
- ->getAppliedRates($taxRequest);
275
-
276
- if (!isset($appliedRates[0]['rates'][0]['title'])) {
277
- return $fullInfo;
278
- }
279
-
280
- /**
281
- * Get the tax title from the applied rates.
282
- */
283
- $postnlCodFeeTaxTitle = $appliedRates[0]['rates'][0]['title'];
284
-
285
- /**
286
- * Fo through all tax info entries and try to match the title.
287
- */
288
- foreach ($fullInfo as $key => $taxInfo) {
289
- if ($taxInfo['title'] == $postnlCodFeeTaxTitle) {
290
- /**
291
- * Update the tax info entry with the COD fee tax.
292
- */
293
- $fullInfo[$key]['tax_amount'] += $source->getPostnlCodFeeTax();
294
- $fullInfo[$key]['base_tax_amount'] += $source->getBasePostnlCodFeeTax();
295
- break;
296
- }
297
- }
298
 
299
  return $fullInfo;
300
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
  * @category TIG
37
  * @package TIG_PostNL
38
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
39
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
40
+ * @link http://store.tig.nl/tig/postnl.html
41
  */
42
  class TIG_PostNL_Helper_Payment extends TIG_PostNL_Helper_Data
43
  {
56
  */
57
  const POSTNL_DEBUG_LOG_FILE = 'TIG_PostNL_Payment_Debug.log';
58
 
59
+ /**
60
+ * @var TIG_PostNL_Model_Payment_Service
61
+ */
62
+ protected $_serviceModel;
63
+
64
  /**
65
  * An array of PostNL COD payment methods.
66
  *
70
  'postnl_cod',
71
  );
72
 
73
+ /**
74
+ * @return TIG_PostNL_Model_Payment_Service
75
+ */
76
+ public function getServiceModel()
77
+ {
78
+ if ($this->_serviceModel) {
79
+ return $this->_serviceModel;
80
+ }
81
+
82
+ $serviceModel = Mage::getModel('postnl_payment/service');
83
+
84
+ $this->setServiceModel($serviceModel);
85
+ return $serviceModel;
86
+ }
87
+
88
+ /**
89
+ * @param TIG_PostNL_Model_Payment_Service $serviceModel
90
+ *
91
+ * @return $this
92
+ */
93
+ public function setServiceModel(TIG_PostNL_Model_Payment_Service $serviceModel)
94
+ {
95
+ $this->_serviceModel = $serviceModel;
96
+
97
+ return $this;
98
+ }
99
+
100
  /**
101
  * Gets an array of PostNL COD payment methods.
102
  *
125
  }
126
 
127
  /**
128
+ * Alias for TIG_PostNL_Model_Payment_Service::addPostnlCodFeeTaxInfo()
 
 
 
 
 
129
  *
130
  * @param array $fullInfo
131
  * @param Mage_Sales_Model_Order|Mage_Sales_Model_Order_Invoice|Mage_Sales_Model_Order_Creditmemo $source
133
  *
134
  * @return array
135
  *
136
+ * @see TIG_PostNL_Model_Payment_Service::addPostnlCodFeeTaxInfo()
137
  */
138
  public function addPostnlCodFeeTaxInfo($fullInfo, $source, Mage_Sales_Model_Order $order)
139
  {
140
+ $fullInfo = $this->getServiceModel()->addPostnlCodFeeTaxInfo($fullInfo, $source, $order);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
 
142
  return $fullInfo;
143
  }
app/code/community/TIG/PostNL/Helper/Webservices.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
 
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
 
app/code/community/TIG/PostNL/Model/AddressValidation/Cendris.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_AddressValidation_Cendris extends TIG_PostNL_Model_AddressValidation_Cendris_Abstract
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_AddressValidation_Cendris extends TIG_PostNL_Model_AddressValidation_Cendris_Abstract
app/code/community/TIG/PostNL/Model/AddressValidation/Cendris/Abstract.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  advanced * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_AddressValidation_Cendris_Abstract extends Varien_Object
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  advanced * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_AddressValidation_Cendris_Abstract extends Varien_Object
app/code/community/TIG/PostNL/Model/AddressValidation/Observer/AddressBook.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasAddressBlockClass()
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasAddressBlockClass()
app/code/community/TIG/PostNL/Model/AddressValidation/Observer/OneStepCheckout.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasAddressBlockClass()
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasAddressBlockClass()
app/code/community/TIG/PostNL/Model/AddressValidation/Observer/Onepage.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasBillingAddressBlockClass()
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasBillingAddressBlockClass()
app/code/community/TIG/PostNL/Model/AddressValidation/System/Config/Backend/ValidateAccount.php CHANGED
@@ -25,16 +25,26 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
 
 
 
 
 
 
 
 
 
 
38
  */
39
  class TIG_PostNL_Model_AddressValidation_System_Config_Backend_ValidateAccount extends Mage_Core_Model_Config_Data
40
  {
@@ -148,7 +158,9 @@ class TIG_PostNL_Model_AddressValidation_System_Config_Backend_ValidateAccount e
148
  );
149
 
150
  /**
151
- * Load the CIF model and set to test mode to false
 
 
152
  */
153
  $cif = Mage::getModel('postnl_core/cif')
154
  ->setTestMode($testMode);
@@ -184,7 +196,12 @@ class TIG_PostNL_Model_AddressValidation_System_Config_Backend_ValidateAccount e
184
  */
185
  protected function _getIsTestMode()
186
  {
187
- $cifTestMode = (bool) $this->_getConfigValue(self::XPATH_MODE);
 
 
 
 
 
188
 
189
  return $cifTestMode;
190
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ *
39
+ * @method boolean hasStoreId()
40
+ * @method boolean hasWebsite()
41
+ *
42
+ * @method string getStoreCode()
43
+ * @method string getWebsiteCode()
44
+ * @method array getGroups()
45
+ *
46
+ * @method TIG_PostNL_Model_AddressValidation_System_Config_Backend_ValidateAccount setStoreId(int $value)
47
+ * @method TIG_PostNL_Model_AddressValidation_System_Config_Backend_ValidateAccount setWebsite(Mage_Core_Model_Website $value)
48
  */
49
  class TIG_PostNL_Model_AddressValidation_System_Config_Backend_ValidateAccount extends Mage_Core_Model_Config_Data
50
  {
158
  );
159
 
160
  /**
161
+ * Load the CIF model and set to test mode to false.
162
+ *
163
+ * @var TIG_PostNL_Model_Core_Cif $cif
164
  */
165
  $cif = Mage::getModel('postnl_core/cif')
166
  ->setTestMode($testMode);
196
  */
197
  protected function _getIsTestMode()
198
  {
199
+ $cifTestMode = false;
200
+ $cifMode = $this->_getConfigValue(self::XPATH_MODE);
201
+
202
+ if ($cifMode !== '2') {
203
+ $cifTestMode = true;
204
+ }
205
 
206
  return $cifTestMode;
207
  }
app/code/community/TIG/PostNL/Model/Admin/Inbox.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * The only reason this class exists is because the add() method and it's derivatives are only present since EE 1.12 and
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * The only reason this class exists is because the add() method and it's derivatives are only present since EE 1.12 and
app/code/community/TIG/PostNL/Model/Admin/Logging/Handler/Postnl.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Admin_Logging_Handler_Postnl extends Enterprise_Logging_Model_Handler_Controllers
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Admin_Logging_Handler_Postnl extends Enterprise_Logging_Model_Handler_Controllers
app/code/community/TIG/PostNL/Model/Admin/Logging/Observer.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Admin_Logging_Observer
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Admin_Logging_Observer
app/code/community/TIG/PostNL/Model/Adminhtml/Form/Element/Checkbox.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Adminhtml_Form_Element_Checkbox extends Varien_Data_Form_Element_Checkbox
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Adminhtml_Form_Element_Checkbox extends Varien_Data_Form_Element_Checkbox
app/code/community/TIG/PostNL/Model/Adminhtml/Observer/OrderGrid.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * Observer to edit the sales > order grid
@@ -68,27 +68,27 @@ class TIG_PostNL_Model_Adminhtml_Observer_OrderGrid extends Varien_Object
68
  /**
69
  * XML path to show_grid_options setting.
70
  */
71
- const XPATH_SHOW_OPTIONS = 'postnl/cif_labels_and_confirming/show_grid_options';
72
 
73
  /**
74
  * XML path to show_buspakje_options setting.
75
  */
76
- const XPATH_SHOW_BUSPAKJE_OPTION = 'postnl/cif_labels_and_confirming/show_buspakje_option';
77
 
78
  /**
79
  * XML path to buspakje_calculation_mode setting.
80
  */
81
- const XPATH_BUSPAKJE_CALCULATION_MODE = 'postnl/cif_labels_and_confirming/buspakje_calculation_mode';
82
 
83
  /**
84
  * XML path to 'order grid columns' setting
85
  */
86
- const XPATH_ORDER_GRID_COLUMNS = 'postnl/cif_labels_and_confirming/order_grid_columns';
87
 
88
  /**
89
  * Xpath to the 'order_grid_massaction_default' setting.
90
  */
91
- const XPATH_ORDER_GRID_MASSACTION_DEFAULT = 'postnl/cif_labels_and_confirming/order_grid_massaction_default';
92
 
93
  /**
94
  * Edits the sales order grid by adding a mass action to create shipments for selected orders.
@@ -272,6 +272,7 @@ class TIG_PostNL_Model_Adminhtml_Observer_OrderGrid extends Varien_Object
272
  'is_pakje_gemak' => 'postnl_order.is_pakje_gemak',
273
  'is_pakketautomaat' => 'postnl_order.is_pakketautomaat',
274
  'delivery_option_type' => 'postnl_order.type',
 
275
  )
276
  );
277
 
@@ -435,13 +436,13 @@ class TIG_PostNL_Model_Adminhtml_Observer_OrderGrid extends Varien_Object
435
  $block->addColumnAfter(
436
  'confirm_date',
437
  array(
438
- 'type' => 'date',
439
- 'header' => $helper->__('Send date'),
440
- 'index' => 'confirm_date',
441
- 'filter_index' => 'postnl_order.confirm_date',
442
- 'renderer' => 'postnl_adminhtml/widget_grid_column_renderer_orderConfirmDate',
443
- 'width' => '150px',
444
- 'frame_callback' => array($this, 'decorateConfirmDate'),
445
  ),
446
  $after
447
  );
@@ -513,7 +514,10 @@ class TIG_PostNL_Model_Adminhtml_Observer_OrderGrid extends Varien_Object
513
 
514
  $class = $this->_getConfirmDateClass($value, $row, $column);
515
 
516
- return '<span class="'.$class.'"><span>'.$value.'</span></span>';
 
 
 
517
  }
518
 
519
  /**
@@ -614,7 +618,7 @@ class TIG_PostNL_Model_Adminhtml_Observer_OrderGrid extends Varien_Object
614
  return $values;
615
  }
616
 
617
- if (is_null($values)) {
618
  return '';
619
  }
620
 
@@ -787,6 +791,31 @@ class TIG_PostNL_Model_Adminhtml_Observer_OrderGrid extends Varien_Object
787
  );
788
  }
789
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
790
  /**
791
  * Make sure the admin is allowed to print packing slips and add the mass action.
792
  */
@@ -833,11 +862,11 @@ class TIG_PostNL_Model_Adminhtml_Observer_OrderGrid extends Varien_Object
833
  $showOptions = Mage::getStoreConfig(self::XPATH_SHOW_OPTIONS, $storeId);
834
 
835
  if ($showOptions) {
836
- $optionsModel = Mage::getModel('postnl_core/system_config_source_allProductOptions');
 
837
 
838
  /**
839
  * Add another dropdown containing the possible product options.
840
- * Mage_Adminhtml_Block_Widget_Grid_Massaction_Item_Additional_Default
841
  */
842
  $config = array(
843
  'postnl_use_default' => array(
@@ -847,186 +876,129 @@ class TIG_PostNL_Model_Adminhtml_Observer_OrderGrid extends Varien_Object
847
  'value' => 1,
848
  'checked' => 'checked',
849
  ),
850
- 'postnl_domestic_options' => array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
851
  'name' => 'product_options[domestic_options]',
852
  'type' => 'select',
853
- 'label' => $helper->__('Product options'),
854
- 'values' => $optionsModel->getOptions(
855
- array(
856
- 'group' => 'standard_options',
857
- 'isCod' => false,
858
- ),
859
- false,
860
- true
861
- ),
862
- ),
863
- 'postnl_avond_options' => array(
864
  'name' => 'product_options[avond_options]',
865
  'type' => 'select',
866
- 'label' => $helper->__('Product options'),
867
- 'values' => $optionsModel->getOptions(
868
- array(
869
- 'group' => 'standard_options',
870
- 'isCod' => false,
871
- 'isAvond' => true),
872
- false,
873
- true
874
- ),
875
- ),
876
- 'postnl_pg_options' => array(
877
  'name' => 'product_options[pg_options]',
878
  'type' => 'select',
879
- 'label' => $helper->__('Product options'),
880
- 'values' => $optionsModel->getOptions(
881
- array(
882
- 'group' => 'pakjegemak_options',
883
- 'isCod' => false,
884
- ),
885
- false,
886
- true
887
- ),
888
- ),
889
- 'postnl_pge_options' => array(
890
  'name' => 'product_options[pge_options]',
891
  'type' => 'select',
892
- 'class' => 'required-entry',
893
- 'label' => $helper->__('Product options'),
894
- 'values' => $optionsModel->getOptions(
895
- array(
896
- 'group' => 'pakjegemak_options',
897
- 'isCod' => false,
898
- 'isPge' => true,
899
- ),
900
- false,
901
- true
902
- ),
903
- ),
904
- 'postnl_eps_options' => array(
905
  'name' => 'product_options[eps_options]',
906
  'type' => 'select',
907
- 'label' => $helper->__('Product options'),
908
- 'values' => $optionsModel->getOptions(
909
- array(
910
- 'group' => 'eu_options',
911
- ),
912
- false,
913
- true
914
- ),
915
- ),
916
- 'postnl_globalpack_options' => array(
917
  'name' => 'product_options[globalpack_options]',
918
  'type' => 'select',
919
- 'label' => $helper->__('Product options'),
920
- 'values' => $optionsModel->getOptions(
921
- array(
922
- 'group' => 'global_options',
923
- ),
924
- false,
925
- true
926
- ),
927
- ),
928
- 'postnl_domestic_cod_options' => array(
929
  'name' => 'product_options[domestic_cod_options]',
930
  'type' => 'select',
931
- 'label' => $helper->__('Product options'),
932
- 'values' => $optionsModel->getOptions(
933
- array(
934
- 'group' => 'standard_options',
935
- 'isCod' => true,
936
- ),
937
- false,
938
- true
939
- ),
940
- ),
941
- 'postnl_avond_cod_options' => array(
942
  'name' => 'product_options[avond_cod_options]',
943
  'type' => 'select',
944
- 'label' => $helper->__('Product options'),
945
- 'values' => $optionsModel->getOptions(
946
- array(
947
- 'group' => 'standard_options',
948
- 'isCod' => true,
949
- 'isAvond' => true,
950
- ),
951
- false,
952
- true
953
- ),
954
- ),
955
- 'postnl_pg_cod_options' => array(
956
  'name' => 'product_options[pg_cod_options]',
957
  'type' => 'select',
958
- 'label' => $helper->__('Product options'),
959
- 'values' => $optionsModel->getOptions(
960
- array(
961
- 'group' => 'pakjegemak_options',
962
- 'isCod' => true,
963
- ),
964
- false,
965
- true
966
- ),
967
- ),
968
- 'postnl_pge_cod_options' => array(
969
  'name' => 'product_options[pge_cod_options]',
970
  'type' => 'select',
971
- 'label' => $helper->__('Product options'),
972
- 'values' => $optionsModel->getOptions(
973
- array(
974
- 'group' => 'pakjegemak_options',
975
- 'isCod' => true,
976
- 'isPge' => true,
977
- ),
978
- false,
979
- true
980
- ),
981
- ),
982
- 'postnl_pa_options' => array(
983
  'name' => 'product_options[pa_options]',
984
  'type' => 'select',
985
- 'label' => $helper->__('Product options'),
986
- 'values' => $optionsModel->getOptions(
987
- array(
988
- 'group' => 'pakketautomaat_options',
989
- ),
990
- false,
991
- true
992
- ),
993
- ),
994
- 'postnl_buspakje_options' => array(
995
  'name' => 'product_options[buspakje_options]',
996
  'type' => 'select',
997
- 'class' => 'required-entry',
998
- 'label' => $helper->__('Product options'),
999
- 'values' => $optionsModel->getOptions(
1000
- array(
1001
- 'group' => 'buspakje_options',
1002
- ),
1003
- false,
1004
- true
1005
- ),
1006
- ),
1007
- );
1008
-
1009
- $buspakjeCalculationMode = Mage::getStoreConfig(self::XPATH_BUSPAKJE_CALCULATION_MODE, $storeId);
1010
- $showBuspakjeOptions = Mage::getStoreConfigFlag(self::XPATH_SHOW_BUSPAKJE_OPTION, $storeId);
1011
- if ($helper->canUseBuspakje()
1012
- && $buspakjeCalculationMode == 'manual'
1013
- && $showBuspakjeOptions
1014
- ) {
1015
- $buspakjeConfig = array(
1016
- 'postnl_is_buspakje' => array(
1017
- 'name' => 'product_options[is_buspakje]',
1018
- 'type' => 'postnl_checkbox',
1019
- 'label' => $helper->__('Is letter box parcel'),
1020
- 'value' => 1,
1021
- ),
1022
  );
1023
-
1024
- /**
1025
- * Insert the is_buspakje checkbox at the second position in the config array.
1026
- */
1027
- $config = array_slice($config, 0, 1, true)
1028
- + $buspakjeConfig
1029
- + array_slice($config, 1, count($config) - 1, true);
1030
  }
1031
 
1032
  /**
@@ -1035,12 +1007,121 @@ class TIG_PostNL_Model_Adminhtml_Observer_OrderGrid extends Varien_Object
1035
  $block = Mage::app()
1036
  ->getLayout()
1037
  ->createBlock('postnl_adminhtml/widget_grid_massaction_item_additional_productOptions');
 
1038
  $massActionData['additional'] = $block->createFromConfiguration($config);
1039
  }
1040
 
1041
  return $massActionData;
1042
  }
1043
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1044
  /**
1045
  * Gets mass action data for the full PostNL flow mass action.
1046
  *
@@ -1070,6 +1151,37 @@ class TIG_PostNL_Model_Adminhtml_Observer_OrderGrid extends Varien_Object
1070
  return $massActionData;
1071
  }
1072
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1073
  /**
1074
  * Gets mass action data for the printPackingSlips mass action.
1075
  *
@@ -1129,7 +1241,7 @@ class TIG_PostNL_Model_Adminhtml_Observer_OrderGrid extends Varien_Object
1129
  /**
1130
  * Adds new filters to the collection if these filters are based on columns added by this observer
1131
  *
1132
- * @param array $filter Array of filters to be added
1133
  *
1134
  * @return $this
1135
  */
@@ -1279,6 +1391,35 @@ class TIG_PostNL_Model_Adminhtml_Observer_OrderGrid extends Varien_Object
1279
  return $this;
1280
  }
1281
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1282
  /**
1283
  * Based on Mage_Adminhtml_Block_Widget_Grid::_addColumnFilterToCollection()
1284
  *
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * Observer to edit the sales > order grid
68
  /**
69
  * XML path to show_grid_options setting.
70
  */
71
+ const XPATH_SHOW_OPTIONS = 'postnl/grid/show_grid_options';
72
 
73
  /**
74
  * XML path to show_buspakje_options setting.
75
  */
76
+ const XPATH_SHOW_BUSPAKJE_OPTION = 'postnl/grid/show_buspakje_option';
77
 
78
  /**
79
  * XML path to buspakje_calculation_mode setting.
80
  */
81
+ const XPATH_BUSPAKJE_CALCULATION_MODE = 'postnl/delivery_options/buspakje_calculation_mode';
82
 
83
  /**
84
  * XML path to 'order grid columns' setting
85
  */
86
+ const XPATH_ORDER_GRID_COLUMNS = 'postnl/grid/order_grid_columns';
87
 
88
  /**
89
  * Xpath to the 'order_grid_massaction_default' setting.
90
  */
91
+ const XPATH_ORDER_GRID_MASSACTION_DEFAULT = 'postnl/grid/order_grid_massaction_default';
92
 
93
  /**
94
  * Edits the sales order grid by adding a mass action to create shipments for selected orders.
272
  'is_pakje_gemak' => 'postnl_order.is_pakje_gemak',
273
  'is_pakketautomaat' => 'postnl_order.is_pakketautomaat',
274
  'delivery_option_type' => 'postnl_order.type',
275
+ 'options' => 'postnl_order.options',
276
  )
277
  );
278
 
436
  $block->addColumnAfter(
437
  'confirm_date',
438
  array(
439
+ 'type' => 'date',
440
+ 'header' => $helper->__('Send date'),
441
+ 'index' => 'confirm_date',
442
+ 'filter_condition_callback' => array($this, '_filterConfirmDate'),
443
+ 'renderer' => 'postnl_adminhtml/widget_grid_column_renderer_orderConfirmDate',
444
+ 'width' => '150px',
445
+ 'frame_callback' => array($this, 'decorateConfirmDate'),
446
  ),
447
  $after
448
  );
514
 
515
  $class = $this->_getConfirmDateClass($value, $row, $column);
516
 
517
+ $origValue = $row->getData($column->getIndex());
518
+ $formattedDate = Mage::helper('core')->formatDate($origValue, 'full', false);
519
+
520
+ return '<span class="'.$class.'" title="' . $formattedDate . '"><span>'.$value.'</span></span>';
521
  }
522
 
523
  /**
618
  return $values;
619
  }
620
 
621
+ if (is_null($values) || $values === '') {
622
  return '';
623
  }
624
 
791
  );
792
  }
793
 
794
+ /**
795
+ * Make sure the admin is allowed to ship orders, print labels, print packing slips and confirm shipments. If
796
+ * so, add the massaction.
797
+ */
798
+ if ($helper->checkIsPostnlActionAllowed(
799
+ array(
800
+ 'create_shipment',
801
+ 'confirm',
802
+ 'print_label',
803
+ 'print_packing_slips',
804
+ )
805
+ )
806
+ ) {
807
+ $fullPostnlFlowPackingSlipMassActionData = $this->_getFullPostnlFlowPackingSlipMassAction();
808
+
809
+ /**
810
+ * Add the massaction.
811
+ */
812
+ $block->getMassactionBlock()
813
+ ->addItem(
814
+ 'postnl_create_shipment_print_packing_slip_and_confirm',
815
+ $fullPostnlFlowPackingSlipMassActionData
816
+ );
817
+ }
818
+
819
  /**
820
  * Make sure the admin is allowed to print packing slips and add the mass action.
821
  */
862
  $showOptions = Mage::getStoreConfig(self::XPATH_SHOW_OPTIONS, $storeId);
863
 
864
  if ($showOptions) {
865
+ $optionLabel = $helper->__('Product options');
866
+ $options = $this->_getProductOptions();
867
 
868
  /**
869
  * Add another dropdown containing the possible product options.
 
870
  */
871
  $config = array(
872
  'postnl_use_default' => array(
876
  'value' => 1,
877
  'checked' => 'checked',
878
  ),
879
+ );
880
+
881
+ $buspakjeCalculationMode = Mage::getStoreConfig(self::XPATH_BUSPAKJE_CALCULATION_MODE, $storeId);
882
+ $showBuspakjeOptions = Mage::getStoreConfigFlag(self::XPATH_SHOW_BUSPAKJE_OPTION, $storeId);
883
+ if ($helper->canUseBuspakje()
884
+ && $buspakjeCalculationMode == 'manual'
885
+ && $showBuspakjeOptions
886
+ && !empty($options['postnl_buspakje_options'])
887
+ ) {
888
+ $config['postnl_is_buspakje'] = array(
889
+ 'name' => 'product_options[is_buspakje]',
890
+ 'type' => 'postnl_checkbox',
891
+ 'label' => $helper->__('Is letter box parcel'),
892
+ 'value' => 1,
893
+ );
894
+ }
895
+
896
+ if (!empty($options['postnl_domestic_options'])) {
897
+ $config['postnl_domestic_options'] = array(
898
  'name' => 'product_options[domestic_options]',
899
  'type' => 'select',
900
+ 'label' => $optionLabel,
901
+ 'values' => $options['postnl_domestic_options'],
902
+ );
903
+ }
904
+
905
+ if (!empty($options['postnl_avond_options'])) {
906
+ $config['postnl_avond_options'] = array(
 
 
 
 
907
  'name' => 'product_options[avond_options]',
908
  'type' => 'select',
909
+ 'label' => $optionLabel,
910
+ 'values' => $options['postnl_avond_options'],
911
+ );
912
+ }
913
+
914
+ if (!empty($options['postnl_pg_options'])) {
915
+ $config['postnl_pg_options'] = array(
 
 
 
 
916
  'name' => 'product_options[pg_options]',
917
  'type' => 'select',
918
+ 'label' => $optionLabel,
919
+ 'values' => $options['postnl_pg_options'],
920
+ );
921
+ }
922
+
923
+ if (!empty($options['postnl_pge_options'])) {
924
+ $config['postnl_pge_options'] = array(
 
 
 
 
925
  'name' => 'product_options[pge_options]',
926
  'type' => 'select',
927
+ 'label' => $optionLabel,
928
+ 'values' => $options['postnl_pge_options'],
929
+ );
930
+ }
931
+
932
+ if (!empty($options['postnl_eps_options'])) {
933
+ $config['postnl_eps_options'] = array(
 
 
 
 
 
 
934
  'name' => 'product_options[eps_options]',
935
  'type' => 'select',
936
+ 'label' => $optionLabel,
937
+ 'values' => $options['postnl_eps_options'],
938
+ );
939
+ }
940
+
941
+ if (!empty($options['postnl_globalpack_options'])) {
942
+ $config['postnl_globalpack_options'] = array(
 
 
 
943
  'name' => 'product_options[globalpack_options]',
944
  'type' => 'select',
945
+ 'label' => $optionLabel,
946
+ 'values' => $options['postnl_globalpack_options'],
947
+ );
948
+ }
949
+
950
+ if (!empty($options['postnl_domestic_cod_options'])) {
951
+ $config['postnl_domestic_cod_options'] = array(
 
 
 
952
  'name' => 'product_options[domestic_cod_options]',
953
  'type' => 'select',
954
+ 'label' => $optionLabel,
955
+ 'values' => $options['postnl_domestic_cod_options'],
956
+ );
957
+ }
958
+
959
+ if (!empty($options['postnl_avond_cod_options'])) {
960
+ $config['postnl_avond_cod_options'] = array(
 
 
 
 
961
  'name' => 'product_options[avond_cod_options]',
962
  'type' => 'select',
963
+ 'label' => $optionLabel,
964
+ 'values' => $options['postnl_avond_cod_options'],
965
+ );
966
+ }
967
+
968
+ if (!empty($options['postnl_pg_cod_options'])) {
969
+ $config['postnl_pg_cod_options'] = array(
 
 
 
 
 
970
  'name' => 'product_options[pg_cod_options]',
971
  'type' => 'select',
972
+ 'label' => $optionLabel,
973
+ 'values' => $options['postnl_pg_cod_options'],
974
+ );
975
+ }
976
+
977
+ if (!empty($options['postnl_pge_cod_options'])) {
978
+ $config['postnl_pge_cod_options'] = array(
 
 
 
 
979
  'name' => 'product_options[pge_cod_options]',
980
  'type' => 'select',
981
+ 'label' => $optionLabel,
982
+ 'values' => $options['postnl_pge_cod_options'],
983
+ );
984
+ }
985
+
986
+ if (!empty($options['postnl_pa_options'])) {
987
+ $config['postnl_pa_options'] = array(
 
 
 
 
 
988
  'name' => 'product_options[pa_options]',
989
  'type' => 'select',
990
+ 'label' => $optionLabel,
991
+ 'values' => $options['postnl_pa_options'],
992
+ );
993
+ }
994
+
995
+ if (!empty($options['postnl_buspakje_options'])) {
996
+ $config['postnl_buspakje_options'] = array(
 
 
 
997
  'name' => 'product_options[buspakje_options]',
998
  'type' => 'select',
999
+ 'label' => $optionLabel,
1000
+ 'values' => $options['postnl_buspakje_options'],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1001
  );
 
 
 
 
 
 
 
1002
  }
1003
 
1004
  /**
1007
  $block = Mage::app()
1008
  ->getLayout()
1009
  ->createBlock('postnl_adminhtml/widget_grid_massaction_item_additional_productOptions');
1010
+
1011
  $massActionData['additional'] = $block->createFromConfiguration($config);
1012
  }
1013
 
1014
  return $massActionData;
1015
  }
1016
 
1017
+ /**
1018
+ * @return array
1019
+ */
1020
+ protected function _getProductOptions()
1021
+ {
1022
+ $optionsModel = Mage::getModel('postnl_core/system_config_source_allProductOptions');
1023
+ $options = array(
1024
+ 'postnl_domestic_options' => $optionsModel->getOptions(
1025
+ array(
1026
+ 'group' => 'standard_options',
1027
+ 'isCod' => false,
1028
+ ),
1029
+ false,
1030
+ true
1031
+ ),
1032
+ 'postnl_avond_options' => $optionsModel->getOptions(
1033
+ array(
1034
+ 'group' => 'standard_options',
1035
+ 'isCod' => false,
1036
+ ),
1037
+ false,
1038
+ true
1039
+ ),
1040
+ 'postnl_pg_options' => $optionsModel->getOptions(
1041
+ array(
1042
+ 'group' => 'standard_options',
1043
+ 'isCod' => false,
1044
+ 'isAvond' => true,
1045
+ ),
1046
+ false,
1047
+ true
1048
+ ),
1049
+ 'postnl_pge_options' => $optionsModel->getOptions(
1050
+ array(
1051
+ 'group' => 'pakjegemak_options',
1052
+ 'isCod' => false,
1053
+ 'isPge' => true,
1054
+ ),
1055
+ false,
1056
+ true
1057
+ ),
1058
+ 'postnl_eps_options' => $optionsModel->getOptions(
1059
+ array(
1060
+ 'group' => 'eu_options',
1061
+ ),
1062
+ false,
1063
+ true
1064
+ ),
1065
+ 'postnl_globalpack_options' => $optionsModel->getOptions(
1066
+ array(
1067
+ 'group' => 'global_options',
1068
+ ),
1069
+ false,
1070
+ true
1071
+ ),
1072
+ 'postnl_domestic_cod_options' => $optionsModel->getOptions(
1073
+ array(
1074
+ 'group' => 'standard_options',
1075
+ 'isCod' => true,
1076
+ ),
1077
+ false,
1078
+ true
1079
+ ),
1080
+ 'postnl_avond_cod_options' => $optionsModel->getOptions(
1081
+ array(
1082
+ 'group' => 'standard_options',
1083
+ 'isCod' => true,
1084
+ 'isAvond' => true,
1085
+ ),
1086
+ false,
1087
+ true
1088
+ ),
1089
+ 'postnl_pg_cod_options' => $optionsModel->getOptions(
1090
+ array(
1091
+ 'group' => 'pakjegemak_options',
1092
+ 'isCod' => true,
1093
+ ),
1094
+ false,
1095
+ true
1096
+ ),
1097
+ 'postnl_pge_cod_options' => $optionsModel->getOptions(
1098
+ array(
1099
+ 'group' => 'pakjegemak_options',
1100
+ 'isCod' => true,
1101
+ 'isPge' => true,
1102
+ ),
1103
+ false,
1104
+ true
1105
+ ),
1106
+ 'postnl_pa_options' => $optionsModel->getOptions(
1107
+ array(
1108
+ 'group' => 'pakketautomaat_options',
1109
+ ),
1110
+ false,
1111
+ true
1112
+ ),
1113
+ 'postnl_buspakje_options' => $optionsModel->getOptions(
1114
+ array(
1115
+ 'group' => 'buspakje_options',
1116
+ ),
1117
+ false,
1118
+ true
1119
+ )
1120
+ );
1121
+
1122
+ return $options;
1123
+ }
1124
+
1125
  /**
1126
  * Gets mass action data for the full PostNL flow mass action.
1127
  *
1151
  return $massActionData;
1152
  }
1153
 
1154
+ /**
1155
+ * Gets mass action data for the full PostNL flow mass action with packing slip.
1156
+ *
1157
+ * @return array
1158
+ */
1159
+ protected function _getFullPostnlFlowPackingSlipMassAction()
1160
+ {
1161
+ $helper = Mage::helper('postnl');
1162
+
1163
+ /**
1164
+ * Build an array of options for the massaction item.
1165
+ */
1166
+ $massActionData = array(
1167
+ 'label' => $helper->__('PostNL - Create shipments, print packing slips and confirm'),
1168
+ 'url' => Mage::helper('adminhtml')->getUrl(
1169
+ 'postnl_admin/adminhtml_shipment/massFullPostnlFlowWithPackingSlip'
1170
+ ),
1171
+ );
1172
+
1173
+ $defaultMassAction = Mage::getStoreConfig(
1174
+ self::XPATH_ORDER_GRID_MASSACTION_DEFAULT,
1175
+ Mage_Core_Model_App::ADMIN_STORE_ID
1176
+ );
1177
+
1178
+ if ($defaultMassAction == 'postnl_create_shipment_print_packing_slip_and_confirm') {
1179
+ $massActionData['selected'] = true;
1180
+ }
1181
+
1182
+ return $massActionData;
1183
+ }
1184
+
1185
  /**
1186
  * Gets mass action data for the printPackingSlips mass action.
1187
  *
1241
  /**
1242
  * Adds new filters to the collection if these filters are based on columns added by this observer
1243
  *
1244
+ * @param array $filter Array of filters to be added
1245
  *
1246
  * @return $this
1247
  */
1391
  return $this;
1392
  }
1393
 
1394
+ /**
1395
+ * Filter the order grid's confirm date field. This field may represent either the postnl_order's confirm_date
1396
+ * column or the postnl_shipment's confirm_date column.
1397
+ *
1398
+ * @param TIG_PostNL_Model_Resource_Order_Grid_Collection $collection
1399
+ * @param Mage_Adminhtml_Block_Widget_Grid_Column $column
1400
+ *
1401
+ * @return $this
1402
+ */
1403
+ protected function _filterConfirmDate($collection, $column)
1404
+ {
1405
+ $filter = $column->getFilter();
1406
+ if (!$filter) {
1407
+ return $this;
1408
+ }
1409
+
1410
+ $cond = $filter->getCondition();
1411
+ if (!$cond) {
1412
+ return $this;
1413
+ }
1414
+
1415
+ $field = "IF(`postnl_shipment`.`confirm_date`, `postnl_shipment`.`confirm_date`, "
1416
+ . "`postnl_order`.`confirm_date`)";
1417
+
1418
+ $collection->addFieldToFilter($field , $cond);
1419
+
1420
+ return $this;
1421
+ }
1422
+
1423
  /**
1424
  * Based on Mage_Adminhtml_Block_Widget_Grid::_addColumnFilterToCollection()
1425
  *
app/code/community/TIG/PostNL/Model/Adminhtml/Observer/ShipmentGrid.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * Observer to edit the sales > shipments grid
@@ -70,12 +70,12 @@ class TIG_PostNL_Model_Adminhtml_Observer_ShipmentGrid extends Varien_Object
70
  /**
71
  * XML path to 'shipping grid columns' setting
72
  */
73
- const XPATH_SHIPPING_GRID_COLUMNS = 'postnl/cif_labels_and_confirming/shipping_grid_columns';
74
 
75
  /**
76
  * XML path to default selected mass action setting
77
  */
78
- const XPATH_SHIPPING_GRID_MASSACTION_DEFAULT = 'postnl/cif_labels_and_confirming/shipping_grid_massaction_default';
79
 
80
  /**
81
  * Xpath to label size setting.
@@ -85,12 +85,12 @@ class TIG_PostNL_Model_Adminhtml_Observer_ShipmentGrid extends Varien_Object
85
  /**
86
  * XML path to show_buspakje_options setting.
87
  */
88
- const XPATH_SHOW_BUSPAKJE_OPTION = 'postnl/cif_labels_and_confirming/show_buspakje_option';
89
 
90
  /**
91
  * XML path to buspakje_calculation_mode setting.
92
  */
93
- const XPATH_BUSPAKJE_CALCULATION_MODE = 'postnl/cif_labels_and_confirming/buspakje_calculation_mode';
94
 
95
  /**
96
  * Gets an array of optional columns to display
@@ -241,30 +241,6 @@ class TIG_PostNL_Model_Adminhtml_Observer_ShipmentGrid extends Varien_Object
241
  {
242
  $resource = Mage::getSingleton('core/resource');
243
 
244
- /**
245
- * Add a conditional SELECT clause for the country_id and postcode fields. If the shipment has a PakjeGemak
246
- * address we need the postcode and country_id from that address. Otherwise we need them from the shipping
247
- * address.
248
- */
249
- $collection->addExpressionFieldToSelect(
250
- 'country_id',
251
- 'IF({{pakjegemak_parent_id}}, {{pakjegemak_country_id}}, {{shipping_country_id}})',
252
- array(
253
- 'pakjegemak_parent_id' => '`pakjegemak_address`.`parent_id`',
254
- 'pakjegemak_country_id' => '`pakjegemak_address`.`country_id`',
255
- 'shipping_country_id' => '`shipping_address`.`country_id`',
256
- )
257
- );
258
- $collection->addExpressionFieldToSelect(
259
- 'postcode',
260
- 'IF({{pakjegemak_parent_id}}, {{pakjegemak_postcode}}, {{shipping_postcode}})',
261
- array(
262
- 'pakjegemak_parent_id' => '`pakjegemak_address`.`parent_id`',
263
- 'pakjegemak_postcode' => '`pakjegemak_address`.`postcode`',
264
- 'shipping_postcode' => '`shipping_address`.`postcode`',
265
- )
266
- );
267
-
268
  $select = $collection->getSelect();
269
 
270
  /**
@@ -280,19 +256,15 @@ class TIG_PostNL_Model_Adminhtml_Observer_ShipmentGrid extends Varien_Object
280
  );
281
 
282
  /**
283
- * Join sales_flat_order_address table. Once for the shipping address and once for the pakje_gemak address. We
284
- * need both for the conditional select used to get the postcode and country_id of the destination_address.
285
  */
286
  $select->joinLeft(
287
  array('shipping_address' => $resource->getTableName('sales/order_address')),
288
  "`main_table`.`order_id`=`shipping_address`.`parent_id` AND `shipping_address`.`address_type`='shipping'",
289
- array()
290
- );
291
- $select->joinLeft(
292
- array('pakjegemak_address' => $resource->getTableName('sales/order_address')),
293
- "`main_table`.`order_id`=`pakjegemak_address`.`parent_id`" .
294
- " AND `pakjegemak_address`.`address_type`='pakje_gemak'",
295
- array()
296
  );
297
 
298
  /**
@@ -605,30 +577,32 @@ class TIG_PostNL_Model_Adminhtml_Observer_ShipmentGrid extends Varien_Object
605
  }
606
 
607
  $actionColumn = $block->getColumn('action');
608
- $actions = $actionColumn->getActions();
609
-
610
- if ($helper->checkIsPostnlActionAllowed('print_label')) {
611
- $actions[] = array(
612
- 'caption' => $helper->__('Print label'),
613
- 'style' => 'cursor:pointer;',
614
- 'is_postnl' => true, //custom flag for renderer
615
- 'code' => 'postnl_print_label',
616
- );
617
- }
 
618
 
619
- if ($helper->checkIsPostnlActionAllowed('confirm')) {
620
- $actions[] = array(
621
- 'caption' => $helper->__('Confirm'),
622
- 'url' => array('base' => 'postnl_admin/adminhtml_shipment/confirm'),
623
- 'field' => 'shipment_id',
624
- 'is_postnl' => true, //custom flag for renderer
625
- 'code' => 'postnl_confirm',
626
- );
627
- }
628
 
629
- $actionColumn->setActions($actions)
630
- ->setWidth('150px')
631
- ->setData('renderer', 'postnl_adminhtml/widget_grid_column_renderer_action');
 
632
 
633
  $block->sortColumnsByOrder();
634
 
@@ -657,7 +631,10 @@ class TIG_PostNL_Model_Adminhtml_Observer_ShipmentGrid extends Varien_Object
657
  $class = '';
658
  }
659
 
660
- return '<span class="'.$class.'"><span>'.$value.'</span></span>';
 
 
 
661
  }
662
 
663
  /**
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * Observer to edit the sales > shipments grid
70
  /**
71
  * XML path to 'shipping grid columns' setting
72
  */
73
+ const XPATH_SHIPPING_GRID_COLUMNS = 'postnl/grid/shipping_grid_columns';
74
 
75
  /**
76
  * XML path to default selected mass action setting
77
  */
78
+ const XPATH_SHIPPING_GRID_MASSACTION_DEFAULT = 'postnl/grid/shipping_grid_massaction_default';
79
 
80
  /**
81
  * Xpath to label size setting.
85
  /**
86
  * XML path to show_buspakje_options setting.
87
  */
88
+ const XPATH_SHOW_BUSPAKJE_OPTION = 'postnl/grid/show_buspakje_option';
89
 
90
  /**
91
  * XML path to buspakje_calculation_mode setting.
92
  */
93
+ const XPATH_BUSPAKJE_CALCULATION_MODE = 'postnl/delivery_options/buspakje_calculation_mode';
94
 
95
  /**
96
  * Gets an array of optional columns to display
241
  {
242
  $resource = Mage::getSingleton('core/resource');
243
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  $select = $collection->getSelect();
245
 
246
  /**
256
  );
257
 
258
  /**
259
+ * Join sales_flat_order_address table.
 
260
  */
261
  $select->joinLeft(
262
  array('shipping_address' => $resource->getTableName('sales/order_address')),
263
  "`main_table`.`order_id`=`shipping_address`.`parent_id` AND `shipping_address`.`address_type`='shipping'",
264
+ array(
265
+ 'postcode' => 'shipping_address.postcode',
266
+ 'country_id' => 'shipping_address.country_id',
267
+ )
 
 
 
268
  );
269
 
270
  /**
577
  }
578
 
579
  $actionColumn = $block->getColumn('action');
580
+ if ($actionColumn) {
581
+ $actions = $actionColumn->getActions();
582
+
583
+ if ($helper->checkIsPostnlActionAllowed('print_label')) {
584
+ $actions[] = array(
585
+ 'caption' => $helper->__('Print label'),
586
+ 'style' => 'cursor:pointer;',
587
+ 'is_postnl' => true, //custom flag for renderer
588
+ 'code' => 'postnl_print_label',
589
+ );
590
+ }
591
 
592
+ if ($helper->checkIsPostnlActionAllowed('confirm')) {
593
+ $actions[] = array(
594
+ 'caption' => $helper->__('Confirm'),
595
+ 'url' => array('base' => 'postnl_admin/adminhtml_shipment/confirm'),
596
+ 'field' => 'shipment_id',
597
+ 'is_postnl' => true, //custom flag for renderer
598
+ 'code' => 'postnl_confirm',
599
+ );
600
+ }
601
 
602
+ $actionColumn->setActions($actions)
603
+ ->setWidth('150px')
604
+ ->setData('renderer', 'postnl_adminhtml/widget_grid_column_renderer_action');
605
+ }
606
 
607
  $block->sortColumnsByOrder();
608
 
631
  $class = '';
632
  }
633
 
634
+ $origValue = $row->getData($column->getIndex());
635
+ $formattedDate = Mage::helper('core')->formatDate($origValue, 'full', false);
636
+
637
+ return '<span class="'.$class.'" title="' . $formattedDate . '"><span>'.$value.'</span></span>';
638
  }
639
 
640
  /**
app/code/community/TIG/PostNL/Model/Adminhtml/Observer/ShipmentView.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * Observer to edit the shipment view
@@ -120,6 +120,7 @@ class TIG_PostNL_Model_Adminhtml_Observer_ShipmentView
120
  */
121
  $confirmAllowed = $helper->checkIsPostnlActionAllowed('confirm');
122
  $printAllowed = $helper->checkIsPostnlActionAllowed('print_label');
 
123
  $deleteLabelsAllowed = $helper->checkIsPostnlActionAllowed('delete_labels');
124
  $resetConfirmAllowed = $helper->checkIsPostnlActionAllowed(array('reset_confirmation', 'delete_labels'));
125
  $sendTrackAndTraceAllowed = $helper->checkIsPostnlActionAllowed('send_track_and_trace');
@@ -132,11 +133,30 @@ class TIG_PostNL_Model_Adminhtml_Observer_ShipmentView
132
  if ($printAllowed) {
133
  $printShippingLabelUrl = $this->getPrintShippingLabelUrl($shipment->getId());
134
 
135
- $block->addButton('print_shipping_label', array(
136
- 'label' => $helper->__('PostNL - Print Shipping Label'),
137
- 'onclick' => "printLabel('{$printShippingLabelUrl}')",
138
- 'class' => 'download',
139
- ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  }
141
 
142
  /**
@@ -164,7 +184,11 @@ class TIG_PostNL_Model_Adminhtml_Observer_ShipmentView
164
  );
165
  }
166
 
167
- if ($postnlShipment->canConvertShipmentToBuspakje() && $convertToBuspakjeAllowed
 
 
 
 
168
  && (!$postnlShipment->isConfirmed()
169
  || ($postnlShipment->canResetConfirmation()
170
  && $resetConfirmAllowed
@@ -192,6 +216,9 @@ class TIG_PostNL_Model_Adminhtml_Observer_ShipmentView
192
  );
193
  }
194
 
 
 
 
195
  if ($postnlShipment->canConvertShipmentToPackage() && $convertToPackageAllowed
196
  && (!$postnlShipment->isConfirmed()
197
  || ($postnlShipment->canResetConfirmation()
@@ -286,7 +313,7 @@ class TIG_PostNL_Model_Adminhtml_Observer_ShipmentView
286
  }
287
 
288
  /**
289
- * Get adminhtml url for PostNL print shipping label action
290
  *
291
  * @param int $shipmentId The ID of the current shipment
292
  *
@@ -302,6 +329,23 @@ class TIG_PostNL_Model_Adminhtml_Observer_ShipmentView
302
  return $url;
303
  }
304
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
305
  /**
306
  * Get adminhtml url for PostNL reset confirmation action
307
  *
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * Observer to edit the shipment view
120
  */
121
  $confirmAllowed = $helper->checkIsPostnlActionAllowed('confirm');
122
  $printAllowed = $helper->checkIsPostnlActionAllowed('print_label');
123
+ $printPackingSlipAllowed = $helper->checkIsPostnlActionAllowed(array('print_label', 'print_packing_slip'));
124
  $deleteLabelsAllowed = $helper->checkIsPostnlActionAllowed('delete_labels');
125
  $resetConfirmAllowed = $helper->checkIsPostnlActionAllowed(array('reset_confirmation', 'delete_labels'));
126
  $sendTrackAndTraceAllowed = $helper->checkIsPostnlActionAllowed('send_track_and_trace');
133
  if ($printAllowed) {
134
  $printShippingLabelUrl = $this->getPrintShippingLabelUrl($shipment->getId());
135
 
136
+ $block->addButton(
137
+ 'print_shipping_label',
138
+ array(
139
+ 'label' => $helper->__('PostNL - Print Shipping Label'),
140
+ 'onclick' => "printLabel('{$printShippingLabelUrl}')",
141
+ 'class' => 'download',
142
+ )
143
+ );
144
+ }
145
+
146
+ /**
147
+ * Add a button to print this shipment's packing slip.
148
+ */
149
+ if ($printPackingSlipAllowed) {
150
+ $printPackingSlipUrl = $this->getPrintPackingSlipUrl($shipment->getId());
151
+
152
+ $block->addButton(
153
+ 'print_packing_slip',
154
+ array(
155
+ 'label' => $helper->__('PostNL - Print Packing Slip'),
156
+ 'onclick' => "printLabel('{$printPackingSlipUrl}')",
157
+ 'class' => 'download',
158
+ )
159
+ );
160
  }
161
 
162
  /**
184
  );
185
  }
186
 
187
+ /**
188
+ * Add a button to convert this shipment to a buspakje shipment.
189
+ */
190
+ if ($postnlShipment->canConvertShipmentToBuspakje()
191
+ && $convertToBuspakjeAllowed
192
  && (!$postnlShipment->isConfirmed()
193
  || ($postnlShipment->canResetConfirmation()
194
  && $resetConfirmAllowed
216
  );
217
  }
218
 
219
+ /**
220
+ * Add a button to convert this shipment to a package shipment.
221
+ */
222
  if ($postnlShipment->canConvertShipmentToPackage() && $convertToPackageAllowed
223
  && (!$postnlShipment->isConfirmed()
224
  || ($postnlShipment->canResetConfirmation()
313
  }
314
 
315
  /**
316
+ * Get adminhtml url for PostNL print shipping label action.
317
  *
318
  * @param int $shipmentId The ID of the current shipment
319
  *
329
  return $url;
330
  }
331
 
332
+ /**
333
+ * Get adminhtml url for PostNL print packing slip action.
334
+ *
335
+ * @param int $shipmentId The ID of the current shipment
336
+ *
337
+ * @return string
338
+ */
339
+ public function getPrintPackingSlipUrl($shipmentId)
340
+ {
341
+ $url = Mage::helper('adminhtml')->getUrl(
342
+ 'postnl_admin/adminhtml_shipment/printPackingSlip',
343
+ array('shipment_id' => $shipmentId)
344
+ );
345
+
346
+ return $url;
347
+ }
348
+
349
  /**
350
  * Get adminhtml url for PostNL reset confirmation action
351
  *
app/code/community/TIG/PostNL/Model/Adminhtml/Observer/SystemConfig.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Adminhtml_Observer_SystemConfig
@@ -42,15 +42,13 @@ class TIG_PostNL_Model_Adminhtml_Observer_SystemConfig
42
  * Adds a button to the system > config page for the PostNL section, allowing the admin to download all PostNL debug
43
  * logs.
44
  *
45
- * @param Varien_Event_Observer $observer
46
- *
47
  * @return $this
48
  *
49
  * @event controller_action_layout_render_before_adminhtml_system_config_edit
50
  *
51
  * @observer postnl_add_download_log_button
52
  */
53
- public function addDownloadLogButton(Varien_Event_Observer $observer)
54
  {
55
  $section = Mage::app()->getRequest()->getParam('section');
56
  if ($section !== 'postnl') {
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Adminhtml_Observer_SystemConfig
42
  * Adds a button to the system > config page for the PostNL section, allowing the admin to download all PostNL debug
43
  * logs.
44
  *
 
 
45
  * @return $this
46
  *
47
  * @event controller_action_layout_render_before_adminhtml_system_config_edit
48
  *
49
  * @observer postnl_add_download_log_button
50
  */
51
+ public function addDownloadLogButton()
52
  {
53
  $section = Mage::app()->getRequest()->getParam('section');
54
  if ($section !== 'postnl') {
app/code/community/TIG/PostNL/Model/Adminhtml/Support/Logs.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Adminhtml_Support_Logs
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Adminhtml_Support_Logs
app/code/community/TIG/PostNL/Model/Adminhtml/System/Config/Source/OrderGridColumns.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Adminhtml_System_Config_Source_OrderGridColumns
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Adminhtml_System_Config_Source_OrderGridColumns
app/code/community/TIG/PostNL/Model/Adminhtml/System/Config/Source/OrderGridMassaction.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Adminhtml_System_Config_Source_OrderGridMassaction
@@ -59,6 +59,10 @@ class TIG_PostNL_Model_Adminhtml_System_Config_Source_OrderGridMassaction
59
  'value' => 'postnl_create_shipment_print_label_and_confirm',
60
  'label' => $helper->__('Create shipments, print labels and confirm'),
61
  ),
 
 
 
 
62
  array(
63
  'value' => 'postnl_print_packing_slips',
64
  'label' => $helper->__('Print packing slips'),
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Adminhtml_System_Config_Source_OrderGridMassaction
59
  'value' => 'postnl_create_shipment_print_label_and_confirm',
60
  'label' => $helper->__('Create shipments, print labels and confirm'),
61
  ),
62
+ array(
63
+ 'value' => 'postnl_create_shipment_print_packing_slip_and_confirm',
64
+ 'label' => $helper->__('Create shipments, print packing slips and confirm'),
65
+ ),
66
  array(
67
  'value' => 'postnl_print_packing_slips',
68
  'label' => $helper->__('Print packing slips'),
app/code/community/TIG/PostNL/Model/Adminhtml/System/Config/Source/ShipmentGridColumns.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Adminhtml_System_Config_Source_ShipmentGridColumns
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Adminhtml_System_Config_Source_ShipmentGridColumns
app/code/community/TIG/PostNL/Model/Adminhtml/System/Config/Source/ShipmentGridMassaction.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Adminhtml_System_Config_Source_ShipmentGridMassAction
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Adminhtml_System_Config_Source_ShipmentGridMassAction
app/code/community/TIG/PostNL/Model/Carrier/Matrixrate.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ *
39
+ * This is a dummy class for the matrixrate export/import functionality.
40
+ */
41
+ class TIG_PostNL_Model_Carrier_Matrixrate extends Mage_Core_Model_Abstract
42
+ {
43
+ /**
44
+ * Prefix of model events names
45
+ *
46
+ * @var string
47
+ */
48
+ protected $_eventPrefix = 'postnl_carrier_matrixrate';
49
+
50
+ /**
51
+ * Class constructor.
52
+ */
53
+ public function _construct()
54
+ {
55
+ $this->_init('postnl_carrier/matrixrate');
56
+ }
57
+ }
app/code/community/TIG/PostNL/Model/Carrier/Postnl.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * PostNL shipping method model
@@ -135,7 +135,8 @@ class TIG_PostNL_Model_Carrier_Postnl extends Mage_Shipping_Model_Carrier_Abstra
135
  }
136
 
137
  /**
138
- * Several checks to see if shipping to the selected country is allowed based on the supported PostNL shipping products
 
139
  */
140
  $countryId = $request->getDestCountryId();
141
  $helper = $this->getHelper();
@@ -172,6 +173,10 @@ class TIG_PostNL_Model_Carrier_Postnl extends Mage_Shipping_Model_Carrier_Abstra
172
  $result = $this->_getTableRate($request);
173
  }
174
 
 
 
 
 
175
  if (!isset($result)) {
176
  throw new TIG_PostNL_Exception(
177
  $helper->__('Invalid rate type requested: %s', $rateType),
@@ -366,6 +371,157 @@ class TIG_PostNL_Model_Carrier_Postnl extends Mage_Shipping_Model_Carrier_Abstra
366
  return $result;
367
  }
368
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
369
  /**
370
  * @param Mage_Shipping_Model_Rate_Request $request
371
  *
@@ -386,6 +542,18 @@ class TIG_PostNL_Model_Carrier_Postnl extends Mage_Shipping_Model_Carrier_Abstra
386
  return $rate;
387
  }
388
 
 
 
 
 
 
 
 
 
 
 
 
 
389
  /**
390
  * @param $type
391
  * @param string $code
@@ -436,8 +604,9 @@ class TIG_PostNL_Model_Carrier_Postnl extends Mage_Shipping_Model_Carrier_Abstra
436
  $helper = Mage::helper('postnl');
437
 
438
  $methods = array(
439
- 'flatrate' => $this->getConfigData('name') . ' (' . $helper->__('flat rate') . ')',
440
- 'tablerate' => $this->getConfigData('name') . ' (' . $helper->__('table rate') . ')',
 
441
  );
442
 
443
  return $methods;
@@ -456,9 +625,6 @@ class TIG_PostNL_Model_Carrier_Postnl extends Mage_Shipping_Model_Carrier_Abstra
456
  $track = $this->_getTrackByNumber($tracking);
457
  $shipment = $track->getShipment();
458
 
459
- $locale = Mage::getStoreConfig('general/locale/code', $shipment->getStoreId());
460
- $lang = substr($locale, 0, 2);
461
-
462
  $shippingAddress = $shipment->getShippingAddress();
463
 
464
  /**
@@ -472,13 +638,12 @@ class TIG_PostNL_Model_Carrier_Postnl extends Mage_Shipping_Model_Carrier_Abstra
472
  }
473
  }
474
 
475
-
476
  $statusModel->setCarrier($track->getCarrierCode())
477
  ->setCarrierTitle($this->getConfigData('name'))
478
  ->setTracking($track->getTrackNumber())
479
  ->setPopup(1)
480
  ->setUrl(
481
- $this->getHelper()->getBarcodeUrl($track->getTrackNumber(), $shippingAddress, $lang, false)
482
  );
483
 
484
  return $statusModel;
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * PostNL shipping method model
135
  }
136
 
137
  /**
138
+ * Several checks to see if shipping to the selected country is allowed based on the supported PostNL shipping
139
+ * products
140
  */
141
  $countryId = $request->getDestCountryId();
142
  $helper = $this->getHelper();
173
  $result = $this->_getTableRate($request);
174
  }
175
 
176
+ if ($rateType == 'matrix') {
177
+ $result = $this->_getMatrixRate($request);
178
+ }
179
+
180
  if (!isset($result)) {
181
  throw new TIG_PostNL_Exception(
182
  $helper->__('Invalid rate type requested: %s', $rateType),
371
  return $result;
372
  }
373
 
374
+ /**
375
+ * @param Mage_Shipping_Model_Rate_Request $request
376
+ *
377
+ * @return Mage_Shipping_Model_Rate_Result
378
+ */
379
+ protected function _getMatrixRate(Mage_Shipping_Model_Rate_Request $request)
380
+ {
381
+ //Zend_Debug::dump($request->debug());exit;
382
+
383
+ // exclude Virtual products price from Package value if pre-configured
384
+ if (!$this->getConfigFlag('include_virtual_price') && $request->getAllItems()) {
385
+ /**
386
+ * @var Mage_Sales_Model_Quote_Item $item
387
+ */
388
+ foreach ($request->getAllItems() as $item) {
389
+ if ($item->getParentItem()) {
390
+ continue;
391
+ }
392
+ if ($item->getHasChildren() && $item->isShipSeparately()) {
393
+ foreach ($item->getChildren() as $child) {
394
+ /**
395
+ * @var Mage_Sales_Model_Quote_Item $child
396
+ */
397
+ if ($child->getProduct()->isVirtual()) {
398
+ $request->setPackageValue($request->getPackageValue() - $child->getBaseRowTotal());
399
+ }
400
+ }
401
+ } elseif ($item->getProduct()->isVirtual()) {
402
+ $request->setPackageValue($request->getPackageValue() - $item->getBaseRowTotal());
403
+ }
404
+ }
405
+ }
406
+
407
+ // Free shipping by qty
408
+ $freeQty = 0;
409
+ $freePackageValue = false;
410
+ if ($request->getAllItems()) {
411
+ $freePackageValue = 0;
412
+ /**
413
+ * @var Mage_Sales_Model_Quote_Item $item
414
+ */
415
+ foreach ($request->getAllItems() as $item) {
416
+ if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
417
+ continue;
418
+ }
419
+
420
+ if ($item->getHasChildren() && $item->isShipSeparately()) {
421
+ /**
422
+ * @var Mage_Sales_Model_Quote_Item $child
423
+ */
424
+ foreach ($item->getChildren() as $child) {
425
+ if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
426
+ $freeShipping = is_numeric($child->getFreeShipping()) ? $child->getFreeShipping() : 0;
427
+ $freeQty += $item->getQty() * ($child->getQty() - $freeShipping);
428
+ }
429
+ }
430
+ } elseif ($item->getFreeShipping()) {
431
+ $freeShipping = is_numeric($item->getFreeShipping()) ? $item->getFreeShipping() : 0;
432
+ $freeQty += $item->getQty() - $freeShipping;
433
+ $freePackageValue += $item->getBaseRowTotal();
434
+ }
435
+ }
436
+ $oldValue = $request->getPackageValue();
437
+ $request->setPackageValue($oldValue - $freePackageValue);
438
+ }
439
+
440
+ if ($freePackageValue) {
441
+ $request->setPackageValue($request->getPackageValue() - $freePackageValue);
442
+ }
443
+
444
+ $conditionName = $this->getConfigData('condition_name');
445
+ $request->setConditionName($conditionName ? $conditionName : $this->_default_condition_name);
446
+
447
+ // Package weight and qty free shipping
448
+ $oldWeight = $request->getPackageWeight();
449
+ $oldQty = $request->getPackageQty();
450
+
451
+ $request->setPackageWeight($request->getFreeMethodWeight());
452
+ $request->setPackageQty($oldQty - $freeQty);
453
+
454
+ /**
455
+ * Determine the parcel type.
456
+ */
457
+ if ($request->getAllItems()) {
458
+ $item = current($request->getAllItems());
459
+ $quote = $item->getQuote();
460
+
461
+ $postnlOrder = Mage::getModel('postnl_core/order')->loadByQuote($quote);
462
+ if ($postnlOrder && $postnlOrder->getId() && $postnlOrder->isPakjeGemak()) {
463
+ $request->setParcelType('regular');
464
+ } elseif (Mage::helper('postnl')->quoteIsBuspakje($quote)) {
465
+ $request->setParcelType('letter_box');
466
+ }
467
+ }
468
+
469
+ $result = Mage::getModel('shipping/rate_result');
470
+ $rate = $this->getMatrixRate($request);
471
+
472
+ $request->setPackageWeight($oldWeight);
473
+ $request->setPackageQty($oldQty);
474
+
475
+ $method = Mage::getModel('shipping/rate_result_method');
476
+ if (!empty($rate) && $rate['price'] >= 0) {
477
+ if ($request->getFreeShipping() === true || ($request->getPackageQty() == $freeQty)) {
478
+ $shippingPrice = 0;
479
+ } else {
480
+ $shippingPrice = $this->getFinalPriceWithHandlingFee($rate['price']);
481
+ }
482
+
483
+ $price = $shippingPrice;
484
+ $cost = $rate['cost'];
485
+ } elseif (empty($rate) && $request->getFreeShipping() === true) {
486
+ /**
487
+ * was applied promotion rule for whole cart
488
+ * other shipping methods could be switched off at all
489
+ * we must show table rate method with 0$ price, if grand_total more, than min table condition_value
490
+ * free setPackageWeight() has already was taken into account
491
+ */
492
+ $request->setPackageValue($freePackageValue);
493
+ $request->setPackageQty($freeQty);
494
+ $rate = $this->getMatrixRate($request);
495
+ if (!empty($rate) && $rate['price'] >= 0) {
496
+ $method = Mage::getModel('shipping/rate_result_method');
497
+ }
498
+
499
+ $price = 0;
500
+ $cost = 0;
501
+ } else {
502
+ $error = Mage::getModel('shipping/rate_result_error');
503
+ $error->setCarrier('tablerate');
504
+ $error->setCarrierTitle($this->getConfigData('title'));
505
+ $error->setErrorMessage($this->getConfigData('specificerrmsg'));
506
+ $result->append($error);
507
+
508
+ return $result;
509
+ }
510
+
511
+ $method->setCarrier('postnl');
512
+ $method->setCarrierTitle($this->getConfigData('title'));
513
+
514
+ $method->setMethod('matrixrate');
515
+ $method->setMethodTitle($this->getConfigData('name'));
516
+
517
+ $method->setPrice($price);
518
+ $method->setCost($cost);
519
+
520
+ $result->append($method);
521
+
522
+ return $result;
523
+ }
524
+
525
  /**
526
  * @param Mage_Shipping_Model_Rate_Request $request
527
  *
542
  return $rate;
543
  }
544
 
545
+ /**
546
+ * @param Mage_Shipping_Model_Rate_Request $request
547
+ *
548
+ * @return array|bool
549
+ */
550
+ public function getMatrixRate(Mage_Shipping_Model_Rate_Request $request)
551
+ {
552
+ $rate = Mage::getResourceModel('postnl_carrier/matrixrate')->getRate($request);
553
+
554
+ return $rate;
555
+ }
556
+
557
  /**
558
  * @param $type
559
  * @param string $code
604
  $helper = Mage::helper('postnl');
605
 
606
  $methods = array(
607
+ 'flatrate' => $this->getConfigData('name') . ' (' . $helper->__('flat rate') . ')',
608
+ 'tablerate' => $this->getConfigData('name') . ' (' . $helper->__('table rate') . ')',
609
+ 'matrixrate' => $this->getConfigData('name') . ' (' . $helper->__('matrix rate') . ')',
610
  );
611
 
612
  return $methods;
625
  $track = $this->_getTrackByNumber($tracking);
626
  $shipment = $track->getShipment();
627
 
 
 
 
628
  $shippingAddress = $shipment->getShippingAddress();
629
 
630
  /**
638
  }
639
  }
640
 
 
641
  $statusModel->setCarrier($track->getCarrierCode())
642
  ->setCarrierTitle($this->getConfigData('name'))
643
  ->setTracking($track->getTrackNumber())
644
  ->setPopup(1)
645
  ->setUrl(
646
+ $this->getHelper()->getBarcodeUrl($track->getTrackNumber(), $shippingAddress, false, false)
647
  );
648
 
649
  return $statusModel;
app/code/community/TIG/PostNL/Model/Carrier/Quote/Address/Total/Shipping.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Carrier_Quote_Address_Total_Shipping
@@ -181,6 +181,14 @@ class TIG_PostNL_Model_Carrier_Quote_Address_Total_Shipping
181
  return $this;
182
  }
183
 
 
 
 
 
 
 
 
 
184
  /**
185
  * @var Mage_Sales_Model_Quote_Address_Rate $rate
186
  */
@@ -191,22 +199,6 @@ class TIG_PostNL_Model_Carrier_Quote_Address_Total_Shipping
191
 
192
  $price = $rate->getPrice();
193
 
194
- $postnlOrder = Mage::getModel('postnl_core/order');
195
-
196
- $postnlOrder->load($address->getQuoteId(), 'quote_id');
197
-
198
- if ($postnlOrder->getId() && $postnlOrder->getIsActive()) {
199
- $type = $postnlOrder->getType();
200
- } else {
201
- $amountPrice = $address->getQuote()->getStore()->convertPrice($rate->getPrice(), false);
202
- $this->_setAmount($amountPrice);
203
- $this->_setBaseAmount($price);
204
- $shippingDescription = $rate->getCarrierTitle() . ' - ' . $rate->getMethodTitle();
205
- $address->setShippingDescription(trim($shippingDescription, ' -'));
206
-
207
- break;
208
- }
209
-
210
  $includingTax = false;
211
  if (Mage::getSingleton('tax/config')->shippingPriceIncludesTax()) {
212
  $includingTax = true;
@@ -219,6 +211,8 @@ class TIG_PostNL_Model_Carrier_Quote_Address_Total_Shipping
219
  $fee = Mage::helper('postnl/deliveryOptions')->getEveningFee(false, $includingTax, false);
220
  }
221
 
 
 
222
  $price += $fee;
223
 
224
  $amountPrice = $address->getQuote()->getStore()->convertPrice($price, false);
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Carrier_Quote_Address_Total_Shipping
181
  return $this;
182
  }
183
 
184
+ $postnlOrder = Mage::getModel('postnl_core/order');
185
+ $postnlOrder->load($address->getQuoteId(), 'quote_id');
186
+
187
+ $type = false;
188
+ if ($postnlOrder->getId() && $postnlOrder->getIsActive()) {
189
+ $type = $postnlOrder->getType();
190
+ }
191
+
192
  /**
193
  * @var Mage_Sales_Model_Quote_Address_Rate $rate
194
  */
199
 
200
  $price = $rate->getPrice();
201
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  $includingTax = false;
203
  if (Mage::getSingleton('tax/config')->shippingPriceIncludesTax()) {
204
  $includingTax = true;
211
  $fee = Mage::helper('postnl/deliveryOptions')->getEveningFee(false, $includingTax, false);
212
  }
213
 
214
+ $fee += Mage::helper('postnl/deliveryOptions')->getOptionsFee($postnlOrder, false, $includingTax, false);
215
+
216
  $price += $fee;
217
 
218
  $amountPrice = $address->getQuote()->getStore()->convertPrice($price, false);
app/code/community/TIG/PostNL/Model/Carrier/Resource/Matrixrate.php ADDED
@@ -0,0 +1,588 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ class TIG_PostNL_Model_Carrier_Resource_Matrixrate extends Mage_Shipping_Model_Resource_Carrier_Tablerate
40
+ {
41
+ /**
42
+ * Define main table and id field name.
43
+ *
44
+ * @return void
45
+ */
46
+ protected function _construct()
47
+ {
48
+ $this->_init('postnl_carrier/matrixrate', 'pk');
49
+ }
50
+
51
+ /**
52
+ * Return table rate array or false by rate request.
53
+ *
54
+ * @param Mage_Shipping_Model_Rate_Request $request
55
+ *
56
+ * @return array|false
57
+ */
58
+ public function getRate(Mage_Shipping_Model_Rate_Request $request)
59
+ {
60
+ $adapter = $this->_getReadAdapter();
61
+
62
+ /**
63
+ * Get the bound values for the select conditions.
64
+ */
65
+ $bind = array(
66
+ ':website_id' => (int) $request->getWebsiteId(),
67
+ ':country_id' => "%{$request->getDestCountryId()}%",
68
+ ':region_id' => (int) $request->getDestRegionId(),
69
+ ':postcode' => $request->getDestPostcode(),
70
+ ':weight' => $request->getPackageWeight(),
71
+ ':subtotal' => $request->getBaseSubtotalInclTax(),
72
+ ':qty' => $request->getPackageQty(),
73
+ );
74
+
75
+ /**
76
+ * Get the request's parcel type. This is 'regular' by default.
77
+ *
78
+ * If the request has specified a parcel type, use that. Otherwise if the request contains any items, get the
79
+ * quote from the first item and check if the quote is a letter box parcel.
80
+ */
81
+ $parcelType = 'regular';
82
+ if ($request->hasData('parcel_type')) {
83
+ $parcelType = $request->getData('parcel_type');
84
+ }
85
+
86
+ $bind[':parcel_type'] = $parcelType;
87
+
88
+ /**
89
+ * Get the base select query.
90
+ */
91
+ $select = $adapter->select()
92
+ ->from($this->getMainTable())
93
+ ->where('(website_id = :website_id) OR (website_id = ?)', Mage_Core_Model_App::ADMIN_STORE_ID)
94
+ ->order(
95
+ array(
96
+ 'website_id DESC',
97
+ 'parcel_type DESC',
98
+ 'dest_country_id DESC',
99
+ 'dest_region_id DESC',
100
+ 'dest_zip DESC',
101
+ 'weight DESC',
102
+ 'subtotal DESC',
103
+ 'qty DESC',
104
+ )
105
+ )
106
+ ->limit(1);
107
+
108
+ /**
109
+ * Render destination condition.
110
+ */
111
+ $orWhere = '('
112
+ . implode(
113
+ ') OR (',
114
+ array(
115
+ "dest_country_id LIKE :country_id AND dest_region_id = :region_id AND dest_zip = :postcode",
116
+ "dest_country_id LIKE :country_id AND dest_region_id = :region_id AND dest_zip = ''",
117
+ /**
118
+ * Handle asterisk in dest_zip field.
119
+ */
120
+ "dest_country_id LIKE :country_id AND dest_region_id = :region_id AND dest_zip = '*'",
121
+ "dest_country_id LIKE :country_id AND dest_region_id = 0 AND dest_zip = '*'",
122
+ "dest_country_id = '0' AND dest_region_id = :region_id AND dest_zip = '*'",
123
+ "dest_country_id = '0' AND dest_region_id = 0 AND dest_zip = '*'",
124
+
125
+ "dest_country_id LIKE :country_id AND dest_region_id = 0 AND dest_zip = ''",
126
+ "dest_country_id LIKE :country_id AND dest_region_id = 0 AND dest_zip = :postcode",
127
+ "dest_country_id LIKE :country_id AND dest_region_id = 0 AND dest_zip = '*'",
128
+ )
129
+ )
130
+ . ')';
131
+ $select->where($orWhere);
132
+
133
+ /**
134
+ * Add PostNL matrix rate specific conditions.
135
+ */
136
+ $select->where('weight <= :weight');
137
+ $select->where('subtotal <= :subtotal');
138
+ $select->where('qty <= :qty');
139
+ $select->where("(parcel_type = :parcel_type) OR (parcel_type = '*')");
140
+
141
+ $result = $adapter->fetchRow($select, $bind);
142
+
143
+ if (!$result) {
144
+ return false;
145
+ }
146
+
147
+ /**
148
+ * Normalize destination zip code.
149
+ */
150
+ if ($result && $result['dest_zip'] == '*') {
151
+ $result['dest_zip'] = '';
152
+ }
153
+
154
+ $result['cost'] = 0;
155
+
156
+ return $result;
157
+ }
158
+
159
+ /**
160
+ * Upload matrix rate file and import data from it.
161
+ *
162
+ * @param Varien_Object $object
163
+ *
164
+ * @throws TIG_PostNL_Exception
165
+ *
166
+ * @return $this
167
+ */
168
+ public function uploadAndImport(Varien_Object $object)
169
+ {
170
+ if (empty($_FILES['groups']['tmp_name']['postnl']['fields']['matrix_import']['value'])) {
171
+ return $this;
172
+ }
173
+
174
+ $csvFile = $_FILES['groups']['tmp_name']['postnl']['fields']['matrix_import']['value'];
175
+ $website = Mage::app()->getWebsite($object->getScopeId());
176
+
177
+ $this->_importWebsiteId = (int)$website->getId();
178
+ $this->_importUniqueHash = array();
179
+ $this->_importErrors = array();
180
+ $this->_importedRows = 0;
181
+
182
+ $io = new Varien_Io_File();
183
+ $info = pathinfo($csvFile);
184
+ $io->open(array('path' => $info['dirname']));
185
+ $io->streamOpen($info['basename'], 'r');
186
+
187
+ // check and skip headers
188
+ $headers = $io->streamReadCsv();
189
+ if ($headers === false || count($headers) < 8) {
190
+ $io->streamClose();
191
+ throw new TIG_PostNL_Exception(
192
+ Mage::helper('postnl')->__('Invalid PostNL Matrix Rates File Format'),
193
+ 'POSTNL-0194'
194
+ );
195
+ }
196
+
197
+ $adapter = $this->_getWriteAdapter();
198
+ $adapter->beginTransaction();
199
+
200
+ try {
201
+ $rowNumber = 1;
202
+ $importData = array();
203
+
204
+ $this->_loadDirectoryCountries();
205
+ $this->_loadDirectoryRegions();
206
+
207
+ // delete old data by website ID
208
+ $condition = array(
209
+ 'website_id = ?' => $this->_importWebsiteId,
210
+ );
211
+ $adapter->delete($this->getMainTable(), $condition);
212
+
213
+ while (false !== ($csvLine = $io->streamReadCsv())) {
214
+ $rowNumber ++;
215
+
216
+ if (empty($csvLine)) {
217
+ continue;
218
+ }
219
+
220
+ $row = $this->_getImportRow($csvLine, $rowNumber);
221
+ if ($row !== false) {
222
+ $importData[] = $row;
223
+ }
224
+
225
+ if (count($importData) == 5000) {
226
+ $this->_saveImportData($importData);
227
+ $importData = array();
228
+ }
229
+ }
230
+ $this->_saveImportData($importData);
231
+ $io->streamClose();
232
+ } catch (Mage_Core_Exception $e) {
233
+ $adapter->rollback();
234
+ $io->streamClose();
235
+ Mage::throwException($e->getMessage());
236
+ } catch (Exception $e) {
237
+ $adapter->rollback();
238
+ $io->streamClose();
239
+
240
+ Mage::helper('postnl')->logException($e);
241
+ throw new TIG_PostNL_Exception(
242
+ Mage::helper('postnl')->__('An error occurred while importing the matrix rates.'),
243
+ 'POSTNL-0195'
244
+ );
245
+ }
246
+
247
+ $adapter->commit();
248
+
249
+ if ($this->_importErrors) {
250
+ $error = Mage::helper('postnl')->__(
251
+ 'File has not been imported. See the following list of errors: %s',
252
+ implode(" \n", $this->_importErrors)
253
+ );
254
+ throw new TIG_PostNL_Exception($error, 'POSTNL-0196');
255
+ }
256
+
257
+ return $this;
258
+ }
259
+
260
+ /**
261
+ * Import matrix rate data from an array.
262
+ *
263
+ * @param array $data
264
+ *
265
+ * @return $this
266
+ *
267
+ * @throws Mage_Core_Exception
268
+ * @throws TIG_PostNL_Exception
269
+ */
270
+ public function import(array $data)
271
+ {
272
+ $adapter = $this->_getWriteAdapter();
273
+ $adapter->beginTransaction();
274
+
275
+ try {
276
+ $rowNumber = 1;
277
+ $importData = array();
278
+
279
+ $this->_loadDirectoryCountries();
280
+ $this->_loadDirectoryRegions();
281
+
282
+ // delete old data by website ID
283
+ $condition = array(
284
+ 'website_id = ?' => $this->_importWebsiteId,
285
+ );
286
+ $adapter->delete($this->getMainTable(), $condition);
287
+
288
+ foreach ($data as $key => $line) {
289
+ $rowNumber ++;
290
+
291
+ if (empty($line)) {
292
+ continue;
293
+ }
294
+
295
+ $row = $this->_getImportRow($line, $rowNumber);
296
+ if ($row !== false) {
297
+ $importData[] = $row;
298
+ }
299
+
300
+ if (count($importData) == 5000) {
301
+ $this->_saveImportData($importData);
302
+ $importData = array();
303
+ }
304
+ }
305
+
306
+ $this->_saveImportData($importData);
307
+ } catch (Mage_Core_Exception $e) {
308
+ $adapter->rollback();
309
+ Mage::throwException($e->getMessage());
310
+ } catch (Exception $e) {
311
+ $adapter->rollback();
312
+
313
+ Mage::helper('postnl')->logException($e);
314
+ throw new TIG_PostNL_Exception(
315
+ Mage::helper('postnl')->__('An error occurred while importing the matrix rates.'),
316
+ 'POSTNL-0195'
317
+ );
318
+ }
319
+
320
+ $adapter->commit();
321
+
322
+ if ($this->_importErrors) {
323
+ $error = Mage::helper('postnl')->__(
324
+ 'Data has not been imported. See the following list of errors: %s',
325
+ implode(" \n", $this->_importErrors)
326
+ );
327
+ throw new TIG_PostNL_Exception($error, 'POSTNL-0199');
328
+ }
329
+
330
+ return $this;
331
+ }
332
+
333
+ /**
334
+ * Validate row for import and return table rate array or false.
335
+ *
336
+ * Error will be add to _importErrors array.
337
+ *
338
+ * @param array $row
339
+ * @param int $rowNumber
340
+ *
341
+ * @return array|false
342
+ */
343
+ protected function _getImportRow($row, $rowNumber = 0)
344
+ {
345
+ // validate row
346
+ if (count($row) < 8) {
347
+ $this->_importErrors[] = Mage::helper('postnl')->__(
348
+ 'Invalid PostNL matrix rates format in row #%s',
349
+ $rowNumber
350
+ );
351
+ return false;
352
+ }
353
+
354
+ // strip whitespace from the beginning and end of each row
355
+ foreach ($row as $k => $v) {
356
+ $row[$k] = trim($v);
357
+ }
358
+
359
+ // validate country
360
+ $countries = explode(',', $row[0]);
361
+ $countryIds = array();
362
+ foreach ($countries as $country) {
363
+ $country = trim($country);
364
+ if (isset($this->_importIso2Countries[$country])) {
365
+ $countryIds[] = $this->_importIso2Countries[$country];
366
+ } elseif (isset($this->_importIso3Countries[$country])) {
367
+ $countryIds[] = $this->_importIso3Countries[$country];
368
+ } elseif ($country == '*' || $country == '') {
369
+ $countryIds[] = '0';
370
+ } else {
371
+ $this->_importErrors[] = Mage::helper('postnl')->__(
372
+ 'Invalid country "%s" in row #%s.',
373
+ $country,
374
+ $rowNumber
375
+ );
376
+
377
+ return false;
378
+ }
379
+ }
380
+ $countryId = implode(',', $countryIds);
381
+
382
+ // validate region
383
+ if ($countryId != '0' && isset($this->_importRegions[$countryId][$row[1]])) {
384
+ $regionId = $this->_importRegions[$countryId][$row[1]];
385
+ } elseif ($row[1] == '*' || $row[1] == '') {
386
+ $regionId = 0;
387
+ } else {
388
+ $this->_importErrors[] = Mage::helper('postnl')->__(
389
+ 'Invalid region/state "%s" in row #%s.',
390
+ $row[1],
391
+ $rowNumber
392
+ );
393
+ return false;
394
+ }
395
+
396
+ // detect zip code
397
+ if ($row[2] == '') {
398
+ $zipCode = '*';
399
+ } else {
400
+ $zipCode = $row[2];
401
+ }
402
+
403
+ // validate weight
404
+ $weight = $this->_parseDecimalValue($row[3]);
405
+ if ($weight === false) {
406
+ $this->_importErrors[] = Mage::helper('postnl')->__(
407
+ 'Invalid weight "%s" in row #%s.',
408
+ $row[3],
409
+ $rowNumber
410
+ );
411
+ return false;
412
+ }
413
+
414
+ // validate subtotal
415
+ $subtotal = $this->_parseDecimalValue($row[4]);
416
+ if ($subtotal === false) {
417
+ $this->_importErrors[] = Mage::helper('postnl')->__(
418
+ 'Invalid subtotal "%s" in row #%s.',
419
+ $row[4],
420
+ $rowNumber
421
+ );
422
+ return false;
423
+ }
424
+
425
+ // validate qty
426
+ $qty = $this->_parseIntegerValue($row[5]);
427
+ if ($qty === false) {
428
+ $this->_importErrors[] = Mage::helper('postnl')->__(
429
+ 'Invalid quantity "%s" in row #%s.',
430
+ $row[5],
431
+ $rowNumber
432
+ );
433
+ return false;
434
+ }
435
+
436
+ // validate parcel type
437
+ $parcelType = $this->_importParcelType($row[6]);
438
+ if (!$parcelType) {
439
+ $allowedParcelTypes = array(
440
+ '*',
441
+ 'letter_box',
442
+ 'regular'
443
+ );
444
+
445
+ $this->_importErrors[] = Mage::helper('postnl')->__(
446
+ 'Invalid parcel type "%s" in row #%s. Valid values are: "%s".',
447
+ $row[6],
448
+ $rowNumber,
449
+ implode('", "', $allowedParcelTypes)
450
+ );
451
+ return false;
452
+ }
453
+
454
+ // validate price
455
+ $price = $this->_parseDecimalValue($row[7]);
456
+ if ($price === false) {
457
+ $this->_importErrors[] = Mage::helper('postnl')->__(
458
+ 'Invalid shipping price "%s" in row #%s.',
459
+ $row[4],
460
+ $rowNumber
461
+ );
462
+ return false;
463
+ }
464
+
465
+ // protect from duplicate
466
+ $hash = sprintf("%s-%d-%s-%F-%F-%d-%s", $countryId, $regionId, $zipCode, $weight, $subtotal, $qty, $parcelType);
467
+ if (isset($this->_importUniqueHash[$hash])) {
468
+ $this->_importErrors[] = Mage::helper('postnl')->__(
469
+ 'Duplicate row #%s (country "%s", region/state "%s", zip "%s", weight "%s", subtotal "%s", quantity ' .
470
+ '"%s" and parcel type "%s").',
471
+ $rowNumber,
472
+ $row[0],
473
+ $row[1],
474
+ $zipCode,
475
+ $row[3],
476
+ $row[4],
477
+ $row[5],
478
+ $row[6]
479
+ );
480
+ return false;
481
+ }
482
+ $this->_importUniqueHash[$hash] = true;
483
+
484
+ return array(
485
+ $this->_importWebsiteId, // website_id
486
+ $countryId, // dest_country_id
487
+ $regionId, // dest_region_id,
488
+ $zipCode, // dest_zip
489
+ $weight, // weight,
490
+ $subtotal, // subtotal
491
+ $qty, // quantity
492
+ $parcelType, // parcel type
493
+ $price // price
494
+ );
495
+ }
496
+
497
+ /**
498
+ * Parse and validate positive integer value.
499
+ *
500
+ * Return false if value is not decimal or is not positive.
501
+ *
502
+ * @param string $value
503
+ *
504
+ * @return bool|int
505
+ */
506
+ protected function _parseintegerValue($value)
507
+ {
508
+ if (!is_numeric($value)) {
509
+ return false;
510
+ }
511
+
512
+ $value = (int) $value;
513
+
514
+ if ($value < 0) {
515
+ return false;
516
+ }
517
+
518
+ return $value;
519
+ }
520
+
521
+ /**
522
+ * Save import data batch.
523
+ *
524
+ * @param array $data
525
+ *
526
+ * @return $this
527
+ */
528
+ protected function _saveImportData(array $data)
529
+ {
530
+ if (!empty($data)) {
531
+ $columns = array(
532
+ 'website_id',
533
+ 'dest_country_id',
534
+ 'dest_region_id',
535
+ 'dest_zip',
536
+ 'weight',
537
+ 'subtotal',
538
+ 'qty',
539
+ 'parcel_type',
540
+ 'price',
541
+ );
542
+ $this->_getWriteAdapter()->insertArray($this->getMainTable(), $columns, $data);
543
+ $this->_importedRows += count($data);
544
+ }
545
+
546
+ return $this;
547
+ }
548
+
549
+ /**
550
+ * Import the parcel type column.
551
+ *
552
+ * @param $parcelType
553
+ *
554
+ * @return string|false
555
+ */
556
+ protected function _importParcelType($parcelType)
557
+ {
558
+ $formattedType = false;
559
+ switch ($parcelType) {
560
+ case '': //no break
561
+ case '0': //no break
562
+ case '*':
563
+ $formattedType = '*';
564
+ break;
565
+ case 'letter_box': //no break
566
+ case 'letterbox': //no break
567
+ case 'buspakje': //no break
568
+ case 'bus_pakje': //no break
569
+ case 'brievenbuspakje': //no break
570
+ case 'brievenbus pakje': //no break
571
+ case 'letterboxparcel': //no break
572
+ case 'letter box parcel':
573
+ $formattedType = 'letter_box';
574
+ break;
575
+ case 'regular': //no break
576
+ case 'standaard': //no break
577
+ case 'pakket': //no break
578
+ case 'belpakje': //no break
579
+ case 'parcel': //no break
580
+ case 'package':
581
+ $formattedType = 'regular';
582
+ break;
583
+ //no default
584
+ }
585
+
586
+ return $formattedType;
587
+ }
588
+ }
app/code/community/TIG/PostNL/Model/Carrier/Resource/Matrixrate/Collection.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ class TIG_PostNL_Model_Carrier_Resource_Matrixrate_Collection
40
+ extends Mage_Shipping_Model_Resource_Carrier_Tablerate_Collection
41
+ {
42
+ /**
43
+ * Define resource model and item.
44
+ */
45
+ protected function _construct()
46
+ {
47
+ $this->_init('postnl_carrier/matrixrate');
48
+ $this->_shipTable = $this->getMainTable();
49
+ $this->_countryTable = $this->getTable('directory/country');
50
+ $this->_regionTable = $this->getTable('directory/country_region');
51
+ }
52
+
53
+ /**
54
+ * Initialize select, add country iso3 code and region name, and define default sorting.
55
+ */
56
+ public function _initSelect()
57
+ {
58
+ Mage_Core_Model_Resource_Db_Collection_Abstract::_initSelect();
59
+
60
+ $this->_select->joinLeft(
61
+ array('region_table' => $this->_regionTable),
62
+ 'region_table.region_id = main_table.dest_region_id',
63
+ array('dest_region' => 'code')
64
+ );
65
+
66
+ $this->addOrder('dest_country_id', self::SORT_ORDER_ASC);
67
+ $this->addOrder('dest_region', self::SORT_ORDER_ASC);
68
+ $this->addOrder('dest_zip', self::SORT_ORDER_ASC);
69
+ $this->addOrder('weight', self::SORT_ORDER_ASC);
70
+ $this->addOrder('subtotal', self::SORT_ORDER_ASC);
71
+ $this->addOrder('qty', self::SORT_ORDER_ASC);
72
+ }
73
+ }
app/code/community/TIG/PostNL/Model/Carrier/Resource/Tablerate.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Carrier_Resource_Tablerate extends Mage_Shipping_Model_Resource_Carrier_Tablerate
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Carrier_Resource_Tablerate extends Mage_Shipping_Model_Resource_Carrier_Tablerate
app/code/community/TIG/PostNL/Model/Carrier/Resource/Tablerate/Collection.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Carrier_Resource_Tablerate_Collection
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Carrier_Resource_Tablerate_Collection
app/code/community/TIG/PostNL/Model/Carrier/System/Config/Backend/Matrixrate.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ class TIG_PostNL_Model_Carrier_System_Config_Backend_Matrixrate extends Mage_Core_Model_Config_Data
40
+ {
41
+ /**
42
+ * Upload a new csv file.
43
+ */
44
+ public function _afterSave()
45
+ {
46
+ Mage::getResourceModel('postnl_carrier/matrixrate')->uploadAndImport($this);
47
+ }
48
+ }
app/code/community/TIG/PostNL/Model/Carrier/System/Config/Backend/Tablerate.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Carrier_System_Config_Backend_Tablerate extends Mage_Core_Model_Config_Data
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Carrier_System_Config_Backend_Tablerate extends Mage_Core_Model_Config_Data
app/code/community/TIG/PostNL/Model/Carrier/System/Config/Source/RateType.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Carrier_System_Config_Source_RateType
@@ -55,6 +55,10 @@ class TIG_PostNL_Model_Carrier_System_Config_Source_RateType
55
  'value' => 'table',
56
  'label' => $helper->__('Table'),
57
  ),
 
 
 
 
58
  );
59
 
60
  return $options;
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Carrier_System_Config_Source_RateType
55
  'value' => 'table',
56
  'label' => $helper->__('Table'),
57
  ),
58
+ array(
59
+ 'value' => 'matrix',
60
+ 'label' => $helper->__('Matrix'),
61
+ ),
62
  );
63
 
64
  return $options;
app/code/community/TIG/PostNL/Model/Carrier/System/Config/Source/TablerateSource.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Carrier_System_Config_Source_TablerateSource
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Carrier_System_Config_Source_TablerateSource
app/code/community/TIG/PostNL/Model/Carrier/Tablerate.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * This is a dummy class for the tablerate export/import functionality.
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * This is a dummy class for the tablerate export/import functionality.
app/code/community/TIG/PostNL/Model/Checkout/Cif.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method TIG_PostNL_Model_Checkout_Cif setStoreId(int $value)
@@ -68,8 +68,8 @@ class TIG_PostNL_Model_Checkout_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
68
  /**
69
  * XML paths for shipment reference info
70
  */
71
- const XPATH_SHIPMENT_REFERENCE_TYPE = 'postnl/cif_labels_and_confirming/shipment_reference_type';
72
- const XPATH_CUSTOM_SHIPMENT_REFERENCE = 'postnl/cif_labels_and_confirming/custom_shipment_reference';
73
 
74
  /**
75
  * Check if the module is set to test mode
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method TIG_PostNL_Model_Checkout_Cif setStoreId(int $value)
68
  /**
69
  * XML paths for shipment reference info
70
  */
71
+ const XPATH_SHIPMENT_REFERENCE_TYPE = 'postnl/packing_slip/shipment_reference_type';
72
+ const XPATH_CUSTOM_SHIPMENT_REFERENCE = 'postnl/packing_slip/custom_shipment_reference';
73
 
74
  /**
75
  * Check if the module is set to test mode
app/code/community/TIG/PostNL/Model/Checkout/Observer/Order.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Checkout_Observer_Order
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Checkout_Observer_Order
app/code/community/TIG/PostNL/Model/Checkout/Observer/Shipment.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Checkout_Observer_Shipment
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Checkout_Observer_Shipment
app/code/community/TIG/PostNL/Model/Checkout/Order.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @deprecated 1.2.0 This class has been moved to TIG_PostNL_Model_Core_Order. A dummy class has been left behind to
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @deprecated 1.2.0 This class has been moved to TIG_PostNL_Model_Core_Order. A dummy class has been left behind to
app/code/community/TIG/PostNL/Model/Checkout/Service.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method TIG_PostNL_Model_Checkout_Service setQuote(Mage_Sales_Model_Quote $value)
@@ -50,17 +50,17 @@ class TIG_PostNL_Model_Checkout_Service extends Varien_Object
50
  /**
51
  * Constants containing XML paths to cif address configuration options
52
  */
53
- const XPATH_SPLIT_STREET = 'postnl/cif_address/split_street';
54
- const XPATH_STREETNAME_FIELD = 'postnl/cif_address/streetname_field';
55
- const XPATH_HOUSENUMBER_FIELD = 'postnl/cif_address/housenr_field';
56
- const XPATH_SPLIT_HOUSENUMBER = 'postnl/cif_address/split_housenr';
57
- const XPATH_HOUSENUMBER_EXTENSION_FIELD = 'postnl/cif_address/housenr_extension_field';
58
- const XPATH_AREA_FIELD = 'postnl/cif_address/area_field';
59
- const XPATH_BUILDING_NAME_FIELD = 'postnl/cif_address/building_name_field';
60
- const XPATH_DEPARTMENT_FIELD = 'postnl/cif_address/department_field';
61
- const XPATH_DOORCODE_FIELD = 'postnl/cif_address/doorcode_field';
62
- const XPATH_FLOOR_FIELD = 'postnl/cif_address/floor_field';
63
- const XPATH_REMARK_FIELD = 'postnl/cif_address/remark_field';
64
 
65
  /**
66
  * XML path to all PostNL Checkout payment settings
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method TIG_PostNL_Model_Checkout_Service setQuote(Mage_Sales_Model_Quote $value)
50
  /**
51
  * Constants containing XML paths to cif address configuration options
52
  */
53
+ const XPATH_SPLIT_STREET = 'postnl/cif_labels_and_confirming/split_street';
54
+ const XPATH_STREETNAME_FIELD = 'postnl/cif_labels_and_confirming/streetname_field';
55
+ const XPATH_HOUSENUMBER_FIELD = 'postnl/cif_labels_and_confirming/housenr_field';
56
+ const XPATH_SPLIT_HOUSENUMBER = 'postnl/cif_labels_and_confirming/split_housenr';
57
+ const XPATH_HOUSENUMBER_EXTENSION_FIELD = 'postnl/cif_labels_and_confirming/housenr_extension_field';
58
+ const XPATH_AREA_FIELD = 'postnl/cif_labels_and_confirming/area_field';
59
+ const XPATH_BUILDING_NAME_FIELD = 'postnl/cif_labels_and_confirming/building_name_field';
60
+ const XPATH_DEPARTMENT_FIELD = 'postnl/cif_labels_and_confirming/department_field';
61
+ const XPATH_DOORCODE_FIELD = 'postnl/cif_labels_and_confirming/doorcode_field';
62
+ const XPATH_FLOOR_FIELD = 'postnl/cif_labels_and_confirming/floor_field';
63
+ const XPATH_REMARK_FIELD = 'postnl/cif_labels_and_confirming/remark_field';
64
 
65
  /**
66
  * XML path to all PostNL Checkout payment settings
app/code/community/TIG/PostNL/Model/Checkout/System/Config/Source/ActivePaymentMethods.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Checkout_System_Config_Source_ActivePaymentMethods
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Checkout_System_Config_Source_ActivePaymentMethods
app/code/community/TIG/PostNL/Model/Checkout/System/Config/Source/CmsPage.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Checkout_System_Config_Source_CmsPage
@@ -44,7 +44,7 @@ class TIG_PostNL_Model_Checkout_System_Config_Source_CmsPage
44
  protected $_options;
45
 
46
  /**
47
- * Get the stored options array
48
  *
49
  * @return array
50
  */
@@ -54,7 +54,7 @@ class TIG_PostNL_Model_Checkout_System_Config_Source_CmsPage
54
  }
55
 
56
  /**
57
- * Store the options array
58
  *
59
  * @param array $options
60
  *
@@ -68,7 +68,7 @@ class TIG_PostNL_Model_Checkout_System_Config_Source_CmsPage
68
  }
69
 
70
  /**
71
- * Checks if an option array has been stored
72
  *
73
  * @return boolean
74
  */
@@ -83,7 +83,7 @@ class TIG_PostNL_Model_Checkout_System_Config_Source_CmsPage
83
  }
84
 
85
  /**
86
- * Get an option array of all CMS pages available
87
  *
88
  * @return array
89
  */
@@ -95,7 +95,10 @@ class TIG_PostNL_Model_Checkout_System_Config_Source_CmsPage
95
  }
96
 
97
  $options = array(
98
- '' => Mage::helper('postnl')->__('-- none --'),
 
 
 
99
  );
100
 
101
  /**
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Checkout_System_Config_Source_CmsPage
44
  protected $_options;
45
 
46
  /**
47
+ * Get the stored options array.
48
  *
49
  * @return array
50
  */
54
  }
55
 
56
  /**
57
+ * Store the options array.
58
  *
59
  * @param array $options
60
  *
68
  }
69
 
70
  /**
71
+ * Checks if an option array has been stored.
72
  *
73
  * @return boolean
74
  */
83
  }
84
 
85
  /**
86
+ * Get an option array of all CMS pages available.
87
  *
88
  * @return array
89
  */
95
  }
96
 
97
  $options = array(
98
+ array(
99
+ 'value' => '',
100
+ 'label' => Mage::helper('postnl')->__('-- none --'),
101
+ )
102
  );
103
 
104
  /**
app/code/community/TIG/PostNL/Model/Core/Cache.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasPostnlCoreIsEnabled()
@@ -57,6 +57,10 @@
57
  * @method boolean hasPostnlMijnpakketCanShowNotification()
58
  * @method boolean hasPostnlCoreCanUseBuspakje()
59
  * @method boolean hasPostnlDeliveryOptionsCanUseDeliveryDays()
 
 
 
 
60
  *
61
  * @method boolean getPostnlCoreIsEnabled()
62
  * @method boolean getPostnlCoreIsConfigured()
@@ -79,6 +83,10 @@
79
  * @method boolean getPostnlMijnpakketCanShowNotification()
80
  * @method boolean getPostnlCoreCanUseBuspakje()
81
  * @method boolean getPostnlDeliveryOptionsCanUseDeliveryDays()
 
 
 
 
82
  *
83
  * @method TIG_PostNL_Model_Core_Cache setPostnlCoreIsEnabled(boolean $value)
84
  * @method TIG_PostNL_Model_Core_Cache setPostnlCoreIsConfigured(boolean $value)
@@ -101,6 +109,10 @@
101
  * @method TIG_PostNL_Model_Core_Cache setPostnlMijnpakketCanShowNotification(boolean $value)
102
  * @method TIG_PostNL_Model_Core_Cache setPostnlCoreCanUseBuspakje(boolean $value)
103
  * @method TIG_PostNL_Model_Core_Cache setPostnlDeliveryOptionsCanUseDeliveryDays(boolean $value)
 
 
 
 
104
  */
105
  class TIG_PostNL_Model_Core_Cache extends Varien_Object
106
  {
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasPostnlCoreIsEnabled()
57
  * @method boolean hasPostnlMijnpakketCanShowNotification()
58
  * @method boolean hasPostnlCoreCanUseBuspakje()
59
  * @method boolean hasPostnlDeliveryOptionsCanUseDeliveryDays()
60
+ * @method boolean hasCanShowOnlyStatedAddressOption()
61
+ * @method boolean hasPostnlShippingMethods()
62
+ * @method boolean hasMatchedPostnlShippingMethods()
63
+ * @method boolean hasCanUseResponsiveDeliveryOptions()
64
  *
65
  * @method boolean getPostnlCoreIsEnabled()
66
  * @method boolean getPostnlCoreIsConfigured()
83
  * @method boolean getPostnlMijnpakketCanShowNotification()
84
  * @method boolean getPostnlCoreCanUseBuspakje()
85
  * @method boolean getPostnlDeliveryOptionsCanUseDeliveryDays()
86
+ * @method boolean getCanShowOnlyStatedAddressOption()
87
+ * @method array getPostnlShippingMethods()
88
+ * @method array getMatchedPostnlShippingMethods()
89
+ * @method boolean getCanUseResponsiveDeliveryOptions()
90
  *
91
  * @method TIG_PostNL_Model_Core_Cache setPostnlCoreIsEnabled(boolean $value)
92
  * @method TIG_PostNL_Model_Core_Cache setPostnlCoreIsConfigured(boolean $value)
109
  * @method TIG_PostNL_Model_Core_Cache setPostnlMijnpakketCanShowNotification(boolean $value)
110
  * @method TIG_PostNL_Model_Core_Cache setPostnlCoreCanUseBuspakje(boolean $value)
111
  * @method TIG_PostNL_Model_Core_Cache setPostnlDeliveryOptionsCanUseDeliveryDays(boolean $value)
112
+ * @method TIG_PostNL_Model_Core_Cache setCanShowOnlyStatedAddressOption(boolean $value)
113
+ * @method TIG_PostNL_Model_Core_Cache setPostnlShippingMethods(array $value)
114
+ * @method TIG_PostNL_Model_Core_Cache setMatchedPostnlShippingMethods(array $value)
115
+ * @method TIG_PostNL_Model_Core_Cache setCanUseResponsiveDeliveryOptions(boolean $value)
116
  */
117
  class TIG_PostNL_Model_Core_Cache extends Varien_Object
118
  {
app/code/community/TIG/PostNL/Model/Core/Cif.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * Class containing all default methods used for CIF communication by this extension.
@@ -63,18 +63,18 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
63
  const XPATH_CUSTOMER_CODE = 'postnl/cif/customer_code';
64
  const XPATH_CUSTOMER_NUMBER = 'postnl/cif/customer_number';
65
  const XPATH_COLLECTION_LOCATION = 'postnl/cif/collection_location';
66
- const XPATH_GLOBAL_BARCODE_TYPE = 'postnl/cif/global_barcode_type';
67
- const XPATH_GLOBAL_BARCODE_RANGE = 'postnl/cif/global_barcode_range';
68
 
69
  /**
70
  * Constants containing xpaths to cif address configuration options.
71
  */
72
- const XPATH_AREA_FIELD = 'postnl/cif_address/area_field';
73
- const XPATH_BUILDING_NAME_FIELD = 'postnl/cif_address/building_name_field';
74
- const XPATH_DEPARTMENT_FIELD = 'postnl/cif_address/department_field';
75
- const XPATH_DOORCODE_FIELD = 'postnl/cif_address/doorcode_field';
76
- const XPATH_FLOOR_FIELD = 'postnl/cif_address/floor_field';
77
- const XPATH_REMARK_FIELD = 'postnl/cif_address/remark_field';
78
 
79
  /**
80
  * Constants containing xpaths to cif customs configuration options.
@@ -92,27 +92,20 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
92
  /**
93
  * Xpath to setting that determines whether to use a separate return address.
94
  */
95
- const XPATH_USE_SENDER_ADDRESS_AS_RETURN = 'postnl/cif_return_address/use_sender_address';
96
 
97
  /**
98
  * Xpath to sender address data.
99
  *
100
  * N.B. missing last part so this will return an array of all fields.
101
  */
102
- const XPATH_SENDER_ADDRESS = 'postnl/cif_sender_address';
103
-
104
- /**
105
- * Xpath to return address data.
106
- *
107
- * N.B. missing last part so this will return an array of all fields.
108
- */
109
- const XPATH_RETURN_ADDRESS = 'postnl/cif_return_address';
110
 
111
  /**.
112
- * Xpaths for shipment reference info
113
  */
114
- const XPATH_SHIPMENT_REFERENCE_TYPE = 'postnl/cif_labels_and_confirming/shipment_reference_type';
115
- const XPATH_CUSTOM_SHIPMENT_REFERENCE = 'postnl/cif_labels_and_confirming/custom_shipment_reference';
116
 
117
  /**
118
  * Possible barcodes series per barcode type.
@@ -126,7 +119,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
126
  /**
127
  * Xpath to weight per parcel config setting.
128
  */
129
- const XPATH_WEIGHT_PER_PARCEL = 'postnl/cif_labels_and_confirming/weight_per_parcel';
130
 
131
  /**
132
  * XPaths for COD specific settings.
@@ -135,6 +128,16 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
135
  const XPATH_COD_BIC = 'postnl/cod/bic';
136
  const XPATH_COD_IBAN = 'postnl/cod/iban';
137
 
 
 
 
 
 
 
 
 
 
 
138
  /**
139
  * Array containing possible address types.
140
  *
@@ -150,8 +153,8 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
150
  );
151
 
152
  /**
153
- * array containing all available printer types. These are used to determine the output type of shipping labels
154
- * currently only GraphicFile|PDF is supported
155
  *
156
  * printer type syntax is: <printer family>|<printer type>
157
  *
@@ -168,7 +171,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
168
  'GraphicFile|PDF',
169
  'GraphicFile|PS',
170
 
171
- //Intermec FingerPrint
172
  'IntermecEasyCoder PF4i',
173
 
174
  //Intermec IDP
@@ -242,7 +245,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
242
  );
243
 
244
  /**
245
- * Get possible address types
246
  *
247
  * @return array
248
  */
@@ -252,7 +255,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
252
  }
253
 
254
  /**
255
- * Get possible printer types
256
  *
257
  * @return array
258
  */
@@ -262,7 +265,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
262
  }
263
 
264
  /**
265
- * Get shipment types that require an invoice number
266
  *
267
  * @return array
268
  */
@@ -282,7 +285,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
282
  }
283
 
284
  /**
285
- * Gets the current store id. If no store id is specified, return the default admin store id
286
  *
287
  * @return int
288
  */
@@ -299,7 +302,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
299
  }
300
 
301
  /**
302
- * Retrieves a barcode from CIF
303
  *
304
  * @param Mage_Sales_Model_Order_Shipment $shipment
305
  * @param string $barcodeType Which kind of barcode to generate
@@ -410,7 +413,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
410
  }
411
 
412
  /**
413
- * Retrieves the latest shipping status of a shipment from CIF
414
  *
415
  * @param TIG_PostnL_Model_Core_Shipment $postnlShipment
416
  *
@@ -478,7 +481,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
478
  }
479
 
480
  /**
481
- * Retrieves the latest shipping status of a shipment from CIF including full status history
482
  *
483
  * @param TIG_PostnL_Model_Core_Shipment $postnlShipment
484
  *
@@ -540,7 +543,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
540
  }
541
 
542
  /**
543
- * Confirms the choen shipment without generating labels
544
  *
545
  * @param TIG_PostNL_Model_Core_Shipment $postnlShipment
546
  * @param string $barcode
@@ -606,7 +609,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
606
  }
607
 
608
  /**
609
- * Generates shipping labels for the chosen shipment
610
  *
611
  * @param TIG_PostnL_Model_Core_Shipment $postnlShipment
612
  * @param $barcode
@@ -670,14 +673,14 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
670
  }
671
 
672
  /**
673
- * Generates shipping labels for the chosen shipment without confirming it
674
  *
675
  * @param TIG_PostnL_Model_Core_Shipment $postnlShipment
676
  * @param string $barcode
677
  * @param boolean|string $mainBarcode
678
  * @param bool|int $shipmentNumber
679
- * @param string $printerType The printertype used. Currently only
680
- * 'GraphicFile|PDF' is fully supported.
681
  *
682
  *
683
  * @throws TIG_PostNL_Exception
@@ -743,7 +746,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
743
  }
744
 
745
  /**
746
- * Gets the Message parameter
747
  *
748
  * @param $barcode
749
  * @param array $extra An array of additional parameters to add
@@ -773,7 +776,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
773
  }
774
 
775
  /**
776
- * Gets the customer parameter
777
  *
778
  * @param Mage_Sales_Model_Order_Shipment|boolean $shipment
779
  *
@@ -799,7 +802,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
799
  }
800
 
801
  /**
802
- * Creates the CIF shipment object based on a PostNL shipment
803
  *
804
  * @param TIG_PostnL_Model_Core_Shipment $postnlShipment
805
  * @param $barcode
@@ -928,7 +931,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
928
  */
929
  protected function _getShipmentAddresses(TIG_PostnL_Model_Core_Shipment $postnlShipment, $shippingAddress)
930
  {
931
- $useSenderAddressAsReturn = Mage::getStoreConfig(
932
  self::XPATH_USE_SENDER_ADDRESS_AS_RETURN,
933
  $this->getStoreId()
934
  );
@@ -945,7 +948,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
945
  }
946
 
947
  if ($pakjeGemakAddress) {
948
- $addresses['Address'][] =$this->_getAddress('Delivery', $pakjeGemakAddress);
949
  }
950
 
951
  return $addresses;
@@ -956,7 +959,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
956
  *
957
  * @param TIG_PostnL_Model_Core_Shipment $postnlShipment
958
  *
959
- * @return array|bool
960
  */
961
  protected function _getProductOptions(TIG_PostnL_Model_Core_Shipment $postnlShipment)
962
  {
@@ -978,7 +981,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
978
  }
979
 
980
  /**
981
- * Gets an array containing required address data
982
  *
983
  * @param $addressType
984
  * @param bool|string $shippingAddress
@@ -1004,7 +1007,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
1004
  switch ($addressType) {
1005
  case 'Sender':
1006
  /**
1007
- * Get all cif_sender_address fields as an array and convert that to a Varien_Object
1008
  * This allows the _prepareAddress method to access this data in the same way as a
1009
  * conventional Mage_Sales_Model_Order_Address object.
1010
  */
@@ -1032,20 +1035,29 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
1032
  }
1033
 
1034
  /**
1035
- * Get all cif_return_address fields as an array and convert that to a Varien_Object. This allows the
1036
- * _prepareAddress method to access this data in the same way as a conventional
1037
- * Mage_Sales_Model_Order_Address object.
1038
  */
1039
- $returnAddress = Mage::getStoreConfig(self::XPATH_RETURN_ADDRESS, $this->getStoreId());
1040
 
1041
  $streetData = array(
1042
- 'streetname' => $returnAddress['streetname'],
1043
- 'housenumber' => $returnAddress['housenumber'],
1044
- 'housenumberExtension' => $returnAddress['housenumber_extension'],
1045
  'fullStreet' => '',
1046
  );
1047
 
1048
- $address = new Varien_Object($returnAddress);
 
 
 
 
 
 
 
 
 
1049
  break;
1050
  case 'PakjeGemak': //no break
1051
  case 'Receiver': //no break
@@ -1061,7 +1073,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
1061
  }
1062
 
1063
  /**
1064
- * Forms an array of address data compatible with CIF
1065
 
1066
  * @param Mage_Sales_Model_Order_Address|Varien_Object $address
1067
  * @param array|boolean $streetData Optional parameter containing streetname,
@@ -1105,8 +1117,8 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
1105
  }
1106
 
1107
  /**
1108
- * Gets data for the barcode that's requested. Depending on the destination of the shipment
1109
- * several barcode types may be requested.
1110
  *
1111
  * @param string $barcodeType
1112
  *
@@ -1218,7 +1230,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
1218
  }
1219
 
1220
  /**
1221
- * Creates the CIF contact object
1222
  *
1223
  * @param Mage_Sales_Model_Order_Address $address
1224
  * @param TIG_PostNL_Model_Core_Shipment $postnlShipment
@@ -1260,7 +1272,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
1260
  }
1261
 
1262
  /**
1263
- * Creates the CIF group object
1264
  *
1265
  * @param int $groupCount
1266
  * @param bool $mainBarcode
@@ -1316,7 +1328,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
1316
  }
1317
 
1318
  /**
1319
- * create Customs CIF object
1320
  *
1321
  * @param TIG_PostNL_Model_Core_Shipment $postnlShipment
1322
  *
@@ -1381,7 +1393,18 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
1381
  */
1382
  $itemCount = 0;
1383
  $content = array();
1384
- $items = $this->_sortCustomsItems($shipment->getAllItems());
 
 
 
 
 
 
 
 
 
 
 
1385
 
1386
  $helper = Mage::helper('postnl');
1387
 
@@ -1392,7 +1415,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
1392
  /**
1393
  * A maximum of 5 rows are allowed
1394
  */
1395
- if (++$itemCount > 5) {
1396
  break;
1397
  }
1398
 
@@ -1445,9 +1468,9 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
1445
  }
1446
 
1447
  /**
1448
- * Sorts an array of shipment items based on a product attribute that is defined in the module configuration
1449
  *
1450
- * @param array $items
1451
  *
1452
  * @return array
1453
  */
@@ -1465,18 +1488,35 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
1465
  $this->getStoreId()
1466
  );
1467
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1468
  /**
1469
  * Place the item's sorting value in a temporary array where the key is the item's ID
1470
  *
1471
  * @var Mage_Sales_Model_Order_Shipment_Item $item
1472
  */
 
1473
  foreach ($items as $item) {
1474
- $product = Mage::getModel('catalog/product')->load($item->getOrderItem()->getProductId());
1475
- if (!$product) {
1476
- continue;
1477
- }
1478
 
1479
- $sortingAttributeValue = $product->getDataUsingMethod($sortingAttribute);
1480
  $sortedItems[$item->getId()] = $sortingAttributeValue;
1481
  }
1482
 
@@ -1501,7 +1541,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
1501
  }
1502
 
1503
  /**
1504
- * Get a shipment item's HS tariff
1505
  *
1506
  * @param Mage_Sales_Model_Order_Shipment_Item $shipmentItem
1507
  *
@@ -1515,7 +1555,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
1515
  * HS Tariff is an optional attribute. Check if it's used and if not, return a default value of 000000
1516
  */
1517
  if (!Mage::getStoreConfig(self::XPATH_GLOBALPACK_USE_HS_TARIFF_ATTRIBUTE, $storeId)) {
1518
- return '000000';
1519
  }
1520
 
1521
  if ($this->hasHSTariffAttribute()) {
@@ -1529,14 +1569,14 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
1529
  $hsTariff = $product->getDataUsingMethod($hsTariffAttribute);
1530
 
1531
  if (empty($hsTariff)) {
1532
- $hsTariff = '000000';
1533
  }
1534
 
1535
  return $hsTariff;
1536
  }
1537
 
1538
  /**
1539
- * Get a shipment item's country of origin
1540
  *
1541
  * @param Mage_Sales_Model_Order_Shipment_Item $shipmentItem
1542
  *
@@ -1576,7 +1616,7 @@ class TIG_PostNL_Model_Core_Cif extends TIG_PostNL_Model_Core_Cif_Abstract
1576
  }
1577
 
1578
  /**
1579
- * Get a shipment item's customs value
1580
  *
1581
  * @param Mage_Sales_Model_Order_Shipment_Item $shipmentItem
1582
  *
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * Class containing all default methods used for CIF communication by this extension.
63
  const XPATH_CUSTOMER_CODE = 'postnl/cif/customer_code';
64
  const XPATH_CUSTOMER_NUMBER = 'postnl/cif/customer_number';
65
  const XPATH_COLLECTION_LOCATION = 'postnl/cif/collection_location';
66
+ const XPATH_GLOBAL_BARCODE_TYPE = 'postnl/cif_globalpack_settings/global_barcode_type';
67
+ const XPATH_GLOBAL_BARCODE_RANGE = 'postnl/cif_globalpack_settings/global_barcode_range';
68
 
69
  /**
70
  * Constants containing xpaths to cif address configuration options.
71
  */
72
+ const XPATH_AREA_FIELD = 'postnl/cif_labels_and_confirming/area_field';
73
+ const XPATH_BUILDING_NAME_FIELD = 'postnl/cif_labels_and_confirming/building_name_field';
74
+ const XPATH_DEPARTMENT_FIELD = 'postnl/cif_labels_and_confirming/department_field';
75
+ const XPATH_DOORCODE_FIELD = 'postnl/cif_labels_and_confirming/doorcode_field';
76
+ const XPATH_FLOOR_FIELD = 'postnl/cif_labels_and_confirming/floor_field';
77
+ const XPATH_REMARK_FIELD = 'postnl/cif_labels_and_confirming/remark_field';
78
 
79
  /**
80
  * Constants containing xpaths to cif customs configuration options.
92
  /**
93
  * Xpath to setting that determines whether to use a separate return address.
94
  */
95
+ const XPATH_USE_SENDER_ADDRESS_AS_RETURN = 'postnl/cif_address/use_sender_address';
96
 
97
  /**
98
  * Xpath to sender address data.
99
  *
100
  * N.B. missing last part so this will return an array of all fields.
101
  */
102
+ const XPATH_SENDER_ADDRESS = 'postnl/cif_address';
 
 
 
 
 
 
 
103
 
104
  /**.
105
+ * Xpaths for shipment reference info.
106
  */
107
+ const XPATH_SHIPMENT_REFERENCE_TYPE = 'postnl/packing_slip/shipment_reference_type';
108
+ const XPATH_CUSTOM_SHIPMENT_REFERENCE = 'postnl/packing_slip/custom_shipment_reference';
109
 
110
  /**
111
  * Possible barcodes series per barcode type.
119
  /**
120
  * Xpath to weight per parcel config setting.
121
  */
122
+ const XPATH_WEIGHT_PER_PARCEL = 'postnl/packing_slip/weight_per_parcel';
123
 
124
  /**
125
  * XPaths for COD specific settings.
128
  const XPATH_COD_BIC = 'postnl/cod/bic';
129
  const XPATH_COD_IBAN = 'postnl/cod/iban';
130
 
131
+ /**
132
+ * The maximum amount of products which can be printed on the customs declaration form.
133
+ */
134
+ const MAX_CUSTOMS_PRODUCT_COUNT = 5;
135
+
136
+ /**
137
+ * Default HS tariff value.
138
+ */
139
+ const DEFAULT_HS_TARIFF = '000000';
140
+
141
  /**
142
  * Array containing possible address types.
143
  *
153
  );
154
 
155
  /**
156
+ * Array containing all available printer types. These are used to determine the output type of shipping labels
157
+ * currently only GraphicFile|PDF is supported.
158
  *
159
  * printer type syntax is: <printer family>|<printer type>
160
  *
171
  'GraphicFile|PDF',
172
  'GraphicFile|PS',
173
 
174
+ //Intermec FinnerPrint
175
  'IntermecEasyCoder PF4i',
176
 
177
  //Intermec IDP
245
  );
246
 
247
  /**
248
+ * Get possible address types.
249
  *
250
  * @return array
251
  */
255
  }
256
 
257
  /**
258
+ * Get possible printer types.
259
  *
260
  * @return array
261
  */
265
  }
266
 
267
  /**
268
+ * Get shipment types that require an invoice number.
269
  *
270
  * @return array
271
  */
285
  }
286
 
287
  /**
288
+ * Gets the current store id. If no store id is specified, return the default admin store id.
289
  *
290
  * @return int
291
  */
302
  }
303
 
304
  /**
305
+ * Retrieves a barcode from CIF.
306
  *
307
  * @param Mage_Sales_Model_Order_Shipment $shipment
308
  * @param string $barcodeType Which kind of barcode to generate
413
  }
414
 
415
  /**
416
+ * Retrieves the latest shipping status of a shipment from CIF.
417
  *
418
  * @param TIG_PostnL_Model_Core_Shipment $postnlShipment
419
  *
481
  }
482
 
483
  /**
484
+ * Retrieves the latest shipping status of a shipment from CIF including full status history.
485
  *
486
  * @param TIG_PostnL_Model_Core_Shipment $postnlShipment
487
  *
543
  }
544
 
545
  /**
546
+ * Confirms the chosen shipment without generating labels.
547
  *
548
  * @param TIG_PostNL_Model_Core_Shipment $postnlShipment
549
  * @param string $barcode
609
  }
610
 
611
  /**
612
+ * Generates shipping labels for the chosen shipment.
613
  *
614
  * @param TIG_PostnL_Model_Core_Shipment $postnlShipment
615
  * @param $barcode
673
  }
674
 
675
  /**
676
+ * Generates shipping labels for the chosen shipment without confirming it.
677
  *
678
  * @param TIG_PostnL_Model_Core_Shipment $postnlShipment
679
  * @param string $barcode
680
  * @param boolean|string $mainBarcode
681
  * @param bool|int $shipmentNumber
682
+ * @param string $printerType The printertype used. Currently only 'GraphicFile|PDF'
683
+ * is fully supported.
684
  *
685
  *
686
  * @throws TIG_PostNL_Exception
746
  }
747
 
748
  /**
749
+ * Gets the Message parameter.
750
  *
751
  * @param $barcode
752
  * @param array $extra An array of additional parameters to add
776
  }
777
 
778
  /**
779
+ * Gets the customer parameter.
780
  *
781
  * @param Mage_Sales_Model_Order_Shipment|boolean $shipment
782
  *
802
  }
803
 
804
  /**
805
+ * Creates the CIF shipment object based on a PostNL shipment.
806
  *
807
  * @param TIG_PostnL_Model_Core_Shipment $postnlShipment
808
  * @param $barcode
931
  */
932
  protected function _getShipmentAddresses(TIG_PostnL_Model_Core_Shipment $postnlShipment, $shippingAddress)
933
  {
934
+ $useSenderAddressAsReturn = Mage::getStoreConfigFlag(
935
  self::XPATH_USE_SENDER_ADDRESS_AS_RETURN,
936
  $this->getStoreId()
937
  );
948
  }
949
 
950
  if ($pakjeGemakAddress) {
951
+ $addresses['Address'][] = $this->_getAddress('Delivery', $pakjeGemakAddress);
952
  }
953
 
954
  return $addresses;
959
  *
960
  * @param TIG_PostnL_Model_Core_Shipment $postnlShipment
961
  *
962
+ * @return array|false
963
  */
964
  protected function _getProductOptions(TIG_PostnL_Model_Core_Shipment $postnlShipment)
965
  {
981
  }
982
 
983
  /**
984
+ * Gets an array containing required address data.
985
  *
986
  * @param $addressType
987
  * @param bool|string $shippingAddress
1007
  switch ($addressType) {
1008
  case 'Sender':
1009
  /**
1010
+ * Get all cif_address fields as an array and convert that to a Varien_Object
1011
  * This allows the _prepareAddress method to access this data in the same way as a
1012
  * conventional Mage_Sales_Model_Order_Address object.
1013
  */
1035
  }
1036
 
1037
  /**
1038
+ * Get all cif_address fields with the 'return_' prefix as an array and convert that to a
1039
+ * Varien_Object. This allows the _prepareAddress method to access this data in the same way as a
1040
+ * conventional Mage_Sales_Model_Order_Address object.
1041
  */
1042
+ $returnAddress = Mage::getStoreConfig(self::XPATH_SENDER_ADDRESS, $this->getStoreId());
1043
 
1044
  $streetData = array(
1045
+ 'streetname' => $returnAddress['return_streetname'],
1046
+ 'housenumber' => $returnAddress['return_housenumber'],
1047
+ 'housenumberExtension' => $returnAddress['return_housenumber_extension'],
1048
  'fullStreet' => '',
1049
  );
1050
 
1051
+ $returnAddressData = array();
1052
+ foreach($returnAddress as $field => $value) {
1053
+ if (strpos($field, 'return_') === false) {
1054
+ continue;
1055
+ }
1056
+
1057
+ $returnAddressData[substr($field, 7)] = $value;
1058
+ }
1059
+
1060
+ $address = new Varien_Object($returnAddressData);
1061
  break;
1062
  case 'PakjeGemak': //no break
1063
  case 'Receiver': //no break
1073
  }
1074
 
1075
  /**
1076
+ * Forms an array of address data compatible with CIF.
1077
 
1078
  * @param Mage_Sales_Model_Order_Address|Varien_Object $address
1079
  * @param array|boolean $streetData Optional parameter containing streetname,
1117
  }
1118
 
1119
  /**
1120
+ * Gets data for the barcode that's requested. Depending on the destination of the shipment several barcode types
1121
+ * may be requested.
1122
  *
1123
  * @param string $barcodeType
1124
  *
1230
  }
1231
 
1232
  /**
1233
+ * Creates the CIF contact object.
1234
  *
1235
  * @param Mage_Sales_Model_Order_Address $address
1236
  * @param TIG_PostNL_Model_Core_Shipment $postnlShipment
1272
  }
1273
 
1274
  /**
1275
+ * Creates the CIF group object.
1276
  *
1277
  * @param int $groupCount
1278
  * @param bool $mainBarcode
1328
  }
1329
 
1330
  /**
1331
+ * Create Customs CIF object.
1332
  *
1333
  * @param TIG_PostNL_Model_Core_Shipment $postnlShipment
1334
  *
1393
  */
1394
  $itemCount = 0;
1395
  $content = array();
1396
+
1397
+ /**
1398
+ * @var Mage_Sales_Model_Order_Shipment_Item $item
1399
+ */
1400
+ $items = $shipment->getItemsCollection();
1401
+ foreach ($items as $key => $item) {
1402
+ if ($item->isDeleted()) {
1403
+ $items->removeItemByKey($key);
1404
+ }
1405
+ }
1406
+
1407
+ $items = $this->_sortCustomsItems($items);
1408
 
1409
  $helper = Mage::helper('postnl');
1410
 
1415
  /**
1416
  * A maximum of 5 rows are allowed
1417
  */
1418
+ if (++$itemCount > self::MAX_CUSTOMS_PRODUCT_COUNT) {
1419
  break;
1420
  }
1421
 
1468
  }
1469
 
1470
  /**
1471
+ * Sorts an array of shipment items based on a product attribute that is defined in the module configuration.
1472
  *
1473
+ * @param Mage_Sales_Model_Resource_Order_Shipment_Item_Collection $items
1474
  *
1475
  * @return array
1476
  */
1488
  $this->getStoreId()
1489
  );
1490
 
1491
+ /**
1492
+ * Get all products linked to the requested items.
1493
+ */
1494
+ $productIds = $items->getColumnValues('product_id');
1495
+ $products = Mage::getResourceModel('catalog/product_collection')
1496
+ ->setStoreId($this->getStoreId())
1497
+ ->addFieldToFilter('entity_id', array('in' => $productIds))
1498
+ ->addAttributeToSelect($sortingAttribute)
1499
+ ->setOrder($sortingAttribute, strtoupper($sortingDirection));
1500
+
1501
+ $products->getSelect()->limit(self::MAX_CUSTOMS_PRODUCT_COUNT);
1502
+
1503
+ /**
1504
+ * Get the attribute values of the requested sorting attribute.
1505
+ */
1506
+ $attributeValues = array();
1507
+ foreach ($products as $product) {
1508
+ $attributeValues[$product->getId()] = $product->getDataUsingMethod($sortingAttribute);
1509
+ }
1510
+
1511
  /**
1512
  * Place the item's sorting value in a temporary array where the key is the item's ID
1513
  *
1514
  * @var Mage_Sales_Model_Order_Shipment_Item $item
1515
  */
1516
+ $sortedItems = array();
1517
  foreach ($items as $item) {
1518
+ $sortingAttributeValue = $attributeValues[$item->getProductId()];
 
 
 
1519
 
 
1520
  $sortedItems[$item->getId()] = $sortingAttributeValue;
1521
  }
1522
 
1541
  }
1542
 
1543
  /**
1544
+ * Get a shipment item's HS tariff.
1545
  *
1546
  * @param Mage_Sales_Model_Order_Shipment_Item $shipmentItem
1547
  *
1555
  * HS Tariff is an optional attribute. Check if it's used and if not, return a default value of 000000
1556
  */
1557
  if (!Mage::getStoreConfig(self::XPATH_GLOBALPACK_USE_HS_TARIFF_ATTRIBUTE, $storeId)) {
1558
+ return self::DEFAULT_HS_TARIFF;
1559
  }
1560
 
1561
  if ($this->hasHSTariffAttribute()) {
1569
  $hsTariff = $product->getDataUsingMethod($hsTariffAttribute);
1570
 
1571
  if (empty($hsTariff)) {
1572
+ $hsTariff = self::DEFAULT_HS_TARIFF;
1573
  }
1574
 
1575
  return $hsTariff;
1576
  }
1577
 
1578
  /**
1579
+ * Get a shipment item's country of origin.
1580
  *
1581
  * @param Mage_Sales_Model_Order_Shipment_Item $shipmentItem
1582
  *
1616
  }
1617
 
1618
  /**
1619
+ * Get a shipment item's customs value.
1620
  *
1621
  * @param Mage_Sales_Model_Order_Shipment_Item $shipmentItem
1622
  *
app/code/community/TIG/PostNL/Model/Core/Cif/Abstract.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * Base CIF model. Contains general code for communicating with the CIF API
@@ -46,6 +46,8 @@
46
  * @method TIG_PostNL_Model_Core_Cif_Abstract setPassword(string $value)
47
  * @method TIG_PostNL_Model_Core_Cif_Abstract setUsername(string $value)
48
  * @method TIG_PostNL_Model_Core_Cif_Abstract setStoreId(int $value)
 
 
49
  *
50
  * @method boolean hasSoapClient()
51
  * @method boolean hasHelper()
@@ -53,6 +55,8 @@
53
  * @method boolean hasTestMode()
54
  * @method boolean hasPassword()
55
  * @method boolean hasUsername()
 
 
56
  *
57
  * @method TIG_PostNL_Model_Core_Cif_Abstract unsTestMode()
58
  */
@@ -61,12 +65,12 @@ abstract class TIG_PostNL_Model_Core_Cif_Abstract extends Varien_Object
61
  /**
62
  * Base URL of wsdl files
63
  */
64
- const WSDL_BASE_URL = 'https://service.postnl.com/CIF/';
65
 
66
  /**
67
  * Base URL of sandbox wsdl files
68
  */
69
- const TEST_WSDL_BASE_URL = 'https://testservice.postnl.com/CIF_SB/';
70
 
71
  /**
72
  * Available wsdl filenames.
@@ -106,6 +110,11 @@ abstract class TIG_PostNL_Model_Core_Cif_Abstract extends Varien_Object
106
  const XPATH_CIF_VERSION_TIMEFRAME = 'postnl/advanced/cif_version_timeframe';
107
  const XPATH_CIF_VERSION_LOCATION = 'postnl/advanced/cif_version_location';
108
 
 
 
 
 
 
109
  /**
110
  * Check if the required PHP extensions are installed.
111
  *
@@ -149,6 +158,36 @@ abstract class TIG_PostNL_Model_Core_Cif_Abstract extends Varien_Object
149
  return $storeId;
150
  }
151
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  /**
153
  * @return TIG_PostNL_Helper_Cif
154
  */
@@ -282,8 +321,8 @@ abstract class TIG_PostNL_Model_Core_Cif_Abstract extends Varien_Object
282
  );
283
 
284
  /**
285
- * try to create a new Zend_Soap_Client instance based on the supplied wsdl. if it fails, try again without using the
286
- * wsdl cache.
287
  */
288
  try {
289
  $client = new Zend_Soap_Client(
@@ -309,9 +348,9 @@ abstract class TIG_PostNL_Model_Core_Cif_Abstract extends Varien_Object
309
  /**
310
  * Calls a CIF method.
311
  *
312
- * @param string $wsdlType Which wsdl to use
313
- * @param callable $method The method that will be called
314
- * @param array $soapParams An array of parameters to be sent
315
  *
316
  * @return object|boolean
317
  *
@@ -321,6 +360,12 @@ abstract class TIG_PostNL_Model_Core_Cif_Abstract extends Varien_Object
321
  {
322
  $client = null;
323
  try {
 
 
 
 
 
 
324
  /**
325
  * @var Zend_Soap_Client $client
326
  */
@@ -331,24 +376,24 @@ abstract class TIG_PostNL_Model_Core_Cif_Abstract extends Varien_Object
331
  */
332
  if (!is_callable(array($client, $method))) {
333
  throw new TIG_PostNL_Exception(
334
- Mage::helper('postnl')->__('The specified method "%s" is not callable.', $method),
335
  'POSTNL-0136'
336
  );
337
  }
338
 
339
  /**
340
- * Add SOAP header,
341
  */
342
  $header = $this->_getSoapHeader();
343
  $client->addSoapInputHeader($header, true); //permanent header
344
 
345
  /**
346
- * Call the SOAP method,
347
  */
348
  $response = $client->$method($soapParams);
349
 
350
  /**
351
- * Process any warnings that may have occurred,
352
  */
353
  $this->_processWarnings($client);
354
 
@@ -356,7 +401,7 @@ abstract class TIG_PostNL_Model_Core_Cif_Abstract extends Varien_Object
356
  return $response;
357
  } catch(SoapFault $e) {
358
  /**
359
- * Only Soap exceptions are caught. Other exceptions must be caught by the caller,
360
  *
361
  * @throws TIG_PostNL_Exception
362
  */
@@ -437,9 +482,9 @@ abstract class TIG_PostNL_Model_Core_Cif_Abstract extends Varien_Object
437
  * Check if we need the live or the sandbox wsdl.
438
  */
439
  if ($this->isTestMode()) {
440
- $wsdlUrl = self::TEST_WSDL_BASE_URL;
441
  } else {
442
- $wsdlUrl = self::WSDL_BASE_URL;
443
  }
444
 
445
  /**
@@ -603,7 +648,7 @@ abstract class TIG_PostNL_Model_Core_Cif_Abstract extends Varien_Object
603
  * log this error.
604
  */
605
  $value = $errorNumber->nodeValue;
606
- if ($value == '13') {
607
  $logException = false;
608
  }
609
 
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * Base CIF model. Contains general code for communicating with the CIF API
46
  * @method TIG_PostNL_Model_Core_Cif_Abstract setPassword(string $value)
47
  * @method TIG_PostNL_Model_Core_Cif_Abstract setUsername(string $value)
48
  * @method TIG_PostNL_Model_Core_Cif_Abstract setStoreId(int $value)
49
+ * @method TIG_PostNL_Model_Core_Cif_Abstract setWsdlBaseUrl(string $value)
50
+ * @method TIG_PostNL_Model_Core_Cif_Abstract setTestWsdlBaseUrl(string $value)
51
  *
52
  * @method boolean hasSoapClient()
53
  * @method boolean hasHelper()
55
  * @method boolean hasTestMode()
56
  * @method boolean hasPassword()
57
  * @method boolean hasUsername()
58
+ * @method boolean hasWsdlBaseUrl()
59
+ * @method boolean hasTestWsdlBaseUrl()
60
  *
61
  * @method TIG_PostNL_Model_Core_Cif_Abstract unsTestMode()
62
  */
65
  /**
66
  * Base URL of wsdl files
67
  */
68
+ const WSDL_BASE_URL_XPATH = 'postnl/cif/wsdl_base_url';
69
 
70
  /**
71
  * Base URL of sandbox wsdl files
72
  */
73
+ const TEST_WSDL_BASE_URL_XPATH = 'postnl/cif/test_wsdl_base_url';
74
 
75
  /**
76
  * Available wsdl filenames.
110
  const XPATH_CIF_VERSION_TIMEFRAME = 'postnl/advanced/cif_version_timeframe';
111
  const XPATH_CIF_VERSION_LOCATION = 'postnl/advanced/cif_version_location';
112
 
113
+ /**
114
+ * The error number CIF uses for the 'shipment not found' error.
115
+ */
116
+ const SHIPMENT_NOT_FOUND_ERROR_NUMBER = 13;
117
+
118
  /**
119
  * Check if the required PHP extensions are installed.
120
  *
158
  return $storeId;
159
  }
160
 
161
+ /**
162
+ * @return string
163
+ */
164
+ public function getWsdlBaseUrl()
165
+ {
166
+ if ($this->hasWsdlBaseUrl()) {
167
+ return $this->_getData('wsdl_base_url');
168
+ }
169
+
170
+ $wsdlBaseUrl = Mage::getStoreConfig(self::WSDL_BASE_URL_XPATH, $this->getStoreId());
171
+
172
+ $this->setWsdlBaseUrl($wsdlBaseUrl);
173
+ return $wsdlBaseUrl;
174
+ }
175
+
176
+ /**
177
+ * @return string
178
+ */
179
+ public function getTestWsdlBaseUrl()
180
+ {
181
+ if ($this->hasTestWsdlBaseUrl()) {
182
+ return $this->_getData('test_wsdl_base_url');
183
+ }
184
+
185
+ $wsdlBaseUrl = Mage::getStoreConfig(self::TEST_WSDL_BASE_URL_XPATH, $this->getStoreId());
186
+
187
+ $this->setTestWsdlBaseUrl($wsdlBaseUrl);
188
+ return $wsdlBaseUrl;
189
+ }
190
+
191
  /**
192
  * @return TIG_PostNL_Helper_Cif
193
  */
321
  );
322
 
323
  /**
324
+ * try to create a new Zend_Soap_Client instance based on the supplied wsdl. if it fails, try again without
325
+ * using the wsdl cache.
326
  */
327
  try {
328
  $client = new Zend_Soap_Client(
348
  /**
349
  * Calls a CIF method.
350
  *
351
+ * @param string $wsdlType Which wsdl to use
352
+ * @param string $method The method that will be called
353
+ * @param array $soapParams An array of parameters to be sent
354
  *
355
  * @return object|boolean
356
  *
360
  {
361
  $client = null;
362
  try {
363
+ /**
364
+ * Strip non-printable characters from the SOAP parameters.
365
+ */
366
+ $cifHelper = Mage::helper('postnl/cif');
367
+ array_walk_recursive($soapParams, array($cifHelper, 'stripNonPrintableCharacters'));
368
+
369
  /**
370
  * @var Zend_Soap_Client $client
371
  */
376
  */
377
  if (!is_callable(array($client, $method))) {
378
  throw new TIG_PostNL_Exception(
379
+ $cifHelper->__('The specified method "%s" is not callable.', $method),
380
  'POSTNL-0136'
381
  );
382
  }
383
 
384
  /**
385
+ * Add SOAP header.
386
  */
387
  $header = $this->_getSoapHeader();
388
  $client->addSoapInputHeader($header, true); //permanent header
389
 
390
  /**
391
+ * Call the SOAP method.
392
  */
393
  $response = $client->$method($soapParams);
394
 
395
  /**
396
+ * Process any warnings that may have occurred.
397
  */
398
  $this->_processWarnings($client);
399
 
401
  return $response;
402
  } catch(SoapFault $e) {
403
  /**
404
+ * Only Soap exceptions are caught. Other exceptions must be caught by the caller.
405
  *
406
  * @throws TIG_PostNL_Exception
407
  */
482
  * Check if we need the live or the sandbox wsdl.
483
  */
484
  if ($this->isTestMode()) {
485
+ $wsdlUrl = $this->getTestWsdlBaseUrl();
486
  } else {
487
+ $wsdlUrl = $this->getWsdlBaseUrl();
488
  }
489
 
490
  /**
648
  * log this error.
649
  */
650
  $value = $errorNumber->nodeValue;
651
+ if ($value == self::SHIPMENT_NOT_FOUND_ERROR_NUMBER) {
652
  $logException = false;
653
  }
654
 
app/code/community/TIG/PostNL/Model/Core/Cif/Exception.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
 
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
 
app/code/community/TIG/PostNL/Model/Core/Label.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method TIG_PostNL_Model_Core_Label setLabelSize(string $value)
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method TIG_PostNL_Model_Core_Label setLabelSize(string $value)
app/code/community/TIG/PostNL/Model/Core/Observer/Barcode.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Observer_Barcode
@@ -97,11 +97,11 @@ class TIG_PostNL_Model_Core_Observer_Barcode
97
  $postnlOrder = Mage::getModel('postnl_core/order')->load($shipment->getOrderId(), 'order_id');
98
 
99
  if ($postnlOrder->getId()) {
100
- if ($postnlOrder->getConfirmDate()) {
101
  $postnlShipment->setConfirmDate(strtotime($postnlOrder->getConfirmDate()));
102
  }
103
 
104
- if ($postnlOrder->getDeliveryDate()) {
105
  $postnlShipment->setDeliveryDate(strtotime($postnlOrder->getDeliveryDate()));
106
  }
107
 
@@ -120,9 +120,9 @@ class TIG_PostNL_Model_Core_Observer_Barcode
120
  $postnlShipment->save();
121
 
122
  /**
123
- * Barcode generation needs to be tried separately. This functionality may throw a valid exceptionin which case
124
- * it needs to be tried again later without preventing the shipment from being created. This may happen when CIF
125
- * is overburdened.
126
  */
127
  try {
128
  $postnlShipment->saveAdditionalShippingOptions();
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Observer_Barcode
97
  $postnlOrder = Mage::getModel('postnl_core/order')->load($shipment->getOrderId(), 'order_id');
98
 
99
  if ($postnlOrder->getId()) {
100
+ if ($postnlOrder->hasConfirmDate()) {
101
  $postnlShipment->setConfirmDate(strtotime($postnlOrder->getConfirmDate()));
102
  }
103
 
104
+ if ($postnlOrder->hasDeliveryDate()) {
105
  $postnlShipment->setDeliveryDate(strtotime($postnlOrder->getDeliveryDate()));
106
  }
107
 
120
  $postnlShipment->save();
121
 
122
  /**
123
+ * Barcode generation needs to be tried separately. This functionality may throw a valid exception which case it
124
+ * needs to be tried again later without preventing the shipment from being created. This may happen when CIF is
125
+ * overburdened.
126
  */
127
  try {
128
  $postnlShipment->saveAdditionalShippingOptions();
app/code/community/TIG/PostNL/Model/Core/Observer/Cache.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Observer_Cache
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Observer_Cache
app/code/community/TIG/PostNL/Model/Core/Observer/Cron.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Observer_Cron
@@ -51,7 +51,22 @@ class TIG_PostNL_Model_Core_Observer_Cron
51
  /**
52
  * XML path to setting that determines whether or not to send track and trace emails
53
  */
54
- const XPATH_SEND_TRACK_AND_TRACE_EMAIL = 'postnl/cif_labels_and_confirming/send_track_and_trace_email';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
  /**
57
  * Method to destroy temporary label files that have been stored for too long.
@@ -90,7 +105,7 @@ class TIG_PostNL_Model_Core_Observer_Cron
90
 
91
  /**
92
  * Check the maximum amount of time a temp file may be stored. By default this is 300s (5m).
93
- * If this settings is empty, end the script.
94
  */
95
  $maxFileStorageTime = (int) Mage::getStoreConfig(
96
  self::XPATH_MAX_FILE_STORAGE,
@@ -447,8 +462,12 @@ class TIG_PostNL_Model_Core_Observer_Cron
447
  return $this;
448
  }
449
 
 
 
 
 
450
  foreach ($errorNumbers as $errorNumber) {
451
- if ($errorNumber != '13') { // Collo not found error
452
  $helper->logException($e);
453
  return $this;
454
  }
@@ -468,7 +487,6 @@ class TIG_PostNL_Model_Core_Observer_Cron
468
  $yesterday->setTimestamp(Mage::getModel('core/date')->gmtTimestamp())
469
  ->sub(new DateInterval('P1D'));
470
 
471
- $now = Mage::getModel('core/date')->gmtTimestamp();
472
  $yesterday = $yesterday->getTimestamp();
473
 
474
  if ($confirmedAt > $yesterday) {
@@ -530,8 +548,7 @@ class TIG_PostNL_Model_Core_Observer_Cron
530
  $helper->cronLog("All confirmation placed before {$expireDate} will be expired.");
531
 
532
  /**
533
- * Get all postnl shipments that have been confirmed over X days ago and who have not yet been shipped
534
- * (shipping_phase other than 'collection')
535
  */
536
  $postnlShipmentCollection = Mage::getResourceModel('postnl_core/shipment_collection');
537
  $postnlShipmentCollection->addFieldToFilter(
@@ -847,4 +864,125 @@ class TIG_PostNL_Model_Core_Observer_Cron
847
 
848
  return $this;
849
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
850
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Observer_Cron
51
  /**
52
  * XML path to setting that determines whether or not to send track and trace emails
53
  */
54
+ const XPATH_SEND_TRACK_AND_TRACE_EMAIL = 'postnl/track_and_trace/send_track_and_trace_email';
55
+
56
+ /**
57
+ * Xpath to the product attribute update data used by the product attribute update cron.
58
+ */
59
+ const XPATH_PRODUCT_ATTRIBUTE_UPDATE_DATA = 'postnl/general/product_attribute_update_data';
60
+
61
+ /**
62
+ * Cron expression definition for updating product attributes.
63
+ */
64
+ const UPDATE_PRODUCT_ATTRIBUTE_STRING_PATH = 'crontab/jobs/postnl_update_product_attribute/schedule/cron_expr';
65
+
66
+ /**
67
+ * Maximum number of products to update per cron run.
68
+ */
69
+ const MAX_PRODUCTS_TO_UPDATE = 250;
70
 
71
  /**
72
  * Method to destroy temporary label files that have been stored for too long.
105
 
106
  /**
107
  * Check the maximum amount of time a temp file may be stored. By default this is 300s (5m).
108
+ * If this setting is empty, end the script.
109
  */
110
  $maxFileStorageTime = (int) Mage::getStoreConfig(
111
  self::XPATH_MAX_FILE_STORAGE,
462
  return $this;
463
  }
464
 
465
+ /**
466
+ * @var $cifAbstractModelClassName TIG_PostNL_Model_Core_Cif_Abstract
467
+ */
468
+ $cifAbstractModelClassName = Mage::getConfig()->getModelClassName('postnl_core/cif_abstract');
469
  foreach ($errorNumbers as $errorNumber) {
470
+ if ($errorNumber != $cifAbstractModelClassName::SHIPMENT_NOT_FOUND_ERROR_NUMBER) { // Collo not found error
471
  $helper->logException($e);
472
  return $this;
473
  }
487
  $yesterday->setTimestamp(Mage::getModel('core/date')->gmtTimestamp())
488
  ->sub(new DateInterval('P1D'));
489
 
 
490
  $yesterday = $yesterday->getTimestamp();
491
 
492
  if ($confirmedAt > $yesterday) {
548
  $helper->cronLog("All confirmation placed before {$expireDate} will be expired.");
549
 
550
  /**
551
+ * Get all postnl shipments that have been confirmed over X days ago and who have not yet been shipped.
 
552
  */
553
  $postnlShipmentCollection = Mage::getResourceModel('postnl_core/shipment_collection');
554
  $postnlShipmentCollection->addFieldToFilter(
864
 
865
  return $this;
866
  }
867
+
868
+ /**
869
+ * Update products with newly added PostNL attributes. This cron will process 250 products per run.
870
+ *
871
+ * @return $this
872
+ *
873
+ * @throws Exception
874
+ */
875
+ public function updateProductAttribute()
876
+ {
877
+ $helper = Mage::helper('postnl');
878
+
879
+ $helper->cronLog($helper->__('UpdateProductAttribute cron starting...'));
880
+
881
+ $data = Mage::getStoreConfig(self::XPATH_PRODUCT_ATTRIBUTE_UPDATE_DATA, Mage_Core_Model_App::ADMIN_STORE_ID);
882
+ if (!$data) {
883
+ $helper->cronLog($helper->__('No attribute data found. Exiting cron.'));
884
+ return $this;
885
+ }
886
+
887
+ $data = unserialize($data);
888
+ $currentAttributeData = current($data);
889
+
890
+ $helper->cronLog(
891
+ $helper->__('Updating product attribute data: %s', var_export($currentAttributeData, true))
892
+ );
893
+
894
+ /**
895
+ * Get all products that need to be updated.
896
+ */
897
+ $productCollection = Mage::getResourceModel('catalog/product_collection')
898
+ ->addStoreFilter(Mage_Core_Model_App::ADMIN_STORE_ID)
899
+ ->addFieldToFilter(
900
+ 'type_id',
901
+ array(
902
+ 'in' => $currentAttributeData[1]
903
+ )
904
+ );
905
+
906
+ foreach (array_keys($currentAttributeData[0]) as $attribute) {
907
+ $productCollection->addAttributeToSelect($attribute, 'left')
908
+ ->addFieldToFilter($attribute, array('null' => true));
909
+ }
910
+
911
+ $productCollection->getSelect()->limit(self::MAX_PRODUCTS_TO_UPDATE);
912
+
913
+ /**
914
+ * If there are fewer than 250 products remaining, this will be the last time this cron is run.
915
+ */
916
+ $finalRun = false;
917
+ $allIds = $productCollection->getAllIds();
918
+ if (count($allIds) < self::MAX_PRODUCTS_TO_UPDATE) {
919
+ $finalRun = true;
920
+ }
921
+
922
+ $helper->cronLog($helper->__('Updating product IDs: %s', var_export($allIds, true)));
923
+
924
+ if (!empty($allIds)) {
925
+ try {
926
+ /**
927
+ * Update the attributes of these products.
928
+ */
929
+ Mage::getSingleton('catalog/product_action')
930
+ ->updateAttributes(
931
+ $allIds,
932
+ $currentAttributeData[0],
933
+ Mage_Core_Model_App::ADMIN_STORE_ID
934
+ );
935
+ } catch (Exception $e) {
936
+ /**
937
+ * If an error occurred not all products were processed, so the cron is not finished quite yet.
938
+ */
939
+ $finalRun = false;
940
+ $helper->logException($e);
941
+ $helper->cronLog($helper->__('An error occurred while processing this attribute.'));
942
+ }
943
+ }
944
+
945
+ if ($finalRun) {
946
+ $helper->cronLog($helper->__('No products left to update.'));
947
+
948
+ /**
949
+ * Remove the processed attributes from the attribute data array.
950
+ */
951
+ array_shift($data);
952
+
953
+ if (!empty($data)) {
954
+ /**
955
+ * If there is still data left, update the data for the next run.
956
+ */
957
+ Mage::getConfig()->saveConfig(
958
+ self::XPATH_PRODUCT_ATTRIBUTE_UPDATE_DATA,
959
+ serialize($data),
960
+ 'default',
961
+ Mage_Core_Model_App::ADMIN_STORE_ID
962
+ );
963
+ } else {
964
+ /**
965
+ * If all attributes have been processed, remove the cron from the schedule.
966
+ */
967
+ $helper->cronLog($helper->__('All attributes have been processed. Removing cron.'));
968
+
969
+ Mage::getConfig()->saveConfig(
970
+ self::XPATH_PRODUCT_ATTRIBUTE_UPDATE_DATA,
971
+ null,
972
+ 'default',
973
+ Mage_Core_Model_App::ADMIN_STORE_ID
974
+ );
975
+
976
+ Mage::getModel('core/config_data')
977
+ ->load(self::UPDATE_PRODUCT_ATTRIBUTE_STRING_PATH, 'path')
978
+ ->setValue(null)
979
+ ->setPath(self::UPDATE_PRODUCT_ATTRIBUTE_STRING_PATH)
980
+ ->save();
981
+ }
982
+ }
983
+
984
+ $helper->cronLog($helper->__('UpdateProductAttribute cron has finished.'));
985
+
986
+ return $this;
987
+ }
988
  }
app/code/community/TIG/PostNL/Model/Core/Observer/SaveShipment.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Observer_SaveShipment
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Observer_SaveShipment
app/code/community/TIG/PostNL/Model/Core/Order.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * Class TIG_PostNL_Model_Core_Order
@@ -52,6 +52,7 @@
52
  * @method int getEntityId()
53
  * @method string getMobilePhoneNumber()
54
  * @method int getIsPakketautomaat()
 
55
  *
56
  * @method TIG_PostNL_Model_Core_Order setIsPakketautomaat(int $value)
57
  * @method TIG_PostNL_Model_Core_Order setEntityId(int $value)
@@ -69,10 +70,15 @@
69
  * @method TIG_PostNL_Model_Core_Order setIsActive(int $value)
70
  * @method TIG_PostNL_Model_Core_Order setConfirmDate(string $value)
71
  * @method TIG_PostNL_Model_Core_Order setPakjeGemakAddress(mixed $value)
 
72
  *
73
  * @method boolean hasOrderId()
74
  * @method boolean hasQuoteId()
75
  * @method boolean hasPakjeGemakAddress()
 
 
 
 
76
  */
77
  class TIG_PostNL_Model_Core_Order extends Mage_Core_Model_Abstract
78
  {
@@ -91,11 +97,30 @@ class TIG_PostNL_Model_Core_Order extends Mage_Core_Model_Abstract
91
  */
92
  protected $_eventPrefix = 'postnl_order';
93
 
 
 
 
 
 
 
 
 
 
 
 
94
  public function _construct()
95
  {
96
  $this->_init('postnl_core/order');
97
  }
98
 
 
 
 
 
 
 
 
 
99
  /**
100
  * Gets the order associated with this PostNL Checkout Order.
101
  *
@@ -251,6 +276,52 @@ class TIG_PostNL_Model_Core_Order extends Mage_Core_Model_Abstract
251
  return false;
252
  }
253
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
254
  /**
255
  * @param Mage_Sales_Model_Order $order
256
  *
@@ -264,6 +335,76 @@ class TIG_PostNL_Model_Core_Order extends Mage_Core_Model_Abstract
264
  return $this;
265
  }
266
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  /**
268
  * Cancels the PostNL order.
269
  *
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * Class TIG_PostNL_Model_Core_Order
52
  * @method int getEntityId()
53
  * @method string getMobilePhoneNumber()
54
  * @method int getIsPakketautomaat()
55
+ * @method array|boolean getUnserializedOptions()
56
  *
57
  * @method TIG_PostNL_Model_Core_Order setIsPakketautomaat(int $value)
58
  * @method TIG_PostNL_Model_Core_Order setEntityId(int $value)
70
  * @method TIG_PostNL_Model_Core_Order setIsActive(int $value)
71
  * @method TIG_PostNL_Model_Core_Order setConfirmDate(string $value)
72
  * @method TIG_PostNL_Model_Core_Order setPakjeGemakAddress(mixed $value)
73
+ * @method TIG_PostNL_Model_Core_Order setUnserializedOptions(array $value)
74
  *
75
  * @method boolean hasOrderId()
76
  * @method boolean hasQuoteId()
77
  * @method boolean hasPakjeGemakAddress()
78
+ * @method boolean hasConfirmDate()
79
+ * @method boolean hasDeliveryDate()
80
+ * @method boolean hasUnserializedOptions()
81
+ * @method boolean hasOptions()
82
  */
83
  class TIG_PostNL_Model_Core_Order extends Mage_Core_Model_Abstract
84
  {
97
  */
98
  protected $_eventPrefix = 'postnl_order';
99
 
100
+ /**
101
+ * PostNL order types considered to be 'PakjeGemak';
102
+ *
103
+ * @var array
104
+ */
105
+ protected $_pakjeGemakTypes = array(
106
+ 'PG',
107
+ 'PGE',
108
+ 'PA'
109
+ );
110
+
111
  public function _construct()
112
  {
113
  $this->_init('postnl_core/order');
114
  }
115
 
116
+ /**
117
+ * @return array
118
+ */
119
+ public function getPakjeGemakTypes()
120
+ {
121
+ return $this->_pakjeGemakTypes;
122
+ }
123
+
124
  /**
125
  * Gets the order associated with this PostNL Checkout Order.
126
  *
276
  return false;
277
  }
278
 
279
+ /**
280
+ * @return array|boolean
281
+ */
282
+ public function getOptions()
283
+ {
284
+ if ($this->hasUnserializedOptions()) {
285
+ return $this->getUnserializedOptions();
286
+ }
287
+
288
+ $options = $this->_getData('options');
289
+
290
+ if (!empty($options)) {
291
+ $options = unserialize($options);
292
+ }
293
+
294
+
295
+ $this->setUnserializedOptions($options);
296
+ return $options;
297
+ }
298
+
299
+ /**
300
+ * @param array|boolean|null $options
301
+ *
302
+ * @return $this
303
+ */
304
+ public function setOptions($options)
305
+ {
306
+
307
+ $this->setUnserializedOptions($options);
308
+
309
+ /**
310
+ * If the options are an empty array, remove the options instead. Otherwise, serialize the array before saving.
311
+ */
312
+ if (is_array($options)) {
313
+ if (empty($options)) {
314
+ $options = false;
315
+ } else {
316
+ $options = serialize($options);
317
+ }
318
+ }
319
+
320
+ $this->setData('options', $options);
321
+
322
+ return $this;
323
+ }
324
+
325
  /**
326
  * @param Mage_Sales_Model_Order $order
327
  *
335
  return $this;
336
  }
337
 
338
+ /**
339
+ * @param Mage_Sales_Model_Quote $quote
340
+ *
341
+ * @return $this
342
+ */
343
+ public function loadByQuote(Mage_Sales_Model_Quote $quote)
344
+ {
345
+ $quoteId = $quote->getId();
346
+ $this->load($quoteId, 'quote_id');
347
+
348
+ return $this;
349
+ }
350
+
351
+ /**
352
+ * Check if this order is a PakjeGemak order.
353
+ *
354
+ * @return boolean
355
+ */
356
+ public function isPakjeGemak()
357
+ {
358
+ $type = $this->getType();
359
+ $pakjeGemakTypes = $this->getPakjeGemakTypes();
360
+
361
+ if (in_array($type, $pakjeGemakTypes)) {
362
+ return true;
363
+ }
364
+
365
+ return false;
366
+ }
367
+
368
+ /**
369
+ * Validate the chosen extra options. If an option is invalid, it will be unset.
370
+ *
371
+ * @return $this
372
+ */
373
+ public function validateOptions()
374
+ {
375
+ if (!$this->hasOptions()) {
376
+ return $this;
377
+ }
378
+
379
+ $options = $this->getOptions();
380
+ if (empty($options) || !is_array($options)) {
381
+ $this->setOptions(false);
382
+
383
+ return $this;
384
+ }
385
+
386
+ foreach ($options as $option => $value) {
387
+ if (!$value) {
388
+ continue;
389
+ }
390
+
391
+ switch ($option) {
392
+ case 'only_stated_address':
393
+ if ($this->getType() == 'PG'
394
+ || $this->getType() == 'PGE'
395
+ || $this->getType() == 'PA'
396
+ ) {
397
+ unset($options[$option]);
398
+ }
399
+ break;
400
+ //no default
401
+ }
402
+ }
403
+
404
+ $this->setOptions($options);
405
+ return $this;
406
+ }
407
+
408
  /**
409
  * Cancels the PostNL order.
410
  *
app/code/community/TIG/PostNL/Model/Core/PackingSlip.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method TIG_PostNL_Model_Core_PackingSlip setStoreId(int $value)
@@ -247,7 +247,8 @@ class TIG_PostNL_Model_Core_PackingSlip extends Mage_Sales_Model_Order_Pdf_Abstr
247
 
248
  $labelModel = Mage::getSingleton('postnl_core/label')
249
  ->setLabelSize('A4')
250
- ->setOutputMode('S');
 
251
 
252
  /**
253
  * @var TIG_PostNL_Model_Core_Shipment_Label $firstLabel
@@ -771,7 +772,7 @@ class TIG_PostNL_Model_Core_PackingSlip extends Mage_Sales_Model_Order_Pdf_Abstr
771
  $top -= 10;
772
 
773
  $deliveryDate = $postnlShipment->getDeliveryDate();
774
- $text = $this->getCoreHelper()->formatDate($deliveryDate, 'short', false);
775
  $x = 580 - $this->widthForStringUsingFontSize($text, $font, 8);
776
  $page->drawText($text, $x, $top, 'UTF-8');
777
 
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method TIG_PostNL_Model_Core_PackingSlip setStoreId(int $value)
247
 
248
  $labelModel = Mage::getSingleton('postnl_core/label')
249
  ->setLabelSize('A4')
250
+ ->setOutputMode('S')
251
+ ->setLabelCounter(0);
252
 
253
  /**
254
  * @var TIG_PostNL_Model_Core_Shipment_Label $firstLabel
772
  $top -= 10;
773
 
774
  $deliveryDate = $postnlShipment->getDeliveryDate();
775
+ $text = $this->getCoreHelper()->formatDate($deliveryDate, 'full', false);
776
  $x = 580 - $this->widthForStringUsingFontSize($text, $font, 8);
777
  $page->drawText($text, $x, $top, 'UTF-8');
778
 
app/code/community/TIG/PostNL/Model/Core/Packingslip/Pdf/Items/Invoice/Default.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method array getItemColumns()
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method array getItemColumns()
app/code/community/TIG/PostNL/Model/Core/Resource/Order.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Resource_Order extends TIG_PostNL_Model_Resource_Db_Abstract
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Resource_Order extends TIG_PostNL_Model_Resource_Db_Abstract
app/code/community/TIG/PostNL/Model/Core/Resource/Order/Collection.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Resource_Order_Collection extends TIG_PostNL_Model_Resource_Db_Collection_Postnl
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Resource_Order_Collection extends TIG_PostNL_Model_Resource_Db_Collection_Postnl
app/code/community/TIG/PostNL/Model/Core/Resource/Shipment.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Resource_Shipment extends TIG_PostNL_Model_Resource_Db_Abstract
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Resource_Shipment extends TIG_PostNL_Model_Resource_Db_Abstract
app/code/community/TIG/PostNL/Model/Core/Resource/Shipment/Barcode.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Resource_Shipment_Barcode extends Mage_Core_Model_Resource_Db_Abstract
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Resource_Shipment_Barcode extends Mage_Core_Model_Resource_Db_Abstract
app/code/community/TIG/PostNL/Model/Core/Resource/Shipment/Barcode/Collection.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Resource_Shipment_Barcode_Collection extends TIG_PostNL_Model_Resource_Db_Collection_Postnl
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Resource_Shipment_Barcode_Collection extends TIG_PostNL_Model_Resource_Db_Collection_Postnl
app/code/community/TIG/PostNL/Model/Core/Resource/Shipment/Collection.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Resource_Shipment_Collection extends TIG_PostNL_Model_Resource_Db_Collection_Postnl
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Resource_Shipment_Collection extends TIG_PostNL_Model_Resource_Db_Collection_Postnl
app/code/community/TIG/PostNL/Model/Core/Resource/Shipment/Label.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Resource_Shipment_Label extends Mage_Core_Model_Resource_Db_Abstract
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Resource_Shipment_Label extends Mage_Core_Model_Resource_Db_Abstract
app/code/community/TIG/PostNL/Model/Core/Resource/Shipment/Label/Collection.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Resource_Shipment_Label_Collection extends TIG_PostNL_Model_Resource_Db_Collection_Postnl
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Resource_Shipment_Label_Collection extends TIG_PostNL_Model_Resource_Db_Collection_Postnl
app/code/community/TIG/PostNL/Model/Core/Resource/Shipment/Status/History.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Resource_Shipment_Status_History extends Mage_Core_Model_Resource_Db_Abstract
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Resource_Shipment_Status_History extends Mage_Core_Model_Resource_Db_Abstract
app/code/community/TIG/PostNL/Model/Core/Resource/Shipment/Status/History/Collection.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Resource_Shipment_Status_History_Collection extends TIG_PostNL_Model_Resource_Db_Collection_Postnl
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Resource_Shipment_Status_History_Collection extends TIG_PostNL_Model_Resource_Db_Collection_Postnl
app/code/community/TIG/PostNL/Model/Core/Service.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Service
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Service
app/code/community/TIG/PostNL/Model/Core/Service/InvoiceDummy.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Service_InvoiceDummy extends Mage_Sales_Model_Order_Invoice
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Service_InvoiceDummy extends Mage_Sales_Model_Order_Invoice
app/code/community/TIG/PostNL/Model/Core/Service/OrderDummy.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Service_OrderDummy extends Mage_Sales_Model_Order
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Service_OrderDummy extends Mage_Sales_Model_Order
app/code/community/TIG/PostNL/Model/Core/Shipment.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  * @package TIG
39
  * @module PostNL
@@ -62,6 +62,9 @@
62
  * - postnl_shipment_savelabels_before
63
  * - postnl_shipment_savelabels_after
64
  * - postnl_shipment_saveadditionaloptions_after
 
 
 
65
  *
66
  * @method bool getIsDutchShipment()
67
  * @method bool getIsEuShipment()
@@ -118,6 +121,7 @@
118
  * @method TIG_PostNL_Model_Core_Shipment setDefaultProductCode(string $value)
119
  * @method TIG_PostNL_Model_Core_Shipment setLabels(array $value)
120
  * @method TIG_PostNL_Model_Core_Shipment setProductOption(string $value)
 
121
  *
122
  * @method bool hasBarcodeUrl()
123
  * @method bool hasPostnlOrder()
@@ -140,6 +144,7 @@
140
  * @method bool hasIsBuspakjeShipment()
141
  * @method bool hasDefaultProductCode()
142
  * @method bool hasProductOption()
 
143
  */
144
  class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
145
  {
@@ -184,40 +189,41 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
184
  /**
185
  * Xpaths to default product options settings.
186
  */
187
- const XPATH_DEFAULT_STANDARD_PRODUCT_OPTION = 'postnl/cif_product_options/default_product_option';
188
- const XPATH_DEFAULT_STANDARD_COD_PRODUCT_OPTION = 'postnl/cif_product_options/default_cod_product_option';
189
- const XPATH_DEFAULT_EVENING_PRODUCT_OPTION = 'postnl/cif_product_options/default_evening_product_option';
190
- const XPATH_DEFAULT_EVENING_COD_PRODUCT_OPTION = 'postnl/cif_product_options/default_evening_cod_product_option';
191
- const XPATH_DEFAULT_PAKJEGEMAK_PRODUCT_OPTION = 'postnl/cif_product_options/default_pakjegemak_product_option';
192
- const XPATH_DEFAULT_PAKJEGEMAK_COD_PRODUCT_OPTION = 'postnl/cif_product_options/default_pakjegemak_cod_product_option';
193
- const XPATH_DEFAULT_PGE_PRODUCT_OPTION = 'postnl/cif_product_options/default_pge_product_option';
194
- const XPATH_DEFAULT_PGE_COD_PRODUCT_OPTION = 'postnl/cif_product_options/default_pge_cod_product_option';
195
- const XPATH_DEFAULT_PAKKETAUTOMAAT_PRODUCT_OPTION = 'postnl/cif_product_options/default_pakketautomaat_product_option';
196
- const XPATH_DEFAULT_EU_PRODUCT_OPTION = 'postnl/cif_product_options/default_eu_product_option';
197
- const XPATH_DEFAULT_EU_BE_PRODUCT_OPTION = 'postnl/cif_product_options/default_eu_be_product_option';
198
- const XPATH_DEFAULT_GLOBAL_PRODUCT_OPTION = 'postnl/cif_product_options/default_global_product_option';
199
- const XPATH_DEFAULT_BUSPAKJE_PRODUCT_OPTION = 'postnl/cif_product_options/default_buspakje_product_option';
200
- const XPATH_USE_ALTERNATIVE_DEFAULT = 'postnl/cif_product_options/use_alternative_default';
201
- const XPATH_ALTERNATIVE_DEFAULT_MAX_AMOUNT = 'postnl/cif_product_options/alternative_default_max_amount';
202
- const XPATH_ALTERNATIVE_DEFAULT_OPTION = 'postnl/cif_product_options/alternative_default_option';
 
203
 
204
  /**
205
  * Xpath to weight per parcel config setting.
206
  */
207
- const XPATH_WEIGHT_PER_PARCEL = 'postnl/cif_labels_and_confirming/weight_per_parcel';
208
 
209
  /**
210
  * Xpath to setting that determines whether or not to send track and trace emails.
211
  */
212
- const XPATH_SEND_TRACK_AND_TRACE_EMAIL = 'postnl/cif_labels_and_confirming/send_track_and_trace_email';
213
 
214
  /**
215
  * Xpath to track and trace email settings.
216
  */
217
- const XPATH_TRACK_AND_TRACE_EMAIL_TEMPLATE = 'postnl/cif_labels_and_confirming/track_and_trace_email_template';
218
- const XPATH_EMAIL_COPY = 'postnl/cif_labels_and_confirming/send_copy';
219
- const XPATH_EMAIL_COPY_TO = 'postnl/cif_labels_and_confirming/copy_to';
220
- const XPATH_EMAIL_COPY_METHOD = 'postnl/cif_labels_and_confirming/copy_method';
221
 
222
  /**
223
  * Xpath to maximum allowed parcel count settings.
@@ -360,6 +366,8 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
360
  $orderId = $this->getOrderId();
361
  if (!$orderId) {
362
  $orderId = $this->getShipment()->getOrderId();
 
 
363
  }
364
 
365
  if (!$orderId && $throwException) {
@@ -380,6 +388,25 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
380
  return $order;
381
  }
382
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
383
  /**
384
  * Retrieves the linked Shipment's shipping address
385
  *
@@ -460,7 +487,7 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
460
  /**
461
  * Gets the order ID from the associated Mage_Sales_Model_Order_Shipment object
462
  *
463
- * @return int
464
  */
465
  public function getOrderId()
466
  {
@@ -916,18 +943,10 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
916
  */
917
  $helper = $this->getHelper('carrier');
918
 
919
- $locale = Mage::getStoreConfig('general/locale/code', $this->getStoreId());
920
- $lang = substr($locale, 0, 2);
921
-
922
  $url = '';
923
- $pakjeGemakAddress = $this->getPakjeGemakAddress();
924
- if ($pakjeGemakAddress) {
925
- $url = $helper->getBarcodeUrl($barcode, $pakjeGemakAddress, $lang, $forceNl);
926
- } else {
927
- $shippingAddress = $this->getShippingAddress();
928
- if ($shippingAddress) {
929
- $url = $helper->getBarcodeUrl($barcode, $shippingAddress, $lang, $forceNl);
930
- }
931
  }
932
 
933
  $this->setBarcodeUrl($url);
@@ -961,6 +980,21 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
961
  /**
962
  * Gets the default product code for this shipment from the module's configuration.
963
  *
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
964
  * @throws TIG_PostNL_Exception
965
  *
966
  * @return string
@@ -975,13 +1009,21 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
975
 
976
  $shipmentType = $this->getShipmentType();
977
 
 
 
978
  $xpath = false;
979
  switch ($shipmentType) {
980
  case self::SHIPMENT_TYPE_DOMESTIC_COD:
981
  $xpath = self::XPATH_DEFAULT_STANDARD_COD_PRODUCT_OPTION;
982
  break;
983
  case self::SHIPMENT_TYPE_AVOND:
984
- $xpath = self::XPATH_DEFAULT_EVENING_PRODUCT_OPTION;
 
 
 
 
 
 
985
  break;
986
  case self::SHIPMENT_TYPE_AVOND_COD:
987
  $xpath = self::XPATH_DEFAULT_EVENING_COD_PRODUCT_OPTION;
@@ -1022,31 +1064,39 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
1022
  }
1023
 
1024
  /**
1025
- * If the shipment is not EU or global, it's dutch (AKA a 'standard' shipment)
1026
- *
 
 
 
 
 
1027
  * Dutch shipments may use an alternative default option when the shipment's base grand total exceeds a
1028
  * specified amount.
1029
  */
1030
  $useAlternativeDefault = Mage::getStoreConfig(self::XPATH_USE_ALTERNATIVE_DEFAULT, $storeId);
1031
  if (!$xpath && $useAlternativeDefault) {
1032
  /**
1033
- * Alternative default option usage is enabled
1034
  */
1035
  $maxShipmentAmount = Mage::getStoreConfig(self::XPATH_ALTERNATIVE_DEFAULT_MAX_AMOUNT, $storeId);
1036
  if ($this->getShipmentBaseGrandTotal() > $maxShipmentAmount) {
1037
  /**
1038
- * The shipment's base grand total exceeds the specified amount: use the alternative default
1039
  */
1040
  $xpath = self::XPATH_ALTERNATIVE_DEFAULT_OPTION;
1041
  }
1042
  }
1043
 
 
 
 
1044
  if (!$xpath) {
1045
  $xpath = self::XPATH_DEFAULT_STANDARD_PRODUCT_OPTION;
1046
  }
1047
 
1048
  /**
1049
- * standard default option
1050
  */
1051
  $productCode = Mage::getStoreConfig($xpath, $storeId);
1052
 
@@ -1054,12 +1104,14 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
1054
  * If no default product code was found, try to use another product code that is available.
1055
  */
1056
  if (!$productCode) {
 
1057
  $availableProductCodes = $this->getAllowedProductCodes();
1058
 
1059
  /**
1060
  * If no other product codes are available for this shipment type, throw an error.
1061
  */
1062
  if (empty($availableProductCodes)) {
 
1063
  throw new TIG_PostNL_Exception(
1064
  $this->getHelper()->__(
1065
  "No default product options are available for this shipment. Please check that you have " .
@@ -1083,8 +1135,8 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
1083
  'POSTNL-0189',
1084
  'warning',
1085
  $helper->__(
1086
- "The default product option was not available for this shipment, so another product option was " .
1087
- "chosen. Please check if the default product options are configured correctly in the PostNL " .
1088
  "extension's configuration."
1089
  )
1090
  );
@@ -1096,6 +1148,55 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
1096
  return $productCode;
1097
  }
1098
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1099
  /**
1100
  * Gets this shipment's main barcode.
1101
  *
@@ -1191,7 +1292,7 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
1191
  /**
1192
  * Gets a PostNL order associated with this shipment (if any exist)
1193
  *
1194
- * @return boolean|TIG_PostNL_Model_Core_Order
1195
  */
1196
  public function getPostnlOrder()
1197
  {
@@ -1304,7 +1405,7 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
1304
  /**
1305
  * Gets the delivery date for this shipment.
1306
  *
1307
- * @return null|string
1308
  */
1309
  public function getDeliveryDate()
1310
  {
@@ -1316,7 +1417,7 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
1316
  * Try to get the delivery date for a PostNL order.
1317
  */
1318
  $postnlOrder = $this->getPostnlOrder();
1319
- if ($postnlOrder && $postnlOrder->getDeliveryDate()) {
1320
  $deliveryDate = $postnlOrder->getDeliveryDate();
1321
 
1322
  $this->setDeliveryDate($deliveryDate);
@@ -1327,16 +1428,12 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
1327
  * @var TIG_PostNL_Helper_DeliveryOptions $helper
1328
  */
1329
  $helper = $this->getHelper('deliveryOptions');
1330
- $deliveryDate = $helper->getDeliveryDate($this->getOrder()->getCreatedAt(), $this->getStoreId());
 
1331
 
1332
- if ($deliveryDate) {
1333
- return $deliveryDate;
1334
- }
1335
 
1336
- /**
1337
- * If no delivery date is available, return null.
1338
- */
1339
- return null;
1340
  }
1341
 
1342
  /**
@@ -1358,6 +1455,23 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
1358
  return $isBuspakje;
1359
  }
1360
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1361
  /**
1362
  * Getter for the '_preventSaving' class variable.
1363
  *
@@ -1389,21 +1503,23 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
1389
  /**
1390
  * Set an extra cover amount
1391
  *
1392
- * @param int $amount
1393
  *
1394
- * @return boolean|TIG_PostNL_Model_Core_Shipment
1395
  */
1396
- public function setExtraCoverAmount($amount)
1397
  {
1398
  /**
1399
  * Check if extra cover is allowed for this shipment
1400
  */
1401
- $productCode = $this->getProductCode();
1402
- $extraCoverProductCodes = $this->getExtraCoverProductCodes();
1403
- if (!in_array($productCode, $extraCoverProductCodes)) {
1404
  return false;
1405
  }
1406
 
 
 
 
 
1407
  $this->setData('extra_cover_amount', $amount);
1408
 
1409
  return $this;
@@ -1513,7 +1629,7 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
1513
  * If this shipment has an associated PostNL order with a confirm date, use that.
1514
  */
1515
  $postnlOrder = $this->getPostnlOrder();
1516
- if ($postnlOrder && $postnlOrder->getConfirmDate()) {
1517
  $confirmDate = new DateTime($postnlOrder->getConfirmDate());
1518
 
1519
  $this->setData('confirm_date', $confirmDate->getTimestamp());
@@ -1525,23 +1641,17 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
1525
  */
1526
  $deliveryDate = $this->getDeliveryDate();
1527
 
1528
- /**
1529
- * If no delivery date is available, set the confirm date to today.
1530
- */
1531
- if (!$deliveryDate) {
1532
- $confirmDate = Mage::getModel('core/date')->gmtTimestamp();
1533
-
1534
- $this->setData('confirm_date', $confirmDate);
1535
- return $this;
1536
- }
1537
-
1538
  /**
1539
  * Calculate the confirm based on the delivery date.
1540
  */
1541
  $deliveryDate = new DateTime($deliveryDate);
1542
- $confirmDate = $deliveryDate->sub(new DateInterval('P1D'))->getTimestamp();
1543
 
1544
- $this->setData('confirm_date', $confirmDate);
 
 
 
 
 
1545
  return $this;
1546
  }
1547
 
@@ -1929,8 +2039,7 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
1929
  /**
1930
  * @var Mage_Sales_Model_Order_Payment $payment
1931
  */
1932
- $payment = Mage::getModel('sales/order_payment')
1933
- ->load($this->getShipment()->getOrderId(), 'parent_id');
1934
  $paymentMethod = $payment->getMethod();
1935
 
1936
  if (in_array($paymentMethod, $codPaymentMethods)) {
@@ -1977,6 +2086,26 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
1977
  return $isExported;
1978
  }
1979
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1980
  /**
1981
  * Checks if the current entity may generate a barcode.
1982
  *
@@ -2216,8 +2345,7 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
2216
  }
2217
 
2218
  $shippingPhase = $this->getShippingPhase();
2219
- if ($shippingPhase == self::SHIPPING_PHASE_COLLECTION
2220
- || $shippingPhase == self::SHIPPING_PHASE_DELIVERED
2221
  || $shippingPhase == self::SHIPPING_PHASE_DISTRIBUTION
2222
  || $shippingPhase == self::SHIPPING_PHASE_SORTING
2223
  ) {
@@ -2240,8 +2368,7 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
2240
  }
2241
 
2242
  $shippingPhase = $this->getShippingPhase();
2243
- if ($shippingPhase == self::SHIPPING_PHASE_COLLECTION
2244
- || $shippingPhase == self::SHIPPING_PHASE_DELIVERED
2245
  || $shippingPhase == self::SHIPPING_PHASE_DISTRIBUTION
2246
  || $shippingPhase == self::SHIPPING_PHASE_SORTING
2247
  ) {
@@ -2268,8 +2395,7 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
2268
  }
2269
 
2270
  $shippingPhase = $this->getShippingPhase();
2271
- if ($shippingPhase == self::SHIPPING_PHASE_COLLECTION
2272
- || $shippingPhase == self::SHIPPING_PHASE_DELIVERED
2273
  || $shippingPhase == self::SHIPPING_PHASE_DISTRIBUTION
2274
  || $shippingPhase == self::SHIPPING_PHASE_SORTING
2275
  ) {
@@ -2297,8 +2423,7 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
2297
  }
2298
 
2299
  $shippingPhase = $this->getShippingPhase();
2300
- if ($shippingPhase == self::SHIPPING_PHASE_COLLECTION
2301
- || $shippingPhase == self::SHIPPING_PHASE_DELIVERED
2302
  || $shippingPhase == self::SHIPPING_PHASE_DISTRIBUTION
2303
  || $shippingPhase == self::SHIPPING_PHASE_SORTING
2304
  ) {
@@ -3016,9 +3141,10 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
3016
  */
3017
  public function sendTrackAndTraceEmail($ignoreAlreadySent = false, $ignoreConfig = false)
3018
  {
 
3019
  if (!$this->canSendTrackAndTraceEmail($ignoreAlreadySent, $ignoreConfig)) {
3020
  throw new TIG_PostNL_Exception(
3021
- Mage::helper('postnl')->__('The sendTrackAndTraceEmail action is currently unavailable.'),
3022
  'POSTNL-0076'
3023
  );
3024
  }
@@ -3027,34 +3153,71 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
3027
 
3028
  $template = Mage::getStoreConfig(self::XPATH_TRACK_AND_TRACE_EMAIL_TEMPLATE, $storeId);
3029
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3030
 
3031
- /**
3032
- * @var Mage_Sales_Model_Order $order
3033
- */
3034
- $shippingAddress = $this->getShippingAddress();
3035
- $shipment = $this->getShipment();
3036
- $order = $shipment->getOrder();
3037
-
3038
- /** @noinspection PhpUndefinedMethodInspection */
3039
- $templateVariables = array(
3040
- 'postnlshipment' => $this,
3041
- 'barcode' => $this->getMainBarcode(),
3042
- 'barcode_url' => $this->getBarcodeUrl(false),
3043
- 'shipment' => $shipment,
3044
- 'order' => $order,
3045
- 'customer' => $order->getCustomer(),
3046
- 'quote' => $order->getQuote(),
3047
- );
3048
 
3049
- // Get the destination email addresses to send copies to
3050
- $copy = Mage::getStoreConfigFlag(self::XPATH_EMAIL_COPY, $storeId);
3051
- $copyTo = explode(',', Mage::getStoreConfig(self::XPATH_EMAIL_COPY_TO, $storeId));
3052
- $copyMethod = Mage::getStoreConfig(self::XPATH_EMAIL_COPY_METHOD, $storeId);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3053
 
3054
- try {
3055
  $mailer = Mage::getModel('core/email_template_mailer');
3056
  $emailInfo = Mage::getModel('core/email_info');
3057
- $emailInfo->addTo($this->getShipment()->getOrder()->getCustomerEmail(), $shippingAddress->getName());
3058
 
3059
  if ($copy && !empty($copyTo) && $copyMethod == 'bcc') {
3060
  foreach ($copyTo as $email) {
@@ -3072,14 +3235,52 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
3072
  }
3073
  }
3074
 
3075
- // Set all required params and send emails.
3076
- $mailer->setSender(Mage::getStoreConfig($order::XML_PATH_EMAIL_IDENTITY, $storeId));
3077
- $mailer->setStoreId($storeId);
3078
- $mailer->setTemplateId($template);
3079
- $mailer->setTemplateParams($templateVariables);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3080
  $mailer->send();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3081
  } catch (Exception $e) {
3082
- $helper = Mage::helper('postnl');
3083
  $helper->logException($e);
3084
  throw new TIG_PostNL_Exception(
3085
  $helper->__(
@@ -3453,9 +3654,9 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
3453
  * Get the selected product code for the current shipment's shipment type.
3454
  */
3455
  $shipmentType .= '_options';
3456
- if (array_key_exists($shipmentType, $codes)) {
3457
  return $codes[$shipmentType];
3458
- } elseif (array_key_exists('product_option', $codes)) {
3459
  return $codes['product_option'];
3460
  }
3461
 
@@ -3486,8 +3687,13 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
3486
  * Check if the product code is allowed.
3487
  */
3488
  if (!in_array($productCode, $allowedProductCodes)) {
 
 
 
3489
  throw new TIG_PostNL_Exception(
3490
- $cifHelper->__('Product code %s is not allowed for this shipment.', $productCode),
 
 
3491
  'POSTNL-0078'
3492
  );
3493
  }
@@ -3507,8 +3713,13 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
3507
  if (!$shippingAddress
3508
  || !in_array($shippingAddress->getCountryId(), $allowedCountries)
3509
  ) {
 
 
 
3510
  throw new TIG_PostNL_Exception(
3511
- $cifHelper->__('Product code %s is not allowed for this shipment.', $productCode),
 
 
3512
  'POSTNL-0078'
3513
  );
3514
  }
@@ -3924,6 +4135,13 @@ class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
3924
  if (!$this->getProductCode() || Mage::registry('postnl_product_option') !== null) {
3925
  $productCode = $this->_getProductCode();
3926
  $this->setProductCode($productCode);
 
 
 
 
 
 
 
3927
  }
3928
 
3929
  /**
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  * @package TIG
39
  * @module PostNL
62
  * - postnl_shipment_savelabels_before
63
  * - postnl_shipment_savelabels_after
64
  * - postnl_shipment_saveadditionaloptions_after
65
+ * - postnl_shipment_add_track_and_trace_email_vars
66
+ * - postnl_shipment_send_track_and_trace_email_before
67
+ * - postnl_shipment_send_track_and_trace_email_after
68
  *
69
  * @method bool getIsDutchShipment()
70
  * @method bool getIsEuShipment()
121
  * @method TIG_PostNL_Model_Core_Shipment setDefaultProductCode(string $value)
122
  * @method TIG_PostNL_Model_Core_Shipment setLabels(array $value)
123
  * @method TIG_PostNL_Model_Core_Shipment setProductOption(string $value)
124
+ * @method TIG_PostNL_Model_Core_Shipment setPayment(Mage_Sales_Model_Order_Payment $value)
125
  *
126
  * @method bool hasBarcodeUrl()
127
  * @method bool hasPostnlOrder()
144
  * @method bool hasIsBuspakjeShipment()
145
  * @method bool hasDefaultProductCode()
146
  * @method bool hasProductOption()
147
+ * @method bool hasPayment()
148
  */
149
  class TIG_PostNL_Model_Core_Shipment extends Mage_Core_Model_Abstract
150
  {
189
  /**
190
  * Xpaths to default product options settings.
191
  */
192
+ const XPATH_DEFAULT_STANDARD_PRODUCT_OPTION = 'postnl/grid/default_product_option';
193
+ const XPATH_DEFAULT_STANDARD_COD_PRODUCT_OPTION = 'postnl/cod/default_cod_product_option';
194
+ const XPATH_DEFAULT_EVENING_PRODUCT_OPTION = 'postnl/grid/default_evening_product_option';
195
+ const XPATH_DEFAULT_EVENING_COD_PRODUCT_OPTION = 'postnl/cod/default_evening_cod_product_option';
196
+ const XPATH_DEFAULT_PAKJEGEMAK_PRODUCT_OPTION = 'postnl/grid/default_pakjegemak_product_option';
197
+ const XPATH_DEFAULT_PAKJEGEMAK_COD_PRODUCT_OPTION = 'postnl/cod/default_pakjegemak_cod_product_option';
198
+ const XPATH_DEFAULT_PGE_PRODUCT_OPTION = 'postnl/grid/default_pge_product_option';
199
+ const XPATH_DEFAULT_PGE_COD_PRODUCT_OPTION = 'postnl/cod/default_pge_cod_product_option';
200
+ const XPATH_DEFAULT_PAKKETAUTOMAAT_PRODUCT_OPTION = 'postnl/delivery_options/default_pakketautomaat_product_option';
201
+ const XPATH_DEFAULT_EU_PRODUCT_OPTION = 'postnl/grid/default_eu_product_option';
202
+ const XPATH_DEFAULT_EU_BE_PRODUCT_OPTION = 'postnl/grid/default_eu_be_product_option';
203
+ const XPATH_DEFAULT_GLOBAL_PRODUCT_OPTION = 'postnl/cif_globalpack_settings/default_global_product_option';
204
+ const XPATH_DEFAULT_BUSPAKJE_PRODUCT_OPTION = 'postnl/grid/default_buspakje_product_option';
205
+ const XPATH_USE_ALTERNATIVE_DEFAULT = 'postnl/grid/use_alternative_default';
206
+ const XPATH_ALTERNATIVE_DEFAULT_MAX_AMOUNT = 'postnl/grid/alternative_default_max_amount';
207
+ const XPATH_ALTERNATIVE_DEFAULT_OPTION = 'postnl/grid/alternative_default_option';
208
+ const XPATH_DEFAULT_STATED_ADDRESS_ONLY_OPTION = 'postnl/grid/default_stated_address_only_product_option';
209
 
210
  /**
211
  * Xpath to weight per parcel config setting.
212
  */
213
+ const XPATH_WEIGHT_PER_PARCEL = 'postnl/packing_slip/weight_per_parcel';
214
 
215
  /**
216
  * Xpath to setting that determines whether or not to send track and trace emails.
217
  */
218
+ const XPATH_SEND_TRACK_AND_TRACE_EMAIL = 'postnl/track_and_trace/send_track_and_trace_email';
219
 
220
  /**
221
  * Xpath to track and trace email settings.
222
  */
223
+ const XPATH_TRACK_AND_TRACE_EMAIL_TEMPLATE = 'postnl/track_and_trace/track_and_trace_email_template';
224
+ const XPATH_EMAIL_COPY = 'postnl/track_and_trace/send_copy';
225
+ const XPATH_EMAIL_COPY_TO = 'postnl/track_and_trace/copy_to';
226
+ const XPATH_EMAIL_COPY_METHOD = 'postnl/track_and_trace/copy_method';
227
 
228
  /**
229
  * Xpath to maximum allowed parcel count settings.
366
  $orderId = $this->getOrderId();
367
  if (!$orderId) {
368
  $orderId = $this->getShipment()->getOrderId();
369
+
370
+ $this->setOrderId($orderId);
371
  }
372
 
373
  if (!$orderId && $throwException) {
388
  return $order;
389
  }
390
 
391
+ /**
392
+ * Retrieve the payment model associated with this shipment's order.
393
+ *
394
+ * @return Mage_Sales_Model_Order_Payment
395
+ */
396
+ public function getPayment()
397
+ {
398
+ if ($this->hasPayment()) {
399
+ return $this->_getData('payment');
400
+ }
401
+ $orderId = $this->getOrderId();
402
+
403
+ $payment = Mage::getModel('sales/order_payment')
404
+ ->load($orderId, 'parent_id');
405
+
406
+ $this->setPayment($payment);
407
+ return $payment;
408
+ }
409
+
410
  /**
411
  * Retrieves the linked Shipment's shipping address
412
  *
487
  /**
488
  * Gets the order ID from the associated Mage_Sales_Model_Order_Shipment object
489
  *
490
+ * @return int|null
491
  */
492
  public function getOrderId()
493
  {
943
  */
944
  $helper = $this->getHelper('carrier');
945
 
 
 
 
946
  $url = '';
947
+ $shippingAddress = $this->getShippingAddress();
948
+ if ($shippingAddress) {
949
+ $url = $helper->getBarcodeUrl($barcode, $shippingAddress, false, $forceNl);
 
 
 
 
 
950
  }
951
 
952
  $this->setBarcodeUrl($url);
980
  /**
981
  * Gets the default product code for this shipment from the module's configuration.
982
  *
983
+ * The flow for determining the default product code is as follows:
984
+ * - For domestic COD, Avond COD, PakjeGemak, PakjeGemak COD, PakjeGemak Express, PakjeGemak Express COD,
985
+ * Pakketautomaat, GlobalPack and Buspakje shipments we have a specific settings in the config that determines
986
+ * the product code.
987
+ * - For Avond shipments we first have to check if an option has been saved to the PostNL order table. Otherwise we
988
+ * use the configured default product option for Avond shipments.
989
+ * - For EPS shipments we first check if the destination is Belgium and if the 'EPS BE only' option is available.
990
+ * Otherwise we use the configured default product option for EPS shipments.
991
+ * - For domestic shipments we first check if an option has been saved to the PostNL order table. If not, we need
992
+ * to check if an alternative default option has been configured and if the shipment meets the requirements to
993
+ * use the alternative option. Finally, we get the configured default option for domestic shipments.
994
+ *
995
+ * We then check if the product option determined by this code is actually valid for this shipment. If not, an error
996
+ * is thrown.
997
+ *
998
  * @throws TIG_PostNL_Exception
999
  *
1000
  * @return string
1009
 
1010
  $shipmentType = $this->getShipmentType();
1011
 
1012
+ $postnlOrder = $this->getPostnlOrder();
1013
+
1014
  $xpath = false;
1015
  switch ($shipmentType) {
1016
  case self::SHIPMENT_TYPE_DOMESTIC_COD:
1017
  $xpath = self::XPATH_DEFAULT_STANDARD_COD_PRODUCT_OPTION;
1018
  break;
1019
  case self::SHIPMENT_TYPE_AVOND:
1020
+ if ($postnlOrder && $postnlOrder->hasOptions()) {
1021
+ $xpath = $this->_getDefaultProductCodeXpathByOptions();
1022
+ }
1023
+
1024
+ if (!$xpath) {
1025
+ $xpath = self::XPATH_DEFAULT_EVENING_PRODUCT_OPTION;
1026
+ }
1027
  break;
1028
  case self::SHIPMENT_TYPE_AVOND_COD:
1029
  $xpath = self::XPATH_DEFAULT_EVENING_COD_PRODUCT_OPTION;
1064
  }
1065
 
1066
  /**
1067
+ * If the shipment is not EU or global, it's dutch (AKA a 'standard' shipment). *
1068
+ */
1069
+ if (!$xpath && $postnlOrder && $postnlOrder->hasOptions()) {
1070
+ $xpath = $this->_getDefaultProductCodeXpathByOptions();
1071
+ }
1072
+
1073
+ /**
1074
  * Dutch shipments may use an alternative default option when the shipment's base grand total exceeds a
1075
  * specified amount.
1076
  */
1077
  $useAlternativeDefault = Mage::getStoreConfig(self::XPATH_USE_ALTERNATIVE_DEFAULT, $storeId);
1078
  if (!$xpath && $useAlternativeDefault) {
1079
  /**
1080
+ * Alternative default option usage is enabled.
1081
  */
1082
  $maxShipmentAmount = Mage::getStoreConfig(self::XPATH_ALTERNATIVE_DEFAULT_MAX_AMOUNT, $storeId);
1083
  if ($this->getShipmentBaseGrandTotal() > $maxShipmentAmount) {
1084
  /**
1085
+ * The shipment's base grand total exceeds the specified amount: use the alternative default.
1086
  */
1087
  $xpath = self::XPATH_ALTERNATIVE_DEFAULT_OPTION;
1088
  }
1089
  }
1090
 
1091
+ /**
1092
+ * If we still don't have an xpath, the shipment is a regular domestic shipment.
1093
+ */
1094
  if (!$xpath) {
1095
  $xpath = self::XPATH_DEFAULT_STANDARD_PRODUCT_OPTION;
1096
  }
1097
 
1098
  /**
1099
+ * Get the product code configured to the xpath.
1100
  */
1101
  $productCode = Mage::getStoreConfig($xpath, $storeId);
1102
 
1104
  * If no default product code was found, try to use another product code that is available.
1105
  */
1106
  if (!$productCode) {
1107
+ Zend_Debug::dump($xpath);exit;
1108
  $availableProductCodes = $this->getAllowedProductCodes();
1109
 
1110
  /**
1111
  * If no other product codes are available for this shipment type, throw an error.
1112
  */
1113
  if (empty($availableProductCodes)) {
1114
+ Zend_Debug::dump($availableProductCodes);exit;
1115
  throw new TIG_PostNL_Exception(
1116
  $this->getHelper()->__(
1117
  "No default product options are available for this shipment. Please check that you have " .
1135
  'POSTNL-0189',
1136
  'warning',
1137
  $helper->__(
1138
+ 'The default product option was not available for this shipment, so another product option was ' .
1139
+ 'chosen. Please check if the default product options are configured correctly in the PostNL ' .
1140
  "extension's configuration."
1141
  )
1142
  );
1148
  return $productCode;
1149
  }
1150
 
1151
+ /**
1152
+ * Gets the xpath for the default product option by saved PostNL Order options. Currently only the
1153
+ * 'only_stated_address' option is supported, but this may be expanded in future releases.
1154
+ *
1155
+ * If multiple options are applicable, the first applicable option is applied.
1156
+ *
1157
+ * @return bool|string
1158
+ */
1159
+ protected function _getDefaultProductCodeXpathByOptions()
1160
+ {
1161
+ $postnlOrder = $this->getPostnlOrder();
1162
+
1163
+ /**
1164
+ * If this shipment has no PostNL order or that order doesn't have any options, do nothing.
1165
+ */
1166
+ if (!$postnlOrder || !$postnlOrder->hasOptions()) {
1167
+ return false;
1168
+ }
1169
+
1170
+ /**
1171
+ * If the options are empty, do nothing.
1172
+ */
1173
+ $options = $postnlOrder->getOptions();
1174
+ if (empty($options)) {
1175
+ return false;
1176
+ }
1177
+
1178
+ /**
1179
+ * Unserialize the options and check loop through them.
1180
+ */
1181
+ foreach ($options as $option => $value) {
1182
+ /**
1183
+ * If the option has no true value, move on to the next option.
1184
+ */
1185
+ if (!$value) {
1186
+ continue;
1187
+ }
1188
+
1189
+ switch ($option) {
1190
+ case 'only_stated_address':
1191
+ return self::XPATH_DEFAULT_STATED_ADDRESS_ONLY_OPTION;
1192
+ break;
1193
+ //no default
1194
+ }
1195
+ }
1196
+
1197
+ return false;
1198
+ }
1199
+
1200
  /**
1201
  * Gets this shipment's main barcode.
1202
  *
1292
  /**
1293
  * Gets a PostNL order associated with this shipment (if any exist)
1294
  *
1295
+ * @return false|TIG_PostNL_Model_Core_Order
1296
  */
1297
  public function getPostnlOrder()
1298
  {
1405
  /**
1406
  * Gets the delivery date for this shipment.
1407
  *
1408
+ * @return string
1409
  */
1410
  public function getDeliveryDate()
1411
  {
1417
  * Try to get the delivery date for a PostNL order.
1418
  */
1419
  $postnlOrder = $this->getPostnlOrder();
1420
+ if ($postnlOrder && $postnlOrder->hasDeliveryDate()) {
1421
  $deliveryDate = $postnlOrder->getDeliveryDate();
1422
 
1423
  $this->setDeliveryDate($deliveryDate);
1428
  * @var TIG_PostNL_Helper_DeliveryOptions $helper
1429
  */
1430
  $helper = $this->getHelper('deliveryOptions');
1431
+ $orderDate = Mage::getSingleton('core/date')->date(null, $this->getOrder()->getCreatedAt());
1432
+ $deliveryDate = $helper->getDeliveryDate($orderDate, $this->getStoreId());
1433
 
1434
+ $deliveryDate = $helper->getValidDeliveryDate($deliveryDate)->format('Y-m-d H:i:s');
 
 
1435
 
1436
+ return $deliveryDate;
 
 
 
1437
  }
1438
 
1439
  /**
1455
  return $isBuspakje;
1456
  }
1457
 
1458
+ /**
1459
+ * Gets the default extra cover amount for this shipment.
1460
+ *
1461
+ * @return float|int
1462
+ */
1463
+ public function getDefaultExtraCoverAmount()
1464
+ {
1465
+ if ($this->isGlobalShipment()) {
1466
+ return 200;
1467
+ }
1468
+
1469
+ $shipmentAmount = $this->getShipmentBaseGrandTotal();
1470
+ $extraCoverAmount = ceil($shipmentAmount / 500) * 500;
1471
+
1472
+ return $extraCoverAmount;
1473
+ }
1474
+
1475
  /**
1476
  * Getter for the '_preventSaving' class variable.
1477
  *
1503
  /**
1504
  * Set an extra cover amount
1505
  *
1506
+ * @param int|null $amount
1507
  *
1508
+ * @return false|TIG_PostNL_Model_Core_Shipment
1509
  */
1510
+ public function setExtraCoverAmount($amount = null)
1511
  {
1512
  /**
1513
  * Check if extra cover is allowed for this shipment
1514
  */
1515
+ if (!$this->isExtraCover()) {
 
 
1516
  return false;
1517
  }
1518
 
1519
+ if (is_null($amount)) {
1520
+ $amount = $this->getDefaultExtraCoverAmount();
1521
+ }
1522
+
1523
  $this->setData('extra_cover_amount', $amount);
1524
 
1525
  return $this;
1629
  * If this shipment has an associated PostNL order with a confirm date, use that.
1630
  */
1631
  $postnlOrder = $this->getPostnlOrder();
1632
+ if ($postnlOrder && $postnlOrder->hasConfirmDate()) {
1633
  $confirmDate = new DateTime($postnlOrder->getConfirmDate());
1634
 
1635
  $this->setData('confirm_date', $confirmDate->getTimestamp());
1641
  */
1642
  $deliveryDate = $this->getDeliveryDate();
1643
 
 
 
 
 
 
 
 
 
 
 
1644
  /**
1645
  * Calculate the confirm based on the delivery date.
1646
  */
1647
  $deliveryDate = new DateTime($deliveryDate);
 
1648
 
1649
+ $confirmDate = clone $deliveryDate;
1650
+ $confirmDate = $confirmDate->sub(new DateInterval('P1D'));
1651
+
1652
+ $this->getHelper('deliveryOptions')->getValidConfirmDate($confirmDate);
1653
+
1654
+ $this->setData('confirm_date', $confirmDate->getTimestamp());
1655
  return $this;
1656
  }
1657
 
2039
  /**
2040
  * @var Mage_Sales_Model_Order_Payment $payment
2041
  */
2042
+ $payment = $this->getPayment();
 
2043
  $paymentMethod = $payment->getMethod();
2044
 
2045
  if (in_array($paymentMethod, $codPaymentMethods)) {
2086
  return $isExported;
2087
  }
2088
 
2089
+ /**
2090
+ * Check if this shipment is an extra cover shipment.
2091
+ *
2092
+ * @return boolean
2093
+ */
2094
+ public function isExtraCover()
2095
+ {
2096
+ $productCode = $this->getProductCode();
2097
+ if (!$productCode) {
2098
+ return false;
2099
+ }
2100
+
2101
+ $extraCoverProductCodes = $this->getExtraCoverProductCodes();
2102
+ if (in_array($productCode, $extraCoverProductCodes)) {
2103
+ return true;
2104
+ }
2105
+
2106
+ return false;
2107
+ }
2108
+
2109
  /**
2110
  * Checks if the current entity may generate a barcode.
2111
  *
2345
  }
2346
 
2347
  $shippingPhase = $this->getShippingPhase();
2348
+ if ($shippingPhase == self::SHIPPING_PHASE_DELIVERED
 
2349
  || $shippingPhase == self::SHIPPING_PHASE_DISTRIBUTION
2350
  || $shippingPhase == self::SHIPPING_PHASE_SORTING
2351
  ) {
2368
  }
2369
 
2370
  $shippingPhase = $this->getShippingPhase();
2371
+ if ($shippingPhase == self::SHIPPING_PHASE_DELIVERED
 
2372
  || $shippingPhase == self::SHIPPING_PHASE_DISTRIBUTION
2373
  || $shippingPhase == self::SHIPPING_PHASE_SORTING
2374
  ) {
2395
  }
2396
 
2397
  $shippingPhase = $this->getShippingPhase();
2398
+ if ($shippingPhase == self::SHIPPING_PHASE_DELIVERED
 
2399
  || $shippingPhase == self::SHIPPING_PHASE_DISTRIBUTION
2400
  || $shippingPhase == self::SHIPPING_PHASE_SORTING
2401
  ) {
2423
  }
2424
 
2425
  $shippingPhase = $this->getShippingPhase();
2426
+ if ($shippingPhase == self::SHIPPING_PHASE_DELIVERED
 
2427
  || $shippingPhase == self::SHIPPING_PHASE_DISTRIBUTION
2428
  || $shippingPhase == self::SHIPPING_PHASE_SORTING
2429
  ) {
3141
  */
3142
  public function sendTrackAndTraceEmail($ignoreAlreadySent = false, $ignoreConfig = false)
3143
  {
3144
+ $helper = Mage::helper('postnl');
3145
  if (!$this->canSendTrackAndTraceEmail($ignoreAlreadySent, $ignoreConfig)) {
3146
  throw new TIG_PostNL_Exception(
3147
+ $helper->__('The sendTrackAndTraceEmail action is currently unavailable.'),
3148
  'POSTNL-0076'
3149
  );
3150
  }
3153
 
3154
  $template = Mage::getStoreConfig(self::XPATH_TRACK_AND_TRACE_EMAIL_TEMPLATE, $storeId);
3155
 
3156
+ try {
3157
+ /**
3158
+ * @var Mage_Sales_Model_Order $order
3159
+ */
3160
+ $shippingAddress = $this->getShippingAddress();
3161
+ $shipment = $this->getShipment();
3162
+ $order = $this->getOrder();
3163
+ if (!$order || !$shipment || !$shippingAddress) {
3164
+ throw new TIG_PostNL_Exception(
3165
+ $helper->__('Unable to send track & trace email due to missing shipment parameters.'),
3166
+ 'POSTNL-0200'
3167
+ );
3168
+ }
3169
 
3170
+ $payment = $order->getPayment();
3171
+ $paymentBlockHtml = '';
3172
+ if ($payment) {
3173
+ /** @noinspection PhpUndefinedMethodInspection */
3174
+ $paymentBlock = Mage::helper('payment')
3175
+ ->getInfoBlock($payment)
3176
+ ->setIsSecureMode(true);
 
 
 
 
 
 
 
 
 
 
3177
 
3178
+ /** @noinspection PhpUndefinedMethodInspection */
3179
+ $paymentBlock->getMethod()
3180
+ ->setStore($storeId);
3181
+
3182
+ /**
3183
+ * @var Mage_Payment_Block_Info $paymentBlock
3184
+ */
3185
+ $paymentBlockHtml = $paymentBlock->toHtml();
3186
+ }
3187
+
3188
+ /** @noinspection PhpUndefinedMethodInspection */
3189
+ $templateVariables = array(
3190
+ 'postnlshipment' => $this,
3191
+ 'barcode' => $this->getMainBarcode(),
3192
+ 'barcode_url' => $this->getBarcodeUrl(false),
3193
+ 'shipment' => $shipment,
3194
+ 'order' => $order,
3195
+ 'payment_html' => $paymentBlockHtml,
3196
+ 'customer' => $order->getCustomer(),
3197
+ 'quote' => $order->getQuote(),
3198
+ 'shipment_comment' => '', /** @todo add last shipment comment */
3199
+ 'billing' => $order->getBillingAddress(),
3200
+ 'shipping' => $order->getShippingAddress(),
3201
+ 'pakje_gemak' => $this->getPakjeGemakAddress(),
3202
+ );
3203
+
3204
+ $templateVariables = new Varien_Object($templateVariables);
3205
+ Mage::dispatchEvent(
3206
+ 'postnl_shipment_add_track_and_trace_email_vars',
3207
+ array(
3208
+ 'vars' => $templateVariables,
3209
+ 'postnl_shipment' => $this,
3210
+ )
3211
+ );
3212
+
3213
+ // Get the destination email addresses to send copies to
3214
+ $copy = Mage::getStoreConfigFlag(self::XPATH_EMAIL_COPY, $storeId);
3215
+ $copyTo = explode(',', Mage::getStoreConfig(self::XPATH_EMAIL_COPY_TO, $storeId));
3216
+ $copyMethod = Mage::getStoreConfig(self::XPATH_EMAIL_COPY_METHOD, $storeId);
3217
 
 
3218
  $mailer = Mage::getModel('core/email_template_mailer');
3219
  $emailInfo = Mage::getModel('core/email_info');
3220
+ $emailInfo->addTo($order->getCustomerEmail(), $shippingAddress->getName());
3221
 
3222
  if ($copy && !empty($copyTo) && $copyMethod == 'bcc') {
3223
  foreach ($copyTo as $email) {
3235
  }
3236
  }
3237
 
3238
+ /**
3239
+ * Set all required parameters.
3240
+ */
3241
+ $mailer->setSender(Mage::getStoreConfig($order::XML_PATH_EMAIL_IDENTITY, $storeId))
3242
+ ->setStoreId($storeId)
3243
+ ->setTemplateId($template)
3244
+ ->setTemplateParams($templateVariables->getData());
3245
+
3246
+ Mage::dispatchEvent(
3247
+ 'postnl_shipment_send_track_and_trace_email_before',
3248
+ array(
3249
+ 'postnl_shipment' => $this,
3250
+ 'mailer' => $mailer,
3251
+ )
3252
+ );
3253
+
3254
+ /**
3255
+ * Send the emails.
3256
+ */
3257
  $mailer->send();
3258
+
3259
+ Mage::dispatchEvent(
3260
+ 'postnl_shipment_send_track_and_trace_email_after',
3261
+ array(
3262
+ 'postnl_shipment' => $this,
3263
+ )
3264
+ );
3265
+
3266
+ /**
3267
+ * Add a comment to the order and shipment that the track & trace email has been sent.
3268
+ */
3269
+ $order->addStatusHistoryComment(
3270
+ $helper->__(
3271
+ 'PostNL track & trace email has been sent for shipment #%s.',
3272
+ $shipment->getIncrementId()
3273
+ )
3274
+ )
3275
+ ->setIsCustomerNotified(1)
3276
+ ->save();
3277
+
3278
+ $shipment->addComment(
3279
+ $helper->__('PostNL track & trace email has been sent.'),
3280
+ true
3281
+ )
3282
+ ->save();
3283
  } catch (Exception $e) {
 
3284
  $helper->logException($e);
3285
  throw new TIG_PostNL_Exception(
3286
  $helper->__(
3654
  * Get the selected product code for the current shipment's shipment type.
3655
  */
3656
  $shipmentType .= '_options';
3657
+ if (isset($codes[$shipmentType])) {
3658
  return $codes[$shipmentType];
3659
+ } elseif (isset($codes['product_option'])) {
3660
  return $codes['product_option'];
3661
  }
3662
 
3687
  * Check if the product code is allowed.
3688
  */
3689
  if (!in_array($productCode, $allowedProductCodes)) {
3690
+ $options = Mage::getSingleton('postnl_core/system_config_source_allProductOptions')->getOptions();
3691
+ $productName = $cifHelper->__($options[$productCode]['label']);
3692
+
3693
  throw new TIG_PostNL_Exception(
3694
+ $cifHelper->__(
3695
+ "Product option '%s' (%s) is not allowed for this shipment.", $productName, $productCode
3696
+ ),
3697
  'POSTNL-0078'
3698
  );
3699
  }
3713
  if (!$shippingAddress
3714
  || !in_array($shippingAddress->getCountryId(), $allowedCountries)
3715
  ) {
3716
+ $options = Mage::getSingleton('postnl_core/system_config_source_allProductOptions')->getOptions();
3717
+ $productName = $cifHelper->__($options[$productCode]['label']);
3718
+
3719
  throw new TIG_PostNL_Exception(
3720
+ $cifHelper->__(
3721
+ "Product option '%s' (%s) is not allowed for this shipment.", $productName, $productCode
3722
+ ),
3723
  'POSTNL-0078'
3724
  );
3725
  }
4135
  if (!$this->getProductCode() || Mage::registry('postnl_product_option') !== null) {
4136
  $productCode = $this->_getProductCode();
4137
  $this->setProductCode($productCode);
4138
+
4139
+ /**
4140
+ * If this is an extra cover shipment and no extra cover amount has been set, set the default of 500 EUR.
4141
+ */
4142
+ if ($this->isExtraCover() && !$this->hasExtraCoverAmount()) {
4143
+ $this->setExtraCoverAmount();
4144
+ }
4145
  }
4146
 
4147
  /**
app/code/community/TIG/PostNL/Model/Core/Shipment/Barcode.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * Class TIG_PostNL_Model_Core_Shipment_Barcode@method getBarcode
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * Class TIG_PostNL_Model_Core_Shipment_Barcode@method getBarcode
app/code/community/TIG/PostNL/Model/Core/Shipment/Label.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * Class TIG_PostNL_Model_Core_Shipment_Label
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * Class TIG_PostNL_Model_Core_Shipment_Label
app/code/community/TIG/PostNL/Model/Core/Shipment/Process.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Shipment_Process extends Mage_Index_Model_Process
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_Shipment_Process extends Mage_Index_Model_Process
app/code/community/TIG/PostNL/Model/Core/Shipment/Status/History.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * Class TIG_PostNL_Model_Core_Shipment_Status_History
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * Class TIG_PostNL_Model_Core_Shipment_Status_History
app/code/community/TIG/PostNL/Model/Core/System/Config/Backend/HourMinute.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Backend_HourMinute extends Mage_Core_Model_Config_Data
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Backend_HourMinute extends Mage_Core_Model_Config_Data
app/code/community/TIG/PostNL/Model/Core/System/Config/Backend/Image/Pdf.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Backend_Image_Pdf extends Mage_Adminhtml_Model_System_Config_Backend_Image_Pdf
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Backend_Image_Pdf extends Mage_Adminhtml_Model_System_Config_Backend_Image_Pdf
app/code/community/TIG/PostNL/Model/Core/System/Config/Backend/ValidateDefaultOption.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasIsIncludingTax()
@@ -46,7 +46,7 @@ class TIG_PostNL_Model_Core_System_Config_Backend_ValidateDefaultOption extends
46
  /**
47
  * Xpath to supported options configuration setting
48
  */
49
- const XPATH_SUPPORTED_PRODUCT_OPTIONS = 'postnl/cif_product_options/supported_product_options';
50
 
51
  /**
52
  * Validate that a chosen default option is actually available.
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasIsIncludingTax()
46
  /**
47
  * Xpath to supported options configuration setting
48
  */
49
+ const XPATH_SUPPORTED_PRODUCT_OPTIONS = 'postnl/grid/supported_product_options';
50
 
51
  /**
52
  * Validate that a chosen default option is actually available.
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/AllProductOptions.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_AllProductOptions
@@ -108,12 +108,13 @@ class TIG_PostNL_Model_Core_System_Config_Source_AllProductOptions
108
  'group' => 'standard_options',
109
  ),
110
  '3089' => array(
111
- 'value' => '3089',
112
- 'label' => 'Signature on delivery + Delivery to stated address only',
113
- 'isExtraCover' => false,
114
- 'isAvond' => true,
115
- 'isCod' => false,
116
- 'group' => 'standard_options',
 
117
  ),
118
  '3389' => array(
119
  'value' => '3389',
@@ -124,12 +125,13 @@ class TIG_PostNL_Model_Core_System_Config_Source_AllProductOptions
124
  'group' => 'standard_options',
125
  ),
126
  '3096' => array(
127
- 'value' => '3096',
128
- 'label' => 'Signature on delivery + Deliver to stated address only + Return when not home',
129
- 'isExtraCover' => false,
130
- 'isAvond' => true,
131
- 'isCod' => false,
132
- 'group' => 'standard_options',
 
133
  ),
134
  '3090' => array(
135
  'value' => '3090',
@@ -140,20 +142,22 @@ class TIG_PostNL_Model_Core_System_Config_Source_AllProductOptions
140
  'group' => 'standard_options',
141
  ),
142
  '3385' => array(
143
- 'value' => '3385',
144
- 'label' => 'Deliver to stated address only',
145
- 'isExtraCover' => false,
146
- 'isAvond' => true,
147
- 'isCod' => false,
148
- 'group' => 'standard_options',
 
149
  ),
150
  '3390' => array(
151
- 'value' => '3390',
152
- 'label' => 'Deliver to stated address only + Return when not home',
153
- 'isExtraCover' => false,
154
- 'isAvond' => true,
155
- 'isCod' => false,
156
- 'group' => 'standard_options',
 
157
  ),
158
  '3535' => array(
159
  'value' => '3535',
@@ -296,14 +300,31 @@ class TIG_PostNL_Model_Core_System_Config_Source_AllProductOptions
296
  {
297
  $options = parent::getOptions($flags, $asFlatArray, $checkAvailable);
298
 
 
 
 
 
299
  $helper = Mage::helper('postnl');
300
- if ($helper->canUseEpsBEOnlyOption()) {
301
- $options['eu_options']['value']['4955'] = array(
302
- 'value' => '4955',
303
- 'label' => $helper->__('EU Pack Standard (Belgium only, no signature)'),
304
- 'isBelgiumOnly' => true,
305
- 'isExtraCover' => false,
306
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
307
  }
308
 
309
  return $options;
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_AllProductOptions
108
  'group' => 'standard_options',
109
  ),
110
  '3089' => array(
111
+ 'value' => '3089',
112
+ 'label' => 'Signature on delivery + Delivery to stated address only',
113
+ 'isExtraCover' => false,
114
+ 'isAvond' => true,
115
+ 'isCod' => false,
116
+ 'statedAddressOnly' => true,
117
+ 'group' => 'standard_options',
118
  ),
119
  '3389' => array(
120
  'value' => '3389',
125
  'group' => 'standard_options',
126
  ),
127
  '3096' => array(
128
+ 'value' => '3096',
129
+ 'label' => 'Signature on delivery + Deliver to stated address only + Return when not home',
130
+ 'isExtraCover' => false,
131
+ 'isAvond' => true,
132
+ 'isCod' => false,
133
+ 'statedAddressOnly' => true,
134
+ 'group' => 'standard_options',
135
  ),
136
  '3090' => array(
137
  'value' => '3090',
142
  'group' => 'standard_options',
143
  ),
144
  '3385' => array(
145
+ 'value' => '3385',
146
+ 'label' => 'Deliver to stated address only',
147
+ 'isExtraCover' => false,
148
+ 'isAvond' => true,
149
+ 'isCod' => false,
150
+ 'statedAddressOnly' => true,
151
+ 'group' => 'standard_options',
152
  ),
153
  '3390' => array(
154
+ 'value' => '3390',
155
+ 'label' => 'Deliver to stated address only + Return when not home',
156
+ 'isExtraCover' => false,
157
+ 'isAvond' => true,
158
+ 'isCod' => false,
159
+ 'statedAddressOnly' => true,
160
+ 'group' => 'standard_options',
161
  ),
162
  '3535' => array(
163
  'value' => '3535',
300
  {
301
  $options = parent::getOptions($flags, $asFlatArray, $checkAvailable);
302
 
303
+ /**
304
+ * Add the EU EPS BE only option if it's allowed and if either EPS options are requested or if all groups are
305
+ * requested.
306
+ */
307
  $helper = Mage::helper('postnl');
308
+ if ($helper->canUseEpsBEOnlyOption()
309
+ && (
310
+ (isset($flags['group'])
311
+ && $flags['group'] == 'eu_options'
312
+ )
313
+ || (!isset($flags['group']))
314
+ )
315
+ ) {
316
+ if (!$asFlatArray) {
317
+ $options['4955'] = array(
318
+ 'value' => '4955',
319
+ 'label' => $helper->__('EU Pack Standard (Belgium only, no signature)'),
320
+ 'isBelgiumOnly' => true,
321
+ 'isExtraCover' => false,
322
+ );
323
+ } else {
324
+ $options['4955'] = $helper->__('EU Pack Standard (Belgium only, no signature)');
325
+ }
326
+
327
+ ksort($options);
328
  }
329
 
330
  return $options;
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/Attributes.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_Attributes
@@ -46,6 +46,7 @@ class TIG_PostNL_Model_Core_System_Config_Source_Attributes
46
  public function toOptionArray()
47
  {
48
  $attributes = Mage::getResourceModel('catalog/product_attribute_collection')
 
49
  ->addFieldToFilter('frontend_label', array('notnull' => true));
50
 
51
  $attributes->getSelect()->order('frontend_label ASC');
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_Attributes
46
  public function toOptionArray()
47
  {
48
  $attributes = Mage::getResourceModel('catalog/product_attribute_collection')
49
+ ->addFieldToSelect(array('attribute_code', 'frontend_label'))
50
  ->addFieldToFilter('frontend_label', array('notnull' => true));
51
 
52
  $attributes->getSelect()->order('frontend_label ASC');
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/BuspakjeProductOptions.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_BuspakjeProductOptions
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_BuspakjeProductOptions
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/CheckoutExtensions.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ class TIG_PostNL_Model_Core_System_Config_Source_CheckoutExtensions
40
+ {
41
+ /**
42
+ * Returns an option array for supported checkout extensions.
43
+ *
44
+ * @return array
45
+ */
46
+ public function toOptionArray()
47
+ {
48
+ $helper = Mage::helper('postnl');
49
+ $options = array(
50
+ array(
51
+ 'value' => 'magento_onepagecheckout',
52
+ 'label' => $helper->__("Magento's One Page Checkout"),
53
+ ),
54
+ array(
55
+ 'value' => 'idev_onestepcheckout',
56
+ 'label' => $helper->__("Idev's OneStepCheckout"),
57
+ ),
58
+ array(
59
+ 'value' => 'other',
60
+ 'label' => $helper->__('Other'),
61
+ ),
62
+ );
63
+
64
+ return $options;
65
+ }
66
+ }
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/CommentType.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_CommentType
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_CommentType
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/CutOffTime.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_CutOffTime
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_CutOffTime
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/DebugMode.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_DebugMode
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_DebugMode
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/Direction.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_Direction
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_Direction
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/EuProductOptions.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_EuProductOptions
@@ -64,12 +64,16 @@ class TIG_PostNL_Model_Core_System_Config_Source_EuProductOptions
64
 
65
  $helper = Mage::helper('postnl');
66
  if ($helper->canUseEpsBEOnlyOption()) {
67
- $options['eu_options']['value']['4955'] = array(
68
- 'value' => '4955',
69
- 'label' => $helper->__('EU Pack Standard (Belgium only, no signature)'),
70
- 'isBelgiumOnly' => true,
71
- 'isExtraCover' => false,
72
- );
 
 
 
 
73
  }
74
 
75
  return $options;
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_EuProductOptions
64
 
65
  $helper = Mage::helper('postnl');
66
  if ($helper->canUseEpsBEOnlyOption()) {
67
+ if (!$asFlatArray) {
68
+ $options[] = array(
69
+ 'value' => '4955',
70
+ 'label' => $helper->__('EU Pack Standard (Belgium only, no signature)'),
71
+ 'isBelgiumOnly' => true,
72
+ 'isExtraCover' => false,
73
+ );
74
+ } else {
75
+ $options['4955'] = $helper->__('EU Pack Standard (Belgium only, no signature)');
76
+ }
77
  }
78
 
79
  return $options;
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/GlobalProductOptions.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_GlobalProductOptions
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_GlobalProductOptions
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/GlobalpackShipmentType.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_GlobalpackShipmentType
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_GlobalpackShipmentType
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/HourMinute.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_HourMinute
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_HourMinute
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/LabelSize.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_LabelSize
@@ -49,11 +49,11 @@ class TIG_PostNL_Model_Core_System_Config_Source_LabelSize
49
  $labelSizes = array(
50
  array(
51
  'value' => 'A4',
52
- 'label' => $helper->__('A4')
53
  ),
54
  array(
55
  'value' => 'A6',
56
- 'label' => $helper->__('A6')
57
  ),
58
  );
59
 
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_LabelSize
49
  $labelSizes = array(
50
  array(
51
  'value' => 'A4',
52
+ 'label' => $helper->__('A4 format')
53
  ),
54
  array(
55
  'value' => 'A6',
56
+ 'label' => $helper->__('A6 format')
57
  ),
58
  );
59
 
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/ManualAutomatic.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_ManualAutomatic
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_ManualAutomatic
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/PackingSlipItemFields.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_PackingSlipItemFields
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_PackingSlipItemFields
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/PakjeGemakProductOptions.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_PakjeGemakProductOptions
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_PakjeGemakProductOptions
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/PakketautomaatProductOptions.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_PakketautomaatProductOptions
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_PakketautomaatProductOptions
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/ProductOptions/Abstract.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  abstract class TIG_PostNL_Model_Core_System_Config_Source_ProductOptions_Abstract
@@ -41,7 +41,7 @@ abstract class TIG_PostNL_Model_Core_System_Config_Source_ProductOptions_Abstrac
41
  /**
42
  * Xpath to supported options configuration setting
43
  */
44
- const XPATH_SUPPORTED_PRODUCT_OPTIONS = 'postnl/cif_product_options/supported_product_options';
45
 
46
  /**
47
  * @var array
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  abstract class TIG_PostNL_Model_Core_System_Config_Source_ProductOptions_Abstract
41
  /**
42
  * Xpath to supported options configuration setting
43
  */
44
+ const XPATH_SUPPORTED_PRODUCT_OPTIONS = 'postnl/grid/supported_product_options';
45
 
46
  /**
47
  * @var array
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/ReferenceType.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_ReferenceType
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_ReferenceType
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/ShippingDays.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ class TIG_PostNL_Model_Core_System_Config_Source_ShippingDays
40
+ {
41
+ /**
42
+ * Returns an option array for possible shipping.
43
+ *
44
+ * @return array
45
+ */
46
+ public function toOptionArray()
47
+ {
48
+ $helper = Mage::helper('postnl');
49
+ $labelSizes = array(
50
+ array(
51
+ 'value' => '1',
52
+ 'label' => $helper->__('Monday')
53
+ ),
54
+ array(
55
+ 'value' => '2',
56
+ 'label' => $helper->__('Tuesday')
57
+ ),
58
+ array(
59
+ 'value' => '3',
60
+ 'label' => $helper->__('Wednesday')
61
+ ),
62
+ array(
63
+ 'value' => '4',
64
+ 'label' => $helper->__('Thursday')
65
+ ),
66
+ array(
67
+ 'value' => '5',
68
+ 'label' => $helper->__('Friday')
69
+ ),
70
+ array(
71
+ 'value' => '6',
72
+ 'label' => $helper->__('Saturday')
73
+ ),
74
+ );
75
+
76
+ return $labelSizes;
77
+ }
78
+ }
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/ShippingDuration.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_ShippingDuration
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_ShippingDuration
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/ShippingMethods.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_ShippingMethods
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_ShippingMethods
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/StandardProductOptions.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_StandardProductOptions
@@ -44,102 +44,116 @@ class TIG_PostNL_Model_Core_System_Config_Source_StandardProductOptions
44
  */
45
  protected $_options = array(
46
  array(
47
- 'value' => '3085',
48
- 'label' => 'Standard shipment',
49
- 'isExtraCover' => false,
50
- 'isAvond' => false,
51
- 'isCod' => false,
 
52
  ),
53
  array(
54
- 'value' => '3087',
55
- 'label' => 'Extra Cover',
56
- 'isExtraCover' => true,
57
- 'isAvond' => true,
58
- 'isCod' => false,
 
59
  ),
60
  array(
61
- 'value' => '3094',
62
- 'label' => 'Extra cover + Return when not home',
63
- 'isExtraCover' => true,
64
- 'isAvond' => true,
65
- 'isCod' => false,
 
66
  ),
67
  array(
68
- 'value' => '3189',
69
- 'label' => 'Signature on delivery',
70
- 'isExtraCover' => false,
71
- 'isAvond' => false,
72
- 'isCod' => false,
 
73
  ),
74
  array(
75
- 'value' => '3089',
76
- 'label' => 'Signature on delivery + Delivery to stated address only',
77
- 'isExtraCover' => false,
78
- 'isAvond' => true,
79
- 'isCod' => false,
 
80
  ),
81
  array(
82
- 'value' => '3389',
83
- 'label' => 'Signature on delivery + Return when not home',
84
- 'isExtraCover' => false,
85
- 'isAvond' => false,
86
- 'isCod' => false,
 
87
  ),
88
  array(
89
- 'value' => '3096',
90
- 'label' => 'Signature on delivery + Deliver to stated address only + Return when not home',
91
- 'isExtraCover' => false,
92
- 'isAvond' => true,
93
- 'isCod' => false,
 
94
  ),
95
  array(
96
- 'value' => '3090',
97
- 'label' => 'Delivery to neighbour + Return when not home',
98
- 'isExtraCover' => false,
99
- 'isAvond' => false,
100
- 'isCod' => false,
 
101
  ),
102
  array(
103
- 'value' => '3385',
104
- 'label' => 'Deliver to stated address only',
105
- 'isExtraCover' => false,
106
- 'isAvond' => true,
107
- 'isCod' => false,
 
108
  ),
109
  array(
110
- 'value' => '3390',
111
- 'label' => 'Deliver to stated address only + Return when not home',
112
- 'isExtraCover' => false,
113
- 'isAvond' => true,
114
- 'isCod' => false,
 
115
  ),
116
  array(
117
- 'value' => '3086',
118
- 'label' => 'COD',
119
- 'isExtraCover' => false,
120
- 'isAvond' => true,
121
- 'isCod' => true,
 
122
  ),
123
  array(
124
- 'value' => '3091',
125
- 'label' => 'COD + Extra cover',
126
- 'isExtraCover' => true,
127
- 'isAvond' => true,
128
- 'isCod' => true,
 
129
  ),
130
  array(
131
- 'value' => '3093',
132
- 'label' => 'COD + Return when not home',
133
- 'isExtraCover' => false,
134
- 'isAvond' => true,
135
- 'isCod' => true,
 
136
  ),
137
  array(
138
- 'value' => '3097',
139
- 'label' => 'COD + Extra cover + Return when not home',
140
- 'isExtraCover' => true,
141
- 'isAvond' => true,
142
- 'isCod' => true,
 
143
  ),
144
  );
145
 
@@ -224,4 +238,16 @@ class TIG_PostNL_Model_Core_System_Config_Source_StandardProductOptions
224
  {
225
  return $this->getOptions(array('isAvond' => true, 'isCod' => true), $flat, true);
226
  }
 
 
 
 
 
 
 
 
 
 
 
 
227
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_StandardProductOptions
44
  */
45
  protected $_options = array(
46
  array(
47
+ 'value' => '3085',
48
+ 'label' => 'Standard shipment',
49
+ 'isExtraCover' => false,
50
+ 'isAvond' => false,
51
+ 'isCod' => false,
52
+ 'statedAddressOnly' => false,
53
  ),
54
  array(
55
+ 'value' => '3087',
56
+ 'label' => 'Extra Cover',
57
+ 'isExtraCover' => true,
58
+ 'isAvond' => true,
59
+ 'isCod' => false,
60
+ 'statedAddressOnly' => false,
61
  ),
62
  array(
63
+ 'value' => '3094',
64
+ 'label' => 'Extra cover + Return when not home',
65
+ 'isExtraCover' => true,
66
+ 'isAvond' => true,
67
+ 'isCod' => false,
68
+ 'statedAddressOnly' => false,
69
  ),
70
  array(
71
+ 'value' => '3189',
72
+ 'label' => 'Signature on delivery',
73
+ 'isExtraCover' => false,
74
+ 'isAvond' => false,
75
+ 'isCod' => false,
76
+ 'statedAddressOnly' => false,
77
  ),
78
  array(
79
+ 'value' => '3089',
80
+ 'label' => 'Signature on delivery + Delivery to stated address only',
81
+ 'isExtraCover' => false,
82
+ 'isAvond' => true,
83
+ 'isCod' => false,
84
+ 'statedAddressOnly' => true,
85
  ),
86
  array(
87
+ 'value' => '3389',
88
+ 'label' => 'Signature on delivery + Return when not home',
89
+ 'isExtraCover' => false,
90
+ 'isAvond' => false,
91
+ 'isCod' => false,
92
+ 'statedAddressOnly' => false,
93
  ),
94
  array(
95
+ 'value' => '3096',
96
+ 'label' => 'Signature on delivery + Deliver to stated address only + Return when not home',
97
+ 'isExtraCover' => false,
98
+ 'isAvond' => true,
99
+ 'isCod' => false,
100
+ 'statedAddressOnly' => true,
101
  ),
102
  array(
103
+ 'value' => '3090',
104
+ 'label' => 'Delivery to neighbour + Return when not home',
105
+ 'isExtraCover' => false,
106
+ 'isAvond' => false,
107
+ 'isCod' => false,
108
+ 'statedAddressOnly' => false,
109
  ),
110
  array(
111
+ 'value' => '3385',
112
+ 'label' => 'Deliver to stated address only',
113
+ 'isExtraCover' => false,
114
+ 'isAvond' => true,
115
+ 'isCod' => false,
116
+ 'statedAddressOnly' => true,
117
  ),
118
  array(
119
+ 'value' => '3390',
120
+ 'label' => 'Deliver to stated address only + Return when not home',
121
+ 'isExtraCover' => false,
122
+ 'isAvond' => true,
123
+ 'isCod' => false,
124
+ 'statedAddressOnly' => true,
125
  ),
126
  array(
127
+ 'value' => '3086',
128
+ 'label' => 'COD',
129
+ 'isExtraCover' => false,
130
+ 'isAvond' => true,
131
+ 'isCod' => true,
132
+ 'statedAddressOnly' => false,
133
  ),
134
  array(
135
+ 'value' => '3091',
136
+ 'label' => 'COD + Extra cover',
137
+ 'isExtraCover' => true,
138
+ 'isAvond' => true,
139
+ 'isCod' => true,
140
+ 'statedAddressOnly' => false,
141
  ),
142
  array(
143
+ 'value' => '3093',
144
+ 'label' => 'COD + Return when not home',
145
+ 'isExtraCover' => false,
146
+ 'isAvond' => true,
147
+ 'isCod' => true,
148
+ 'statedAddressOnly' => false,
149
  ),
150
  array(
151
+ 'value' => '3097',
152
+ 'label' => 'COD + Extra cover + Return when not home',
153
+ 'isExtraCover' => true,
154
+ 'isAvond' => true,
155
+ 'isCod' => true,
156
+ 'statedAddressOnly' => false,
157
  ),
158
  );
159
 
238
  {
239
  return $this->getOptions(array('isAvond' => true, 'isCod' => true), $flat, true);
240
  }
241
+
242
+ /**
243
+ * Get available 'stated address only' options.
244
+ *
245
+ * @param boolean $flat
246
+ *
247
+ * @return array
248
+ */
249
+ public function getAvailableStatedAddressOnlyOptions($flat = false)
250
+ {
251
+ return $this->getOptions(array('statedAddressOnly' => true), $flat, true);
252
+ }
253
  }
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/StreetField.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_StreetField
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_StreetField
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/StreetFieldWithDefault.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
 
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
 
app/code/community/TIG/PostNL/Model/Core/System/Config/Source/WeightUnit.php CHANGED
@@ -25,25 +25,23 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_WeightUnit
40
  {
41
  /**
42
- * Returns an option array for all possible PostNL product options
43
  *
44
  * @return array
45
- *
46
- * @todo implement COD and extra cover
47
  */
48
  public function toOptionArray()
49
  {
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Core_System_Config_Source_WeightUnit
40
  {
41
  /**
42
+ * Returns an option array for all possible PostNL product options.
43
  *
44
  * @return array
 
 
45
  */
46
  public function toOptionArray()
47
  {
app/code/community/TIG/PostNL/Model/DeliveryOptions/Cif.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method TIG_PostNL_Model_DeliveryOptions_Cif setStoreId(int $value)
@@ -97,7 +97,7 @@ class TIG_PostNL_Model_DeliveryOptions_Cif extends TIG_PostNL_Model_Core_Cif
97
  $soapParams = array(
98
  'GetDeliveryDate' => array(
99
  'Postalcode' => $postcode,
100
- 'ShippingDate' => date('d-m-Y H:i:s', Mage::getModel('core/date')->timestamp()),
101
  'ShippingDuration' => $shippingDuration,
102
  'CutOffTime' => $this->_getCutOffTime(),
103
  'AllowSundaySorting' => $this->_getSundaySortingAllowed(),
@@ -129,11 +129,11 @@ class TIG_PostNL_Model_DeliveryOptions_Cif extends TIG_PostNL_Model_Core_Cif
129
  }
130
 
131
  /**
132
- * Get evening timeframes for the specified postcode and delivery window.
133
  *
134
  * @param array $data
135
  *
136
- * @return StdClass
137
  *
138
  * @throws TIG_PostNL_Exception
139
  */
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method TIG_PostNL_Model_DeliveryOptions_Cif setStoreId(int $value)
97
  $soapParams = array(
98
  'GetDeliveryDate' => array(
99
  'Postalcode' => $postcode,
100
+ 'ShippingDate' => Mage::getSingleton('core/date')->date('d-m-Y H:i:s'),
101
  'ShippingDuration' => $shippingDuration,
102
  'CutOffTime' => $this->_getCutOffTime(),
103
  'AllowSundaySorting' => $this->_getSundaySortingAllowed(),
129
  }
130
 
131
  /**
132
+ * Get evening time frames for the specified postcode and delivery window.
133
  *
134
  * @param array $data
135
  *
136
+ * @return StdClass[]
137
  *
138
  * @throws TIG_PostNL_Exception
139
  */
app/code/community/TIG/PostNL/Model/DeliveryOptions/Observer/ShippingMethodAvailable.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_DeliveryOptions_Observer_ShippingMethodAvailable extends Varien_Object
@@ -111,7 +111,7 @@ class TIG_PostNL_Model_DeliveryOptions_Observer_ShippingMethodAvailable extends
111
  *
112
  * Unfortunately there is no unique event for this block.
113
  *
114
- * @var Mage_Core_Block_Abstract $block
115
  */
116
  $block = $observer->getBlock();
117
  $blockClass = $this->getBlockClass();
@@ -120,18 +120,22 @@ class TIG_PostNL_Model_DeliveryOptions_Observer_ShippingMethodAvailable extends
120
  return $this;
121
  }
122
 
 
 
123
  if (!$this->getCanUseDeliveryOptions()) {
124
  return $this;
125
  }
126
 
127
- $this->_resetPostnlOrder();
128
-
129
  /**
130
  * Get the template for the current module.
131
  */
132
  $template = 'TIG/PostNL/delivery_options/onepage/available.phtml';
133
  if (Mage::app()->getRequest()->getModuleName() == 'onestepcheckout') {
134
  $template = 'TIG/PostNL/delivery_options/onestepcheckout/available.phtml';
 
 
 
 
135
  }
136
 
137
  /**
@@ -157,10 +161,12 @@ class TIG_PostNL_Model_DeliveryOptions_Observer_ShippingMethodAvailable extends
157
  *
158
  * @var TIG_PostNL_Model_Core_Order $postnlOrder
159
  */
160
- $postnlOrder = Mage::getModel('postnl_core/order')->load($quote->getId(), 'quote_id');
161
- if ($postnlOrder->getId()) {
162
  $postnlOrder->setIsActive(false)
163
  ->setShipmentCosts(0)
 
 
164
  ->save();
165
  }
166
 
@@ -178,4 +184,48 @@ class TIG_PostNL_Model_DeliveryOptions_Observer_ShippingMethodAvailable extends
178
 
179
  return $this;
180
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_DeliveryOptions_Observer_ShippingMethodAvailable extends Varien_Object
111
  *
112
  * Unfortunately there is no unique event for this block.
113
  *
114
+ * @var Mage_Checkout_Block_Onepage_Shipping_Method_Available $block
115
  */
116
  $block = $observer->getBlock();
117
  $blockClass = $this->getBlockClass();
120
  return $this;
121
  }
122
 
123
+ $this->_resetPostnlOrder();
124
+
125
  if (!$this->getCanUseDeliveryOptions()) {
126
  return $this;
127
  }
128
 
 
 
129
  /**
130
  * Get the template for the current module.
131
  */
132
  $template = 'TIG/PostNL/delivery_options/onepage/available.phtml';
133
  if (Mage::app()->getRequest()->getModuleName() == 'onestepcheckout') {
134
  $template = 'TIG/PostNL/delivery_options/onestepcheckout/available.phtml';
135
+
136
+ if (!$block->getChild('postnl.osc.delivery.options')) {
137
+ $block = $this->_addDeliveryOptionBlocks($block);
138
+ }
139
  }
140
 
141
  /**
161
  *
162
  * @var TIG_PostNL_Model_Core_Order $postnlOrder
163
  */
164
+ $postnlOrder = Mage::getModel('postnl_core/order')->loadByQuote($quote);
165
+ if ($postnlOrder->getId() && !$postnlOrder->hasOrderId()) {
166
  $postnlOrder->setIsActive(false)
167
  ->setShipmentCosts(0)
168
+ ->setType(false)
169
+ ->setOptions(false)
170
  ->save();
171
  }
172
 
184
 
185
  return $this;
186
  }
187
+
188
+ /**
189
+ * Adds the delivery option blocks in case these were not added by the layout XML. This occurs during certain OSC
190
+ * AJAX requests that ignore the layout XML and generate blocks manually instead.
191
+ *
192
+ * @param Mage_Checkout_Block_Onepage_Shipping_Method_Available $block
193
+ *
194
+ * @return Mage_Checkout_Block_Onepage_Shipping_Method_Available
195
+ */
196
+ protected function _addDeliveryOptionBlocks(Mage_Checkout_Block_Onepage_Shipping_Method_Available $block)
197
+ {
198
+ /**
199
+ * @var TIG_PostNL_Block_DeliveryOptions_Checkout_DeliveryOptions $firstChild
200
+ */
201
+ $firstChild = $block->getLayout()->createBlock(
202
+ 'postnl_deliveryoptions/checkout_deliveryOptions',
203
+ 'postnl.osc.delivery.options'
204
+ );
205
+ $firstChild->setTemplate('TIG/PostNL/delivery_options/onestepcheckout/deliveryoptions.phtml');
206
+
207
+ /**
208
+ * @var Mage_Core_Block_Template $secondChild
209
+ */
210
+ $secondChild = $block->getLayout()->createBlock(
211
+ 'core/template',
212
+ 'postnl.osc.add.location'
213
+ );
214
+ $secondChild->setTemplate('TIG/PostNL/delivery_options/addlocation.phtml');
215
+
216
+ /**
217
+ * @var TIG_PostNL_Block_DeliveryOptions_Checkout_AddPhoneNumber $thirdChild
218
+ */
219
+ $thirdChild = $block->getLayout()->createBlock(
220
+ 'postnl_deliveryoptions/checkout_addPhoneNumber',
221
+ 'postnl.add.phonenumber'
222
+ );
223
+ $thirdChild->setTemplate('TIG/PostNL/delivery_options/addphonenumber.phtml');
224
+
225
+ $secondChild->append($thirdChild);
226
+ $firstChild->append($secondChild);
227
+ $block->append($firstChild);
228
+
229
+ return $block;
230
+ }
231
  }
app/code/community/TIG/PostNL/Model/DeliveryOptions/Observer/UpdatePostnlOrder.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_DeliveryOptions_Observer_UpdatePostnlOrder
@@ -73,11 +73,16 @@ class TIG_PostNL_Model_DeliveryOptions_Observer_UpdatePostnlOrder
73
  * If this order is not being shipped to the Netherlands or was not placed using PostNL, remove any PakjeGemak
74
  * addresses that may have been saved and delete the PostNL order.
75
  */
76
- $shippingCountry = $order->getShippingAddress()->getCountryId();
77
- if ($shippingCountry != 'NL' || !Mage::helper('postnl/carrier')->isPostnlShippingMethod($shippingMethod)) {
 
 
 
78
  $this->_removePakjeGemakAddress($order);
79
 
80
- $postnlOrder->delete();
 
 
81
  return $this;
82
  }
83
 
@@ -106,7 +111,6 @@ class TIG_PostNL_Model_DeliveryOptions_Observer_UpdatePostnlOrder
106
  /**
107
  * Calculate the correct fee based on the order type.
108
  */
109
- $type = $postnlOrder->getType();
110
  if ($type == 'PGE') {
111
  $fee = Mage::helper('postnl/deliveryOptions')
112
  ->getExpressFee(false, $includingTax, false);
@@ -204,6 +208,73 @@ class TIG_PostNL_Model_DeliveryOptions_Observer_UpdatePostnlOrder
204
  return $this;
205
  }
206
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  /**
208
  * Deletes any PakjeGemak addresses associated with this order.
209
  *
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_DeliveryOptions_Observer_UpdatePostnlOrder
73
  * If this order is not being shipped to the Netherlands or was not placed using PostNL, remove any PakjeGemak
74
  * addresses that may have been saved and delete the PostNL order.
75
  */
76
+ $shippingAddress = $order->getShippingAddress();
77
+ if (!$shippingAddress
78
+ || $shippingAddress->getCountryId() != 'NL'
79
+ || !Mage::helper('postnl/carrier')->isPostnlShippingMethod($shippingMethod)
80
+ ) {
81
  $this->_removePakjeGemakAddress($order);
82
 
83
+ if ($postnlOrder && $postnlOrder->getId()) {
84
+ $postnlOrder->delete();
85
+ }
86
  return $this;
87
  }
88
 
111
  /**
112
  * Calculate the correct fee based on the order type.
113
  */
 
114
  if ($type == 'PGE') {
115
  $fee = Mage::helper('postnl/deliveryOptions')
116
  ->getExpressFee(false, $includingTax, false);
208
  return $this;
209
  }
210
 
211
+ /**
212
+ * @param Varien_Event_Observer $observer
213
+ *
214
+ * @return $this
215
+ *
216
+ * @event controller_action_postdispatch_checkout_onepage_saveShippingMethod
217
+ * |controller_action_predispatch_onestepcheckout_ajax_set_methods_separate
218
+ *
219
+ * @observer checkout_shipping_method_save_options
220
+ *
221
+ * @todo Move this functionality to the saveSelectedOption AJAX call instead.
222
+ */
223
+ public function saveOptions(Varien_Event_Observer $observer)
224
+ {
225
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
226
+
227
+ /**
228
+ * Get the PostNL order associated with this quote.
229
+ *
230
+ * @var TIG_PostNL_Model_Core_Order $postnlOrder
231
+ */
232
+ $postnlOrder = Mage::getModel('postnl_core/order')->load($quote->getId(), 'quote_id');
233
+ if (!$postnlOrder->getId()) {
234
+ $postnlOrder->setQuoteId($quote->getId());
235
+ }
236
+
237
+ /**
238
+ * Get all shipping methods that are considered to be PostNL.
239
+ */
240
+ $shippingMethod = $quote->getShippingAddress()->getShippingMethod();
241
+
242
+ /**
243
+ * If this order is not being shipped to the Netherlands or was not placed using PostNL, remove any options that
244
+ * may have been saved.
245
+ */
246
+ $shippingAddress = $quote->getShippingAddress();
247
+ if (!$shippingAddress
248
+ || $shippingAddress->getCountryId() != 'NL'
249
+ || !Mage::helper('postnl/carrier')->isPostnlShippingMethod($shippingMethod)
250
+ ) {
251
+ $postnlOrder->setOptions(false)
252
+ ->save();
253
+
254
+ return $this;
255
+ }
256
+
257
+ /**
258
+ * @var Mage_Core_Controller_Varien_Front $controller
259
+ */
260
+ $controller = $observer->getControllerAction();
261
+ $options = $controller->getRequest()->getParam('s_method_' . $shippingMethod, array());
262
+ if (empty($options['postnl'])) {
263
+ $options = $controller->getRequest()->getParam($shippingMethod, array());
264
+ }
265
+
266
+ $postnlOptions = false;
267
+ if (isset($options['postnl'])) {
268
+ $postnlOptions = $options['postnl'];
269
+ }
270
+
271
+ $postnlOrder->setOptions($postnlOptions)
272
+ ->validateOptions()
273
+ ->save();
274
+
275
+ return $this;
276
+ }
277
+
278
  /**
279
  * Deletes any PakjeGemak addresses associated with this order.
280
  *
app/code/community/TIG/PostNL/Model/DeliveryOptions/Product/Attribute/Source/ShippingDuration.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_DeliveryOptions_Product_Attribute_Source_ShippingDuration
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_DeliveryOptions_Product_Attribute_Source_ShippingDuration
app/code/community/TIG/PostNL/Model/DeliveryOptions/Service.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasQuote()
@@ -53,9 +53,10 @@ class TIG_PostNL_Model_DeliveryOptions_Service extends Varien_Object
53
  const ADDRESS_TYPE_PAKJEGEMAK = 'pakje_gemak';
54
 
55
  /**
56
- * Xpath for shipping duration setting.
57
  */
58
  const XPATH_SHIPPING_DURATION = 'postnl/cif_labels_and_confirming/shipping_duration';
 
59
 
60
  /**
61
  * Gets a PostNL Order. If none is set; load one.
@@ -123,9 +124,9 @@ class TIG_PostNL_Model_DeliveryOptions_Service extends Varien_Object
123
  /**
124
  * Calculate the confirm date for a specified delivery date.
125
  *
126
- * @param $deliveryDate
127
  *
128
- * @return string
129
  */
130
  public function getConfirmDate($deliveryDate)
131
  {
@@ -134,20 +135,69 @@ class TIG_PostNL_Model_DeliveryOptions_Service extends Varien_Object
134
  }
135
 
136
  $deliveryDate = new DateTime($deliveryDate);
137
- $deliveryDay = $deliveryDate->format('N');
138
 
139
- $shippingDuration = 1;
140
- if ($deliveryDay == 1 && !Mage::helper('postnl/deliveryOptions')->canUseSundaySorting()) {
141
- $shippingDuration++;
142
- }
143
-
144
- $confirmDate = $deliveryDate->sub(new DateInterval("P{$shippingDuration}D"));
145
  $confirmDate = $confirmDate->format('Y-m-d');
146
 
 
 
147
  $this->setConfirmDate($confirmDate);
148
  return $confirmDate;
149
  }
150
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  /**
152
  * @param float|int $costs
153
  *
@@ -199,7 +249,7 @@ class TIG_PostNL_Model_DeliveryOptions_Service extends Varien_Object
199
  {
200
  $quote = $this->getQuote();
201
 
202
- $confirmDate = $this->getConfirmDate($data['date']);
203
 
204
  /**
205
  * @var TIG_PostNL_Model_Core_Order $postnlOrder
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasQuote()
53
  const ADDRESS_TYPE_PAKJEGEMAK = 'pakje_gemak';
54
 
55
  /**
56
+ * Xpaths for shipping settings.
57
  */
58
  const XPATH_SHIPPING_DURATION = 'postnl/cif_labels_and_confirming/shipping_duration';
59
+ const XPATH_SHIPPING_DAYS = 'postnl/cif_labels_and_confirming/shipping_days';
60
 
61
  /**
62
  * Gets a PostNL Order. If none is set; load one.
124
  /**
125
  * Calculate the confirm date for a specified delivery date.
126
  *
127
+ * @param string $deliveryDate
128
  *
129
+ * @return DateTime
130
  */
131
  public function getConfirmDate($deliveryDate)
132
  {
135
  }
136
 
137
  $deliveryDate = new DateTime($deliveryDate);
 
138
 
139
+ $confirmDate = $deliveryDate->sub(new DateInterval("P1D"));
 
 
 
 
 
140
  $confirmDate = $confirmDate->format('Y-m-d');
141
 
142
+ $confirmDate = Mage::helper('postnl/deliveryOptions')->getValidConfirmDate($confirmDate);
143
+
144
  $this->setConfirmDate($confirmDate);
145
  return $confirmDate;
146
  }
147
 
148
+ /**
149
+ * @param StdClass[] $timeframes
150
+ *
151
+ * @return StdClass[]|false
152
+ */
153
+ public function filterTimeframes($timeframes)
154
+ {
155
+ /**
156
+ * If the time frames are not an array, something has gone wrong.
157
+ */
158
+ if (!is_array($timeframes)) {
159
+ return false;
160
+ }
161
+
162
+ /**
163
+ * Get the configured shipping days.
164
+ */
165
+ $shippingDays = Mage::getStoreConfig(self::XPATH_SHIPPING_DAYS, Mage::app()->getStore()->getId());
166
+ $shippingDays = explode(',', $shippingDays);
167
+
168
+ foreach ($timeframes as $key => $timeframe) {
169
+ /**
170
+ * Get the date of the time frame and calculate the shipping day. The shipping day will be the day before
171
+ * the delivery date, but may not be a sunday.
172
+ */
173
+ $timeframeDate = new DateTime($timeframe->Date);
174
+ $deliveryDay = (int) $timeframeDate->format('N');
175
+ $shippingDay = (int) $timeframeDate->sub(new DateInterval('P1D'))->format('N');
176
+
177
+ if ($shippingDay < 1 || $shippingDay > 6) {
178
+ $shippingDay = 6;
179
+ }
180
+
181
+ /**
182
+ * If the shipping day is not allowed, remove the time frame from the array.
183
+ *
184
+ * For tuesday delivery either saturday or monday needs to be available.
185
+ */
186
+ if ($deliveryDay === 2 && !in_array($shippingDay, $shippingDays)) {
187
+ $shippingDay = 6;
188
+ }
189
+
190
+ if (!in_array($shippingDay, $shippingDays)) {
191
+ unset($timeframes[$key]);
192
+ }
193
+ }
194
+
195
+ /**
196
+ * Only return the values, as otherwise the array will be JSON encoded as an object.
197
+ */
198
+ return array_values($timeframes);
199
+ }
200
+
201
  /**
202
  * @param float|int $costs
203
  *
249
  {
250
  $quote = $this->getQuote();
251
 
252
+ $confirmDate = $this->getConfirmDate($data['date'])->getTimestamp();
253
 
254
  /**
255
  * @var TIG_PostNL_Model_Core_Order $postnlOrder
app/code/community/TIG/PostNL/Model/DeliveryOptions/System/Config/Backend/ValidateFee.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasIsIncludingTax()
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method boolean hasIsIncludingTax()
app/code/community/TIG/PostNL/Model/DeliveryOptions/System/Config/Source/DeliveryDaysNumber.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_DeliveryOptions_System_Config_Source_DeliveryDaysNumber
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_DeliveryOptions_System_Config_Source_DeliveryDaysNumber
app/code/community/TIG/PostNL/Model/DeliveryOptions/System/Config/Source/Themes.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_DeliveryOptions_System_Config_Source_Themes extends Varien_Object
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_DeliveryOptions_System_Config_Source_Themes extends Varien_Object
app/code/community/TIG/PostNL/Model/ExtensionControl/Feed.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_ExtensionControl_Feed extends Mage_AdminNotification_Model_Feed
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_ExtensionControl_Feed extends Mage_AdminNotification_Model_Feed
app/code/community/TIG/PostNL/Model/ExtensionControl/Observer/Cron.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_ExtensionControl_Observer_Cron
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_ExtensionControl_Observer_Cron
app/code/community/TIG/PostNL/Model/ExtensionControl/Webservices.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * Primary webservices class. Contains all methods used to communicate with the extensioncontrol webservice.
@@ -41,7 +41,7 @@
41
  * @category TIG
42
  * @package TIG_PostNL
43
  * @subpackage TIG_PostNL_ExtensionControl
44
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
45
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
46
  * @version v1.2.0
47
  * @since v1.0.0
@@ -63,8 +63,8 @@ class TIG_PostNL_Model_ExtensionControl_Webservices extends TIG_PostNL_Model_Ext
63
  /**
64
  * XML paths for setting statistics
65
  */
66
- const XPATH_SUPPORTED_PRODUCT_OPTIONS = 'postnl/cif_product_options/supported_product_options';
67
- const XPATH_SPLIT_STREET = 'postnl/cif_address/split_street';
68
  const XPATH_CHECKOUT_ACTIVE = 'postnl/checkout/active';
69
  const XPATH_CHECKOUT_WEBSHOP_ID = 'postnl/cif/webshop_id';
70
  const XPATH_CONTACT_NAME = 'postnl/cif/contact_name';
@@ -76,14 +76,15 @@ class TIG_PostNL_Model_ExtensionControl_Webservices extends TIG_PostNL_Model_Ext
76
  const XPATH_ENABLE_PAKJEGEMAK = 'postnl/delivery_options/enable_pakjegemak';
77
  const XPATH_ENABLE_PAKKETAUTOMAAT_LOCATIONS = 'postnl/delivery_options/enable_pakketautomaat_locations';
78
  const XPATH_ENABLE_PAKJEGEMAK_EXPRESS = 'postnl/delivery_options/enable_pakjegemak_express';
79
- const XPATH_USE_BUSPAKJE = 'postnl/cif_labels_and_confirming/use_buspakje';
80
- const XPATH_BUSPAKJE_CALCULATION_MODE = 'postnl/cif_labels_and_confirming/buspakje_calculation_mode';
81
  const XPATH_COD_ACTIVE = 'payment/postnl_cod/active';
82
  const XPATH_MIJNPAKKET_LOGIN_ACTIVE = 'postnl/delivery_options/mijnpakket_login_active';
83
- const XPATH_USE_POSTCODE_CHECK = 'postnl/cif_address/use_postcode_check';
 
84
  const XPATH_PARCELWARE_EXPORT_ACTIVE = 'postnl/parcelware_export/active';
85
- const XPATH_SEND_TRACK_AND_TRACE_EMAIL = 'postnl/cif_labels_and_confirming/send_track_and_trace_email';
86
- const XPATH_TRACK_AND_TRACE_EMAIL_TEMPLATE = 'postnl/cif_labels_and_confirming/track_and_trace_email_template';
87
  const XPATH_SHOW_LABEL = 'postnl/packing_slip/show_label';
88
 
89
  /**
@@ -470,7 +471,7 @@ class TIG_PostNL_Model_ExtensionControl_Webservices extends TIG_PostNL_Model_Ext
470
  protected function _getShipmentCollection($website, $shipmentTypes = false)
471
  {
472
  /**
473
- * Get a list of all storeIds associated with this website
474
  *
475
  * @var Mage_Core_Model_Store_Group $group
476
  */
@@ -488,7 +489,7 @@ class TIG_PostNL_Model_ExtensionControl_Webservices extends TIG_PostNL_Model_Ext
488
  $resource = Mage::getSingleton('core/resource');
489
 
490
  /**
491
- * Get the shipment collection
492
  */
493
  $shipmentCollection = Mage::getResourceModel('sales/order_shipment_collection');
494
  $shipmentCollection->addFieldToSelect('entity_id');
@@ -496,7 +497,7 @@ class TIG_PostNL_Model_ExtensionControl_Webservices extends TIG_PostNL_Model_Ext
496
  $select = $shipmentCollection->getSelect();
497
 
498
  /**
499
- * Join sales_flat_order table
500
  */
501
  $select->joinInner(
502
  array('order' => $resource->getTableName('sales/order')),
@@ -506,15 +507,16 @@ class TIG_PostNL_Model_ExtensionControl_Webservices extends TIG_PostNL_Model_Ext
506
  )
507
  );
508
 
509
- if ($shipmentTypes) {
510
- $select->joinLeft(
511
- array('postnl_shipment' => $resource->getTableName('postnl_core/shipment')),
512
- '`main_table`.`entity_id`=`postnl_shipment`.`shipment_id`',
513
- array(
514
- 'shipment_type' => 'postnl_shipment.shipment_type',
515
- )
516
- );
517
- }
 
518
 
519
  $postnlShippingMethods = Mage::helper('postnl/carrier')->getPostnlShippingMethods();
520
  $postnlShippingMethodsRegex = '';
@@ -529,8 +531,18 @@ class TIG_PostNL_Model_ExtensionControl_Webservices extends TIG_PostNL_Model_Ext
529
  }
530
 
531
  $postnlShippingMethodsRegex .= '$';
532
- $shipmentCollection->addFieldToFilter('`order`.`shipping_method`', array('regexp' => $postnlShippingMethodsRegex))
533
- ->addFieldToFilter('`main_table`.`store_id`', array('in' => $storeIds));
 
 
 
 
 
 
 
 
 
 
534
 
535
  if ($shipmentTypes) {
536
  $shipmentCollection->addFieldToFilter('`shipment_type`', array('in', $shipmentTypes));
@@ -715,6 +727,11 @@ class TIG_PostNL_Model_ExtensionControl_Webservices extends TIG_PostNL_Model_Ext
715
  */
716
  protected function _getUseDeliveryOptions($website)
717
  {
 
 
 
 
 
718
  $useDeliveryoptions = (bool) $website->getConfig(self::XPATH_DELIVERY_OPTIONS_ACTIVE);
719
 
720
  return $useDeliveryoptions;
@@ -729,6 +746,10 @@ class TIG_PostNL_Model_ExtensionControl_Webservices extends TIG_PostNL_Model_Ext
729
  */
730
  protected function _getUseDeliveryDays($website)
731
  {
 
 
 
 
732
  $useDeliveryDays = (bool) $website->getConfig(self::XPATH_ENABLE_DELIVERY_DAYS);
733
 
734
  return $useDeliveryDays;
@@ -743,6 +764,10 @@ class TIG_PostNL_Model_ExtensionControl_Webservices extends TIG_PostNL_Model_Ext
743
  */
744
  protected function _getUseTimeframes($website)
745
  {
 
 
 
 
746
  $useTimeframes = (bool) $website->getConfig(self::XPATH_ENABLE_TIMEFRAMES);
747
 
748
  return $useTimeframes;
@@ -757,6 +782,10 @@ class TIG_PostNL_Model_ExtensionControl_Webservices extends TIG_PostNL_Model_Ext
757
  */
758
  protected function _getUseAvond($website)
759
  {
 
 
 
 
760
  $useAvond = (bool) $website->getConfig(self::XPATH_ENABLE_EVENING_TIMEFRAMES);
761
 
762
  return $useAvond;
@@ -771,6 +800,10 @@ class TIG_PostNL_Model_ExtensionControl_Webservices extends TIG_PostNL_Model_Ext
771
  */
772
  protected function _getUsePg($website)
773
  {
 
 
 
 
774
  $usePg = (bool) $website->getConfig(self::XPATH_ENABLE_PAKJEGEMAK);
775
 
776
  return $usePg;
@@ -785,6 +818,10 @@ class TIG_PostNL_Model_ExtensionControl_Webservices extends TIG_PostNL_Model_Ext
785
  */
786
  protected function _getUsePa($website)
787
  {
 
 
 
 
788
  $usePa = (bool) $website->getConfig(self::XPATH_ENABLE_PAKKETAUTOMAAT_LOCATIONS);
789
 
790
  return $usePa;
@@ -799,6 +836,10 @@ class TIG_PostNL_Model_ExtensionControl_Webservices extends TIG_PostNL_Model_Ext
799
  */
800
  protected function _getUsePge($website)
801
  {
 
 
 
 
802
  $usePge = (bool) $website->getConfig(self::XPATH_ENABLE_PAKJEGEMAK_EXPRESS);
803
 
804
  return $usePge;
@@ -846,6 +887,10 @@ class TIG_PostNL_Model_ExtensionControl_Webservices extends TIG_PostNL_Model_Ext
846
  */
847
  protected function _getUseMijnPakketLogin($website)
848
  {
 
 
 
 
849
  $useMijnPakketLogin = (bool) $website->getConfig(self::XPATH_MIJNPAKKET_LOGIN_ACTIVE);
850
 
851
  return $useMijnPakketLogin;
@@ -860,11 +905,30 @@ class TIG_PostNL_Model_ExtensionControl_Webservices extends TIG_PostNL_Model_Ext
860
  */
861
  protected function _getUsePostcodeCheck($website)
862
  {
 
 
 
 
 
863
  $usePostcodeCheck = (bool) $website->getConfig(self::XPATH_USE_POSTCODE_CHECK);
864
 
865
  return $usePostcodeCheck;
866
  }
867
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
868
  /**
869
  * Gets whether parcelware export is active.
870
  *
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * Primary webservices class. Contains all methods used to communicate with the extensioncontrol webservice.
41
  * @category TIG
42
  * @package TIG_PostNL
43
  * @subpackage TIG_PostNL_ExtensionControl
44
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
45
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
46
  * @version v1.2.0
47
  * @since v1.0.0
63
  /**
64
  * XML paths for setting statistics
65
  */
66
+ const XPATH_SUPPORTED_PRODUCT_OPTIONS = 'postnl/grid/supported_product_options';
67
+ const XPATH_SPLIT_STREET = 'postnl/cif_labels_and_confirming/split_street';
68
  const XPATH_CHECKOUT_ACTIVE = 'postnl/checkout/active';
69
  const XPATH_CHECKOUT_WEBSHOP_ID = 'postnl/cif/webshop_id';
70
  const XPATH_CONTACT_NAME = 'postnl/cif/contact_name';
76
  const XPATH_ENABLE_PAKJEGEMAK = 'postnl/delivery_options/enable_pakjegemak';
77
  const XPATH_ENABLE_PAKKETAUTOMAAT_LOCATIONS = 'postnl/delivery_options/enable_pakketautomaat_locations';
78
  const XPATH_ENABLE_PAKJEGEMAK_EXPRESS = 'postnl/delivery_options/enable_pakjegemak_express';
79
+ const XPATH_USE_BUSPAKJE = 'postnl/delivery_options/use_buspakje';
80
+ const XPATH_BUSPAKJE_CALCULATION_MODE = 'postnl/delivery_options/buspakje_calculation_mode';
81
  const XPATH_COD_ACTIVE = 'payment/postnl_cod/active';
82
  const XPATH_MIJNPAKKET_LOGIN_ACTIVE = 'postnl/delivery_options/mijnpakket_login_active';
83
+ const XPATH_USE_POSTCODE_CHECK = 'postnl/cif_labels_and_confirming/use_postcode_check';
84
+ const XPATH_CHECKOUT_EXTENSION = 'postnl/cif_address/checkout_extension';
85
  const XPATH_PARCELWARE_EXPORT_ACTIVE = 'postnl/parcelware_export/active';
86
+ const XPATH_SEND_TRACK_AND_TRACE_EMAIL = 'postnl/track_and_trace/send_track_and_trace_email';
87
+ const XPATH_TRACK_AND_TRACE_EMAIL_TEMPLATE = 'postnl/track_and_trace/track_and_trace_email_template';
88
  const XPATH_SHOW_LABEL = 'postnl/packing_slip/show_label';
89
 
90
  /**
471
  protected function _getShipmentCollection($website, $shipmentTypes = false)
472
  {
473
  /**
474
+ * Get a list of all storeIds associated with this website.
475
  *
476
  * @var Mage_Core_Model_Store_Group $group
477
  */
489
  $resource = Mage::getSingleton('core/resource');
490
 
491
  /**
492
+ * Get the shipment collection.
493
  */
494
  $shipmentCollection = Mage::getResourceModel('sales/order_shipment_collection');
495
  $shipmentCollection->addFieldToSelect('entity_id');
497
  $select = $shipmentCollection->getSelect();
498
 
499
  /**
500
+ * Join sales_flat_order table.
501
  */
502
  $select->joinInner(
503
  array('order' => $resource->getTableName('sales/order')),
507
  )
508
  );
509
 
510
+ /**
511
+ * Join the tig_postnl_shipment table.
512
+ */
513
+ $select->joinInner(
514
+ array('postnl_shipment' => $resource->getTableName('postnl_core/shipment')),
515
+ '`main_table`.`entity_id`=`postnl_shipment`.`shipment_id`',
516
+ array(
517
+ 'shipment_type' => 'postnl_shipment.shipment_type',
518
+ )
519
+ );
520
 
521
  $postnlShippingMethods = Mage::helper('postnl/carrier')->getPostnlShippingMethods();
522
  $postnlShippingMethodsRegex = '';
531
  }
532
 
533
  $postnlShippingMethodsRegex .= '$';
534
+ $shipmentCollection->addFieldToFilter(
535
+ '`order`.`shipping_method`',
536
+ array(
537
+ 'regexp' => $postnlShippingMethodsRegex
538
+ )
539
+ )
540
+ ->addFieldToFilter(
541
+ '`main_table`.`store_id`',
542
+ array(
543
+ 'in' => $storeIds
544
+ )
545
+ );
546
 
547
  if ($shipmentTypes) {
548
  $shipmentCollection->addFieldToFilter('`shipment_type`', array('in', $shipmentTypes));
727
  */
728
  protected function _getUseDeliveryOptions($website)
729
  {
730
+ $checkoutExtension = $this->_getCheckoutExtension($website);
731
+ if (!$checkoutExtension || $checkoutExtension == 'other') {
732
+ return false;
733
+ }
734
+
735
  $useDeliveryoptions = (bool) $website->getConfig(self::XPATH_DELIVERY_OPTIONS_ACTIVE);
736
 
737
  return $useDeliveryoptions;
746
  */
747
  protected function _getUseDeliveryDays($website)
748
  {
749
+ if (!$this->_getUseDeliveryOptions($website)) {
750
+ return false;
751
+ }
752
+
753
  $useDeliveryDays = (bool) $website->getConfig(self::XPATH_ENABLE_DELIVERY_DAYS);
754
 
755
  return $useDeliveryDays;
764
  */
765
  protected function _getUseTimeframes($website)
766
  {
767
+ if (!$this->_getUseDeliveryOptions($website)) {
768
+ return false;
769
+ }
770
+
771
  $useTimeframes = (bool) $website->getConfig(self::XPATH_ENABLE_TIMEFRAMES);
772
 
773
  return $useTimeframes;
782
  */
783
  protected function _getUseAvond($website)
784
  {
785
+ if (!$this->_getUseDeliveryOptions($website)) {
786
+ return false;
787
+ }
788
+
789
  $useAvond = (bool) $website->getConfig(self::XPATH_ENABLE_EVENING_TIMEFRAMES);
790
 
791
  return $useAvond;
800
  */
801
  protected function _getUsePg($website)
802
  {
803
+ if (!$this->_getUseDeliveryOptions($website)) {
804
+ return false;
805
+ }
806
+
807
  $usePg = (bool) $website->getConfig(self::XPATH_ENABLE_PAKJEGEMAK);
808
 
809
  return $usePg;
818
  */
819
  protected function _getUsePa($website)
820
  {
821
+ if (!$this->_getUseDeliveryOptions($website)) {
822
+ return false;
823
+ }
824
+
825
  $usePa = (bool) $website->getConfig(self::XPATH_ENABLE_PAKKETAUTOMAAT_LOCATIONS);
826
 
827
  return $usePa;
836
  */
837
  protected function _getUsePge($website)
838
  {
839
+ if (!$this->_getUseDeliveryOptions($website)) {
840
+ return false;
841
+ }
842
+
843
  $usePge = (bool) $website->getConfig(self::XPATH_ENABLE_PAKJEGEMAK_EXPRESS);
844
 
845
  return $usePge;
887
  */
888
  protected function _getUseMijnPakketLogin($website)
889
  {
890
+ if (!$this->_getUseDeliveryOptions($website)) {
891
+ return false;
892
+ }
893
+
894
  $useMijnPakketLogin = (bool) $website->getConfig(self::XPATH_MIJNPAKKET_LOGIN_ACTIVE);
895
 
896
  return $useMijnPakketLogin;
905
  */
906
  protected function _getUsePostcodeCheck($website)
907
  {
908
+ $checkoutExtension = $this->_getCheckoutExtension($website);
909
+ if (!$checkoutExtension || $checkoutExtension == 'other') {
910
+ return false;
911
+ }
912
+
913
  $usePostcodeCheck = (bool) $website->getConfig(self::XPATH_USE_POSTCODE_CHECK);
914
 
915
  return $usePostcodeCheck;
916
  }
917
 
918
+ /**
919
+ * Get the currently used checkout extension for this website.
920
+ *
921
+ * @param Mage_Core_Model_Website $website
922
+ *
923
+ * @return mixed
924
+ */
925
+ protected function _getCheckoutExtension($website)
926
+ {
927
+ $checkoutExtension = $website->getConfig(self::XPATH_CHECKOUT_EXTENSION);
928
+
929
+ return $checkoutExtension;
930
+ }
931
+
932
  /**
933
  * Gets whether parcelware export is active.
934
  *
app/code/community/TIG/PostNL/Model/ExtensionControl/Webservices/Abstract.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  abstract class TIG_PostNL_Model_ExtensionControl_Webservices_Abstract extends Varien_Object
@@ -41,7 +41,7 @@ abstract class TIG_PostNL_Model_ExtensionControl_Webservices_Abstract extends Va
41
  /**
42
  * Wsdl location
43
  */
44
- const WEBSERVICE_WSDL_URL = 'http://api.tigpostnl.nl/soap?wsdl';
45
 
46
  /**
47
  * Check if the required PHP extensions are installed.
@@ -94,7 +94,7 @@ abstract class TIG_PostNL_Model_ExtensionControl_Webservices_Abstract extends Va
94
  public function call($method, $soapParams)
95
  {
96
  try {
97
- $wsdl = self::WEBSERVICE_WSDL_URL;
98
 
99
  /**
100
  * Array of soap options used when connecting to CIF
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  abstract class TIG_PostNL_Model_ExtensionControl_Webservices_Abstract extends Varien_Object
41
  /**
42
  * Wsdl location
43
  */
44
+ const WEBSERVICE_WSDL_URL_XPATH = 'postnl/general/webservice_wsdl_url';
45
 
46
  /**
47
  * Check if the required PHP extensions are installed.
94
  public function call($method, $soapParams)
95
  {
96
  try {
97
+ $wsdl = Mage::getStoreConfig(self::WEBSERVICE_WSDL_URL_XPATH, Mage_Core_Model_App::ADMIN_STORE_ID);
98
 
99
  /**
100
  * Array of soap options used when connecting to CIF
app/code/community/TIG/PostNL/Model/Inbox.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @deprecated 1.3.0 This class has been moved to TIG_PostNL_Model_Admin_Inbox. A dummy class has been left behind to
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @deprecated 1.3.0 This class has been moved to TIG_PostNL_Model_Admin_Inbox. A dummy class has been left behind to
app/code/community/TIG/PostNL/Model/Mijnpakket/Cif.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Mijnpakket_Cif extends TIG_PostNL_Model_Checkout_Cif
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Mijnpakket_Cif extends TIG_PostNL_Model_Checkout_Cif
app/code/community/TIG/PostNL/Model/Mijnpakket/Service.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Mijnpakket_Service extends Varien_Object
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Mijnpakket_Service extends Varien_Object
app/code/community/TIG/PostNL/Model/Parcelware/Export.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method TIG_PostNL_Model_Parcelware_Export setIsGlobal(boolean $value)
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method TIG_PostNL_Model_Parcelware_Export setIsGlobal(boolean $value)
app/code/community/TIG/PostNL/Model/Payment/Cod.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Payment_Cod extends Mage_Payment_Model_Method_Abstract
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Payment_Cod extends Mage_Payment_Model_Method_Abstract
app/code/community/TIG/PostNL/Model/Payment/Observer/Cod.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Payment_Observer_Cod
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Payment_Observer_Cod
app/code/community/TIG/PostNL/Model/Payment/Order/Creditmemo/Total/CodFee.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Payment_Order_Creditmemo_Total_CodFee
@@ -78,7 +78,7 @@ class TIG_PostNL_Model_Payment_Order_Creditmemo_Total_CodFee
78
  /**
79
  * This is unfortunately the only way to determine the fee amount that needs to be refunded without
80
  * rewriting a core class. If anybody knows of a better way, please let us know at
81
- * servicedesk@totalinternetgroup.nl.
82
  */
83
  $creditmemoParameters = Mage::app()->getRequest()
84
  ->getParam('creditmemo', array());
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Payment_Order_Creditmemo_Total_CodFee
78
  /**
79
  * This is unfortunately the only way to determine the fee amount that needs to be refunded without
80
  * rewriting a core class. If anybody knows of a better way, please let us know at
81
+ * servicedesk@tig.nl.
82
  */
83
  $creditmemoParameters = Mage::app()->getRequest()
84
  ->getParam('creditmemo', array());
app/code/community/TIG/PostNL/Model/Payment/Order/Creditmemo/Total/CodFee/Abstract.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  abstract class TIG_PostNL_Model_Payment_Order_Creditmemo_Total_CodFee_Abstract
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  abstract class TIG_PostNL_Model_Payment_Order_Creditmemo_Total_CodFee_Abstract
app/code/community/TIG/PostNL/Model/Payment/Order/Creditmemo/Total/CodFeeTax.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Payment_Order_Creditmemo_Total_CodFeeTax
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Payment_Order_Creditmemo_Total_CodFeeTax
app/code/community/TIG/PostNL/Model/Payment/Order/Invoice/Total/CodFee.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Payment_Order_Invoice_Total_CodFee extends Mage_Sales_Model_Order_Invoice_Total_Abstract
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Payment_Order_Invoice_Total_CodFee extends Mage_Sales_Model_Order_Invoice_Total_Abstract
app/code/community/TIG/PostNL/Model/Payment/Order/Invoice/Total/CodFeeTax.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Payment_Order_Invoice_Total_CodFeeTax extends Mage_Sales_Model_Order_Invoice_Total_Abstract
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Payment_Order_Invoice_Total_CodFeeTax extends Mage_Sales_Model_Order_Invoice_Total_Abstract
app/code/community/TIG/PostNL/Model/Payment/Order/Invoice/Total/Subtotal.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Payment_Order_Invoice_Total_Subtotal extends Mage_Sales_Model_Order_Invoice_Total_Subtotal
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Payment_Order_Invoice_Total_Subtotal extends Mage_Sales_Model_Order_Invoice_Total_Subtotal
app/code/community/TIG/PostNL/Model/Payment/Order/Pdf/Total/CodFee.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method int|string getFontSize()
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method int|string getFontSize()
app/code/community/TIG/PostNL/Model/Payment/Order/Pdf/Total/Grandtotal.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method Mage_Sales_Model_Order getOrder()
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method Mage_Sales_Model_Order getOrder()
app/code/community/TIG/PostNL/Model/Payment/Order/Pdf/Total/Tax.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method Mage_Sales_Model_Order getOrder()
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @method Mage_Sales_Model_Order getOrder()
app/code/community/TIG/PostNL/Model/Payment/Quote/Address/Total/CodFee.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Payment_Quote_Address_Total_CodFee
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Payment_Quote_Address_Total_CodFee
app/code/community/TIG/PostNL/Model/Payment/Quote/Address/Total/CodFee/Abstract.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  abstract class TIG_PostNL_Model_Payment_Quote_Address_Total_CodFee_Abstract extends Mage_Tax_Model_Sales_Total_Quote_Tax
@@ -226,4 +226,17 @@ abstract class TIG_PostNL_Model_Payment_Quote_Address_Total_CodFee_Abstract exte
226
 
227
  return $baseFeeTax;
228
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
229
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  abstract class TIG_PostNL_Model_Payment_Quote_Address_Total_CodFee_Abstract extends Mage_Tax_Model_Sales_Total_Quote_Tax
226
 
227
  return $baseFeeTax;
228
  }
229
+
230
+ /**
231
+ * Process model configuration array.
232
+ * This method can be used for changing models apply sort order
233
+ *
234
+ * @param array $config
235
+ * @param store $store
236
+ * @return array
237
+ */
238
+ public function processConfigArray($config, $store)
239
+ {
240
+ return $config;
241
+ }
242
  }
app/code/community/TIG/PostNL/Model/Payment/Quote/Address/Total/CodFeeTax.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Payment_Quote_Address_Total_CodFeeTax
@@ -83,7 +83,7 @@ class TIG_PostNL_Model_Payment_Quote_Address_Total_CodFeeTax
83
  return $this;
84
  }
85
 
86
- if (!$address->getPostnlCodFee() || !$address->getBasePostnlCodFee()) {
87
  return $this;
88
  }
89
 
@@ -142,8 +142,8 @@ class TIG_PostNL_Model_Payment_Quote_Address_Total_CodFeeTax
142
  ->setPostnlCodFeeTax($feeTax)
143
  ->setBasePostnlCodFeeTax($baseFeeTax);
144
 
145
- $address->addTotalAmount('nominal_tax', $feeTax);
146
- $address->addBaseTotalAmount('nominal_tax', $baseFeeTax);
147
 
148
  $quote->setPostnlCodFeeTax($feeTax)
149
  ->setBasePostnlCodFeeTax($baseFeeTax);
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Payment_Quote_Address_Total_CodFeeTax
83
  return $this;
84
  }
85
 
86
+ if ($address->getPostnlCodFee() < 0.0001 || $address->getBasePostnlCodFee() < 0.0001) {
87
  return $this;
88
  }
89
 
142
  ->setPostnlCodFeeTax($feeTax)
143
  ->setBasePostnlCodFeeTax($baseFeeTax);
144
 
145
+ $address->addTotalAmount('postnl_cod_fee_tax', $feeTax);
146
+ $address->addBaseTotalAmount('postnl_cod_fee_tax', $baseFeeTax);
147
 
148
  $quote->setPostnlCodFeeTax($feeTax)
149
  ->setBasePostnlCodFeeTax($baseFeeTax);
app/code/community/TIG/PostNL/Model/Payment/Service.php ADDED
@@ -0,0 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ class TIG_PostNL_Model_Payment_Service
40
+ {
41
+ /**
42
+ * Xpath to PostNL COD fee tax class.
43
+ */
44
+ const XPATH_COD_FEE_TAX_CLASS = 'tax/classes/postnl_cod_fee';
45
+
46
+ /**
47
+ * Add PostNL COD fee tax info to the full tax info array.
48
+ *
49
+ * This is a really annoying hack to fix the problem where the full tax info does not include the custom PostNL COD
50
+ * fee tax info. Magento only supports tax info from shipping tax or product tax by default
51
+ * (see Mage_Tax_Helper_Data::getCalculatedTaxes()). If anybody knows of a better way to fix this (that does not
52
+ * require a core rewrite) please let us know at servicedesk@tig.nl.
53
+ *
54
+ * @param array $fullInfo
55
+ * @param Mage_Sales_Model_Order|Mage_Sales_Model_Order_Invoice|Mage_Sales_Model_Order_Creditmemo $source
56
+ * @param Mage_Sales_Model_Order $order
57
+ *
58
+ * @return array
59
+ *
60
+ * @see Mage_Tax_Helper_Data::getCalculatedTaxes()
61
+ */
62
+ public function addPostnlCodFeeTaxInfo($fullInfo, $source, Mage_Sales_Model_Order $order)
63
+ {
64
+ $feeTax = (float) $order->getPostnlCodFeeTax();
65
+ if ($feeTax <= 0) {
66
+ return $fullInfo;
67
+ }
68
+
69
+ /**
70
+ * There are 3 possible ways to add the COD fee tax info:
71
+ * - Go through all tax info records of an order and add the COD fee info to the record with the same title and
72
+ * a discrepancy in the recorded and expected amount.
73
+ * - Add a missing tax info record.
74
+ * - Recalculate the tax info for the COD fee and update the amount of the tax record with the same title.
75
+ */
76
+ $orderClassName = Mage::getConfig()->getModelClassName('sales/order');
77
+ if ($source instanceof $orderClassName) {
78
+ $fullInfo = $this->_updateTaxAmountForTaxInfo($order, $fullInfo);
79
+ } else {
80
+ /**
81
+ * Try to find a tax record that does not have a corresponding tax item record.
82
+ */
83
+ $taxItemCollection = Mage::getResourceModel('tax/sales_order_tax_item_collection');
84
+ $taxItemCollection->addFieldToSelect('tax_id');
85
+ $taxItemCollection->getSelect()->distinct();
86
+
87
+ $taxItemIds = $taxItemCollection->getColumnValues('tax_id');
88
+
89
+ $taxCollection = Mage::getResourceModel('sales/order_tax_collection')
90
+ ->addFieldToFilter('order_id', array('eq' => $order->getId()))
91
+ ->addFieldToFilter('tax_id', array('nin' => $taxItemIds));
92
+
93
+ /**
94
+ * If we have found a missing record, we need to add it with the COD fee tax info. Otherwise we need to
95
+ * recreate the entire tax request for the COD fee tax so we can match the title to an existing tax item
96
+ * record.
97
+ */
98
+ if ($taxCollection->getSize()) {
99
+ $fullInfo = $this->_addPostnlCodFeeTaxInfoFromCollection($taxCollection, $fullInfo, $source);
100
+ } else {
101
+ $fullInfo = $this->_addPostnlCodFeeTaxInfoFromRequest($order, $fullInfo, $source);
102
+ }
103
+ }
104
+
105
+ return $fullInfo;
106
+ }
107
+
108
+ /**
109
+ * Add PostNL COD fee tax info by updating an incorrect tax record.
110
+ *
111
+ * @param Mage_Sales_Model_Order $order
112
+ * @param array $fullInfo
113
+ *
114
+ * @return array
115
+ */
116
+ protected function _updateTaxAmountForTaxInfo($order, $fullInfo)
117
+ {
118
+ $taxCollection = Mage::getResourceModel('sales/order_tax_collection')
119
+ ->addFieldToSelect('amount')
120
+ ->addFieldToFilter('order_id', array('eq' => $order->getId()));
121
+
122
+ /**
123
+ * Go through each tax record and update the tax info entry that has the same title, but a different amount.
124
+ */
125
+ foreach ($taxCollection as $tax) {
126
+ foreach ($fullInfo as $key => $taxInfo) {
127
+ if ($tax->getTitle() == $taxInfo['title'] && $tax->getAmount() != $taxInfo['tax_amount']) {
128
+ /**
129
+ * Update the amounts.
130
+ */
131
+ $fullInfo[$key]['tax_amount'] = $tax->getAmount();
132
+ $fullInfo[$key]['base_tax_amount'] = $tax->getBaseAmount();
133
+ }
134
+ }
135
+ }
136
+
137
+ return $fullInfo;
138
+ }
139
+
140
+ /**
141
+ * Add PostNL COD fee tax info by updating or adding a missing tax record.
142
+ *
143
+ * @param Mage_Sales_Model_Resource_Order_Tax_Collection $taxCollection
144
+ * @param array $fullInfo
145
+ * @param Mage_Sales_Model_Order_Invoice|Mage_Sales_Model_Order_Creditmemo $source
146
+ *
147
+ * @return array
148
+ */
149
+ protected function _addPostnlCodFeeTaxInfoFromCollection($taxCollection, $fullInfo, $source)
150
+ {
151
+ /**
152
+ * Go through all tax records and add the COD fee tax to the entry that has the right title. If no entry exists
153
+ * with that title, add it.
154
+ */
155
+ foreach ($taxCollection as $tax) {
156
+ foreach ($fullInfo as $key => $taxInfo) {
157
+ /**
158
+ * Update an existing entry.
159
+ */
160
+ if ($taxInfo['title'] == $tax->getTitle()) {
161
+ $fullInfo[$key]['tax_amount'] += $source->getPostnlCodFeeTax();
162
+ $fullInfo[$key]['base_tax_amount'] += $source->getBasePostnlCodFeeTax();
163
+
164
+ break(2);
165
+ }
166
+ }
167
+
168
+ /**
169
+ * Add a missing entry.
170
+ */
171
+ $fullInfo[] = array(
172
+ 'tax_amount' => $source->getPostnlCodFeeTax(),
173
+ 'base_tax_amount' => $source->getBasePostnlCodFeeTax(),
174
+ 'title' => $tax->getTitle(),
175
+ 'percent' => $tax->getPercent(),
176
+ );
177
+ }
178
+
179
+ return $fullInfo;
180
+ }
181
+
182
+ /**
183
+ * Add PostNL COD fee tax info by recreating the tax request.
184
+ *
185
+ * @param Mage_Sales_Model_Order $order
186
+ * @param array $fullInfo
187
+ * @param Mage_Sales_Model_Order_Invoice|Mage_Sales_Model_Order_Creditmemo $source
188
+ *
189
+ * @return array
190
+ */
191
+ protected function _addPostnlCodFeeTaxInfoFromRequest($order, $fullInfo, $source)
192
+ {
193
+ $store = $order->getStore();
194
+ $taxCalculation = Mage::getSingleton('tax/calculation');
195
+
196
+ /**
197
+ * Recalculate the tax request.
198
+ */
199
+ $customerTaxClass = $order->getCustomerTaxClassId();
200
+ $shippingAddress = $order->getShippingAddress();
201
+ $billingAddress = $order->getBillingAddress();
202
+ $codTaxClass = Mage::getStoreConfig(self::XPATH_COD_FEE_TAX_CLASS, $store);
203
+
204
+ $taxRequest = $taxCalculation->getRateRequest(
205
+ $shippingAddress,
206
+ $billingAddress,
207
+ $customerTaxClass,
208
+ $store
209
+ );
210
+
211
+ $taxRequest->setProductClassId($codTaxClass);
212
+
213
+ /**
214
+ * If the tax request fails, there is nothing more we can do. This might occur, if the tax rules have been
215
+ * changed since this order was placed. Unfortunately there is nothing we can do about this.
216
+ */
217
+ if (!$taxRequest) {
218
+ return $fullInfo;
219
+ }
220
+
221
+ /**
222
+ * Get the applied rates.
223
+ */
224
+ $appliedRates = Mage::getSingleton('tax/calculation')
225
+ ->getAppliedRates($taxRequest);
226
+
227
+ if (!isset($appliedRates[0]['rates'][0]['title'])) {
228
+ return $fullInfo;
229
+ }
230
+
231
+ /**
232
+ * Get the tax title from the applied rates.
233
+ */
234
+ $postnlCodFeeTaxTitle = $appliedRates[0]['rates'][0]['title'];
235
+
236
+ /**
237
+ * Fo through all tax info entries and try to match the title.
238
+ */
239
+ foreach ($fullInfo as $key => $taxInfo) {
240
+ if ($taxInfo['title'] == $postnlCodFeeTaxTitle) {
241
+ /**
242
+ * Update the tax info entry with the COD fee tax.
243
+ */
244
+ $fullInfo[$key]['tax_amount'] += $source->getPostnlCodFeeTax();
245
+ $fullInfo[$key]['base_tax_amount'] += $source->getBasePostnlCodFeeTax();
246
+ break;
247
+ }
248
+ }
249
+
250
+ return $fullInfo;
251
+ }
252
+ }
app/code/community/TIG/PostNL/Model/Payment/System/Config/Source/CodFeeTaxClass.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Payment_System_Config_Source_CodFeeTaxClass
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Payment_System_Config_Source_CodFeeTaxClass
app/code/community/TIG/PostNL/Model/Resource/Catalog/Product.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Resource_Catalog_Product extends Mage_Catalog_Model_Resource_Product
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Resource_Catalog_Product extends Mage_Catalog_Model_Resource_Product
app/code/community/TIG/PostNL/Model/Resource/Db/Abstract.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  abstract class TIG_PostNL_Model_Resource_Db_Abstract extends Mage_Core_Model_Resource_Db_Abstract
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  abstract class TIG_PostNL_Model_Resource_Db_Abstract extends Mage_Core_Model_Resource_Db_Abstract
app/code/community/TIG/PostNL/Model/Resource/Db/Collection/Postnl.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Resource_Db_Collection_Postnl extends Mage_Core_Model_Resource_Db_Collection_Abstract
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Resource_Db_Collection_Postnl extends Mage_Core_Model_Resource_Db_Collection_Abstract
app/code/community/TIG/PostNL/Model/Resource/Order/Grid/Collection.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Resource_Order_Grid_Collection extends Mage_Sales_Model_Resource_Order_Grid_Collection
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Resource_Order_Grid_Collection extends Mage_Sales_Model_Resource_Order_Grid_Collection
app/code/community/TIG/PostNL/Model/Resource/Order/Shipment/Grid/Collection.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Resource_Order_Shipment_Grid_Collection extends Mage_Sales_Model_Resource_Order_Shipment_Grid_Collection
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Resource_Order_Shipment_Grid_Collection extends Mage_Sales_Model_Resource_Order_Shipment_Grid_Collection
app/code/community/TIG/PostNL/Model/Resource/Setup.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Resource_Setup extends Mage_Catalog_Model_Resource_Setup
@@ -50,6 +50,12 @@ class TIG_PostNL_Model_Resource_Setup extends Mage_Catalog_Model_Resource_Setup
50
  const UPDATE_STATISTICS_CRON_STRING_PATH = 'crontab/jobs/postnl_update_statistics/schedule/cron_expr';
51
  const UPDATE_STATISTICS_CRON_MODEL_PATH = 'crontab/jobs/postnl_update_statistics/run/model';
52
 
 
 
 
 
 
 
53
  /**
54
  * XML path to the support tab_expanded setting
55
  */
@@ -70,18 +76,34 @@ class TIG_PostNL_Model_Resource_Setup extends Mage_Catalog_Model_Resource_Setup
70
  /**
71
  * Xpath to supported options configuration setting
72
  */
73
- const XPATH_SUPPORTED_PRODUCT_OPTIONS = 'postnl/cif_product_options/supported_product_options';
74
 
75
  /**
76
  * Xpath to the item columns setting.
77
  */
78
  const XPATH_PACKING_SLIP_ITEM_COLUMNS = 'postnl/packing_slip/item_columns';
79
 
 
 
 
 
 
80
  /**
81
  * Minimum server memory required by the PostNL extension in bytes.
82
  */
83
  const MIN_SERVER_MEMORY = 268435456; //256MB
84
 
 
 
 
 
 
 
 
 
 
 
 
85
  /**
86
  * callAfterApplyAllUpdates flag. Causes applyAfterUpdates() to be called.
87
  *
@@ -221,24 +243,25 @@ class TIG_PostNL_Model_Resource_Setup extends Mage_Catalog_Model_Resource_Setup
221
 
222
  $inbox = Mage::getModel('postnl_admin/inbox');
223
  if ($dbVer) {
224
- $title = '[POSTNL-0083] ' . $helper->__(
225
- 'PostNL extension has been successfully updated to version v%s.',
226
- $configVer
227
- );
228
 
229
- $url = 'http://kb.totalinternetgroup.nl/topic/31921907';
230
  } else {
231
- $title = '[POSTNL-0156] ' . $helper->__(
232
- 'The PostNL extension v%s has been successfully installed.',
233
- $configVer
234
- );
235
- $url = '';
 
236
  }
237
 
238
  $message = $helper->__(
239
  'You can read the full changelog in the <a href="%s" target="_blank" title="TIG knowledgebase">TIG ' .
240
  'knowledgebase</a>.',
241
- 'http://kb.totalinternetgroup.nl/topic/38584893/'
242
  );
243
 
244
  $inbox->addNotice($title, $message, $url, true)
@@ -259,17 +282,17 @@ class TIG_PostNL_Model_Resource_Setup extends Mage_Catalog_Model_Resource_Setup
259
  /**
260
  * Generate semi-random values for the cron expression.
261
  */
262
- $cronMorningHour = mt_rand(10, 12);
263
- $cronMorningHour += Mage::getModel('core/date')->getGmtOffset('hours');
264
 
 
 
265
  $cronAfternoonHour = $cronMorningHour + 4; //4 hours after the morning update
266
- $cronMinute = mt_rand(0, 59);
267
 
268
  /**
269
- * Generate a cron expr that runs on a specified minute on a specified hour between 10 and 12 AM, and between 14
270
- * and 16 PM.
271
  */
272
- $cronExpr = "{$cronMinute} {$cronMorningHour},{$cronAfternoonHour} * * *";
273
 
274
  /**
275
  * Store the cron expression in core_config_data.
@@ -288,7 +311,7 @@ class TIG_PostNL_Model_Resource_Setup extends Mage_Catalog_Model_Resource_Setup
288
  } catch (Exception $e) {
289
  throw new TIG_PostNL_Exception(
290
  Mage::helper('postnl')->__('Unable to save shipping_status cron expression: %s', $cronExpr),
291
- 'POSTNL-0084',
292
  $e
293
  );
294
  }
@@ -335,7 +358,7 @@ class TIG_PostNL_Model_Resource_Setup extends Mage_Catalog_Model_Resource_Setup
335
  } catch (Exception $e) {
336
  throw new TIG_PostNL_Exception(
337
  Mage::helper('postnl')->__('Unable to save update_statistics cron expression: %s', $cronExpr),
338
- 'POSTNL-0085',
339
  $e
340
  );
341
  }
@@ -364,21 +387,7 @@ class TIG_PostNL_Model_Resource_Setup extends Mage_Catalog_Model_Resource_Setup
364
 
365
  $supportedVersions = Mage::getConfig()->getNode('tig/compatibility/postnl/' . $edition);
366
  if ($supportedVersions === false) {
367
- $title = '[POSTNL-0086] '
368
- . $helper->__('The PostNL extension is not compatible with your Magento version!');
369
-
370
- $message = $helper->__(
371
- 'This may cause unexpected behaviour. You may use the PostNL extension on unsupported versions of ' .
372
- 'Magento at your own risk.'
373
- );
374
-
375
- $inbox = Mage::getModel('postnl_admin/inbox');
376
- $inbox->addCritical(
377
- $title,
378
- $message,
379
- 'http://kb.totalinternetgroup.nl/topic/31925577',
380
- true
381
- )->save();
382
 
383
  Mage::register('postnl_version_compatibility_checked', true);
384
  return $this;
@@ -391,31 +400,48 @@ class TIG_PostNL_Model_Resource_Setup extends Mage_Catalog_Model_Resource_Setup
391
  $installedMagentoVersion = $installedMagentoVersionInfo['major'] . '.' . $installedMagentoVersionInfo['minor'];
392
 
393
  if (!in_array($installedMagentoVersion, $supportedVersionArray)) {
394
- $title = '[POSTNL-0086] '
395
- . $helper->__('The PostNL extension is not compatible with your Magento version!');
396
-
397
- $message = $helper->__(
398
- 'This may cause unexpected behaviour. You may use the PostNL extension on unsupported versions of ' .
399
- 'Magento at your own risk.'
400
- );
401
-
402
- $inbox = Mage::getModel('postnl_admin/inbox');
403
- $inbox->addCritical(
404
- $title,
405
- $message,
406
- 'http://kb.totalinternetgroup.nl/topic/31925577',
407
- true
408
- )->save();
409
 
410
  Mage::register('postnl_version_compatibility_checked', true);
411
  return $this;
412
  }
413
 
414
-
415
  Mage::register('postnl_version_compatibility_checked', true);
416
  return $this;
417
  }
418
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
419
  /**
420
  * Make sure that the server meets Magento's (and PostNL's) memory requirements.
421
  *
@@ -432,7 +458,9 @@ class TIG_PostNL_Model_Resource_Setup extends Mage_Catalog_Model_Resource_Setup
432
 
433
  if ($helper->getMemoryLimit() < self::MIN_SERVER_MEMORY) {
434
  $memoryMb = self::MIN_SERVER_MEMORY / 1024 / 1024;
435
- $title = '[POSTNL-0175] '
 
 
436
  . $helper->__("The server's memory limit is less than %.0fMB.", $memoryMb);
437
 
438
  $message = $helper->__(
@@ -445,7 +473,7 @@ class TIG_PostNL_Model_Resource_Setup extends Mage_Catalog_Model_Resource_Setup
445
  $inbox->addCritical(
446
  $title,
447
  $message,
448
- '',
449
  true
450
  )->save();
451
  }
@@ -625,6 +653,9 @@ class TIG_PostNL_Model_Resource_Setup extends Mage_Catalog_Model_Resource_Setup
625
  * @param boolean $removeOldValue
626
  *
627
  * @return $this
 
 
 
628
  */
629
  public function moveConfigSetting($fromXpath, $toXpath, $removeOldValue = true)
630
  {
@@ -681,8 +712,12 @@ class TIG_PostNL_Model_Resource_Setup extends Mage_Catalog_Model_Resource_Setup
681
  * @param string $scope
682
  * @param int $scopeId
683
  * @param boolean $removeOldValue
 
684
  *
685
  * @return $this
 
 
 
686
  */
687
  public function moveConfigSettingForScope($fromXpath, $toXpath, $scope = 'default', $scopeId = 0,
688
  $removeOldValue = true, $defaultValue = false)
@@ -1049,4 +1084,236 @@ class TIG_PostNL_Model_Resource_Setup extends Mage_Catalog_Model_Resource_Setup
1049
 
1050
  return $this;
1051
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1052
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Model_Resource_Setup extends Mage_Catalog_Model_Resource_Setup
50
  const UPDATE_STATISTICS_CRON_STRING_PATH = 'crontab/jobs/postnl_update_statistics/schedule/cron_expr';
51
  const UPDATE_STATISTICS_CRON_MODEL_PATH = 'crontab/jobs/postnl_update_statistics/run/model';
52
 
53
+ /**
54
+ * Cron expression and cron model definitions for updating product attributes.
55
+ */
56
+ const UPDATE_PRODUCT_ATTRIBUTE_STRING_PATH = 'crontab/jobs/postnl_update_product_attribute/schedule/cron_expr';
57
+ const UPDATE_PRODUCT_ATTRIBUTE_MODEL_PATH = 'crontab/jobs/postnl_update_product_attribute/run/model';
58
+
59
  /**
60
  * XML path to the support tab_expanded setting
61
  */
76
  /**
77
  * Xpath to supported options configuration setting
78
  */
79
+ const XPATH_SUPPORTED_PRODUCT_OPTIONS = 'postnl/grid/supported_product_options';
80
 
81
  /**
82
  * Xpath to the item columns setting.
83
  */
84
  const XPATH_PACKING_SLIP_ITEM_COLUMNS = 'postnl/packing_slip/item_columns';
85
 
86
+ /**
87
+ * Xpath to the product attribute update data used by the product attribute update cron.
88
+ */
89
+ const XPATH_PRODUCT_ATTRIBUTE_UPDATE_DATA = 'postnl/general/product_attribute_update_data';
90
+
91
  /**
92
  * Minimum server memory required by the PostNL extension in bytes.
93
  */
94
  const MIN_SERVER_MEMORY = 268435456; //256MB
95
 
96
+ /**
97
+ * Error codes that might be triggered during setup.
98
+ */
99
+ const SUCCESSFUL_UPDATE_ERROR_CODE = 'POSTNL-0083';
100
+ const SHIPPING_STATUS_CRON_ERROR_CODE = 'POSTNL-0084';
101
+ const UPDATE_STATISTICS_CRON_ERROR_CODE = 'POSTNL-0085';
102
+ const UNSUPPORTED_MAGENTO_VERSION_ERROR_CODE = 'POSTNL-0086';
103
+ const SUCCESSFUL_INSTALL_ERROR_CODE = 'POSTNL-0156';
104
+ const MEMORY_LIMIT_ERROR_CODE = 'POSTNL-0175';
105
+ const UPDATE_PRODUCT_ATTRIBUTE_ERROR_CODE = 'POSTNL-0197';
106
+
107
  /**
108
  * callAfterApplyAllUpdates flag. Causes applyAfterUpdates() to be called.
109
  *
243
 
244
  $inbox = Mage::getModel('postnl_admin/inbox');
245
  if ($dbVer) {
246
+ $title = '['
247
+ . self::SUCCESSFUL_UPDATE_ERROR_CODE
248
+ . '] '
249
+ . $helper->__('PostNL extension has been successfully updated to version v%s.', $configVer);
250
 
251
+ $url = $helper->getErrorUrl(self::SUCCESSFUL_UPDATE_ERROR_CODE );
252
  } else {
253
+ $title = '['
254
+ . self::SUCCESSFUL_INSTALL_ERROR_CODE
255
+ . '] '
256
+ . $helper->__('The PostNL extension v%s has been successfully installed.', $configVer);
257
+
258
+ $url = $helper->getErrorUrl(self::SUCCESSFUL_INSTALL_ERROR_CODE );
259
  }
260
 
261
  $message = $helper->__(
262
  'You can read the full changelog in the <a href="%s" target="_blank" title="TIG knowledgebase">TIG ' .
263
  'knowledgebase</a>.',
264
+ $helper->getChangelogUrl()
265
  );
266
 
267
  $inbox->addNotice($title, $message, $url, true)
282
  /**
283
  * Generate semi-random values for the cron expression.
284
  */
285
+ $cronMinute = mt_rand(0, 59);
 
286
 
287
+ $cronNightHour = mt_rand(1, 3);
288
+ $cronMorningHour = $cronNightHour + 9; //9 hours after the night update
289
  $cronAfternoonHour = $cronMorningHour + 4; //4 hours after the morning update
 
290
 
291
  /**
292
+ * Generate a cron expr that runs on a specified minute on a specified hour between 1 and 3 AM, between 10 and
293
+ * 12 AM, and between 14 and 16 PM.
294
  */
295
+ $cronExpr = "{$cronMinute} {$cronNightHour},{$cronMorningHour},{$cronAfternoonHour} * * *";
296
 
297
  /**
298
  * Store the cron expression in core_config_data.
311
  } catch (Exception $e) {
312
  throw new TIG_PostNL_Exception(
313
  Mage::helper('postnl')->__('Unable to save shipping_status cron expression: %s', $cronExpr),
314
+ self::SHIPPING_STATUS_CRON_ERROR_CODE,
315
  $e
316
  );
317
  }
358
  } catch (Exception $e) {
359
  throw new TIG_PostNL_Exception(
360
  Mage::helper('postnl')->__('Unable to save update_statistics cron expression: %s', $cronExpr),
361
+ self::UPDATE_STATISTICS_CRON_ERROR_CODE,
362
  $e
363
  );
364
  }
387
 
388
  $supportedVersions = Mage::getConfig()->getNode('tig/compatibility/postnl/' . $edition);
389
  if ($supportedVersions === false) {
390
+ $this->_addUnsupportedVersionMessage();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
391
 
392
  Mage::register('postnl_version_compatibility_checked', true);
393
  return $this;
400
  $installedMagentoVersion = $installedMagentoVersionInfo['major'] . '.' . $installedMagentoVersionInfo['minor'];
401
 
402
  if (!in_array($installedMagentoVersion, $supportedVersionArray)) {
403
+ $this->_addUnsupportedVersionMessage();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
404
 
405
  Mage::register('postnl_version_compatibility_checked', true);
406
  return $this;
407
  }
408
 
 
409
  Mage::register('postnl_version_compatibility_checked', true);
410
  return $this;
411
  }
412
 
413
+ /**
414
+ * @return $this
415
+ *
416
+ * @throws Exception
417
+ */
418
+ protected function _addUnsupportedVersionMessage()
419
+ {
420
+ $helper = Mage::helper('postnl');
421
+
422
+ $title = '['
423
+ . self::UNSUPPORTED_MAGENTO_VERSION_ERROR_CODE
424
+ . '] '
425
+ . $helper->__('The PostNL extension is not compatible with your Magento version!');
426
+
427
+ $message = $helper->__(
428
+ 'This may cause unexpected behaviour. You may use the PostNL extension on unsupported versions of ' .
429
+ 'Magento at your own risk.'
430
+ );
431
+
432
+ $url = $helper->getErrorUrl(self::UNSUPPORTED_MAGENTO_VERSION_ERROR_CODE );
433
+
434
+ $inbox = Mage::getModel('postnl_admin/inbox');
435
+ $inbox->addCritical(
436
+ $title,
437
+ $message,
438
+ $url,
439
+ true
440
+ )->save();
441
+
442
+ return $this;
443
+ }
444
+
445
  /**
446
  * Make sure that the server meets Magento's (and PostNL's) memory requirements.
447
  *
458
 
459
  if ($helper->getMemoryLimit() < self::MIN_SERVER_MEMORY) {
460
  $memoryMb = self::MIN_SERVER_MEMORY / 1024 / 1024;
461
+ $title = '['
462
+ . self::MEMORY_LIMIT_ERROR_CODE
463
+ . '] '
464
  . $helper->__("The server's memory limit is less than %.0fMB.", $memoryMb);
465
 
466
  $message = $helper->__(
473
  $inbox->addCritical(
474
  $title,
475
  $message,
476
+ $helper->getErrorUrl(self::MEMORY_LIMIT_ERROR_CODE),
477
  true
478
  )->save();
479
  }
653
  * @param boolean $removeOldValue
654
  *
655
  * @return $this
656
+ *
657
+ * @deprecated v1.4.1 This method has been superseded by the
658
+ * TIG_PostNL_Model_Resource_Setup::moveConfigSettingInDb() method.
659
  */
660
  public function moveConfigSetting($fromXpath, $toXpath, $removeOldValue = true)
661
  {
712
  * @param string $scope
713
  * @param int $scopeId
714
  * @param boolean $removeOldValue
715
+ * @param boolean $defaultValue
716
  *
717
  * @return $this
718
+ *
719
+ * @deprecated v1.4.1 This method has been superseded by the
720
+ * TIG_PostNL_Model_Resource_Setup::moveConfigSettingInDb() method.
721
  */
722
  public function moveConfigSettingForScope($fromXpath, $toXpath, $scope = 'default', $scopeId = 0,
723
  $removeOldValue = true, $defaultValue = false)
1084
 
1085
  return $this;
1086
  }
1087
+
1088
+ /**
1089
+ * Set the product attribute update cron's cron expression and save the necessary attribute data.
1090
+ *
1091
+ * @param array $data
1092
+ *
1093
+ * @return $this
1094
+ * @throws TIG_PostNL_Exception
1095
+ */
1096
+ public function setProductAttributeUpdateCron($data)
1097
+ {
1098
+ /**
1099
+ * Check if any existing data is present.
1100
+ */
1101
+ $existingData = Mage::getStoreConfig(
1102
+ self::XPATH_PRODUCT_ATTRIBUTE_UPDATE_DATA,
1103
+ Mage_Core_Model_App::ADMIN_STORE_ID
1104
+ );
1105
+
1106
+ /**
1107
+ * Merge the existing data with the new data.
1108
+ */
1109
+ if ($existingData) {
1110
+ $data = array_merge($data, unserialize($existingData));
1111
+ }
1112
+
1113
+ /**
1114
+ * Serialize the attribute data for storage in the database.
1115
+ */
1116
+ $serializedData = serialize($data);
1117
+
1118
+ /**
1119
+ * Save the attribute data.
1120
+ */
1121
+ Mage::getConfig()->saveConfig(
1122
+ self::XPATH_PRODUCT_ATTRIBUTE_UPDATE_DATA,
1123
+ $serializedData,
1124
+ 'default',
1125
+ Mage_Core_Model_App::ADMIN_STORE_ID
1126
+ );
1127
+
1128
+ $cronExpr = "*/5 * * * *";
1129
+
1130
+ /**
1131
+ * Store the cron expression in core_config_data.
1132
+ */
1133
+ try {
1134
+ Mage::getModel('core/config_data')
1135
+ ->load(self::UPDATE_PRODUCT_ATTRIBUTE_STRING_PATH, 'path')
1136
+ ->setValue($cronExpr)
1137
+ ->setPath(self::UPDATE_PRODUCT_ATTRIBUTE_STRING_PATH)
1138
+ ->save();
1139
+ Mage::getModel('core/config_data')
1140
+ ->load(self::UPDATE_PRODUCT_ATTRIBUTE_MODEL_PATH, 'path')
1141
+ ->setValue((string) Mage::getConfig()->getNode(self::UPDATE_PRODUCT_ATTRIBUTE_MODEL_PATH))
1142
+ ->setPath(self::UPDATE_PRODUCT_ATTRIBUTE_MODEL_PATH)
1143
+ ->save();
1144
+ } catch (Exception $e) {
1145
+ throw new TIG_PostNL_Exception(
1146
+ Mage::helper('postnl')->__('Unable to save update_product_attribute cron expression: %s', $cronExpr),
1147
+ self::UPDATE_PRODUCT_ATTRIBUTE_ERROR_CODE,
1148
+ $e
1149
+ );
1150
+ }
1151
+
1152
+ return $this;
1153
+ }
1154
+
1155
+ /**
1156
+ * Install new matrix rate data.
1157
+ *
1158
+ * @param array $data
1159
+ *
1160
+ * @return $this
1161
+ */
1162
+ public function installMatrixRates(array $data)
1163
+ {
1164
+ try {
1165
+ Mage::getResourceModel('postnl_carrier/matrixrate')->import($data);
1166
+ } catch (Exception $e) {
1167
+ Mage::helper('postnl')->logException($e);
1168
+ }
1169
+
1170
+ return $this;
1171
+ }
1172
+
1173
+ /**
1174
+ * Add newly supported shipping methods.
1175
+ *
1176
+ * @param array|string $methods
1177
+ *
1178
+ * @return $this
1179
+ */
1180
+ public function addSupportedShippingMethods($methods)
1181
+ {
1182
+ if (!is_array($methods)) {
1183
+ $methods = array($methods);
1184
+ }
1185
+
1186
+ /**
1187
+ * Get the current shipping methods for the default config.
1188
+ */
1189
+ $defaultShippingMethods = Mage::getStoreConfig(
1190
+ 'postnl/advanced/postnl_shipping_methods',
1191
+ Mage_Core_Model_App::ADMIN_STORE_ID
1192
+ );
1193
+
1194
+ $defaultShippingMethods = explode(',', $defaultShippingMethods);
1195
+
1196
+ /**
1197
+ * Merge with the new methods and save the config.
1198
+ */
1199
+ $newDefaultShippingMethods = array_merge($defaultShippingMethods, $methods);
1200
+ Mage::getConfig()->saveConfig(
1201
+ 'postnl/advanced/postnl_shipping_methods',
1202
+ implode(',', $newDefaultShippingMethods),
1203
+ 'default',
1204
+ Mage_Core_Model_App::ADMIN_STORE_ID
1205
+ );
1206
+
1207
+ return $this;
1208
+ }
1209
+
1210
+ /**
1211
+ * Copy a config setting from an old xpath to a new xpath directly in the database, rather than using Magento config
1212
+ * entities.
1213
+ *
1214
+ * @param string $fromXpath
1215
+ * @param string $toXpath
1216
+ *
1217
+ * @return $this
1218
+ */
1219
+ public function moveConfigSettingInDb($fromXpath, $toXpath)
1220
+ {
1221
+ $conn = $this->getConnection();
1222
+
1223
+ try {
1224
+ $select = $conn->select()
1225
+ ->from($this->getTable('core/config_data'))
1226
+ ->where('path = ?', $fromXpath);
1227
+
1228
+ $result = $conn->fetchAll($select);
1229
+ foreach ($result as $row) {
1230
+ try {
1231
+ /**
1232
+ * Copy the old setting to the new setting.
1233
+ *
1234
+ * @todo Check if the row already exists.
1235
+ */
1236
+ $conn->insert(
1237
+ $this->getTable('core/config_data'),
1238
+ array(
1239
+ 'scope' => $row['scope'],
1240
+ 'scope_id' => $row['scope_id'],
1241
+ 'value' => $row['value'],
1242
+ 'path' => $toXpath
1243
+ )
1244
+ );
1245
+ } catch (Exception $e) {
1246
+ Mage::helper('postnl')->logException($e);
1247
+ }
1248
+ }
1249
+ } catch (Exception $e) {
1250
+ Mage::helper('postnl')->logException($e);
1251
+ }
1252
+
1253
+ return $this;
1254
+ }
1255
+
1256
+ /**
1257
+ * Moves and merges the PostNL active setting to and with the PostNL mode setting.
1258
+ *
1259
+ * @return $this
1260
+ */
1261
+ public function moveActiveSetting()
1262
+ {
1263
+ $conn = $this->getConnection();
1264
+
1265
+ try {
1266
+ /**
1267
+ * Modify all mode settings with value 0 (Live) to value 2 (the new live mode value).
1268
+ */
1269
+ $conn->update(
1270
+ $this->getTable('core/config_data'),
1271
+ array(
1272
+ 'value' => 2,
1273
+ ),
1274
+ array(
1275
+ 'path = ?' => 'postnl/cif/mode',
1276
+ 'value = ?' => 0
1277
+ )
1278
+ );
1279
+ } catch (Exception $e) {
1280
+ Mage::helper('postnl')->logException($e);
1281
+ }
1282
+
1283
+ try {
1284
+ /**
1285
+ * Get all scopes for which PostNl is disabled.
1286
+ */
1287
+ $disabledSelect = $conn->select()
1288
+ ->from($this->getTable('core/config_data'))
1289
+ ->where('path = ?', 'postnl/general/active')
1290
+ ->where('value = ?', 0);
1291
+
1292
+ $disabledRows = $conn->fetchAll($disabledSelect);
1293
+ foreach ($disabledRows as $disabledRow) {
1294
+ try {
1295
+ /**
1296
+ * Set the mode to 0 (off) for these scopes.
1297
+ */
1298
+ $conn->update(
1299
+ $this->getTable('core/config_data'),
1300
+ array(
1301
+ 'value' => 0,
1302
+ ),
1303
+ array(
1304
+ 'path = ?' => 'postnl/cif/mode',
1305
+ 'scope_id = ?' => $disabledRow['scope_id'],
1306
+ 'scope = ?' => $disabledRow['scope'],
1307
+ )
1308
+ );
1309
+ } catch (Exception $e) {
1310
+ Mage::helper('postnl')->logException($e);
1311
+ }
1312
+ }
1313
+ } catch (Exception $e) {
1314
+ Mage::helper('postnl')->logException($e);
1315
+ }
1316
+
1317
+ return $this;
1318
+ }
1319
  }
app/code/community/TIG/PostNL/Model/System/Config/Backend/Checkbox.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+ class TIG_PostNL_Model_System_Config_Backend_Checkbox extends Mage_Core_Model_Config_Data
40
+ {
41
+ /**
42
+ * Modify the value before saving so it uses the value from the hidden element.
43
+ *
44
+ * @return Mage_Core_Model_Abstract
45
+ */
46
+ protected function _beforeSave()
47
+ {
48
+ $value = $this->getValue();
49
+ if (isset($value['hidden'])) {
50
+ $this->setValue($value['hidden']);
51
+ }
52
+
53
+ return parent::_beforeSave();
54
+ }
55
+ }
app/code/community/TIG/PostNL/Model/System/Config/Source/Testlive.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
 
@@ -48,13 +48,21 @@ class TIG_PostNL_Model_System_Config_Source_Testlive
48
  {
49
  $helper = Mage::helper('postnl');
50
 
 
 
 
 
51
  $array = array(
 
 
 
 
52
  array(
53
  'value' => '1',
54
  'label' => $helper->__('Test')
55
  ),
56
  array(
57
- 'value' => '0',
58
  'label' => $helper->__('Live')
59
  ),
60
  );
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
 
48
  {
49
  $helper = Mage::helper('postnl');
50
 
51
+ /**
52
+ * Used 0, 1 and 2 as values so that Mage::getStoreConfigFlag() would still function for checking if the
53
+ * extension is active. You still need to check if the value is 2 to see if it's in live or test mode.
54
+ */
55
  $array = array(
56
+ array(
57
+ 'value' => '0',
58
+ 'label' => $helper->__('Off')
59
+ ),
60
  array(
61
  'value' => '1',
62
  'label' => $helper->__('Test')
63
  ),
64
  array(
65
+ 'value' => '2',
66
  'label' => $helper->__('Live')
67
  ),
68
  );
app/code/community/TIG/PostNL/Model/System/Config/Source/Yesno.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
 
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
 
app/code/community/TIG/PostNL/controllers/AddressValidationController.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_AddressValidationController extends Mage_Core_Controller_Front_Action
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_AddressValidationController extends Mage_Core_Controller_Front_Action
app/code/community/TIG/PostNL/controllers/Adminhtml/ConfigController.php CHANGED
@@ -25,18 +25,18 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
- class TIG_PostNL_Adminhtml_ConfigController extends Mage_Adminhtml_Controller_Action
40
  {
41
  /**
42
  * Base XML path of config settings that will be checked.
@@ -245,6 +245,30 @@ class TIG_PostNL_Adminhtml_ConfigController extends Mage_Adminhtml_Controller_Ac
245
  return $this;
246
  }
247
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  /**
249
  * Download all PostNL log files as a zip file.
250
  *
@@ -299,4 +323,161 @@ class TIG_PostNL_Adminhtml_ConfigController extends Mage_Adminhtml_Controller_Ac
299
 
300
  return $this;
301
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
302
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
+ class TIG_PostNL_Adminhtml_ConfigController extends TIG_PostNL_Controller_Adminhtml_Config
40
  {
41
  /**
42
  * Base XML path of config settings that will be checked.
245
  return $this;
246
  }
247
 
248
+ /**
249
+ * Export shipping matrix rates in csv format.
250
+ *
251
+ * @return $this
252
+ */
253
+ public function exportMatrixratesAction()
254
+ {
255
+ $fileName = 'matrixrates.csv';
256
+
257
+ /**
258
+ * @var TIG_PostNL_Block_Adminhtml_Carrier_Postnl_Matrixrate_Grid $gridBlock
259
+ */
260
+ $gridBlock = $this->getLayout()->createBlock('postnl_adminhtml/carrier_postnl_matrixrate_grid');
261
+ $website = Mage::app()->getWebsite($this->getRequest()->getParam('website'));
262
+
263
+ $gridBlock->setWebsiteId($website->getId());
264
+
265
+ $content = $gridBlock->getCsvFile();
266
+
267
+ $this->_prepareDownloadResponse($fileName, $content);
268
+
269
+ return $this;
270
+ }
271
+
272
  /**
273
  * Download all PostNL log files as a zip file.
274
  *
323
 
324
  return $this;
325
  }
326
+
327
+ /**
328
+ * Saves a step in the PostNL configuration wizard.
329
+ *
330
+ * This functionality is nearly identical to Magento's configuration save action.
331
+ *
332
+ * @return $this
333
+ *
334
+ * @see Mage_Adminhtml_System_ConfigController::saveAction()
335
+ */
336
+ public function saveWizardStepAction()
337
+ {
338
+ $groups = $this->getRequest()->getPost('groups');
339
+
340
+ try {
341
+ if (!$this->_isSectionAllowed($this->getRequest()->getParam('section'))) {
342
+ $this->getResponse()
343
+ ->setBody('redirect');
344
+
345
+ return $this;
346
+ }
347
+
348
+ /**
349
+ * custom save logic
350
+ */
351
+ $this->_saveSection();
352
+ $section = $this->getRequest()->getParam('section');
353
+ $website = $this->getRequest()->getParam('website');
354
+ $store = $this->getRequest()->getParam('store');
355
+ Mage::getSingleton('adminhtml/config_data')
356
+ ->setSection($section)
357
+ ->setWebsite($website)
358
+ ->setStore($store)
359
+ ->setGroups($groups)
360
+ ->save();
361
+
362
+ /**
363
+ * reinit configuration
364
+ */
365
+ Mage::getConfig()->reinit();
366
+ Mage::dispatchEvent('admin_system_config_section_save_after', array(
367
+ 'website' => $website,
368
+ 'store' => $store,
369
+ 'section' => $section
370
+ ));
371
+ Mage::app()->reinitStores();
372
+
373
+ /**
374
+ * website and store codes can be used in event implementation, so set them as well
375
+ */
376
+ Mage::dispatchEvent("admin_system_config_changed_section_{$section}",
377
+ array('website' => $website, 'store' => $store)
378
+ );
379
+ }
380
+ catch (Mage_Core_Exception $e) {
381
+ $this->getResponse()
382
+ ->setBody($e->getMessage());
383
+
384
+ return $this;
385
+ }
386
+ catch (Exception $e) {
387
+ $this->getResponse()
388
+ ->setBody(
389
+ Mage::helper('adminhtml')->__('An error occurred while saving this configuration:')
390
+ . ' '
391
+ . $e->getMessage()
392
+ );
393
+
394
+ return $this;
395
+ }
396
+
397
+ $this->_saveState($this->getRequest()->getPost('config_state'));
398
+
399
+ /**
400
+ * Save the next wizard step as the current step the admin user is on.
401
+ */
402
+ $nextStep = $this->getRequest()->getPost('next_step_hash');
403
+ if ($nextStep) {
404
+ $this->_saveCurrentWizardStep($nextStep);
405
+ }
406
+
407
+ $this->getResponse()
408
+ ->setBody('success');
409
+
410
+ return $this;
411
+ }
412
+
413
+ /**
414
+ * Custom save logic for section
415
+ */
416
+ protected function _saveSection ()
417
+ {
418
+ $method = '_save' . uc_words($this->getRequest()->getParam('section'), '');
419
+ if (method_exists($this, $method)) {
420
+ $this->$method();
421
+ }
422
+ }
423
+
424
+ /**
425
+ * Check if specified section allowed in ACL
426
+ *
427
+ * Will forward to deniedAction(), if not allowed.
428
+ *
429
+ * @param string $section
430
+ * @return bool
431
+ */
432
+ protected function _isSectionAllowed($section)
433
+ {
434
+ try {
435
+ $session = Mage::getSingleton('admin/session');
436
+ $resourceLookup = "admin/system/config/{$section}";
437
+ if ($session->getData('acl') instanceof Mage_Admin_Model_Acl) {
438
+ $resourceId = $session->getData('acl')->get($resourceLookup)->getResourceId();
439
+ if (!$session->isAllowed($resourceId)) {
440
+ throw new Exception('');
441
+ }
442
+ return true;
443
+ }
444
+ }
445
+ catch (Zend_Acl_Exception $e) {
446
+ $this->norouteAction();
447
+ $this->setFlag('', self::FLAG_NO_DISPATCH, true);
448
+ }
449
+ catch (Exception $e) {
450
+ $this->deniedAction();
451
+ $this->setFlag('', self::FLAG_NO_DISPATCH, true);
452
+ }
453
+
454
+ return false;
455
+ }
456
+
457
+ /**
458
+ * Save state of configuration field sets
459
+ *
460
+ * @param array $configState
461
+ * @return bool
462
+ */
463
+ protected function _saveState($configState = array())
464
+ {
465
+ $adminUser = Mage::getSingleton('admin/session')->getUser();
466
+ if (is_array($configState)) {
467
+ $extra = $adminUser->getExtra();
468
+ if (!is_array($extra)) {
469
+ $extra = array();
470
+ }
471
+ if (!isset($extra['configState'])) {
472
+ $extra['configState'] = array();
473
+ }
474
+ foreach ($configState as $fieldset => $state) {
475
+ $extra['configState'][$fieldset] = $state;
476
+ }
477
+
478
+ $adminUser->saveExtra($extra);
479
+ }
480
+
481
+ return true;
482
+ }
483
  }
app/code/community/TIG/PostNL/controllers/Adminhtml/ExtensionControlController.php CHANGED
@@ -25,18 +25,18 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
- class TIG_PostNL_Adminhtml_ExtensionControlController extends Mage_Adminhtml_Controller_Action
40
  {
41
  /**
42
  * XML path to extensioncontrol email setting
@@ -64,6 +64,45 @@ class TIG_PostNL_Adminhtml_ExtensionControlController extends Mage_Adminhtml_Con
64
  */
65
  const SHOP_ALREADY_REGISTERED_FAULTCODE = 'API-2-6';
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  /**
68
  * Activate the extension by registering it with the extension control service
69
  *
@@ -82,7 +121,14 @@ class TIG_PostNL_Adminhtml_ExtensionControlController extends Mage_Adminhtml_Con
82
 
83
  Mage::app()->cleanCache();
84
 
85
- $this->_redirect('adminhtml/system_config/edit', array('section' => 'postnl'));
 
 
 
 
 
 
 
86
  return $this;
87
  }
88
 
@@ -146,7 +192,7 @@ class TIG_PostNL_Adminhtml_ExtensionControlController extends Mage_Adminhtml_Con
146
  $this->__(
147
  'Your webshop has been registered. Within a few minutes you will recieve an email at the emailaddress ' .
148
  'you specified. Please read this email carefully as it contains instructions on how to finish the ' .
149
- 'extension activation procedure.'
150
  )
151
  );
152
 
@@ -269,9 +315,15 @@ class TIG_PostNL_Adminhtml_ExtensionControlController extends Mage_Adminhtml_Con
269
  Mage::getModel('core/config')->saveConfig(self::XPATH_IS_ACTIVATED, 2);
270
 
271
  $helper->addSessionMessage('adminhtml/session', null, 'success',
272
- $this->__('The extension has been successfully activated!')
273
  );
274
 
 
 
 
 
 
 
275
  return $this;
276
  }
277
 
@@ -289,6 +341,11 @@ class TIG_PostNL_Adminhtml_ExtensionControlController extends Mage_Adminhtml_Con
289
 
290
  Mage::app()->cleanCache();
291
 
 
 
 
 
 
292
  $this->_redirect('adminhtml/system_config/edit', array('section' => 'postnl'));
293
  return $this;
294
  }
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
+ class TIG_PostNL_Adminhtml_ExtensionControlController extends TIG_PostNL_Controller_Adminhtml_Config
40
  {
41
  /**
42
  * XML path to extensioncontrol email setting
64
  */
65
  const SHOP_ALREADY_REGISTERED_FAULTCODE = 'API-2-6';
66
 
67
+ /**
68
+ * @var string|null
69
+ */
70
+ protected $_fragment;
71
+
72
+ /**
73
+ * @return mixed
74
+ */
75
+ public function getFragment()
76
+ {
77
+ return $this->_fragment;
78
+ }
79
+
80
+ /**
81
+ * @param mixed $fragment
82
+ *
83
+ * @return $this
84
+ */
85
+ public function setFragment($fragment)
86
+ {
87
+ $this->_fragment = $fragment;
88
+
89
+ return $this;
90
+ }
91
+
92
+ /**
93
+ * @return bool
94
+ */
95
+ public function hasFragment()
96
+ {
97
+ $fragment = $this->getFragment();
98
+
99
+ if (is_null($fragment)) {
100
+ return false;
101
+ }
102
+
103
+ return true;
104
+ }
105
+
106
  /**
107
  * Activate the extension by registering it with the extension control service
108
  *
121
 
122
  Mage::app()->cleanCache();
123
 
124
+ $urlParams = array(
125
+ 'section' => 'postnl'
126
+ );
127
+ if ($this->hasFragment()) {
128
+ $urlParams['_fragment'] = $this->getFragment();
129
+ }
130
+
131
+ $this->_redirect('adminhtml/system_config/edit', $urlParams);
132
  return $this;
133
  }
134
 
192
  $this->__(
193
  'Your webshop has been registered. Within a few minutes you will recieve an email at the emailaddress ' .
194
  'you specified. Please read this email carefully as it contains instructions on how to finish the ' .
195
+ 'extension registration procedure.'
196
  )
197
  );
198
 
315
  Mage::getModel('core/config')->saveConfig(self::XPATH_IS_ACTIVATED, 2);
316
 
317
  $helper->addSessionMessage('adminhtml/session', null, 'success',
318
+ $this->__('The extension has been successfully registered!')
319
  );
320
 
321
+ /**
322
+ * Proceed to the next step in the configuration wizard.
323
+ */
324
+ $this->_saveCurrentWizardStep('#wizard2');
325
+ $this->setFragment('wizard2');
326
+
327
  return $this;
328
  }
329
 
341
 
342
  Mage::app()->cleanCache();
343
 
344
+ /**
345
+ * Reset the wizard to the first step.
346
+ */
347
+ $this->_saveCurrentWizardStep('#wizard1');
348
+
349
  $this->_redirect('adminhtml/system_config/edit', array('section' => 'postnl'));
350
  return $this;
351
  }
app/code/community/TIG/PostNL/controllers/Adminhtml/ShipmentController.php CHANGED
@@ -25,21 +25,21 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Adminhtml_ShipmentController extends TIG_PostNL_Controller_Adminhtml_Shipment
40
  {
41
  /**
42
- * Print a shipping label for a single shipment
43
  *
44
  * @return $this
45
  */
@@ -101,7 +101,7 @@ class TIG_PostNL_Adminhtml_ShipmentController extends TIG_PostNL_Controller_Admi
101
  $labelModel = Mage::getModel('postnl_core/label');
102
  $output = $labelModel->createPdf($labels);
103
 
104
- $filename = 'PostNL Shipping Labels' . date('YmdHis') . '.pdf';
105
 
106
  $this->_preparePdfResponse($filename, $output);
107
  } catch (TIG_PostNL_Model_Core_Cif_Exception $e) {
@@ -131,6 +131,82 @@ class TIG_PostNL_Adminhtml_ShipmentController extends TIG_PostNL_Controller_Admi
131
  return $this;
132
  }
133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  /**
135
  * Confirm a PosTNL shipment without printing a label
136
  *
@@ -877,71 +953,15 @@ class TIG_PostNL_Adminhtml_ShipmentController extends TIG_PostNL_Controller_Admi
877
  Mage::register('postnl_additional_options', $extraOptions);
878
  }
879
 
880
- try {
881
- $orderIds = $this->_getOrderIds();
882
-
883
- /**
884
- * Create the shipments.
885
- */
886
- $errors = 0;
887
- foreach ($orderIds as $orderId) {
888
- try {
889
- $this->_createShipment($orderId);
890
- } catch (TIG_PostNL_Exception $e) {
891
- $helper->logException($e);
892
- $this->addWarning(
893
- array(
894
- 'entity_id' => Mage::getResourceModel('sales/order')->getIncrementId($orderId),
895
- 'code' => $e->getCode(),
896
- 'description' => $e->getMessage(),
897
- )
898
- );
899
- $errors++;
900
- } catch (Exception $e) {
901
- $helper->logException($e);
902
- $this->addWarning(
903
- array(
904
- 'entity_id' => Mage::getResourceModel('sales/order')->getIncrementId($orderId),
905
- 'code' => null,
906
- 'description' => $e->getMessage(),
907
- )
908
- );
909
- $errors++;
910
- }
911
- }
912
- } catch (TIG_PostNL_Model_Core_Cif_Exception $e) {
913
- Mage::helper('postnl/cif')->parseCifException($e);
914
-
915
- $helper->logException($e);
916
- $helper->addExceptionSessionMessage('adminhtml/session', $e);
917
-
918
- $this->_redirect('adminhtml/sales_order/index');
919
- return $this;
920
- } catch (TIG_PostNL_Exception $e) {
921
- $helper->logException($e);
922
- $helper->addExceptionSessionMessage('adminhtml/session', $e);
923
-
924
- $this->_redirect('adminhtml/sales_order/index');
925
- return $this;
926
- } catch (Exception $e) {
927
- $helper->logException($e);
928
- $helper->addSessionMessage('adminhtml/session', 'POSTNL-0010', 'error',
929
- $this->__('An error occurred while processing this action.')
930
- );
931
-
932
- $this->_redirect('adminhtml/sales_order/index');
933
- return $this;
934
- }
935
 
936
- /**
937
- * Check for warnings.
938
- */
939
- $this->_checkForWarnings();
940
 
941
  /**
942
  * Add either a success or failure message and redirect the user accordingly.
943
  */
944
- if ($errors < count($orderIds)) {
945
  $helper->addSessionMessage(
946
  'adminhtml/session', null, 'success',
947
  $this->__('The shipments were successfully created.')
@@ -950,13 +970,20 @@ class TIG_PostNL_Adminhtml_ShipmentController extends TIG_PostNL_Controller_Admi
950
  $this->_redirect('adminhtml/sales_shipment/index');
951
  } else {
952
  $helper->addSessionMessage(
953
- 'adminhtml/session', null, 'error',
 
 
954
  $this->__('None of the shipments could be created. Please check the error messages for more details.')
955
  );
956
 
957
  $this->_redirect('adminhtml/sales_order/index');
958
  }
959
 
 
 
 
 
 
960
  return $this;
961
  }
962
 
@@ -965,11 +992,13 @@ class TIG_PostNL_Adminhtml_ShipmentController extends TIG_PostNL_Controller_Admi
965
  * selected orders. Then we confirm those shipments and get their shipping labels. If all goes according to plan,
966
  * the labels will be presented as a pdf. This really is the "Don't give me any options, just do everything"-option.
967
  *
 
 
968
  * @return $this
969
  *
970
  * @throws TIG_PostNL_Exception
971
  */
972
- public function massFullPostnlFlowAction()
973
  {
974
  $helper = Mage::helper('postnl');
975
 
@@ -994,7 +1023,7 @@ class TIG_PostNL_Adminhtml_ShipmentController extends TIG_PostNL_Controller_Admi
994
  /**
995
  * Perform the full process for all selected orders.
996
  */
997
- $this->_fullPostnlFlow();
998
  } catch (TIG_PostNL_Model_Core_Cif_Exception $e) {
999
  Mage::helper('postnl/cif')->parseCifException($e);
1000
 
@@ -1022,14 +1051,26 @@ class TIG_PostNL_Adminhtml_ShipmentController extends TIG_PostNL_Controller_Admi
1022
  return $this;
1023
  }
1024
 
 
 
 
 
 
 
 
 
 
 
1025
  /**
1026
  * Create the shipments, confirm them and print their shipping labels.
1027
  *
 
 
1028
  * @return $this
1029
  *
1030
- * @throws TIG_PostNL_Exception
1031
  */
1032
- protected function _fullPostnlFlow()
1033
  {
1034
  $helper = Mage::helper('postnl');
1035
 
@@ -1058,84 +1099,17 @@ class TIG_PostNL_Adminhtml_ShipmentController extends TIG_PostNL_Controller_Admi
1058
  )
1059
  );
1060
 
1061
- /**
1062
- * Create the shipments.
1063
- */
1064
- $errors = 0;
1065
- $shipmentIds = array();
1066
- $carrierHelper = Mage::helper('postnl/carrier');
1067
- foreach ($orderIds as $orderId) {
1068
- try {
1069
- /**
1070
- * @var Mage_Sales_Model_Order $order
1071
- */
1072
- $order = Mage::getModel('sales/order')->load($orderId);
1073
- $shippingMethod = $order->getShippingMethod();
1074
-
1075
- /**
1076
- * Check that the order was placed using PostNL.
1077
- */
1078
- if (!$carrierHelper->isPostnlShippingMethod($shippingMethod)) {
1079
- $this->addWarning(
1080
- array(
1081
- 'entity_id' => $order->getIncrementId(),
1082
- 'code' => 'POSTNL-0009',
1083
- 'description' => $this->__(
1084
- 'This action is not available for order #%s, because it was not placed using PostNL.',
1085
- $order->getIncrementId()
1086
- ),
1087
- )
1088
- );
1089
-
1090
- $errors++;
1091
- continue;
1092
- }
1093
 
1094
- $shipmentIds[] = $this->_createShipment($orderId);
1095
- } catch (TIG_PostNL_Exception $e) {
1096
- /**
1097
- * If any shipments already exist, get their IDs so they can be processed.
1098
- */
1099
- $shipmentCollection = Mage::getResourceModel('sales/order_shipment_collection');
1100
- $shipmentCollection->addFieldToSelect('entity_id')
1101
- ->addFieldToFilter('order_id', $orderId);
1102
-
1103
- if ($shipmentCollection->getSize() > 0) {
1104
- $shipmentIds = array_merge($shipmentCollection->getColumnValues('entity_id'), $shipmentIds);
1105
- } else {
1106
- /**
1107
- * If no shipments exist, add a warning message indicating the process failed for this order.
1108
- */
1109
- $helper->logException($e);
1110
- $this->addWarning(
1111
- array(
1112
- 'entity_id' => Mage::getResourceModel('sales/order')->getIncrementId($orderId),
1113
- 'code' => $e->getCode(),
1114
- 'description' => $e->getMessage(),
1115
- )
1116
- );
1117
- $errors++;
1118
- }
1119
- } catch (Exception $e) {
1120
- $helper->logException($e);
1121
- $this->addWarning(
1122
- array(
1123
- 'entity_id' => Mage::getResourceModel('sales/order')->getIncrementId($orderId),
1124
- 'code' => null,
1125
- 'description' => $e->getMessage(),
1126
- )
1127
- );
1128
- $errors++;
1129
- }
1130
- }
1131
 
1132
  /**
1133
  * Add either a success or failure message and redirect the user accordingly.
1134
  */
1135
- if ($errors < count($orderIds)) {
1136
  $helper->addSessionMessage(
1137
- 'adminhtml/session', null, 'success',
1138
- $this->__('The shipments were successfully created.')
1139
  );
1140
  } else {
1141
  $helper->addSessionMessage(
@@ -1175,46 +1149,17 @@ class TIG_PostNL_Adminhtml_ShipmentController extends TIG_PostNL_Controller_Admi
1175
  */
1176
  $shipments = $this->_loadAndCheckShipments($shipmentIds, true, false);
1177
 
1178
- /**
1179
- * Get the labels from CIF.
1180
- *
1181
- * @var TIG_PostNL_Model_Core_Shipment $shipment
1182
- */
1183
- $labels = array();
1184
- foreach ($shipments as $shipment) {
1185
- try {
1186
- $shipmentLabels = $this->_getLabels($shipment, true);
1187
- $labels = array_merge($labels, $shipmentLabels);
1188
- } catch (TIG_PostNL_Model_Core_Cif_Exception $e) {
1189
- Mage::helper('postnl/cif')->parseCifException($e);
1190
-
1191
- $helper->logException($e);
1192
- $this->addWarning(
1193
- array(
1194
- 'entity_id' => $shipment->getShipmentIncrementId(),
1195
- 'code' => $e->getCode(),
1196
- 'description' => $e->getMessage(),
1197
- )
1198
- );
1199
- } catch (TIG_PostNL_Exception $e) {
1200
- $helper->logException($e);
1201
- $this->addWarning(
1202
- array(
1203
- 'entity_id' => $shipment->getShipmentIncrementId(),
1204
- 'code' => $e->getCode(),
1205
- 'description' => $e->getMessage(),
1206
- )
1207
- );
1208
- } catch (Exception $e) {
1209
- $helper->logException($e);
1210
- $this->addWarning(
1211
- array(
1212
- 'entity_id' => $shipment->getShipmentIncrementId(),
1213
- 'code' => null,
1214
- 'description' => $e->getMessage(),
1215
- )
1216
- );
1217
- }
1218
  }
1219
 
1220
  /**
@@ -1222,7 +1167,7 @@ class TIG_PostNL_Adminhtml_ShipmentController extends TIG_PostNL_Controller_Admi
1222
  */
1223
  $this->_checkForWarnings();
1224
 
1225
- if (!$labels) {
1226
  $helper->addSessionMessage('adminhtml/session', null, 'error',
1227
  $this->__(
1228
  'Unfortunately no shipments could be processed. Please check the error messages for more ' .
@@ -1234,14 +1179,6 @@ class TIG_PostNL_Adminhtml_ShipmentController extends TIG_PostNL_Controller_Admi
1234
  return $this;
1235
  }
1236
 
1237
- /**
1238
- * The label wills be base64 encoded strings. Convert these to a single pdf.
1239
- */
1240
- $label = Mage::getModel('postnl_core/label');
1241
- $output = $label->createPdf($labels);
1242
-
1243
- $filename = 'PostNL Shipping Labels' . date('YmdHis') . '.pdf';
1244
-
1245
  $this->_preparePdfResponse($filename, $output);
1246
  return $this;
1247
  }
@@ -1360,7 +1297,7 @@ class TIG_PostNL_Adminhtml_ShipmentController extends TIG_PostNL_Controller_Admi
1360
 
1361
  $output = $label->createPdf($labels);
1362
 
1363
- $filename = 'PostNL Shipping Labels' . date('YmdHis') . '.pdf';
1364
 
1365
  $this->_preparePdfResponse($filename, $output);
1366
  } catch (TIG_PostNL_Exception $e) {
@@ -1431,7 +1368,7 @@ class TIG_PostNL_Adminhtml_ShipmentController extends TIG_PostNL_Controller_Admi
1431
  */
1432
  foreach ($shipments as $shipment) {
1433
  try {
1434
- $shipmentLabels = $this->_getLabels($shipment, true);
1435
  $labels = array_merge($labels, $shipmentLabels);
1436
  } catch (TIG_PostNL_Exception $e) {
1437
  $helper->logException($e);
@@ -1482,7 +1419,7 @@ class TIG_PostNL_Adminhtml_ShipmentController extends TIG_PostNL_Controller_Admi
1482
 
1483
  $output = $label->createPdf($labels);
1484
 
1485
- $fileName = 'PostNL Shipping Labels' . date('YmdHis') . '.pdf';
1486
 
1487
  $this->_preparePdfResponse($fileName, $output);
1488
  } catch (TIG_PostNL_Model_Core_Cif_Exception $e) {
@@ -1674,7 +1611,7 @@ class TIG_PostNL_Adminhtml_ShipmentController extends TIG_PostNL_Controller_Admi
1674
  */
1675
  $output = $pdf->render();
1676
 
1677
- $fileName = 'PostNL Packing Slips '
1678
  . date('Ymd-His', Mage::getSingleton('core/date')->timestamp())
1679
  . '.pdf';
1680
 
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_Adminhtml_ShipmentController extends TIG_PostNL_Controller_Adminhtml_Shipment
40
  {
41
  /**
42
+ * Print a shipping label for a single shipment.
43
  *
44
  * @return $this
45
  */
101
  $labelModel = Mage::getModel('postnl_core/label');
102
  $output = $labelModel->createPdf($labels);
103
 
104
+ $filename = 'PostNL Shipping Labels-' . date('YmdHis') . '.pdf';
105
 
106
  $this->_preparePdfResponse($filename, $output);
107
  } catch (TIG_PostNL_Model_Core_Cif_Exception $e) {
131
  return $this;
132
  }
133
 
134
+ /**
135
+ * Print a packing slip for a single shipment.
136
+ *
137
+ * @return $this
138
+ */
139
+ public function printPackingSlipAction()
140
+ {
141
+ $helper = Mage::helper('postnl');
142
+ if (!$this->_checkIsAllowed(array('print_label', 'print_packing_slip'))) {
143
+ $helper->addSessionMessage('adminhtml/session', 'POSTNL-0155', 'error',
144
+ $this->__('The current user is not allowed to perform this action.')
145
+ );
146
+
147
+ $this->_redirect('adminhtml/sales_shipment/index');
148
+ return $this;
149
+ }
150
+
151
+ $shipmentId = $this->getRequest()->getParam('shipment_id');
152
+
153
+ /**
154
+ * If no shipment was selected, throw an error.
155
+ */
156
+ if (is_null($shipmentId)) {
157
+ $helper->addSessionMessage('adminhtml/session', null, 'error',
158
+ $this->__('Please select a shipment.')
159
+ );
160
+ $this->_redirect('adminhtml/sales_shipment/index');
161
+ return $this;
162
+ }
163
+
164
+ try {
165
+ /**
166
+ * Load the shipment and check if it exists and is valid.
167
+ */
168
+ $shipment = $this->_loadShipment($shipmentId, true);
169
+
170
+ /**
171
+ * Get the labels from CIF and create the packing slip.
172
+ */
173
+ $pdf = new Zend_Pdf();
174
+ $shipmentLabels = $this->_getLabels($shipment, false);
175
+ Mage::getModel('postnl_core/packingSlip')->createPdf($shipmentLabels, $shipment, $pdf);
176
+ $output = $pdf->render();
177
+
178
+ /**
179
+ * We need to check for warnings before the packing slip download response.
180
+ */
181
+ $this->_checkForWarnings();
182
+
183
+ $filename = 'PostNL Packing Slip-' . date('YmdHis') . '.pdf';
184
+
185
+ $this->_preparePdfResponse($filename, $output);
186
+ } catch (TIG_PostNL_Model_Core_Cif_Exception $e) {
187
+ Mage::helper('postnl/cif')->parseCifException($e);
188
+
189
+ $helper->logException($e);
190
+ $helper->addExceptionSessionMessage('adminhtml/session', $e);
191
+
192
+ $this->_redirect('adminhtml/sales_shipment/index');
193
+ } catch (TIG_PostNL_Exception $e) {
194
+ $helper->logException($e);
195
+ $helper->addExceptionSessionMessage('adminhtml/session', $e);
196
+
197
+ $this->_redirect('adminhtml/sales_shipment/index');
198
+ } catch (Exception $e) {
199
+ $helper->logException($e);
200
+ $helper->addSessionMessage('adminhtml/session', 'POSTNL-0010', 'error',
201
+ $this->__('An error occurred while processing this action.')
202
+ );
203
+
204
+ $this->_redirect('adminhtml/sales_shipment/index');
205
+ }
206
+
207
+ return $this;
208
+ }
209
+
210
  /**
211
  * Confirm a PosTNL shipment without printing a label
212
  *
953
  Mage::register('postnl_additional_options', $extraOptions);
954
  }
955
 
956
+ $orderIds = $this->_getOrderIds();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
957
 
958
+ $this->_errors = 0;
959
+ $this->_createShipments($orderIds);
 
 
960
 
961
  /**
962
  * Add either a success or failure message and redirect the user accordingly.
963
  */
964
+ if ($this->_errors < count($orderIds)) {
965
  $helper->addSessionMessage(
966
  'adminhtml/session', null, 'success',
967
  $this->__('The shipments were successfully created.')
970
  $this->_redirect('adminhtml/sales_shipment/index');
971
  } else {
972
  $helper->addSessionMessage(
973
+ 'adminhtml/session',
974
+ null,
975
+ 'error',
976
  $this->__('None of the shipments could be created. Please check the error messages for more details.')
977
  );
978
 
979
  $this->_redirect('adminhtml/sales_order/index');
980
  }
981
 
982
+ /**
983
+ * Check for warnings.
984
+ */
985
+ $this->_checkForWarnings();
986
+
987
  return $this;
988
  }
989
 
992
  * selected orders. Then we confirm those shipments and get their shipping labels. If all goes according to plan,
993
  * the labels will be presented as a pdf. This really is the "Don't give me any options, just do everything"-option.
994
  *
995
+ * @param string $type
996
+ *
997
  * @return $this
998
  *
999
  * @throws TIG_PostNL_Exception
1000
  */
1001
+ public function massFullPostnlFlowAction($type = 'label')
1002
  {
1003
  $helper = Mage::helper('postnl');
1004
 
1023
  /**
1024
  * Perform the full process for all selected orders.
1025
  */
1026
+ $this->_fullPostnlFlow($type);
1027
  } catch (TIG_PostNL_Model_Core_Cif_Exception $e) {
1028
  Mage::helper('postnl/cif')->parseCifException($e);
1029
 
1051
  return $this;
1052
  }
1053
 
1054
+ /**
1055
+ * This action does the same as massFullPostnlFlowAction except it print packing slips, instead of shipping labels.
1056
+ *
1057
+ * @return $this
1058
+ */
1059
+ public function massFullPostnlFlowWithPackingSlipAction()
1060
+ {
1061
+ return $this->massFullPostnlFlowAction('packing_slip');
1062
+ }
1063
+
1064
  /**
1065
  * Create the shipments, confirm them and print their shipping labels.
1066
  *
1067
+ * @param string $type
1068
+ *
1069
  * @return $this
1070
  *
1071
+ * @throws TIG_PostNL_Exception|InvalidArgumentException
1072
  */
1073
+ protected function _fullPostnlFlow($type = 'label')
1074
  {
1075
  $helper = Mage::helper('postnl');
1076
 
1099
  )
1100
  );
1101
 
1102
+ $this->_errors = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1103
 
1104
+ $shipmentIds = $this->_createShipments($orderIds, true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1105
 
1106
  /**
1107
  * Add either a success or failure message and redirect the user accordingly.
1108
  */
1109
+ if ($this->_errors < count($orderIds)) {
1110
  $helper->addSessionMessage(
1111
+ 'adminhtml/session', null, 'success',
1112
+ $this->__('The shipments were successfully created.')
1113
  );
1114
  } else {
1115
  $helper->addSessionMessage(
1149
  */
1150
  $shipments = $this->_loadAndCheckShipments($shipmentIds, true, false);
1151
 
1152
+ switch ($type) {
1153
+ case 'label':
1154
+ $output = $this->_getMassLabelsOutput($shipments);
1155
+ $filename = 'PostNL Shipping Labels-' . date('YmdHis') . '.pdf';
1156
+ break;
1157
+ case 'packing_slip':
1158
+ $output = $this->_getMassPackingSlipsOutput($shipments);
1159
+ $filename = 'PostNL Packing Slips-' . date('YmdHis') . '.pdf';
1160
+ break;
1161
+ default:
1162
+ throw new InvalidArgumentException('Invalid type requested: ' . $type);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1163
  }
1164
 
1165
  /**
1167
  */
1168
  $this->_checkForWarnings();
1169
 
1170
+ if (!$output) {
1171
  $helper->addSessionMessage('adminhtml/session', null, 'error',
1172
  $this->__(
1173
  'Unfortunately no shipments could be processed. Please check the error messages for more ' .
1179
  return $this;
1180
  }
1181
 
 
 
 
 
 
 
 
 
1182
  $this->_preparePdfResponse($filename, $output);
1183
  return $this;
1184
  }
1297
 
1298
  $output = $label->createPdf($labels);
1299
 
1300
+ $filename = 'PostNL Shipping Labels-' . date('YmdHis') . '.pdf';
1301
 
1302
  $this->_preparePdfResponse($filename, $output);
1303
  } catch (TIG_PostNL_Exception $e) {
1368
  */
1369
  foreach ($shipments as $shipment) {
1370
  try {
1371
+ $shipmentLabels = $this->_getLabels($shipment, false);
1372
  $labels = array_merge($labels, $shipmentLabels);
1373
  } catch (TIG_PostNL_Exception $e) {
1374
  $helper->logException($e);
1419
 
1420
  $output = $label->createPdf($labels);
1421
 
1422
+ $fileName = 'PostNL Shipping Labels-' . date('YmdHis') . '.pdf';
1423
 
1424
  $this->_preparePdfResponse($fileName, $output);
1425
  } catch (TIG_PostNL_Model_Core_Cif_Exception $e) {
1611
  */
1612
  $output = $pdf->render();
1613
 
1614
+ $fileName = 'PostNL Packing Slips-'
1615
  . date('Ymd-His', Mage::getSingleton('core/date')->timestamp())
1616
  . '.pdf';
1617
 
app/code/community/TIG/PostNL/controllers/CheckoutController.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_CheckoutController extends Mage_Core_Controller_Front_Action
@@ -607,7 +607,7 @@ class TIG_PostNL_CheckoutController extends Mage_Core_Controller_Front_Action
607
  }
608
 
609
  /**
610
- * Checks if a quote is (still) valid
611
  *
612
  * @param Mage_Sales_Model_Quote $quote
613
  * @param boolean $addErrors
@@ -622,7 +622,7 @@ class TIG_PostNL_CheckoutController extends Mage_Core_Controller_Front_Action
622
  $postnlOrder = Mage::getModel('postnl_core/order')->load($quote->getId(), 'quote_id');
623
 
624
  /**
625
- * Check if the quote is active
626
  */
627
  if (!$quote->getIsActive()) {
628
  if ($addErrors) {
@@ -636,7 +636,7 @@ class TIG_PostNL_CheckoutController extends Mage_Core_Controller_Front_Action
636
  }
637
 
638
  /**
639
- * Check if a valid PostNL order exists for this quote
640
  */
641
  if (!$postnlOrder->getIsActive()
642
  || !$postnlOrder->getId()
@@ -652,7 +652,7 @@ class TIG_PostNL_CheckoutController extends Mage_Core_Controller_Front_Action
652
  }
653
 
654
  /**
655
- * Make sure the cart hasnt changed since we started the checkout process
656
  */
657
  if (Mage::getSingleton('checkout/session')->getCartWasUpdated(true)) {
658
  if ($addErrors) {
@@ -666,7 +666,7 @@ class TIG_PostNL_CheckoutController extends Mage_Core_Controller_Front_Action
666
  }
667
 
668
  /**
669
- * Check if the quote actually has any items
670
  */
671
  if (Mage::helper('checkout/cart')->getItemsCount() < 1) {
672
  if ($addErrors) {
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_CheckoutController extends Mage_Core_Controller_Front_Action
607
  }
608
 
609
  /**
610
+ * Checks if a quote is (still) valid.
611
  *
612
  * @param Mage_Sales_Model_Quote $quote
613
  * @param boolean $addErrors
622
  $postnlOrder = Mage::getModel('postnl_core/order')->load($quote->getId(), 'quote_id');
623
 
624
  /**
625
+ * Check if the quote is active.
626
  */
627
  if (!$quote->getIsActive()) {
628
  if ($addErrors) {
636
  }
637
 
638
  /**
639
+ * Check if a valid PostNL order exists for this quote.
640
  */
641
  if (!$postnlOrder->getIsActive()
642
  || !$postnlOrder->getId()
652
  }
653
 
654
  /**
655
+ * Make sure the cart hasn't changed since we started the checkout process.
656
  */
657
  if (Mage::getSingleton('checkout/session')->getCartWasUpdated(true)) {
658
  if ($addErrors) {
666
  }
667
 
668
  /**
669
+ * Check if the quote actually has any items.
670
  */
671
  if (Mage::helper('checkout/cart')->getItemsCount() < 1) {
672
  if ($addErrors) {
app/code/community/TIG/PostNL/controllers/DeliveryOptionsController.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_DeliveryOptionsController extends Mage_Core_Controller_Front_Action
@@ -50,7 +50,7 @@ class TIG_PostNL_DeliveryOptionsController extends Mage_Core_Controller_Front_Ac
50
  const CITY_NAME_REGEX = '#^[a-zA-Z]+(?:(?:\\s+|-)[a-zA-Z]+)*$#';
51
  const STREET_NAME_REGEX = "#^[a-zA-Z0-9\s,'-]*$#";
52
  const HOUSENR_EXT_REGEX = "#^[a-zA-Z0-9\s,'-]*$#";
53
- const NAME_REGEX = "#^[a-zA-Z0-9\s,'-]*$#";
54
 
55
  /**
56
  * Regular expression to validate dutch phone number.
@@ -371,14 +371,19 @@ class TIG_PostNL_DeliveryOptionsController extends Mage_Core_Controller_Front_Ac
371
  return $this;
372
  }
373
 
374
- if (!is_array($response)) {
 
 
 
 
 
375
  $this->getResponse()
376
  ->setBody('error');
377
 
378
  return $this;
379
  }
380
 
381
- $timeframes = Mage::helper('core')->jsonEncode($response);
382
 
383
  /**
384
  * Return the result as a json response
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_DeliveryOptionsController extends Mage_Core_Controller_Front_Action
50
  const CITY_NAME_REGEX = '#^[a-zA-Z]+(?:(?:\\s+|-)[a-zA-Z]+)*$#';
51
  const STREET_NAME_REGEX = "#^[a-zA-Z0-9\s,'-]*$#";
52
  const HOUSENR_EXT_REGEX = "#^[a-zA-Z0-9\s,'-]*$#";
53
+ const NAME_REGEX = "#^[a-zA-Z0-9\s,'&-]*$#";
54
 
55
  /**
56
  * Regular expression to validate dutch phone number.
371
  return $this;
372
  }
373
 
374
+ /**
375
+ * Filter out unavailable time frames.
376
+ */
377
+ $timeframes = $this->getService()->filterTimeframes($response);
378
+
379
+ if (!$timeframes) {
380
  $this->getResponse()
381
  ->setBody('error');
382
 
383
  return $this;
384
  }
385
 
386
+ $timeframes = Mage::helper('core')->jsonEncode($timeframes);
387
 
388
  /**
389
  * Return the result as a json response
app/code/community/TIG/PostNL/controllers/MijnpakketController.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_MijnpakketController extends Mage_Core_Controller_Front_Action
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
  class TIG_PostNL_MijnpakketController extends Mage_Core_Controller_Front_Action
app/code/community/TIG/PostNL/data/postnl_setup/data-install-1.0.0.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
 
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
 
app/code/community/TIG/PostNL/data/postnl_setup/data-install-1.0.3.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
 
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
 
app/code/community/TIG/PostNL/data/postnl_setup/data-install-1.1.4.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
 
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
 
app/code/community/TIG/PostNL/data/postnl_setup/data-install-1.3.0.php CHANGED
@@ -25,21 +25,23 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @var TIG_PostNL_Model_Resource_Setup $installer
40
  */
41
  $installer = $this;
42
 
 
 
43
  /**
44
  * This attribute needs to be updated for simple products.
45
  */
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  *
39
  * @var TIG_PostNL_Model_Resource_Setup $installer
40
  */
41
  $installer = $this;
42
 
43
+ set_time_limit(0);
44
+
45
  /**
46
  * This attribute needs to be updated for simple products.
47
  */
app/code/community/TIG/PostNL/data/postnl_setup/data-install-1.4.0.php ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ *
39
+ * @var TIG_PostNL_Model_Resource_Setup $installer
40
+ */
41
+ $installer = $this;
42
+
43
+ set_time_limit(0);
44
+
45
+ /**
46
+ * This attribute needs to be updated for simple products.
47
+ */
48
+ $simpleAttributesData = array(
49
+ 'postnl_max_qty_for_buspakje' => 0,
50
+ );
51
+
52
+ /**
53
+ * These attributes need to be updated for the product types specified below.
54
+ */
55
+ $attributesData = array(
56
+ 'postnl_allow_pakje_gemak' => 1,
57
+ 'postnl_allow_delivery_days' => 1,
58
+ 'postnl_allow_timeframes' => 1,
59
+ 'postnl_allow_pakketautomaat' => 1,
60
+ 'postnl_allow_delivery_options' => 1,
61
+ );
62
+
63
+ $productTypes = array(
64
+ Mage_Catalog_Model_Product_Type::TYPE_SIMPLE,
65
+ Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE,
66
+ Mage_Catalog_Model_Product_Type::TYPE_GROUPED,
67
+ Mage_Catalog_Model_Product_Type::TYPE_BUNDLE,
68
+ );
69
+
70
+ /**
71
+ * Matrix rate data.
72
+ */
73
+ $matrixRateData = array(
74
+ array('NL', '*', '*', '0', '0', '0', 'regular', '5'), // Regular Dutch shipments
75
+ array('NL', '*', '*', '0', '0', '0', 'letter_box', '2.5'), // Dutch buspakje shipments
76
+ array('BE', '*', '*', '0', '0', '0', '*', '5'), // Belgian shipments
77
+ array('BE', '*', '*', '1', '0', '0', '*', '5'),
78
+ array('BE', '*', '*', '2', '0', '0', '*', '5'),
79
+ array('BE', '*', '*', '3', '0', '0', '*', '5'),
80
+ array('BE', '*', '*', '4', '0', '0', '*', '5'),
81
+ array('BE', '*', '*', '5', '0', '0', '*', '5'),
82
+ array('BE', '*', '*', '6', '0', '0', '*', '5'),
83
+ array('BE', '*', '*', '7', '0', '0', '*', '5'),
84
+ array('BE', '*', '*', '8', '0', '0', '*', '5'),
85
+ array('BE', '*', '*', '9', '0', '0', '*', '5'),
86
+ array('BE', '*', '*', '10', '0', '0', '*', '5'),
87
+ array('BE', '*', '*', '11', '0', '0', '*', '5'),
88
+ array('BE', '*', '*', '12', '0', '0', '*', '5'),
89
+ array('BE', '*', '*', '13', '0', '0', '*', '5'),
90
+ array('BE', '*', '*', '14', '0', '0', '*', '5'),
91
+ array('BE', '*', '*', '15', '0', '0', '*', '5'),
92
+ array('BE', '*', '*', '16', '0', '0', '*', '5'),
93
+ array('BE', '*', '*', '17', '0', '0', '*', '5'),
94
+ array('BE', '*', '*', '18', '0', '0', '*', '5'),
95
+ array('BE', '*', '*', '19', '0', '0', '*', '5'),
96
+ array('BE', '*', '*', '20', '0', '0', '*', '5'),
97
+ array('BE', '*', '*', '21', '0', '0', '*', '5'),
98
+ array('BE', '*', '*', '22', '0', '0', '*', '5'),
99
+ array('BE', '*', '*', '23', '0', '0', '*', '5'),
100
+ array('BE', '*', '*', '24', '0', '0', '*', '5'),
101
+ array('BE', '*', '*', '25', '0', '0', '*', '5'),
102
+ array('BE', '*', '*', '26', '0', '0', '*', '5'),
103
+ array('BE', '*', '*', '27', '0', '0', '*', '5'),
104
+ array('BE', '*', '*', '28', '0', '0', '*', '5'),
105
+ array('BE', '*', '*', '29', '0', '0', '*', '5'),
106
+ array('DE', '*', '*', '0', '0', '0', '*', '5'), // German shipments
107
+ array('DE', '*', '*', '1', '0', '0', '*', '5'),
108
+ array('DE', '*', '*', '2', '0', '0', '*', '5'),
109
+ array('DE', '*', '*', '3', '0', '0', '*', '5'),
110
+ array('DE', '*', '*', '4', '0', '0', '*', '5'),
111
+ array('DE', '*', '*', '5', '0', '0', '*', '5'),
112
+ array('DE', '*', '*', '6', '0', '0', '*', '5'),
113
+ array('DE', '*', '*', '7', '0', '0', '*', '5'),
114
+ array('DE', '*', '*', '8', '0', '0', '*', '5'),
115
+ array('DE', '*', '*', '9', '0', '0', '*', '5'),
116
+ array('DE', '*', '*', '10', '0', '0', '*', '5'),
117
+ array('DE', '*', '*', '11', '0', '0', '*', '5'),
118
+ array('DE', '*', '*', '12', '0', '0', '*', '5'),
119
+ array('DE', '*', '*', '13', '0', '0', '*', '5'),
120
+ array('DE', '*', '*', '14', '0', '0', '*', '5'),
121
+ array('DE', '*', '*', '15', '0', '0', '*', '5'),
122
+ array('DE', '*', '*', '16', '0', '0', '*', '5'),
123
+ array('DE', '*', '*', '17', '0', '0', '*', '5'),
124
+ array('DE', '*', '*', '18', '0', '0', '*', '5'),
125
+ array('DE', '*', '*', '19', '0', '0', '*', '5'),
126
+ array('DE', '*', '*', '20', '0', '0', '*', '5'),
127
+ array('DE', '*', '*', '21', '0', '0', '*', '5'),
128
+ array('DE', '*', '*', '22', '0', '0', '*', '5'),
129
+ array('DE', '*', '*', '23', '0', '0', '*', '5'),
130
+ array('DE', '*', '*', '24', '0', '0', '*', '5'),
131
+ array('DE', '*', '*', '25', '0', '0', '*', '5'),
132
+ array('DE', '*', '*', '26', '0', '0', '*', '5'),
133
+ array('DE', '*', '*', '27', '0', '0', '*', '5'),
134
+ array('DE', '*', '*', '28', '0', '0', '*', '5'),
135
+ array('DE', '*', '*', '29', '0', '0', '*', '5'),
136
+ array('*', '*', '*', '0', '0', '0', '*', '5'), // GlobalPack shipments
137
+ );
138
+
139
+ $installer->generateShippingStatusCronExpr()
140
+ ->generateUpdateStatisticsCronExpr()
141
+ ->expandSupportTab()
142
+ ->installTestPassword()
143
+ ->installWebshopId()
144
+ ->installPackingSlipItemColumns()
145
+ ->setProductAttributeUpdateCron(
146
+ array(
147
+ array(
148
+ $simpleAttributesData,
149
+ array(Mage_Catalog_Model_Product_Type::TYPE_SIMPLE),
150
+ ),
151
+ array(
152
+ $attributesData,
153
+ $productTypes,
154
+ )
155
+ )
156
+ )
157
+ ->installMatrixRates($matrixRateData)
158
+ ->clearConfigCache();
app/code/community/TIG/PostNL/data/postnl_setup/data-install-1.4.1.php ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ *
39
+ * @var TIG_PostNL_Model_Resource_Setup $installer
40
+ */
41
+ $installer = $this;
42
+
43
+ set_time_limit(0);
44
+
45
+ /**
46
+ * This attribute needs to be updated for simple products.
47
+ */
48
+ $simpleAttributesData = array(
49
+ 'postnl_max_qty_for_buspakje' => 0,
50
+ );
51
+
52
+ /**
53
+ * These attributes need to be updated for the product types specified below.
54
+ */
55
+ $attributesData = array(
56
+ 'postnl_allow_pakje_gemak' => 1,
57
+ 'postnl_allow_delivery_days' => 1,
58
+ 'postnl_allow_timeframes' => 1,
59
+ 'postnl_allow_pakketautomaat' => 1,
60
+ 'postnl_allow_delivery_options' => 1,
61
+ );
62
+
63
+ $productTypes = array(
64
+ Mage_Catalog_Model_Product_Type::TYPE_SIMPLE,
65
+ Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE,
66
+ Mage_Catalog_Model_Product_Type::TYPE_GROUPED,
67
+ Mage_Catalog_Model_Product_Type::TYPE_BUNDLE,
68
+ );
69
+
70
+ /**
71
+ * Matrix rate data.
72
+ */
73
+ $matrixRateData = array(
74
+ array('NL', '*', '*', '0', '0', '0', 'regular', '5'), // Regular Dutch shipments
75
+ array('NL', '*', '*', '0', '0', '0', 'letter_box', '2.5'), // Dutch buspakje shipments
76
+ array('BE', '*', '*', '0', '0', '0', '*', '5'), // Belgian shipments
77
+ array('BE', '*', '*', '1', '0', '0', '*', '5'),
78
+ array('BE', '*', '*', '2', '0', '0', '*', '5'),
79
+ array('BE', '*', '*', '3', '0', '0', '*', '5'),
80
+ array('BE', '*', '*', '4', '0', '0', '*', '5'),
81
+ array('BE', '*', '*', '5', '0', '0', '*', '5'),
82
+ array('BE', '*', '*', '6', '0', '0', '*', '5'),
83
+ array('BE', '*', '*', '7', '0', '0', '*', '5'),
84
+ array('BE', '*', '*', '8', '0', '0', '*', '5'),
85
+ array('BE', '*', '*', '9', '0', '0', '*', '5'),
86
+ array('BE', '*', '*', '10', '0', '0', '*', '5'),
87
+ array('BE', '*', '*', '11', '0', '0', '*', '5'),
88
+ array('BE', '*', '*', '12', '0', '0', '*', '5'),
89
+ array('BE', '*', '*', '13', '0', '0', '*', '5'),
90
+ array('BE', '*', '*', '14', '0', '0', '*', '5'),
91
+ array('BE', '*', '*', '15', '0', '0', '*', '5'),
92
+ array('BE', '*', '*', '16', '0', '0', '*', '5'),
93
+ array('BE', '*', '*', '17', '0', '0', '*', '5'),
94
+ array('BE', '*', '*', '18', '0', '0', '*', '5'),
95
+ array('BE', '*', '*', '19', '0', '0', '*', '5'),
96
+ array('BE', '*', '*', '20', '0', '0', '*', '5'),
97
+ array('BE', '*', '*', '21', '0', '0', '*', '5'),
98
+ array('BE', '*', '*', '22', '0', '0', '*', '5'),
99
+ array('BE', '*', '*', '23', '0', '0', '*', '5'),
100
+ array('BE', '*', '*', '24', '0', '0', '*', '5'),
101
+ array('BE', '*', '*', '25', '0', '0', '*', '5'),
102
+ array('BE', '*', '*', '26', '0', '0', '*', '5'),
103
+ array('BE', '*', '*', '27', '0', '0', '*', '5'),
104
+ array('BE', '*', '*', '28', '0', '0', '*', '5'),
105
+ array('BE', '*', '*', '29', '0', '0', '*', '5'),
106
+ array('DE', '*', '*', '0', '0', '0', '*', '5'), // German shipments
107
+ array('DE', '*', '*', '1', '0', '0', '*', '5'),
108
+ array('DE', '*', '*', '2', '0', '0', '*', '5'),
109
+ array('DE', '*', '*', '3', '0', '0', '*', '5'),
110
+ array('DE', '*', '*', '4', '0', '0', '*', '5'),
111
+ array('DE', '*', '*', '5', '0', '0', '*', '5'),
112
+ array('DE', '*', '*', '6', '0', '0', '*', '5'),
113
+ array('DE', '*', '*', '7', '0', '0', '*', '5'),
114
+ array('DE', '*', '*', '8', '0', '0', '*', '5'),
115
+ array('DE', '*', '*', '9', '0', '0', '*', '5'),
116
+ array('DE', '*', '*', '10', '0', '0', '*', '5'),
117
+ array('DE', '*', '*', '11', '0', '0', '*', '5'),
118
+ array('DE', '*', '*', '12', '0', '0', '*', '5'),
119
+ array('DE', '*', '*', '13', '0', '0', '*', '5'),
120
+ array('DE', '*', '*', '14', '0', '0', '*', '5'),
121
+ array('DE', '*', '*', '15', '0', '0', '*', '5'),
122
+ array('DE', '*', '*', '16', '0', '0', '*', '5'),
123
+ array('DE', '*', '*', '17', '0', '0', '*', '5'),
124
+ array('DE', '*', '*', '18', '0', '0', '*', '5'),
125
+ array('DE', '*', '*', '19', '0', '0', '*', '5'),
126
+ array('DE', '*', '*', '20', '0', '0', '*', '5'),
127
+ array('DE', '*', '*', '21', '0', '0', '*', '5'),
128
+ array('DE', '*', '*', '22', '0', '0', '*', '5'),
129
+ array('DE', '*', '*', '23', '0', '0', '*', '5'),
130
+ array('DE', '*', '*', '24', '0', '0', '*', '5'),
131
+ array('DE', '*', '*', '25', '0', '0', '*', '5'),
132
+ array('DE', '*', '*', '26', '0', '0', '*', '5'),
133
+ array('DE', '*', '*', '27', '0', '0', '*', '5'),
134
+ array('DE', '*', '*', '28', '0', '0', '*', '5'),
135
+ array('DE', '*', '*', '29', '0', '0', '*', '5'),
136
+ array('*', '*', '*', '0', '0', '0', '*', '5'), // GlobalPack shipments
137
+ );
138
+
139
+ $installer->generateShippingStatusCronExpr()
140
+ ->generateUpdateStatisticsCronExpr()
141
+ ->expandSupportTab()
142
+ ->installTestPassword()
143
+ ->installWebshopId()
144
+ ->installPackingSlipItemColumns()
145
+ ->setProductAttributeUpdateCron(
146
+ array(
147
+ array(
148
+ $simpleAttributesData,
149
+ array(Mage_Catalog_Model_Product_Type::TYPE_SIMPLE),
150
+ ),
151
+ array(
152
+ $attributesData,
153
+ $productTypes,
154
+ )
155
+ )
156
+ )
157
+ ->installMatrixRates($matrixRateData)
158
+ ->clearConfigCache();
app/code/community/TIG/PostNL/data/postnl_setup/data-upgrade-1.1.5-1.2.0.php CHANGED
@@ -25,15 +25,15 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
 
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
  */
39
 
app/code/community/TIG/PostNL/data/postnl_setup/data-upgrade-1.2.2-1.3.0.php CHANGED
@@ -25,16 +25,18 @@
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
35
  *
36
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
 
 
38
  */
39
 
40
  /**
@@ -42,6 +44,8 @@
42
  */
43
  $installer = $this;
44
 
 
 
45
  /**
46
  * A new ACL role has been added for the config page.
47
  */
25
  * It is available through the world-wide-web at this URL:
26
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
  * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
  *
30
  * DISCLAIMER
31
  *
32
  * Do not edit or add to this file if you wish to upgrade this module to newer
33
  * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
  *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ *
39
+ * @deprecated This file has been superseded by the data-upgrade-1.2.2-1.4.0.php file.
40
  */
41
 
42
  /**
44
  */
45
  $installer = $this;
46
 
47
+ set_time_limit(0);
48
+
49
  /**
50
  * A new ACL role has been added for the config page.
51
  */
app/code/community/TIG/PostNL/data/postnl_setup/data-upgrade-1.2.2-1.4.0.php ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+
40
+ /**
41
+ * @var TIG_PostNL_Model_Resource_Setup $installer
42
+ */
43
+ $installer = $this;
44
+
45
+ /**
46
+ * A new ACL role has been added for the config page.
47
+ */
48
+ $newConfigAclResources = array(
49
+ 'admin/system/config/postnl/download_logs',
50
+ );
51
+ $configRequiredResources = array(
52
+ 'admin/system/',
53
+ 'admin/system/config',
54
+ 'admin/system/config/postnl',
55
+ 'admin/system/config/convert',
56
+ 'admin/system/config/convert/to_buspakje',
57
+ 'admin/system/config/convert/to_package',
58
+ 'admin/system/config/convert/change_product_code',
59
+ );
60
+
61
+ /**
62
+ * A new ACl role has also been added for printing packing slips.
63
+ */
64
+ $newPostnLAclResources = array(
65
+ 'admin/postnl/shipment/actions/print_label/print_packing_slips',
66
+ );
67
+ $postnlRequiredResources = array(
68
+ 'admin/postnl',
69
+ 'admin/postnl/shipment',
70
+ 'admin/postnl/shipment/actions',
71
+ 'admin/postnl/shipment/actions/print_label',
72
+ );
73
+
74
+ /**
75
+ * This attribute needs to be updated for simple products.
76
+ */
77
+ $simpleAttributesData = array(
78
+ 'postnl_max_qty_for_buspakje' => 0,
79
+ );
80
+
81
+ /**
82
+ * These attributes need to be updated for the product types specified below.
83
+ */
84
+ $attributesData = array(
85
+ 'postnl_allow_pakje_gemak' => 1,
86
+ 'postnl_allow_delivery_days' => 1,
87
+ 'postnl_allow_timeframes' => 1,
88
+ 'postnl_allow_pakketautomaat' => 1,
89
+ 'postnl_allow_delivery_options' => 1,
90
+ );
91
+
92
+ /**
93
+ * The attributes need to be updated for these product types.
94
+ */
95
+ $productTypes = array(
96
+ Mage_Catalog_Model_Product_Type::TYPE_SIMPLE,
97
+ Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE,
98
+ Mage_Catalog_Model_Product_Type::TYPE_GROUPED,
99
+ Mage_Catalog_Model_Product_Type::TYPE_BUNDLE,
100
+ );
101
+
102
+ /**
103
+ * Matrix rate data.
104
+ */
105
+ $matrixrateData = array(
106
+ array('NL', '*', '*', '0', '0', '0', 'regular', '5'), // Regular dutch shipments
107
+ array('NL', '*', '*', '0', '0', '0', 'letter_box', '2.5'), // Dutch buspakje shipments
108
+ array('BE', '*', '*', '0', '0', '0', '*', '5'), // Belgian shipments
109
+ array('BE', '*', '*', '1', '0', '0', '*', '5'),
110
+ array('BE', '*', '*', '2', '0', '0', '*', '5'),
111
+ array('BE', '*', '*', '3', '0', '0', '*', '5'),
112
+ array('BE', '*', '*', '4', '0', '0', '*', '5'),
113
+ array('BE', '*', '*', '5', '0', '0', '*', '5'),
114
+ array('BE', '*', '*', '6', '0', '0', '*', '5'),
115
+ array('BE', '*', '*', '7', '0', '0', '*', '5'),
116
+ array('BE', '*', '*', '8', '0', '0', '*', '5'),
117
+ array('BE', '*', '*', '9', '0', '0', '*', '5'),
118
+ array('BE', '*', '*', '10', '0', '0', '*', '5'),
119
+ array('BE', '*', '*', '11', '0', '0', '*', '5'),
120
+ array('BE', '*', '*', '12', '0', '0', '*', '5'),
121
+ array('BE', '*', '*', '13', '0', '0', '*', '5'),
122
+ array('BE', '*', '*', '14', '0', '0', '*', '5'),
123
+ array('BE', '*', '*', '15', '0', '0', '*', '5'),
124
+ array('BE', '*', '*', '16', '0', '0', '*', '5'),
125
+ array('BE', '*', '*', '17', '0', '0', '*', '5'),
126
+ array('BE', '*', '*', '18', '0', '0', '*', '5'),
127
+ array('BE', '*', '*', '19', '0', '0', '*', '5'),
128
+ array('BE', '*', '*', '20', '0', '0', '*', '5'),
129
+ array('BE', '*', '*', '21', '0', '0', '*', '5'),
130
+ array('BE', '*', '*', '22', '0', '0', '*', '5'),
131
+ array('BE', '*', '*', '23', '0', '0', '*', '5'),
132
+ array('BE', '*', '*', '24', '0', '0', '*', '5'),
133
+ array('BE', '*', '*', '25', '0', '0', '*', '5'),
134
+ array('BE', '*', '*', '26', '0', '0', '*', '5'),
135
+ array('BE', '*', '*', '27', '0', '0', '*', '5'),
136
+ array('BE', '*', '*', '28', '0', '0', '*', '5'),
137
+ array('BE', '*', '*', '29', '0', '0', '*', '5'),
138
+ array('DE', '*', '*', '0', '0', '0', '*', '5'), // German shipments
139
+ array('DE', '*', '*', '1', '0', '0', '*', '5'),
140
+ array('DE', '*', '*', '2', '0', '0', '*', '5'),
141
+ array('DE', '*', '*', '3', '0', '0', '*', '5'),
142
+ array('DE', '*', '*', '4', '0', '0', '*', '5'),
143
+ array('DE', '*', '*', '5', '0', '0', '*', '5'),
144
+ array('DE', '*', '*', '6', '0', '0', '*', '5'),
145
+ array('DE', '*', '*', '7', '0', '0', '*', '5'),
146
+ array('DE', '*', '*', '8', '0', '0', '*', '5'),
147
+ array('DE', '*', '*', '9', '0', '0', '*', '5'),
148
+ array('DE', '*', '*', '10', '0', '0', '*', '5'),
149
+ array('DE', '*', '*', '11', '0', '0', '*', '5'),
150
+ array('DE', '*', '*', '12', '0', '0', '*', '5'),
151
+ array('DE', '*', '*', '13', '0', '0', '*', '5'),
152
+ array('DE', '*', '*', '14', '0', '0', '*', '5'),
153
+ array('DE', '*', '*', '15', '0', '0', '*', '5'),
154
+ array('DE', '*', '*', '16', '0', '0', '*', '5'),
155
+ array('DE', '*', '*', '17', '0', '0', '*', '5'),
156
+ array('DE', '*', '*', '18', '0', '0', '*', '5'),
157
+ array('DE', '*', '*', '19', '0', '0', '*', '5'),
158
+ array('DE', '*', '*', '20', '0', '0', '*', '5'),
159
+ array('DE', '*', '*', '21', '0', '0', '*', '5'),
160
+ array('DE', '*', '*', '22', '0', '0', '*', '5'),
161
+ array('DE', '*', '*', '23', '0', '0', '*', '5'),
162
+ array('DE', '*', '*', '24', '0', '0', '*', '5'),
163
+ array('DE', '*', '*', '25', '0', '0', '*', '5'),
164
+ array('DE', '*', '*', '26', '0', '0', '*', '5'),
165
+ array('DE', '*', '*', '27', '0', '0', '*', '5'),
166
+ array('DE', '*', '*', '28', '0', '0', '*', '5'),
167
+ array('DE', '*', '*', '29', '0', '0', '*', '5'),
168
+ array('*', '*', '*', '0', '0', '0', '*', '5'), // GlobalPack shipments
169
+ );
170
+
171
+ /**
172
+ * In this new version we need to fill the new 'order_id' and 'shipment_type' columns. We also need to add several new
173
+ * ACL rules and add several new support product codes for 'buspakje' and COD shipments, and update several attribute
174
+ * values for existing products. We've also moved several config settings, so we need to copy the previous settings
175
+ * there. Otherwise the existing configuration will be lost.
176
+ */
177
+ $installer->setOrderId()
178
+ ->setShipmentType()
179
+ ->setIsBuspakje()
180
+ ->addAclRules($newConfigAclResources, $configRequiredResources)
181
+ ->addAclRules($newPostnLAclResources, $postnlRequiredResources)
182
+ ->addSupportedProductCode(
183
+ array(
184
+ '2828',
185
+ '2928',
186
+ '3086',
187
+ '3091',
188
+ '3093',
189
+ '3097',
190
+ '3535',
191
+ '3545',
192
+ '3536',
193
+ '3546'
194
+ )
195
+ )
196
+ ->installPackingSlipItemColumns()
197
+ ->setProductAttributeUpdateCron(
198
+ array(
199
+ array(
200
+ $simpleAttributesData,
201
+ array(Mage_Catalog_Model_Product_Type::TYPE_SIMPLE),
202
+ ),
203
+ array(
204
+ $attributesData,
205
+ $productTypes,
206
+ )
207
+ )
208
+ )
209
+ ->moveConfigSetting(
210
+ 'postnl/delivery_options/shipping_duration',
211
+ 'postnl/cif_labels_and_confirming/shipping_duration',
212
+ true
213
+ )
214
+ ->moveConfigSetting(
215
+ 'postnl/delivery_options/cutoff_time',
216
+ 'postnl/cif_labels_and_confirming/cutoff_time',
217
+ true
218
+ )
219
+ ->moveConfigSetting(
220
+ 'postnl/delivery_options/allow_sunday_sorting',
221
+ 'postnl/cif_labels_and_confirming/allow_sunday_sorting',
222
+ true
223
+ )
224
+ ->moveConfigSetting(
225
+ 'postnl/delivery_options/sunday_cutoff_time',
226
+ 'postnl/cif_labels_and_confirming/sunday_cutoff_time',
227
+ true
228
+ )
229
+ ->installMatrixRates($matrixrateData)
230
+ ->clearConfigCache();
app/code/community/TIG/PostNL/data/postnl_setup/data-upgrade-1.3.1-1.4.0.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web, please send an email
28
+ * to servicedesk@tig.nl so we can send you a copy immediately.
29
+ *
30
+ * DISCLAIMER
31
+ *
32
+ * Do not edit or add to this file if you wish to upgrade this module to newer
33
+ * versions in the future. If you wish to customize this module for your
34
+ * needs please contact servicedesk@tig.nl for more information.
35
+ *
36
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
37
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
38
+ */
39
+
40
+ /**
41
+ * @var TIG_PostNL_Model_Resource_Setup $installer
42
+ */
43
+ $installer = $this;
44
+
45
+ /**
46
+ * Matrix rate data.
47
+ */
48
+ $matrixRateData = array(
49
+ array('NL', '*', '*', '0', '0', '0', 'regular', '5'), // Regular Dutch shipments
50
+ array('NL', '*', '*', '0', '0', '0', 'letter_box', '2.5'), // Dutch buspakje shipments
51
+ array('BE', '*', '*', '0', '0', '0', '*', '5'), // Belgian shipments
52
+ array('BE', '*', '*', '1', '0', '0', '*', '5'),
53
+ array('BE', '*', '*', '2', '0', '0', '*', '5'),
54
+ array('BE', '*', '*', '3', '0', '0', '*', '5'),
55
+ array('BE', '*', '*', '4', '0', '0', '*', '5'),
56
+ array('BE', '*', '*', '5', '0', '0', '*', '5'),
57
+ array('BE', '*', '*', '6', '0', '0', '*', '5'),
58
+ array('BE', '*', '*', '7', '0', '0', '*', '5'),
59
+ array('BE', '*', '*', '8', '0', '0', '*', '5'),
60
+ array('BE', '*', '*', '9', '0', '0', '*', '5'),
61
+ array('BE', '*', '*', '10', '0', '0', '*', '5'),
62
+ array('BE', '*', '*', '11', '0', '0', '*', '5'),
63
+ array('BE', '*', '*', '12', '0', '0', '*', '5'),
64
+ array('BE', '*', '*', '13', '0', '0', '*', '5'),
65
+ array('BE', '*', '*', '14', '0', '0', '*', '5'),
66
+ array('BE', '*', '*', '15', '0', '0', '*', '5'),
67
+ array('BE', '*', '*', '16', '0', '0', '*', '5'),
68
+ array('BE', '*', '*', '17', '0', '0', '*', '5'),
69
+ array('BE', '*', '*', '18', '0', '0', '*', '5'),
70
+ array('BE', '*', '*', '19', '0', '0', '*', '5'),
71
+ array('BE', '*', '*', '20', '0', '0', '*', '5'),
72
+ array('BE', '*', '*', '21', '0', '0', '*', '5'),
73
+ array('BE', '*', '*', '22', '0', '0', '*', '5'),
74
+ array('BE', '*', '*', '23', '0', '0', '*', '5'),
75
+ array('BE', '*', '*', '24', '0', '0', '*', '5'),
76
+ array('BE', '*', '*', '25', '0', '0', '*', '5'),
77
+ array('BE', '*', '*', '26', '0', '0', '*', '5'),
78
+ array('BE', '*', '*', '27', '0', '0', '*', '5'),
79
+ array('BE', '*', '*', '28', '0', '0', '*', '5'),
80
+ array('BE', '*', '*', '29', '0', '0', '*', '5'),
81
+ array('DE', '*', '*', '0', '0', '0', '*', '5'), // German shipments
82
+ array('DE', '*', '*', '1', '0', '0', '*', '5'),
83
+ array('DE', '*', '*', '2', '0', '0', '*', '5'),
84
+ array('DE', '*', '*', '3', '0', '0', '*', '5'),
85
+ array('DE', '*', '*', '4', '0', '0', '*', '5'),
86
+ array('DE', '*', '*', '5', '0', '0', '*', '5'),
87
+ array('DE', '*', '*', '6', '0', '0', '*', '5'),
88
+ array('DE', '*', '*', '7', '0', '0', '*', '5'),
89
+ array('DE', '*', '*', '8', '0', '0', '*', '5'),
90
+ array('DE', '*', '*', '9', '0', '0', '*', '5'),
91
+ array('DE', '*', '*', '10', '0', '0', '*', '5'),
92
+ array('DE', '*', '*', '11', '0', '0', '*', '5'),
93
+ array('DE', '*', '*', '12', '0', '0', '*', '5'),
94
+ array('DE', '*', '*', '13', '0', '0', '*', '5'),
95
+ array('DE', '*', '*', '14', '0', '0', '*', '5'),
96
+ array('DE', '*', '*', '15', '0', '0', '*', '5'),
97
+ array('DE', '*', '*', '16', '0', '0', '*', '5'),
98
+ array('DE', '*', '*', '17', '0', '0', '*', '5'),
99
+ array('DE', '*', '*', '18', '0', '0', '*', '5'),
100
+ array('DE', '*', '*', '19', '0', '0', '*', '5'),
101
+ array('DE', '*', '*', '20', '0', '0', '*', '5'),
102
+ array('DE', '*', '*', '21', '0', '0', '*', '5'),
103
+ array('DE', '*', '*', '22', '0', '0', '*', '5'),
104
+ array('DE', '*', '*', '23', '0', '0', '*', '5'),
105
+ array('DE', '*', '*', '24', '0', '0', '*', '5'),
106
+ array('DE', '*', '*', '25', '0', '0', '*', '5'),
107
+ array('DE', '*', '*', '26', '0', '0', '*', '5'),
108
+ array('DE', '*', '*', '27', '0', '0', '*', '5'),
109
+ array('DE', '*', '*', '28', '0', '0', '*', '5'),
110
+ array('DE', '*', '*', '29', '0', '0', '*', '5'),
111
+ array('*', '*', '*', '0', '0', '0', '*', '5'), // GlobalPack shipments
112
+ );
113
+
114
+ $installer->installMatrixRates($matrixRateData)
115
+ ->addSupportedShippingMethods(array('postnl_matrixrate'))
116
+ ->clearConfigCache();
app/code/community/TIG/PostNL/data/postnl_setup/data-upgrade-1.4.0-1.4.1.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * ___________ __ __
4
+ * \__ ___/____ _/ |_ _____ | |
5
+ * | | / _ \\ __\\__ \ | |
6
+ * | | | |_| || | / __ \_| |__
7
+ * |____| \____/ |__| (____ /|____/
8
+ * \/
9
+ * ___ __ __
10
+ * | | ____ _/ |_ ____ _______ ____ ____ _/ |_
11
+ * | | / \\ __\_/ __ \\_ __ \ / \ _/ __ \\ __\
12
+ * | || | \| | \ ___/ | | \/| | \\ ___/ | |
13
+ * |___||___| /|__| \_____>|__| |___| / \_____>|__|
14
+ * \/ \/
15
+ * ________
16
+ * / _____/_______ ____ __ __ ______
17
+ * / \ ___\_ __ \ / _ \ | | \\____ \
18
+ * \ \_\ \| | \/| |_| || | /| |_| |
19
+ * \______ /|__| \____/ |____/ | __/
20
+ * \/ |__|
21
+ *
22
+ * NOTICE OF LICENSE
23
+ *
24
+ * This source file is subject to the Creative Commons License.
25
+ * It is available through the world-wide-web at this URL:
26
+ * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
27
+ * If you are unable to obtain it through the world-wide-web,
28
+ * please send an email
29
+ * to servicedesk@tig.nl so we can send you a copy immediately.
30
+ *
31
+ * DISCLAIMER
32
+ *
33
+ * Do not edit or add to this file if you wish to upgrade this module to newer
34
+ * versions in the future. If you wish to customize this module for your
35
+ * needs please contact servicedesk@tig.nl for more information.
36
+ *
37
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
38
+ * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
39
+ *
40
+ * @var TIG_PostNL_Model_Resource_Setup $installer
41
+ */
42
+ $installer = $this;
43
+
44
+ $settingsToMove = array(
45
+ 'postnl/cif_return_address/firstname' => 'postnl/cif_address/return_firstname',
46
+ 'postnl/cif_return_address/lastname' => 'postnl/cif_address/return_lastname',
47
+ 'postnl/cif_return_address/company' => 'postnl/cif_address/return_company',
48
+ 'postnl/cif_return_address/department' => 'postnl/cif_address/return_department',
49
+ 'postnl/cif_return_address/streetname' => 'postnl/cif_address/return_streetname',
50
+ 'postnl/cif_return_address/housenumber' => 'postnl/cif_address/return_housenumber',
51
+ 'postnl/cif_return_address/housenumber_extension' => 'postnl/cif_address/return_housenumber_extension',
52
+ 'postnl/cif_return_address/postcode' => 'postnl/cif_address/return_postcode',
53
+ 'postnl/cif_return_address/city' => 'postnl/cif_address/return_city',
54
+ 'postnl/cif_return_address/region' => 'postnl/cif_address/return_region',
55
+ 'postnl/cif_return_address/country' => 'postnl/cif_address/return_country',
56
+ 'postnl/cif_return_address/use_sender_address' => 'postnl/cif_address/use_sender_address',
57
+ 'postnl/cif/use_globalpack' => 'postnl/cif_globalpack_settings/use_globalpack',
58
+ 'postnl/cif/global_barcode_type' => 'postnl/cif_globalpack_settings/global_barcode_type',
59
+ 'postnl/cif/global_barcode_range' => 'postnl/cif_globalpack_settings/global_barcode_range',
60
+ 'postnl/cif_labels_and_confirming/weight_per_parcel' => 'postnl/packing_slip/weight_per_parcel',
61
+ 'postnl/cif_labels_and_confirming/weight_unit' => 'postnl/packing_slip/weight_unit',
62
+ 'postnl/cif_labels_and_confirming/shipment_reference_type' => 'postnl/packing_slip/shipment_reference_type',
63
+ 'postnl/cif_labels_and_confirming/custom_shipment_reference' => 'postnl/packing_slip/custom_shipment_reference',
64
+ 'postnl/cif_product_options/default_cod_product_option' => 'postnl/cod/default_cod_product_option',
65
+ 'postnl/cif_product_options/default_evening_cod_product_option' => 'postnl/cod/default_evening_cod_product_option',
66
+ 'postnl/cif_product_options/default_pakjegemak_cod_product_option' => 'postnl/cod/default_pakjegemak_cod_product_option',
67
+ 'postnl/cif_product_options/default_pge_cod_product_option' => 'postnl/cod/default_pge_cod_product_option',
68
+ 'postnl/cif_labels_and_confirming/send_track_and_trace_email' => 'postnl/track_and_trace/send_track_and_trace_email',
69
+ 'postnl/cif_labels_and_confirming/track_and_trace_email_template' => 'postnl/track_and_trace/track_and_trace_email_template',
70
+ 'postnl/cif_labels_and_confirming/send_copy' => 'postnl/track_and_trace/send_copy',
71
+ 'postnl/cif_labels_and_confirming/copy_to' => 'postnl/track_and_trace/copy_to',
72
+ 'postnl/cif_labels_and_confirming/copy_method' => 'postnl/track_and_trace/copy_method',
73
+ 'postnl/cif_labels_and_confirming/show_grid_options' => 'postnl/grid/show_grid_options',
74
+ 'postnl/cif_labels_and_confirming/show_buspakje_option' => 'postnl/grid/show_buspakje_option',
75
+ 'postnl/cif_labels_and_confirming/order_grid_columns' => 'postnl/grid/order_grid_columns',
76
+ 'postnl/cif_labels_and_confirming/order_grid_massaction_default' => 'postnl/grid/order_grid_massaction_default',
77
+ 'postnl/cif_labels_and_confirming/shipping_grid_columns' => 'postnl/grid/shipping_grid_columns',
78
+ 'postnl/cif_labels_and_confirming/shipping_grid_massaction_default' => 'postnl/grid/shipping_grid_massaction_default',
79
+ 'postnl/cif_product_options/supported_product_options' => 'postnl/grid/supported_product_options',
80
+ 'postnl/cif_sender_address/firstname' => 'postnl/cif_address/firstname',
81
+ 'postnl/cif_sender_address/lastname' => 'postnl/cif_address/lastname',
82
+ 'postnl/cif_sender_address/company' => 'postnl/cif_address/company',
83
+ 'postnl/cif_sender_address/department' => 'postnl/cif_address/department',
84
+ 'postnl/cif_sender_address/streetname' => 'postnl/cif_address/streetname',
85
+ 'postnl/cif_sender_address/housenumber' => 'postnl/cif_address/housenumber',
86
+ 'postnl/cif_sender_address/housenumber_extension' => 'postnl/cif_address/housenumber_extension',
87
+ 'postnl/cif_sender_address/postcode' => 'postnl/cif_address/postcode',
88
+ 'postnl/cif_sender_address/city' => 'postnl/cif_address/city',
89
+ 'postnl/cif_sender_address/region' => 'postnl/cif_address/region',
90
+ 'postnl/cif_sender_address/country' => 'postnl/cif_address/country',
91
+ 'postnl/cif_product_options/default_product_option' => 'postnl/grid/default_product_option',
92
+ 'postnl/cif_product_options/use_alternative_default' => 'postnl/grid/use_alternative_default',
93
+ 'postnl/cif_product_options/alternative_default_max_amount' => 'postnl/grid/alternative_default_max_amount',
94
+ 'postnl/cif_product_options/alternative_default_option' => 'postnl/grid/alternative_default_option',
95
+ 'postnl/cif_product_options/default_evening_product_option' => 'postnl/grid/default_evening_product_option',
96
+ 'postnl/cif_product_options/default_pakjegemak_product_option' => 'postnl/grid/default_pakjegemak_product_option',
97
+ 'postnl/cif_product_options/default_pge_product_option' => 'postnl/grid/default_pge_product_option',
98
+ 'postnl/cif_product_options/default_buspakje_product_option' => 'postnl/grid/default_buspakje_product_option',
99
+ 'postnl/cif_product_options/default_stated_address_only_product_option' => 'postnl/grid/default_stated_address_only_product_option',
100
+ 'postnl/cif_product_options/default_pakketautomaat_product_option' => 'postnl/delivery_options/default_pakketautomaat_product_option',
101
+ 'postnl/cif_product_options/default_eu_product_option' => 'postnl/grid/default_eu_product_option',
102
+ 'postnl/cif_product_options/default_eu_be_product_option' => 'postnl/grid/default_eu_be_product_option',
103
+ 'postnl/cif_product_options/default_global_product_option' => 'postnl/cif_globalpack_settings/default_global_product_option',
104
+ 'postnl/cif_labels_and_confirming/use_buspakje' => 'postnl/delivery_options/use_buspakje',
105
+ 'postnl/cif_labels_and_confirming/buspakje_calculation_mode' => 'postnl/delivery_options/buspakje_calculation_mode',
106
+ 'postnl/cif_address/use_postcode_check' => 'postnl/cif_labels_and_confirming/use_postcode_check',
107
+ 'postnl/cif_address/postcode_check_in_checkout' => 'postnl/cif_labels_and_confirming/postcode_check_in_checkout',
108
+ 'postnl/cif_address/postcode_check_in_addressbook' => 'postnl/cif_labels_and_confirming/postcode_check_in_addressbook',
109
+ 'postnl/cif_address/postcode_check_max_attempts' => 'postnl/cif_labels_and_confirming/postcode_check_max_attempts',
110
+ 'postnl/cif_address/postcode_check_timeout' => 'postnl/cif_labels_and_confirming/postcode_check_timeout',
111
+ 'postnl/cif_address/split_street' => 'postnl/cif_labels_and_confirming/split_street',
112
+ 'postnl/cif_address/streetname_field' => 'postnl/cif_labels_and_confirming/streetname_field',
113
+ 'postnl/cif_address/housenr_field' => 'postnl/cif_labels_and_confirming/housenr_field',
114
+ 'postnl/cif_address/split_housenr' => 'postnl/cif_labels_and_confirming/split_housenr',
115
+ 'postnl/cif_address/housenr_extension_field' => 'postnl/cif_labels_and_confirming/housenr_extension_field',
116
+ 'postnl/cif_address/building_name_field' => 'postnl/cif_labels_and_confirming/building_name_field',
117
+ 'postnl/cif_address/department_field' => 'postnl/cif_labels_and_confirming/department_field',
118
+ 'postnl/cif_address/doorcode_field' => 'postnl/cif_labels_and_confirming/doorcode_field',
119
+ 'postnl/cif_address/floor_field' => 'postnl/cif_labels_and_confirming/floor_field',
120
+ 'postnl/cif_address/remark_field' => 'postnl/cif_labels_and_confirming/remark_field',
121
+ 'postnl/cif_address/area_field' => 'postnl/cif_labels_and_confirming/area_field',
122
+ );
123
+
124
+ foreach ($settingsToMove as $from => $to) {
125
+ $installer->moveConfigSettingInDb($from, $to);
126
+ }
127
+
128
+ $installer->moveActiveSetting()
129
+ ->clearConfigCache();
app/code/community/TIG/PostNL/etc/adminhtml.xml CHANGED
@@ -26,15 +26,15 @@
26
  * It is available through the world-wide-web at this URL:
27
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
28
  * If you are unable to obtain it through the world-wide-web, please send an email
29
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
30
  *
31
  * DISCLAIMER
32
  *
33
  * Do not edit or add to this file if you wish to upgrade this module to newer
34
  * versions in the future. If you wish to customize this module for your
35
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
36
  *
37
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
38
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
39
  */
40
  -->
26
  * It is available through the world-wide-web at this URL:
27
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
28
  * If you are unable to obtain it through the world-wide-web, please send an email
29
+ * to servicedesk@tig.nl so we can send you a copy immediately.
30
  *
31
  * DISCLAIMER
32
  *
33
  * Do not edit or add to this file if you wish to upgrade this module to newer
34
  * versions in the future. If you wish to customize this module for your
35
+ * needs please contact servicedesk@tig.nl for more information.
36
  *
37
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
38
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
39
  */
40
  -->
app/code/community/TIG/PostNL/etc/config.xml CHANGED
@@ -26,22 +26,22 @@
26
  * It is available through the world-wide-web at this URL:
27
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
28
  * If you are unable to obtain it through the world-wide-web, please send an email
29
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
30
  *
31
  * DISCLAIMER
32
  *
33
  * Do not edit or add to this file if you wish to upgrade this module to newer
34
  * versions in the future. If you wish to customize this module for your
35
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
36
  *
37
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
38
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
39
  */
40
  -->
41
  <config>
42
  <modules>
43
  <TIG_PostNL>
44
- <version>1.3.1</version>
45
  </TIG_PostNL>
46
  </modules>
47
 
@@ -147,6 +147,9 @@
147
  <tablerate>
148
  <table>tig_postnl_tablerate</table>
149
  </tablerate>
 
 
 
150
  </entities>
151
  </postnl_carrier_resource>
152
  </models>
@@ -478,7 +481,9 @@
478
 
479
  <frontend>
480
  <secure_url>
481
- <postnl_checkout>/postnl/checkout</postnl_checkout>
 
 
482
  <postnl_addressvalidation>/postnl/addressValidation</postnl_addressvalidation>
483
  <postnl_deliveryoptions>/postnl/deliveryOptions</postnl_deliveryoptions>
484
  <postnl_mijnpakket>/postnl/mijnpakket</postnl_mijnpakket>
@@ -543,6 +548,26 @@
543
  </checkout_deliveryoptions>
544
  </observers>
545
  </core_block_abstract_to_html_before>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
546
  </events>
547
  </frontend>
548
 
@@ -625,6 +650,13 @@
625
  <model>postnl_core/observer_cron::removeOldLabels</model>
626
  </run>
627
  </postnl_remove_old_labels>
 
 
 
 
 
 
 
628
  </jobs>
629
  </crontab>
630
 
@@ -657,9 +689,9 @@
657
  <fee>17.45</fee> <!-- Charge an additional fee of 17.45 EUR for the use of PostNL COD. This is the amount PostNL charges for using COD -->
658
  <fee_label>PostNL rembourstoeslag</fee_label> <!-- PostNL COD fee -->
659
  <order_status>processing</order_status> <!-- Pending status -->
 
660
  <allowspecific>1</allowspecific> <!-- Allow only specific countries -->
661
  <specificcountry>NL</specificcountry> <!-- Allow only NL -->
662
- <instructions/>
663
  <min_order_total/>
664
  <max_order_total>2000</max_order_total> <!-- PostNL COD is only available for orders whose base grand total amount is less than 2000 EUR -->
665
  <allow_for_non_postnl>0</allow_for_non_postnl> <!-- Only show this payment method if the order is being shipped using PostNL -->
@@ -693,14 +725,109 @@
693
  </carriers>
694
  <postnl>
695
  <general>
696
- <active>0</active> <!-- Inactive -->
697
- <is_activated>0</is_activated> <!-- Not activated -->
698
  <email/>
699
  <unique_key/>
700
  <private_key/>
701
- </general>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
702
  <cif>
703
- <mode>1</mode> <!-- Test mode -->
704
  <customer_number>11223344</customer_number> <!-- Demo customer number -->
705
  <customer_code>TOTA</customer_code> <!-- Demo customer code -->
706
  <live_username/>
@@ -710,35 +837,15 @@
710
  <collection_location>103861</collection_location> <!-- Demo collection location -->
711
  <webshop_id/> <!-- The demo webshop ID will be generated on install as it needs to be encrypted -->
712
  <public_webshop_id>a98e0769d6bf40a8b49d85e7aff41d7a</public_webshop_id> <!-- Demo public webshop ID -->
713
- <use_globalpack>0</use_globalpack> <!-- Do not use GlobalPack -->
714
- <global_barcode_type>CD</global_barcode_type> <!-- Demo barcode type -->
715
- <global_barcode_range>1660</global_barcode_range> <!-- Demo barcode range -->
716
- </cif>
717
- <cif_labels_and_confirming>
718
- <label_size>A4</label_size> <!-- A4 size labels -->
719
- <weight_per_parcel>20000</weight_per_parcel> <!-- 20 kg -->
720
- <weight_unit>gram</weight_unit> <!-- gram -->
721
  <shipment_reference_type>shipment_increment_id</shipment_reference_type> <!-- Use the shipment's increment ID as the shipment reference -->
722
  <custom_shipment_reference/>
723
- <use_buspakje>1</use_buspakje> <!-- Use buspakje -->
724
- <buspakje_calculation_mode>manual</buspakje_calculation_mode> <!-- Manually determine if a shipment is a buspakje shipment -->
725
- <shipping_duration>1</shipping_duration> <!-- Shipping takes 1 day -->
726
- <cutoff_time>17:00:00</cutoff_time> <!-- Add an extra shipping day if customers order after 17:00 P.M. -->
727
- <allow_sunday_sorting>0</allow_sunday_sorting> <!-- Sunday sorting is disabled -->
728
- <sunday_cutoff_time/>
729
- <show_grid_options>1</show_grid_options> <!-- Show product options in the order grid -->
730
- <show_buspakje_option>1</show_buspakje_option> <!-- Show the option to mark a shipment as being a buspakje -->
731
- <order_grid_columns>shipment_type</order_grid_columns> <!-- Show the shipment type column -->
732
- <order_grid_massaction_default>postnl_create_shipments</order_grid_massaction_default> <!-- Select the create shipments mass action by default -->
733
- <shipping_grid_columns>shipment_type,confirm_date,confirm_status,labels_printed,barcode,shipping_phase</shipping_grid_columns> <!-- Show the shipping description, shipment type, label-printed and shipping phase columns -->
734
- <shipping_grid_massaction_default>postnl_print_labels_and_confirm</shipping_grid_massaction_default> <!-- 'Print labels and confirm shipment' massaction -->
735
- <send_track_and_trace_email>1</send_track_and_trace_email> <!-- automatically send a track & trace email to the customer -->
736
- <track_and_trace_email_template>postnl_cif_labels_and_confirming_track_and_trace_email_template</track_and_trace_email_template> <!-- Default template from locale -->
737
- <send_copy>0</send_copy> <!-- Do not send a copy of the track & trace email -->
738
- <copy_to/>
739
- <copy_method>bcc</copy_method> <!-- Use the bcc method for sending the track & trace email copy -->
740
- </cif_labels_and_confirming>
741
- <packing_slip>
742
  <logo/>
743
  <show_webshop_info>1</show_webshop_info> <!-- Show webshop info on the packing slip -->
744
  <coc_number/>
@@ -756,122 +863,43 @@
756
  <show_comment>1</show_comment> <!-- Show a comment on the packing slip -->
757
  <comment_type>shipment_comment</comment_type> <!-- Show the shipment's last comment, rather than a pre-defined comment -->
758
  <comment_text/>
759
- <show_label>1</show_label> <!-- Automatically add the shipping label to the packing slip -->
 
760
  </packing_slip>
761
- <parcelware_export>
762
- <active>0</active> <!-- Inactive -->
763
- <auto_confirm>0</auto_confirm> <!-- Do not auto confirm -->
764
- <contract_ref_nr/>
765
- <contract_name/>
766
- <sender_ref_nr/>
767
- </parcelware_export>
768
- <cif_address>
769
- <use_postcode_check>0</use_postcode_check> <!-- Do not use postcode check functionality -->
770
- <postcode_check_in_checkout>1</postcode_check_in_checkout> <!-- Use postcode check on the checkout page -->
771
- <postcode_check_in_addressbook>1</postcode_check_in_addressbook> <!-- Use postcode check in the customer's addressbook -->
772
- <postcode_check_max_attempts>1</postcode_check_max_attempts> <!-- Allow 1 attempt before disabling postcode check and allowing users to enter their addess manually -->
773
- <postcode_check_timeout>5</postcode_check_timeout> <!-- Postcode check will timeout after 5 seconds -->
774
- <split_street>1</split_street> <!-- split street -->
775
- <streetname_field>1</streetname_field> <!-- first address line -->
776
- <housenr_field>2</housenr_field> <!-- second address line -->
777
- <split_housenr>0</split_housenr> <!-- do not split housenumber and houndenumber extension -->
778
- <housenr_extension_field>3</housenr_extension_field> <!-- third address line (not used, since split_housenr is disabled) -->
779
- <area_field/>
780
- <building_name_field/>
781
- <department_field/>
782
- <doorcode_field/>
783
- <floor_field/>
784
- <remark_field/>
785
- </cif_address>
786
- <cif_sender_address>
787
- <firstname/>
788
- <lastname/>
789
- <company/>
790
- <streetname/>
791
- <housenumber/>
792
- <housenumber_extension/>
793
- <postcode/>
794
- <city/>
795
- <region/>
796
- <country>NL</country> <!-- All sender addresses must be located in the Netherlands -->
797
- </cif_sender_address>
798
- <cif_return_address>
799
- <use_sender_address>1</use_sender_address> <!-- Use the sender address as the return address -->
800
- <firstname/>
801
- <lastname/>
802
- <company/>
803
- <streetname/>
804
- <housenumber/>
805
- <housenumber_extension/>
806
- <postcode/>
807
- <city/>
808
- <region/>
809
- <country>NL</country> <!-- All return addresses must be located in the Netherlands -->
810
- </cif_return_address>
811
- <cif_product_options>
812
- <supported_product_options>3085,3086,3091,3093,3097,3087,3094,3189,3089,3389,3096,3090,3385,3390,3535,3545,3536,3546,3534,3544,3533,3543,4952,4945,3553,2928,2828</supported_product_options> <!-- all possible options except for EPS BE only -->
813
- <allow_eps_be_only_options>0</allow_eps_be_only_options> <!-- Do not allow the EPS BE only product option -->
814
- <default_product_option>3085</default_product_option> <!-- standard shipment -->
815
- <use_alternative_default>0</use_alternative_default> <!-- Do not use an alternative default -->
816
- <alternative_default_max_amount>100</alternative_default_max_amount> <!-- 100 EUR -->
817
- <alternative_default_option>3189</alternative_default_option> <!-- Signature on delivery -->
818
- <default_evening_product_option>3385</default_evening_product_option> <!-- Deliver to stated address only -->
819
- <default_pakjegemak_product_option>3533</default_pakjegemak_product_option> <!-- Post Office + signature on delivery -->
820
- <default_pge_product_option>3543</default_pge_product_option> <!-- Post Office + Signature on Delivery + Notification -->
821
- <default_buspakje_product_option>2928</default_buspakje_product_option> <!-- Buspakje Extra -->
822
- <default_eu_product_option>4952</default_eu_product_option> <!-- EU Pack Special to consumer (combilabel) -->
823
- <default_eu_be_product_option>4952</default_eu_be_product_option> <!-- EU Pack Special to consumer (combilabel) -->
824
- <default_global_product_option>4945</default_global_product_option> <!-- GlobalPack -->
825
- <default_pakketautomaat_product_option>3553</default_pakketautomaat_product_option> <!-- Parcel dispenser -->
826
- <default_cod_product_option>3086</default_cod_product_option> <!-- COD -->
827
- <default_evening_cod_product_option>3086</default_evening_cod_product_option> <!-- COD -->
828
- <default_pakjegemak_cod_product_option>3535</default_pakjegemak_cod_product_option> <!-- Post Office + COD -->
829
- <default_pge_cod_product_option>3545</default_pge_cod_product_option> <!-- Post Office + COD + Notification -->
830
- </cif_product_options>
831
  <cod>
832
  <account_name/>
833
  <iban/>
834
  <bic/>
835
  <auto_invoice>1</auto_invoice> <!-- Enable auto-invoice -->
836
  <allow_cod_for_buspakje>0</allow_cod_for_buspakje> <!-- Disable COD for letter box parcels -->
 
 
 
 
837
  </cod>
838
- <cif_globalpack_settings>
839
- <customs_license_number/>
840
- <customs_certificate_number/>
 
 
 
841
  <default_shipment_type>Commercial Goods</default_shipment_type>
842
- <use_hs_tariff>0</use_hs_tariff> <!-- Do not use a specific HS tariff -->
843
- <hs_tariff_attribute/>
844
- <customs_value_attribute>price</customs_value_attribute> <!-- price attribute -->
845
- <country_of_origin_attribute>country_of_manufacture</country_of_origin_attribute> <!-- country of manufacture attribute -->
846
- <description_attribute>name</description_attribute> <!-- name attribute -->
847
- <product_sorting_attribute>price</product_sorting_attribute> <!-- price attribute -->
848
- <product_sorting_direction>desc</product_sorting_direction> <!-- descending -->
849
- </cif_globalpack_settings>
850
- <delivery_options>
851
- <delivery_options_active>0</delivery_options_active> <!-- Delivery options are disabled -->
852
- <theme>default</theme> <!-- Use the default PostNL theme -->
853
- <mijnpakket_login_active>1</mijnpakket_login_active> <!-- Enable MijnPakket login -->
854
- <show_options_for_letter>0</show_options_for_letter> <!-- Do not show delivery options if the order's total weight is less than 2 kg -->
855
- <show_options_for_backorders>0</show_options_for_backorders> <!-- Do not show delivery options if the order is not in stock -->
856
- <delivery_days_number>7</delivery_days_number> <!-- Show up to 7 delivery days -->
857
- <enable_delivery_days>1</enable_delivery_days> <!-- Delivery days are allowed -->
858
- <enable_timeframes>1</enable_timeframes> <!-- Timeframes are allowed -->
859
- <enable_evening_timeframes>1</enable_evening_timeframes> <!-- Evening timeframes are enabled -->
860
- <evening_timeframe_fee>2</evening_timeframe_fee> <!-- Evening timeframes cost 2 {base currency} extra -->
861
- <enable_pakjegemak>1</enable_pakjegemak> <!-- PakjeGemak locations are allowed -->
862
- <enable_pakjegemak_express>1</enable_pakjegemak_express> <!-- PakjeGemak express locations are allowed -->
863
- <pakjegemak_express_fee>2</pakjegemak_express_fee> <!-- PakjeGemak Express locations cost 2 {base currency} extra -->
864
- <enable_pakketautomaat_locations>1</enable_pakketautomaat_locations> <!-- Pakketautomaat locations are allowed -->
865
- <allow_streetview>1</allow_streetview> <!-- Google streetview is allowed. -->
866
- <show_options_for_buspakje>0</show_options_for_buspakje> <!-- Do not show delivery options if the order is a letter box parcel -->
867
- <show_all_options_for_buspakje>0</show_all_options_for_buspakje> <!-- Do not show all delivery options for letter box parcel orders -->
868
- <enable_delivery_days_for_buspakje>1</enable_delivery_days_for_buspakje> <!-- Show delivery days for letter box parcel orders -->
869
- <enable_pakjegemak_for_buspakje>0</enable_pakjegemak_for_buspakje> <!-- Do not show post office locations for letter box parcel orders -->
870
- <enable_pakketautomaat_for_buspakje>0</enable_pakketautomaat_for_buspakje> <!-- Do not show parcel dispenser locations for letter box parcel orders -->
871
- <mijnpakket_notification>0</mijnpakket_notification> <!-- Do not show MijnPakket notifications after customers have placed their order -->
872
- <show_create_mijnpakket_account_link>1</show_create_mijnpakket_account_link> <!-- Show the create MijnPakket account link -->
873
- <show_mijnpakket_app_link>1</show_mijnpakket_app_link> <!-- Show the MijnPakket app link -->
874
- </delivery_options>
875
  <checkout>
876
  <active>0</active> <!-- PostNL Checkout is inactive -->
877
  <show_exclusively_for_mijnpakket_users>0</show_exclusively_for_mijnpakket_users> <!-- Do not show PostNL Checkout exclusively to MijnPakket users -->
@@ -889,6 +917,12 @@
889
  <agree_conditions>1</agree_conditions> <!-- Customers must first agree to the webshop's terms and conditions -->
890
  <contact_url/>
891
  <service_url/>
 
 
 
 
 
 
892
  </checkout>
893
  <checkout_payment_methods>
894
  <ideal>0</ideal> <!-- Do not use iDEAL -->
@@ -918,6 +952,36 @@
918
  <klarna>0</klarna> <!-- Do not use Klarna -->
919
  <klarna_method/>
920
  </checkout_payment_methods>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
921
  <advanced>
922
  <debug_mode>1</debug_mode> <!-- Exception logging only -->
923
  <infinite_label_printing>0</infinite_label_printing> <!-- do not allow infinite printing -->
@@ -929,7 +993,7 @@
929
  <feed_url>ext.tigpostnl.nl/rss</feed_url> <!-- Default URL for the RSS notification feed -->
930
  <feed_use_https>0</feed_use_https> <!-- use regular http:// to get the latest feed updates. At the moment https is not yet supported, however it may be in the future. -->
931
  <show_error_details_in_frontend>0</show_error_details_in_frontend> <!-- Do not show error details in the frontend -->
932
- <postnl_shipping_methods>postnl_flatrate,postnl_tablerate</postnl_shipping_methods> <!-- By default only the PostNL shipping methods may be consider to be 'PostNL shipping methods' -->
933
  <cif_version_shippingstatus>1_3</cif_version_shippingstatus> <!-- v1.3 -->
934
  <cif_version_confirming>1_4</cif_version_confirming> <!-- v1.4 -->
935
  <cif_version_labelling>1_5</cif_version_labelling> <!-- v1.5 -->
@@ -977,14 +1041,38 @@
977
  <default translate="label" module="postnl">
978
  <label>Default PostNL theme</label>
979
  <use_cufon>1</use_cufon>
 
 
 
 
 
 
 
 
 
 
 
 
 
980
  </default>
981
  <!-- An unbranded, white, gray and blue theme -->
982
  <neutral translate="label" module="postnl">
983
  <label>Neutral theme</label>
984
  <use_cufon>1</use_cufon>
985
  <files>
986
- <onepage>css/TIG/PostNL/deliveryoptions/neutral.css</onepage>
987
- <onestepcheckout>css/TIG/PostNL/deliveryoptions/onestepcheckout_neutral.css</onestepcheckout>
 
 
 
 
 
 
 
 
 
 
 
988
  </files>
989
  </neutral>
990
  </themes>
@@ -996,32 +1084,32 @@
996
  <!-- These are errors, warnings and notices that are generated by this extension -->
997
  <POSTNL-0001>
998
  <message>You have configured the extension for test mode only. You still must enter a live username and password before you may use the extension for real shipments.</message>
999
- <url>http://kb.totalinternetgroup.nl/topic/31114923</url>
1000
  <type>warning</type>
1001
  </POSTNL-0001>
1002
  <POSTNL-0002>
1003
  <message>You have not yet fully configured the extension. You must complete this process before you can use it.</message>
1004
- <url>http://kb.totalinternetgroup.nl/topic/31565256</url>
1005
  <type>error</type>
1006
  </POSTNL-0002>
1007
  <POSTNL-0003>
1008
  <message>You have not yet configured the extension to use GlobalPack shipments. Please complete this process if you wish to ship parcels to outside the EU.</message>
1009
- <url>http://kb.totalinternetgroup.nl/topic/31566436</url>
1010
  <type>notice</type>
1011
  </POSTNL-0003>
1012
  <POSTNL-0004>
1013
  <message>You have not yet configured PostNL Checkout. Please complete this process if you wish to use PostNL Checkout.</message>
1014
- <url>http://kb.totalinternetgroup.nl/topic/31567046</url>
1015
  <type>notice</type>
1016
  </POSTNL-0004>
1017
  <POSTNL-0005>
1018
  <message>You currently do not use split street lines. Not using split street lines may cause errors in shipment processing as PostNL cannot support every possible address syntax. We strongly recommend using split street lines to avoid problems when using PostNL shipping. For more information, please contact PostNL support.</message>
1019
- <url>http://kb.totalinternetgroup.nl/topic/31080848</url>
1020
  <type>warning</type>
1021
  </POSTNL-0005>
1022
  <POSTNL-0006>
1023
  <message>PostNL: It appears that your cron is not working properly. PostNL requires the cron to be active in order to function.</message>
1024
- <url>http://kb.totalinternetgroup.nl/topic/31060037</url>
1025
  <type>warning</type>
1026
  </POSTNL-0006>
1027
  <POSTNL-0007>
@@ -1031,22 +1119,22 @@
1031
  </POSTNL-0007>
1032
  <POSTNL-0008>
1033
  <message>Please fill in your unique and private keys and try again.</message>
1034
- <url>http://kb.totalinternetgroup.nl/topic/31079168</url>
1035
  <type>error</type>
1036
  </POSTNL-0008>
1037
  <POSTNL-0009>
1038
  <message>This action is not available for shipment #%s, because it was not shipped using PostNL.</message>
1039
- <url>http://kb.totalinternetgroup.nl/topic/31061687</url>
1040
  <type>error</type>
1041
  </POSTNL-0009>
1042
  <POSTNL-0010>
1043
  <message>An error occurred while processing this action.</message>
1044
- <url>http://kb.totalinternetgroup.nl/topic/31062917</url>
1045
  <type>error</type>
1046
  </POSTNL-0010>
1047
  <POSTNL-0011>
1048
  <message>Please select one or more orders.</message>
1049
- <url>http://kb.totalinternetgroup.nl/topic/31570156</url>
1050
  <type>error</type>
1051
  </POSTNL-0011>
1052
  <POSTNL-0012>
@@ -1056,432 +1144,432 @@
1056
  </POSTNL-0012>
1057
  <POSTNL-0013>
1058
  <message>Please select one or more shipments.</message>
1059
- <url>http://kb.totalinternetgroup.nl/topic/31120533</url>
1060
  <type>error</type>
1061
  </POSTNL-0013>
1062
  <POSTNL-0014>
1063
  <message>You can print a maximum of 200 labels at once.</message>
1064
- <url>http://kb.totalinternetgroup.nl/topic/31083628</url>
1065
  <type>error</type>
1066
  </POSTNL-0014>
1067
  <POSTNL-0015>
1068
  <message>Order #%s cannot be shipped at this time.</message>
1069
- <url>http://kb.totalinternetgroup.nl/topic/31083718</url>
1070
  <type>error</type>
1071
  </POSTNL-0015>
1072
  <POSTNL-0016>
1073
  <message>Shipment #%s could not be confirmed, because for EU shipments you may only confirm a shipment after it's labels have been printed.</message>
1074
- <url>http://kb.totalinternetgroup.nl/topic/31573296</url>
1075
  <type>error</type>
1076
  </POSTNL-0016>
1077
  <POSTNL-0017>
1078
  <message>Shipment #%s has already been confirmed.</message>
1079
- <url>http://kb.totalinternetgroup.nl/topic/31066127</url>
1080
  <type>error</type>
1081
  </POSTNL-0017>
1082
  <POSTNL-0018>
1083
  <message>Shipment #%s cannot be confirmed at this time.</message>
1084
- <url>http://kb.totalinternetgroup.nl/topic/31123903</url>
1085
  <type>error</type>
1086
  </POSTNL-0018>
1087
  <POSTNL-0019>
1088
  <message>PostNL replied with the following warnings: %s</message>
1089
- <url>http://kb.totalinternetgroup.nl/topic/31573886</url>
1090
  <type>warning</type>
1091
  </POSTNL-0019>
1092
  <POSTNL-0020>
1093
  <message>Error code %s: %s</message>
1094
- <url>http://kb.totalinternetgroup.nl/topic/31086988</url>
1095
  <type>warning</type>
1096
  </POSTNL-0020>
1097
  <POSTNL-0021>
1098
  <message>An error occurred while processing your order. Please try again</message>
1099
- <url>http://kb.totalinternetgroup.nl/topic/31085978</url>
1100
  <type>error</type>
1101
  </POSTNL-0021>
1102
  <POSTNL-0022>
1103
  <message>Unable to set Payment Method.</message>
1104
- <url>http://kb.totalinternetgroup.nl/topic/31086728</url>
1105
  <type>error</type>
1106
  </POSTNL-0022>
1107
  <POSTNL-0023>
1108
  <message>Your order has been cancelled. Please try again.</message>
1109
- <url>http://kb.totalinternetgroup.nl/topic/31069277</url>
1110
  <type>notice</type>
1111
  </POSTNL-0023>
1112
  <POSTNL-0024>
1113
  <message>Unfortunately the checkout process cannot be finished. Please try again.</message>
1114
- <url>http://kb.totalinternetgroup.nl/topic/31069397</url>
1115
  <type>error</type>
1116
  </POSTNL-0024>
1117
  <POSTNL-0025>
1118
  <message>Unfortunately no PostNL Checkout order could be found. Please try again.</message>
1119
- <url>http://kb.totalinternetgroup.nl/topic/31069667</url>
1120
  <type>error</type>
1121
  </POSTNL-0025>
1122
  <POSTNL-0026>
1123
  <message>It seems your cart has been changed since you started the checkout process. Please try again.</message>
1124
- <url>http://kb.totalinternetgroup.nl/topic/31126613</url>
1125
  <type>error</type>
1126
  </POSTNL-0026>
1127
  <POSTNL-0027>
1128
  <message>You have not yet enabled PostNL Checkout.</message>
1129
- <url>http://kb.totalinternetgroup.nl/topic/31576976</url>
1130
  <type>error</type>
1131
  </POSTNL-0027>
1132
  <POSTNL-0028>
1133
  <message>You need to enable at least one payment method.</message>
1134
- <url>http://kb.totalinternetgroup.nl/topic/31070197</url>
1135
  <type>error</type>
1136
  </POSTNL-0028>
1137
  <POSTNL-0029>
1138
  <message>Unable to get valid barcodetype for postnl shipment id #%s</message>
1139
- <url>http://kb.totalinternetgroup.nl/topic/31147298</url>
1140
  <type>error</type>
1141
  </POSTNL-0029>
1142
  <POSTNL-0030>
1143
  <message>You have not yet enabled the extension.</message>
1144
- <url>http://kb.totalinternetgroup.nl/topic/31185593</url>
1145
  <type>error</type>
1146
  </POSTNL-0030>
1147
  <POSTNL-0031>
1148
  <message>The PostNL shipping method has not been enabled.</message>
1149
- <url>http://kb.totalinternetgroup.nl/topic/31129647</url>
1150
  <type>error</type>
1151
  </POSTNL-0031>
1152
  <POSTNL-0032>
1153
  <message>The shop's base currency code must be set to EUR for PostNL to function.</message>
1154
- <url>http://kb.totalinternetgroup.nl/topic/31129917</url>
1155
  <type>error</type>
1156
  </POSTNL-0032>
1157
  <POSTNL-0033>
1158
  <message>The extension has not been activated.</message>
1159
- <url>http://kb.totalinternetgroup.nl/topic/31186323</url>
1160
  <type>error</type>
1161
  </POSTNL-0033>
1162
  <POSTNL-0034>
1163
  <message>%s > %s is required.</message>
1164
- <url>http://kb.totalinternetgroup.nl/topic/31186983</url>
1165
  <type>error</type>
1166
  </POSTNL-0034>
1167
  <POSTNL-0035>
1168
  <message>Invalid Magento edition detected: %s</message>
1169
- <url>http://kb.totalinternetgroup.nl/topic/31131717</url>
1170
  <type>error</type>
1171
  </POSTNL-0035>
1172
  <POSTNL-0036>
1173
  <message>Invalid rate type requested: %s</message>
1174
- <url>http://kb.totalinternetgroup.nl/topic/31150488</url>
1175
  <type>error</type>
1176
  </POSTNL-0036>
1177
  <POSTNL-0037>
1178
  <message>Invalid UpdateOrder response received!</message>
1179
- <url>http://kb.totalinternetgroup.nl/topic/31133667</url>
1180
  <type>error</type>
1181
  </POSTNL-0037>
1182
  <POSTNL-0038>
1183
  <message>Invalid PingStatus response: %s</message>
1184
- <url>http://kb.totalinternetgroup.nl/topic/31638656</url>
1185
  <type>error</type>
1186
  </POSTNL-0038>
1187
  <POSTNL-0039>
1188
  <message>No quote available to initiate PostNL Checkout.</message>
1189
- <url>http://kb.totalinternetgroup.nl/topic/31639136</url>
1190
  <type>error</type>
1191
  </POSTNL-0039>
1192
  <POSTNL-0040>
1193
  <message>Invalid PrepareOrder response: %s</message>
1194
- <url>http://kb.totalinternetgroup.nl/topic/31191183</url>
1195
  <type>error</type>
1196
  </POSTNL-0040>
1197
  <POSTNL-0041>
1198
  <message>Invalid ReadOrder response: %s</message>
1199
- <url>http://kb.totalinternetgroup.nl/topic/31191443</url>
1200
  <type>error</type>
1201
  </POSTNL-0041>
1202
  <POSTNL-0042>
1203
  <message>Invalid ConfirmOrder response: %s</message>
1204
- <url>http://kb.totalinternetgroup.nl/topic/31191933</url>
1205
  <type>error</type>
1206
  </POSTNL-0042>
1207
  <POSTNL-0043>
1208
  <message>Invalid reference type requested: %s</message>
1209
- <url>http://kb.totalinternetgroup.nl/topic/31640636</url>
1210
  <type>error</type>
1211
  </POSTNL-0043>
1212
  <POSTNL-0044>
1213
  <message>Invalid object specified: %s</message>
1214
- <url>http://kb.totalinternetgroup.nl/topic/31641096</url>
1215
  <type>error</type>
1216
  </POSTNL-0044>
1217
  <POSTNL-0045>
1218
  <message>OrderToken missing for quote #%s</message>
1219
- <url>http://kb.totalinternetgroup.nl/topic/31662856</url>
1220
  <type>error</type>
1221
  </POSTNL-0045>
1222
  <POSTNL-0046>
1223
  <message>This PostNL Checkout order cannot be cancelled: it has no associated magento order.</message>
1224
- <url>http://kb.totalinternetgroup.nl/topic/31157957</url>
1225
  <type>error</type>
1226
  </POSTNL-0046>
1227
  <POSTNL-0047>
1228
  <message>This PostNL Checkout order cannot be cancelled: it has already been canceled.</message>
1229
- <url>http://kb.totalinternetgroup.nl/topic/31177418</url>
1230
  <type>error</type>
1231
  </POSTNL-0047>
1232
  <POSTNL-0048>
1233
  <message>Selected payment method %s is not available.</message>
1234
- <url>http://kb.totalinternetgroup.nl/topic/31158587</url>
1235
  <type>error</type>
1236
  </POSTNL-0048>
1237
  <POSTNL-0049>
1238
  <message>Unable to create an order for quote #%s</message>
1239
- <url>http://kb.totalinternetgroup.nl/topic/31215003</url>
1240
  <type>error</type>
1241
  </POSTNL-0049>
1242
  <POSTNL-0050>
1243
  <message>Invalid quote supplied.</message>
1244
- <url>http://kb.totalinternetgroup.nl/topic/31215543</url>
1245
  <type>error</type>
1246
  </POSTNL-0050>
1247
  <POSTNL-0051>
1248
  <message>Invalid data supplied.</message>
1249
- <url>http://kb.totalinternetgroup.nl/topic/31216003</url>
1250
  <type>error</type>
1251
  </POSTNL-0051>
1252
  <POSTNL-0052>
1253
  <message>No username or password set.</message>
1254
- <url>http://kb.totalinternetgroup.nl/topic/31216113</url>
1255
  <type>error</type>
1256
  </POSTNL-0052>
1257
  <POSTNL-0053>
1258
  <message>Chosen wsdl type is not supported: %s</message>
1259
- <url>http://kb.totalinternetgroup.nl/topic/31178198</url>
1260
  <type>error</type>
1261
  </POSTNL-0053>
1262
  <POSTNL-0054>
1263
  <message>Invalid barcode response: %s</message>
1264
- <url>http://kb.totalinternetgroup.nl/topic/31664456</url>
1265
  <type>error</type>
1266
  </POSTNL-0054>
1267
  <POSTNL-0055>
1268
  <message>Invalid shippingStatus response: %s</message>
1269
- <url>http://kb.totalinternetgroup.nl/topic/31664246</url>
1270
  <type>error</type>
1271
  </POSTNL-0055>
1272
  <POSTNL-0056>
1273
  <message>Invalid confirmShipment response: %s</message>
1274
- <url>http://kb.totalinternetgroup.nl/topic/31923588</url>
1275
  <type>error</type>
1276
  </POSTNL-0056>
1277
  <POSTNL-0057>
1278
  <message>Invalid generateLabels response: %s</message>
1279
- <url>http://kb.totalinternetgroup.nl/topic/31906367</url>
1280
  <type>error</type>
1281
  </POSTNL-0057>
1282
  <POSTNL-0058>
1283
  <message>Invalid generateLabelsWithoutConfirm response: %s</message>
1284
- <url>http://kb.totalinternetgroup.nl/topic/31923208</url>
1285
  <type>error</type>
1286
  </POSTNL-0058>
1287
  <POSTNL-0059>
1288
  <message>Invalid housnumber supplied: %s</message>
1289
- <url>http://kb.totalinternetgroup.nl/topic/32412636</url>
1290
  <type>error</type>
1291
  </POSTNL-0059>
1292
  <POSTNL-0060>
1293
  <message>Invalid full street supplied: %s</message>
1294
- <url>http://kb.totalinternetgroup.nl/topic/31924308</url>
1295
  <type>error</type>
1296
  </POSTNL-0060>
1297
  <POSTNL-0061>
1298
  <message>Invalid barcodetype requested: %s</message>
1299
- <url>http://kb.totalinternetgroup.nl/topic/31924098</url>
1300
  <type>error</type>
1301
  </POSTNL-0061>
1302
  <POSTNL-0062>
1303
  <message>Invalid printer type requested: %s</message>
1304
- <url>http://kb.totalinternetgroup.nl/topic/32413996</url>
1305
  <type>error</type>
1306
  </POSTNL-0062>
1307
  <POSTNL-0063>
1308
  <message>Unable to match barcode to shippingStatus response: %s</message>
1309
- <url>http://kb.totalinternetgroup.nl/topic/31910007</url>
1310
  <type>error</type>
1311
  </POSTNL-0063>
1312
  <POSTNL-0064>
1313
  <message>Maximum amount of labels exceeded. Maximum allowed: 200. Requested: %s</message>
1314
- <url>http://kb.totalinternetgroup.nl/topic/31925938</url>
1315
  <type>error</type>
1316
  </POSTNL-0064>
1317
  <POSTNL-0065>
1318
  <message>Invalid label type supplied: %s</message>
1319
- <url>http://kb.totalinternetgroup.nl/topic/31910337</url>
1320
  <type>error</type>
1321
  </POSTNL-0065>
1322
  <POSTNL-0066>
1323
  <message>Temporary template file already exists: %s</message>
1324
- <url>http://kb.totalinternetgroup.nl/topic/32415756</url>
1325
  <type>error</type>
1326
  </POSTNL-0066>
1327
  <POSTNL-0067>
1328
  <message>Invalid counter: %s</message>
1329
- <url>http://kb.totalinternetgroup.nl/topic/31973693</url>
1330
  <type>error</type>
1331
  </POSTNL-0067>
1332
  <POSTNL-0068>
1333
  <message>Number of parcels not allowed. Amount requested: %s, maximum allowed: %s.</message>
1334
- <url>http://kb.totalinternetgroup.nl/topic/31973693</url>
1335
  <type>error</type>
1336
  </POSTNL-0068>
1337
  <POSTNL-0069>
1338
  <message>The generateBarcodes action is currently unavailable.</message>
1339
- <url>http://kb.totalinternetgroup.nl/topic/32416446</url>
1340
  <type>error</type>
1341
  </POSTNL-0069>
1342
  <POSTNL-0070>
1343
  <message>Unable to generate barcode for this shipment: %s</message>
1344
- <url>http://kb.totalinternetgroup.nl/topic/31974103</url>
1345
  <type>error</type>
1346
  </POSTNL-0070>
1347
  <POSTNL-0071>
1348
  <message>The confirmAndPrintLabel action returned an invalid response: %s</message>
1349
- <url>http://kb.totalinternetgroup.nl/topic/31928088</url>
1350
  <type>error</type>
1351
  </POSTNL-0071>
1352
  <POSTNL-0072>
1353
  <message>Invalid confirm response received: %s</message>
1354
- <url>http://kb.totalinternetgroup.nl/topic/31976783</url>
1355
  <type>error</type>
1356
  </POSTNL-0072>
1357
  <POSTNL-0073>
1358
  <message>The updateShippingStatus action is currently unavailable.</message>
1359
- <url>http://kb.totalinternetgroup.nl/topic/31930018</url>
1360
  <type>error</type>
1361
  </POSTNL-0073>
1362
  <POSTNL-0074>
1363
  <message>The updateCompleteShippingStatus action is currently unavailable.</message>
1364
- <url>http://kb.totalinternetgroup.nl/topic/31930488</url>
1365
  <type>error</type>
1366
  </POSTNL-0074>
1367
  <POSTNL-0075>
1368
  <message>Unable to add tracking info: no barcode or shipment available.</message>
1369
- <url>http://kb.totalinternetgroup.nl/topic/31977793</url>
1370
  <type>error</type>
1371
  </POSTNL-0075>
1372
  <POSTNL-0076>
1373
  <message>The sendTrackAndTraceEmail action is currently unavailable.</message>
1374
- <url>http://kb.totalinternetgroup.nl/topic/31930908</url>
1375
  <type>error</type>
1376
  </POSTNL-0076>
1377
  <POSTNL-0077>
1378
  <message>Unable to send track and trace email for shipment #%s</message>
1379
- <url>http://kb.totalinternetgroup.nl/topic/31977863</url>
1380
  <type>error</type>
1381
  </POSTNL-0077>
1382
  <POSTNL-0078>
1383
  <message>Product code %s is not allowed for this shipment.</message>
1384
- <url>http://kb.totalinternetgroup.nl/topic/31978843</url>
1385
  <type>error</type>
1386
  </POSTNL-0078>
1387
  <POSTNL-0079>
1388
  <message>Invalid activateWebshop response: %s</message>
1389
- <url>http://kb.totalinternetgroup.nl/topic/31978413</url>
1390
  <type>error</type>
1391
  </POSTNL-0079>
1392
  <POSTNL-0080>
1393
  <message>Unable to update statistics. This feature has been disabled.</message>
1394
- <url>http://kb.totalinternetgroup.nl/topic/31978413</url>
1395
  <type>error</type>
1396
  </POSTNL-0080>
1397
  <POSTNL-0081>
1398
  <message>No private or unique key found. Unable to complete the request.</message>
1399
- <url>http://kb.totalinternetgroup.nl/topic/31979763</url>
1400
  <type>error</type>
1401
  </POSTNL-0081>
1402
  <POSTNL-0082>
1403
  <message>Invalid updateStatistics response: %s</message>
1404
- <url>http://kb.totalinternetgroup.nl/topic/31918757</url>
1405
  <type>error</type>
1406
  </POSTNL-0082>
1407
  <POSTNL-0083>
1408
  <message>PostNL extension has been successfully updated to version %s</message>
1409
- <url>http://kb.totalinternetgroup.nl/topic/31921907</url>
1410
  <type>notice</type>
1411
  </POSTNL-0083>
1412
  <POSTNL-0084>
1413
  <message>Unable to save shipping_status cron expression: %s</message>
1414
- <url>http://kb.totalinternetgroup.nl/topic/31940658</url>
1415
  <type>error</type>
1416
  </POSTNL-0084>
1417
  <POSTNL-0085>
1418
  <message>Unable to save update_statistics cron expression: %s</message>
1419
- <url>http://kb.totalinternetgroup.nl/topic/31925327</url>
1420
  <type>error</type>
1421
  </POSTNL-0085>
1422
  <POSTNL-0086>
1423
  <message>The PostNL extension is not compatible with your Magento version! This may cause unexpected behaviour.</message>
1424
- <url>http://kb.totalinternetgroup.nl/topic/31925577</url>
1425
  <type>warning</type>
1426
  </POSTNL-0086>
1427
  <POSTNL-0087>
1428
  <message>Wrong message type</message>
1429
- <url>http://kb.totalinternetgroup.nl/topic/31566016</url>
1430
  <type>error</type>
1431
  </POSTNL-0087>
1432
  <POSTNL-0088>
1433
  <message>Invalid session requested.</message>
1434
- <url>http://kb.totalinternetgroup.nl/topic/32430366</url>
1435
  <type>error</type>
1436
  </POSTNL-0088>
1437
  <POSTNL-0089>
1438
  <message>No message supplied.</message>
1439
- <url>http://kb.totalinternetgroup.nl/topic/31925967</url>
1440
  <type>error</type>
1441
  </POSTNL-0089>
1442
  <POSTNL-0090>
1443
  <message>No message type supplied.</message>
1444
- <url>http://kb.totalinternetgroup.nl/topic/31988933</url>
1445
  <type>error</type>
1446
  </POSTNL-0090>
1447
  <POSTNL-0091>
1448
  <message>Missing country of origin value for product #%s.</message>
1449
- <url>http://kb.totalinternetgroup.nl/topic/31988983</url>
1450
  <type>error</type>
1451
  </POSTNL-0091>
1452
  <POSTNL-0092>
1453
  <message>Missing customs value for product #%s.</message>
1454
- <url>http://kb.totalinternetgroup.nl/topic/32432746</url>
1455
  <type>error</type>
1456
  </POSTNL-0092>
1457
  <POSTNL-0093>
1458
  <message>Missing customs description for product #%s.</message>
1459
- <url>http://kb.totalinternetgroup.nl/topic/31944008</url>
1460
  <type>error</type>
1461
  </POSTNL-0093>
1462
  <POSTNL-0094>
1463
  <message>Invalid message type requested: %s.</message>
1464
- <url>http://kb.totalinternetgroup.nl/topic/33566806</url>
1465
  <type>error</type>
1466
  </POSTNL-0094>
1467
  <POSTNL-0095>
1468
  <message>Config form fieldset clone model required to be able to clone fields</message>
1469
- <url>http://kb.totalinternetgroup.nl/topic/33059188</url>
1470
  <type>error</type>
1471
  </POSTNL-0095>
1472
  <POSTNL-0096>
1473
  <message>Unable to read directory: %s</message>
1474
- <url>http://kb.totalinternetgroup.nl/topic/33063203</url>
1475
  <type>error</type>
1476
  </POSTNL-0096>
1477
  <POSTNL-0097>
1478
  <message>Invalid UpdateOrder response: %s</message>
1479
- <url>http://kb.totalinternetgroup.nl/topic/33064418</url>
1480
  <type>error</type>
1481
  </POSTNL-0097>
1482
  <POSTNL-0098>
1483
  <message>The PostNL Extension is currently configured in test mode.</message>
1484
- <url>http://kb.totalinternetgroup.nl/topic/46536473</url>
1485
  <type>warning</type>
1486
  </POSTNL-0098>
1487
 
@@ -1490,307 +1578,307 @@
1490
  <POSTNL-0100>
1491
  <!-- This error is generated by CIF, however we have designated it an error code -->
1492
  <message>The user is not authorized for this barcode</message>
1493
- <url>http://kb.totalinternetgroup.nl/topic/32435446</url>
1494
  <type>error</type>
1495
  </POSTNL-0100>
1496
  <POSTNL-0101>
1497
  <message>The quote's total weight is below the miniumum required to use PostNL Checkout.</message>
1498
- <url>http://kb.totalinternetgroup.nl/topic/32433656</url>
1499
  <type>notice</type>
1500
  </POSTNL-0101>
1501
  <POSTNL-0102>
1502
  <message>One or more items in the cart are out of stock.</message>
1503
- <url>http://kb.totalinternetgroup.nl/topic/31993743</url>
1504
  <type>notice</type>
1505
  </POSTNL-0102>
1506
  <POSTNL-0103>
1507
  <message>PostNL Checkout has been disabled.</message>
1508
- <url>http://kb.totalinternetgroup.nl/topic/31947888</url>
1509
  <type>notice</type>
1510
  </POSTNL-0103>
1511
  <POSTNL-0104>
1512
  <message>The quote is virtual.</message>
1513
- <url>http://kb.totalinternetgroup.nl/topic/32436016</url>
1514
  <type>notice</type>
1515
  </POSTNL-0104>
1516
  <POSTNL-0105>
1517
  <message>The quote's grand total is below the minimum amount required.</message>
1518
- <url>http://kb.totalinternetgroup.nl/topic/32759156</url>
1519
  <type>notice</type>
1520
  </POSTNL-0105>
1521
  <POSTNL-0106>
1522
  <message>No standard product options are enabled. At least 1 option must be active.</message>
1523
- <url>http://kb.totalinternetgroup.nl/topic/32288438</url>
1524
  <type>notice</type>
1525
  </POSTNL-0106>
1526
  <POSTNL-0107>
1527
  <message>You have not yet enabled the PostNL extension.</message>
1528
- <url>http://kb.totalinternetgroup.nl/topic/32266563</url>
1529
  <type>notice</type>
1530
  </POSTNL-0107>
1531
  <POSTNL-0108>
1532
  <message>Invalid address type supplied: %s</message>
1533
- <url>http://kb.totalinternetgroup.nl/topic/32295088</url>
1534
  <type>error</type>
1535
  </POSTNL-0108>
1536
  <POSTNL-0109>
1537
  <message>The confirm action is currently unavailable.</message>
1538
- <url>http://kb.totalinternetgroup.nl/topic/32772946</url>
1539
  <type>error</type>
1540
  </POSTNL-0109>
1541
  <POSTNL-0110>
1542
  <message>The confirmAndGenerateLabel action is currently unavailable.</message>
1543
- <url>http://kb.totalinternetgroup.nl/topic/32279277</url>
1544
  <type>error</type>
1545
  </POSTNL-0110>
1546
  <POSTNL-0111>
1547
  <message>Unable to retrieve barcode data.</message>
1548
- <url>http://kb.totalinternetgroup.nl/topic/38561927</url>
1549
  <type>error</type>
1550
  </POSTNL-0111>
1551
  <POSTNL-0112>
1552
  <message>Your shopping cart is empty. Please add a product and try again.</message>
1553
- <url>http://kb.totalinternetgroup.nl/topic/38561597</url>
1554
  <type>error</type>
1555
  </POSTNL-0112>
1556
  <POSTNL-0113>
1557
  <message>An error occurred while updating the PostNL Checkout order.</message>
1558
- <url>http://kb.totalinternetgroup.nl/topic/38931193</url>
1559
  <type>warning</type>
1560
  </POSTNL-0113>
1561
  <POSTNL-0114>
1562
  <message>Your PostNL account credentials could not be validated. Please enter valid PostNL account credentials before activating the postcode check functionality.</message>
1563
- <url>http://kb.totalinternetgroup.nl/topic/52364673</url>
1564
  <type>error</type>
1565
  </POSTNL-0114>
1566
  <POSTNL-0115>
1567
  <message>No data available for GetDeliveryDay request.</message>
1568
- <url>http://kb.totalinternetgroup.nl/topic/52364963</url>
1569
  <type>error</type>
1570
  </POSTNL-0115>
1571
  <POSTNL-0116>
1572
  <message>Invalid GetDeliveryDate response: %s</message>
1573
- <url>http://kb.totalinternetgroup.nl/topic/52982498</url>
1574
  <type>error</type>
1575
  </POSTNL-0116>
1576
  <POSTNL-0117>
1577
  <message>No data available for request.</message>
1578
- <url>http://kb.totalinternetgroup.nl/topic/53527926</url>
1579
  <type>error</type>
1580
  </POSTNL-0117>
1581
  <POSTNL-0118>
1582
  <message>Invalid postcode supplied for getNearestLocations request: %s</message>
1583
- <url>http://kb.totalinternetgroup.nl/topic/53014647</url>
1584
  <type>error</type>
1585
  </POSTNL-0118>
1586
  <POSTNL-0119>
1587
  <message>Invalid coordinates supplied for getNearestLocations request. lat: %s, long: %s</message>
1588
- <url>http://kb.totalinternetgroup.nl/topic/53015967</url>
1589
  <type>error</type>
1590
  </POSTNL-0119>
1591
  <POSTNL-0120>
1592
  <message>Invalid arguments supplied. getNearestLocations requires a postcode or a longitude and latitude.</message>
1593
- <url>http://kb.totalinternetgroup.nl/topic/52369463</url>
1594
  <type>error</type>
1595
  </POSTNL-0120>
1596
  <POSTNL-0121>
1597
  <message>Invalid delivery date supplied: %s</message>
1598
- <url>http://kb.totalinternetgroup.nl/topic/52985978</url>
1599
  <type>error</type>
1600
  </POSTNL-0121>
1601
  <POSTNL-0122>
1602
  <message>Invalid response for GetDeliveryTimeframes request: %s</message>
1603
- <url>http://kb.totalinternetgroup.nl/topic/53017197</url>
1604
  <type>error</type>
1605
  </POSTNL-0122>
1606
  <POSTNL-0123>
1607
  <message>Invalid response for GetNearestLocations request: %s</message>
1608
- <url>http://kb.totalinternetgroup.nl/topic/52986878</url>
1609
  <type>error</type>
1610
  </POSTNL-0123>
1611
  <POSTNL-0124>
1612
  <message>Invalid arguments supplied. GetDeliveryTimeframes requires a postcode and a housenumber.</message>
1613
- <url>http://kb.totalinternetgroup.nl/topic/53532186</url>
1614
  <type>error</type>
1615
  </POSTNL-0124>
1616
  <POSTNL-0125>
1617
  <message>Invalid postcode supplied for GetDeliveryTimeframes request: %s Postcodes may only contain 4 numbers and 2 letters.</message>
1618
- <url>http://kb.totalinternetgroup.nl/topic/52371803</url>
1619
  <type>error</type>
1620
  </POSTNL-0125>
1621
  <POSTNL-0126>
1622
  <message>Invalid housenumber supplied for GetDeliveryTimeframes request: %s Housenumbers may only contain digits.</message>
1623
- <url>http://kb.totalinternetgroup.nl/topic/52988088</url>
1624
  <type>error</type>
1625
  </POSTNL-0126>
1626
  <POSTNL-0127>
1627
  <message>Invalid shipping duration: %s. Shipping duration must be between 1 and 14 days.</message>
1628
- <url>http://kb.totalinternetgroup.nl/topic/52372583</url>
1629
  <type>error</type>
1630
  </POSTNL-0127>
1631
  <POSTNL-0128>
1632
  <message>Invalid arguments supplied. getNearestLocationsInArea requires two sets of coordinates.</message>
1633
- <url>http://kb.totalinternetgroup.nl/topic/53020717</url>
1634
  <type>error</type>
1635
  </POSTNL-0128>
1636
  <POSTNL-0129>
1637
  <message>Invalid NE coordinates supplied for getLocationsInArea request. lat: %s, long: %s</message>
1638
- <url>http://kb.totalinternetgroup.nl/topic/53534856</url>
1639
  <type>error</type>
1640
  </POSTNL-0129>
1641
  <POSTNL-0130>
1642
  <message>Invalid SW coordinates supplied for getLocationsInArea request. lat: %s, long: %s</message>
1643
- <url>http://kb.totalinternetgroup.nl/topic/53535436</url>
1644
  <type>error</type>
1645
  </POSTNL-0130>
1646
  <POSTNL-0131>
1647
  <message>Invalid postcode supplied for GetDeliveryDate request: %s Postcodes may only contain 4 numbers and 2 letters.</message>
1648
- <url>http://kb.totalinternetgroup.nl/topic/53022657</url>
1649
  <type>error</type>
1650
  </POSTNL-0131>
1651
  <POSTNL-0132>
1652
  <message>PostNL delivery options are only available for Dutch shipping addresses.</message>
1653
- <url>http://kb.totalinternetgroup.nl/topic/52384143</url>
1654
  <type>error</type>
1655
  </POSTNL-0132>
1656
  <POSTNL-0133>
1657
  <message>You have not yet enabled PostNL delivery options.</message>
1658
- <url>http://kb.totalinternetgroup.nl/topic/53003058</url>
1659
  <type>error</type>
1660
  </POSTNL-0133>
1661
  <POSTNL-0134>
1662
  <message>The SOAP extension is not installed. PostNL requires the SOAP extension to communicate with PostNL.</message>
1663
- <url>http://kb.totalinternetgroup.nl/topic/52387393</url>
1664
  <type>error</type>
1665
  </POSTNL-0134>
1666
  <POSTNL-0135>
1667
  <message>The OpenSSL extension is not installed. The PostNL extension requires the OpenSSL extension to secure the communications with the PostNL servers.</message>
1668
- <url>http://kb.totalinternetgroup.nl/topic/52387703</url>
1669
  <type>error</type>
1670
  </POSTNL-0135>
1671
  <POSTNL-0136>
1672
  <message>The specified method "%s" is not callable.</message>
1673
- <url>http://kb.totalinternetgroup.nl/topic/53034097</url>
1674
  <type>error</type>
1675
  </POSTNL-0136>
1676
  <POSTNL-0137>
1677
  <message>The MCrypt extension is not installed. The PostNL extension requires the MCrypt extension to secure the communications with the PostNL servers.</message>
1678
- <url>http://kb.totalinternetgroup.nl/topic/53550106</url>
1679
  <type>error</type>
1680
  </POSTNL-0137>
1681
  <POSTNL-0138>
1682
  <message>Invalid arguments supplied. In order to save a selected option, a type, delivery date and optional extra costs are required.</message>
1683
- <url>http://kb.totalinternetgroup.nl/topic/52389583</url>
1684
  <type>error</type>
1685
  </POSTNL-0138>
1686
  <POSTNL-0139>
1687
  <message>Invalid type supplied: %s</message>
1688
- <url>http://kb.totalinternetgroup.nl/topic/53035527</url>
1689
  <type>error</type>
1690
  </POSTNL-0139>
1691
  <POSTNL-0140>
1692
  <message>Invalid extra costs supplied: %s Extra costs must be supplied as a float.</message>
1693
- <url>http://kb.totalinternetgroup.nl/topic/53552216</url>
1694
  <type>error</type>
1695
  </POSTNL-0140>
1696
  <POSTNL-0141>
1697
  <message>Invalid argument supplied. A valid PakjeGemak address must contain at least a city, country code, street, house number, phonenumber and zipcode.</message>
1698
- <url>http://kb.totalinternetgroup.nl/topic/53037577</url>
1699
  <type>error</type>
1700
  </POSTNL-0141>
1701
  <POSTNL-0142>
1702
  <message>Invalid arguments supplied. The 'costs' parameter is required.</message>
1703
- <url>http://kb.totalinternetgroup.nl/topic/53037947</url>
1704
  <type>error</type>
1705
  </POSTNL-0142>
1706
  <POSTNL-0143>
1707
  <message>Invalid country code supplied: %s.</message>
1708
- <url>http://kb.totalinternetgroup.nl/topic/53554796</url>
1709
  <type>error</type>
1710
  </POSTNL-0143>
1711
  <POSTNL-0144>
1712
  <message>Invalid street supplied: %s.</message>
1713
- <url>http://kb.totalinternetgroup.nl/topic/52393003</url>
1714
  <type>error</type>
1715
  </POSTNL-0144>
1716
  <POSTNL-0145>
1717
  <message>Invalid housenumber supplied: %s.</message>
1718
- <url>http://kb.totalinternetgroup.nl/topic/53038967</url>
1719
  <type>error</type>
1720
  </POSTNL-0145>
1721
  <POSTNL-0146>
1722
  <message>Invalid postcode supplied: %s.</message>
1723
- <url>http://kb.totalinternetgroup.nl/topic/53039527</url>
1724
  <type>error</type>
1725
  </POSTNL-0146>
1726
  <POSTNL-0147>
1727
  <message>Invalid housenumber extension supplied: %s.</message>
1728
- <url>http://kb.totalinternetgroup.nl/topic/53009848</url>
1729
  <type>error</type>
1730
  </POSTNL-0147>
1731
  <POSTNL-0148>
1732
  <message>Invalid arguments supplied. The 'number' parameter is required.</message>
1733
- <url>http://kb.totalinternetgroup.nl/topic/53009968</url>
1734
  <type>error</type>
1735
  </POSTNL-0148>
1736
  <POSTNL-0149>
1737
  <message>Invalid mobile phone number supplied: %s.</message>
1738
- <url>http://kb.totalinternetgroup.nl/topic/53039917</url>
1739
  <type>error</type>
1740
  </POSTNL-0149>
1741
  <POSTNL-0150>
1742
  <message>The quote's total weight is below the miniumum required to use PostNL delivery options.</message>
1743
- <url>http://kb.totalinternetgroup.nl/topic/53040387</url>
1744
  <type>error</type>
1745
  </POSTNL-0150>
1746
  <POSTNL-0151>
1747
  <message>Invalid phone number supplied: %s.</message>
1748
- <url>http://kb.totalinternetgroup.nl/topic/58968276</url>
1749
  <type>error</type>
1750
  </POSTNL-0151>
1751
  <POSTNL-0152>
1752
  <message>Invalid arguments supplied. The 'costs' parameter requires an amount incl. and excl. VAT.</message>
1753
- <url>http://kb.totalinternetgroup.nl/topic/53557046</url>
1754
  <type>error</type>
1755
  </POSTNL-0152>
1756
  <POSTNL-0153>
1757
  <message>Invalid fee amount entered: %s incl. VAT. Please enter a value between 0.00 and 2.00 EUR incl. VAT.</message>
1758
- <url>http://kb.totalinternetgroup.nl/topic/58943736</url>
1759
  <type>error</type>
1760
  </POSTNL-0153>
1761
  <POSTNL-0154>
1762
  <message>Invalid name supplied: %s.</message>
1763
- <url>http://kb.totalinternetgroup.nl/topic/57784943</url>
1764
  <type>error</type>
1765
  </POSTNL-0154>
1766
  <POSTNL-0155>
1767
  <message>The current user is not allowed to perform this action.</message>
1768
- <url>http://kb.totalinternetgroup.nl/topic/58415077</url>
1769
  <type>error</type>
1770
  </POSTNL-0155>
1771
  <POSTNL-0156>
1772
  <message>The PostNL extension v%s has been successfully installed.</message>
1773
- <url>http://kb.totalinternetgroup.nl/topic/58945996</url>
1774
  <type>notice</type>
1775
  </POSTNL-0156>
1776
  <POSTNL-0157>
1777
  <message>Invalid token specified: %s</message>
1778
- <url>http://kb.totalinternetgroup.nl/topic/58416207</url>
1779
  <type>error</type>
1780
  </POSTNL-0157>
1781
  <POSTNL-0158>
1782
  <message>Invalid GetProfileAccessToken response: %s</message>
1783
- <url>http://kb.totalinternetgroup.nl/topic/58948686</url>
1784
  <type>error</type>
1785
  </POSTNL-0158>
1786
  <POSTNL-0159>
1787
  <message>You have chosen a default shipping option that is not supported. Please only select default options that you have selected in the 'Select supported option' field.</message>
1788
- <url>http://kb.totalinternetgroup.nl/topic/57789373</url>
1789
  <type>warning</type>
1790
  </POSTNL-0159>
1791
  <POSTNL-0160>
1792
  <message>A required configuration value is missing: %s.</message>
1793
- <url>http://kb.totalinternetgroup.nl/topic/94860156</url>
1794
  <type>error</type>
1795
  </POSTNL-0160>
1796
  <POSTNL-0161>
@@ -1800,142 +1888,142 @@
1800
  </POSTNL-0161>
1801
  <POSTNL-0162>
1802
  <message>Cannot create an invoice without products.</message>
1803
- <url>http://kb.totalinternetgroup.nl/topic/94861626</url>
1804
  <type>error</type>
1805
  </POSTNL-0162>
1806
  <POSTNL-0163>
1807
  <message>Order item #%s could not be invoiced.</message>
1808
- <url>http://kb.totalinternetgroup.nl/topic/93711773</url>
1809
  <type>error</type>
1810
  </POSTNL-0163>
1811
  <POSTNL-0164>
1812
  <message>Unable to create an invoice for this shipment due to the order missing.</message>
1813
- <url>http://kb.totalinternetgroup.nl/topic/93711923</url>
1814
  <type>error</type>
1815
  </POSTNL-0164>
1816
  <POSTNL-0165>
1817
  <message>Unable to create an invoice for this shipment because the order cannot be invoiced.</message>
1818
- <url>http://kb.totalinternetgroup.nl/topic/93712093</url>
1819
  <type>error</type>
1820
  </POSTNL-0165>
1821
  <POSTNL-0166>
1822
  <message>An error occurred while creating an invoice for this shipment.</message>
1823
- <url>http://kb.totalinternetgroup.nl/topic/93712203</url>
1824
  <type>error</type>
1825
  </POSTNL-0166>
1826
  <POSTNL-0167>
1827
  <message>No valid shipment type found for shipment #%s</message>
1828
- <url>http://kb.totalinternetgroup.nl/topic/93727133</url>
1829
  <type>error</type>
1830
  </POSTNL-0167>
1831
  <POSTNL-0168>
1832
  <message>No valid order available for packing slip.</message>
1833
- <url>http://kb.totalinternetgroup.nl/topic/93727223</url>
1834
  <type>error</type>
1835
  </POSTNL-0168>
1836
  <POSTNL-0169>
1837
  <message>Invalid label type supplied for packing slip label pdf: %s.</message>
1838
- <url>http://kb.totalinternetgroup.nl/topic/93727383</url>
1839
  <type>error</type>
1840
  </POSTNL-0169>
1841
  <POSTNL-0170>
1842
  <message>Approaching memory limit for this operation. Please select fewer shipments and try again.</message>
1843
- <url>http://kb.totalinternetgroup.nl/topic/95141016</url>
1844
  <type>error</type>
1845
  </POSTNL-0170>
1846
  <POSTNL-0171>
1847
  <message>None of the orders you have selected have any associated shipments. Please choose at least one order that has a shipment.</message>
1848
- <url>http://kb.totalinternetgroup.nl/topic/95141286</url>
1849
  <type>error</type>
1850
  </POSTNL-0171>
1851
  <POSTNL-0172>
1852
  <message>No valid log files were found.</message>
1853
- <url>http://kb.totalinternetgroup.nl/topic/95141546</url>
1854
  <type>error</type>
1855
  </POSTNL-0172>
1856
  <POSTNL-0173>
1857
  <message>Log %s is too large and was skipped.</message>
1858
- <url>http://kb.totalinternetgroup.nl/topic/93991283</url>
1859
  <type>warning</type>
1860
  </POSTNL-0173>
1861
  <POSTNL-0174>
1862
  <message>The total size of all log files exceeds the maximum size allowed.</message>
1863
- <url>http://kb.totalinternetgroup.nl/topic/93991313</url>
1864
  <type>error</type>
1865
  </POSTNL-0174>
1866
  <POSTNL-0175>
1867
  <message>The server's memory limit is less than %.0fMB. The PostNL extension requires at least %.0fMB to function properly. Using the PostNL extension on servers with less memory than this may cause unexpected errors.</message>
1868
- <url>http://kb.totalinternetgroup.nl/topic/95141856</url>
1869
  <type>warning</type>
1870
  </POSTNL-0175>
1871
  <POSTNL-0176>
1872
  <message>No shipment found for PostNL shipment #%d.</message>
1873
- <url>http://kb.totalinternetgroup.nl/topic/95141986</url>
1874
  <type>error</type>
1875
  </POSTNL-0176>
1876
  <POSTNL-0177>
1877
  <message>No order found for PostNL shipment #%d.</message>
1878
- <url>http://kb.totalinternetgroup.nl/topic/95142026</url>
1879
  <type>error</type>
1880
  </POSTNL-0177>
1881
  <POSTNL-0178>
1882
  <message>Maximum PostNL COD fee amount available to refunds is %s.</message>
1883
- <url>http://kb.totalinternetgroup.nl/topic/95142066</url>
1884
  <type>error</type>
1885
  </POSTNL-0178>
1886
  <POSTNL-0179>
1887
  <message>It is not possible to create partial shipments for orders placed using PostNL COD. Please create only full shipments.</message>
1888
- <url>http://kb.totalinternetgroup.nl/topic/93991833</url>
1889
  <type>error</type>
1890
  </POSTNL-0179>
1891
  <POSTNL-0180>
1892
  <message>The addTrackingCodeToShipment action is currently unavailable.</message>
1893
- <url>http://kb.totalinternetgroup.nl/topic/95142106</url>
1894
  <type>error</type>
1895
  </POSTNL-0180>
1896
  <POSTNL-0181>
1897
  <message>It appears the PostNL username and/or password you have entered is incorrect.</message>
1898
- <url>http://kb.totalinternetgroup.nl/topic/95142216</url>
1899
  <type>error</type>
1900
  </POSTNL-0181>
1901
  <POSTNL-0182>
1902
  <message>Your PostNL account is unfortunately not allowed to perform this action. Please contact PostNL.</message>
1903
- <url>http://kb.totalinternetgroup.nl/topic/93992103</url>
1904
  <type>error</type>
1905
  </POSTNL-0182>
1906
  <POSTNL-0183>
1907
  <message>Unfortunately you have exceeded the maximum amount of PostNL requests you may send each minute. Please wait a few minutes and try again. If this problem persists, please contact PostNL.</message>
1908
- <url>http://kb.totalinternetgroup.nl/topic/93992233</url>
1909
  <type>error</type>
1910
  </POSTNL-0183>
1911
  <POSTNL-0184>
1912
  <message>This PostNL service is currently disabled. Please contact PostNL.</message>
1913
- <url>http://kb.totalinternetgroup.nl/topic/93992253</url>
1914
  <type>error</type>
1915
  </POSTNL-0184>
1916
  <POSTNL-0185>
1917
  <message>There was a problem connecting to PostNL's services. This may be due to a timeout. Please wait a few minutes and try again. If this problem persists, please contact PostNL.</message>
1918
- <url>http://kb.totalinternetgroup.nl/topic/93992303</url>
1919
  <type>error</type>
1920
  </POSTNL-0185>
1921
  <POSTNL-0186>
1922
  <message>Your PostNL customer code appears to be incorrect. Please make sure you have entered the correct code.</message>
1923
- <url>http://kb.totalinternetgroup.nl/topic/95142616</url>
1924
  <type>error</type>
1925
  </POSTNL-0186>
1926
  <POSTNL-0187>
1927
  <message>The total size of all PostNL logs exceeds the maximum recommended size.</message>
1928
- <url>http://kb.totalinternetgroup.nl/topic/95142626</url>
1929
  <type>warning</type>
1930
  </POSTNL-0187>
1931
  <POSTNL-0188>
1932
  <message>No default product options are available for this shipment. Please check that you have correctly configured the available product options in the PostNL extension's configuration.</message>
1933
- <url>http://kb.totalinternetgroup.nl/topic/95142666</url>
1934
  <type>error</type>
1935
  </POSTNL-0188>
1936
  <POSTNL-0189>
1937
  <message>The default product option was not available for this shipment, so another product option was chosen. Please check if the default product options are configured correctly in the PostNL extension's configuration.</message>
1938
- <url>http://kb.totalinternetgroup.nl/topic/95142726</url>
1939
  <type>warning</type>
1940
  </POSTNL-0189>
1941
  <POSTNL-0190>
@@ -1945,24 +2033,59 @@
1945
  </POSTNL-0190>
1946
  <POSTNL-0191>
1947
  <message>The convertToBuspakje action is currently unavailable.</message>
1948
- <url>http://kb.totalinternetgroup.nl/topic/96044606</url>
1949
  <type>error</type>
1950
  </POSTNL-0191>
1951
  <POSTNL-0192>
1952
  <message>The convertToPackage action is currently unavailable.</message>
1953
- <url>http://kb.totalinternetgroup.nl/topic/94895313</url>
1954
  <type>error</type>
1955
  </POSTNL-0192>
1956
  <POSTNL-0193>
1957
  <message>The changeProductCode action is currently unavailable.</message>
1958
- <url>http://kb.totalinternetgroup.nl/topic/96045026</url>
1959
  <type>error</type>
1960
  </POSTNL-0193>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1961
 
1962
  <!-- These error codes are generated by CIF, not by this extension -->
1963
  <LIRS_0>
1964
  <message>Combilabel was not processed successfully for shipment with barcode %s. Normal label is generated and product code for shipment changed to 4944.</message>
1965
- <url>http://kb.totalinternetgroup.nl/topic/32432076</url>
1966
  <type>warning</type>
1967
  </LIRS_0>
1968
  </errors>
26
  * It is available through the world-wide-web at this URL:
27
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
28
  * If you are unable to obtain it through the world-wide-web, please send an email
29
+ * to servicedesk@tig.nl so we can send you a copy immediately.
30
  *
31
  * DISCLAIMER
32
  *
33
  * Do not edit or add to this file if you wish to upgrade this module to newer
34
  * versions in the future. If you wish to customize this module for your
35
+ * needs please contact servicedesk@tig.nl for more information.
36
  *
37
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
38
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
39
  */
40
  -->
41
  <config>
42
  <modules>
43
  <TIG_PostNL>
44
+ <version>1.4.1</version>
45
  </TIG_PostNL>
46
  </modules>
47
 
147
  <tablerate>
148
  <table>tig_postnl_tablerate</table>
149
  </tablerate>
150
+ <matrixrate>
151
+ <table>tig_postnl_matrixrate</table>
152
+ </matrixrate>
153
  </entities>
154
  </postnl_carrier_resource>
155
  </models>
481
 
482
  <frontend>
483
  <secure_url>
484
+ <postnl_checkout_summary>/postnl/checkout/summary/</postnl_checkout_summary>
485
+ <postnl_checkout_finishcheckout>/postnl/checkout/finishCheckout/</postnl_checkout_finishcheckout>
486
+ <postnl_checkout_cancel>/postnl/checkout/cancel/</postnl_checkout_cancel>
487
  <postnl_addressvalidation>/postnl/addressValidation</postnl_addressvalidation>
488
  <postnl_deliveryoptions>/postnl/deliveryOptions</postnl_deliveryoptions>
489
  <postnl_mijnpakket>/postnl/mijnpakket</postnl_mijnpakket>
548
  </checkout_deliveryoptions>
549
  </observers>
550
  </core_block_abstract_to_html_before>
551
+ <controller_action_postdispatch_checkout_onepage_saveShippingMethod>
552
+ <observers>
553
+ <!-- Saves selected PostNL options for Onepage checkout. -->
554
+ <checkout_shipping_method_save_options>
555
+ <type>singleton</type>
556
+ <class>postnl_deliveryoptions/observer_updatePostnlOrder</class>
557
+ <method>saveOptions</method>
558
+ </checkout_shipping_method_save_options>
559
+ </observers>
560
+ </controller_action_postdispatch_checkout_onepage_saveShippingMethod>
561
+ <controller_action_predispatch_onestepcheckout_ajax_set_methods_separate>
562
+ <observers>
563
+ <!-- Saves a selected PostNL options for OneStepCheckout. -->
564
+ <checkout_shipping_method_save_options>
565
+ <type>singleton</type>
566
+ <class>postnl_deliveryoptions/observer_updatePostnlOrder</class>
567
+ <method>saveOptions</method>
568
+ </checkout_shipping_method_save_options>
569
+ </observers>
570
+ </controller_action_predispatch_onestepcheckout_ajax_set_methods_separate>
571
  </events>
572
  </frontend>
573
 
650
  <model>postnl_core/observer_cron::removeOldLabels</model>
651
  </run>
652
  </postnl_remove_old_labels>
653
+ <!-- Update product attributes data. This needs to be performed for certain update scripts, however it can be very taxing on the server when there are a lot of products. Therefore we'll process it using a cronjob. -->
654
+ <postnl_update_product_attribute>
655
+ <!-- No cron expression. The cron expression is generated when the extension is updated and will be removed once the update has finished. -->
656
+ <run>
657
+ <model>postnl_core/observer_cron::updateProductAttribute</model>
658
+ </run>
659
+ </postnl_update_product_attribute>
660
  </jobs>
661
  </crontab>
662
 
689
  <fee>17.45</fee> <!-- Charge an additional fee of 17.45 EUR for the use of PostNL COD. This is the amount PostNL charges for using COD -->
690
  <fee_label>PostNL rembourstoeslag</fee_label> <!-- PostNL COD fee -->
691
  <order_status>processing</order_status> <!-- Pending status -->
692
+ <instructions/>
693
  <allowspecific>1</allowspecific> <!-- Allow only specific countries -->
694
  <specificcountry>NL</specificcountry> <!-- Allow only NL -->
 
695
  <min_order_total/>
696
  <max_order_total>2000</max_order_total> <!-- PostNL COD is only available for orders whose base grand total amount is less than 2000 EUR -->
697
  <allow_for_non_postnl>0</allow_for_non_postnl> <!-- Only show this payment method if the order is being shipped using PostNL -->
725
  </carriers>
726
  <postnl>
727
  <general>
 
 
728
  <email/>
729
  <unique_key/>
730
  <private_key/>
731
+ <is_activated>0</is_activated> <!-- Not activated -->
732
+ <webservice_wsdl_url>http://api.tigpostnl.nl/soap?wsdl</webservice_wsdl_url> <!-- URL of the TIG extension control system that is used for activating the extension -->
733
+ <changelog_url>http://kb.tig.nl/topic/38584893/</changelog_url> <!-- URL of the extension's changelog -->
734
+ <postnl_register_url>http://www.postnl.nl/zakelijk/e-commerce/flexibele-bezorgopties</postnl_register_url> <!-- URL where new PostNL customers can register -->
735
+ <knowledgebase_url>http://kb.tig.nl</knowledgebase_url> <!-- URL of the TIG knowledgebase -->
736
+ <new_ticket_url>http://kb.tig.nl/ticket/form/new</new_ticket_url> <!-- URL where merchants can submit a support ticket -->
737
+ <installation_manual_url>http://kb.tig.nl/topic/39335103</installation_manual_url> <!-- URL to the extension's installation manual -->
738
+ <user_guide_url>http://kb.tig.nl/topic/44206406</user_guide_url> <!-- URL to the extension's user guide -->
739
+ <kb_url>http://kb.tig.nl/forum/23046087</kb_url> <!-- URL of the TIG PostNL knowledgebase -->
740
+ </general>
741
+ <cif_address>
742
+ <firstname/>
743
+ <lastname/>
744
+ <company/>
745
+ <streetname/>
746
+ <housenumber/>
747
+ <housenumber_extension/>
748
+ <postcode/>
749
+ <city/>
750
+ <region/>
751
+ <country>NL</country> <!-- All sender addresses must be located in the Netherlands -->
752
+ <use_sender_address>1</use_sender_address> <!-- Use the sender address as the return address -->
753
+ <return_firstname/>
754
+ <return_lastname/>
755
+ <return_company/>
756
+ <return_streetname/>
757
+ <return_housenumber/>
758
+ <return_housenumber_extension/>
759
+ <return_postcode/>
760
+ <return_city/>
761
+ <return_region/>
762
+ <return_country>NL</return_country> <!-- All return addresses must be located in the Netherlands -->
763
+ </cif_address>
764
+ <cif_labels_and_confirming>
765
+ <label_size>A4</label_size> <!-- A4 size labels -->
766
+ <shipping_duration>1</shipping_duration> <!-- Shipping takes 1 day -->
767
+ <cutoff_time>17:00:00</cutoff_time> <!-- Add an extra shipping day if customers order after 17:00 P.M. -->
768
+ <allow_sunday_sorting>0</allow_sunday_sorting> <!-- Sunday sorting is disabled -->
769
+ <sunday_cutoff_time/>
770
+ <shipping_days>1,2,3,4,5,6</shipping_days> <!-- Orders are shipped monday through saturday -->
771
+ <checkout_extension>magento_onepagecheckout</checkout_extension> <!-- Use Magento's One Page CHeckout as the default checkout extension -->
772
+ <checkout_extension_other/>
773
+ <use_postcode_check>0</use_postcode_check> <!-- Do not use postcode check functionality -->
774
+ <postcode_check_in_checkout>1</postcode_check_in_checkout> <!-- Use postcode check on the checkout page -->
775
+ <postcode_check_in_addressbook>1</postcode_check_in_addressbook> <!-- Use postcode check in the customer's addressbook -->
776
+ <postcode_check_max_attempts>1</postcode_check_max_attempts> <!-- Allow 1 attempt before disabling postcode check and allowing users to enter their addess manually -->
777
+ <postcode_check_timeout>5</postcode_check_timeout> <!-- Postcode check will timeout after 5 seconds -->
778
+ <split_street>1</split_street> <!-- split street -->
779
+ <streetname_field>1</streetname_field> <!-- first address line -->
780
+ <housenr_field>2</housenr_field> <!-- second address line -->
781
+ <split_housenr>0</split_housenr> <!-- do not split housenumber and houndenumber extension -->
782
+ <housenr_extension_field>3</housenr_extension_field> <!-- third address line (not used, since split_housenr is disabled) -->
783
+ <area_field/>
784
+ <building_name_field/>
785
+ <department_field/>
786
+ <doorcode_field/>
787
+ <floor_field/>
788
+ <remark_field/>
789
+ </cif_labels_and_confirming>
790
+ <delivery_options>
791
+ <delivery_options_active>0</delivery_options_active> <!-- Delivery options are disabled -->
792
+ <theme>default</theme> <!-- Use the default PostNL theme -->
793
+ <responsive>0</responsive> <!-- Do not use the responsive design -->
794
+ <show_options_for_backorders>0</show_options_for_backorders> <!-- Do not show delivery options if the order is not in stock -->
795
+ <enable_delivery_days>1</enable_delivery_days> <!-- Delivery days are allowed -->
796
+ <delivery_days_number>7</delivery_days_number> <!-- Show up to 7 delivery days -->
797
+ <enable_timeframes>1</enable_timeframes> <!-- Timeframes are allowed -->
798
+ <enable_evening_timeframes>1</enable_evening_timeframes> <!-- Evening timeframes are enabled -->
799
+ <evening_timeframe_fee>2</evening_timeframe_fee> <!-- Evening timeframes cost 2 {base currency} extra -->
800
+ <enable_pakjegemak>1</enable_pakjegemak> <!-- PakjeGemak locations are allowed -->
801
+ <enable_pakjegemak_express>1</enable_pakjegemak_express> <!-- PakjeGemak express locations are allowed -->
802
+ <pakjegemak_express_fee>2</pakjegemak_express_fee> <!-- PakjeGemak Express locations cost 2 {base currency} extra -->
803
+ <enable_pakketautomaat_locations>1</enable_pakketautomaat_locations> <!-- Pakketautomaat locations are allowed -->
804
+ <allow_streetview>1</allow_streetview> <!-- Google streetview is allowed. -->
805
+ <show_options_for_buspakje>0</show_options_for_buspakje> <!-- Do not show delivery options if the order is a letter box parcel -->
806
+ <show_all_options_for_buspakje>0</show_all_options_for_buspakje> <!-- Do not show all delivery options for letter box parcel orders -->
807
+ <enable_delivery_days_for_buspakje>1</enable_delivery_days_for_buspakje> <!-- Show delivery days for letter box parcel orders -->
808
+ <enable_pakjegemak_for_buspakje>0</enable_pakjegemak_for_buspakje> <!-- Do not show post office locations for letter box parcel orders -->
809
+ <enable_pakketautomaat_for_buspakje>0</enable_pakketautomaat_for_buspakje> <!-- Do not show parcel dispenser locations for letter box parcel orders -->
810
+ <stated_address_only_option>0</stated_address_only_option> <!-- Do not show the 'stated address only' option -->
811
+ <stated_address_only_checked>0</stated_address_only_checked> <!-- The stated address only option is not checked by default -->
812
+ <stated_address_only_fee>0.26</stated_address_only_fee> <!-- Charge 26 cents extra -->
813
+ <mijnpakket_login_active>1</mijnpakket_login_active> <!-- Enable MijnPakket login -->
814
+ <mijnpakket_notification>0</mijnpakket_notification> <!-- Do not show MijnPakket notifications after customers have placed their order -->
815
+ <show_create_mijnpakket_account_link>1</show_create_mijnpakket_account_link> <!-- Show the create MijnPakket account link -->
816
+ <show_mijnpakket_app_link>1</show_mijnpakket_app_link> <!-- Show the MijnPakket app link -->
817
+ <use_buspakje>1</use_buspakje> <!-- Use buspakje -->
818
+ <buspakje_calculation_mode>manual</buspakje_calculation_mode> <!-- Manually determine if a shipment is a buspakje shipment -->
819
+ <create_account_base_url>https://mijnpakket.postnl.nl/Register/RegisterFromWebshop?</create_account_base_url> <!-- Base URl for create MijnPakket account link -->
820
+ <mijnpakket_live_base_url>https://mijnpakket.postnl.nl/</mijnpakket_live_base_url> <!-- Base URL for MijnPakket in live mode -->
821
+ <mijnpakket_test_base_url>https://tppwscheckout-sandbox.e-id.nl/</mijnpakket_test_base_url> <!-- Base URL for MijnPakket in test mode -->
822
+ <mijnpakket_login_js_path>Checkout2/Login.js</mijnpakket_login_js_path> <!-- Path to MijnPakket login JS file -->
823
+ <mijnpakket_checkout_premium_js_path>Checkout2/CheckoutPremium.js</mijnpakket_checkout_premium_js_path> <!-- Path to MijnPakket Checkout premium JS file -->
824
+ <mijnpakket_login_btn_live_base_url>https://checkout.postnl.nl/</mijnpakket_login_btn_live_base_url> <!-- Base URL for MijnPakket login button in live mode -->
825
+ <mijnpakket_login_btn_test_base_url>https://tppcb-sandbox.e-id.nl/</mijnpakket_login_btn_test_base_url> <!-- Base URL for MijnPakket login button in test mode -->
826
+ <mijnpakket_login_btn_url_path>Button/PremiumLogin</mijnpakket_login_btn_url_path> <!-- Path to MijnPakket login button -->
827
+ <default_pakketautomaat_product_option>3553</default_pakketautomaat_product_option> <!-- Parcel dispenser -->
828
+ </delivery_options>
829
  <cif>
830
+ <mode>0</mode> <!-- The extension is disabled by default -->
831
  <customer_number>11223344</customer_number> <!-- Demo customer number -->
832
  <customer_code>TOTA</customer_code> <!-- Demo customer code -->
833
  <live_username/>
837
  <collection_location>103861</collection_location> <!-- Demo collection location -->
838
  <webshop_id/> <!-- The demo webshop ID will be generated on install as it needs to be encrypted -->
839
  <public_webshop_id>a98e0769d6bf40a8b49d85e7aff41d7a</public_webshop_id> <!-- Demo public webshop ID -->
840
+ <wsdl_base_url>https://service.postnl.com/CIF/</wsdl_base_url> <!-- Base URL of CIF WSDL files -->
841
+ <test_wsdl_base_url>https://testservice.postnl.com/CIF_SB/</test_wsdl_base_url> <!-- Base URL of CIF sandbox WSDL files -->
842
+ <track_and_trace_nl_base_url>https://mijnpakket.postnl.nl/Inbox/Search?</track_and_trace_nl_base_url> <!-- Base URL for the Dutch track & trace page -->
843
+ <track_and_trace_int_base_url>https://www.internationalparceltracking.com/Main.aspx#/track</track_and_trace_int_base_url> <!-- Base URL for the international track & trace page -->
844
+ </cif>
845
+ <packing_slip>
 
 
846
  <shipment_reference_type>shipment_increment_id</shipment_reference_type> <!-- Use the shipment's increment ID as the shipment reference -->
847
  <custom_shipment_reference/>
848
+ <show_label>1</show_label> <!-- Automatically add the shipping label to the packing slip -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
849
  <logo/>
850
  <show_webshop_info>1</show_webshop_info> <!-- Show webshop info on the packing slip -->
851
  <coc_number/>
863
  <show_comment>1</show_comment> <!-- Show a comment on the packing slip -->
864
  <comment_type>shipment_comment</comment_type> <!-- Show the shipment's last comment, rather than a pre-defined comment -->
865
  <comment_text/>
866
+ <weight_per_parcel>20000</weight_per_parcel> <!-- 20 kg -->
867
+ <weight_unit>gram</weight_unit> <!-- gram -->
868
  </packing_slip>
869
+ <track_and_trace>
870
+ <send_track_and_trace_email>1</send_track_and_trace_email> <!-- automatically send a track & trace email to the customer -->
871
+ <track_and_trace_email_template>postnl_cif_labels_and_confirming_track_and_trace_email_template</track_and_trace_email_template> <!-- Default template from locale -->
872
+ <send_copy>0</send_copy> <!-- Do not send a copy of the track & trace email -->
873
+ <copy_to/>
874
+ <copy_method>bcc</copy_method> <!-- Use the bcc method for sending the track & trace email copy -->
875
+ </track_and_trace>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
876
  <cod>
877
  <account_name/>
878
  <iban/>
879
  <bic/>
880
  <auto_invoice>1</auto_invoice> <!-- Enable auto-invoice -->
881
  <allow_cod_for_buspakje>0</allow_cod_for_buspakje> <!-- Disable COD for letter box parcels -->
882
+ <default_cod_product_option>3086</default_cod_product_option> <!-- COD -->
883
+ <default_evening_cod_product_option>3086</default_evening_cod_product_option> <!-- COD -->
884
+ <default_pakjegemak_cod_product_option>3535</default_pakjegemak_cod_product_option> <!-- Post Office + COD -->
885
+ <default_pge_cod_product_option>3545</default_pge_cod_product_option> <!-- Post Office + COD + Notification -->
886
  </cod>
887
+ <cif_globalpack_settings>
888
+ <use_globalpack>0</use_globalpack> <!-- Do not use GlobalPack -->
889
+ <global_barcode_type>CD</global_barcode_type> <!-- Demo barcode type -->
890
+ <global_barcode_range>1660</global_barcode_range> <!-- Demo barcode range -->
891
+ <customs_license_number/>
892
+ <customs_certificate_number/>
893
  <default_shipment_type>Commercial Goods</default_shipment_type>
894
+ <use_hs_tariff>0</use_hs_tariff> <!-- Do not use a specific HS tariff -->
895
+ <hs_tariff_attribute/>
896
+ <customs_value_attribute>price</customs_value_attribute> <!-- price attribute -->
897
+ <country_of_origin_attribute>country_of_manufacture</country_of_origin_attribute> <!-- country of manufacture attribute -->
898
+ <description_attribute>name</description_attribute> <!-- name attribute -->
899
+ <product_sorting_attribute>price</product_sorting_attribute> <!-- price attribute -->
900
+ <product_sorting_direction>desc</product_sorting_direction> <!-- descending -->
901
+ <default_global_product_option>4945</default_global_product_option> <!-- GlobalPack -->
902
+ </cif_globalpack_settings>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
903
  <checkout>
904
  <active>0</active> <!-- PostNL Checkout is inactive -->
905
  <show_exclusively_for_mijnpakket_users>0</show_exclusively_for_mijnpakket_users> <!-- Do not show PostNL Checkout exclusively to MijnPakket users -->
917
  <agree_conditions>1</agree_conditions> <!-- Customers must first agree to the webshop's terms and conditions -->
918
  <contact_url/>
919
  <service_url/>
920
+ <checkout_button_test_base_url>https://tppcb-sandbox.e-id.nl/Button/Checkout</checkout_button_test_base_url> <!-- Base URL for PostNl Checkout button in test mode -->
921
+ <checkout_button_live_base_url>https://checkout.postnl.nl/Button/Checkout</checkout_button_live_base_url> <!-- Base URL for PostNl Checkout button -->
922
+ <test_checkout_js_url>https://tppwscheckout-sandbox.e-id.nl/Checkout2/Scripts/Checkout.js</test_checkout_js_url> <!-- URL for PostNL Checkout JS file in test mode -->
923
+ <live_checkout_js_url>https://mijnpakket.postnl.nl/Checkout2/Scripts/Checkout.js</live_checkout_js_url> <!-- URL for PostNL Checkout JS file -->
924
+ <test_checkout_premium_js_url>https://tppwscheckout-sandbox.e-id.nl/Checkout2/CheckoutPremium.js</test_checkout_premium_js_url> <!-- URL for PostNL Checkout premium JS file in test mode -->
925
+ <live_checkout_premium_js_url>https://mijnpakket.postnl.nl/Checkout2/CheckoutPremium.js</live_checkout_premium_js_url> <!-- URL for PostNL Checkout premium JS file -->
926
  </checkout>
927
  <checkout_payment_methods>
928
  <ideal>0</ideal> <!-- Do not use iDEAL -->
952
  <klarna>0</klarna> <!-- Do not use Klarna -->
953
  <klarna_method/>
954
  </checkout_payment_methods>
955
+ <parcelware_export>
956
+ <active>0</active> <!-- Inactive -->
957
+ <auto_confirm>0</auto_confirm> <!-- Do not auto confirm -->
958
+ <contract_ref_nr/>
959
+ <contract_name/>
960
+ <sender_ref_nr/>
961
+ </parcelware_export>
962
+ <grid>
963
+ <show_grid_options>1</show_grid_options> <!-- Show product options in the order grid -->
964
+ <show_buspakje_option>1</show_buspakje_option> <!-- Show the option to mark a shipment as being a buspakje -->
965
+ <order_grid_columns>shipment_type</order_grid_columns> <!-- Show the shipment type column -->
966
+ <order_grid_massaction_default>postnl_create_shipments</order_grid_massaction_default> <!-- Select the create shipments mass action by default -->
967
+ <shipping_grid_columns>shipment_type,confirm_date,confirm_status,labels_printed,barcode,shipping_phase</shipping_grid_columns> <!-- Show the shipping description, shipment type, label-printed and shipping phase columns -->
968
+ <shipping_grid_massaction_default>postnl_print_labels_and_confirm</shipping_grid_massaction_default> <!-- 'Print labels and confirm shipment' massaction -->
969
+ <supported_product_options>3085,3086,3091,3093,3097,3087,3094,3189,3089,3389,3096,3090,3385,3390,3535,3545,3536,3546,3534,3544,3533,3543,4952,4945,3553,2928,2828</supported_product_options> <!-- all possible options except for EPS BE only -->
970
+ <default_product_option>3085</default_product_option> <!-- standard shipment -->
971
+ <use_alternative_default>0</use_alternative_default> <!-- Do not use an alternative default -->
972
+ <alternative_default_max_amount>100</alternative_default_max_amount> <!-- 100 EUR -->
973
+ <alternative_default_option>3189</alternative_default_option> <!-- Signature on delivery -->
974
+ <default_evening_product_option>3385</default_evening_product_option> <!-- Deliver to stated address only -->
975
+ <default_pakjegemak_product_option>3533</default_pakjegemak_product_option> <!-- Post Office + signature on delivery -->
976
+ <default_pge_product_option>3543</default_pge_product_option> <!-- Post Office + Signature on Delivery + Notification -->
977
+ <default_buspakje_product_option>2928</default_buspakje_product_option> <!-- Buspakje Extra -->
978
+ <default_stated_address_only_product_option>3385</default_stated_address_only_product_option> <!-- Deliver to stated address only -->
979
+ <default_eu_product_option>4952</default_eu_product_option> <!-- EU Pack Special to consumer (combilabel) -->
980
+ <default_eu_be_product_option>4955</default_eu_be_product_option> <!-- EU Pack Standard (Belgium only, no signature) (combilabel) -->
981
+ </grid>
982
+ <cif_product_options>
983
+ <allow_eps_be_only_options>0</allow_eps_be_only_options> <!-- Do not allow the EPS BE only product option -->
984
+ </cif_product_options>
985
  <advanced>
986
  <debug_mode>1</debug_mode> <!-- Exception logging only -->
987
  <infinite_label_printing>0</infinite_label_printing> <!-- do not allow infinite printing -->
993
  <feed_url>ext.tigpostnl.nl/rss</feed_url> <!-- Default URL for the RSS notification feed -->
994
  <feed_use_https>0</feed_use_https> <!-- use regular http:// to get the latest feed updates. At the moment https is not yet supported, however it may be in the future. -->
995
  <show_error_details_in_frontend>0</show_error_details_in_frontend> <!-- Do not show error details in the frontend -->
996
+ <postnl_shipping_methods>postnl_flatrate,postnl_tablerate,postnl_matrixrate</postnl_shipping_methods> <!-- By default only the PostNL shipping methods may be consider to be 'PostNL shipping methods' -->
997
  <cif_version_shippingstatus>1_3</cif_version_shippingstatus> <!-- v1.3 -->
998
  <cif_version_confirming>1_4</cif_version_confirming> <!-- v1.4 -->
999
  <cif_version_labelling>1_5</cif_version_labelling> <!-- v1.5 -->
1041
  <default translate="label" module="postnl">
1042
  <label>Default PostNL theme</label>
1043
  <use_cufon>1</use_cufon>
1044
+ <files>
1045
+ <onepage>
1046
+ <responsive>
1047
+ <default>css/TIG/PostNL/deliveryoptions/mediaqueries.css</default>
1048
+ </responsive>
1049
+ </onepage>
1050
+ <onestepcheckout>
1051
+ <responsive>
1052
+ <default>css/TIG/PostNL/deliveryoptions/mediaqueries.css</default>
1053
+ <osc>css/TIG/PostNL/deliveryoptions/onestepcheckout_mediaqueries.css</osc>
1054
+ </responsive>
1055
+ </onestepcheckout>
1056
+ </files>
1057
  </default>
1058
  <!-- An unbranded, white, gray and blue theme -->
1059
  <neutral translate="label" module="postnl">
1060
  <label>Neutral theme</label>
1061
  <use_cufon>1</use_cufon>
1062
  <files>
1063
+ <onepage>
1064
+ <main>css/TIG/PostNL/deliveryoptions/neutral.css</main>
1065
+ <responsive>
1066
+ <default>css/TIG/PostNL/deliveryoptions/mediaqueries.css</default>
1067
+ </responsive>
1068
+ </onepage>
1069
+ <onestepcheckout>
1070
+ <main>css/TIG/PostNL/deliveryoptions/onestepcheckout_neutral.css</main>
1071
+ <responsive>
1072
+ <default>css/TIG/PostNL/deliveryoptions/mediaqueries.css</default>
1073
+ <osc>css/TIG/PostNL/deliveryoptions/onestepcheckout_mediaqueries.css</osc>
1074
+ </responsive>
1075
+ </onestepcheckout>
1076
  </files>
1077
  </neutral>
1078
  </themes>
1084
  <!-- These are errors, warnings and notices that are generated by this extension -->
1085
  <POSTNL-0001>
1086
  <message>You have configured the extension for test mode only. You still must enter a live username and password before you may use the extension for real shipments.</message>
1087
+ <url>http://kb.tig.nl/topic/31114923</url>
1088
  <type>warning</type>
1089
  </POSTNL-0001>
1090
  <POSTNL-0002>
1091
  <message>You have not yet fully configured the extension. You must complete this process before you can use it.</message>
1092
+ <url>http://kb.tig.nl/topic/31565256</url>
1093
  <type>error</type>
1094
  </POSTNL-0002>
1095
  <POSTNL-0003>
1096
  <message>You have not yet configured the extension to use GlobalPack shipments. Please complete this process if you wish to ship parcels to outside the EU.</message>
1097
+ <url>http://kb.tig.nl/topic/31566436</url>
1098
  <type>notice</type>
1099
  </POSTNL-0003>
1100
  <POSTNL-0004>
1101
  <message>You have not yet configured PostNL Checkout. Please complete this process if you wish to use PostNL Checkout.</message>
1102
+ <url>http://kb.tig.nl/topic/31567046</url>
1103
  <type>notice</type>
1104
  </POSTNL-0004>
1105
  <POSTNL-0005>
1106
  <message>You currently do not use split street lines. Not using split street lines may cause errors in shipment processing as PostNL cannot support every possible address syntax. We strongly recommend using split street lines to avoid problems when using PostNL shipping. For more information, please contact PostNL support.</message>
1107
+ <url>http://kb.tig.nl/topic/31080848</url>
1108
  <type>warning</type>
1109
  </POSTNL-0005>
1110
  <POSTNL-0006>
1111
  <message>PostNL: It appears that your cron is not working properly. PostNL requires the cron to be active in order to function.</message>
1112
+ <url>http://kb.tig.nl/topic/31060037</url>
1113
  <type>warning</type>
1114
  </POSTNL-0006>
1115
  <POSTNL-0007>
1119
  </POSTNL-0007>
1120
  <POSTNL-0008>
1121
  <message>Please fill in your unique and private keys and try again.</message>
1122
+ <url>http://kb.tig.nl/topic/31079168</url>
1123
  <type>error</type>
1124
  </POSTNL-0008>
1125
  <POSTNL-0009>
1126
  <message>This action is not available for shipment #%s, because it was not shipped using PostNL.</message>
1127
+ <url>http://kb.tig.nl/topic/31061687</url>
1128
  <type>error</type>
1129
  </POSTNL-0009>
1130
  <POSTNL-0010>
1131
  <message>An error occurred while processing this action.</message>
1132
+ <url>http://kb.tig.nl/topic/31062917</url>
1133
  <type>error</type>
1134
  </POSTNL-0010>
1135
  <POSTNL-0011>
1136
  <message>Please select one or more orders.</message>
1137
+ <url>http://kb.tig.nl/topic/31570156</url>
1138
  <type>error</type>
1139
  </POSTNL-0011>
1140
  <POSTNL-0012>
1144
  </POSTNL-0012>
1145
  <POSTNL-0013>
1146
  <message>Please select one or more shipments.</message>
1147
+ <url>http://kb.tig.nl/topic/31120533</url>
1148
  <type>error</type>
1149
  </POSTNL-0013>
1150
  <POSTNL-0014>
1151
  <message>You can print a maximum of 200 labels at once.</message>
1152
+ <url>http://kb.tig.nl/topic/31083628</url>
1153
  <type>error</type>
1154
  </POSTNL-0014>
1155
  <POSTNL-0015>
1156
  <message>Order #%s cannot be shipped at this time.</message>
1157
+ <url>http://kb.tig.nl/topic/31083718</url>
1158
  <type>error</type>
1159
  </POSTNL-0015>
1160
  <POSTNL-0016>
1161
  <message>Shipment #%s could not be confirmed, because for EU shipments you may only confirm a shipment after it's labels have been printed.</message>
1162
+ <url>http://kb.tig.nl/topic/31573296</url>
1163
  <type>error</type>
1164
  </POSTNL-0016>
1165
  <POSTNL-0017>
1166
  <message>Shipment #%s has already been confirmed.</message>
1167
+ <url>http://kb.tig.nl/topic/31066127</url>
1168
  <type>error</type>
1169
  </POSTNL-0017>
1170
  <POSTNL-0018>
1171
  <message>Shipment #%s cannot be confirmed at this time.</message>
1172
+ <url>http://kb.tig.nl/topic/31123903</url>
1173
  <type>error</type>
1174
  </POSTNL-0018>
1175
  <POSTNL-0019>
1176
  <message>PostNL replied with the following warnings: %s</message>
1177
+ <url>http://kb.tig.nl/topic/31573886</url>
1178
  <type>warning</type>
1179
  </POSTNL-0019>
1180
  <POSTNL-0020>
1181
  <message>Error code %s: %s</message>
1182
+ <url>http://kb.tig.nl/topic/31086988</url>
1183
  <type>warning</type>
1184
  </POSTNL-0020>
1185
  <POSTNL-0021>
1186
  <message>An error occurred while processing your order. Please try again</message>
1187
+ <url>http://kb.tig.nl/topic/31085978</url>
1188
  <type>error</type>
1189
  </POSTNL-0021>
1190
  <POSTNL-0022>
1191
  <message>Unable to set Payment Method.</message>
1192
+ <url>http://kb.tig.nl/topic/31086728</url>
1193
  <type>error</type>
1194
  </POSTNL-0022>
1195
  <POSTNL-0023>
1196
  <message>Your order has been cancelled. Please try again.</message>
1197
+ <url>http://kb.tig.nl/topic/31069277</url>
1198
  <type>notice</type>
1199
  </POSTNL-0023>
1200
  <POSTNL-0024>
1201
  <message>Unfortunately the checkout process cannot be finished. Please try again.</message>
1202
+ <url>http://kb.tig.nl/topic/31069397</url>
1203
  <type>error</type>
1204
  </POSTNL-0024>
1205
  <POSTNL-0025>
1206
  <message>Unfortunately no PostNL Checkout order could be found. Please try again.</message>
1207
+ <url>http://kb.tig.nl/topic/31069667</url>
1208
  <type>error</type>
1209
  </POSTNL-0025>
1210
  <POSTNL-0026>
1211
  <message>It seems your cart has been changed since you started the checkout process. Please try again.</message>
1212
+ <url>http://kb.tig.nl/topic/31126613</url>
1213
  <type>error</type>
1214
  </POSTNL-0026>
1215
  <POSTNL-0027>
1216
  <message>You have not yet enabled PostNL Checkout.</message>
1217
+ <url>http://kb.tig.nl/topic/31576976</url>
1218
  <type>error</type>
1219
  </POSTNL-0027>
1220
  <POSTNL-0028>
1221
  <message>You need to enable at least one payment method.</message>
1222
+ <url>http://kb.tig.nl/topic/31070197</url>
1223
  <type>error</type>
1224
  </POSTNL-0028>
1225
  <POSTNL-0029>
1226
  <message>Unable to get valid barcodetype for postnl shipment id #%s</message>
1227
+ <url>http://kb.tig.nl/topic/31147298</url>
1228
  <type>error</type>
1229
  </POSTNL-0029>
1230
  <POSTNL-0030>
1231
  <message>You have not yet enabled the extension.</message>
1232
+ <url>http://kb.tig.nl/topic/31185593</url>
1233
  <type>error</type>
1234
  </POSTNL-0030>
1235
  <POSTNL-0031>
1236
  <message>The PostNL shipping method has not been enabled.</message>
1237
+ <url>http://kb.tig.nl/topic/31129647</url>
1238
  <type>error</type>
1239
  </POSTNL-0031>
1240
  <POSTNL-0032>
1241
  <message>The shop's base currency code must be set to EUR for PostNL to function.</message>
1242
+ <url>http://kb.tig.nl/topic/31129917</url>
1243
  <type>error</type>
1244
  </POSTNL-0032>
1245
  <POSTNL-0033>
1246
  <message>The extension has not been activated.</message>
1247
+ <url>http://kb.tig.nl/topic/31186323</url>
1248
  <type>error</type>
1249
  </POSTNL-0033>
1250
  <POSTNL-0034>
1251
  <message>%s > %s is required.</message>
1252
+ <url>http://kb.tig.nl/topic/31186983</url>
1253
  <type>error</type>
1254
  </POSTNL-0034>
1255
  <POSTNL-0035>
1256
  <message>Invalid Magento edition detected: %s</message>
1257
+ <url>http://kb.tig.nl/topic/31131717</url>
1258
  <type>error</type>
1259
  </POSTNL-0035>
1260
  <POSTNL-0036>
1261
  <message>Invalid rate type requested: %s</message>
1262
+ <url>http://kb.tig.nl/topic/31150488</url>
1263
  <type>error</type>
1264
  </POSTNL-0036>
1265
  <POSTNL-0037>
1266
  <message>Invalid UpdateOrder response received!</message>
1267
+ <url>http://kb.tig.nl/topic/31133667</url>
1268
  <type>error</type>
1269
  </POSTNL-0037>
1270
  <POSTNL-0038>
1271
  <message>Invalid PingStatus response: %s</message>
1272
+ <url>http://kb.tig.nl/topic/31638656</url>
1273
  <type>error</type>
1274
  </POSTNL-0038>
1275
  <POSTNL-0039>
1276
  <message>No quote available to initiate PostNL Checkout.</message>
1277
+ <url>http://kb.tig.nl/topic/31639136</url>
1278
  <type>error</type>
1279
  </POSTNL-0039>
1280
  <POSTNL-0040>
1281
  <message>Invalid PrepareOrder response: %s</message>
1282
+ <url>http://kb.tig.nl/topic/31191183</url>
1283
  <type>error</type>
1284
  </POSTNL-0040>
1285
  <POSTNL-0041>
1286
  <message>Invalid ReadOrder response: %s</message>
1287
+ <url>http://kb.tig.nl/topic/31191443</url>
1288
  <type>error</type>
1289
  </POSTNL-0041>
1290
  <POSTNL-0042>
1291
  <message>Invalid ConfirmOrder response: %s</message>
1292
+ <url>http://kb.tig.nl/topic/31191933</url>
1293
  <type>error</type>
1294
  </POSTNL-0042>
1295
  <POSTNL-0043>
1296
  <message>Invalid reference type requested: %s</message>
1297
+ <url>http://kb.tig.nl/topic/31640636</url>
1298
  <type>error</type>
1299
  </POSTNL-0043>
1300
  <POSTNL-0044>
1301
  <message>Invalid object specified: %s</message>
1302
+ <url>http://kb.tig.nl/topic/31641096</url>
1303
  <type>error</type>
1304
  </POSTNL-0044>
1305
  <POSTNL-0045>
1306
  <message>OrderToken missing for quote #%s</message>
1307
+ <url>http://kb.tig.nl/topic/31662856</url>
1308
  <type>error</type>
1309
  </POSTNL-0045>
1310
  <POSTNL-0046>
1311
  <message>This PostNL Checkout order cannot be cancelled: it has no associated magento order.</message>
1312
+ <url>http://kb.tig.nl/topic/31157957</url>
1313
  <type>error</type>
1314
  </POSTNL-0046>
1315
  <POSTNL-0047>
1316
  <message>This PostNL Checkout order cannot be cancelled: it has already been canceled.</message>
1317
+ <url>http://kb.tig.nl/topic/31177418</url>
1318
  <type>error</type>
1319
  </POSTNL-0047>
1320
  <POSTNL-0048>
1321
  <message>Selected payment method %s is not available.</message>
1322
+ <url>http://kb.tig.nl/topic/31158587</url>
1323
  <type>error</type>
1324
  </POSTNL-0048>
1325
  <POSTNL-0049>
1326
  <message>Unable to create an order for quote #%s</message>
1327
+ <url>http://kb.tig.nl/topic/31215003</url>
1328
  <type>error</type>
1329
  </POSTNL-0049>
1330
  <POSTNL-0050>
1331
  <message>Invalid quote supplied.</message>
1332
+ <url>http://kb.tig.nl/topic/31215543</url>
1333
  <type>error</type>
1334
  </POSTNL-0050>
1335
  <POSTNL-0051>
1336
  <message>Invalid data supplied.</message>
1337
+ <url>http://kb.tig.nl/topic/31216003</url>
1338
  <type>error</type>
1339
  </POSTNL-0051>
1340
  <POSTNL-0052>
1341
  <message>No username or password set.</message>
1342
+ <url>http://kb.tig.nl/topic/31216113</url>
1343
  <type>error</type>
1344
  </POSTNL-0052>
1345
  <POSTNL-0053>
1346
  <message>Chosen wsdl type is not supported: %s</message>
1347
+ <url>http://kb.tig.nl/topic/31178198</url>
1348
  <type>error</type>
1349
  </POSTNL-0053>
1350
  <POSTNL-0054>
1351
  <message>Invalid barcode response: %s</message>
1352
+ <url>http://kb.tig.nl/topic/31664456</url>
1353
  <type>error</type>
1354
  </POSTNL-0054>
1355
  <POSTNL-0055>
1356
  <message>Invalid shippingStatus response: %s</message>
1357
+ <url>http://kb.tig.nl/topic/31664246</url>
1358
  <type>error</type>
1359
  </POSTNL-0055>
1360
  <POSTNL-0056>
1361
  <message>Invalid confirmShipment response: %s</message>
1362
+ <url>http://kb.tig.nl/topic/31923588</url>
1363
  <type>error</type>
1364
  </POSTNL-0056>
1365
  <POSTNL-0057>
1366
  <message>Invalid generateLabels response: %s</message>
1367
+ <url>http://kb.tig.nl/topic/31906367</url>
1368
  <type>error</type>
1369
  </POSTNL-0057>
1370
  <POSTNL-0058>
1371
  <message>Invalid generateLabelsWithoutConfirm response: %s</message>
1372
+ <url>http://kb.tig.nl/topic/31923208</url>
1373
  <type>error</type>
1374
  </POSTNL-0058>
1375
  <POSTNL-0059>
1376
  <message>Invalid housnumber supplied: %s</message>
1377
+ <url>http://kb.tig.nl/topic/32412636</url>
1378
  <type>error</type>
1379
  </POSTNL-0059>
1380
  <POSTNL-0060>
1381
  <message>Invalid full street supplied: %s</message>
1382
+ <url>http://kb.tig.nl/topic/31924308</url>
1383
  <type>error</type>
1384
  </POSTNL-0060>
1385
  <POSTNL-0061>
1386
  <message>Invalid barcodetype requested: %s</message>
1387
+ <url>http://kb.tig.nl/topic/31924098</url>
1388
  <type>error</type>
1389
  </POSTNL-0061>
1390
  <POSTNL-0062>
1391
  <message>Invalid printer type requested: %s</message>
1392
+ <url>http://kb.tig.nl/topic/32413996</url>
1393
  <type>error</type>
1394
  </POSTNL-0062>
1395
  <POSTNL-0063>
1396
  <message>Unable to match barcode to shippingStatus response: %s</message>
1397
+ <url>http://kb.tig.nl/topic/31910007</url>
1398
  <type>error</type>
1399
  </POSTNL-0063>
1400
  <POSTNL-0064>
1401
  <message>Maximum amount of labels exceeded. Maximum allowed: 200. Requested: %s</message>
1402
+ <url>http://kb.tig.nl/topic/31925938</url>
1403
  <type>error</type>
1404
  </POSTNL-0064>
1405
  <POSTNL-0065>
1406
  <message>Invalid label type supplied: %s</message>
1407
+ <url>http://kb.tig.nl/topic/31910337</url>
1408
  <type>error</type>
1409
  </POSTNL-0065>
1410
  <POSTNL-0066>
1411
  <message>Temporary template file already exists: %s</message>
1412
+ <url>http://kb.tig.nl/topic/32415756</url>
1413
  <type>error</type>
1414
  </POSTNL-0066>
1415
  <POSTNL-0067>
1416
  <message>Invalid counter: %s</message>
1417
+ <url>http://kb.tig.nl/topic/31973693</url>
1418
  <type>error</type>
1419
  </POSTNL-0067>
1420
  <POSTNL-0068>
1421
  <message>Number of parcels not allowed. Amount requested: %s, maximum allowed: %s.</message>
1422
+ <url>http://kb.tig.nl/topic/31973693</url>
1423
  <type>error</type>
1424
  </POSTNL-0068>
1425
  <POSTNL-0069>
1426
  <message>The generateBarcodes action is currently unavailable.</message>
1427
+ <url>http://kb.tig.nl/topic/32416446</url>
1428
  <type>error</type>
1429
  </POSTNL-0069>
1430
  <POSTNL-0070>
1431
  <message>Unable to generate barcode for this shipment: %s</message>
1432
+ <url>http://kb.tig.nl/topic/31974103</url>
1433
  <type>error</type>
1434
  </POSTNL-0070>
1435
  <POSTNL-0071>
1436
  <message>The confirmAndPrintLabel action returned an invalid response: %s</message>
1437
+ <url>http://kb.tig.nl/topic/31928088</url>
1438
  <type>error</type>
1439
  </POSTNL-0071>
1440
  <POSTNL-0072>
1441
  <message>Invalid confirm response received: %s</message>
1442
+ <url>http://kb.tig.nl/topic/31976783</url>
1443
  <type>error</type>
1444
  </POSTNL-0072>
1445
  <POSTNL-0073>
1446
  <message>The updateShippingStatus action is currently unavailable.</message>
1447
+ <url>http://kb.tig.nl/topic/31930018</url>
1448
  <type>error</type>
1449
  </POSTNL-0073>
1450
  <POSTNL-0074>
1451
  <message>The updateCompleteShippingStatus action is currently unavailable.</message>
1452
+ <url>http://kb.tig.nl/topic/31930488</url>
1453
  <type>error</type>
1454
  </POSTNL-0074>
1455
  <POSTNL-0075>
1456
  <message>Unable to add tracking info: no barcode or shipment available.</message>
1457
+ <url>http://kb.tig.nl/topic/31977793</url>
1458
  <type>error</type>
1459
  </POSTNL-0075>
1460
  <POSTNL-0076>
1461
  <message>The sendTrackAndTraceEmail action is currently unavailable.</message>
1462
+ <url>http://kb.tig.nl/topic/31930908</url>
1463
  <type>error</type>
1464
  </POSTNL-0076>
1465
  <POSTNL-0077>
1466
  <message>Unable to send track and trace email for shipment #%s</message>
1467
+ <url>http://kb.tig.nl/topic/31977863</url>
1468
  <type>error</type>
1469
  </POSTNL-0077>
1470
  <POSTNL-0078>
1471
  <message>Product code %s is not allowed for this shipment.</message>
1472
+ <url>http://kb.tig.nl/topic/31978843</url>
1473
  <type>error</type>
1474
  </POSTNL-0078>
1475
  <POSTNL-0079>
1476
  <message>Invalid activateWebshop response: %s</message>
1477
+ <url>http://kb.tig.nl/topic/31978413</url>
1478
  <type>error</type>
1479
  </POSTNL-0079>
1480
  <POSTNL-0080>
1481
  <message>Unable to update statistics. This feature has been disabled.</message>
1482
+ <url>http://kb.tig.nl/topic/31978413</url>
1483
  <type>error</type>
1484
  </POSTNL-0080>
1485
  <POSTNL-0081>
1486
  <message>No private or unique key found. Unable to complete the request.</message>
1487
+ <url>http://kb.tig.nl/topic/31979763</url>
1488
  <type>error</type>
1489
  </POSTNL-0081>
1490
  <POSTNL-0082>
1491
  <message>Invalid updateStatistics response: %s</message>
1492
+ <url>http://kb.tig.nl/topic/31918757</url>
1493
  <type>error</type>
1494
  </POSTNL-0082>
1495
  <POSTNL-0083>
1496
  <message>PostNL extension has been successfully updated to version %s</message>
1497
+ <url>http://kb.tig.nl/topic/31921907</url>
1498
  <type>notice</type>
1499
  </POSTNL-0083>
1500
  <POSTNL-0084>
1501
  <message>Unable to save shipping_status cron expression: %s</message>
1502
+ <url>http://kb.tig.nl/topic/31940658</url>
1503
  <type>error</type>
1504
  </POSTNL-0084>
1505
  <POSTNL-0085>
1506
  <message>Unable to save update_statistics cron expression: %s</message>
1507
+ <url>http://kb.tig.nl/topic/31925327</url>
1508
  <type>error</type>
1509
  </POSTNL-0085>
1510
  <POSTNL-0086>
1511
  <message>The PostNL extension is not compatible with your Magento version! This may cause unexpected behaviour.</message>
1512
+ <url>http://kb.tig.nl/topic/31925577</url>
1513
  <type>warning</type>
1514
  </POSTNL-0086>
1515
  <POSTNL-0087>
1516
  <message>Wrong message type</message>
1517
+ <url>http://kb.tig.nl/topic/31566016</url>
1518
  <type>error</type>
1519
  </POSTNL-0087>
1520
  <POSTNL-0088>
1521
  <message>Invalid session requested.</message>
1522
+ <url>http://kb.tig.nl/topic/32430366</url>
1523
  <type>error</type>
1524
  </POSTNL-0088>
1525
  <POSTNL-0089>
1526
  <message>No message supplied.</message>
1527
+ <url>http://kb.tig.nl/topic/31925967</url>
1528
  <type>error</type>
1529
  </POSTNL-0089>
1530
  <POSTNL-0090>
1531
  <message>No message type supplied.</message>
1532
+ <url>http://kb.tig.nl/topic/31988933</url>
1533
  <type>error</type>
1534
  </POSTNL-0090>
1535
  <POSTNL-0091>
1536
  <message>Missing country of origin value for product #%s.</message>
1537
+ <url>http://kb.tig.nl/topic/31988983</url>
1538
  <type>error</type>
1539
  </POSTNL-0091>
1540
  <POSTNL-0092>
1541
  <message>Missing customs value for product #%s.</message>
1542
+ <url>http://kb.tig.nl/topic/32432746</url>
1543
  <type>error</type>
1544
  </POSTNL-0092>
1545
  <POSTNL-0093>
1546
  <message>Missing customs description for product #%s.</message>
1547
+ <url>http://kb.tig.nl/topic/31944008</url>
1548
  <type>error</type>
1549
  </POSTNL-0093>
1550
  <POSTNL-0094>
1551
  <message>Invalid message type requested: %s.</message>
1552
+ <url>http://kb.tig.nl/topic/33566806</url>
1553
  <type>error</type>
1554
  </POSTNL-0094>
1555
  <POSTNL-0095>
1556
  <message>Config form fieldset clone model required to be able to clone fields</message>
1557
+ <url>http://kb.tig.nl/topic/33059188</url>
1558
  <type>error</type>
1559
  </POSTNL-0095>
1560
  <POSTNL-0096>
1561
  <message>Unable to read directory: %s</message>
1562
+ <url>http://kb.tig.nl/topic/33063203</url>
1563
  <type>error</type>
1564
  </POSTNL-0096>
1565
  <POSTNL-0097>
1566
  <message>Invalid UpdateOrder response: %s</message>
1567
+ <url>http://kb.tig.nl/topic/33064418</url>
1568
  <type>error</type>
1569
  </POSTNL-0097>
1570
  <POSTNL-0098>
1571
  <message>The PostNL Extension is currently configured in test mode.</message>
1572
+ <url>http://kb.tig.nl/topic/46536473</url>
1573
  <type>warning</type>
1574
  </POSTNL-0098>
1575
 
1578
  <POSTNL-0100>
1579
  <!-- This error is generated by CIF, however we have designated it an error code -->
1580
  <message>The user is not authorized for this barcode</message>
1581
+ <url>http://kb.tig.nl/topic/32435446</url>
1582
  <type>error</type>
1583
  </POSTNL-0100>
1584
  <POSTNL-0101>
1585
  <message>The quote's total weight is below the miniumum required to use PostNL Checkout.</message>
1586
+ <url>http://kb.tig.nl/topic/32433656</url>
1587
  <type>notice</type>
1588
  </POSTNL-0101>
1589
  <POSTNL-0102>
1590
  <message>One or more items in the cart are out of stock.</message>
1591
+ <url>http://kb.tig.nl/topic/31993743</url>
1592
  <type>notice</type>
1593
  </POSTNL-0102>
1594
  <POSTNL-0103>
1595
  <message>PostNL Checkout has been disabled.</message>
1596
+ <url>http://kb.tig.nl/topic/31947888</url>
1597
  <type>notice</type>
1598
  </POSTNL-0103>
1599
  <POSTNL-0104>
1600
  <message>The quote is virtual.</message>
1601
+ <url>http://kb.tig.nl/topic/32436016</url>
1602
  <type>notice</type>
1603
  </POSTNL-0104>
1604
  <POSTNL-0105>
1605
  <message>The quote's grand total is below the minimum amount required.</message>
1606
+ <url>http://kb.tig.nl/topic/32759156</url>
1607
  <type>notice</type>
1608
  </POSTNL-0105>
1609
  <POSTNL-0106>
1610
  <message>No standard product options are enabled. At least 1 option must be active.</message>
1611
+ <url>http://kb.tig.nl/topic/32288438</url>
1612
  <type>notice</type>
1613
  </POSTNL-0106>
1614
  <POSTNL-0107>
1615
  <message>You have not yet enabled the PostNL extension.</message>
1616
+ <url>http://kb.tig.nl/topic/32266563</url>
1617
  <type>notice</type>
1618
  </POSTNL-0107>
1619
  <POSTNL-0108>
1620
  <message>Invalid address type supplied: %s</message>
1621
+ <url>http://kb.tig.nl/topic/32295088</url>
1622
  <type>error</type>
1623
  </POSTNL-0108>
1624
  <POSTNL-0109>
1625
  <message>The confirm action is currently unavailable.</message>
1626
+ <url>http://kb.tig.nl/topic/32772946</url>
1627
  <type>error</type>
1628
  </POSTNL-0109>
1629
  <POSTNL-0110>
1630
  <message>The confirmAndGenerateLabel action is currently unavailable.</message>
1631
+ <url>http://kb.tig.nl/topic/32279277</url>
1632
  <type>error</type>
1633
  </POSTNL-0110>
1634
  <POSTNL-0111>
1635
  <message>Unable to retrieve barcode data.</message>
1636
+ <url>http://kb.tig.nl/topic/38561927</url>
1637
  <type>error</type>
1638
  </POSTNL-0111>
1639
  <POSTNL-0112>
1640
  <message>Your shopping cart is empty. Please add a product and try again.</message>
1641
+ <url>http://kb.tig.nl/topic/38561597</url>
1642
  <type>error</type>
1643
  </POSTNL-0112>
1644
  <POSTNL-0113>
1645
  <message>An error occurred while updating the PostNL Checkout order.</message>
1646
+ <url>http://kb.tig.nl/topic/38931193</url>
1647
  <type>warning</type>
1648
  </POSTNL-0113>
1649
  <POSTNL-0114>
1650
  <message>Your PostNL account credentials could not be validated. Please enter valid PostNL account credentials before activating the postcode check functionality.</message>
1651
+ <url>http://kb.tig.nl/topic/52364673</url>
1652
  <type>error</type>
1653
  </POSTNL-0114>
1654
  <POSTNL-0115>
1655
  <message>No data available for GetDeliveryDay request.</message>
1656
+ <url>http://kb.tig.nl/topic/52364963</url>
1657
  <type>error</type>
1658
  </POSTNL-0115>
1659
  <POSTNL-0116>
1660
  <message>Invalid GetDeliveryDate response: %s</message>
1661
+ <url>http://kb.tig.nl/topic/52982498</url>
1662
  <type>error</type>
1663
  </POSTNL-0116>
1664
  <POSTNL-0117>
1665
  <message>No data available for request.</message>
1666
+ <url>http://kb.tig.nl/topic/53527926</url>
1667
  <type>error</type>
1668
  </POSTNL-0117>
1669
  <POSTNL-0118>
1670
  <message>Invalid postcode supplied for getNearestLocations request: %s</message>
1671
+ <url>http://kb.tig.nl/topic/53014647</url>
1672
  <type>error</type>
1673
  </POSTNL-0118>
1674
  <POSTNL-0119>
1675
  <message>Invalid coordinates supplied for getNearestLocations request. lat: %s, long: %s</message>
1676
+ <url>http://kb.tig.nl/topic/53015967</url>
1677
  <type>error</type>
1678
  </POSTNL-0119>
1679
  <POSTNL-0120>
1680
  <message>Invalid arguments supplied. getNearestLocations requires a postcode or a longitude and latitude.</message>
1681
+ <url>http://kb.tig.nl/topic/52369463</url>
1682
  <type>error</type>
1683
  </POSTNL-0120>
1684
  <POSTNL-0121>
1685
  <message>Invalid delivery date supplied: %s</message>
1686
+ <url>http://kb.tig.nl/topic/52985978</url>
1687
  <type>error</type>
1688
  </POSTNL-0121>
1689
  <POSTNL-0122>
1690
  <message>Invalid response for GetDeliveryTimeframes request: %s</message>
1691
+ <url>http://kb.tig.nl/topic/53017197</url>
1692
  <type>error</type>
1693
  </POSTNL-0122>
1694
  <POSTNL-0123>
1695
  <message>Invalid response for GetNearestLocations request: %s</message>
1696
+ <url>http://kb.tig.nl/topic/52986878</url>
1697
  <type>error</type>
1698
  </POSTNL-0123>
1699
  <POSTNL-0124>
1700
  <message>Invalid arguments supplied. GetDeliveryTimeframes requires a postcode and a housenumber.</message>
1701
+ <url>http://kb.tig.nl/topic/53532186</url>
1702
  <type>error</type>
1703
  </POSTNL-0124>
1704
  <POSTNL-0125>
1705
  <message>Invalid postcode supplied for GetDeliveryTimeframes request: %s Postcodes may only contain 4 numbers and 2 letters.</message>
1706
+ <url>http://kb.tig.nl/topic/52371803</url>
1707
  <type>error</type>
1708
  </POSTNL-0125>
1709
  <POSTNL-0126>
1710
  <message>Invalid housenumber supplied for GetDeliveryTimeframes request: %s Housenumbers may only contain digits.</message>
1711
+ <url>http://kb.tig.nl/topic/52988088</url>
1712
  <type>error</type>
1713
  </POSTNL-0126>
1714
  <POSTNL-0127>
1715
  <message>Invalid shipping duration: %s. Shipping duration must be between 1 and 14 days.</message>
1716
+ <url>http://kb.tig.nl/topic/52372583</url>
1717
  <type>error</type>
1718
  </POSTNL-0127>
1719
  <POSTNL-0128>
1720
  <message>Invalid arguments supplied. getNearestLocationsInArea requires two sets of coordinates.</message>
1721
+ <url>http://kb.tig.nl/topic/53020717</url>
1722
  <type>error</type>
1723
  </POSTNL-0128>
1724
  <POSTNL-0129>
1725
  <message>Invalid NE coordinates supplied for getLocationsInArea request. lat: %s, long: %s</message>
1726
+ <url>http://kb.tig.nl/topic/53534856</url>
1727
  <type>error</type>
1728
  </POSTNL-0129>
1729
  <POSTNL-0130>
1730
  <message>Invalid SW coordinates supplied for getLocationsInArea request. lat: %s, long: %s</message>
1731
+ <url>http://kb.tig.nl/topic/53535436</url>
1732
  <type>error</type>
1733
  </POSTNL-0130>
1734
  <POSTNL-0131>
1735
  <message>Invalid postcode supplied for GetDeliveryDate request: %s Postcodes may only contain 4 numbers and 2 letters.</message>
1736
+ <url>http://kb.tig.nl/topic/53022657</url>
1737
  <type>error</type>
1738
  </POSTNL-0131>
1739
  <POSTNL-0132>
1740
  <message>PostNL delivery options are only available for Dutch shipping addresses.</message>
1741
+ <url>http://kb.tig.nl/topic/52384143</url>
1742
  <type>error</type>
1743
  </POSTNL-0132>
1744
  <POSTNL-0133>
1745
  <message>You have not yet enabled PostNL delivery options.</message>
1746
+ <url>http://kb.tig.nl/topic/53003058</url>
1747
  <type>error</type>
1748
  </POSTNL-0133>
1749
  <POSTNL-0134>
1750
  <message>The SOAP extension is not installed. PostNL requires the SOAP extension to communicate with PostNL.</message>
1751
+ <url>http://kb.tig.nl/topic/52387393</url>
1752
  <type>error</type>
1753
  </POSTNL-0134>
1754
  <POSTNL-0135>
1755
  <message>The OpenSSL extension is not installed. The PostNL extension requires the OpenSSL extension to secure the communications with the PostNL servers.</message>
1756
+ <url>http://kb.tig.nl/topic/52387703</url>
1757
  <type>error</type>
1758
  </POSTNL-0135>
1759
  <POSTNL-0136>
1760
  <message>The specified method "%s" is not callable.</message>
1761
+ <url>http://kb.tig.nl/topic/53034097</url>
1762
  <type>error</type>
1763
  </POSTNL-0136>
1764
  <POSTNL-0137>
1765
  <message>The MCrypt extension is not installed. The PostNL extension requires the MCrypt extension to secure the communications with the PostNL servers.</message>
1766
+ <url>http://kb.tig.nl/topic/53550106</url>
1767
  <type>error</type>
1768
  </POSTNL-0137>
1769
  <POSTNL-0138>
1770
  <message>Invalid arguments supplied. In order to save a selected option, a type, delivery date and optional extra costs are required.</message>
1771
+ <url>http://kb.tig.nl/topic/52389583</url>
1772
  <type>error</type>
1773
  </POSTNL-0138>
1774
  <POSTNL-0139>
1775
  <message>Invalid type supplied: %s</message>
1776
+ <url>http://kb.tig.nl/topic/53035527</url>
1777
  <type>error</type>
1778
  </POSTNL-0139>
1779
  <POSTNL-0140>
1780
  <message>Invalid extra costs supplied: %s Extra costs must be supplied as a float.</message>
1781
+ <url>http://kb.tig.nl/topic/53552216</url>
1782
  <type>error</type>
1783
  </POSTNL-0140>
1784
  <POSTNL-0141>
1785
  <message>Invalid argument supplied. A valid PakjeGemak address must contain at least a city, country code, street, house number, phonenumber and zipcode.</message>
1786
+ <url>http://kb.tig.nl/topic/53037577</url>
1787
  <type>error</type>
1788
  </POSTNL-0141>
1789
  <POSTNL-0142>
1790
  <message>Invalid arguments supplied. The 'costs' parameter is required.</message>
1791
+ <url>http://kb.tig.nl/topic/53037947</url>
1792
  <type>error</type>
1793
  </POSTNL-0142>
1794
  <POSTNL-0143>
1795
  <message>Invalid country code supplied: %s.</message>
1796
+ <url>http://kb.tig.nl/topic/53554796</url>
1797
  <type>error</type>
1798
  </POSTNL-0143>
1799
  <POSTNL-0144>
1800
  <message>Invalid street supplied: %s.</message>
1801
+ <url>http://kb.tig.nl/topic/52393003</url>
1802
  <type>error</type>
1803
  </POSTNL-0144>
1804
  <POSTNL-0145>
1805
  <message>Invalid housenumber supplied: %s.</message>
1806
+ <url>http://kb.tig.nl/topic/53038967</url>
1807
  <type>error</type>
1808
  </POSTNL-0145>
1809
  <POSTNL-0146>
1810
  <message>Invalid postcode supplied: %s.</message>
1811
+ <url>http://kb.tig.nl/topic/53039527</url>
1812
  <type>error</type>
1813
  </POSTNL-0146>
1814
  <POSTNL-0147>
1815
  <message>Invalid housenumber extension supplied: %s.</message>
1816
+ <url>http://kb.tig.nl/topic/53009848</url>
1817
  <type>error</type>
1818
  </POSTNL-0147>
1819
  <POSTNL-0148>
1820
  <message>Invalid arguments supplied. The 'number' parameter is required.</message>
1821
+ <url>http://kb.tig.nl/topic/53009968</url>
1822
  <type>error</type>
1823
  </POSTNL-0148>
1824
  <POSTNL-0149>
1825
  <message>Invalid mobile phone number supplied: %s.</message>
1826
+ <url>http://kb.tig.nl/topic/53039917</url>
1827
  <type>error</type>
1828
  </POSTNL-0149>
1829
  <POSTNL-0150>
1830
  <message>The quote's total weight is below the miniumum required to use PostNL delivery options.</message>
1831
+ <url>http://kb.tig.nl/topic/53040387</url>
1832
  <type>error</type>
1833
  </POSTNL-0150>
1834
  <POSTNL-0151>
1835
  <message>Invalid phone number supplied: %s.</message>
1836
+ <url>http://kb.tig.nl/topic/58968276</url>
1837
  <type>error</type>
1838
  </POSTNL-0151>
1839
  <POSTNL-0152>
1840
  <message>Invalid arguments supplied. The 'costs' parameter requires an amount incl. and excl. VAT.</message>
1841
+ <url>http://kb.tig.nl/topic/53557046</url>
1842
  <type>error</type>
1843
  </POSTNL-0152>
1844
  <POSTNL-0153>
1845
  <message>Invalid fee amount entered: %s incl. VAT. Please enter a value between 0.00 and 2.00 EUR incl. VAT.</message>
1846
+ <url>http://kb.tig.nl/topic/58943736</url>
1847
  <type>error</type>
1848
  </POSTNL-0153>
1849
  <POSTNL-0154>
1850
  <message>Invalid name supplied: %s.</message>
1851
+ <url>http://kb.tig.nl/topic/57784943</url>
1852
  <type>error</type>
1853
  </POSTNL-0154>
1854
  <POSTNL-0155>
1855
  <message>The current user is not allowed to perform this action.</message>
1856
+ <url>http://kb.tig.nl/topic/58415077</url>
1857
  <type>error</type>
1858
  </POSTNL-0155>
1859
  <POSTNL-0156>
1860
  <message>The PostNL extension v%s has been successfully installed.</message>
1861
+ <url>http://kb.tig.nl/topic/58945996</url>
1862
  <type>notice</type>
1863
  </POSTNL-0156>
1864
  <POSTNL-0157>
1865
  <message>Invalid token specified: %s</message>
1866
+ <url>http://kb.tig.nl/topic/58416207</url>
1867
  <type>error</type>
1868
  </POSTNL-0157>
1869
  <POSTNL-0158>
1870
  <message>Invalid GetProfileAccessToken response: %s</message>
1871
+ <url>http://kb.tig.nl/topic/58948686</url>
1872
  <type>error</type>
1873
  </POSTNL-0158>
1874
  <POSTNL-0159>
1875
  <message>You have chosen a default shipping option that is not supported. Please only select default options that you have selected in the 'Select supported option' field.</message>
1876
+ <url>http://kb.tig.nl/topic/57789373</url>
1877
  <type>warning</type>
1878
  </POSTNL-0159>
1879
  <POSTNL-0160>
1880
  <message>A required configuration value is missing: %s.</message>
1881
+ <url>http://kb.tig.nl/topic/94860156</url>
1882
  <type>error</type>
1883
  </POSTNL-0160>
1884
  <POSTNL-0161>
1888
  </POSTNL-0161>
1889
  <POSTNL-0162>
1890
  <message>Cannot create an invoice without products.</message>
1891
+ <url>http://kb.tig.nl/topic/94861626</url>
1892
  <type>error</type>
1893
  </POSTNL-0162>
1894
  <POSTNL-0163>
1895
  <message>Order item #%s could not be invoiced.</message>
1896
+ <url>http://kb.tig.nl/topic/93711773</url>
1897
  <type>error</type>
1898
  </POSTNL-0163>
1899
  <POSTNL-0164>
1900
  <message>Unable to create an invoice for this shipment due to the order missing.</message>
1901
+ <url>http://kb.tig.nl/topic/93711923</url>
1902
  <type>error</type>
1903
  </POSTNL-0164>
1904
  <POSTNL-0165>
1905
  <message>Unable to create an invoice for this shipment because the order cannot be invoiced.</message>
1906
+ <url>http://kb.tig.nl/topic/93712093</url>
1907
  <type>error</type>
1908
  </POSTNL-0165>
1909
  <POSTNL-0166>
1910
  <message>An error occurred while creating an invoice for this shipment.</message>
1911
+ <url>http://kb.tig.nl/topic/93712203</url>
1912
  <type>error</type>
1913
  </POSTNL-0166>
1914
  <POSTNL-0167>
1915
  <message>No valid shipment type found for shipment #%s</message>
1916
+ <url>http://kb.tig.nl/topic/93727133</url>
1917
  <type>error</type>
1918
  </POSTNL-0167>
1919
  <POSTNL-0168>
1920
  <message>No valid order available for packing slip.</message>
1921
+ <url>http://kb.tig.nl/topic/93727223</url>
1922
  <type>error</type>
1923
  </POSTNL-0168>
1924
  <POSTNL-0169>
1925
  <message>Invalid label type supplied for packing slip label pdf: %s.</message>
1926
+ <url>http://kb.tig.nl/topic/93727383</url>
1927
  <type>error</type>
1928
  </POSTNL-0169>
1929
  <POSTNL-0170>
1930
  <message>Approaching memory limit for this operation. Please select fewer shipments and try again.</message>
1931
+ <url>http://kb.tig.nl/topic/95141016</url>
1932
  <type>error</type>
1933
  </POSTNL-0170>
1934
  <POSTNL-0171>
1935
  <message>None of the orders you have selected have any associated shipments. Please choose at least one order that has a shipment.</message>
1936
+ <url>http://kb.tig.nl/topic/95141286</url>
1937
  <type>error</type>
1938
  </POSTNL-0171>
1939
  <POSTNL-0172>
1940
  <message>No valid log files were found.</message>
1941
+ <url>http://kb.tig.nl/topic/95141546</url>
1942
  <type>error</type>
1943
  </POSTNL-0172>
1944
  <POSTNL-0173>
1945
  <message>Log %s is too large and was skipped.</message>
1946
+ <url>http://kb.tig.nl/topic/93991283</url>
1947
  <type>warning</type>
1948
  </POSTNL-0173>
1949
  <POSTNL-0174>
1950
  <message>The total size of all log files exceeds the maximum size allowed.</message>
1951
+ <url>http://kb.tig.nl/topic/93991313</url>
1952
  <type>error</type>
1953
  </POSTNL-0174>
1954
  <POSTNL-0175>
1955
  <message>The server's memory limit is less than %.0fMB. The PostNL extension requires at least %.0fMB to function properly. Using the PostNL extension on servers with less memory than this may cause unexpected errors.</message>
1956
+ <url>http://kb.tig.nl/topic/95141856</url>
1957
  <type>warning</type>
1958
  </POSTNL-0175>
1959
  <POSTNL-0176>
1960
  <message>No shipment found for PostNL shipment #%d.</message>
1961
+ <url>http://kb.tig.nl/topic/95141986</url>
1962
  <type>error</type>
1963
  </POSTNL-0176>
1964
  <POSTNL-0177>
1965
  <message>No order found for PostNL shipment #%d.</message>
1966
+ <url>http://kb.tig.nl/topic/95142026</url>
1967
  <type>error</type>
1968
  </POSTNL-0177>
1969
  <POSTNL-0178>
1970
  <message>Maximum PostNL COD fee amount available to refunds is %s.</message>
1971
+ <url>http://kb.tig.nl/topic/95142066</url>
1972
  <type>error</type>
1973
  </POSTNL-0178>
1974
  <POSTNL-0179>
1975
  <message>It is not possible to create partial shipments for orders placed using PostNL COD. Please create only full shipments.</message>
1976
+ <url>http://kb.tig.nl/topic/93991833</url>
1977
  <type>error</type>
1978
  </POSTNL-0179>
1979
  <POSTNL-0180>
1980
  <message>The addTrackingCodeToShipment action is currently unavailable.</message>
1981
+ <url>http://kb.tig.nl/topic/95142106</url>
1982
  <type>error</type>
1983
  </POSTNL-0180>
1984
  <POSTNL-0181>
1985
  <message>It appears the PostNL username and/or password you have entered is incorrect.</message>
1986
+ <url>http://kb.tig.nl/topic/95142216</url>
1987
  <type>error</type>
1988
  </POSTNL-0181>
1989
  <POSTNL-0182>
1990
  <message>Your PostNL account is unfortunately not allowed to perform this action. Please contact PostNL.</message>
1991
+ <url>http://kb.tig.nl/topic/93992103</url>
1992
  <type>error</type>
1993
  </POSTNL-0182>
1994
  <POSTNL-0183>
1995
  <message>Unfortunately you have exceeded the maximum amount of PostNL requests you may send each minute. Please wait a few minutes and try again. If this problem persists, please contact PostNL.</message>
1996
+ <url>http://kb.tig.nl/topic/93992233</url>
1997
  <type>error</type>
1998
  </POSTNL-0183>
1999
  <POSTNL-0184>
2000
  <message>This PostNL service is currently disabled. Please contact PostNL.</message>
2001
+ <url>http://kb.tig.nl/topic/93992253</url>
2002
  <type>error</type>
2003
  </POSTNL-0184>
2004
  <POSTNL-0185>
2005
  <message>There was a problem connecting to PostNL's services. This may be due to a timeout. Please wait a few minutes and try again. If this problem persists, please contact PostNL.</message>
2006
+ <url>http://kb.tig.nl/topic/93992303</url>
2007
  <type>error</type>
2008
  </POSTNL-0185>
2009
  <POSTNL-0186>
2010
  <message>Your PostNL customer code appears to be incorrect. Please make sure you have entered the correct code.</message>
2011
+ <url>http://kb.tig.nl/topic/95142616</url>
2012
  <type>error</type>
2013
  </POSTNL-0186>
2014
  <POSTNL-0187>
2015
  <message>The total size of all PostNL logs exceeds the maximum recommended size.</message>
2016
+ <url>http://kb.tig.nl/topic/95142626</url>
2017
  <type>warning</type>
2018
  </POSTNL-0187>
2019
  <POSTNL-0188>
2020
  <message>No default product options are available for this shipment. Please check that you have correctly configured the available product options in the PostNL extension's configuration.</message>
2021
+ <url>http://kb.tig.nl/topic/95142666</url>
2022
  <type>error</type>
2023
  </POSTNL-0188>
2024
  <POSTNL-0189>
2025
  <message>The default product option was not available for this shipment, so another product option was chosen. Please check if the default product options are configured correctly in the PostNL extension's configuration.</message>
2026
+ <url>http://kb.tig.nl/topic/95142726</url>
2027
  <type>warning</type>
2028
  </POSTNL-0189>
2029
  <POSTNL-0190>
2033
  </POSTNL-0190>
2034
  <POSTNL-0191>
2035
  <message>The convertToBuspakje action is currently unavailable.</message>
2036
+ <url>http://kb.tig.nl/topic/96044606</url>
2037
  <type>error</type>
2038
  </POSTNL-0191>
2039
  <POSTNL-0192>
2040
  <message>The convertToPackage action is currently unavailable.</message>
2041
+ <url>http://kb.tig.nl/topic/94895313</url>
2042
  <type>error</type>
2043
  </POSTNL-0192>
2044
  <POSTNL-0193>
2045
  <message>The changeProductCode action is currently unavailable.</message>
2046
+ <url>http://kb.tig.nl/topic/96045026</url>
2047
  <type>error</type>
2048
  </POSTNL-0193>
2049
+ <POSTNL-0194>
2050
+ <message>Invalid PostNL Matrix Rates File Format</message>
2051
+ <url>http://kb.tig.nl/topic/101211863</url>
2052
+ <type>error</type>
2053
+ </POSTNL-0194>
2054
+ <POSTNL-0195>
2055
+ <message>An error occurred while importing the matrix rates.</message>
2056
+ <url>http://kb.tig.nl/topic/102370766</url>
2057
+ <type>error</type>
2058
+ </POSTNL-0195>
2059
+ <POSTNL-0196>
2060
+ <message>File has not been imported. See the following list of errors: %s</message>
2061
+ <url>http://kb.tig.nl/topic/101212943</url>
2062
+ <type>error</type>
2063
+ </POSTNL-0196>
2064
+ <POSTNL-0197>
2065
+ <message>Unable to save update_product_attribute cron expression: %s</message>
2066
+ <url>http://kb.tig.nl/topic/101214223</url>
2067
+ <type>error</type>
2068
+ </POSTNL-0197>
2069
+ <POSTNL-0198>
2070
+ <message>The PostNL extension is currently being upgraded.</message>
2071
+ <url>http://kb.tig.nl/topic/102372846</url>
2072
+ <type>error</type>
2073
+ </POSTNL-0198>
2074
+ <POSTNL-0199>
2075
+ <message>Data has not been imported. See the following list of errors: %s</message>
2076
+ <url>http://kb.tig.nl/topic/102373046</url>
2077
+ <type>error</type>
2078
+ </POSTNL-0199>
2079
+ <POSTNL-0200>
2080
+ <message><![CDATA[Unable to send track & trace email due to missing shipment parameters.]]></message>
2081
+ <url>http://kb.tig.nl/topic/102373326</url>
2082
+ <type>error</type>
2083
+ </POSTNL-0200>
2084
 
2085
  <!-- These error codes are generated by CIF, not by this extension -->
2086
  <LIRS_0>
2087
  <message>Combilabel was not processed successfully for shipment with barcode %s. Normal label is generated and product code for shipment changed to 4944.</message>
2088
+ <url>http://kb.tig.nl/topic/32432076</url>
2089
  <type>warning</type>
2090
  </LIRS_0>
2091
  </errors>
app/code/community/TIG/PostNL/etc/jstranslator.xml CHANGED
@@ -26,15 +26,15 @@
26
  * It is available through the world-wide-web at this URL:
27
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
28
  * If you are unable to obtain it through the world-wide-web, please send an email
29
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
30
  *
31
  * DISCLAIMER
32
  *
33
  * Do not edit or add to this file if you wish to upgrade this module to newer
34
  * versions in the future. If you wish to customize this module for your
35
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
36
  *
37
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
38
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
39
  */
40
  -->
@@ -117,4 +117,19 @@
117
  <fits_through_the_mailslot translate="message" module="postnl">
118
  <message>Fits through the mailslot</message>
119
  </fits_through_the_mailslot>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  </jstranslator>
26
  * It is available through the world-wide-web at this URL:
27
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
28
  * If you are unable to obtain it through the world-wide-web, please send an email
29
+ * to servicedesk@tig.nl so we can send you a copy immediately.
30
  *
31
  * DISCLAIMER
32
  *
33
  * Do not edit or add to this file if you wish to upgrade this module to newer
34
  * versions in the future. If you wish to customize this module for your
35
+ * needs please contact servicedesk@tig.nl for more information.
36
  *
37
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
38
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
39
  */
40
  -->
117
  <fits_through_the_mailslot translate="message" module="postnl">
118
  <message>Fits through the mailslot</message>
119
  </fits_through_the_mailslot>
120
+ <select_location translate="message" module="postnl">
121
+ <message>Select location</message>
122
+ </select_location>
123
+ <show_map translate="message" module="postnl">
124
+ <message>Show map</message>
125
+ </show_map>
126
+ <advanced_settings translate="message" module="postnl">
127
+ <message>Advanced Settings</message>
128
+ </advanced_settings>
129
+ <as_soon_as_possible translate="message" module="postnl">
130
+ <message>As soon as possible</message>
131
+ </as_soon_as_possible>
132
+ <wizard_step_saved translate="message" module="postnl">
133
+ <message>The previous has been saved successfully!</message>
134
+ </wizard_step_saved>
135
  </jstranslator>
app/code/community/TIG/PostNL/etc/logging.xml CHANGED
@@ -26,15 +26,15 @@
26
  * It is available through the world-wide-web at this URL:
27
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
28
  * If you are unable to obtain it through the world-wide-web, please send an email
29
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
30
  *
31
  * DISCLAIMER
32
  *
33
  * Do not edit or add to this file if you wish to upgrade this module to newer
34
  * versions in the future. If you wish to customize this module for your
35
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
36
  *
37
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
38
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
39
  */
40
  -->
26
  * It is available through the world-wide-web at this URL:
27
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
28
  * If you are unable to obtain it through the world-wide-web, please send an email
29
+ * to servicedesk@tig.nl so we can send you a copy immediately.
30
  *
31
  * DISCLAIMER
32
  *
33
  * Do not edit or add to this file if you wish to upgrade this module to newer
34
  * versions in the future. If you wish to customize this module for your
35
+ * needs please contact servicedesk@tig.nl for more information.
36
  *
37
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
38
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
39
  */
40
  -->
app/code/community/TIG/PostNL/etc/system.xml CHANGED
@@ -26,15 +26,15 @@
26
  * It is available through the world-wide-web at this URL:
27
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
28
  * If you are unable to obtain it through the world-wide-web, please send an email
29
- * to servicedesk@totalinternetgroup.nl so we can send you a copy immediately.
30
  *
31
  * DISCLAIMER
32
  *
33
  * Do not edit or add to this file if you wish to upgrade this module to newer
34
  * versions in the future. If you wish to customize this module for your
35
- * needs please contact servicedesk@totalinternetgroup.nl for more information.
36
  *
37
- * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.totalinternetgroup.nl)
38
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
39
  */
40
  -->
@@ -60,9 +60,9 @@
60
  <groups>
61
  <classes>
62
  <fields>
63
- <postnl_cod_fee translate="label comment" module="postnl">
64
  <label>Tax class for PostNL COD fee</label>
65
- <comment>This tax class will be used when calculating the tax for the PostNL COD fee.</comment>
66
  <frontend_type>select</frontend_type>
67
  <source_model>postnl_payment/system_config_source_codFeeTaxClass</source_model>
68
  <sort_order>20</sort_order>
@@ -74,9 +74,9 @@
74
  </classes>
75
  <calculation>
76
  <fields>
77
- <postnl_cod_fee_including_tax translate="label comment" module="postnl">
78
  <label>PostNL COD fee</label>
79
- <comment>Whether the PostNL COD fee you have entered is incl. or excl. tax.</comment>
80
  <frontend_type>select</frontend_type>
81
  <backend_model>tax/config_price_include</backend_model>
82
  <source_model>tax/system_config_source_priceType</source_model>
@@ -125,9 +125,9 @@
125
  <show_in_website>1</show_in_website>
126
  <show_in_store>1</show_in_store>
127
  <fields>
128
- <active translate="label comment" module="postnl">
129
  <label>Enabled</label>
130
- <comment>Enable or disable the PostNL Cash on Delivery payment method.</comment>
131
  <frontend_type>select</frontend_type>
132
  <source_model>postnl/system_config_source_yesno</source_model>
133
  <sort_order>10</sort_order>
@@ -135,7 +135,7 @@
135
  <show_in_website>1</show_in_website>
136
  <show_in_store>1</show_in_store>
137
  </active>
138
- <title translate="label" module="postnl">
139
  <label>Title</label>
140
  <tooltip><![CDATA[<p>If you have configured a fee in the field below, you may use '%s' in the title. This will be replaced with the fee amount in the customer's chosen currency.</p><p>I.e. If the fee is 17.45 EUR and the title you have entered is "PostNL COD (+%s)" then the title will show "PostNL COD (+€17,45)". If the customer has chosen to pay in USD, the title will show "PostNL COD (+$23.73)" instead.</p>]]></tooltip>
141
  <frontend_type>text</frontend_type>
@@ -147,9 +147,9 @@
147
  <active>1</active>
148
  </depends>
149
  </title>
150
- <fee translate="label comment" modul="postnl">
151
  <label>Fee</label>
152
- <comment>This fee will be charged to the customer when they choose to pay using PostNL COD.</comment>
153
  <frontend_type>text</frontend_type>
154
  <sort_order>30</sort_order>
155
  <show_in_default>1</show_in_default>
@@ -160,9 +160,9 @@
160
  <active>1</active>
161
  </depends>
162
  </fee>
163
- <fee_label translate="label comment" modul="postnl">
164
  <label>Fee label</label>
165
- <comment>This label will be displayed next to the fee on the checkout, order, invoice and creditmemo pages and pdfs.</comment>
166
  <frontend_type>text</frontend_type>
167
  <sort_order>40</sort_order>
168
  <show_in_default>1</show_in_default>
@@ -173,9 +173,9 @@
173
  <active>1</active>
174
  </depends>
175
  </fee_label>
176
- <order_status translate="label comment" module="postnl">
177
  <label>New order status</label>
178
- <comment>Newly placed orders will have this status.</comment>
179
  <frontend_type>select</frontend_type>
180
  <source_model>adminhtml/system_config_source_order_status_processing</source_model>
181
  <sort_order>50</sort_order>
@@ -246,9 +246,9 @@
246
  <active>1</active>
247
  </depends>
248
  </max_order_total>
249
- <allow_for_non_postnl translate="label comment" module="postnl">
250
  <label>Allow for non-PostNL orders</label>
251
- <comment>Set this option to 'yes' to allow orders placed using a different shipping method than PostNL to use this payment method.</comment>
252
  <frontend_type>select</frontend_type>
253
  <source_model>postnl/system_config_source_yesno</source_model>
254
  <sort_order>110</sort_order>
@@ -353,9 +353,9 @@
353
  <rate_type>flat</rate_type>
354
  </depends>
355
  </price>
356
- <rate_source translate="label comment" module="postnl">
357
  <label>Rate Source</label>
358
- <comment>You can use the rates you have entered for Magento's Table Rates shipping method or you can choose to enter table rates specific for the PostNL shipping method.</comment>
359
  <frontend_type>select</frontend_type>
360
  <source_model>postnl_carrier/system_config_source_tablerateSource</source_model>
361
  <sort_order>70</sort_order>
@@ -391,10 +391,34 @@
391
  <rate_source>postnl_tablerate</rate_source>
392
  </depends>
393
  </import>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
394
  <import_export_header translate="label" module="postnl">
395
  <label>You can import and export rates on the website scope. You can change your current scope with the dropdown at the top left of this page.</label>
396
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
397
- <sort_order>100</sort_order>
398
  <show_in_default>1</show_in_default>
399
  <show_in_website>0</show_in_website>
400
  <show_in_store>1</show_in_store>
@@ -407,7 +431,7 @@
407
  <label>Condition</label>
408
  <frontend_type>select</frontend_type>
409
  <source_model>adminhtml/system_config_source_shipping_tablerate</source_model>
410
- <sort_order>110</sort_order>
411
  <show_in_default>1</show_in_default>
412
  <show_in_website>1</show_in_website>
413
  <show_in_store>0</show_in_store>
@@ -419,7 +443,7 @@
419
  <label>Include Virtual Products in Price Calculation</label>
420
  <frontend_type>select</frontend_type>
421
  <source_model>postnl/system_config_source_yesno</source_model>
422
- <sort_order>120</sort_order>
423
  <show_in_default>1</show_in_default>
424
  <show_in_website>1</show_in_website>
425
  <show_in_store>0</show_in_store>
@@ -431,7 +455,7 @@
431
  <label>Calculate Handling Fee</label>
432
  <frontend_type>select</frontend_type>
433
  <source_model>shipping/source_handlingType</source_model>
434
- <sort_order>130</sort_order>
435
  <show_in_default>1</show_in_default>
436
  <show_in_website>1</show_in_website>
437
  <show_in_store>0</show_in_store>
@@ -440,7 +464,7 @@
440
  <label>Handling Fee</label>
441
  <frontend_type>text</frontend_type>
442
  <validate>validate-number validate-zero-or-greater</validate>
443
- <sort_order>140</sort_order>
444
  <show_in_default>1</show_in_default>
445
  <show_in_website>1</show_in_website>
446
  <show_in_store>0</show_in_store>
@@ -448,7 +472,7 @@
448
  <specificerrmsg translate="label" module="postnl">
449
  <label>Displayed Error Message</label>
450
  <frontend_type>textarea</frontend_type>
451
- <sort_order>150</sort_order>
452
  <show_in_default>1</show_in_default>
453
  <show_in_website>1</show_in_website>
454
  <show_in_store>1</show_in_store>
@@ -456,7 +480,7 @@
456
  <sallowspecific translate="label" module="postnl">
457
  <label>Ship to Applicable Countries</label>
458
  <frontend_type>select</frontend_type>
459
- <sort_order>160</sort_order>
460
  <frontend_class>shipping-applicable-country</frontend_class>
461
  <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
462
  <show_in_default>1</show_in_default>
@@ -466,7 +490,7 @@
466
  <specificcountry translate="label" module="postnl">
467
  <label>Ship to Specific Countries</label>
468
  <frontend_type>multiselect</frontend_type>
469
- <sort_order>170</sort_order>
470
  <source_model>adminhtml/system_config_source_country</source_model>
471
  <show_in_default>1</show_in_default>
472
  <show_in_website>1</show_in_website>
@@ -476,7 +500,7 @@
476
  <showmethod translate="label" module="postnl">
477
  <label>Show Method if Not Applicable</label>
478
  <frontend_type>select</frontend_type>
479
- <sort_order>180</sort_order>
480
  <source_model>postnl/system_config_source_yesno</source_model>
481
  <show_in_default>1</show_in_default>
482
  <show_in_website>1</show_in_website>
@@ -485,7 +509,7 @@
485
  <sort_order translate="label" module="postnl">
486
  <label>Sort Order</label>
487
  <frontend_type>text</frontend_type>
488
- <sort_order>190</sort_order>
489
  <show_in_default>1</show_in_default>
490
  <show_in_website>1</show_in_website>
491
  <show_in_store>0</show_in_store>
@@ -520,6 +544,8 @@
520
  </split_address_check>
521
  <support translate="label" module="postnl">
522
  <label>Version &amp; Support</label>
 
 
523
  <sort_order>300</sort_order> <!-- This should always be the first tab -->
524
  <show_in_default>1</show_in_default>
525
  <show_in_website>1</show_in_website>
@@ -535,29 +561,19 @@
535
  </fields>
536
  </support>
537
  <general translate="label comment" module="postnl">
538
- <label>General Settings</label>
539
- <comment>Here you can enable or disable the entire extension. This is also where you register your extension for use.</comment>
540
  <frontend_model>postnl_adminhtml/system_config_form_fieldset</frontend_model>
 
541
  <sort_order>400</sort_order>
542
  <show_in_default>1</show_in_default>
543
  <show_in_website>1</show_in_website>
544
- <show_in_store>0</show_in_store>
545
  <fields>
546
- <active translate="label comment" module="postnl">
547
- <label>Active</label>
548
- <comment>Enable or disable the extension</comment>
549
- <frontend_type>select</frontend_type>
550
- <source_model>postnl/system_config_source_yesno</source_model>
551
- <sort_order>10</sort_order>
552
- <show_in_default>1</show_in_default>
553
- <show_in_website>1</show_in_website>
554
- <show_in_store>0</show_in_store>
555
- <validate>validate-select</validate>
556
- </active>
557
  <activation_in_progress_header translate="label" module="postnl">
558
- <label><![CDATA[The extension has been partially activated. Fill in the fields below and press the 'finish activation' button below to finish the procedure. Click <a href="#" onclick="%s">here</a> to reset the activation procedure.]]></label>
559
  <frontend_model>postnl_adminhtml/system_config_form_field_activatedFieldHeader</frontend_model>
560
- <sort_order>20</sort_order>
561
  <show_in_default>1</show_in_default>
562
  <show_in_website>0</show_in_website>
563
  <show_in_store>0</show_in_store>
@@ -566,9 +582,9 @@
566
  </depends>
567
  </activation_in_progress_header>
568
  <activated_header translate="label" module="postnl">
569
- <label><![CDATA[The extension has been activated. Click <a href="#" onclick="%s">here</a> to be able to activate the extension under a different name.]]></label>
570
  <frontend_model>postnl_adminhtml/system_config_form_field_activatedFieldHeader</frontend_model>
571
- <sort_order>30</sort_order>
572
  <show_in_default>1</show_in_default>
573
  <show_in_website>0</show_in_website>
574
  <show_in_store>0</show_in_store>
@@ -576,11 +592,11 @@
576
  <is_activated>2</is_activated>
577
  </depends>
578
  </activated_header>
579
- <email translate="label comment" module="postnl">
580
  <label>Email</label>
581
- <comment>During activation 2 secure keys will be sent to this email address.</comment>
582
  <frontend_type>text</frontend_type>
583
- <sort_order>40</sort_order>
584
  <show_in_default>1</show_in_default>
585
  <show_in_website>0</show_in_website>
586
  <show_in_store>0</show_in_store>
@@ -593,7 +609,7 @@
593
  <frontend_type>obscure</frontend_type>
594
  <frontend_model>postnl_adminhtml/system_config_form_field_obscure</frontend_model>
595
  <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
596
- <sort_order>50</sort_order>
597
  <show_in_default>1</show_in_default>
598
  <show_in_website>0</show_in_website>
599
  <show_in_store>0</show_in_store>
@@ -607,7 +623,7 @@
607
  <frontend_type>obscure</frontend_type>
608
  <frontend_model>postnl_adminhtml/system_config_form_field_obscure</frontend_model>
609
  <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
610
- <sort_order>60</sort_order>
611
  <show_in_default>1</show_in_default>
612
  <show_in_website>0</show_in_website>
613
  <show_in_store>0</show_in_store>
@@ -618,7 +634,7 @@
618
  </private_key>
619
  <activate_button>
620
  <frontend_model>postnl_adminhtml/system_config_form_field_activateButton</frontend_model>
621
- <sort_order>70</sort_order>
622
  <show_in_default>1</show_in_default>
623
  <show_in_website>0</show_in_website>
624
  <show_in_store>0</show_in_store>
@@ -628,7 +644,7 @@
628
  </activate_button>
629
  <finish_activation_button>
630
  <frontend_model>postnl_adminhtml/system_config_form_field_activateButton</frontend_model>
631
- <sort_order>80</sort_order>
632
  <show_in_default>1</show_in_default>
633
  <show_in_website>0</show_in_website>
634
  <show_in_store>0</show_in_store>
@@ -636,2172 +652,2144 @@
636
  <is_activated>1</is_activated>
637
  </depends>
638
  </finish_activation_button>
 
 
 
 
 
 
 
 
639
  </fields>
640
  </general>
641
- <cif translate="label comment" module="postnl">
642
- <label>Account Settings</label>
643
- <comment><![CDATA[Here you can configure your PostNL account.</p><p>In order to use this extension you need to <a href='http://www.postnl.nl/zakelijk/e-commerce/flexibele-bezorgopties/contactformulier' target='_blank' title='Register'>register</a> yourself with PostNL. You will then receive all necessary information in order to configure the extension. If you cannot find the email containing this information, please contact your PostNL account manager.</p><p>If you want to test the extension, but don't have any test mode credentials you can use the account credentials found <a href="http://kb.totalinternetgroup.nl/topic/55404467" title="Test mode account credentials" target="_blank">here</a>.]]></comment>
644
  <frontend_model>postnl_adminhtml/system_config_form_fieldset</frontend_model>
 
645
  <sort_order>500</sort_order>
646
  <show_in_default>1</show_in_default>
647
  <show_in_website>1</show_in_website>
648
- <show_in_store>0</show_in_store>
649
  <fields>
650
- <mode translate="label" module="postnl">
651
- <label>Mode</label>
652
- <frontend_type>select</frontend_type>
653
- <source_model>postnl/system_config_source_testlive</source_model>
654
- <sort_order>10</sort_order>
655
- <show_in_default>1</show_in_default>
656
- <show_in_website>1</show_in_website>
657
- <show_in_store>0</show_in_store>
658
- <validate>validate-select</validate>
659
- </mode>
660
- <customer_number translate="label tooltip" module="postnl">
661
- <label>Customer Number</label>
662
- <tooltip>If you are a contract customer of PostNL, you will have received an email containing this setting. If you cannot find this email, please contact PostNL support at 058-2333343</tooltip>
663
- <frontend_type>text</frontend_type>
664
  <sort_order>10</sort_order>
665
  <show_in_default>1</show_in_default>
666
  <show_in_website>1</show_in_website>
667
- <show_in_store>0</show_in_store>
668
- <validate>validate-digits postnl-validate-empty</validate>
669
- </customer_number>
670
- <customer_code translate="label comment tooltip" module="postnl">
671
- <label>Customer Code</label>
672
- <comment>Your customer code as supplied by PostNL. Must contain between 3 and 4 letters.</comment>
673
- <tooltip>If you are a contract customer of PostNL, you will have received an email containing this setting. If you cannot find this email, please contact PostNL support at 058-2333343</tooltip>
674
  <frontend_type>text</frontend_type>
675
  <sort_order>20</sort_order>
676
  <show_in_default>1</show_in_default>
677
  <show_in_website>1</show_in_website>
678
- <show_in_store>0</show_in_store>
679
- <validate>validate-alpha validate-length minimum-length-3 maximum-length-4 postnl-validate-empty</validate>
680
- </customer_code>
681
- <live_username translate="label tooltip" module="postnl">
682
- <label>Live Username</label>
683
- <tooltip>If you are a contract customer of PostNL, you will have received an email containing this setting. If you cannot find this email, please contact PostNL support at 058-2333343</tooltip>
684
  <frontend_type>text</frontend_type>
685
  <sort_order>30</sort_order>
686
  <show_in_default>1</show_in_default>
687
  <show_in_website>1</show_in_website>
688
- <show_in_store>0</show_in_store>
689
- <validate>postnl-validate-empty</validate>
690
- <depends>
691
- <mode>0</mode>
692
- </depends>
693
- </live_username>
694
- <live_password translate="label tooltip" module="postnl">
695
- <label>Live Password</label>
696
- <tooltip>If you are a contract customer of PostNL, you will have received an email containing this setting. If you cannot find this email, please contact PostNL support at 058-2333343</tooltip>
697
- <frontend_type>obscure</frontend_type>
698
- <frontend_model>postnl_adminhtml/system_config_form_field_obscure</frontend_model>
699
- <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
700
  <sort_order>40</sort_order>
701
  <show_in_default>1</show_in_default>
702
  <show_in_website>1</show_in_website>
703
- <show_in_store>0</show_in_store>
704
- <validate>postnl-validate-empty</validate>
705
- <autocomplete>off</autocomplete>
706
- <depends>
707
- <mode>0</mode>
708
- </depends>
709
- </live_password>
710
- <test_username translate="label" module="postnl">
711
- <label>Test Username</label>
712
  <frontend_type>text</frontend_type>
713
  <sort_order>50</sort_order>
714
  <show_in_default>1</show_in_default>
715
  <show_in_website>1</show_in_website>
716
- <show_in_store>0</show_in_store>
717
- <validate>postnl-validate-empty</validate>
718
- <depends>
719
- <mode>1</mode>
720
- </depends>
721
- </test_username>
722
- <test_password translate="label" module="postnl">
723
- <label>Test Password</label>
724
- <frontend_type>obscure</frontend_type>
725
- <frontend_model>postnl_adminhtml/system_config_form_field_obscure</frontend_model>
726
- <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
727
  <sort_order>60</sort_order>
728
  <show_in_default>1</show_in_default>
729
  <show_in_website>1</show_in_website>
730
- <show_in_store>0</show_in_store>
731
- <validate>postnl-validate-empty</validate>
732
- <autocomplete>off</autocomplete>
733
- <depends>
734
- <mode>1</mode>
735
- </depends>
736
- </test_password>
737
- <collection_location translate="label comment tooltip" module="postnl">
738
- <label>BLS (location) Code</label>
739
- <comment>The internal code of the nearest PostNL sorting centre. Must contain 6 numbers.</comment>
740
- <tooltip>If you are a contract customer of PostNL, you will have received an email containing this setting. If you cannot find this email, please contact PostNL support at 058-2333343</tooltip>
741
  <frontend_type>text</frontend_type>
742
  <sort_order>70</sort_order>
743
  <show_in_default>1</show_in_default>
744
  <show_in_website>1</show_in_website>
745
- <show_in_store>0</show_in_store>
746
- <validate>validate-digits validate-length minimum-length-6 maximum-length-6 postnl-validate-empty</validate>
747
- </collection_location>
748
- <webshop_id translate="label" module="postnl">
749
- <label>Webshop ID</label>
750
- <frontend_type>obscure</frontend_type>
751
- <frontend_model>postnl_adminhtml/system_config_form_field_obscure</frontend_model>
752
- <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
753
  <sort_order>80</sort_order>
754
  <show_in_default>1</show_in_default>
755
  <show_in_website>1</show_in_website>
756
- <show_in_store>0</show_in_store>
757
- <autocomplete>off</autocomplete>
758
- </webshop_id>
759
- <public_webshop_id translate="label" module="postnl">
760
- <label>Public Webshop ID</label>
761
  <frontend_type>text</frontend_type>
762
  <sort_order>90</sort_order>
763
  <show_in_default>1</show_in_default>
764
  <show_in_website>1</show_in_website>
765
- <show_in_store>0</show_in_store>
766
- </public_webshop_id>
767
- <validate_button translate="tooltip" module="postnl">
768
- <comment>You can use this button to validate your account settings without saving the configuration.</comment>
769
- <tooltip><![CDATA[This will send a 'test' request to PostNL. If the above fields are not entered correctly, this will result in an error. Please note that the PostNL extension must be active for the validation to succeed. <br />Please note that the webshop ID and public webshop ID fields will not be validated. Only your CIF credentials will be checked.]]></tooltip>
770
- <frontend_model>postnl_adminhtml/system_config_form_field_validateButton</frontend_model>
771
  <sort_order>100</sort_order>
772
  <show_in_default>1</show_in_default>
773
  <show_in_website>1</show_in_website>
774
- <show_in_store>0</show_in_store>
775
- </validate_button>
776
- <global_fields_header translate="label" module="postnl">
777
- <label>These fields are only required if you intend to send products to countries outside the EU.</label>
778
- <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
 
779
  <sort_order>110</sort_order>
780
  <show_in_default>1</show_in_default>
781
  <show_in_website>1</show_in_website>
782
- <show_in_store>0</show_in_store>
783
- </global_fields_header>
784
- <use_globalpack translate="label comment" module="postnl">
785
- <label>Use GlobalPack</label>
786
- <comment>GlobalPack is used to ship orders outside the EU. Otherwise you can leave this field disabled.</comment>
787
- <frontend_type>select</frontend_type>
788
- <source_model>postnl/system_config_source_yesno</source_model>
789
  <sort_order>120</sort_order>
790
  <show_in_default>1</show_in_default>
791
  <show_in_website>1</show_in_website>
792
- <show_in_store>0</show_in_store>
793
- </use_globalpack>
794
- <global_barcode_type translate="label comment" module="postnl">
795
- <label>Global Barcode Type</label>
796
- <comment>The current global barcode type as supplied by PostNL. Must contain 2 letters.</comment>
797
- <frontend_type>text</frontend_type>
 
798
  <sort_order>130</sort_order>
799
  <show_in_default>1</show_in_default>
800
  <show_in_website>1</show_in_website>
801
- <show_in_store>0</show_in_store>
802
- <validate>validate-alpha validate-length minimum-length-2 maximum-length-2</validate>
803
- <depends>
804
- <use_globalpack>1</use_globalpack>
805
- </depends>
806
- </global_barcode_type>
807
- <global_barcode_range translate="label comment" module="postnl">
808
- <label>Global Barcode Range</label>
809
- <comment>Your global barcode range as supplied by PostNL. Must contain 4 digits.</comment>
810
  <frontend_type>text</frontend_type>
811
  <sort_order>140</sort_order>
812
  <show_in_default>1</show_in_default>
813
  <show_in_website>1</show_in_website>
814
- <show_in_store>0</show_in_store>
815
- <validate>validate-digits validate-length minimum-length-4 maximum-length-4</validate>
816
  <depends>
817
- <use_globalpack>1</use_globalpack>
818
  </depends>
819
- </global_barcode_range>
820
- </fields>
821
- </cif>
822
- <cif_labels_and_confirming translate="label comment" module="postnl">
823
- <label>Confirming &amp; Label Printing Settings</label>
824
- <comment>Here you can specify your confirming and label printing preferences. You can also customize the way our modified shipment and order grids are displayed. Lastly, you can specify whether the extension should automatically send a track &amp; trace email to your customers.</comment>
825
- <frontend_model>postnl_adminhtml/system_config_form_fieldset</frontend_model>
826
- <sort_order>600</sort_order>
827
- <show_in_default>1</show_in_default>
828
- <show_in_website>1</show_in_website>
829
- <show_in_store>1</show_in_store>
830
- <fields>
831
- <label_size translate="label comment" module="postnl">
832
- <label>Label size</label>
833
- <comment>This setting only applies to multiple Dutch and EPS labels. GlobalPack labels are always printed as A4.</comment>
834
- <frontend_type>select</frontend_type>
835
- <source_model>postnl_core/system_config_source_labelSize</source_model>
836
- <sort_order>10</sort_order>
837
  <show_in_default>1</show_in_default>
838
- <show_in_website>0</show_in_website>
839
- <show_in_store>0</show_in_store>
840
- <validate>validate-select</validate>
841
- </label_size>
842
- <weight_per_parcel translate="label comment tooltip" module="postnl">
843
- <label>Maximum weight per parcel</label>
844
- <comment>Determine the maximum weight of each parcel. If a shipment's total weight exceeds this, the shipment will be spread out over multiple parcels.</comment>
845
- <tooltip>This only applies to Dutch shipments. Each parcel needs to be shipped seperately and will receive it's own shipping label.</tooltip>
 
846
  <frontend_type>text</frontend_type>
847
- <sort_order>20</sort_order>
848
  <show_in_default>1</show_in_default>
849
  <show_in_website>1</show_in_website>
850
  <show_in_store>1</show_in_store>
851
- <validate>validate-greater-than-zero validate-number</validate>
852
- </weight_per_parcel>
853
- <weight_unit translate="label comment" module="postnl">
854
- <label>Weight unit</label>
855
- <comment>Select the unit in which you've entered products' weight</comment>
856
- <frontend_type>select</frontend_type>
857
- <source_model>postnl_core/system_config_source_weightUnit</source_model>
858
- <sort_order>30</sort_order>
859
  <show_in_default>1</show_in_default>
860
  <show_in_website>1</show_in_website>
861
  <show_in_store>1</show_in_store>
862
- <validate>validate-select</validate>
863
- </weight_unit>
864
- <shipment_reference_type translate="label comment" module="postnl">
865
- <label>Shipment reference type</label>
866
- <comment>Select what to use as a shipment's reference. This will be printed on the shipping label</comment>
867
- <frontend_type>select</frontend_type>
868
- <source_model>postnl_core/system_config_source_referenceType</source_model>
869
- <sort_order>40</sort_order>
870
  <show_in_default>1</show_in_default>
871
  <show_in_website>1</show_in_website>
872
  <show_in_store>1</show_in_store>
873
- </shipment_reference_type>
874
- <custom_shipment_reference translate="label comment tooltip" module="postnl">
875
- <label>Custom reference value</label>
876
- <comment>You can use the following variables: {{var shipment_increment_id}}, {{var order_increment_id}} and {{var store_frontend_name}}. The resulting text may not exceed 28 characters.</comment>
877
- <tooltip>You can use this field to for example, add a prefix to the shipment increment ID or to help identify the shipment as coming from your webshop.</tooltip>
 
 
 
878
  <frontend_type>text</frontend_type>
879
- <sort_order>50</sort_order>
880
  <show_in_default>1</show_in_default>
881
  <show_in_website>1</show_in_website>
882
  <show_in_store>1</show_in_store>
 
883
  <depends>
884
- <shipment_reference_type>custom</shipment_reference_type>
885
  </depends>
886
- </custom_shipment_reference>
887
- <buspakje_header translate="label" module="postnl">
888
- <label>These settings allow you to configure if and how PostNL determines if a shipment is a letter box parcel or a regular package shipment. Letter box parcels have to be able to fit through a mail slot and will be delivered using the regular mail service, rather than PostNL's parcel service.</label>
889
- <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
890
- <sort_order>60</sort_order>
 
891
  <show_in_default>1</show_in_default>
892
- <show_in_website>0</show_in_website>
893
- <show_in_store>0</show_in_store>
894
- </buspakje_header>
895
- <use_buspakje translate="label comment" module="postnl">
896
- <label>Use letter box parcels</label>
897
- <comment><![CDATA[If you disable this field all shipments will be considered regular package shipments.<br/>It is very important that you have correctly configured all products when using letter box parcels. Orders weighing more than <strong>2kg</strong> or are larger than <strong>38 x 26.5 x 3.2 cm</strong> cannot be shipped as letter box parcels.]]></comment>
898
- <frontend_type>select</frontend_type>
899
- <source_model>postnl/system_config_source_yesno</source_model>
900
- <sort_order>70</sort_order>
 
901
  <show_in_default>1</show_in_default>
902
- <show_in_website>0</show_in_website>
903
- <show_in_store>0</show_in_store>
904
- </use_buspakje>
905
- <buspakje_calculation_mode translate="label comment" module="postnl">
906
- <label>Calculation mode</label>
907
- <comment>You can let the PostNL extension calculate automatically whether a shipment would fit in a mail slot or you can manually determine this when creating shipments in the backend.</comment>
908
- <tooltip>If set to 'automatic' the PostNL extension will check the 'Weight' and 'PostNL Max Qty For Letter Box Parcels' of all products in an order to determine whether the shipment would fit through a mail slot. You may always overrule this and manually set whether a shipment is a letter box parcel or not.</tooltip>
909
- <frontend_type>select</frontend_type>
910
- <source_model>postnl_core/system_config_source_manualAutomatic</source_model>
911
- <sort_order>80</sort_order>
 
912
  <show_in_default>1</show_in_default>
913
- <show_in_website>0</show_in_website>
914
- <show_in_store>0</show_in_store>
915
  <depends>
916
- <use_buspakje>1</use_buspakje>
917
  </depends>
918
- </buspakje_calculation_mode>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
919
  <duration_header translate="label" module="postnl">
920
- <label><![CDATA[PostNL delivery options determine the possible delivery dates based on a few settings. It is important that you configure these as accurately as you can. You should try to be conservative with these settings. If you cannot transfer a shipment to PostNL on time each day, customers may not receive their order on the requested date.<br />You can interpret these settings as "If ordered by {cut-off time}, the order will be delivered in {shipping duration} days".]]></label>
921
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
922
- <sort_order>90</sort_order>
923
  <show_in_default>1</show_in_default>
924
  <show_in_website>1</show_in_website>
925
  <show_in_store>1</show_in_store>
926
  </duration_header>
927
- <shipping_duration translate="label comment" module="postnl">
928
  <label>Shipping duration</label>
929
- <comment>The number of days shipping will take after a customer finishes their order.</comment>
930
  <source_model>postnl_core/system_config_source_shippingDuration</source_model>
931
  <frontend_type>select</frontend_type>
932
- <sort_order>100</sort_order>
933
  <show_in_default>1</show_in_default>
934
  <show_in_website>1</show_in_website>
935
  <show_in_store>1</show_in_store>
936
  </shipping_duration>
937
- <cutoff_time translate="label comment" module="postnl">
938
  <label>Order cut-off time</label>
939
- <comment>When an order is placed after this time, another day will be added to the shipping duration.</comment>
940
  <frontend_model>postnl_adminhtml/system_config_form_field_hourMinute</frontend_model>
941
  <source_model>postnl_core/system_config_source_hourMinute</source_model>
942
  <backend_model>postnl_core/system_config_backend_hourMinute</backend_model>
943
- <sort_order>110</sort_order>
944
  <show_in_default>1</show_in_default>
945
  <show_in_website>1</show_in_website>
946
  <show_in_store>1</show_in_store>
947
  </cutoff_time>
948
- <grid_header translate="label" module="postnl">
949
- <label>These fields allow you to alter the way the order and shipment grids are displayed.</label>
950
- <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
951
- <sort_order>120</sort_order>
952
- <show_in_default>1</show_in_default>
953
- <show_in_website>0</show_in_website>
954
- <show_in_store>0</show_in_store>
955
- </grid_header>
956
- <show_grid_options translate="label comment tooltip" module="postnl">
957
- <label>Show product options in order grid</label>
958
- <comment>This will add a product options field to the create shipments mass action in the order grid. If disabled, default options will be used.</comment>
959
- <tooltip>These options will appear in a dropdown field next to the 'create shipments' mass action in the sales > order grid.</tooltip>
960
- <frontend_type>select</frontend_type>
961
- <source_model>postnl/system_config_source_yesno</source_model>
962
- <sort_order>130</sort_order>
963
- <show_in_default>1</show_in_default>
964
- <show_in_website>0</show_in_website>
965
- <show_in_store>0</show_in_store>
966
- </show_grid_options>
967
- <show_buspakje_option translate="label comment tooltip" module="postnl">
968
- <label>Show letter box parcel option in order grid</label>
969
- <comment>This will add the option to mark shipments as being letter box parcels when creating shipments from the order grid.</comment>
970
- <frontend_type>select</frontend_type>
971
- <source_model>postnl/system_config_source_yesno</source_model>
972
- <sort_order>140</sort_order>
973
- <show_in_default>1</show_in_default>
974
- <show_in_website>0</show_in_website>
975
- <show_in_store>0</show_in_store>
976
- <depends>
977
- <use_buspakje>1</use_buspakje>
978
- <buspakje_calculation_mode>manual</buspakje_calculation_mode>
979
- </depends>
980
- </show_buspakje_option>
981
- <shipping_grid_columns_anchor>
982
- <frontend_model>postnl_adminhtml/system_config_form_field_anchor</frontend_model>
983
- <anchor_name>shipment_grid_columns</anchor_name>
984
- <sort_order>150</sort_order>
985
- <show_in_default>1</show_in_default>
986
- <show_in_website>0</show_in_website>
987
- <show_in_store>0</show_in_store>
988
- </shipping_grid_columns_anchor>
989
- <order_grid_columns translate="label comment tooltip" module="postnl">
990
- <label>Optional order grid columns</label>
991
- <comment>Select which optional columns to show in the order grid.</comment>
992
- <tooltip>Selecting too many columns may cause the order grid to no longer fit on your monitor.</tooltip>
993
- <frontend_type>multiselect</frontend_type>
994
- <source_model>postnl_adminhtml/system_config_source_orderGridColumns</source_model>
995
- <sort_order>160</sort_order>
996
- <show_in_default>1</show_in_default>
997
- <show_in_website>0</show_in_website>
998
- <show_in_store>0</show_in_store>
999
- <can_be_empty>1</can_be_empty>
1000
- </order_grid_columns>
1001
- <order_grid_massaction_default translate="label" module="postnl">
1002
- <label>Select a default option for the order grid mass action.</label>
1003
- <frontend_type>select</frontend_type>
1004
- <source_model>postnl_adminhtml/system_config_source_orderGridMassaction</source_model>
1005
- <sort_order>170</sort_order>
1006
- <show_in_default>1</show_in_default>
1007
- <show_in_website>0</show_in_website>
1008
- <show_in_store>0</show_in_store>
1009
- </order_grid_massaction_default>
1010
- <shipping_grid_columns translate="label comment tooltip" module="postnl">
1011
- <label>Optional shipment grid columns</label>
1012
- <comment>Select which optional columns to show in the shipment grid.</comment>
1013
- <tooltip>Selecting too many columns may cause the shipment grid to no longer fit on your monitor.</tooltip>
1014
  <frontend_type>multiselect</frontend_type>
1015
- <source_model>postnl_adminhtml/system_config_source_shipmentGridColumns</source_model>
1016
- <sort_order>180</sort_order>
1017
- <show_in_default>1</show_in_default>
1018
- <show_in_website>0</show_in_website>
1019
- <show_in_store>0</show_in_store>
1020
- <can_be_empty>1</can_be_empty>
1021
- </shipping_grid_columns>
1022
- <shipping_grid_massaction_default translate="label" module="postnl">
1023
- <label>Select a default option for the shipment grid mass action.</label>
1024
- <frontend_type>select</frontend_type>
1025
- <source_model>postnl_adminhtml/system_config_source_shipmentGridMassaction</source_model>
1026
- <sort_order>190</sort_order>
1027
  <show_in_default>1</show_in_default>
1028
- <show_in_website>0</show_in_website>
1029
- <show_in_store>0</show_in_store>
1030
- </shipping_grid_massaction_default>
1031
- <email_header translate="label" module="postnl">
1032
- <label>These fields are used to configure the track &amp; trace email that may be automatically emailed to customers after a shipment has been confirmed.</label>
1033
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1034
- <sort_order>200</sort_order>
1035
  <show_in_default>1</show_in_default>
1036
  <show_in_website>1</show_in_website>
1037
  <show_in_store>1</show_in_store>
1038
- </email_header>
1039
- <send_track_and_trace_email translate="label comment" module="postnl">
1040
- <label>Automatically send track &amp; trace email to customer</label>
1041
- <comment>If enabled, a track &amp; trace email will be sent to the customer roughly 20 minutes after a shipment has been confirmed.</comment>
1042
  <frontend_type>select</frontend_type>
1043
- <source_model>postnl/system_config_source_yesno</source_model>
1044
- <sort_order>210</sort_order>
1045
  <show_in_default>1</show_in_default>
1046
  <show_in_website>1</show_in_website>
1047
  <show_in_store>1</show_in_store>
1048
- <validate>validate-select</validate>
1049
- </send_track_and_trace_email>
1050
- <track_and_trace_email_template translate="label comment" module="postnl">
1051
- <label>Track &amp; trace email template</label>
1052
- <comment>You can customize the track &amp; trace email in system > transactional emails.</comment>
1053
- <frontend_type>select</frontend_type>
1054
- <source_model>adminhtml/system_config_source_email_template</source_model>
1055
- <sort_order>220</sort_order>
1056
  <show_in_default>1</show_in_default>
1057
  <show_in_website>1</show_in_website>
1058
  <show_in_store>1</show_in_store>
1059
- <validate>validate-select</validate>
1060
- </track_and_trace_email_template>
1061
- <send_copy translate="label comment" module="postnl">
1062
- <label>Send a copy of the track &amp; trace email</label>
1063
- <comment>If enabled, you may enter seperate email addresses to which the track &amp; trace email will be sent in addition to the customer.</comment>
1064
- <frontend_type>select</frontend_type>
 
 
 
1065
  <source_model>postnl/system_config_source_yesno</source_model>
1066
- <sort_order>230</sort_order>
 
1067
  <show_in_default>1</show_in_default>
1068
  <show_in_website>1</show_in_website>
1069
  <show_in_store>1</show_in_store>
1070
- <validate>validate-select</validate>
1071
- </send_copy>
1072
- <copy_to translate="label comment" module="postnl">
1073
- <label>Send track &amp; trace email copy to</label>
1074
- <comment>You can enter multiple email addresses seperated by commas.</comment>
1075
- <frontend_type>text</frontend_type>
1076
- <sort_order>240</sort_order>
 
 
 
 
 
 
1077
  <show_in_default>1</show_in_default>
1078
  <show_in_website>1</show_in_website>
1079
  <show_in_store>1</show_in_store>
1080
  <depends>
1081
- <send_copy>1</send_copy>
 
 
 
 
1082
  </depends>
1083
- </copy_to>
1084
- <copy_method translate="label" module="postnl">
1085
- <label>Track &amp; trace email copy method</label>
1086
- <frontend_type>select</frontend_type>
1087
- <source_model>adminhtml/system_config_source_email_method</source_model>
1088
- <sort_order>250</sort_order>
 
1089
  <show_in_default>1</show_in_default>
1090
  <show_in_website>1</show_in_website>
1091
  <show_in_store>1</show_in_store>
1092
  <depends>
1093
- <send_copy>1</send_copy>
 
 
 
 
1094
  </depends>
1095
- </copy_method>
1096
- </fields>
1097
- </cif_labels_and_confirming>
1098
- <packing_slip translate="label comment" module="postnl">
1099
- <label>Packing Slip Settings</label>
1100
- <comment><![CDATA[Here you can configure which elements you would like to show on the PostNL packing slip. You can read more about these settings and the impact they have on the resulting packing slip <a href="http://kb.totalinternetgroup.nl/topic/95885953" target="_blank" title="More info">here</a>.]]></comment>
1101
- <frontend_model>postnl_adminhtml/system_config_form_fieldset</frontend_model>
1102
- <sort_order>700</sort_order>
1103
- <show_in_default>1</show_in_default>
1104
- <show_in_website>1</show_in_website>
1105
- <show_in_store>1</show_in_store>
1106
- <fields>
1107
- <logo translate="label comment" module="postnl">
1108
- <label>Logo for packing slips</label>
1109
- <comment>The image will automatically be resized to fit the maximum dimensions of 900x100px.</comment>
1110
- <frontend_type>image</frontend_type>
1111
- <backend_model>postnl_core/system_config_backend_image_pdf</backend_model>
1112
- <upload_dir config="system/filesystem/media" scope_info="1">TIG/PostNL/core/packing_slip_logo</upload_dir>
1113
- <base_url type="media" scope_info="1">TIG/PostNL/core/packing_slip_logo</base_url>
1114
- <sort_order>10</sort_order>
1115
- <show_in_default>1</show_in_default>
1116
- <show_in_website>1</show_in_website>
1117
- <show_in_store>0</show_in_store>
1118
- </logo>
1119
- <show_webshop_info translate="label comment" module="postnl">
1120
- <label>Show webshop information</label>
1121
- <comment>If enabled, the shop's name, contact address, CoC and VAT numbers will be displayed on the packing slip.</comment>
1122
- <frontend_type>select</frontend_type>
1123
- <source_model>postnl/system_config_source_yesno</source_model>
1124
- <sort_order>20</sort_order>
1125
- <show_in_default>1</show_in_default>
1126
- <show_in_website>1</show_in_website>
1127
- <show_in_store>0</show_in_store>
1128
- <validate>validate-select</validate>
1129
- </show_webshop_info>
1130
- <coc_number translate="label" module="postnl">
1131
- <label>CoC number</label>
1132
  <frontend_type>text</frontend_type>
1133
- <sort_order>30</sort_order>
1134
  <show_in_default>1</show_in_default>
1135
  <show_in_website>1</show_in_website>
1136
  <show_in_store>1</show_in_store>
1137
  <depends>
1138
- <show_webshop_info>1</show_webshop_info>
 
 
 
 
1139
  </depends>
1140
- </coc_number>
1141
- <vat_number translate="label" module="postnl">
1142
- <label>VAT number</label>
 
 
1143
  <frontend_type>text</frontend_type>
1144
- <sort_order>40</sort_order>
1145
  <show_in_default>1</show_in_default>
1146
  <show_in_website>1</show_in_website>
1147
  <show_in_store>1</show_in_store>
1148
  <depends>
1149
- <show_webshop_info>1</show_webshop_info>
 
 
 
 
1150
  </depends>
1151
- </vat_number>
1152
- <show_customer_number translate="label comment" module="postnl">
1153
- <label>Show customer number</label>
1154
- <comment>If enabled, the customer ID will be printed on the packing slip for registered customers.</comment>
1155
- <frontend_type>select</frontend_type>
 
 
 
1156
  <source_model>postnl/system_config_source_yesno</source_model>
1157
- <sort_order>50</sort_order>
1158
  <show_in_default>1</show_in_default>
1159
  <show_in_website>1</show_in_website>
1160
  <show_in_store>0</show_in_store>
1161
- <validate>validate-select</validate>
1162
- </show_customer_number>
1163
- <show_billing_address translate="label" module="postnl">
1164
- <label>Show billing address</label>
 
 
1165
  <frontend_type>select</frontend_type>
1166
- <source_model>postnl/system_config_source_yesno</source_model>
1167
- <sort_order>60</sort_order>
1168
  <show_in_default>1</show_in_default>
1169
  <show_in_website>1</show_in_website>
1170
  <show_in_store>0</show_in_store>
 
 
 
 
1171
  <validate>validate-select</validate>
1172
- </show_billing_address>
1173
- <show_shipping_address translate="label" module="postnl">
1174
- <label>Show shipping address</label>
1175
  <frontend_type>select</frontend_type>
1176
- <source_model>postnl/system_config_source_yesno</source_model>
1177
- <sort_order>70</sort_order>
1178
  <show_in_default>1</show_in_default>
1179
  <show_in_website>1</show_in_website>
1180
  <show_in_store>0</show_in_store>
 
 
 
 
1181
  <validate>validate-select</validate>
1182
- </show_shipping_address>
1183
- <show_pakjegemak_address translate="label" module="postnl">
1184
- <label>Show post office address</label>
1185
- <frontend_type>select</frontend_type>
 
1186
  <source_model>postnl/system_config_source_yesno</source_model>
1187
- <sort_order>80</sort_order>
1188
  <show_in_default>1</show_in_default>
1189
  <show_in_website>1</show_in_website>
1190
  <show_in_store>0</show_in_store>
1191
- <validate>validate-select</validate>
1192
- </show_pakjegemak_address>
1193
- <show_order_info translate="label comment" module="postnl">
1194
- <label>Show order information</label>
1195
- <comment>If enabled, the order ID, shipment ID and order date will be shown on the packing slip.</comment>
 
 
1196
  <frontend_type>select</frontend_type>
1197
- <source_model>postnl/system_config_source_yesno</source_model>
1198
- <sort_order>90</sort_order>
1199
  <show_in_default>1</show_in_default>
1200
  <show_in_website>1</show_in_website>
1201
  <show_in_store>0</show_in_store>
 
 
 
 
 
1202
  <validate>validate-select</validate>
1203
- </show_order_info>
1204
- <show_payment_method translate="label" module="postnl">
1205
- <label>Show payment method</label>
1206
- <frontend_type>select</frontend_type>
1207
- <source_model>postnl/system_config_source_yesno</source_model>
1208
- <sort_order>100</sort_order>
1209
  <show_in_default>1</show_in_default>
1210
  <show_in_website>1</show_in_website>
1211
  <show_in_store>0</show_in_store>
1212
- <validate>validate-select</validate>
1213
- </show_payment_method>
1214
- <show_shipping_method translate="label" module="postnl">
1215
- <label>Show shipping method</label>
1216
  <frontend_type>select</frontend_type>
1217
- <source_model>postnl/system_config_source_yesno</source_model>
1218
- <sort_order>110</sort_order>
1219
  <show_in_default>1</show_in_default>
1220
  <show_in_website>1</show_in_website>
1221
  <show_in_store>0</show_in_store>
1222
- <validate>validate-select</validate>
1223
- </show_shipping_method>
1224
- <show_shipping_date translate="label" module="postnl">
1225
- <label>Show shipping date</label>
1226
  <frontend_type>select</frontend_type>
1227
- <source_model>postnl/system_config_source_yesno</source_model>
1228
- <sort_order>120</sort_order>
1229
  <show_in_default>1</show_in_default>
1230
  <show_in_website>1</show_in_website>
1231
  <show_in_store>0</show_in_store>
1232
- <validate>validate-select</validate>
1233
- </show_shipping_date>
1234
- <item_columns translate="label comment" module="postnl">
1235
- <label>Item columns</label>
1236
- <comment>You can specify which item columns you would like to show on your packing slip pdf. We recommend you experiment with these settings before using them in a production environment. It may be diffcult to predict the outcome of these settings without trying them out by printing a PostNL packing slip.</comment>
1237
- <frontend_model>postnl_adminhtml/system_config_form_field_packingSlipItemColumns</frontend_model>
1238
- <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
1239
- <sort_order>130</sort_order>
1240
  <show_in_default>1</show_in_default>
1241
  <show_in_website>1</show_in_website>
1242
  <show_in_store>0</show_in_store>
1243
- </item_columns>
1244
- <show_totals translate="label" module="postnl">
1245
- <label>Show shipment totals</label>
 
1246
  <frontend_type>select</frontend_type>
1247
- <source_model>postnl/system_config_source_yesno</source_model>
1248
- <sort_order>140</sort_order>
1249
  <show_in_default>1</show_in_default>
1250
  <show_in_website>1</show_in_website>
1251
  <show_in_store>0</show_in_store>
1252
- <validate>validate-select</validate>
1253
- </show_totals>
1254
- <show_comment translate="label" module="postnl">
1255
- <label>Show shipment comment</label>
1256
  <frontend_type>select</frontend_type>
1257
- <source_model>postnl/system_config_source_yesno</source_model>
1258
- <sort_order>150</sort_order>
1259
  <show_in_default>1</show_in_default>
1260
  <show_in_website>1</show_in_website>
1261
  <show_in_store>0</show_in_store>
1262
- <validate>validate-select</validate>
1263
- </show_comment>
1264
- <comment_type translate="label comment" module="postnl">
1265
- <label>Comment type</label>
1266
- <comment>You can choose to show a static, pre-configured message or you can show the last visible comment added to the shipment on the shipment detail page.</comment>
1267
  <frontend_type>select</frontend_type>
1268
- <source_model>postnl_core/system_config_source_commentType</source_model>
1269
- <sort_order>160</sort_order>
1270
  <show_in_default>1</show_in_default>
1271
  <show_in_website>1</show_in_website>
1272
  <show_in_store>0</show_in_store>
1273
- <validate>validate-select</validate>
1274
- <depends>
1275
- <show_comment>1</show_comment>
1276
- </depends>
1277
- </comment_type>
1278
- <comment_text translate="label" module="postnl">
1279
- <label>Comment text</label>
1280
- <frontend_type>textarea</frontend_type>
1281
- <sort_order>170</sort_order>
1282
  <show_in_default>1</show_in_default>
1283
  <show_in_website>1</show_in_website>
1284
  <show_in_store>1</show_in_store>
1285
- <validate>validate-select</validate>
1286
- <depends>
1287
- <show_comment>1</show_comment>
1288
- <comment_type>static</comment_type>
1289
- </depends>
1290
- </comment_text>
1291
- <show_label translate="label comment" module="postnl">
1292
- <label>Show shipping label</label>
1293
- <comment>If enabled, the shipping label will be printed directly on the packing slip if possible. Otherwise it will always be printed on a separate page.</comment>
1294
- <frontend_type>select</frontend_type>
1295
- <source_model>postnl/system_config_source_yesno</source_model>
1296
- <sort_order>180</sort_order>
1297
- <show_in_default>1</show_in_default>
1298
- <show_in_website>1</show_in_website>
1299
- <show_in_store>0</show_in_store>
1300
- <validate>validate-select</validate>
1301
- </show_label>
1302
  </fields>
1303
- </packing_slip>
1304
- <parcelware_export translate="label comment" module="postnl">
1305
- <label>Parcelware Export Settings</label>
1306
- <comment><![CDATA[This is where you can configure your Parcelware export. You can find more information about configuring these settings <a href="http://kb.totalinternetgroup.nl/topic/94906903" target="_blank" title="More info">here</a>.]]></comment>
1307
  <frontend_model>postnl_adminhtml/system_config_form_fieldset</frontend_model>
1308
- <sort_order>800</sort_order>
 
1309
  <show_in_default>1</show_in_default>
1310
  <show_in_website>1</show_in_website>
1311
  <show_in_store>1</show_in_store>
1312
  <fields>
1313
- <active translate="label" module="postnl">
1314
- <label>Enable Parcelware export</label>
1315
- <frontend_type>select</frontend_type>
1316
- <source_model>postnl/system_config_source_yesno</source_model>
1317
  <sort_order>10</sort_order>
1318
  <show_in_default>1</show_in_default>
1319
- <show_in_website>0</show_in_website>
1320
- <show_in_store>0</show_in_store>
1321
- <validate>validate-select</validate>
1322
- </active>
1323
- <parcelware_export_disabled_header translate="label" module="postnl">
1324
- <label>Parcelware export is disabled. Activate Parcelware export in order to edit these settings. Please note that you can only activate Parcelware export from the global level.</label>
26
  * It is available through the world-wide-web at this URL:
27
  * http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
28
  * If you are unable to obtain it through the world-wide-web, please send an email
29
+ * to servicedesk@tig.nl so we can send you a copy immediately.
30
  *
31
  * DISCLAIMER
32
  *
33
  * Do not edit or add to this file if you wish to upgrade this module to newer
34
  * versions in the future. If you wish to customize this module for your
35
+ * needs please contact servicedesk@tig.nl for more information.
36
  *
37
+ * @copyright Copyright (c) 2014 Total Internet Group B.V. (http://www.tig.nl)
38
  * @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US
39
  */
40
  -->
60
  <groups>
61
  <classes>
62
  <fields>
63
+ <postnl_cod_fee translate="label tooltip" module="postnl">
64
  <label>Tax class for PostNL COD fee</label>
65
+ <tooltip>This tax class will be used when calculating the tax for the PostNL COD fee.</tooltip>
66
  <frontend_type>select</frontend_type>
67
  <source_model>postnl_payment/system_config_source_codFeeTaxClass</source_model>
68
  <sort_order>20</sort_order>
74
  </classes>
75
  <calculation>
76
  <fields>
77
+ <postnl_cod_fee_including_tax translate="label tooltip" module="postnl">
78
  <label>PostNL COD fee</label>
79
+ <tooltip>Whether the PostNL COD fee you have entered is incl. or excl. tax.</tooltip>
80
  <frontend_type>select</frontend_type>
81
  <backend_model>tax/config_price_include</backend_model>
82
  <source_model>tax/system_config_source_priceType</source_model>
125
  <show_in_website>1</show_in_website>
126
  <show_in_store>1</show_in_store>
127
  <fields>
128
+ <active translate="label tooltip" module="postnl">
129
  <label>Enabled</label>
130
+ <tooltip>Enable or disable the PostNL Cash on Delivery payment method.</tooltip>
131
  <frontend_type>select</frontend_type>
132
  <source_model>postnl/system_config_source_yesno</source_model>
133
  <sort_order>10</sort_order>
135
  <show_in_website>1</show_in_website>
136
  <show_in_store>1</show_in_store>
137
  </active>
138
+ <title translate="label tooltip" module="postnl">
139
  <label>Title</label>
140
  <tooltip><![CDATA[<p>If you have configured a fee in the field below, you may use '%s' in the title. This will be replaced with the fee amount in the customer's chosen currency.</p><p>I.e. If the fee is 17.45 EUR and the title you have entered is "PostNL COD (+%s)" then the title will show "PostNL COD (+€17,45)". If the customer has chosen to pay in USD, the title will show "PostNL COD (+$23.73)" instead.</p>]]></tooltip>
141
  <frontend_type>text</frontend_type>
147
  <active>1</active>
148
  </depends>
149
  </title>
150
+ <fee translate="label tooltip" modul="postnl">
151
  <label>Fee</label>
152
+ <tooltip>This fee will be charged to the customer when they choose to pay using PostNL COD.</tooltip>
153
  <frontend_type>text</frontend_type>
154
  <sort_order>30</sort_order>
155
  <show_in_default>1</show_in_default>
160
  <active>1</active>
161
  </depends>
162
  </fee>
163
+ <fee_label translate="label tooltip" modul="postnl">
164
  <label>Fee label</label>
165
+ <tooltip>This label will be displayed next to the fee on the checkout, order, invoice and creditmemo pages and pdfs.</tooltip>
166
  <frontend_type>text</frontend_type>
167
  <sort_order>40</sort_order>
168
  <show_in_default>1</show_in_default>
173
  <active>1</active>
174
  </depends>
175
  </fee_label>
176
+ <order_status translate="label tooltip" module="postnl">
177
  <label>New order status</label>
178
+ <tooltip>Newly placed orders will have this status.</tooltip>
179
  <frontend_type>select</frontend_type>
180
  <source_model>adminhtml/system_config_source_order_status_processing</source_model>
181
  <sort_order>50</sort_order>
246
  <active>1</active>
247
  </depends>
248
  </max_order_total>
249
+ <allow_for_non_postnl translate="label tooltip" module="postnl">
250
  <label>Allow for non-PostNL orders</label>
251
+ <tooltip>Set this option to 'yes' to allow orders placed using a different shipping method than PostNL to use this payment method.</tooltip>
252
  <frontend_type>select</frontend_type>
253
  <source_model>postnl/system_config_source_yesno</source_model>
254
  <sort_order>110</sort_order>
353
  <rate_type>flat</rate_type>
354
  </depends>
355
  </price>
356
+ <rate_source translate="label tooltip" module="postnl">
357
  <label>Rate Source</label>
358
+ <tooltip>You can use the rates you have entered for Magento's Table Rates shipping method or you can choose to enter table rates specific for the PostNL shipping method.</tooltip>
359
  <frontend_type>select</frontend_type>
360
  <source_model>postnl_carrier/system_config_source_tablerateSource</source_model>
361
  <sort_order>70</sort_order>
391
  <rate_source>postnl_tablerate</rate_source>
392
  </depends>
393
  </import>
394
+ <matrix_export translate="label">
395
+ <label>Export Rates</label>
396
+ <frontend_model>postnl_adminhtml/system_config_form_field_matrixrateExport</frontend_model>
397
+ <sort_order>100</sort_order>
398
+ <show_in_default>1</show_in_default>
399
+ <show_in_website>1</show_in_website>
400
+ <show_in_store>0</show_in_store>
401
+ <depends>
402
+ <rate_type>matrix</rate_type>
403
+ </depends>
404
+ </matrix_export>
405
+ <matrix_import translate="label comment">
406
+ <label>Import Rates</label>
407
+ <comment><![CDATA[A prefilled csv file can be found <a href="http://kb.tig.nl/topic/102462196" target="_blank">here</a>.]]></comment>
408
+ <frontend_model>postnl_adminhtml/system_config_form_field_matrixrateImport</frontend_model>
409
+ <backend_model>postnl_carrier/system_config_backend_matrixrate</backend_model>
410
+ <sort_order>110</sort_order>
411
+ <show_in_default>1</show_in_default>
412
+ <show_in_website>1</show_in_website>
413
+ <show_in_store>0</show_in_store>
414
+ <depends>
415
+ <rate_type>matrix</rate_type>
416
+ </depends>
417
+ </matrix_import>
418
  <import_export_header translate="label" module="postnl">
419
  <label>You can import and export rates on the website scope. You can change your current scope with the dropdown at the top left of this page.</label>
420
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
421
+ <sort_order>120</sort_order>
422
  <show_in_default>1</show_in_default>
423
  <show_in_website>0</show_in_website>
424
  <show_in_store>1</show_in_store>
431
  <label>Condition</label>
432
  <frontend_type>select</frontend_type>
433
  <source_model>adminhtml/system_config_source_shipping_tablerate</source_model>
434
+ <sort_order>130</sort_order>
435
  <show_in_default>1</show_in_default>
436
  <show_in_website>1</show_in_website>
437
  <show_in_store>0</show_in_store>
443
  <label>Include Virtual Products in Price Calculation</label>
444
  <frontend_type>select</frontend_type>
445
  <source_model>postnl/system_config_source_yesno</source_model>
446
+ <sort_order>140</sort_order>
447
  <show_in_default>1</show_in_default>
448
  <show_in_website>1</show_in_website>
449
  <show_in_store>0</show_in_store>
455
  <label>Calculate Handling Fee</label>
456
  <frontend_type>select</frontend_type>
457
  <source_model>shipping/source_handlingType</source_model>
458
+ <sort_order>150</sort_order>
459
  <show_in_default>1</show_in_default>
460
  <show_in_website>1</show_in_website>
461
  <show_in_store>0</show_in_store>
464
  <label>Handling Fee</label>
465
  <frontend_type>text</frontend_type>
466
  <validate>validate-number validate-zero-or-greater</validate>
467
+ <sort_order>160</sort_order>
468
  <show_in_default>1</show_in_default>
469
  <show_in_website>1</show_in_website>
470
  <show_in_store>0</show_in_store>
472
  <specificerrmsg translate="label" module="postnl">
473
  <label>Displayed Error Message</label>
474
  <frontend_type>textarea</frontend_type>
475
+ <sort_order>170</sort_order>
476
  <show_in_default>1</show_in_default>
477
  <show_in_website>1</show_in_website>
478
  <show_in_store>1</show_in_store>
480
  <sallowspecific translate="label" module="postnl">
481
  <label>Ship to Applicable Countries</label>
482
  <frontend_type>select</frontend_type>
483
+ <sort_order>180</sort_order>
484
  <frontend_class>shipping-applicable-country</frontend_class>
485
  <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
486
  <show_in_default>1</show_in_default>
490
  <specificcountry translate="label" module="postnl">
491
  <label>Ship to Specific Countries</label>
492
  <frontend_type>multiselect</frontend_type>
493
+ <sort_order>190</sort_order>
494
  <source_model>adminhtml/system_config_source_country</source_model>
495
  <show_in_default>1</show_in_default>
496
  <show_in_website>1</show_in_website>
500
  <showmethod translate="label" module="postnl">
501
  <label>Show Method if Not Applicable</label>
502
  <frontend_type>select</frontend_type>
503
+ <sort_order>200</sort_order>
504
  <source_model>postnl/system_config_source_yesno</source_model>
505
  <show_in_default>1</show_in_default>
506
  <show_in_website>1</show_in_website>
509
  <sort_order translate="label" module="postnl">
510
  <label>Sort Order</label>
511
  <frontend_type>text</frontend_type>
512
+ <sort_order>210</sort_order>
513
  <show_in_default>1</show_in_default>
514
  <show_in_website>1</show_in_website>
515
  <show_in_store>0</show_in_store>
544
  </split_address_check>
545
  <support translate="label" module="postnl">
546
  <label>Version &amp; Support</label>
547
+ <frontend_model>postnl_adminhtml/system_config_form_fieldset</frontend_model>
548
+ <frontend_class>postnl-support</frontend_class>
549
  <sort_order>300</sort_order> <!-- This should always be the first tab -->
550
  <show_in_default>1</show_in_default>
551
  <show_in_website>1</show_in_website>
561
  </fields>
562
  </support>
563
  <general translate="label comment" module="postnl">
564
+ <label>Registration</label>
565
+ <comment>In this first step you will need to register the extension.</comment>
566
  <frontend_model>postnl_adminhtml/system_config_form_fieldset</frontend_model>
567
+ <frontend_class>postnl-wizard</frontend_class>
568
  <sort_order>400</sort_order>
569
  <show_in_default>1</show_in_default>
570
  <show_in_website>1</show_in_website>
571
+ <show_in_store>1</show_in_store>
572
  <fields>
 
 
 
 
 
 
 
 
 
 
 
573
  <activation_in_progress_header translate="label" module="postnl">
574
+ <label><![CDATA[Please fill in the fields below to finish the extension registration procedure. Click <a href="#" onclick="%s">here</a> to reset the registration procedure.]]></label>
575
  <frontend_model>postnl_adminhtml/system_config_form_field_activatedFieldHeader</frontend_model>
576
+ <sort_order>10</sort_order>
577
  <show_in_default>1</show_in_default>
578
  <show_in_website>0</show_in_website>
579
  <show_in_store>0</show_in_store>
582
  </depends>
583
  </activation_in_progress_header>
584
  <activated_header translate="label" module="postnl">
585
+ <label><![CDATA[The extension has been registered. Click <a href="#" onclick="%s">here</a> to be able to register the extension under a different name.]]></label>
586
  <frontend_model>postnl_adminhtml/system_config_form_field_activatedFieldHeader</frontend_model>
587
+ <sort_order>20</sort_order>
588
  <show_in_default>1</show_in_default>
589
  <show_in_website>0</show_in_website>
590
  <show_in_store>0</show_in_store>
592
  <is_activated>2</is_activated>
593
  </depends>
594
  </activated_header>
595
+ <email translate="label tooltip" module="postnl">
596
  <label>Email</label>
597
+ <tooltip>During registration 2 secure keys will be sent to this email address.</tooltip>
598
  <frontend_type>text</frontend_type>
599
+ <sort_order>30</sort_order>
600
  <show_in_default>1</show_in_default>
601
  <show_in_website>0</show_in_website>
602
  <show_in_store>0</show_in_store>
609
  <frontend_type>obscure</frontend_type>
610
  <frontend_model>postnl_adminhtml/system_config_form_field_obscure</frontend_model>
611
  <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
612
+ <sort_order>40</sort_order>
613
  <show_in_default>1</show_in_default>
614
  <show_in_website>0</show_in_website>
615
  <show_in_store>0</show_in_store>
623
  <frontend_type>obscure</frontend_type>
624
  <frontend_model>postnl_adminhtml/system_config_form_field_obscure</frontend_model>
625
  <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
626
+ <sort_order>50</sort_order>
627
  <show_in_default>1</show_in_default>
628
  <show_in_website>0</show_in_website>
629
  <show_in_store>0</show_in_store>
634
  </private_key>
635
  <activate_button>
636
  <frontend_model>postnl_adminhtml/system_config_form_field_activateButton</frontend_model>
637
+ <sort_order>60</sort_order>
638
  <show_in_default>1</show_in_default>
639
  <show_in_website>0</show_in_website>
640
  <show_in_store>0</show_in_store>
644
  </activate_button>
645
  <finish_activation_button>
646
  <frontend_model>postnl_adminhtml/system_config_form_field_activateButton</frontend_model>
647
+ <sort_order>70</sort_order>
648
  <show_in_default>1</show_in_default>
649
  <show_in_website>0</show_in_website>
650
  <show_in_store>0</show_in_store>
652
  <is_activated>1</is_activated>
653
  </depends>
654
  </finish_activation_button>
655
+ <only_default_header translate="label" module="postnl">
656
+ <label><![CDATA[Extension registration is only available on the 'global' scope.]]></label>
657
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
658
+ <sort_order>90</sort_order>
659
+ <show_in_default>0</show_in_default>
660
+ <show_in_website>1</show_in_website>
661
+ <show_in_store>1</show_in_store>
662
+ </only_default_header>
663
  </fields>
664
  </general>
665
+ <cif_address translate="label comment" module="postnl">
666
+ <label>Address Details</label>
667
+ <comment>Please fill in your address details. These details are required for the activation of the extension.</comment>
668
  <frontend_model>postnl_adminhtml/system_config_form_fieldset</frontend_model>
669
+ <frontend_class>postnl-wizard</frontend_class>
670
  <sort_order>500</sort_order>
671
  <show_in_default>1</show_in_default>
672
  <show_in_website>1</show_in_website>
673
+ <show_in_store>1</show_in_store>
674
  <fields>
675
+ <sender_address_header translate="label" module="postnl">
676
+ <label>Sender address</label>
677
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
 
 
 
 
 
 
 
 
 
 
 
678
  <sort_order>10</sort_order>
679
  <show_in_default>1</show_in_default>
680
  <show_in_website>1</show_in_website>
681
+ <show_in_store>1</show_in_store>
682
+ </sender_address_header>
683
+ <firstname translate="label" module="postnl">
684
+ <label>First Name</label>
 
 
 
685
  <frontend_type>text</frontend_type>
686
  <sort_order>20</sort_order>
687
  <show_in_default>1</show_in_default>
688
  <show_in_website>1</show_in_website>
689
+ <show_in_store>1</show_in_store>
690
+ </firstname>
691
+ <lastname translate="label" module="postnl">
692
+ <label>Last Name</label>
 
 
693
  <frontend_type>text</frontend_type>
694
  <sort_order>30</sort_order>
695
  <show_in_default>1</show_in_default>
696
  <show_in_website>1</show_in_website>
697
+ <show_in_store>1</show_in_store>
698
+ <validate>postnl-validate-empty-group postnl-validate-group-sender_address</validate>
699
+ </lastname>
700
+ <company translate="label" module="postnl">
701
+ <label>Company</label>
702
+ <frontend_type>text</frontend_type>
 
 
 
 
 
 
703
  <sort_order>40</sort_order>
704
  <show_in_default>1</show_in_default>
705
  <show_in_website>1</show_in_website>
706
+ <show_in_store>1</show_in_store>
707
+ <validate>postnl-validate-empty-group postnl-validate-group-sender_address</validate>
708
+ </company>
709
+ <department translate="label" module="postnl">
710
+ <label>Department</label>
 
 
 
 
711
  <frontend_type>text</frontend_type>
712
  <sort_order>50</sort_order>
713
  <show_in_default>1</show_in_default>
714
  <show_in_website>1</show_in_website>
715
+ <show_in_store>1</show_in_store>
716
+ </department>
717
+ <streetname translate="label" module="postnl">
718
+ <label>Street</label>
719
+ <frontend_type>text</frontend_type>
 
 
 
 
 
 
720
  <sort_order>60</sort_order>
721
  <show_in_default>1</show_in_default>
722
  <show_in_website>1</show_in_website>
723
+ <show_in_store>1</show_in_store>
724
+ <validate>validate-alphanum-with-spaces postnl-validate-empty</validate>
725
+ </streetname>
726
+ <housenumber translate="label" module="postnl">
727
+ <label>House Nr.</label>
 
 
 
 
 
 
728
  <frontend_type>text</frontend_type>
729
  <sort_order>70</sort_order>
730
  <show_in_default>1</show_in_default>
731
  <show_in_website>1</show_in_website>
732
+ <show_in_store>1</show_in_store>
733
+ <validate>validate-digits postnl-validate-empty</validate>
734
+ </housenumber>
735
+ <housenumber_extension translate="label" module="postnl">
736
+ <label>House Nr. Extension</label>
737
+ <frontend_type>text</frontend_type>
 
 
738
  <sort_order>80</sort_order>
739
  <show_in_default>1</show_in_default>
740
  <show_in_website>1</show_in_website>
741
+ <show_in_store>1</show_in_store>
742
+ </housenumber_extension>
743
+ <postcode translate="label" module="postnl">
744
+ <label>Postcode</label>
 
745
  <frontend_type>text</frontend_type>
746
  <sort_order>90</sort_order>
747
  <show_in_default>1</show_in_default>
748
  <show_in_website>1</show_in_website>
749
+ <show_in_store>1</show_in_store>
750
+ <validate>postnl-validate-empty</validate>
751
+ </postcode>
752
+ <city translate="label" module="postnl">
753
+ <label>City</label>
754
+ <frontend_type>text</frontend_type>
755
  <sort_order>100</sort_order>
756
  <show_in_default>1</show_in_default>
757
  <show_in_website>1</show_in_website>
758
+ <show_in_store>1</show_in_store>
759
+ <validate>postnl-validate-empty</validate>
760
+ </city>
761
+ <region translate="label" module="postnl">
762
+ <label>Region</label>
763
+ <frontend_type>text</frontend_type>
764
  <sort_order>110</sort_order>
765
  <show_in_default>1</show_in_default>
766
  <show_in_website>1</show_in_website>
767
+ <show_in_store>1</show_in_store>
768
+ </region>
769
+ <return_address_header translate="label" module="postnl">
770
+ <label>Return address</label>
771
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
 
 
772
  <sort_order>120</sort_order>
773
  <show_in_default>1</show_in_default>
774
  <show_in_website>1</show_in_website>
775
+ <show_in_store>1</show_in_store>
776
+ </return_address_header>
777
+ <use_sender_address translate="label" module="postnl">
778
+ <label>Use the sender address as the return adress</label>
779
+ <frontend_type>checkbox</frontend_type>
780
+ <backend_model>postnl/system_config_backend_checkbox</backend_model>
781
+ <source_model>postnl/system_config_source_yesno</source_model>
782
  <sort_order>130</sort_order>
783
  <show_in_default>1</show_in_default>
784
  <show_in_website>1</show_in_website>
785
+ <show_in_store>1</show_in_store>
786
+ </use_sender_address>
787
+ <return_firstname translate="label" module="postnl">
788
+ <label>First Name</label>
 
 
 
 
 
789
  <frontend_type>text</frontend_type>
790
  <sort_order>140</sort_order>
791
  <show_in_default>1</show_in_default>
792
  <show_in_website>1</show_in_website>
793
+ <show_in_store>1</show_in_store>
 
794
  <depends>
795
+ <use_sender_address>0</use_sender_address>
796
  </depends>
797
+ <validate>postnl-validate-empty</validate>
798
+ </return_firstname>
799
+ <return_lastname translate="label" module="postnl">
800
+ <label>Last Name</label>
801
+ <frontend_type>text</frontend_type>
802
+ <sort_order>150</sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
803
  <show_in_default>1</show_in_default>
804
+ <show_in_website>1</show_in_website>
805
+ <show_in_store>1</show_in_store>
806
+ <depends>
807
+ <use_sender_address>0</use_sender_address>
808
+ </depends>
809
+ <validate>postnl-validate-empty</validate>
810
+ </return_lastname>
811
+ <return_company translate="label" module="postnl">
812
+ <label>Company</label>
813
  <frontend_type>text</frontend_type>
814
+ <sort_order>160</sort_order>
815
  <show_in_default>1</show_in_default>
816
  <show_in_website>1</show_in_website>
817
  <show_in_store>1</show_in_store>
818
+ <depends>
819
+ <use_sender_address>0</use_sender_address>
820
+ </depends>
821
+ </return_company>
822
+ <return_department translate="label" module="postnl">
823
+ <label>Department</label>
824
+ <frontend_type>text</frontend_type>
825
+ <sort_order>170</sort_order>
826
  <show_in_default>1</show_in_default>
827
  <show_in_website>1</show_in_website>
828
  <show_in_store>1</show_in_store>
829
+ <depends>
830
+ <use_sender_address>0</use_sender_address>
831
+ </depends>
832
+ </return_department>
833
+ <return_streetname translate="label" module="postnl">
834
+ <label>Street</label>
835
+ <frontend_type>text</frontend_type>
836
+ <sort_order>180</sort_order>
837
  <show_in_default>1</show_in_default>
838
  <show_in_website>1</show_in_website>
839
  <show_in_store>1</show_in_store>
840
+ <validate>validate-alphanum-with-spaces</validate>
841
+ <depends>
842
+ <use_sender_address>0</use_sender_address>
843
+ </depends>
844
+ <validate>postnl-validate-empty</validate>
845
+ </return_streetname>
846
+ <return_housenumber translate="label" module="postnl">
847
+ <label>House Nr.</label>
848
  <frontend_type>text</frontend_type>
849
+ <sort_order>190</sort_order>
850
  <show_in_default>1</show_in_default>
851
  <show_in_website>1</show_in_website>
852
  <show_in_store>1</show_in_store>
853
+ <validate>validate-digits</validate>
854
  <depends>
855
+ <use_sender_address>0</use_sender_address>
856
  </depends>
857
+ <validate>postnl-validate-empty</validate>
858
+ </return_housenumber>
859
+ <return_housenumber_extension translate="label" module="postnl">
860
+ <label>House Nr. Extension</label>
861
+ <frontend_type>text</frontend_type>
862
+ <sort_order>200</sort_order>
863
  <show_in_default>1</show_in_default>
864
+ <show_in_website>1</show_in_website>
865
+ <show_in_store>1</show_in_store>
866
+ <depends>
867
+ <use_sender_address>0</use_sender_address>
868
+ </depends>
869
+ </return_housenumber_extension>
870
+ <return_postcode translate="label" module="postnl">
871
+ <label>Postcode</label>
872
+ <frontend_type>text</frontend_type>
873
+ <sort_order>210</sort_order>
874
  <show_in_default>1</show_in_default>
875
+ <show_in_website>1</show_in_website>
876
+ <show_in_store>1</show_in_store>
877
+ <depends>
878
+ <use_sender_address>0</use_sender_address>
879
+ </depends>
880
+ <validate>postnl-validate-empty</validate>
881
+ </return_postcode>
882
+ <return_city translate="label" module="postnl">
883
+ <label>City</label>
884
+ <frontend_type>text</frontend_type>
885
+ <sort_order>220</sort_order>
886
  <show_in_default>1</show_in_default>
887
+ <show_in_website>1</show_in_website>
888
+ <show_in_store>1</show_in_store>
889
  <depends>
890
+ <use_sender_address>0</use_sender_address>
891
  </depends>
892
+ <validate>postnl-validate-empty</validate>
893
+ </return_city>
894
+ <return_region translate="label" module="postnl">
895
+ <label>Region</label>
896
+ <frontend_type>text</frontend_type>
897
+ <sort_order>230</sort_order>
898
+ <show_in_default>1</show_in_default>
899
+ <show_in_website>1</show_in_website>
900
+ <show_in_store>1</show_in_store>
901
+ <depends>
902
+ <use_sender_address>0</use_sender_address>
903
+ </depends>
904
+ </return_region>
905
+ <save_and_continue translate="label" module="postnl">
906
+ <label>Save and continue</label>
907
+ <frontend_model>postnl_adminhtml/system_config_form_field_wizardSaveButton</frontend_model>
908
+ <sort_order>240</sort_order>
909
+ <show_in_default>1</show_in_default>
910
+ <show_in_website>1</show_in_website>
911
+ <show_in_store>1</show_in_store>
912
+ <next_step_rel>postnl_cif_labels_and_confirming</next_step_rel>
913
+ </save_and_continue>
914
+ </fields>
915
+ </cif_address>
916
+ <cif_labels_and_confirming translate="label comment" module="postnl">
917
+ <label>Store Settings</label>
918
+ <comment>The extension can be completely adjusted to fit seamlessly with the processes of your online store. Here you can configure the most crucial settings.</comment>
919
+ <frontend_model>postnl_adminhtml/system_config_form_fieldset</frontend_model>
920
+ <frontend_class>postnl-wizard</frontend_class>
921
+ <sort_order>600</sort_order>
922
+ <show_in_default>1</show_in_default>
923
+ <show_in_website>1</show_in_website>
924
+ <show_in_store>1</show_in_store>
925
+ <fields>
926
+ <printer_settings_header translate="label" module="postnl">
927
+ <label>Printer settings</label>
928
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
929
+ <sort_order>10</sort_order>
930
+ <show_in_default>1</show_in_default>
931
+ <show_in_website>1</show_in_website>
932
+ <show_in_store>1</show_in_store>
933
+ </printer_settings_header>
934
+ <label_size translate="label tooltip" module="postnl">
935
+ <label>Label size</label>
936
+ <tooltip>This setting only applies to multiple Dutch and EPS labels. GlobalPack labels are always printed as A4.</tooltip>
937
+ <frontend_type>postnl_radios</frontend_type>
938
+ <source_model>postnl_core/system_config_source_labelSize</source_model>
939
+ <sort_order>20</sort_order>
940
+ <show_in_default>1</show_in_default>
941
+ <show_in_website>0</show_in_website>
942
+ <show_in_store>0</show_in_store>
943
+ </label_size>
944
  <duration_header translate="label" module="postnl">
945
+ <label>Shipment days and timing</label>
946
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
947
+ <sort_order>30</sort_order>
948
  <show_in_default>1</show_in_default>
949
  <show_in_website>1</show_in_website>
950
  <show_in_store>1</show_in_store>
951
  </duration_header>
952
+ <shipping_duration translate="label tooltip" module="postnl">
953
  <label>Shipping duration</label>
954
+ <tooltip>The number of days shipping will take after a customer finishes their order.</tooltip>
955
  <source_model>postnl_core/system_config_source_shippingDuration</source_model>
956
  <frontend_type>select</frontend_type>
957
+ <sort_order>40</sort_order>
958
  <show_in_default>1</show_in_default>
959
  <show_in_website>1</show_in_website>
960
  <show_in_store>1</show_in_store>
961
  </shipping_duration>
962
+ <cutoff_time translate="label tooltip" module="postnl">
963
  <label>Order cut-off time</label>
964
+ <tooltip>When an order is placed after this time, another day will be added to the shipping duration.</tooltip>
965
  <frontend_model>postnl_adminhtml/system_config_form_field_hourMinute</frontend_model>
966
  <source_model>postnl_core/system_config_source_hourMinute</source_model>
967
  <backend_model>postnl_core/system_config_backend_hourMinute</backend_model>
968
+ <sort_order>50</sort_order>
969
  <show_in_default>1</show_in_default>
970
  <show_in_website>1</show_in_website>
971
  <show_in_store>1</show_in_store>
972
  </cutoff_time>
973
+ <shipping_days translate="label comment" module="postnl">
974
+ <label>Shipping days</label>
975
+ <comment><![CDATA[Select on which days of the week orders are shipped. You can read more about shipping and delivery days <a href="http://kb.tig.nl/topic/102775036" target="_blank">here</a>.]]></comment>
976
+ <source_model>postnl_core/system_config_source_shippingDays</source_model>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
977
  <frontend_type>multiselect</frontend_type>
978
+ <sort_order>60</sort_order>
 
 
 
 
 
 
 
 
 
 
 
979
  <show_in_default>1</show_in_default>
980
+ <show_in_website>1</show_in_website>
981
+ <show_in_store>1</show_in_store>
982
+ </shipping_days>
983
+ <checkout_settings_header translate="titel" module="postnl">
984
+ <label>Checkout settings</label>
985
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
986
+ <sort_order>70</sort_order>
987
  <show_in_default>1</show_in_default>
988
  <show_in_website>1</show_in_website>
989
  <show_in_store>1</show_in_store>
990
+ </checkout_settings_header>
991
+ <checkout_extension translate="label tooltip" module="postnl">
992
+ <label>Checkout extension</label>
993
+ <tooltip>Postcode validation and delivery options are only available for supported checkouts.</tooltip>
994
  <frontend_type>select</frontend_type>
995
+ <source_model>postnl_core/system_config_source_checkoutExtensions</source_model>
996
+ <sort_order>80</sort_order>
997
  <show_in_default>1</show_in_default>
998
  <show_in_website>1</show_in_website>
999
  <show_in_store>1</show_in_store>
1000
+ </checkout_extension>
1001
+ <checkout_extension_other translate="label" module="postnl">
1002
+ <label>Specify checkout extension</label>
1003
+ <frontend_type>text</frontend_type>
1004
+ <sort_order>90</sort_order>
 
 
 
1005
  <show_in_default>1</show_in_default>
1006
  <show_in_website>1</show_in_website>
1007
  <show_in_store>1</show_in_store>
1008
+ <depends>
1009
+ <checkout_extension>other</checkout_extension>
1010
+ </depends>
1011
+ </checkout_extension_other>
1012
+ <use_postcode_check translate="label tooltip" module="postnl">
1013
+ <label>Use postcode check</label>
1014
+ <tooltip>Automatically complete Dutch addresses after your customer fills in his postcode and house number.</tooltip>
1015
+ <frontend_type>checkbox</frontend_type>
1016
+ <backend_model>postnl/system_config_backend_checkbox</backend_model>
1017
  <source_model>postnl/system_config_source_yesno</source_model>
1018
+ <backend_model>postnl_addressvalidation/system_config_backend_validateAccount</backend_model>
1019
+ <sort_order>100</sort_order>
1020
  <show_in_default>1</show_in_default>
1021
  <show_in_website>1</show_in_website>
1022
  <show_in_store>1</show_in_store>
1023
+ <depends>
1024
+ <checkout_extension>
1025
+ <value>magento_onepagecheckout||idev_onestepcheckout</value>
1026
+ <separator>||</separator>
1027
+ </checkout_extension>
1028
+ </depends>
1029
+ </use_postcode_check>
1030
+ <postcode_check_in_checkout translate="label" module="postnl">
1031
+ <label>Use postcode check on checkout page</label>
1032
+ <frontend_type>checkbox</frontend_type>
1033
+ <backend_model>postnl/system_config_backend_checkbox</backend_model>
1034
+ <source_model>postnl/system_config_source_yesno</source_model>
1035
+ <sort_order>110</sort_order>
1036
  <show_in_default>1</show_in_default>
1037
  <show_in_website>1</show_in_website>
1038
  <show_in_store>1</show_in_store>
1039
  <depends>
1040
+ <use_postcode_check>1</use_postcode_check>
1041
+ <checkout_extension>
1042
+ <value>magento_onepagecheckout||idev_onestepcheckout</value>
1043
+ <separator>||</separator>
1044
+ </checkout_extension>
1045
  </depends>
1046
+ </postcode_check_in_checkout>
1047
+ <postcode_check_in_addressbook translate="label" module="postnl">
1048
+ <label>Use postcode check in customer's address book</label>
1049
+ <frontend_type>checkbox</frontend_type>
1050
+ <backend_model>postnl/system_config_backend_checkbox</backend_model>
1051
+ <source_model>postnl/system_config_source_yesno</source_model>
1052
+ <sort_order>120</sort_order>
1053
  <show_in_default>1</show_in_default>
1054
  <show_in_website>1</show_in_website>
1055
  <show_in_store>1</show_in_store>
1056
  <depends>
1057
+ <use_postcode_check>1</use_postcode_check>
1058
+ <checkout_extension>
1059
+ <value>magento_onepagecheckout||idev_onestepcheckout</value>
1060
+ <separator>||</separator>
1061
+ </checkout_extension>
1062
  </depends>
1063
+ </postcode_check_in_addressbook>
1064
+ <postcode_check_max_attempts translate="label tooltip" module="postnl">
1065
+ <label>Maximum number of attempts</label>
1066
+ <tooltip>After this number of attempts your customer will be prompted to fill in his address manually. Leave this field empty to allow an infinite number of attempts. Please note however that in rare cases a correct address might not be validated, leaving your customer unable to complete the order process. We therefore recommend always filling in a maximum number of attempts.</tooltip>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1067
  <frontend_type>text</frontend_type>
1068
+ <sort_order>130</sort_order>
1069
  <show_in_default>1</show_in_default>
1070
  <show_in_website>1</show_in_website>
1071
  <show_in_store>1</show_in_store>
1072
  <depends>
1073
+ <use_postcode_check>1</use_postcode_check>
1074
+ <checkout_extension>
1075
+ <value>magento_onepagecheckout||idev_onestepcheckout</value>
1076
+ <separator>||</separator>
1077
+ </checkout_extension>
1078
  </depends>
1079
+ <validate>validate-int validate-greater-than-zero</validate>
1080
+ </postcode_check_max_attempts>
1081
+ <postcode_check_timeout translate="label tooltip" module="postnl">
1082
+ <label>Connection timeout duration</label>
1083
+ <tooltip>After this number of seconds a customer will be prompted to fill in his address manually. Leave this field empty to disable the feature. Please note: if a customer needs to wait too long he might leave the order process.</tooltip>
1084
  <frontend_type>text</frontend_type>
1085
+ <sort_order>140</sort_order>
1086
  <show_in_default>1</show_in_default>
1087
  <show_in_website>1</show_in_website>
1088
  <show_in_store>1</show_in_store>
1089
  <depends>
1090
+ <use_postcode_check>1</use_postcode_check>
1091
+ <checkout_extension>
1092
+ <value>magento_onepagecheckout||idev_onestepcheckout</value>
1093
+ <separator>||</separator>
1094
+ </checkout_extension>
1095
  </depends>
1096
+ <validate>validate-int validate-greater-than-zero</validate>
1097
+ </postcode_check_timeout>
1098
+ <split_street translate="label comment tooltip" module="postnl">
1099
+ <label>Split street parts</label>
1100
+ <comment><![CDATA[You can read more on how to configure split address lines <a href="http://kb.tig.nl/topic/55961916" target="_blank">here</a>.]]></comment>
1101
+ <tooltip>If you do not use split street lines and you wish to ship to outside the EU, there is a strong possibility that PostNL will be unable to properly parse the address. This may result in the shipment being refused or it may even lead to the shipment being delivered at the wrong address!</tooltip>
1102
+ <frontend_type>checkbox</frontend_type>
1103
+ <backend_model>postnl/system_config_backend_checkbox</backend_model>
1104
  <source_model>postnl/system_config_source_yesno</source_model>
1105
+ <sort_order>150</sort_order>
1106
  <show_in_default>1</show_in_default>
1107
  <show_in_website>1</show_in_website>
1108
  <show_in_store>0</show_in_store>
1109
+ <depends>
1110
+ <use_postcode_check>0</use_postcode_check>
1111
+ </depends>
1112
+ </split_street>
1113
+ <streetname_field translate="label" module="postnl">
1114
+ <label>Streetname field</label>
1115
  <frontend_type>select</frontend_type>
1116
+ <source_model>postnl_core/system_config_source_streetField</source_model>
1117
+ <sort_order>160</sort_order>
1118
  <show_in_default>1</show_in_default>
1119
  <show_in_website>1</show_in_website>
1120
  <show_in_store>0</show_in_store>
1121
+ <depends>
1122
+ <split_street>1</split_street>
1123
+ <use_postcode_check>0</use_postcode_check>
1124
+ </depends>
1125
  <validate>validate-select</validate>
1126
+ </streetname_field>
1127
+ <housenr_field translate="label" module="postnl">
1128
+ <label>Housenr. field</label>
1129
  <frontend_type>select</frontend_type>
1130
+ <source_model>postnl_core/system_config_source_streetField</source_model>
1131
+ <sort_order>170</sort_order>
1132
  <show_in_default>1</show_in_default>
1133
  <show_in_website>1</show_in_website>
1134
  <show_in_store>0</show_in_store>
1135
+ <depends>
1136
+ <split_street>1</split_street>
1137
+ <use_postcode_check>0</use_postcode_check>
1138
+ </depends>
1139
  <validate>validate-select</validate>
1140
+ </housenr_field>
1141
+ <split_housenr translate="label" module="postnl">
1142
+ <label>Split house number parts</label>
1143
+ <frontend_type>checkbox</frontend_type>
1144
+ <backend_model>postnl/system_config_backend_checkbox</backend_model>
1145
  <source_model>postnl/system_config_source_yesno</source_model>
1146
+ <sort_order>180</sort_order>
1147
  <show_in_default>1</show_in_default>
1148
  <show_in_website>1</show_in_website>
1149
  <show_in_store>0</show_in_store>
1150
+ <depends>
1151
+ <split_street>1</split_street>
1152
+ <use_postcode_check>0</use_postcode_check>
1153
+ </depends>
1154
+ </split_housenr>
1155
+ <housenr_extension_field translate="label" module="postnl">
1156
+ <label>Housenr. extension field</label>
1157
  <frontend_type>select</frontend_type>
1158
+ <source_model>postnl_core/system_config_source_streetField</source_model>
1159
+ <sort_order>190</sort_order>
1160
  <show_in_default>1</show_in_default>
1161
  <show_in_website>1</show_in_website>
1162
  <show_in_store>0</show_in_store>
1163
+ <depends>
1164
+ <split_street>1</split_street>
1165
+ <split_housenr>1</split_housenr>
1166
+ <use_postcode_check>0</use_postcode_check>
1167
+ </depends>
1168
  <validate>validate-select</validate>
1169
+ </housenr_extension_field>
1170
+ <optional_street_fields_header translate="label" module="postnl">
1171
+ <label>Optional address fields</label>
1172
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
1173
+ <sort_order>200</sort_order>
 
1174
  <show_in_default>1</show_in_default>
1175
  <show_in_website>1</show_in_website>
1176
  <show_in_store>0</show_in_store>
1177
+ </optional_street_fields_header>
1178
+ <area_field translate="label" module="postnl">
1179
+ <label>Area field</label>
 
1180
  <frontend_type>select</frontend_type>
1181
+ <source_model>postnl_core/system_config_source_streetFieldWithDefault</source_model>
1182
+ <sort_order>210</sort_order>
1183
  <show_in_default>1</show_in_default>
1184
  <show_in_website>1</show_in_website>
1185
  <show_in_store>0</show_in_store>
1186
+ </area_field>
1187
+ <building_name_field translate="label" module="postnl">
1188
+ <label>Building name field</label>
 
1189
  <frontend_type>select</frontend_type>
1190
+ <source_model>postnl_core/system_config_source_streetFieldWithDefault</source_model>
1191
+ <sort_order>220</sort_order>
1192
  <show_in_default>1</show_in_default>
1193
  <show_in_website>1</show_in_website>
1194
  <show_in_store>0</show_in_store>
1195
+ </building_name_field>
1196
+ <department_field translate="label" module="postnl">
1197
+ <label>Department field</label>
1198
+ <frontend_type>select</frontend_type>
1199
+ <source_model>postnl_core/system_config_source_streetFieldWithDefault</source_model>
1200
+ <sort_order>230</sort_order>
 
 
1201
  <show_in_default>1</show_in_default>
1202
  <show_in_website>1</show_in_website>
1203
  <show_in_store>0</show_in_store>
1204
+ </department_field>
1205
+ <doorcode_field translate="label tooltip" module="postnl">
1206
+ <label>Doorcode field</label>
1207
+ <tooltip>Doorcodes are often used in foreign addresses such as those used in France and Singapore.</tooltip>
1208
  <frontend_type>select</frontend_type>
1209
+ <source_model>postnl_core/system_config_source_streetFieldWithDefault</source_model>
1210
+ <sort_order>240</sort_order>
1211
  <show_in_default>1</show_in_default>
1212
  <show_in_website>1</show_in_website>
1213
  <show_in_store>0</show_in_store>
1214
+ </doorcode_field>
1215
+ <floor_field translate="label" module="postnl">
1216
+ <label>Floor field</label>
 
1217
  <frontend_type>select</frontend_type>
1218
+ <source_model>postnl_core/system_config_source_streetFieldWithDefault</source_model>
1219
+ <sort_order>250</sort_order>
1220
  <show_in_default>1</show_in_default>
1221
  <show_in_website>1</show_in_website>
1222
  <show_in_store>0</show_in_store>
1223
+ </floor_field>
1224
+ <remark_field translate="label" module="postnl">
1225
+ <label>Remark field</label>
 
 
1226
  <frontend_type>select</frontend_type>
1227
+ <source_model>postnl_core/system_config_source_streetFieldWithDefault</source_model>
1228
+ <sort_order>260</sort_order>
1229
  <show_in_default>1</show_in_default>
1230
  <show_in_website>1</show_in_website>
1231
  <show_in_store>0</show_in_store>
1232
+ </remark_field>
1233
+ <save_and_continue translate="label" module="postnl">
1234
+ <label>Save and continue</label>
1235
+ <frontend_model>postnl_adminhtml/system_config_form_field_wizardSaveButton</frontend_model>
1236
+ <sort_order>270</sort_order>
 
 
 
 
1237
  <show_in_default>1</show_in_default>
1238
  <show_in_website>1</show_in_website>
1239
  <show_in_store>1</show_in_store>
1240
+ <next_step_rel>postnl_delivery_options</next_step_rel>
1241
+ </save_and_continue>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1242
  </fields>
1243
+ </cif_labels_and_confirming>
1244
+ <delivery_options translate="label comment" module="postnl">
1245
+ <label>Delivery Options</label>
1246
+ <comment>Your customers choose when, where and how they would like to receive their orders with PostNL's delivery options. Let your customers pick a day and the extension will show the estimated time of delivery. On Tuesdays and Wednesdays PostNL also delivers in the evening. Maybe your customers prefer to pick up their orders from one of the 2000 Post offices? No problem, a growing number of locations even have the orders ready for pickup early in the morning.</comment>
1247
  <frontend_model>postnl_adminhtml/system_config_form_fieldset</frontend_model>
1248
+ <frontend_class>postnl-wizard</frontend_class>
1249
+ <sort_order>700</sort_order>
1250
  <show_in_default>1</show_in_default>
1251
  <show_in_website>1</show_in_website>
1252
  <show_in_store>1</show_in_store>
1253
  <fields>
1254
+ <delivery_options_header translate="label" module="postnl">
1255
+ <label>Delivery options</label>
1256
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
 
1257
  <sort_order>10</sort_order>
1258
  <show_in_default>1</show_in_default>
1259
+ <show_in_website>1</show_in_website>
1260
+ <show_in_store>1</show_in_store>
1261
+ <depends>
1262
+