From 7f00efb081c6366bd5ab3445edbf18e500fa8fca Mon Sep 17 00:00:00 2001 From: TheCoreDev Date: Thu, 3 Dec 2020 17:12:39 +0100 Subject: [PATCH] Init du module DHL (sur la base du module Colissimo) --- local/modules/DHL/Config/areas.json | 425 ++++++ local/modules/DHL/Config/config.xml | 40 + .../modules/{FedEx => DHL}/Config/module.xml | 8 +- local/modules/DHL/Config/prices.json | 425 ++++++ local/modules/DHL/Config/routing.xml | 21 + local/modules/DHL/Config/thelia.sql | 32 + .../Controller/Configuration.php | 21 +- .../{FedEx => DHL}/Controller/EditPrices.php | 16 +- local/modules/DHL/DHL.php | 204 +++ .../DHL/EventListener/AreaDeletedListener.php | 43 + local/modules/DHL/Form/Configuration.php | 31 + .../{FedEx => DHL}/Hook/HookManager.php | 6 +- .../DHL/I18n/backOffice/default/de_DE.php | 25 + .../DHL/I18n/backOffice/default/en_US.php | 36 + .../DHL/I18n/backOffice/default/fr_FR.php | 37 + .../DHL/I18n/backOffice/default/it_IT.php | 13 + .../DHL/I18n/backOffice/default/tr_TR.php | 34 + local/modules/DHL/I18n/de_DE.php | 14 + local/modules/DHL/I18n/en_US.php | 14 + local/modules/DHL/I18n/fr_FR.php | 14 + local/modules/DHL/I18n/tr_TR.php | 14 + local/modules/DHL/LICENSE.txt | 165 ++ local/modules/DHL/Listener/SendMail.php | 123 ++ .../{FedEx => DHL}/Loop/CheckRightsLoop.php | 31 +- .../{FedEx => DHL}/Loop/NotSendLoop.php | 18 +- local/modules/{FedEx => DHL}/Loop/Price.php | 18 +- .../DHL/Model/Config/Base/DHLConfigValue.php | 14 + .../Model/Config/Base/DHLDeliveryPrice.php | 1336 +++++++++++++++++ .../Config/Base/DHLDeliveryPriceQuery.php | 563 +++++++ .../DHL/Model/Config/DHLConfigValue.php | 9 + .../Config/Map/DHLDeliveryPriceTableMap.php | 426 ++++++ local/modules/DHL/Model/DHLDeliveryPrice.php | 10 + .../DHL/Model/DHLDeliveryPriceQuery.php | 11 + .../FedExQuery.php => DHL/Model/DHLQuery.php} | 12 +- .../default/module_configuration.html | 83 +- local/modules/FedEx/Config/config.xml | 30 - local/modules/FedEx/Config/routing.xml | 14 - local/modules/FedEx/Config/thelia.sql | 44 - local/modules/FedEx/FedEx.php | 143 -- local/modules/FedEx/Form/Configuration.php | 33 - .../FedEx/I18n/backOffice/default/en_US.php | 23 - .../FedEx/I18n/backOffice/default/fr_FR.php | 25 - local/modules/FedEx/I18n/en_US.php | 12 - local/modules/FedEx/I18n/fr_FR.php | 12 - local/modules/FedEx/Listener/SendMail.php | 90 -- .../Model/Config/Base/FedExConfigValue.php | 9 - .../FedEx/Model/Config/FedExConfigValue.php | 9 - web/index_dev.php | 3 +- 48 files changed, 4198 insertions(+), 541 deletions(-) create mode 100644 local/modules/DHL/Config/areas.json create mode 100644 local/modules/DHL/Config/config.xml rename local/modules/{FedEx => DHL}/Config/module.xml (69%) mode change 100755 => 100644 create mode 100644 local/modules/DHL/Config/prices.json create mode 100644 local/modules/DHL/Config/routing.xml create mode 100644 local/modules/DHL/Config/thelia.sql rename local/modules/{FedEx => DHL}/Controller/Configuration.php (79%) mode change 100755 => 100644 rename local/modules/{FedEx => DHL}/Controller/EditPrices.php (83%) mode change 100755 => 100644 create mode 100644 local/modules/DHL/DHL.php create mode 100644 local/modules/DHL/EventListener/AreaDeletedListener.php create mode 100644 local/modules/DHL/Form/Configuration.php rename local/modules/{FedEx => DHL}/Hook/HookManager.php (79%) create mode 100644 local/modules/DHL/I18n/backOffice/default/de_DE.php create mode 100644 local/modules/DHL/I18n/backOffice/default/en_US.php create mode 100644 local/modules/DHL/I18n/backOffice/default/fr_FR.php create mode 100644 local/modules/DHL/I18n/backOffice/default/it_IT.php create mode 100644 local/modules/DHL/I18n/backOffice/default/tr_TR.php create mode 100644 local/modules/DHL/I18n/de_DE.php create mode 100644 local/modules/DHL/I18n/en_US.php create mode 100644 local/modules/DHL/I18n/fr_FR.php create mode 100644 local/modules/DHL/I18n/tr_TR.php create mode 100644 local/modules/DHL/LICENSE.txt create mode 100644 local/modules/DHL/Listener/SendMail.php rename local/modules/{FedEx => DHL}/Loop/CheckRightsLoop.php (65%) mode change 100755 => 100644 rename local/modules/{FedEx => DHL}/Loop/NotSendLoop.php (63%) rename local/modules/{FedEx => DHL}/Loop/Price.php (60%) mode change 100755 => 100644 create mode 100644 local/modules/DHL/Model/Config/Base/DHLConfigValue.php create mode 100644 local/modules/DHL/Model/Config/Base/DHLDeliveryPrice.php create mode 100644 local/modules/DHL/Model/Config/Base/DHLDeliveryPriceQuery.php create mode 100644 local/modules/DHL/Model/Config/DHLConfigValue.php create mode 100644 local/modules/DHL/Model/Config/Map/DHLDeliveryPriceTableMap.php create mode 100644 local/modules/DHL/Model/DHLDeliveryPrice.php create mode 100644 local/modules/DHL/Model/DHLDeliveryPriceQuery.php rename local/modules/{FedEx/Model/FedExQuery.php => DHL/Model/DHLQuery.php} (83%) rename local/modules/{FedEx => DHL}/templates/backOffice/default/module_configuration.html (60%) mode change 100755 => 100644 delete mode 100755 local/modules/FedEx/Config/config.xml delete mode 100755 local/modules/FedEx/Config/routing.xml delete mode 100644 local/modules/FedEx/Config/thelia.sql delete mode 100755 local/modules/FedEx/FedEx.php delete mode 100644 local/modules/FedEx/Form/Configuration.php delete mode 100644 local/modules/FedEx/I18n/backOffice/default/en_US.php delete mode 100644 local/modules/FedEx/I18n/backOffice/default/fr_FR.php delete mode 100644 local/modules/FedEx/I18n/en_US.php delete mode 100644 local/modules/FedEx/I18n/fr_FR.php delete mode 100755 local/modules/FedEx/Listener/SendMail.php delete mode 100644 local/modules/FedEx/Model/Config/Base/FedExConfigValue.php delete mode 100644 local/modules/FedEx/Model/Config/FedExConfigValue.php diff --git a/local/modules/DHL/Config/areas.json b/local/modules/DHL/Config/areas.json new file mode 100644 index 00000000..4c844626 --- /dev/null +++ b/local/modules/DHL/Config/areas.json @@ -0,0 +1,425 @@ +{ + "shippingZones": [ + { + "name": "DHL - Delivery Zone 1", + "delivery_time_in_days": 3, + "delivery_type": 2, + "countries": [ + "BEL", + "LUX", + "DEU", + "ITA", + "NLD", + "ESP", + "GBR", + "VAT" + ], + "prices": [ + { + "up_to": 2, + "price_euro": 23.09 + }, + { + "up_to": 5, + "price_euro": 26.11 + }, + { + "up_to": 7, + "price_euro": 30.19 + }, + { + "up_to": 10, + "price_euro": 36.31 + }, + { + "up_to": 15, + "price_euro": 47.01 + }, + { + "up_to": 30, + "price_euro": 79.31 + } + ] + }, + { + "name": "DHL - Delivery Zone 2", + "delivery_time_in_days": 5, + "delivery_type": 2, + "countries": [ + "AUT", + "CZE", + "DNK", + "IRL", + "POL", + "PRT" + ], + "prices": [ + { + "up_to": 2, + "price_euro": 23.65 + }, + { + "up_to": 5, + "price_euro": 27.28 + }, + { + "up_to": 7, + "price_euro": 31.36 + }, + { + "up_to": 10, + "price_euro": 37.48 + }, + { + "up_to": 15, + "price_euro": 48.18 + }, + { + "up_to": 30, + "price_euro": 80.48 + } + ] + }, + { + "name": "DHL - Delivery Zone 3", + "delivery_time_in_days": 3, + "delivery_type": 2, + "countries": [ + "BGR", + "HRV", + "CYP", + "EST", + "FIN", + "GRC", + "HUN", + "LVA", + "LTU", + "MLT", + "ROU", + "SVK", + "SVN", + "SWE" + ], + "prices": [ + { + "up_to": 2, + "price_euro": 24.01 + }, + { + "up_to": 5, + "price_euro": 27.64 + }, + { + "up_to": 7, + "price_euro": 31.72 + }, + { + "up_to": 10, + "price_euro": 37.84 + }, + { + "up_to": 15, + "price_euro": 48.54 + }, + { + "up_to": 30, + "price_euro": 80.84 + } + ] + }, + { + "name": "DHL - Delivery Zone 4", + "delivery_time_in_days": 5, + "delivery_type": 2, + "countries": [ + "ALB", + "BIH", + "ISR", + "LIE", + "MDA", + "MKD", + "NOR", + "SMR", + "CHE", + "TUR" + ], + "prices": [ + { + "up_to": 2, + "price_euro": 29.32 + }, + { + "up_to": 5, + "price_euro": 35.38 + }, + { + "up_to": 7, + "price_euro": 43.54 + }, + { + "up_to": 10, + "price_euro": 55.78 + }, + { + "up_to": 15, + "price_euro": 76.18 + }, + { + "up_to": 30, + "price_euro": 142.38 + } + ] + }, + { + "name": "DHL - Delivery Zone 5", + "delivery_time_in_days": 6, + "delivery_type": 2, + "countries": [ + "CAN", + "MEX", + "USA" + ], + "prices": [ + { + "up_to": 2, + "price_euro": 29.32 + }, + { + "up_to": 5, + "price_euro": 35.38 + }, + { + "up_to": 7, + "price_euro": 43.54 + }, + { + "up_to": 10, + "price_euro": 55.78 + }, + { + "up_to": 15, + "price_euro": 76.18 + }, + { + "up_to": 30, + "price_euro": 142.38 + } + ] + }, + { + "name": "DHL - Delivery Zone 6", + "delivery_time_in_days": 6, + "delivery_type": 2, + "countries": [ + "DZA", + "BGD", + "KHM", + "CHN", + "EGY", + "GUF", + "GLP", + "HKG", + "IND", + "IDN", + "JPN", + "KOR", + "MYS", + "MYT", + "MTQ", + "MAR", + "PHL", + "REU", + "SGP", + "ZAF", + "LKA", + "THA", + "TUN", + "ARE", + "VNM" + ], + "prices": [ + { + "up_to": 2, + "price_euro": 30.59 + }, + { + "up_to": 5, + "price_euro": 37.85 + }, + { + "up_to": 7, + "price_euro": 48.01 + }, + { + "up_to": 10, + "price_euro": 63.25 + }, + { + "up_to": 15, + "price_euro": 88.65 + }, + { + "up_to": 30, + "price_euro": 165.25 + } + ] + }, + { + "name": "DHL - Delivery Zone 7", + "delivery_time_in_days": 6, + "delivery_type": 2, + "countries": [ + "AFG", + "AGO", + "ATG", + "ARG", + "ARM", + "AUS", + "AZE", + "BHS", + "BHR", + "BRB", + "BLR", + "BLZ", + "BEN", + "BTN", + "BOL", + "BWA", + "BRA", + "BRN", + "BFA", + "BDI", + "CMR", + "CPV", + "CAF", + "TCD", + "CHL", + "COL", + "COM", + "COG", + "COK", + "CRI", + "CIV", + "CUB", + "DJI", + "DMA", + "DOM", + "ECU", + "SLV", + "ERI", + "ETH", + "FJI", + "GAB", + "GMB", + "GEO", + "GHA", + "GND", + "GTM", + "GIN", + "GNB", + "HTI", + "HND", + "ISL", + "IRN", + "IRQ", + "JAM", + "JOR", + "KAZ", + "KEN", + "KIR", + "KWT", + "KGZ", + "LAO", + "LBN", + "LSO", + "LBR", + "LBY", + "MDG", + "MWI", + "MDV", + "MLI", + "MHL", + "MRT", + "MUS", + "FSM", + "MNG", + "MOZ", + "NAM", + "NRU", + "NPL", + "KNA", + "NCL", + "OMN", + "NZL", + "PAK", + "PAN", + "PNG", + "PRY", + "PER", + "QAT", + "RUS", + "RWA", + "LCA", + "VCT", + "STP", + "SAU", + "SEN", + "SYC", + "SLE", + "SLB", + "SOM", + "SDN", + "PRK", + "SUR", + "SPM", + "SWZ", + "SYR", + "TJK", + "TZA", + "TGO", + "TON", + "TTO", + "TKM", + "TUV", + "UGA", + "UKR", + "URY", + "UZB", + "VUT", + "VEN", + "WLF", + "WSM", + "YEM", + "COD", + "ZMB", + "ZWE" + ], + "prices": [ + { + "up_to": 2, + "price_euro": 39.02 + }, + { + "up_to": 5, + "price_euro": 48.70 + }, + { + "up_to": 7, + "price_euro": 52.78 + }, + { + "up_to": 10, + "price_euro": 58.90 + }, + { + "up_to": 15, + "price_euro": 125.90 + }, + { + "up_to": 30, + "price_euro": 326.90 + } + ] + } + ] +} diff --git a/local/modules/DHL/Config/config.xml b/local/modules/DHL/Config/config.xml new file mode 100644 index 00000000..aba082b7 --- /dev/null +++ b/local/modules/DHL/Config/config.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/local/modules/FedEx/Config/module.xml b/local/modules/DHL/Config/module.xml old mode 100755 new mode 100644 similarity index 69% rename from local/modules/FedEx/Config/module.xml rename to local/modules/DHL/Config/module.xml index 43bff63c..2cc8a9e7 --- a/local/modules/FedEx/Config/module.xml +++ b/local/modules/DHL/Config/module.xml @@ -1,13 +1,13 @@ - FedEx\FedEx + DHL\DHL - FedEx delivery + DHL delivery - Livraison par FedEx + Livraison par DHL - 1.0.0 + 2.3.3 Laurent LE CORRE laurent@thecoredev.fr diff --git a/local/modules/DHL/Config/prices.json b/local/modules/DHL/Config/prices.json new file mode 100644 index 00000000..4c844626 --- /dev/null +++ b/local/modules/DHL/Config/prices.json @@ -0,0 +1,425 @@ +{ + "shippingZones": [ + { + "name": "DHL - Delivery Zone 1", + "delivery_time_in_days": 3, + "delivery_type": 2, + "countries": [ + "BEL", + "LUX", + "DEU", + "ITA", + "NLD", + "ESP", + "GBR", + "VAT" + ], + "prices": [ + { + "up_to": 2, + "price_euro": 23.09 + }, + { + "up_to": 5, + "price_euro": 26.11 + }, + { + "up_to": 7, + "price_euro": 30.19 + }, + { + "up_to": 10, + "price_euro": 36.31 + }, + { + "up_to": 15, + "price_euro": 47.01 + }, + { + "up_to": 30, + "price_euro": 79.31 + } + ] + }, + { + "name": "DHL - Delivery Zone 2", + "delivery_time_in_days": 5, + "delivery_type": 2, + "countries": [ + "AUT", + "CZE", + "DNK", + "IRL", + "POL", + "PRT" + ], + "prices": [ + { + "up_to": 2, + "price_euro": 23.65 + }, + { + "up_to": 5, + "price_euro": 27.28 + }, + { + "up_to": 7, + "price_euro": 31.36 + }, + { + "up_to": 10, + "price_euro": 37.48 + }, + { + "up_to": 15, + "price_euro": 48.18 + }, + { + "up_to": 30, + "price_euro": 80.48 + } + ] + }, + { + "name": "DHL - Delivery Zone 3", + "delivery_time_in_days": 3, + "delivery_type": 2, + "countries": [ + "BGR", + "HRV", + "CYP", + "EST", + "FIN", + "GRC", + "HUN", + "LVA", + "LTU", + "MLT", + "ROU", + "SVK", + "SVN", + "SWE" + ], + "prices": [ + { + "up_to": 2, + "price_euro": 24.01 + }, + { + "up_to": 5, + "price_euro": 27.64 + }, + { + "up_to": 7, + "price_euro": 31.72 + }, + { + "up_to": 10, + "price_euro": 37.84 + }, + { + "up_to": 15, + "price_euro": 48.54 + }, + { + "up_to": 30, + "price_euro": 80.84 + } + ] + }, + { + "name": "DHL - Delivery Zone 4", + "delivery_time_in_days": 5, + "delivery_type": 2, + "countries": [ + "ALB", + "BIH", + "ISR", + "LIE", + "MDA", + "MKD", + "NOR", + "SMR", + "CHE", + "TUR" + ], + "prices": [ + { + "up_to": 2, + "price_euro": 29.32 + }, + { + "up_to": 5, + "price_euro": 35.38 + }, + { + "up_to": 7, + "price_euro": 43.54 + }, + { + "up_to": 10, + "price_euro": 55.78 + }, + { + "up_to": 15, + "price_euro": 76.18 + }, + { + "up_to": 30, + "price_euro": 142.38 + } + ] + }, + { + "name": "DHL - Delivery Zone 5", + "delivery_time_in_days": 6, + "delivery_type": 2, + "countries": [ + "CAN", + "MEX", + "USA" + ], + "prices": [ + { + "up_to": 2, + "price_euro": 29.32 + }, + { + "up_to": 5, + "price_euro": 35.38 + }, + { + "up_to": 7, + "price_euro": 43.54 + }, + { + "up_to": 10, + "price_euro": 55.78 + }, + { + "up_to": 15, + "price_euro": 76.18 + }, + { + "up_to": 30, + "price_euro": 142.38 + } + ] + }, + { + "name": "DHL - Delivery Zone 6", + "delivery_time_in_days": 6, + "delivery_type": 2, + "countries": [ + "DZA", + "BGD", + "KHM", + "CHN", + "EGY", + "GUF", + "GLP", + "HKG", + "IND", + "IDN", + "JPN", + "KOR", + "MYS", + "MYT", + "MTQ", + "MAR", + "PHL", + "REU", + "SGP", + "ZAF", + "LKA", + "THA", + "TUN", + "ARE", + "VNM" + ], + "prices": [ + { + "up_to": 2, + "price_euro": 30.59 + }, + { + "up_to": 5, + "price_euro": 37.85 + }, + { + "up_to": 7, + "price_euro": 48.01 + }, + { + "up_to": 10, + "price_euro": 63.25 + }, + { + "up_to": 15, + "price_euro": 88.65 + }, + { + "up_to": 30, + "price_euro": 165.25 + } + ] + }, + { + "name": "DHL - Delivery Zone 7", + "delivery_time_in_days": 6, + "delivery_type": 2, + "countries": [ + "AFG", + "AGO", + "ATG", + "ARG", + "ARM", + "AUS", + "AZE", + "BHS", + "BHR", + "BRB", + "BLR", + "BLZ", + "BEN", + "BTN", + "BOL", + "BWA", + "BRA", + "BRN", + "BFA", + "BDI", + "CMR", + "CPV", + "CAF", + "TCD", + "CHL", + "COL", + "COM", + "COG", + "COK", + "CRI", + "CIV", + "CUB", + "DJI", + "DMA", + "DOM", + "ECU", + "SLV", + "ERI", + "ETH", + "FJI", + "GAB", + "GMB", + "GEO", + "GHA", + "GND", + "GTM", + "GIN", + "GNB", + "HTI", + "HND", + "ISL", + "IRN", + "IRQ", + "JAM", + "JOR", + "KAZ", + "KEN", + "KIR", + "KWT", + "KGZ", + "LAO", + "LBN", + "LSO", + "LBR", + "LBY", + "MDG", + "MWI", + "MDV", + "MLI", + "MHL", + "MRT", + "MUS", + "FSM", + "MNG", + "MOZ", + "NAM", + "NRU", + "NPL", + "KNA", + "NCL", + "OMN", + "NZL", + "PAK", + "PAN", + "PNG", + "PRY", + "PER", + "QAT", + "RUS", + "RWA", + "LCA", + "VCT", + "STP", + "SAU", + "SEN", + "SYC", + "SLE", + "SLB", + "SOM", + "SDN", + "PRK", + "SUR", + "SPM", + "SWZ", + "SYR", + "TJK", + "TZA", + "TGO", + "TON", + "TTO", + "TKM", + "TUV", + "UGA", + "UKR", + "URY", + "UZB", + "VUT", + "VEN", + "WLF", + "WSM", + "YEM", + "COD", + "ZMB", + "ZWE" + ], + "prices": [ + { + "up_to": 2, + "price_euro": 39.02 + }, + { + "up_to": 5, + "price_euro": 48.70 + }, + { + "up_to": 7, + "price_euro": 52.78 + }, + { + "up_to": 10, + "price_euro": 58.90 + }, + { + "up_to": 15, + "price_euro": 125.90 + }, + { + "up_to": 30, + "price_euro": 326.90 + } + ] + } + ] +} diff --git a/local/modules/DHL/Config/routing.xml b/local/modules/DHL/Config/routing.xml new file mode 100644 index 00000000..3439bf63 --- /dev/null +++ b/local/modules/DHL/Config/routing.xml @@ -0,0 +1,21 @@ + + + + + DHL\Controller\EditPrices::editprices + + + + + + + + + + + + DHL\Controller\Configuration::editConfiguration + + diff --git a/local/modules/DHL/Config/thelia.sql b/local/modules/DHL/Config/thelia.sql new file mode 100644 index 00000000..0eb13120 --- /dev/null +++ b/local/modules/DHL/Config/thelia.sql @@ -0,0 +1,32 @@ +# This is a fix for InnoDB in MySQL >= 4.1.x +# It "suspends judgement" for fkey relationships until are tables are set. +SET FOREIGN_KEY_CHECKS = 0; + +-- --------------------------------------------------------------------- +-- Mail templates for dhl +-- --------------------------------------------------------------------- + +-- First, delete existing entries +SET @var := 0; +SELECT @var := `id` FROM `message` WHERE name="mail_dhl"; +DELETE FROM `message` WHERE `id`=@var; +-- Try if ON DELETE constraint isn't set +DELETE FROM `message_i18n` WHERE `id`=@var; + +-- Then add new entries +SELECT @max := MAX(`id`) FROM `message`; +SET @max := @max+1; +-- insert message +INSERT INTO `message` (`id`, `name`, `secured`) VALUES +(@max, +'mail_dhl', +'0' +); + +-- and template fr_FR +INSERT INTO `message_i18n` (`id`, `locale`, `title`, `subject`, `text_message`, `html_message`) VALUES +(@max, 'en_US', 'DHL shipping message', 'Your order {$order_ref} has been shipped', '{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}\r\nDear {$FIRSTNAME} {$LASTNAME},\r\n{/loop}\r\nThank you for your order on our online store {config key="store_name"}.\r\nYour order {$order_ref} dated {format_date date=$order_date} has been shipped on {format_date date=$update_date}.\r\nThe tracking number for this delivery is {$package}. Please check the La Poste website for tracking your parcel: www.coliposte.net.\r\nYou can use this tracking number to get your parcel in your local La Poste office. If don''t get an advice in your mailbox after two working days, claim your parcel at your local La Poste office, using this tracking number.\r\nFeel free to contact us for any forther information\r\nBest Regards.', '{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}\r\n

Dear {$FIRSTNAME} {$LASTNAME},

\r\n{/loop}\r\n

Thank you for your order on our online store {config key="store_name"}.

\r\n

Your order {$order_ref} dated {format_date date=$order_date} has been shipped on {format_date date=$update_date}.\r\nThe tracking number for this delivery is {$package}. Please check the La Poste website for tracking your parcel: www.coliposte.net.

\r\n

You can use this tracking number to get your parcel in your local La Poste office. If don''t get an advice in your mailbox after two working days, claim your parcel at your local La Poste office, using this tracking number.

\r\n

Feel free to contact us for any forther information

\r\n

Best Regards.

'), +(@max, 'fr_FR', 'Message d''expédition de DHL', 'Suivi DHL commande : {$order_ref}', '{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}\r\n{$LASTNAME} {$FIRSTNAME},\r\n{/loop}\r\nNous vous remercions de votre commande sur notre site {config key="store_name"}\r\nUn colis concernant votre commande {$order_ref} du {format_date date=$order_date} a quitté nos entrepôts pour être pris en charge par La Poste le {format_date date=$update_date}.\r\nSon numéro de suivi est le suivant : {$package}\r\nIl vous permet de suivre votre colis en ligne sur le site de La Poste : www.coliposte.net\r\nIl vous sera, par ailleurs, très utile si vous étiez absent au moment de la livraison de votre colis : en fournissant ce numéro de DHL Suivi, vous pourrez retirer votre colis dans le bureau de Poste le plus proche.\r\nATTENTION ! Si vous ne trouvez pas l''avis de passage normalement déposé dans votre boîte aux lettres au bout de 48 Heures jours ouvrables, n''hésitez pas à aller le réclamer à votre bureau de Poste, muni de votre numéro de DHL Suivi.\r\nNous restons à votre disposition pour toute information complémentaire.\r\nCordialement', '{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}\r\n{$LASTNAME} {$FIRSTNAME},\r\n{/loop}\r\nNous vous remercions de votre commande sur notre site {config key="store_name"}\r\nUn colis concernant votre commande {$order_ref} du {format_date date=$order_date} a quitté nos entrepôts pour être pris en charge par La Poste le {format_date date=$update_date}.\r\nSon numéro de suivi est le suivant : {$package}\r\nIl vous permet de suivre votre colis en ligne sur le site de La Poste : www.coliposte.net\r\nIl vous sera, par ailleurs, très utile si vous étiez absent au moment de la livraison de votre colis : en fournissant ce numéro de DHL Suivi, vous pourrez retirer votre colis dans le bureau de Poste le plus proche.\r\nATTENTION ! Si vous ne trouvez pas l''avis de passage normalement déposé dans votre boîte aux lettres au bout de 48 Heures jours ouvrables, n''hésitez pas à aller le réclamer à votre bureau de Poste, muni de votre numéro de DHL Suivi.\r\nNous restons à votre disposition pour toute information complémentaire.\r\nCordialement'); + +# This restores the fkey checks, after having unset them earlier +SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file diff --git a/local/modules/FedEx/Controller/Configuration.php b/local/modules/DHL/Controller/Configuration.php old mode 100755 new mode 100644 similarity index 79% rename from local/modules/FedEx/Controller/Configuration.php rename to local/modules/DHL/Controller/Configuration.php index 6ee90e1d..23e9c835 --- a/local/modules/FedEx/Controller/Configuration.php +++ b/local/modules/DHL/Controller/Configuration.php @@ -1,8 +1,9 @@ + * @package DHL\Controller + * @author Thomas Arnaud */ class Configuration extends BaseAdminController { @@ -21,21 +22,21 @@ class Configuration extends BaseAdminController { if (null !== $response = $this->checkAuth( AdminResources::MODULE, - [FedEx::DOMAIN_NAME], + [DHL::DOMAIN_NAME], AccessManager::UPDATE )) { return $response; } - $form = $this->createForm('fedex.configuration'); + $form = $this->createForm('dhl.configuration'); $error_message = null; try { $validateForm = $this->validateForm($form); $data = $validateForm->getData(); - FedEx::setConfigValue( - FedEx::TRACKING_URL_PARAMETER, + DHL::setConfigValue( + DHLConfigValue::TRACKING_URL, $data["tracking_url"] ); @@ -51,7 +52,7 @@ class Configuration extends BaseAdminController $error_message, $form ); - $response = $this->render("module-configure", ['module_code' => 'FedEx']); + $response = $this->render("module-configure", ['module_code' => 'DHL']); } return $response; } @@ -61,6 +62,6 @@ class Configuration extends BaseAdminController */ protected function redirectToConfigurationPage() { - return RedirectResponse::create(URL::getInstance()->absoluteUrl('/admin/module/fedex')); + return RedirectResponse::create(URL::getInstance()->absoluteUrl('/admin/module/DHL')); } } diff --git a/local/modules/FedEx/Controller/EditPrices.php b/local/modules/DHL/Controller/EditPrices.php old mode 100755 new mode 100644 similarity index 83% rename from local/modules/FedEx/Controller/EditPrices.php rename to local/modules/DHL/Controller/EditPrices.php index 8c6b5d09..41595a3e --- a/local/modules/FedEx/Controller/EditPrices.php +++ b/local/modules/DHL/Controller/EditPrices.php @@ -1,9 +1,9 @@ + * @package DHL\Controller + * @author Thelia */ class EditPrices extends BaseAdminController { @@ -34,7 +34,7 @@ class EditPrices extends BaseAdminController ->findPK($area); if ($exists !== null) { - if (null !== $data = FedEx::getConfigValue(FedExConfigValue::PRICES, null)) { + if (null !== $data = DHL::getConfigValue(DHLConfigValue::PRICES, null)) { $json_data = json_decode( $data, true @@ -52,7 +52,7 @@ class EditPrices extends BaseAdminController } ksort($json_data[$area]['slices']); - FedEx::setConfigValue(FedExConfigValue::PRICES, json_encode($json_data)); + DHL::setConfigValue(DHLConfigValue::PRICES, json_encode($json_data)); } else { throw new \Exception("Area not found"); @@ -69,6 +69,6 @@ class EditPrices extends BaseAdminController */ protected function redirectToConfigurationPage() { - return RedirectResponse::create(URL::getInstance()->absoluteUrl('/admin/module/fedex')); + return RedirectResponse::create(URL::getInstance()->absoluteUrl('/admin/module/DHL')); } } diff --git a/local/modules/DHL/DHL.php b/local/modules/DHL/DHL.php new file mode 100644 index 00000000..e1b88f45 --- /dev/null +++ b/local/modules/DHL/DHL.php @@ -0,0 +1,204 @@ +insertSql(null, array(__DIR__ . '/Config/thelia.sql')); + + // Create DHL shipping zones for relay and home delivery + $moduleId = self::getModuleId(); + $rateFromEuro = Currency::getDefaultCurrency()->getRate(); + $moduleConfiguration = json_decode(file_get_contents(__DIR__. '/Config/prices.json')); + if (false === $moduleConfiguration) { + throw new TheliaProcessException("Invalid JSON configuration for DHL module"); + } + + // Create all shipping zones, and associate DHL module with them. + foreach ($moduleConfiguration->shippingZones as $shippingZone) { + AreaQuery::create()->filterByName($shippingZone->name)->delete(); + + $area = new Area(); + $area + ->setName($shippingZone->name) + ->save(); + + foreach ($shippingZone->countries as $countryIsoCode) { + if (null !== $country = CountryQuery::create()->findOneByIsoalpha3($countryIsoCode)) { + (new CountryArea()) + ->setAreaId($area->getId()) + ->setCountryId($country->getId()) + ->save(); + } + } + + // Attach this zone to our module + (new AreaDeliveryModule()) + ->setArea($area) + ->setDeliveryModuleId($moduleId) + ->save(); + + // Create base prices + foreach ($shippingZone->prices as $price) { + (new DHLDeliveryPrice()) + ->setAreaId($area->getId()) + ->setMaxWeight($price->up_to) + ->setPriceWithTax($price->price_euro * $rateFromEuro) + ->save(); + } + } + + + } + + public function isValidDelivery(Country $country) + { + if (0 == self::getConfigValue(DHLConfigValue::ENABLED, 1)) { + return false; + } + + if (null !== $area = $this->getAreaForCountry($country)) { + $areaId = $area->getId(); + + $prices = self::getPrices(); + + /* Check if DHL delivers the area */ + if (isset($prices[$areaId]) && isset($prices[$areaId]["slices"])) { + // Yes ! Check if the cart weight is below slice limit + $areaPrices = $prices[$areaId]["slices"]; + ksort($areaPrices); + + /* Check cart weight is below the maximum weight */ + end($areaPrices); + $maxWeight = key($areaPrices); + + $cartWeight = $this->getRequest()->getSession()->getSessionCart($this->getDispatcher())->getWeight(); + + if ($cartWeight <= $maxWeight) { + return true; + } + } + } + + return false; + } + + /** + * @param $areaId + * @param $weight + * + * @return mixed + * @throws \Thelia\Exception\OrderException + */ + public static function getPostageAmount($areaId, $weight) + { + $postage = 0; + $prices = self::getPrices(); + + /* check if DHL delivers the asked area */ + if (!isset($prices[$areaId]) || !isset($prices[$areaId]["slices"])) { + throw new DeliveryException( + Translator::getInstance()->trans( + "DHL delivery unavailable for the delivery country", + [], + self::DOMAIN_NAME + ) + ); + } + + $areaPrices = $prices[$areaId]["slices"]; + ksort($areaPrices); + + /* Check cart weight is below the maximum weight */ + end($areaPrices); + $maxWeight = key($areaPrices); + if ($weight > $maxWeight) { + throw new DeliveryException( + Translator::getInstance()->trans( + "DHL delivery unavailable for this cart weight (%weight kg)", + array("%weight" => $weight), + self::DOMAIN_NAME + ) + ); + } + + $postage = current($areaPrices); + + while (prev($areaPrices)) { + if ($weight > key($areaPrices)) { + break; + } + + $postage = current($areaPrices); + } + return $postage; + + } + + /** + * + * calculate and return delivery price + * + * @param Country $country + * @return mixed + * @throws \Thelia\Exception\OrderException + */ + public function getPostage(Country $country) + { + $cartWeight = $this->getRequest()->getSession()->getSessionCart($this->getDispatcher())->getWeight(); + + $postage = self::getPostageAmount( + $this->getAreaForCountry($country)->getId(), + $cartWeight + ); + + return $postage; + } + + public function update($currentVersion, $newVersion, ConnectionInterface $con = null) + { + $uploadDir = __DIR__ . '/Config/prices.json'; + if (is_readable($uploadDir) && DHL::getConfigValue(DHLConfigValue::PRICES, null) == null) { + DHL::setConfigValue(DHLConfigValue::PRICES, file_get_contents($uploadDir)); + } + } +} diff --git a/local/modules/DHL/EventListener/AreaDeletedListener.php b/local/modules/DHL/EventListener/AreaDeletedListener.php new file mode 100644 index 00000000..b0c0d7aa --- /dev/null +++ b/local/modules/DHL/EventListener/AreaDeletedListener.php @@ -0,0 +1,43 @@ + + */ +class AreaDeletedListener implements EventSubscriberInterface +{ + /** + * @param AreaDeleteEvent $event + */ + public function updateConfig(AreaDeleteEvent $event) + { + if (null !== $data = DHL::getConfigValue(DHLConfigValue::PRICES, null)) { + $areaId = $event->getAreaId(); + $json_data = json_decode($data, true); + unset($json_data[$areaId]); + + DHL::setConfigValue(DHLConfigValue::PRICES, json_encode($json_data, true)); + } + } + + /** + * @return array + */ + public static function getSubscribedEvents() + { + return [ + TheliaEvents::AREA_DELETE => [ + 'updateConfig', 128 + ] + ]; + } +} diff --git a/local/modules/DHL/Form/Configuration.php b/local/modules/DHL/Form/Configuration.php new file mode 100644 index 00000000..6ad8da5d --- /dev/null +++ b/local/modules/DHL/Form/Configuration.php @@ -0,0 +1,31 @@ + + */ +class Configuration extends BaseForm +{ + protected function buildForm() + { + $this->formBuilder + ->add( + DHL::WEBSERVICE_URL, + 'text', + [ + 'label' => $this->translator->trans('DHL tracking URL', [], DHL::DOMAIN_NAME), + 'label_attr' => [ + 'help' => $this->translator->trans('This is the URL of the DHL tracking service.', [], DHL::DOMAIN_NAME) + ] + ] + ); + } +} diff --git a/local/modules/FedEx/Hook/HookManager.php b/local/modules/DHL/Hook/HookManager.php similarity index 79% rename from local/modules/FedEx/Hook/HookManager.php rename to local/modules/DHL/Hook/HookManager.php index 36a0d853..7c255401 100644 --- a/local/modules/FedEx/Hook/HookManager.php +++ b/local/modules/DHL/Hook/HookManager.php @@ -1,14 +1,14 @@ + * @package DHL\Hook + * @author Thomas Arnaud */ class HookManager extends BaseHook { diff --git a/local/modules/DHL/I18n/backOffice/default/de_DE.php b/local/modules/DHL/I18n/backOffice/default/de_DE.php new file mode 100644 index 00000000..867bf22d --- /dev/null +++ b/local/modules/DHL/I18n/backOffice/default/de_DE.php @@ -0,0 +1,25 @@ + '*Wenn Sie diese Option auswählen, sind die exportierten Bestellungen auf dieser Seite nicht mehr verfügbar', + 'Actions' => 'Aktionen', + 'An error occured' => 'Ein Fehler ist aufgetreten', + 'Area : ' => 'Bereich : ', + 'Cancel' => 'Abbrechen', + 'Change orders status after export' => 'Status der Bestellung nach dem Export ändern', + 'DHL Module allows to send your products all around the world with La Poste.' => 'DHL Modul ermöglicht, Ihre Produkte mit La Poste weltweit zu versenden.', + 'Create' => 'Erstellen', + 'Date' => 'Datum', + 'Delete' => 'Löschen', + 'Do not change' => 'Nicht ändern', + 'Edit' => 'Ändern', + 'Export' => 'Export', + 'Please change the access rights' => 'Bitte ändern Sie die Zugriffsrechte', + 'Price (€)' => 'Preis (€)', + 'Processing' => 'Bearbeitung', + 'REF' => 'REF', + 'Sent' => 'Gesendet', + 'There is currently not orders to export' => 'Es gibt derzeit keine Bestellungen, die exportiert werden können', + 'Total taxed amount' => 'Gesamter besteuerter Betrag', + 'Weight up to ... (kg)' => 'Gewicht bis zu ... (kg)', +]; diff --git a/local/modules/DHL/I18n/backOffice/default/en_US.php b/local/modules/DHL/I18n/backOffice/default/en_US.php new file mode 100644 index 00000000..fb60da5e --- /dev/null +++ b/local/modules/DHL/I18n/backOffice/default/en_US.php @@ -0,0 +1,36 @@ + '*If you choose this option, the exported orders would not be available on this page anymore', + 'Actions' => 'Actions', + 'An error occured' => 'An error occured', + 'Area : ' => 'Area : ', + 'Cancel' => 'Cancel', + 'Change orders status after export' => 'Change orders status after export', + 'DHL Module allows to send your products all around the world with La Poste.' => 'DHL Module allows to send your products all around the world with La Poste.', + 'Create' => 'Create', + 'Create a new price slice' => 'Create a new price slice', + 'Create a price slice' => 'Create a price slice', + 'Date' => 'Date', + 'Delete' => 'Delete', + 'Delete a price slice' => 'Delete a price slice', + 'Delete this price slice' => 'Delete this price slice', + 'Do not change' => 'Do not change', + 'Do you really want to delete this slice ?' => 'Do you really want to delete this slice ?', + 'Edit' => 'Edit', + 'Edit a price slice' => 'Edit a price slice', + 'Edit this price slice' => 'Edit this price slice', + 'Export' => 'Export', + 'Export expeditor inet file' => 'Export expeditor inet file', + 'Please change the access rights' => 'Please change the access rights', + 'Price (€)' => 'Price (€)', + 'Price slices' => 'Price slices', + 'Processing' => 'Processing', + 'REF' => 'REF', + 'Sent' => 'Sent', + 'There is currently not orders to export' => 'There is currently no orders to export', + 'Total taxed amount' => 'Total taxed amount', + 'Weight up to ... (kg)' => 'Weight up to ... (kg)', + 'Number of packages' => 'Number of packages', + 'Packages weight' => 'Packages weight' +); diff --git a/local/modules/DHL/I18n/backOffice/default/fr_FR.php b/local/modules/DHL/I18n/backOffice/default/fr_FR.php new file mode 100644 index 00000000..d7889dbc --- /dev/null +++ b/local/modules/DHL/I18n/backOffice/default/fr_FR.php @@ -0,0 +1,37 @@ + '* Si vous choisissez cette option, les commandes exportées ne seront plus affichée sur cette page.', + 'Actions' => 'Actions', + 'An error occured' => 'Une erreur est survenue', + 'Area : ' => 'Zone de livraison : ', + 'Cancel' => 'Annuler', + 'Change orders status after export' => 'Modification du statut des commande après l\'export', + 'DHL Module allows to send your products all around the world with La Poste.' => 'DHL vous permet d’expédier vos colis dans le monde entier avec La Poste', + 'Create' => 'Créer', + 'Create a new price slice' => 'Créer une nouvelle tranche de prix', + 'Create a price slice' => 'Créer une tranche de prix', + 'Customer' => 'Client', + 'Date' => 'Date', + 'Delete' => 'Supprimer', + 'Delete a price slice' => 'Supprimer une tranche de prix', + 'Delete this price slice' => 'Supprimer cette tranche de prix', + 'Do not change' => 'Ne pas modifier', + 'Do you really want to delete this slice ?' => 'Confirmez-vous la suppression de cette tranche de prix', + 'Edit' => 'Modifier', + 'Edit a price slice' => 'Modifier une tranche de prix', + 'Edit this price slice' => 'Modifier cette tranche de prix', + 'Export' => 'Export', + 'Export expeditor inet file' => 'Exporter le fichier Expeditor INET', + 'Number of packages' => 'Nombre de colis', + 'Packages weight' => 'Poids des colis', + 'Please change the access rights' => 'Merci de modifier les droits d\'accès', + 'Price (€)' => 'Prix (€)', + 'Price slices' => 'Prix et poids', + 'Processing' => 'Traitement', + 'REF' => 'REF', + 'Sent' => 'Envoyée', + 'There is currently not orders to export' => 'Il n\'y a pas de commande à exporter pour le moment', + 'Total taxed amount' => 'Total TTC', + 'Weight up to ... (kg)' => 'Jusqu\'au poids (Kg)', +]; diff --git a/local/modules/DHL/I18n/backOffice/default/it_IT.php b/local/modules/DHL/I18n/backOffice/default/it_IT.php new file mode 100644 index 00000000..58e711dc --- /dev/null +++ b/local/modules/DHL/I18n/backOffice/default/it_IT.php @@ -0,0 +1,13 @@ + 'Azioni', + 'Cancel' => 'Annulla', + 'Create' => 'Creare', + 'Date' => 'Data', + 'Delete' => 'Cancellare', + 'Edit' => 'Modifica', + 'Export' => 'Esporta', + 'Number of packages' => 'Numero di pacchetti', + 'Packages weight' => 'Peso pacchi', +]; diff --git a/local/modules/DHL/I18n/backOffice/default/tr_TR.php b/local/modules/DHL/I18n/backOffice/default/tr_TR.php new file mode 100644 index 00000000..35584af1 --- /dev/null +++ b/local/modules/DHL/I18n/backOffice/default/tr_TR.php @@ -0,0 +1,34 @@ + '* Bu seçeneği seçerseniz, ihracat siparişleri artık bu sayfadaki müsait olmaz', + 'Actions' => 'Eylemler', + 'An error occured' => 'Bir hata meydana geldi', + 'Area : ' => 'Alanı: ', + 'Cancel' => 'Vazgeç', + 'Change orders status after export' => 'İhracat sonra sipariş durumunu değiştir', + 'DHL Module allows to send your products all around the world with La Poste.' => 'DHL modülü sağlar ürünlerinizi göndermek için La Poste ile dünyanın her yerinden.', + 'Create' => 'Oluştur', + 'Create a new price slice' => 'Yeni fiyat dilimi oluşturmak', + 'Create a price slice' => 'Bir fiyat dilim oluşturma', + 'Date' => 'Tarih', + 'Delete' => 'sil', + 'Delete a price slice' => 'Bir fiyat dilim silmek', + 'Delete this price slice' => 'Bu fiyat dilim silmek', + 'Do not change' => 'Değiştirme', + 'Do you really want to delete this slice ?' => 'Gerçekten bu dosyayı silmek istiyor musunuz ?', + 'Edit' => 'Düzenle', + 'Edit a price slice' => 'Bir fiyat dilim Düzenle', + 'Edit this price slice' => 'Bu fiyat dilim Düzenle', + 'Export' => 'Dışa aktarma', + 'Export expeditor inet file' => 'Expeditor inet dosyası dışa aktarma', + 'Please change the access rights' => 'Lütfen erişim haklarını Değiştir', + 'Price (€)' => 'Fiyat (TL)', + 'Price slices' => 'Fiyat dilimleri', + 'Processing' => 'İşlem devam ediyor', + 'REF' => 'ÜRÜN KODU', + 'Sent' => 'Gönder', + 'There is currently not orders to export' => 'Şu anda hiçbir emir vermek için', + 'Total taxed amount' => 'Toplam Kdvtutarı', + 'Weight up to ... (kg)' => 'Fazla kilo... (kg)', +]; diff --git a/local/modules/DHL/I18n/de_DE.php b/local/modules/DHL/I18n/de_DE.php new file mode 100644 index 00000000..60a35d52 --- /dev/null +++ b/local/modules/DHL/I18n/de_DE.php @@ -0,0 +1,14 @@ + 'Kostenlose Lieferung aktivieren: ', + 'Can\'t read Config directory' => 'Config-Verzeichnis kann nicht gelesen werden', + 'Can\'t read file' => 'Datei kann nicht gelesen werden', + 'Can\'t write Config directory' => 'Config-Verzeichnis kann nicht beschrieben werden', + 'Can\'t write file' => 'Datei kann nicht geschrieben werden', + 'DHL delivery unavailable for the delivery country' => 'Eine Lieferung mit DHL ist für das Land nicht verfügbar', + 'DHL delivery unavailable for this cart weight (%weight kg)' => 'Eine Lieferung mit DHL ist für Warenkörbe mit diesem Gewicht (%weight kg) nicht verfügbar', + 'Modify status export after export' => 'Status der Bestellung nach dem Export ändern', + 'dhl expeditor export' => 'DHL expeditor export', + 'select a valid status' => 'Wählen Sie einen gültigen Bestellungsstatus aus', +]; diff --git a/local/modules/DHL/I18n/en_US.php b/local/modules/DHL/I18n/en_US.php new file mode 100644 index 00000000..0155cfff --- /dev/null +++ b/local/modules/DHL/I18n/en_US.php @@ -0,0 +1,14 @@ + 'Activate free shipping: ', + 'Can\'t read Config directory' => 'Can\'t read Config directory', + 'Can\'t read file' => 'Can\'t read file', + 'Can\'t write Config directory' => 'Can\'t write Config directory', + 'Can\'t write file' => 'Can\'t write file', + 'DHL delivery unavailable for the delivery country' => 'DHL delivery unavailable for the delivery country', + 'DHL delivery unavailable for this cart weight (%weight kg)' => 'DHL delivery unavailable for this cart weight (%weight kg)', + 'Modify status export after export' => 'Change orders status after export', + 'dhl expeditor export' => 'DHL Expeditor export', + 'select a valid status' => 'Select a valid order status', +); diff --git a/local/modules/DHL/I18n/fr_FR.php b/local/modules/DHL/I18n/fr_FR.php new file mode 100644 index 00000000..e970ef93 --- /dev/null +++ b/local/modules/DHL/I18n/fr_FR.php @@ -0,0 +1,14 @@ + 'Activer la livraison offerte: ', + 'Can\'t read Config directory' => 'Le dossier Config ne peut être lu', + 'Can\'t read file' => 'Le fichier suivant ne peut être lu', + 'Can\'t write Config directory' => 'Le dossier Config ne peut être écrit', + 'Can\'t write file' => 'Le fichier suivant ne peut être écrit', + 'DHL delivery unavailable for the delivery country' => 'La livraison par DHL n\'est pas disponible dans ce pays', + 'DHL delivery unavailable for this cart weight (%weight kg)' => 'La livraison par DHL n\'est pas disponible pour un panier de %weight Kg', + 'Modify status export after export' => 'Modification du statut des commandes après l\'export', + 'dhl expeditor export' => 'Export pour le logiciel Expeditor', + 'select a valid status' => 'Choisissez un statut de commande valide.', +]; diff --git a/local/modules/DHL/I18n/tr_TR.php b/local/modules/DHL/I18n/tr_TR.php new file mode 100644 index 00000000..6f82e712 --- /dev/null +++ b/local/modules/DHL/I18n/tr_TR.php @@ -0,0 +1,14 @@ + 'Ücretsiz nakliye etkinleştirmek için: ', + 'Can\'t read Config directory' => 'Yapılandırma dizini okunamıyor', + 'Can\'t read file' => 'Dosyayı okuyamıyor', + 'Can\'t write Config directory' => 'Dosyayı okuyamıyor', + 'Can\'t write file' => 'Dosyaya yazılamıyor', + 'DHL delivery unavailable for the delivery country' => 'Bu Teslimat Bu ülke için kullanılamaz DHL teslim', + 'DHL delivery unavailable for this cart weight (%weight kg)' => 'DHL teslimat için bu sepeti ağırlık (%weight kg) kullanılamaz', + 'Modify status export after export' => 'İhracat sonra sipariş durumunu değiştir', + 'dhl expeditor export' => 'DHL Expeditor verme', + 'select a valid status' => 'Geçerli sipariş durumunu seçin', +]; diff --git a/local/modules/DHL/LICENSE.txt b/local/modules/DHL/LICENSE.txt new file mode 100644 index 00000000..65c5ca88 --- /dev/null +++ b/local/modules/DHL/LICENSE.txt @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/local/modules/DHL/Listener/SendMail.php b/local/modules/DHL/Listener/SendMail.php new file mode 100644 index 00000000..f40a649b --- /dev/null +++ b/local/modules/DHL/Listener/SendMail.php @@ -0,0 +1,123 @@ + + */ +class SendMail implements EventSubscriberInterface +{ + + protected $parser; + + protected $mailer; + + public function __construct(ParserInterface $parser, MailerFactory $mailer) + { + $this->parser = $parser; + $this->mailer = $mailer; + } + + public function updateStatus(OrderEvent $event) + { + $order = $event->getOrder(); + $dhl = new DHL(); + + if ($order->isSent() && $order->getDeliveryModuleId() == $dhl->getModuleModel()->getId()) { + $contact_email = ConfigQuery::getStoreEmail(); + + if ($contact_email) { + + $message = MessageQuery::create() + ->filterByName('mail_dhl') + ->findOne(); + + if (false === $message) { + throw new \Exception("Failed to load message 'order_confirmation'."); + } + + $order = $event->getOrder(); + $customer = $order->getCustomer(); + + $this->parser->assign('customer_id', $customer->getId()); + $this->parser->assign('order_ref', $order->getRef()); + $this->parser->assign('order_date', $order->getCreatedAt()); + $this->parser->assign('update_date', $order->getUpdatedAt()); + $this->parser->assign('package', $order->getDeliveryRef()); + + + $message + ->setLocale($order->getLang()->getLocale()); + + $instance = \Swift_Message::newInstance() + ->addTo($customer->getEmail(), $customer->getFirstname()." ".$customer->getLastname()) + ->addFrom($contact_email, ConfigQuery::getStoreName()) + ; + + // Build subject and body + + $message->buildMessage($this->parser, $instance); + + $this->mailer->send($instance); + + Tlog::getInstance()->debug("DHL shipping message sent to customer ".$customer->getEmail()); + } + else { + $customer = $order->getCustomer(); + Tlog::getInstance()->debug("DHL shipping message no contact email customer_id", $customer->getId()); + } + } + } + + /** + * Returns an array of event names this subscriber wants to listen to. + * + * The array keys are event names and the value can be: + * + * * The method name to call (priority defaults to 0) + * * An array composed of the method name to call and the priority + * * An array of arrays composed of the method names to call and respective + * priorities, or 0 if unset + * + * For instance: + * + * * array('eventName' => 'methodName') + * * array('eventName' => array('methodName', $priority)) + * * array('eventName' => array(array('methodName1', $priority), array('methodName2')) + * + * @return array The event names to listen to + * + * @api + */ + public static function getSubscribedEvents() + { + return array( + TheliaEvents::ORDER_UPDATE_STATUS => array("updateStatus", 128) + ); + } +} diff --git a/local/modules/FedEx/Loop/CheckRightsLoop.php b/local/modules/DHL/Loop/CheckRightsLoop.php old mode 100755 new mode 100644 similarity index 65% rename from local/modules/FedEx/Loop/CheckRightsLoop.php rename to local/modules/DHL/Loop/CheckRightsLoop.php index 3f3738c2..289b8998 --- a/local/modules/FedEx/Loop/CheckRightsLoop.php +++ b/local/modules/DHL/Loop/CheckRightsLoop.php @@ -1,8 +1,17 @@ + * @package DHL\Looop + * @author Thelia */ class CheckRightsLoop extends BaseLoop implements ArraySearchLoopInterface { @@ -32,7 +41,7 @@ class CheckRightsLoop extends BaseLoop implements ArraySearchLoopInterface "ERRMES"=>Translator::getInstance()->trans( "Can't read Config directory", [], - FedEx::DOMAIN_NAME + DHL::DOMAIN_NAME ), "ERRFILE"=>"" ); @@ -42,7 +51,7 @@ class CheckRightsLoop extends BaseLoop implements ArraySearchLoopInterface "ERRMES"=>Translator::getInstance()->trans( "Can't write Config directory", [], - FedEx::DOMAIN_NAME + DHL::DOMAIN_NAME ), "ERRFILE"=>"" ); @@ -57,9 +66,9 @@ class CheckRightsLoop extends BaseLoop implements ArraySearchLoopInterface "ERRMES"=>Translator::getInstance()->trans( "Can't read file", [], - FedEx::DOMAIN_NAME + DHL::DOMAIN_NAME ), - "ERRFILE"=>"FedEx/Config/".$file + "ERRFILE"=>"DHL/Config/".$file ); } if (!is_writable($dir.$file)) { @@ -67,9 +76,9 @@ class CheckRightsLoop extends BaseLoop implements ArraySearchLoopInterface "ERRMES"=>Translator::getInstance()->trans( "Can't write file", [], - FedEx::DOMAIN_NAME + DHL::DOMAIN_NAME ), - "ERRFILE"=>"FedEx/Config/".$file + "ERRFILE"=>"DHL/Config/".$file ); } diff --git a/local/modules/FedEx/Loop/NotSendLoop.php b/local/modules/DHL/Loop/NotSendLoop.php similarity index 63% rename from local/modules/FedEx/Loop/NotSendLoop.php rename to local/modules/DHL/Loop/NotSendLoop.php index 8d51e786..20101712 100644 --- a/local/modules/FedEx/Loop/NotSendLoop.php +++ b/local/modules/DHL/Loop/NotSendLoop.php @@ -1,8 +1,18 @@ */ class NotSendLoop extends Order @@ -59,6 +69,6 @@ class NotSendLoop extends Order */ public function buildModelCriteria() { - return FedExQuery::getOrders(); + return DHLQuery::getOrders(); } } diff --git a/local/modules/FedEx/Loop/Price.php b/local/modules/DHL/Loop/Price.php old mode 100755 new mode 100644 similarity index 60% rename from local/modules/FedEx/Loop/Price.php rename to local/modules/DHL/Loop/Price.php index fae96efa..a9c3a1cb --- a/local/modules/FedEx/Loop/Price.php +++ b/local/modules/DHL/Loop/Price.php @@ -1,8 +1,18 @@ */ class Price extends BaseLoop implements ArraySearchLoopInterface @@ -37,7 +47,7 @@ class Price extends BaseLoop implements ArraySearchLoopInterface public function buildArray() { $area = $this->getArea(); - $prices = FedEx::getPrices(); + $prices = DHL::getPrices(); if (!isset($prices[$area]) || !isset($prices[$area]["slices"])) { return array(); diff --git a/local/modules/DHL/Model/Config/Base/DHLConfigValue.php b/local/modules/DHL/Model/Config/Base/DHLConfigValue.php new file mode 100644 index 00000000..9787e227 --- /dev/null +++ b/local/modules/DHL/Model/Config/Base/DHLConfigValue.php @@ -0,0 +1,14 @@ + + */ +class DHLConfigValue +{ + const PRICES = "prices"; + const TRACKING_URL = "tracking_url"; +} diff --git a/local/modules/DHL/Model/Config/Base/DHLDeliveryPrice.php b/local/modules/DHL/Model/Config/Base/DHLDeliveryPrice.php new file mode 100644 index 00000000..6ec91652 --- /dev/null +++ b/local/modules/DHL/Model/Config/Base/DHLDeliveryPrice.php @@ -0,0 +1,1336 @@ +max_weight = '0.000000'; + $this->price_with_tax = '0.000000'; + } + + /** + * Initializes internal state of DHL\Model\Base\DHLDeliveryPrice object. + * @see applyDefaults() + */ + public function __construct() + { + $this->applyDefaultValues(); + } + + /** + * Returns whether the object has been modified. + * + * @return boolean True if the object has been modified. + */ + public function isModified() + { + return !!$this->modifiedColumns; + } + + /** + * Has specified column been modified? + * + * @param string $col column fully qualified name (TableMap::TYPE_COLNAME), e.g. Book::AUTHOR_ID + * @return boolean True if $col has been modified. + */ + public function isColumnModified($col) + { + return $this->modifiedColumns && isset($this->modifiedColumns[$col]); + } + + /** + * Get the columns that have been modified in this object. + * @return array A unique list of the modified column names for this object. + */ + public function getModifiedColumns() + { + return $this->modifiedColumns ? array_keys($this->modifiedColumns) : []; + } + + /** + * Returns whether the object has ever been saved. This will + * be false, if the object was retrieved from storage or was created + * and then saved. + * + * @return boolean true, if the object has never been persisted. + */ + public function isNew() + { + return $this->new; + } + + /** + * Setter for the isNew attribute. This method will be called + * by Propel-generated children and objects. + * + * @param boolean $b the state of the object. + */ + public function setNew($b) + { + $this->new = (Boolean) $b; + } + + /** + * Whether this object has been deleted. + * @return boolean The deleted state of this object. + */ + public function isDeleted() + { + return $this->deleted; + } + + /** + * Specify whether this object has been deleted. + * @param boolean $b The deleted state of this object. + * @return void + */ + public function setDeleted($b) + { + $this->deleted = (Boolean) $b; + } + + /** + * Sets the modified state for the object to be false. + * @param string $col If supplied, only the specified column is reset. + * @return void + */ + public function resetModified($col = null) + { + if (null !== $col) { + if (isset($this->modifiedColumns[$col])) { + unset($this->modifiedColumns[$col]); + } + } else { + $this->modifiedColumns = array(); + } + } + + /** + * Compares this with another DHLDeliveryPrice instance. If + * obj is an instance of DHLDeliveryPrice, delegates to + * equals(DHLDeliveryPrice). Otherwise, returns false. + * + * @param mixed $obj The object to compare to. + * @return boolean Whether equal to the object specified. + */ + public function equals($obj) + { + $thisclazz = get_class($this); + if (!is_object($obj) || !($obj instanceof $thisclazz)) { + return false; + } + + if ($this === $obj) { + return true; + } + + if (null === $this->getPrimaryKey() + || null === $obj->getPrimaryKey()) { + return false; + } + + return $this->getPrimaryKey() === $obj->getPrimaryKey(); + } + + /** + * If the primary key is not null, return the hashcode of the + * primary key. Otherwise, return the hash code of the object. + * + * @return int Hashcode + */ + public function hashCode() + { + if (null !== $this->getPrimaryKey()) { + return crc32(serialize($this->getPrimaryKey())); + } + + return crc32(serialize(clone $this)); + } + + /** + * Get the associative array of the virtual columns in this object + * + * @return array + */ + public function getVirtualColumns() + { + return $this->virtualColumns; + } + + /** + * Checks the existence of a virtual column in this object + * + * @param string $name The virtual column name + * @return boolean + */ + public function hasVirtualColumn($name) + { + return array_key_exists($name, $this->virtualColumns); + } + + /** + * Get the value of a virtual column in this object + * + * @param string $name The virtual column name + * @return mixed + * + * @throws PropelException + */ + public function getVirtualColumn($name) + { + if (!$this->hasVirtualColumn($name)) { + throw new PropelException(sprintf('Cannot get value of inexistent virtual column %s.', $name)); + } + + return $this->virtualColumns[$name]; + } + + /** + * Set the value of a virtual column in this object + * + * @param string $name The virtual column name + * @param mixed $value The value to give to the virtual column + * + * @return DHLDeliveryPrice The current object, for fluid interface + */ + public function setVirtualColumn($name, $value) + { + $this->virtualColumns[$name] = $value; + + return $this; + } + + /** + * Logs a message using Propel::log(). + * + * @param string $msg + * @param int $priority One of the Propel::LOG_* logging levels + * @return boolean + */ + protected function log($msg, $priority = Propel::LOG_INFO) + { + return Propel::log(get_class($this) . ': ' . $msg, $priority); + } + + /** + * Populate the current object from a string, using a given parser format + * + * $book = new Book(); + * $book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); + * + * + * @param mixed $parser A AbstractParser instance, + * or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param string $data The source data to import from + * + * @return DHLDeliveryPrice The current object, for fluid interface + */ + public function importFrom($parser, $data) + { + if (!$parser instanceof AbstractParser) { + $parser = AbstractParser::getParser($parser); + } + + $this->fromArray($parser->toArray($data), TableMap::TYPE_PHPNAME); + + return $this; + } + + /** + * Export the current object properties to a string, using a given parser format + * + * $book = BookQuery::create()->findPk(9012); + * echo $book->exportTo('JSON'); + * => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}'); + * + * + * @param mixed $parser A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV') + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy load(ed) columns. Defaults to TRUE. + * @return string The exported data + */ + public function exportTo($parser, $includeLazyLoadColumns = true) + { + if (!$parser instanceof AbstractParser) { + $parser = AbstractParser::getParser($parser); + } + + return $parser->fromArray($this->toArray(TableMap::TYPE_PHPNAME, $includeLazyLoadColumns, array(), true)); + } + + /** + * Clean up internal collections prior to serializing + * Avoids recursive loops that turn into segmentation faults when serializing + */ + public function __sleep() + { + $this->clearAllReferences(); + + return array_keys(get_object_vars($this)); + } + + /** + * Get the [id] column value. + * + * @return int + */ + public function getId() + { + + return $this->id; + } + + /** + * Get the [max_weight] column value. + * + * @return string + */ + public function getMaxWeight() + { + + return $this->max_weight; + } + + /** + * Get the [price_with_tax] column value. + * + * @return string + */ + public function getPriceWithTax() + { + + return $this->price_with_tax; + } + + /** + * Get the [area_id] column value. + * + * @return int + */ + public function getAreaId() + { + + return $this->area_id; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return \DHL\Model\DHLDeliveryPrice The current object (for fluent API support) + */ + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[DHLDeliveryPriceTableMap::ID] = true; + } + + + return $this; + } // setId() + + /** + * Set the value of [max_weight] column. + * + * @param string $v new value + * @return \DHL\Model\DHLDeliveryPrice The current object (for fluent API support) + */ + public function setMaxWeight($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->max_weight !== $v) { + $this->max_weight = $v; + $this->modifiedColumns[DHLDeliveryPriceTableMap::MAX_WEIGHT] = true; + } + + + return $this; + } // setMaxWeight() + + /** + * Set the value of [price_with_tax] column. + * + * @param string $v new value + * @return \DHL\Model\DHLDeliveryPrice The current object (for fluent API support) + */ + public function setPriceWithTax($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->price_with_tax !== $v) { + $this->price_with_tax = $v; + $this->modifiedColumns[DHLDeliveryPriceTableMap::PRICE_WITH_TAX] = true; + } + + + return $this; + } // setPriceWithTax() + + /** + * Set the value of [area_id] column. + * + * @param int $v new value + * @return \DHL\Model\DHLDeliveryPrice The current object (for fluent API support) + */ + public function setAreaId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->area_id !== $v) { + $this->area_id = $v; + $this->modifiedColumns[DHLDeliveryPriceTableMap::AREA_ID] = true; + } + + if ($this->aArea !== null && $this->aArea->getId() !== $v) { + $this->aArea = null; + } + + + return $this; + } // setAreaId() + + /** + * Indicates whether the columns in this object are only set to default values. + * + * This method can be used in conjunction with isModified() to indicate whether an object is both + * modified _and_ has some values set which are non-default. + * + * @return boolean Whether the columns in this object are only been set with default values. + */ + public function hasOnlyDefaultValues() + { + if ($this->max_weight !== '0.000000') { + return false; + } + + if ($this->price_with_tax !== '0.000000') { + return false; + } + + // otherwise, everything was equal, so return TRUE + return true; + } // hasOnlyDefaultValues() + + /** + * Hydrates (populates) the object variables with values from the database resultset. + * + * An offset (0-based "start column") is specified so that objects can be hydrated + * with a subset of the columns in the resultset rows. This is needed, for example, + * for results of JOIN queries where the resultset row includes columns from two or + * more tables. + * + * @param array $row The row returned by DataFetcher->fetch(). + * @param int $startcol 0-based offset column which indicates which restultset column to start with. + * @param boolean $rehydrate Whether this object is being re-hydrated from the database. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * + * @return int next starting column + * @throws PropelException - Any caught Exception will be rewrapped as a PropelException. + */ + public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = TableMap::TYPE_NUM) + { + try { + + + $col = $row[TableMap::TYPE_NUM == $indexType ? 0 + $startcol : DHLDeliveryPriceTableMap::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + $this->id = (null !== $col) ? (int) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : DHLDeliveryPriceTableMap::translateFieldName('MaxWeight', TableMap::TYPE_PHPNAME, $indexType)]; + $this->max_weight = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : DHLDeliveryPriceTableMap::translateFieldName('PriceWithTax', TableMap::TYPE_PHPNAME, $indexType)]; + $this->price_with_tax = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : DHLDeliveryPriceTableMap::translateFieldName('AreaId', TableMap::TYPE_PHPNAME, $indexType)]; + $this->area_id = (null !== $col) ? (int) $col : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 4; // 4 = DHLDeliveryPriceTableMap::NUM_HYDRATE_COLUMNS. + + } catch (Exception $e) { + throw new PropelException("Error populating \DHL\Model\DHLDeliveryPrice object", 0, $e); + } + } + + /** + * Checks and repairs the internal consistency of the object. + * + * This method is executed after an already-instantiated object is re-hydrated + * from the database. It exists to check any foreign keys to make sure that + * the objects related to the current object are correct based on foreign key. + * + * You can override this method in the stub class, but you should always invoke + * the base method from the overridden method (i.e. parent::ensureConsistency()), + * in case your model changes. + * + * @throws PropelException + */ + public function ensureConsistency() + { + if ($this->aArea !== null && $this->area_id !== $this->aArea->getId()) { + $this->aArea = null; + } + } // ensureConsistency + + /** + * Reloads this object from datastore based on primary key and (optionally) resets all associated objects. + * + * This will only work if the object has been saved and has a valid primary key set. + * + * @param boolean $deep (optional) Whether to also de-associated any related objects. + * @param ConnectionInterface $con (optional) The ConnectionInterface connection to use. + * @return void + * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db + */ + public function reload($deep = false, ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("Cannot reload a deleted object."); + } + + if ($this->isNew()) { + throw new PropelException("Cannot reload an unsaved object."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(DHLDeliveryPriceTableMap::DATABASE_NAME); + } + + // We don't need to alter the object instance pool; we're just modifying this instance + // already in the pool. + + $dataFetcher = ChildDHLDeliveryPriceQuery::create(null, $this->buildPkeyCriteria())->setFormatter(ModelCriteria::FORMAT_STATEMENT)->find($con); + $row = $dataFetcher->fetch(); + $dataFetcher->close(); + if (!$row) { + throw new PropelException('Cannot find matching row in the database to reload object values.'); + } + $this->hydrate($row, 0, true, $dataFetcher->getIndexType()); // rehydrate + + if ($deep) { // also de-associate any related objects? + + $this->aArea = null; + } // if (deep) + } + + /** + * Removes this object from datastore and sets delete attribute. + * + * @param ConnectionInterface $con + * @return void + * @throws PropelException + * @see DHLDeliveryPrice::setDeleted() + * @see DHLDeliveryPrice::isDeleted() + */ + public function delete(ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getWriteConnection(DHLDeliveryPriceTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + try { + $deleteQuery = ChildDHLDeliveryPriceQuery::create() + ->filterByPrimaryKey($this->getPrimaryKey()); + $ret = $this->preDelete($con); + if ($ret) { + $deleteQuery->delete($con); + $this->postDelete($con); + $con->commit(); + $this->setDeleted(true); + } else { + $con->commit(); + } + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Persists this object to the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All modified related objects will also be persisted in the doSave() + * method. This method wraps all precipitate database operations in a + * single transaction. + * + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see doSave() + */ + public function save(ConnectionInterface $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("You cannot save an object that has been deleted."); + } + + if ($con === null) { + $con = Propel::getServiceContainer()->getWriteConnection(DHLDeliveryPriceTableMap::DATABASE_NAME); + } + + $con->beginTransaction(); + $isInsert = $this->isNew(); + try { + $ret = $this->preSave($con); + if ($isInsert) { + $ret = $ret && $this->preInsert($con); + } else { + $ret = $ret && $this->preUpdate($con); + } + if ($ret) { + $affectedRows = $this->doSave($con); + if ($isInsert) { + $this->postInsert($con); + } else { + $this->postUpdate($con); + } + $this->postSave($con); + DHLDeliveryPriceTableMap::addInstanceToPool($this); + } else { + $affectedRows = 0; + } + $con->commit(); + + return $affectedRows; + } catch (Exception $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Performs the work of inserting or updating the row in the database. + * + * If the object is new, it inserts it; otherwise an update is performed. + * All related objects are also updated in this method. + * + * @param ConnectionInterface $con + * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. + * @throws PropelException + * @see save() + */ + protected function doSave(ConnectionInterface $con) + { + $affectedRows = 0; // initialize var to track total num of affected rows + if (!$this->alreadyInSave) { + $this->alreadyInSave = true; + + // We call the save method on the following object(s) if they + // were passed to this object by their corresponding set + // method. This object relates to these object(s) by a + // foreign key reference. + + if ($this->aArea !== null) { + if ($this->aArea->isModified() || $this->aArea->isNew()) { + $affectedRows += $this->aArea->save($con); + } + $this->setArea($this->aArea); + } + + if ($this->isNew() || $this->isModified()) { + // persist changes + if ($this->isNew()) { + $this->doInsert($con); + } else { + $this->doUpdate($con); + } + $affectedRows += 1; + $this->resetModified(); + } + + $this->alreadyInSave = false; + + } + + return $affectedRows; + } // doSave() + + /** + * Insert the row in the database. + * + * @param ConnectionInterface $con + * + * @throws PropelException + * @see doSave() + */ + protected function doInsert(ConnectionInterface $con) + { + $modifiedColumns = array(); + $index = 0; + + $this->modifiedColumns[DHLDeliveryPriceTableMap::ID] = true; + if (null !== $this->id) { + throw new PropelException('Cannot insert a value for auto-increment primary key (' . DHLDeliveryPriceTableMap::ID . ')'); + } + + // check the columns in natural order for more readable SQL queries + if ($this->isColumnModified(DHLDeliveryPriceTableMap::ID)) { + $modifiedColumns[':p' . $index++] = 'ID'; + } + if ($this->isColumnModified(DHLDeliveryPriceTableMap::MAX_WEIGHT)) { + $modifiedColumns[':p' . $index++] = 'MAX_WEIGHT'; + } + if ($this->isColumnModified(DHLDeliveryPriceTableMap::PRICE_WITH_TAX)) { + $modifiedColumns[':p' . $index++] = 'PRICE_WITH_TAX'; + } + if ($this->isColumnModified(DHLDeliveryPriceTableMap::AREA_ID)) { + $modifiedColumns[':p' . $index++] = 'AREA_ID'; + } + + $sql = sprintf( + 'INSERT INTO dhl_delivery_price (%s) VALUES (%s)', + implode(', ', $modifiedColumns), + implode(', ', array_keys($modifiedColumns)) + ); + + try { + $stmt = $con->prepare($sql); + foreach ($modifiedColumns as $identifier => $columnName) { + switch ($columnName) { + case 'ID': + $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT); + break; + case 'MAX_WEIGHT': + $stmt->bindValue($identifier, $this->max_weight, PDO::PARAM_STR); + break; + case 'PRICE_WITH_TAX': + $stmt->bindValue($identifier, $this->price_with_tax, PDO::PARAM_STR); + break; + case 'AREA_ID': + $stmt->bindValue($identifier, $this->area_id, PDO::PARAM_INT); + break; + } + } + $stmt->execute(); + } catch (Exception $e) { + Propel::log($e->getMessage(), Propel::LOG_ERR); + throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e); + } + + try { + $pk = $con->lastInsertId(); + } catch (Exception $e) { + throw new PropelException('Unable to get autoincrement id.', 0, $e); + } + $this->setId($pk); + + $this->setNew(false); + } + + /** + * Update the row in the database. + * + * @param ConnectionInterface $con + * + * @return Integer Number of updated rows + * @see doSave() + */ + protected function doUpdate(ConnectionInterface $con) + { + $selectCriteria = $this->buildPkeyCriteria(); + $valuesCriteria = $this->buildCriteria(); + + return $selectCriteria->doUpdate($valuesCriteria, $con); + } + + /** + * Retrieves a field from the object by name passed in as a string. + * + * @param string $name name + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @return mixed Value of field. + */ + public function getByName($name, $type = TableMap::TYPE_PHPNAME) + { + $pos = DHLDeliveryPriceTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + $field = $this->getByPosition($pos); + + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch ($pos) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getMaxWeight(); + break; + case 2: + return $this->getPriceWithTax(); + break; + case 3: + return $this->getAreaId(); + break; + default: + return null; + break; + } // switch() + } + + /** + * Exports the object as an array. + * + * You can specify the key type of the array by passing one of the class + * type constants. + * + * @param string $keyType (optional) One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE. + * @param array $alreadyDumpedObjects List of objects to skip to avoid recursion + * @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE. + * + * @return array an associative array containing the field names (as keys) and field values + */ + public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false) + { + if (isset($alreadyDumpedObjects['DHLDeliveryPrice'][$this->getPrimaryKey()])) { + return '*RECURSION*'; + } + $alreadyDumpedObjects['DHLDeliveryPrice'][$this->getPrimaryKey()] = true; + $keys = DHLDeliveryPriceTableMap::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getMaxWeight(), + $keys[2] => $this->getPriceWithTax(), + $keys[3] => $this->getAreaId(), + ); + $virtualColumns = $this->virtualColumns; + foreach ($virtualColumns as $key => $virtualColumn) { + $result[$key] = $virtualColumn; + } + + if ($includeForeignObjects) { + if (null !== $this->aArea) { + $result['Area'] = $this->aArea->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true); + } + } + + return $result; + } + + /** + * Sets a field from the object by name passed in as a string. + * + * @param string $name + * @param mixed $value field value + * @param string $type The type of fieldname the $name is of: + * one of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * Defaults to TableMap::TYPE_PHPNAME. + * @return void + */ + public function setByName($name, $value, $type = TableMap::TYPE_PHPNAME) + { + $pos = DHLDeliveryPriceTableMap::translateFieldName($name, $type, TableMap::TYPE_NUM); + + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch ($pos) { + case 0: + $this->setId($value); + break; + case 1: + $this->setMaxWeight($value); + break; + case 2: + $this->setPriceWithTax($value); + break; + case 3: + $this->setAreaId($value); + break; + } // switch() + } + + /** + * Populates the object using an array. + * + * This is particularly useful when populating an object from one of the + * request arrays (e.g. $_POST). This method goes through the column + * names, checking to see whether a matching key exists in populated + * array. If so the setByName() method is called for that column. + * + * You can specify the key type of the array by additionally passing one + * of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME, + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * The default key type is the column's TableMap::TYPE_PHPNAME. + * + * @param array $arr An array to populate the object from. + * @param string $keyType The type of keys the array uses. + * @return void + */ + public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) + { + $keys = DHLDeliveryPriceTableMap::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setMaxWeight($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setPriceWithTax($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setAreaId($arr[$keys[3]]); + } + + /** + * Build a Criteria object containing the values of all modified columns in this object. + * + * @return Criteria The Criteria object containing all modified values. + */ + public function buildCriteria() + { + $criteria = new Criteria(DHLDeliveryPriceTableMap::DATABASE_NAME); + + if ($this->isColumnModified(DHLDeliveryPriceTableMap::ID)) $criteria->add(DHLDeliveryPriceTableMap::ID, $this->id); + if ($this->isColumnModified(DHLDeliveryPriceTableMap::MAX_WEIGHT)) $criteria->add(DHLDeliveryPriceTableMap::MAX_WEIGHT, $this->max_weight); + if ($this->isColumnModified(DHLDeliveryPriceTableMap::PRICE_WITH_TAX)) $criteria->add(DHLDeliveryPriceTableMap::PRICE_WITH_TAX, $this->price_with_tax); + if ($this->isColumnModified(DHLDeliveryPriceTableMap::AREA_ID)) $criteria->add(DHLDeliveryPriceTableMap::AREA_ID, $this->area_id); + + return $criteria; + } + + /** + * Builds a Criteria object containing the primary key for this object. + * + * Unlike buildCriteria() this method includes the primary key values regardless + * of whether or not they have been modified. + * + * @return Criteria The Criteria object containing value(s) for primary key(s). + */ + public function buildPkeyCriteria() + { + $criteria = new Criteria(DHLDeliveryPriceTableMap::DATABASE_NAME); + $criteria->add(DHLDeliveryPriceTableMap::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + + return null === $this->getId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of \DHL\Model\DHLDeliveryPrice (or compatible) type. + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new. + * @throws PropelException + */ + public function copyInto($copyObj, $deepCopy = false, $makeNew = true) + { + $copyObj->setMaxWeight($this->getMaxWeight()); + $copyObj->setPriceWithTax($this->getPriceWithTax()); + $copyObj->setAreaId($this->getAreaId()); + if ($makeNew) { + $copyObj->setNew(true); + $copyObj->setId(NULL); // this is a auto-increment column, so set to default value + } + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return \DHL\Model\DHLDeliveryPrice Clone of current object. + * @throws PropelException + */ + public function copy($deepCopy = false) + { + // we use get_class(), because this might be a subclass + $clazz = get_class($this); + $copyObj = new $clazz(); + $this->copyInto($copyObj, $deepCopy); + + return $copyObj; + } + + /** + * Declares an association between this object and a ChildArea object. + * + * @param ChildArea $v + * @return \DHL\Model\DHLDeliveryPrice The current object (for fluent API support) + * @throws PropelException + */ + public function setArea(ChildArea $v = null) + { + if ($v === null) { + $this->setAreaId(NULL); + } else { + $this->setAreaId($v->getId()); + } + + $this->aArea = $v; + + // Add binding for other direction of this n:n relationship. + // If this object has already been added to the ChildArea object, it will not be re-added. + if ($v !== null) { + $v->addDHLDeliveryPrice($this); + } + + + return $this; + } + + + /** + * Get the associated ChildArea object + * + * @param ConnectionInterface $con Optional Connection object. + * @return ChildArea The associated ChildArea object. + * @throws PropelException + */ + public function getArea(ConnectionInterface $con = null) + { + if ($this->aArea === null && ($this->area_id !== null)) { + $this->aArea = AreaQuery::create()->findPk($this->area_id, $con); + /* The following can be used additionally to + guarantee the related object contains a reference + to this object. This level of coupling may, however, be + undesirable since it could result in an only partially populated collection + in the referenced object. + $this->aArea->addDHLDeliveryPrices($this); + */ + } + + return $this->aArea; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->max_weight = null; + $this->price_with_tax = null; + $this->area_id = null; + $this->alreadyInSave = false; + $this->clearAllReferences(); + $this->applyDefaultValues(); + $this->resetModified(); + $this->setNew(true); + $this->setDeleted(false); + } + + /** + * Resets all references to other model objects or collections of model objects. + * + * This method is a user-space workaround for PHP's inability to garbage collect + * objects with circular references (even in PHP 5.3). This is currently necessary + * when using Propel in certain daemon or large-volume/high-memory operations. + * + * @param boolean $deep Whether to also clear the references on all referrer objects. + */ + public function clearAllReferences($deep = false) + { + if ($deep) { + } // if ($deep) + + $this->aArea = null; + } + + /** + * Return the string representation of this object + * + * @return string + */ + public function __toString() + { + return (string) $this->exportTo(DHLDeliveryPriceTableMap::DEFAULT_STRING_FORMAT); + } + + /** + * Code to be run before persisting the object + * @param ConnectionInterface $con + * @return boolean + */ + public function preSave(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after persisting the object + * @param ConnectionInterface $con + */ + public function postSave(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before inserting to database + * @param ConnectionInterface $con + * @return boolean + */ + public function preInsert(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after inserting to database + * @param ConnectionInterface $con + */ + public function postInsert(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before updating the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preUpdate(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after updating the object in database + * @param ConnectionInterface $con + */ + public function postUpdate(ConnectionInterface $con = null) + { + + } + + /** + * Code to be run before deleting the object in database + * @param ConnectionInterface $con + * @return boolean + */ + public function preDelete(ConnectionInterface $con = null) + { + return true; + } + + /** + * Code to be run after deleting the object in database + * @param ConnectionInterface $con + */ + public function postDelete(ConnectionInterface $con = null) + { + + } + + + /** + * Derived method to catches calls to undefined methods. + * + * Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.). + * Allows to define default __call() behavior if you overwrite __call() + * + * @param string $name + * @param mixed $params + * + * @return array|string + */ + public function __call($name, $params) + { + if (0 === strpos($name, 'get')) { + $virtualColumn = substr($name, 3); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + + $virtualColumn = lcfirst($virtualColumn); + if ($this->hasVirtualColumn($virtualColumn)) { + return $this->getVirtualColumn($virtualColumn); + } + } + + if (0 === strpos($name, 'from')) { + $format = substr($name, 4); + + return $this->importFrom($format, reset($params)); + } + + if (0 === strpos($name, 'to')) { + $format = substr($name, 2); + $includeLazyLoadColumns = isset($params[0]) ? $params[0] : true; + + return $this->exportTo($format, $includeLazyLoadColumns); + } + + throw new BadMethodCallException(sprintf('Call to undefined method: %s.', $name)); + } + +} diff --git a/local/modules/DHL/Model/Config/Base/DHLDeliveryPriceQuery.php b/local/modules/DHL/Model/Config/Base/DHLDeliveryPriceQuery.php new file mode 100644 index 00000000..a900bbd2 --- /dev/null +++ b/local/modules/DHL/Model/Config/Base/DHLDeliveryPriceQuery.php @@ -0,0 +1,563 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + + return $query; + } + + /** + * Find object by primary key. + * Propel uses the instance pool to skip the database if the object exists. + * Go fast if the query is untouched. + * + * + * $obj = $c->findPk(12, $con); + * + * + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con an optional connection object + * + * @return ChildDHLDeliveryPrice|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ($key === null) { + return null; + } + if ((null !== ($obj = DHLDeliveryPriceTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) { + // the object is already in the instance pool + return $obj; + } + if ($con === null) { + $con = Propel::getServiceContainer()->getReadConnection(DHLDeliveryPriceTableMap::DATABASE_NAME); + } + $this->basePreSelect($con); + if ($this->formatter || $this->modelAlias || $this->with || $this->select + || $this->selectColumns || $this->asColumns || $this->selectModifiers + || $this->map || $this->having || $this->joins) { + return $this->findPkComplex($key, $con); + } else { + return $this->findPkSimple($key, $con); + } + } + + /** + * Find object by primary key using raw SQL to go fast. + * Bypass doSelect() and the object formatter by using generated code. + * + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object + * + * @return ChildDHLDeliveryPrice A model object, or null if the key is not found + */ + protected function findPkSimple($key, $con) + { + $sql = 'SELECT ID, MAX_WEIGHT, PRICE_WITH_TAX, AREA_ID FROM mondial_relay_delivery_price WHERE ID = :p0'; + try { + $stmt = $con->prepare($sql); + $stmt->bindValue(':p0', $key, PDO::PARAM_INT); + $stmt->execute(); + } catch (Exception $e) { + Propel::log($e->getMessage(), Propel::LOG_ERR); + throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), 0, $e); + } + $obj = null; + if ($row = $stmt->fetch(\PDO::FETCH_NUM)) { + $obj = new ChildDHLDeliveryPrice(); + $obj->hydrate($row); + DHLDeliveryPriceTableMap::addInstanceToPool($obj, (string) $key); + } + $stmt->closeCursor(); + + return $obj; + } + + /** + * Find object by primary key. + * + * @param mixed $key Primary key to use for the query + * @param ConnectionInterface $con A connection object + * + * @return ChildDHLDeliveryPrice|array|mixed the result, formatted by the current formatter + */ + protected function findPkComplex($key, $con) + { + // As the query uses a PK condition, no limit(1) is necessary. + $criteria = $this->isKeepQuery() ? clone $this : $this; + $dataFetcher = $criteria + ->filterByPrimaryKey($key) + ->doSelect($con); + + return $criteria->getFormatter()->init($criteria)->formatOne($dataFetcher); + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param ConnectionInterface $con an optional connection object + * + * @return ObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getReadConnection($this->getDbName()); + } + $this->basePreSelect($con); + $criteria = $this->isKeepQuery() ? clone $this : $this; + $dataFetcher = $criteria + ->filterByPrimaryKeys($keys) + ->doSelect($con); + + return $criteria->getFormatter()->init($criteria)->format($dataFetcher); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return ChildDHLDeliveryPriceQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + + return $this->addUsingAlias(DHLDeliveryPriceTableMap::ID, $key, Criteria::EQUAL); + } + + /** + * Filter the query by a list of primary keys + * + * @param array $keys The list of primary key to use for the query + * + * @return ChildDHLDeliveryPriceQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + + return $this->addUsingAlias(DHLDeliveryPriceTableMap::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * Example usage: + * + * $query->filterById(1234); // WHERE id = 1234 + * $query->filterById(array(12, 34)); // WHERE id IN (12, 34) + * $query->filterById(array('min' => 12)); // WHERE id > 12 + * + * + * @param mixed $id The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildDHLDeliveryPriceQuery The current query, for fluid interface + */ + public function filterById($id = null, $comparison = null) + { + if (is_array($id)) { + $useMinMax = false; + if (isset($id['min'])) { + $this->addUsingAlias(DHLDeliveryPriceTableMap::ID, $id['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($id['max'])) { + $this->addUsingAlias(DHLDeliveryPriceTableMap::ID, $id['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(DHLDeliveryPriceTableMap::ID, $id, $comparison); + } + + /** + * Filter the query on the max_weight column + * + * Example usage: + * + * $query->filterByMaxWeight(1234); // WHERE max_weight = 1234 + * $query->filterByMaxWeight(array(12, 34)); // WHERE max_weight IN (12, 34) + * $query->filterByMaxWeight(array('min' => 12)); // WHERE max_weight > 12 + * + * + * @param mixed $maxWeight The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildDHLDeliveryPriceQuery The current query, for fluid interface + */ + public function filterByMaxWeight($maxWeight = null, $comparison = null) + { + if (is_array($maxWeight)) { + $useMinMax = false; + if (isset($maxWeight['min'])) { + $this->addUsingAlias(DHLDeliveryPriceTableMap::MAX_WEIGHT, $maxWeight['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($maxWeight['max'])) { + $this->addUsingAlias(DHLDeliveryPriceTableMap::MAX_WEIGHT, $maxWeight['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(DHLDeliveryPriceTableMap::MAX_WEIGHT, $maxWeight, $comparison); + } + + /** + * Filter the query on the price_with_tax column + * + * Example usage: + * + * $query->filterByPriceWithTax(1234); // WHERE price_with_tax = 1234 + * $query->filterByPriceWithTax(array(12, 34)); // WHERE price_with_tax IN (12, 34) + * $query->filterByPriceWithTax(array('min' => 12)); // WHERE price_with_tax > 12 + * + * + * @param mixed $priceWithTax The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildDHLDeliveryPriceQuery The current query, for fluid interface + */ + public function filterByPriceWithTax($priceWithTax = null, $comparison = null) + { + if (is_array($priceWithTax)) { + $useMinMax = false; + if (isset($priceWithTax['min'])) { + $this->addUsingAlias(DHLDeliveryPriceTableMap::PRICE_WITH_TAX, $priceWithTax['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($priceWithTax['max'])) { + $this->addUsingAlias(DHLDeliveryPriceTableMap::PRICE_WITH_TAX, $priceWithTax['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(DHLDeliveryPriceTableMap::PRICE_WITH_TAX, $priceWithTax, $comparison); + } + + /** + * Filter the query on the area_id column + * + * Example usage: + * + * $query->filterByAreaId(1234); // WHERE area_id = 1234 + * $query->filterByAreaId(array(12, 34)); // WHERE area_id IN (12, 34) + * $query->filterByAreaId(array('min' => 12)); // WHERE area_id > 12 + * + * + * @see filterByArea() + * + * @param mixed $areaId The value to use as filter. + * Use scalar values for equality. + * Use array values for in_array() equivalent. + * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildDHLDeliveryPriceQuery The current query, for fluid interface + */ + public function filterByAreaId($areaId = null, $comparison = null) + { + if (is_array($areaId)) { + $useMinMax = false; + if (isset($areaId['min'])) { + $this->addUsingAlias(DHLDeliveryPriceTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL); + $useMinMax = true; + } + if (isset($areaId['max'])) { + $this->addUsingAlias(DHLDeliveryPriceTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL); + $useMinMax = true; + } + if ($useMinMax) { + return $this; + } + if (null === $comparison) { + $comparison = Criteria::IN; + } + } + + return $this->addUsingAlias(DHLDeliveryPriceTableMap::AREA_ID, $areaId, $comparison); + } + + /** + * Filter the query by a related \Thelia\Model\Area object + * + * @param \Thelia\Model\Area|ObjectCollection $area The related object(s) to use as filter + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return ChildDHLDeliveryPriceQuery The current query, for fluid interface + */ + public function filterByArea($area, $comparison = null) + { + if ($area instanceof \Thelia\Model\Area) { + return $this + ->addUsingAlias(DHLDeliveryPriceTableMap::AREA_ID, $area->getId(), $comparison); + } elseif ($area instanceof ObjectCollection) { + if (null === $comparison) { + $comparison = Criteria::IN; + } + + return $this + ->addUsingAlias(DHLDeliveryPriceTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison); + } else { + throw new PropelException('filterByArea() only accepts arguments of type \Thelia\Model\Area or Collection'); + } + } + + /** + * Adds a JOIN clause to the query using the Area relation + * + * @param string $relationAlias optional alias for the relation + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return ChildDHLDeliveryPriceQuery The current query, for fluid interface + */ + public function joinArea($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + $tableMap = $this->getTableMap(); + $relationMap = $tableMap->getRelation('Area'); + + // create a ModelJoin object for this join + $join = new ModelJoin(); + $join->setJoinType($joinType); + $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias); + if ($previousJoin = $this->getPreviousJoin()) { + $join->setPreviousJoin($previousJoin); + } + + // add the ModelJoin to the current object + if ($relationAlias) { + $this->addAlias($relationAlias, $relationMap->getRightTable()->getName()); + $this->addJoinObject($join, $relationAlias); + } else { + $this->addJoinObject($join, 'Area'); + } + + return $this; + } + + /** + * Use the Area relation Area object + * + * @see useQuery() + * + * @param string $relationAlias optional alias for the relation, + * to be used as main alias in the secondary query + * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' + * + * @return \Thelia\Model\AreaQuery A secondary query class using the current class as primary query + */ + public function useAreaQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN) + { + return $this + ->joinArea($relationAlias, $joinType) + ->useQuery($relationAlias ? $relationAlias : 'Area', '\Thelia\Model\AreaQuery'); + } + + /** + * Exclude object from result + * + * @param ChildDHLDeliveryPrice $mondialRelayDeliveryPrice Object to remove from the list of results + * + * @return ChildDHLDeliveryPriceQuery The current query, for fluid interface + */ + public function prune($mondialRelayDeliveryPrice = null) + { + if ($mondialRelayDeliveryPrice) { + $this->addUsingAlias(DHLDeliveryPriceTableMap::ID, $mondialRelayDeliveryPrice->getId(), Criteria::NOT_EQUAL); + } + + return $this; + } + + /** + * Deletes all rows from the mondial_relay_delivery_price table. + * + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + */ + public function doDeleteAll(ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(DHLDeliveryPriceTableMap::DATABASE_NAME); + } + $affectedRows = 0; // initialize var to track total num of affected rows + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + $affectedRows += parent::doDeleteAll($con); + // Because this db requires some delete cascade/set null emulation, we have to + // clear the cached instance *after* the emulation has happened (since + // instances get re-added by the select statement contained therein). + DHLDeliveryPriceTableMap::clearInstancePool(); + DHLDeliveryPriceTableMap::clearRelatedInstancePool(); + + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $affectedRows; + } + + /** + * Performs a DELETE on the database, given a ChildDHLDeliveryPrice or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or ChildDHLDeliveryPrice object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public function delete(ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(DHLDeliveryPriceTableMap::DATABASE_NAME); + } + + $criteria = $this; + + // Set the correct dbName + $criteria->setDbName(DHLDeliveryPriceTableMap::DATABASE_NAME); + + $affectedRows = 0; // initialize var to track total num of affected rows + + try { + // use transaction because $criteria could contain info + // for more than one table or we could emulating ON DELETE CASCADE, etc. + $con->beginTransaction(); + + + DHLDeliveryPriceTableMap::removeInstanceFromPool($criteria); + + $affectedRows += ModelCriteria::delete($con); + DHLDeliveryPriceTableMap::clearRelatedInstancePool(); + $con->commit(); + + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + +} // DHLDeliveryPriceQuery diff --git a/local/modules/DHL/Model/Config/DHLConfigValue.php b/local/modules/DHL/Model/Config/DHLConfigValue.php new file mode 100644 index 00000000..1209748a --- /dev/null +++ b/local/modules/DHL/Model/Config/DHLConfigValue.php @@ -0,0 +1,9 @@ + array('Id', 'MaxWeight', 'PriceWithTax', 'AreaId', ), + self::TYPE_STUDLYPHPNAME => array('id', 'maxWeight', 'priceWithTax', 'areaId', ), + self::TYPE_COLNAME => array(DHLDeliveryPriceTableMap::ID, DHLDeliveryPriceTableMap::MAX_WEIGHT, DHLDeliveryPriceTableMap::PRICE_WITH_TAX, DHLDeliveryPriceTableMap::AREA_ID, ), + self::TYPE_RAW_COLNAME => array('ID', 'MAX_WEIGHT', 'PRICE_WITH_TAX', 'AREA_ID', ), + self::TYPE_FIELDNAME => array('id', 'max_weight', 'price_with_tax', 'area_id', ), + self::TYPE_NUM => array(0, 1, 2, 3, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 + */ + protected static $fieldKeys = array ( + self::TYPE_PHPNAME => array('Id' => 0, 'MaxWeight' => 1, 'PriceWithTax' => 2, 'AreaId' => 3, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'maxWeight' => 1, 'priceWithTax' => 2, 'areaId' => 3, ), + self::TYPE_COLNAME => array(DHLDeliveryPriceTableMap::ID => 0, DHLDeliveryPriceTableMap::MAX_WEIGHT => 1, DHLDeliveryPriceTableMap::PRICE_WITH_TAX => 2, DHLDeliveryPriceTableMap::AREA_ID => 3, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'MAX_WEIGHT' => 1, 'PRICE_WITH_TAX' => 2, 'AREA_ID' => 3, ), + self::TYPE_FIELDNAME => array('id' => 0, 'max_weight' => 1, 'price_with_tax' => 2, 'area_id' => 3, ), + self::TYPE_NUM => array(0, 1, 2, 3, ) + ); + + /** + * Initialize the table attributes and columns + * Relations are not initialized by this method since they are lazy loaded + * + * @return void + * @throws PropelException + */ + public function initialize() + { + // attributes + $this->setName('dhl_delivery_price'); + $this->setPhpName('DHLDeliveryPrice'); + $this->setClassName('\\DHL\\Model\\DHLDeliveryPrice'); + $this->setPackage('DHL.Model'); + $this->setUseIdGenerator(true); + // columns + $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); + $this->addColumn('MAX_WEIGHT', 'MaxWeight', 'DECIMAL', true, 16, 0); + $this->addColumn('PRICE_WITH_TAX', 'PriceWithTax', 'DECIMAL', true, 16, 0); + $this->addForeignKey('AREA_ID', 'AreaId', 'INTEGER', 'area', 'ID', true, null, null); + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + $this->addRelation('Area', '\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'CASCADE', 'RESTRICT'); + } // buildRelations() + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM + */ + public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { + return null; + } + + return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row resultset row. + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM + * + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + + return (int) $row[ + $indexType == TableMap::TYPE_NUM + ? 0 + $offset + : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType) + ]; + } + + /** + * The class that the tableMap will make instances of. + * + * If $withPrefix is true, the returned path + * uses a dot-path notation which is translated into a path + * relative to a location on the PHP include_path. + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') + * + * @param boolean $withPrefix Whether or not to return the path with the class name + * @return string path.to.ClassName + */ + public static function getOMClass($withPrefix = true) + { + return $withPrefix ? DHLDeliveryPriceTableMap::CLASS_DEFAULT : DHLDeliveryPriceTableMap::OM_CLASS; + } + + /** + * Populates an object of the default type or an object that inherit from the default. + * + * @param array $row row returned by DataFetcher->fetch(). + * @param int $offset The 0-based offset for reading from the resultset row. + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). + One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + * @return array (DHLDeliveryPrice object, last column rank) + */ + public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) + { + $key = DHLDeliveryPriceTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); + if (null !== ($obj = DHLDeliveryPriceTableMap::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, $offset, true); // rehydrate + $col = $offset + DHLDeliveryPriceTableMap::NUM_HYDRATE_COLUMNS; + } else { + $cls = DHLDeliveryPriceTableMap::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $offset, false, $indexType); + DHLDeliveryPriceTableMap::addInstanceToPool($obj, $key); + } + + return array($obj, $col); + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @param DataFetcherInterface $dataFetcher + * @return array + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(DataFetcherInterface $dataFetcher) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = static::getOMClass(false); + // populate the object(s) + while ($row = $dataFetcher->fetch()) { + $key = DHLDeliveryPriceTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); + if (null !== ($obj = DHLDeliveryPriceTableMap::getInstanceFromPool($key))) { + // We no longer rehydrate the object, since this can cause data loss. + // See http://www.propelorm.org/ticket/509 + // $obj->hydrate($row, 0, true); // rehydrate + $results[] = $obj; + } else { + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + DHLDeliveryPriceTableMap::addInstanceToPool($obj, $key); + } // if key exists + } + + return $results; + } + /** + * Add all the columns needed to create a new object. + * + * Note: any columns that were marked with lazyLoad="true" in the + * XML schema will not be added to the select list and only loaded + * on demand. + * + * @param Criteria $criteria object containing the columns to add. + * @param string $alias optional table alias + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function addSelectColumns(Criteria $criteria, $alias = null) + { + if (null === $alias) { + $criteria->addSelectColumn(DHLDeliveryPriceTableMap::ID); + $criteria->addSelectColumn(DHLDeliveryPriceTableMap::MAX_WEIGHT); + $criteria->addSelectColumn(DHLDeliveryPriceTableMap::PRICE_WITH_TAX); + $criteria->addSelectColumn(DHLDeliveryPriceTableMap::AREA_ID); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.MAX_WEIGHT'); + $criteria->addSelectColumn($alias . '.PRICE_WITH_TAX'); + $criteria->addSelectColumn($alias . '.AREA_ID'); + } + } + + /** + * Returns the TableMap related to this object. + * This method is not needed for general use but a specific application could have a need. + * @return TableMap + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function getTableMap() + { + return Propel::getServiceContainer()->getDatabaseMap(DHLDeliveryPriceTableMap::DATABASE_NAME)->getTable(DHLDeliveryPriceTableMap::TABLE_NAME); + } + + /** + * Add a TableMap instance to the database for this tableMap class. + */ + public static function buildTableMap() + { + $dbMap = Propel::getServiceContainer()->getDatabaseMap(DHLDeliveryPriceTableMap::DATABASE_NAME); + if (!$dbMap->hasTable(DHLDeliveryPriceTableMap::TABLE_NAME)) { + $dbMap->addTableObject(new DHLDeliveryPriceTableMap()); + } + } + + /** + * Performs a DELETE on the database, given a DHLDeliveryPrice or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or DHLDeliveryPrice object or primary key or array of primary keys + * which is used to create the DELETE statement + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows + * if supported by native driver or if emulated using Propel. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doDelete($values, ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(DHLDeliveryPriceTableMap::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + // rename for clarity + $criteria = $values; + } elseif ($values instanceof \DHL\Model\DHLDeliveryPrice) { // it's a model object + // create criteria based on pk values + $criteria = $values->buildPkeyCriteria(); + } else { // it's a primary key, or an array of pks + $criteria = new Criteria(DHLDeliveryPriceTableMap::DATABASE_NAME); + $criteria->add(DHLDeliveryPriceTableMap::ID, (array) $values, Criteria::IN); + } + + $query = DHLDeliveryPriceQuery::create()->mergeWith($criteria); + + if ($values instanceof Criteria) { DHLDeliveryPriceTableMap::clearInstancePool(); + } elseif (!is_object($values)) { // it's a primary key, or an array of pks + foreach ((array) $values as $singleval) { DHLDeliveryPriceTableMap::removeInstanceFromPool($singleval); + } + } + + return $query->delete($con); + } + + /** + * Deletes all rows from the dhl_delivery_price table. + * + * @param ConnectionInterface $con the connection to use + * @return int The number of affected rows (if supported by underlying database driver). + */ + public static function doDeleteAll(ConnectionInterface $con = null) + { + return DHLDeliveryPriceQuery::create()->doDeleteAll($con); + } + + /** + * Performs an INSERT on the database, given a DHLDeliveryPrice or Criteria object. + * + * @param mixed $criteria Criteria or DHLDeliveryPrice object containing data that is used to create the INSERT statement. + * @param ConnectionInterface $con the ConnectionInterface connection to use + * @return mixed The new primary key. + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function doInsert($criteria, ConnectionInterface $con = null) + { + if (null === $con) { + $con = Propel::getServiceContainer()->getWriteConnection(DHLDeliveryPriceTableMap::DATABASE_NAME); + } + + if ($criteria instanceof Criteria) { + $criteria = clone $criteria; // rename for clarity + } else { + $criteria = $criteria->buildCriteria(); // build Criteria from DHLDeliveryPrice object + } + + if ($criteria->containsKey(DHLDeliveryPriceTableMap::ID) && $criteria->keyContainsValue(DHLDeliveryPriceTableMap::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.DHLDeliveryPriceTableMap::ID.')'); + } + + + // Set the correct dbName + $query = DHLDeliveryPriceQuery::create()->mergeWith($criteria); + + try { + // use transaction because $criteria could contain info + // for more than one table (I guess, conceivably) + $con->beginTransaction(); + $pk = $query->doInsert($con); + $con->commit(); + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + + return $pk; + } + +} // DHLDeliveryPriceTableMap +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +DHLDeliveryPriceTableMap::buildTableMap(); diff --git a/local/modules/DHL/Model/DHLDeliveryPrice.php b/local/modules/DHL/Model/DHLDeliveryPrice.php new file mode 100644 index 00000000..a290c8a3 --- /dev/null +++ b/local/modules/DHL/Model/DHLDeliveryPrice.php @@ -0,0 +1,10 @@ + */ -class FedExQuery +class DHLQuery { /** * @return OrderQuery @@ -32,7 +32,7 @@ class FedExQuery ->toArray("code"); $query = OrderQuery::create() - ->filterByDeliveryModuleId((new FedEx())->getModuleModel()->getId()) + ->filterByDeliveryModuleId((new DHL())->getModuleModel()->getId()) ->filterByStatusId( array( $status[OrderStatus::CODE_PAID]['Id'], diff --git a/local/modules/FedEx/templates/backOffice/default/module_configuration.html b/local/modules/DHL/templates/backOffice/default/module_configuration.html old mode 100755 new mode 100644 similarity index 60% rename from local/modules/FedEx/templates/backOffice/default/module_configuration.html rename to local/modules/DHL/templates/backOffice/default/module_configuration.html index 81e15956..d7f378da --- a/local/modules/FedEx/templates/backOffice/default/module_configuration.html +++ b/local/modules/DHL/templates/backOffice/default/module_configuration.html @@ -1,30 +1,29 @@
- {loop name="checkrights.fedex" type="fedex.check.rights"} + {loop name="checkrights.dhl" type="dhl.check.rights"}
-

{$ERRMES} {$ERRFILE} | {intl d='fedex.bo.default' l="Please change the access rights"}.

+

{$ERRMES} {$ERRFILE} | {intl d='dhl.bo.default' l="Please change the access rights"}.

{/loop}
-{elseloop rel="checkrights.fedex"} +{elseloop rel="checkrights.dhl"}
-

{intl d='fedex.bo.default' l="FedEx Module allows to send your products all around the world with FedEx."}

+

{intl d='dhl.bo.default' l="DHL Module allows to send your products all around the world."}

- {form name="fedex.configuration"} - + {form name="dhl.configuration"} + {form_hidden_fields form=$form} - {loop type="module-config" name="boucle" module="FedEx" variable="tracking_url"} - {render_form_field field="tracking_url" value=$VALUE} - {/loop} - {/form} @@ -35,16 +34,10 @@
- - -
-
- -
+
+
{* -- Add price slice confirmation dialog ----------------------------------- *} {loop type="area" name="list area" backend_context=true module_id=$module_id} @@ -52,68 +45,68 @@ file = "includes/generic-create-dialog.html" dialog_id = "price_slice_create_dialog_{$ID}" - dialog_title = {intl d='fedex.bo.default' l="Create a price slice"} + dialog_title = {intl d='dhl.bo.default' l="Create a price slice"} dialog_body = " - + - + " - form_action="{url path="/admin/module/fedex/prices"}" + form_action="{url path="/admin/module/dhl/prices"}" - dialog_ok_label = {intl d='fedex.bo.default' l="Create"} - dialog_cancel_label = {intl d='fedex.bo.default' l="Cancel"} + dialog_ok_label = {intl d='dhl.bo.default' l="Create"} + dialog_cancel_label = {intl d='dhl.bo.default' l="Cancel"} }
- - - + + + - {loop type="fedex" name="fedex" area=$ID} + {loop type="dhl" name="dhl" area=$ID} {* -- EDIT price slice confirmation dialog ----------------------------------- *} {include file = "includes/generic-confirm-dialog.html" dialog_id = "price_slice_edit_dialog_{$ID}_{$MAX_WEIGHT|replace:'.':'-'}" - dialog_title = {intl d='fedex.bo.default' l="Edit a price slice"} + dialog_title = {intl d='dhl.bo.default' l="Edit a price slice"} dialog_message = " - + " - form_action="{url path="/admin/module/fedex/prices"}" - dialog_ok_label = {intl d='fedex.bo.default' l="Edit"} - dialog_cancel_label = {intl d='fedex.bo.default' l="Cancel"} + form_action="{url path="/admin/module/dhl/prices"}" + dialog_ok_label = {intl d='dhl.bo.default' l="Edit"} + dialog_cancel_label = {intl d='dhl.bo.default' l="Cancel"} } {* -- Delete price slice confirmation dialog ----------------------------------- *} {include file = "includes/generic-confirm-dialog.html" dialog_id = "price_slice_delete_dialog_{$ID}_{$MAX_WEIGHT|replace:'.':'-'}" - dialog_title = {intl d='fedex.bo.default' l="Delete a price slice"} + dialog_title = {intl d='dhl.bo.default' l="Delete a price slice"} dialog_message = " - {intl d='fedex.bo.default' l="Do you really want to delete this slice ?"}" + {intl d='dhl.bo.default' l="Do you really want to delete this slice ?"}" - form_action="{url path="/admin/module/fedex/prices"}" - dialog_ok_label = {intl d='fedex.bo.default' l="Delete"} - dialog_cancel_label = {intl d='fedex.bo.default' l="Cancel"} + form_action="{url path="/admin/module/dhl/prices"}" + dialog_ok_label = {intl d='dhl.bo.default' l="Delete"} + dialog_cancel_label = {intl d='dhl.bo.default' l="Cancel"} } @@ -121,11 +114,11 @@
- {intl d='fedex.bo.default' l="Area : "}{$NAME} - {loop type="auth" name="can_create" role="ADMIN" module="fedex" access="CREATE"} - + {intl d='dhl.bo.default' l="Area : "}{$NAME} + {loop type="auth" name="can_create" role="ADMIN" module="dhl" access="CREATE"} + {/loop}
{intl d='fedex.bo.default' l="Weight up to ... (kg)"}{intl d='fedex.bo.default' l="Price (€)"}{intl d='fedex.bo.default' l="Actions"}{intl d='dhl.bo.default' l="Weight up to ... (kg)"}{intl d='dhl.bo.default' l="Price (€)"}{intl d='dhl.bo.default' l="Actions"}
{$PRICE}
- {loop type="auth" name="can_change" role="ADMIN" module="fedex" access="UPDATE"} - + {loop type="auth" name="can_change" role="ADMIN" module="dhl" access="UPDATE"} + - + {/loop} diff --git a/local/modules/FedEx/Config/config.xml b/local/modules/FedEx/Config/config.xml deleted file mode 100755 index 82d54dbf..00000000 --- a/local/modules/FedEx/Config/config.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - -
- - - - - - - - - - - - - - - - diff --git a/local/modules/FedEx/Config/routing.xml b/local/modules/FedEx/Config/routing.xml deleted file mode 100755 index 230c5435..00000000 --- a/local/modules/FedEx/Config/routing.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - FedEx\Controller\EditPrices::editprices - - - - FedEx\Controller\Configuration::editConfiguration - - - diff --git a/local/modules/FedEx/Config/thelia.sql b/local/modules/FedEx/Config/thelia.sql deleted file mode 100644 index 3e88e491..00000000 --- a/local/modules/FedEx/Config/thelia.sql +++ /dev/null @@ -1,44 +0,0 @@ -# This is a fix for InnoDB in MySQL >= 4.1.x -# It "suspends judgement" for fkey relationships until are tables are set. -SET FOREIGN_KEY_CHECKS = 0; - --- --------------------------------------------------------------------- --- Mail templates for FedEx --- --------------------------------------------------------------------- - --- First, delete existing entries -SET @var := 0; -SELECT @var := `id` FROM `message` WHERE name="mail_fedex"; -DELETE FROM `message` WHERE `id`=@var; --- Try if ON DELETE constraint isn't set -DELETE FROM `message_i18n` WHERE `id`=@var; - --- Then add new entries -SELECT @max := MAX(`id`) FROM `message`; -SET @max := @max+1; --- insert message -INSERT INTO `message` (`id`, `name`, `secured`) VALUES -(@max, -'mail_fedex', -'0' -); - --- and template fr_FR -INSERT INTO `message_i18n` (`id`, `locale`, `title`, `subject`, `text_message`, `html_message`) VALUES -(@max, - 'en_US', - 'FedEx shipping message', - 'Your order {$order_ref} has been shipped', - '{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}Dear {$FIRSTNAME} {$LASTNAME},\r\n\r\n{/loop}Thank you for your order {$order_ref} you placed on our online store {config key="store_name"} on {format_date date=$order_date output="date"}.\r\n\r\nYour order has been shipped on {format_date date=$update_date}.\r\nPlease check the FedEx website for tracking your parcel using this link : {$tracking_url}{$package}\r\n\r\nFeel free to contact us for any further information,\r\n\r\nBest Regards.', - '

{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}Dear {$FIRSTNAME} {$LASTNAME},

{/loop}\r\n

Thank you for your order {$order_ref} you placed on our online store {config key="store_name"} on {format_date date=$order_date output="date"}.

Your order has been shipped on {format_date date=$update_date}.Please check the FedEx website for tracking your parcel using this link : {$tracking_url}{$package}

Feel free to contact us for any further information,

Best Regards.

' - ), -(@max, - 'fr_FR', - 'Message d''expédition de FedEx', - 'Suivi FedEx commande : {$order_ref}', - '{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}\r\nCher/chère {$LASTNAME} {$FIRSTNAME},\r\n{/loop}\r\n\r\nNous vous remercions de votre commande {$order_ref} effectuée sur notre site {config key="store_name"} le {format_date date=$order_date output="date"}.\r\n\r\nVotre colis a quitté nos entrepôts pour être pris en charge par FedEx le {format_date date=$update_date output="date"}.\r\nVous pouvez le suivre en ligne sur le site officiel de FedEx via ce lien : {$tracking_url}{$package}\r\n\r\nNous restons à votre disposition pour toute information complémentaire.\r\n\r\nCordialement\r\n', - '

{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}\r\nCher/chère {$LASTNAME} {$FIRSTNAME},

{/loop}\r\n

Nous vous remercions de votre commande {$order_ref} effectuée sur notre site {config key="store_name"} le {format_date date=$order_date output="date"}.


Votre colis a quitté nos entrepôts pour être pris en charge par FedEx le {format_date date=$update_date output="date"}.Vous pouvez le suivre en ligne sur le site officiel de FedEx via ce lien : {$tracking_url}{$package}

Nous restons à votre disposition pour toute information complémentaire.

Cordialement

' -); - -# This restores the fkey checks, after having unset them earlier -SET FOREIGN_KEY_CHECKS = 1; diff --git a/local/modules/FedEx/FedEx.php b/local/modules/FedEx/FedEx.php deleted file mode 100755 index b510c1a3..00000000 --- a/local/modules/FedEx/FedEx.php +++ /dev/null @@ -1,143 +0,0 @@ -insertSql(null, array(__DIR__ . '/Config/thelia.sql')); - } - - - public function isValidDelivery(Country $country, State $state = null) - { - if (null !== $area = $this->getAreaForCountry($country, $state)) { - $areaId = $area->getId(); - - $prices = self::getPrices(); - - /* Check if FedEx delivers the area */ - if (isset($prices[$areaId]) && isset($prices[$areaId]["slices"])) { - // Yes ! Check if the cart weight is below slice limit - $areaPrices = $prices[$areaId]["slices"]; - ksort($areaPrices); - - /* Check cart weight is below the maximum weight */ - end($areaPrices); - $maxWeight = key($areaPrices); - - $cartWeight = $this->getRequest()->getSession()->getSessionCart($this->getDispatcher())->getWeight(); - - if ($cartWeight <= $maxWeight) { - return true; - } - } - } - - return false; - } - - /** - * @param $areaId - * @param $weight - * - * @return mixed - * @throws \Thelia\Exception\OrderException - */ - public static function getPostageAmount($areaId, $weight) - { - $prices = self::getPrices(); - - /* check if FedEx delivers the asked area */ - if (!isset($prices[$areaId]) || !isset($prices[$areaId]["slices"])) { - throw new DeliveryException( - Translator::getInstance()->trans( - "FedEx delivery unavailable for the delivery country", - [], - self::DOMAIN_NAME - ) - ); - } - - $areaPrices = $prices[$areaId]["slices"]; - ksort($areaPrices); - - /* Check cart weight is below the maximum weight */ - end($areaPrices); - $maxWeight = key($areaPrices); - if ($weight > $maxWeight) { - throw new DeliveryException( - Translator::getInstance()->trans( - "FedEx delivery unavailable for this cart weight (%weight kg)", - array("%weight" => $weight), - self::DOMAIN_NAME - ) - ); - } - - $postage = current($areaPrices); - - while (prev($areaPrices)) { - if ($weight > key($areaPrices)) { - break; - } - - $postage = current($areaPrices); - } - - return $postage; - } - - /** - * - * calculate and return delivery price - * - * @param Country $country - * @param State $state - * @return mixed - */ - public function getPostage(Country $country, State $state = null) - { - $cartWeight = $this->getRequest()->getSession()->getSessionCart($this->getDispatcher())->getWeight(); - - $postage = self::getPostageAmount( - $this->getAreaForCountry($country, $state)->getId(), - $cartWeight - ); - - return $postage; - } - -} diff --git a/local/modules/FedEx/Form/Configuration.php b/local/modules/FedEx/Form/Configuration.php deleted file mode 100644 index 320a4787..00000000 --- a/local/modules/FedEx/Form/Configuration.php +++ /dev/null @@ -1,33 +0,0 @@ - - */ -class Configuration extends BaseForm -{ - protected function buildForm() - { - $this->formBuilder - ->add( - FedEx::TRACKING_URL_PARAMETER, - 'url', - [ - 'constraints' => [ - new NotBlank(), - ], - 'label' => $this->translator->trans('FedEx parcel tracking URL', [], FedEx::DOMAIN_NAME), - 'label_attr' => [ - 'help' => $this->translator->trans('This is the parcel tracking URL for FedEx.', [], FedEx::DOMAIN_NAME) - ] - ] - ); - } -} diff --git a/local/modules/FedEx/I18n/backOffice/default/en_US.php b/local/modules/FedEx/I18n/backOffice/default/en_US.php deleted file mode 100644 index 04da973f..00000000 --- a/local/modules/FedEx/I18n/backOffice/default/en_US.php +++ /dev/null @@ -1,23 +0,0 @@ - 'Actions', - 'Area : ' => 'Area : ', - 'Cancel' => 'Cancel', - 'Create' => 'Create', - 'Create a new price slice' => 'Create a new price slice', - 'Create a price slice' => 'Create a price slice', - 'Delete' => 'Delete', - 'Delete a price slice' => 'Delete a price slice', - 'Delete this price slice' => 'Delete this price slice', - 'Do you really want to delete this slice ?' => 'Do you really want to delete this slice ?', - 'Edit' => 'Edit', - 'Edit a price slice' => 'Edit a price slice', - 'Edit this price slice' => 'Edit this price slice', - 'FedEx Module allows to send your products all around the world with FedEx.' => 'FedEx Module allows to send your products all around the world with FedEx.', - 'Please change the access rights' => 'Please change the access rights', - 'Price (€)' => 'Price (€)', - 'Price slices' => 'Price slices', - 'Save' => 'Save', - 'Weight up to ... (kg)' => 'Weight up to ... (kg)', -); diff --git a/local/modules/FedEx/I18n/backOffice/default/fr_FR.php b/local/modules/FedEx/I18n/backOffice/default/fr_FR.php deleted file mode 100644 index b10e1703..00000000 --- a/local/modules/FedEx/I18n/backOffice/default/fr_FR.php +++ /dev/null @@ -1,25 +0,0 @@ - 'Actions', - 'Area : ' => 'Zone de livraison : ', - 'Cancel' => 'Annuler', - 'Create' => 'Créer', - 'Create a new price slice' => 'Créer une nouvelle tranche de prix', - 'Create a price slice' => 'Créer une tranche de prix', - 'Delete' => 'Supprimer', - 'Delete a price slice' => 'Supprimer une tranche de prix', - 'Delete this price slice' => 'Supprimer cette tranche de prix', - 'Do you really want to delete this slice ?' => 'Confirmez-vous la suppression de cette tranche de prix', - 'Edit' => 'Modifier', - 'Edit a price slice' => 'Modifier une tranche de prix', - 'Edit this price slice' => 'Modifier cette tranche de prix', - 'FedEx parcel tracking URL' => 'URL du WebService de suivi des colis FedEx', - 'FedEx Module allows to send your products all around the world with FedEx.' => 'FedEx vous permet d’expédier vos colis dans le monde entier avec FedEx', - 'Please change the access rights' => 'Merci de modifier les droits d\'accès', - 'Price (€)' => 'Prix (€)', - 'Price slices' => 'Prix et poids', - 'Save' => 'Sauvegarder', - 'This is the parcel tracking URL for FedEx.' => 'Veuillez saisir l\'URL de suivi des colis FedEx : le dernier caractère doit être le symbole =', - 'Weight up to ... (kg)' => 'Jusqu\'au poids (Kg)', -); diff --git a/local/modules/FedEx/I18n/en_US.php b/local/modules/FedEx/I18n/en_US.php deleted file mode 100644 index ee49d126..00000000 --- a/local/modules/FedEx/I18n/en_US.php +++ /dev/null @@ -1,12 +0,0 @@ - 'Can\'t read Config directory', - 'Can\'t read file' => 'Can\'t read file', - 'Can\'t write Config directory' => 'Can\'t write Config directory', - 'Can\'t write file' => 'Can\'t write file', - 'FedEx delivery unavailable for the delivery country' => 'FedEx delivery unavailable for the delivery country', - 'FedEx delivery unavailable for this cart weight (%weight kg)' => 'FedEx delivery unavailable for this cart weight (%weight kg)', - 'FedEx parcel tracking URL' => 'URL for FedEx tracking WebService', - 'This is the parcel tracking URL for FedEx.' => 'Please indicate FedEx\' tracking WebService URL : last character must be the symbol =', -); diff --git a/local/modules/FedEx/I18n/fr_FR.php b/local/modules/FedEx/I18n/fr_FR.php deleted file mode 100644 index 1c52ef5b..00000000 --- a/local/modules/FedEx/I18n/fr_FR.php +++ /dev/null @@ -1,12 +0,0 @@ - 'Le dossier Config ne peut être lu', - 'Can\'t read file' => 'Le fichier suivant ne peut être lu', - 'Can\'t write Config directory' => 'Le dossier Config ne peut être écrit', - 'Can\'t write file' => 'Le fichier suivant ne peut être écrit', - 'FedEx delivery unavailable for the delivery country' => 'La livraison par FedEx n\'est pas disponible dans ce pays', - 'FedEx delivery unavailable for this cart weight (%weight kg)' => 'La livraison par FedEx n\'est pas disponible pour un panier de %weight Kg', - 'FedEx parcel tracking URL' => 'URL du WebService de suivi des colis FedEx', - 'This is the parcel tracking URL for FedEx.' => 'Veuillez saisir l\'URL de suivi des colis FedEx : le dernier caractère doit être le symbole =', -); diff --git a/local/modules/FedEx/Listener/SendMail.php b/local/modules/FedEx/Listener/SendMail.php deleted file mode 100755 index 2ebde8aa..00000000 --- a/local/modules/FedEx/Listener/SendMail.php +++ /dev/null @@ -1,90 +0,0 @@ - - */ -class SendMail implements EventSubscriberInterface -{ - protected $parser; - protected $mailer; - - public function __construct(ParserInterface $parser, MailerFactory $mailer) - { - $this->parser = $parser; - $this->mailer = $mailer; - } - - public function updateStatus(OrderEvent $event) - { - $order = $event->getOrder(); - $FedEx = new FedEx(); - - if ($order->isSent() && $order->getDeliveryModuleId() == $FedEx->getModuleModel()->getId()) { - $contact_email = ConfigQuery::getStoreEmail(); - - if ($contact_email) { - $order = $event->getOrder(); - $customer = $order->getCustomer(); - - $this->mailer->sendEmailToCustomer( - 'mail_FedEx', - $customer, - [ - 'customer_id' => $customer->getId(), - 'order_ref' => $order->getRef(), - 'order_date' => $order->getCreatedAt(), - 'update_date' => $order->getUpdatedAt(), - 'tracking_url' => FedEx::getConfigValue('tracking_url',$FedEx::DEFAULT_TRACKING_URL), - 'package' => $order->getDeliveryRef() - ] - ); - - Tlog::getInstance()->debug("FedEx shipping message sent to customer ".$customer->getEmail()); - } else { - $customer = $order->getCustomer(); - Tlog::getInstance()->debug("FedEx shipping message no contact email customer_id", $customer->getId()); - } - } - } - - /** - * Returns an array of event names this subscriber wants to listen to. - * - * The array keys are event names and the value can be: - * - * * The method name to call (priority defaults to 0) - * * An array composed of the method name to call and the priority - * * An array of arrays composed of the method names to call and respective - * priorities, or 0 if unset - * - * For instance: - * - * * array('eventName' => 'methodName') - * * array('eventName' => array('methodName', $priority)) - * * array('eventName' => array(array('methodName1', $priority), array('methodName2')) - * - * @return array The event names to listen to - * - * @api - */ - public static function getSubscribedEvents() - { - return array( - TheliaEvents::ORDER_UPDATE_STATUS => array("updateStatus", 128) - ); - } -} diff --git a/local/modules/FedEx/Model/Config/Base/FedExConfigValue.php b/local/modules/FedEx/Model/Config/Base/FedExConfigValue.php deleted file mode 100644 index 0a97e214..00000000 --- a/local/modules/FedEx/Model/Config/Base/FedExConfigValue.php +++ /dev/null @@ -1,9 +0,0 @@ -