Init du module DHL (sur la base du module Colissimo)

This commit is contained in:
2020-12-03 17:12:39 +01:00
parent 979767253d
commit 7f00efb081
48 changed files with 4198 additions and 541 deletions

View File

@@ -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
}
]
}
]
}

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8" ?>
<config xmlns="http://thelia.net/schema/dic/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
<loops>
<loop class="DHL\Loop\Price" name="dhl"/>
<loop class="DHL\Loop\CheckRightsLoop" name="dhl.check.rights" />
<loop class="DHL\Loop\NotSendLoop" name="dhl.notsend.loop" />
</loops>
<forms>
<!-- <form name="dhl.freeshipping.form" class="DHL\Form\FreeShipping" />-->
<!-- <form name="dhl.export.form" class="DHL\Form\Export" />-->
<form name="dhl.configuration" class="DHL\Form\Configuration" />
</forms>
<services>
<service id="send.dhl.mail" class="DHL\Listener\SendMail">
<argument type="service" id="thelia.parser" />
<argument type="service" id="mailer"/>
<tag name="kernel.event_subscriber"/>
</service>
</services>
<services>
<service id="area.deleted.listener" class="DHL\EventListener\AreaDeletedListener" scope="request">
<tag name="kernel.event_subscriber"/>
<argument type="service" id="request" />
</service>
</services>
<hooks>
<hook id="dhl.hook" class="DHL\Hook\HookManager">
<tag name="hook.event_listener" event="module.configuration" type="back" method="onModuleConfiguration" />
<tag name="hook.event_listener" event="module.config-js" type="back" templates="render:assets/js/module-configuration-js.html" />
</hook>
</hooks>
</config>

View File

@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module>
<fullnamespace>FedEx\FedEx</fullnamespace>
<fullnamespace>DHL\DHL</fullnamespace>
<descriptive locale="en_US">
<title>FedEx delivery</title>
<title>DHL delivery</title>
</descriptive>
<descriptive locale="fr_FR">
<title>Livraison par FedEx</title>
<title>Livraison par DHL</title>
</descriptive>
<version>1.0.0</version>
<version>2.3.3</version>
<author>
<name>Laurent LE CORRE</name>
<email>laurent@thecoredev.fr</email>

View File

@@ -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
}
]
}
]
}

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
<route id="dhl.edit.prices" path="/admin/module/dhl/prices" methods="post">
<default key="_controller">DHL\Controller\EditPrices::editprices</default>
</route>
<!-- <route id="dhl.edit.freeshipping" path="/admin/module/dhl/freeshipping" methods="post">-->
<!-- <default key="_controller">DHL\Controller\FreeShipping::set</default>-->
<!-- </route>-->
<!-- <route id="dhl.export" path="/admin/module/dhl/export" methods="post">-->
<!-- <default key="_controller">DHL\Controller\Export::exportAction</default>-->
<!-- </route>-->
<route id="dhl.configuration" path="/admin/module/dhl/configuration/update" methods="post">
<default key="_controller">DHL\Controller\Configuration::editConfiguration</default>
</route>
</routes>

View File

@@ -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<p>Dear {$FIRSTNAME} {$LASTNAME},</p>\r\n{/loop}\r\n<p>Thank you for your order on our online store {config key="store_name"}.</p>\r\n<p>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: <a href="www.coliposte.net">www.coliposte.net</a>.</p>\r\n<p>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.</p>\r\n<p>Feel free to contact us for any forther information</p>\r\n<p>Best Regards.</p>'),
(@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;

View File

@@ -1,8 +1,9 @@
<?php
namespace FedEx\Controller;
namespace DHL\Controller;
use FedEx\FedEx;
use DHL\DHL;
use DHL\Model\Config\DHLConfigValue;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Thelia\Controller\Admin\BaseAdminController;
use Thelia\Core\Security\AccessManager;
@@ -12,8 +13,8 @@ use Thelia\Tools\URL;
/**
* Class Configuration
* @package FedEx\Controller
* @author Laurent LE CORRE <laurent@thecoredev.fr>
* @package DHL\Controller
* @author Thomas Arnaud <tarnaud@openstudio.fr>
*/
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'));
}
}

View File

@@ -1,9 +1,9 @@
<?php
namespace FedEx\Controller;
namespace DHL\Controller;
use FedEx\FedEx;
use FedEx\Model\Config\FedExConfigValue;
use DHL\DHL;
use DHL\Model\Config\DHLConfigValue;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Thelia\Model\AreaQuery;
use Thelia\Controller\Admin\BaseAdminController;
@@ -11,8 +11,8 @@ use Thelia\Tools\URL;
/**
* Class EditPrices
* @package FedEx\Controller
* @author Laurent LE CORRE <laurent@thecoredev.fr>
* @package DHL\Controller
* @author Thelia <info@thelia.net>
*/
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'));
}
}

204
local/modules/DHL/DHL.php Normal file
View File

@@ -0,0 +1,204 @@
<?php
namespace DHL;
use DHL\Model\Config\DHLConfigValue;
use DHL\Model\DHLDeliveryPrice;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Core\Translation\Translator;
use Thelia\Exception\TheliaProcessException;
use Thelia\Install\Database;
use Thelia\Model\Area;
use Thelia\Model\AreaDeliveryModule;
use Thelia\Model\AreaQuery;
use Thelia\Model\Country;
use Thelia\Model\CountryArea;
use Thelia\Model\CountryQuery;
use Thelia\Model\Currency;
use Thelia\Module\AbstractDeliveryModule;
use Thelia\Module\Exception\DeliveryException;
class DHL extends AbstractDeliveryModule
{
protected $request;
protected $dispatcher;
private static $prices = null;
const DOMAIN_NAME = 'dhl';
const JSON_PRICE_RESOURCE = "/Config/prices.json";
const WEBSERVICE_URL = 'tracking_url';
public static function getPrices()
{
if (null === self::$prices) {
self::$prices = json_decode(DHL::getConfigValue(DHLConfigValue::PRICES, null), true);
}
return self::$prices;
}
public function postActivation(ConnectionInterface $con = null)
{
self::setConfigValue(DHLConfigValue::ENABLED, 1);
$database = new Database($con);
$database->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));
}
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace DHL\EventListener;
use DHL\DHL;
use DHL\Model\Config\DHLConfigValue;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\Area\AreaDeleteEvent;
use Thelia\Core\Event\TheliaEvents;
/**
* Class AreaDeletedListener
* @package AreaDeletedListener\EventListener
* @author Thomas Arnaud <tarnaud@openstudio.fr>
*/
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
]
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace DHL\Form;
use DHL\DHL;
use DHL\Model\Config\Base\DHLConfigValue;
use Thelia\Core\Translation\Translator;
use Thelia\Form\BaseForm;
/**
* Class Configuration
* @package DHL\Form
* @author Laurent LE CORRE <laurent@thecoredev.fr>
*/
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)
]
]
);
}
}

View File

@@ -1,14 +1,14 @@
<?php
namespace FedEx\Hook;
namespace DHL\Hook;
use Thelia\Core\Event\Hook\HookRenderEvent;
use Thelia\Core\Hook\BaseHook;
/**
* Class HookManager
* @package FedEx\Hook
* @author Laurent LE CORRE <laurent@thecoredev.fr>
* @package DHL\Hook
* @author Thomas Arnaud <tarnaud@openstudio.fr>
*/
class HookManager extends BaseHook
{

View File

@@ -0,0 +1,25 @@
<?php
return [
'*If you choose this option, the exported orders would not be available on this page anymore' => '*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)',
];

View File

@@ -0,0 +1,36 @@
<?php
return array(
'*If you choose this option, the exported orders would not be available on this page anymore' => '*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'
);

View File

@@ -0,0 +1,37 @@
<?php
return [
'*If you choose this option, the exported orders would not be available on this page anymore' => '* 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 dexpé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)',
];

View File

@@ -0,0 +1,13 @@
<?php
return [
'Actions' => 'Azioni',
'Cancel' => 'Annulla',
'Create' => 'Creare',
'Date' => 'Data',
'Delete' => 'Cancellare',
'Edit' => 'Modifica',
'Export' => 'Esporta',
'Number of packages' => 'Numero di pacchetti',
'Packages weight' => 'Peso pacchi',
];

View File

@@ -0,0 +1,34 @@
<?php
return [
'*If you choose this option, the exported orders would not be available on this page anymore' => '* 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)',
];

View File

@@ -0,0 +1,14 @@
<?php
return [
'Activate free shipping: ' => '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',
];

View File

@@ -0,0 +1,14 @@
<?php
return array(
'Activate free shipping: ' => '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',
);

View File

@@ -0,0 +1,14 @@
<?php
return [
'Activate free shipping: ' => '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.',
];

View File

@@ -0,0 +1,14 @@
<?php
return [
'Activate free shipping: ' => 'Ü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',
];

View File

@@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
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.

View File

@@ -0,0 +1,123 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace DHL\Listener;
use DHL\DHL;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\Order\OrderEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Template\ParserInterface;
use Thelia\Log\Tlog;
use Thelia\Mailer\MailerFactory;
use Thelia\Model\ConfigQuery;
use Thelia\Model\MessageQuery;
use Thelia\Model\OrderStatus;
use Thelia\Module\PaymentModuleInterface;
/**
* Class SendMail
* @package DHL\Listener
* @author Manuel Raynaud <manu@raynaud.io>
*/
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)
);
}
}

View File

@@ -1,8 +1,17 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace DHL\Loop;
namespace FedEx\Loop;
use FedEx\FedEx;
use DHL\DHL;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResultRow;
@@ -12,8 +21,8 @@ use Thelia\Core\Translation\Translator;
/**
* Class CheckRightsLoop
* @package FedEx\Loop
* @author Laurent LE CORRE <laurent@thecoredev.fr>
* @package DHL\Looop
* @author Thelia <info@thelia.net>
*/
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
);
}

View File

@@ -1,8 +1,18 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace FedEx\Loop;
namespace DHL\Loop;
use FedEx\Model\FedExQuery;
use DHL\Model\DHLQuery;
use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
@@ -10,7 +20,7 @@ use Thelia\Core\Template\Loop\Order;
/**
* Class NotSendLoop
* @package FedEx\Loop
* @package DHL\Loop
* @author Manuel Raynaud <manu@raynaud.io>
*/
class NotSendLoop extends Order
@@ -59,6 +69,6 @@ class NotSendLoop extends Order
*/
public function buildModelCriteria()
{
return FedExQuery::getOrders();
return DHLQuery::getOrders();
}
}

View File

@@ -1,8 +1,18 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace FedEx\Loop;
namespace DHL\Loop;
use FedEx\FedEx;
use DHL\DHL;
use Thelia\Core\Template\Element\ArraySearchLoopInterface;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
@@ -16,7 +26,7 @@ use Thelia\Core\Template\Loop\Argument\Argument;
*
*
* Class Price
* @package FedEx\Loop
* @package DHL\Loop
* @author Etienne Roudeix <eroudeix@openstudio.fr>
*/
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();

View File

@@ -0,0 +1,14 @@
<?php
namespace DHL\Model\Config\Base;
/**
* Class DHL
* @package DHL\Model\Config\Base
* @author Laurent LE CORRE <laurent@thecoredev.fr>
*/
class DHLConfigValue
{
const PRICES = "prices";
const TRACKING_URL = "tracking_url";
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,563 @@
<?php
namespace DHL\Model\Base;
use \Exception;
use \PDO;
use DHL\Model\DHLDeliveryPrice as ChildDHLDeliveryPrice;
use DHL\Model\DHLDeliveryPriceQuery as ChildDHLDeliveryPriceQuery;
use DHL\Model\Map\DHLDeliveryPriceTableMap;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\ModelCriteria;
use Propel\Runtime\ActiveQuery\ModelJoin;
use Propel\Runtime\Collection\ObjectCollection;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\Exception\PropelException;
use Thelia\Model\Area;
/**
* Base class that represents a query for the 'dhl_delivery_price' table.
*
*
*
* @method ChildDHLDeliveryPriceQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildDHLDeliveryPriceQuery orderByMaxWeight($order = Criteria::ASC) Order by the max_weight column
* @method ChildDHLDeliveryPriceQuery orderByPriceWithTax($order = Criteria::ASC) Order by the price_with_tax column
* @method ChildDHLDeliveryPriceQuery orderByAreaId($order = Criteria::ASC) Order by the area_id column
*
* @method ChildDHLDeliveryPriceQuery groupById() Group by the id column
* @method ChildDHLDeliveryPriceQuery groupByMaxWeight() Group by the max_weight column
* @method ChildDHLDeliveryPriceQuery groupByPriceWithTax() Group by the price_with_tax column
* @method ChildDHLDeliveryPriceQuery groupByAreaId() Group by the area_id column
*
* @method ChildDHLDeliveryPriceQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildDHLDeliveryPriceQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ChildDHLDeliveryPriceQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ChildDHLDeliveryPriceQuery leftJoinArea($relationAlias = null) Adds a LEFT JOIN clause to the query using the Area relation
* @method ChildDHLDeliveryPriceQuery rightJoinArea($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Area relation
* @method ChildDHLDeliveryPriceQuery innerJoinArea($relationAlias = null) Adds a INNER JOIN clause to the query using the Area relation
*
* @method ChildDHLDeliveryPrice findOne(ConnectionInterface $con = null) Return the first ChildDHLDeliveryPrice matching the query
* @method ChildDHLDeliveryPrice findOneOrCreate(ConnectionInterface $con = null) Return the first ChildDHLDeliveryPrice matching the query, or a new ChildDHLDeliveryPrice object populated from the query conditions when no match is found
*
* @method ChildDHLDeliveryPrice findOneById(int $id) Return the first ChildDHLDeliveryPrice filtered by the id column
* @method ChildDHLDeliveryPrice findOneByMaxWeight(string $max_weight) Return the first ChildDHLDeliveryPrice filtered by the max_weight column
* @method ChildDHLDeliveryPrice findOneByPriceWithTax(string $price_with_tax) Return the first ChildDHLDeliveryPrice filtered by the price_with_tax column
* @method ChildDHLDeliveryPrice findOneByAreaId(int $area_id) Return the first ChildDHLDeliveryPrice filtered by the area_id column
*
* @method array findById(int $id) Return ChildDHLDeliveryPrice objects filtered by the id column
* @method array findByMaxWeight(string $max_weight) Return ChildDHLDeliveryPrice objects filtered by the max_weight column
* @method array findByPriceWithTax(string $price_with_tax) Return ChildDHLDeliveryPrice objects filtered by the price_with_tax column
* @method array findByAreaId(int $area_id) Return ChildDHLDeliveryPrice objects filtered by the area_id column
*
*/
abstract class DHLDeliveryPriceQuery extends ModelCriteria
{
/**
* Initializes internal state of \DHL\Model\Base\DHLDeliveryPriceQuery object.
*
* @param string $dbName The database name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = 'thelia', $modelName = '\\DHL\\Model\\DHLDeliveryPrice', $modelAlias = null)
{
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ChildDHLDeliveryPriceQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param Criteria $criteria Optional Criteria to build the query from
*
* @return ChildDHLDeliveryPriceQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \DHL\Model\DHLDeliveryPriceQuery) {
return $criteria;
}
$query = new \DHL\Model\DHLDeliveryPriceQuery();
if (null !== $modelAlias) {
$query->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.
*
* <code>
* $obj = $c->findPk(12, $con);
* </code>
*
* @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
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @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:
* <code>
* $query->filterById(1234); // WHERE id = 1234
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
* $query->filterById(array('min' => 12)); // WHERE id > 12
* </code>
*
* @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:
* <code>
* $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
* </code>
*
* @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:
* <code>
* $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
* </code>
*
* @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:
* <code>
* $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
* </code>
*
* @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

View File

@@ -0,0 +1,9 @@
<?php
namespace DHL\Model\Config;
use DHL\Model\Config\Base\DHLConfigValue as BaseDHLConfigValue;
class DHLConfigValue extends BaseDHLConfigValue
{
}

View File

@@ -0,0 +1,426 @@
<?php
namespace DHL\Model\Map;
use DHL\Model\DHLDeliveryPriceQuery;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
use Propel\Runtime\Connection\ConnectionInterface;
use Propel\Runtime\DataFetcher\DataFetcherInterface;
use Propel\Runtime\Exception\PropelException;
use Propel\Runtime\Map\RelationMap;
use Propel\Runtime\Map\TableMap;
use Propel\Runtime\Map\TableMapTrait;
/**
* This class defines the structure of the 'dhl_delivery_price' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
*/
class DHLDeliveryPriceTableMap extends TableMap
{
use InstancePoolTrait;
use TableMapTrait;
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'DHL.Model.Map.DHLDeliveryPriceTableMap';
/**
* The default database name for this class
*/
const DATABASE_NAME = 'thelia';
/**
* The table name for this class
*/
const TABLE_NAME = 'dhl_delivery_price';
/**
* The related Propel class for this table
*/
const OM_CLASS = '\\DHL\\Model\\DHLDeliveryPrice';
/**
* A class that can be returned by this tableMap
*/
const CLASS_DEFAULT = 'DHL.Model.DHLDeliveryPrice';
/**
* The total number of columns
*/
const NUM_COLUMNS = 4;
/**
* The number of lazy-loaded columns
*/
const NUM_LAZY_LOAD_COLUMNS = 0;
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 4;
/**
* the column name for the ID field
*/
const ID = 'dhl_delivery_price.ID';
/**
* the column name for the MAX_WEIGHT field
*/
const MAX_WEIGHT = 'dhl_delivery_price.MAX_WEIGHT';
/**
* the column name for the PRICE_WITH_TAX field
*/
const PRICE_WITH_TAX = 'dhl_delivery_price.PRICE_WITH_TAX';
/**
* the column name for the AREA_ID field
*/
const AREA_ID = 'dhl_delivery_price.AREA_ID';
/**
* The default string format for model objects of the related table
*/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => 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();

View File

@@ -0,0 +1,10 @@
<?php
namespace DHL\Model;
use DHL\Model\Base\DHLDeliveryPrice as BaseDHLDeliveryPrice;
class DHLDeliveryPrice extends BaseDHLDeliveryPrice
{
}

View File

@@ -0,0 +1,11 @@
<?php
namespace DHL\Model;
use DHL\Model\Base\DHLDeliveryPriceQuery as BaseDHLDeliveryPriceQuery;
class DHLDeliveryPriceQuery extends BaseDHLDeliveryPriceQuery
{
}

View File

@@ -1,19 +1,19 @@
<?php
namespace FedEx\Model;
namespace DHL\Model;
use FedEx\FedEx;
use DHL\DHL;
use Propel\Runtime\ActiveQuery\Criteria;
use Thelia\Model\OrderQuery;
use Thelia\Model\OrderStatus;
use Thelia\Model\OrderStatusQuery;
/**
* Class FedExQuery
* @package FedEx\Model
* Class DHLQuery
* @package DHL\Model
* @author Laurent LE CORRE <laurent@thecoredev.fr>
*/
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'],

View File

@@ -1,30 +1,29 @@
<div class="row">
<!-- Errors -->
{loop name="checkrights.fedex" type="fedex.check.rights"}
{loop name="checkrights.dhl" type="dhl.check.rights"}
<div class="alert alert-danger">
<p>{$ERRMES} {$ERRFILE} | {intl d='fedex.bo.default' l="Please change the access rights"}.</p>
<p>{$ERRMES} {$ERRFILE} | {intl d='dhl.bo.default' l="Please change the access rights"}.</p>
</div>
{/loop}
</div>
{elseloop rel="checkrights.fedex"}
{elseloop rel="checkrights.dhl"}
<div class="alert alert-info">
<p>{intl d='fedex.bo.default' l="FedEx Module allows to send your products all around the world with FedEx."}</p>
<p>{intl d='dhl.bo.default' l="DHL Module allows to send your products all around the world."}</p>
</div>
<div class="general-block-decorator">
<div class="row">
<div class="col-md-12">
{form name="fedex.configuration"}
<form method="POST" action="{url path='/admin/module/fedex/configuration/update'}">
{form name="dhl.configuration"}
<form method="POST" action="{url path='/admin/module/dhl/configuration/update'}">
{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}
<button type="submit" name="fedex_save_configuration" value="save" class="form-submit-button btn btn-sm btn-default" title="{intl d='fedex.bo.default' l='Save'}">
{intl d='fedex.bo.default' l='Save'}
{render_form_field field="tracking_url" value={module_config module="DHL" key='tracking_url' locale="fr_FR"}}
<button type="submit" name="dhl_save_configuration" value="save" class="form-submit-button btn btn-sm btn-default" title="{intl d='dhl.bo.default' l='Save'}">
{intl d='dhl.bo.default' l='Save'}
</button>
</form>
{/form}
@@ -35,16 +34,10 @@
<div class="general-block-decorator">
<div class="row">
<div class="col-md-12">
<!-- Tab menu -->
<ul id="tabbed-menu" class="nav nav-tabs">
<li class="{if $tab eq "1"}active{/if}"><a data-toggle="tab" href="#prices_slices_tab">{intl d='fedex.bo.default' l="Price slices"}</a></li>
</ul>
<div class="tab-content">
<div id="prices_slices_tab" class="tab-pane {if $tab eq 1}active{/if} form-container">
<div id="table-prices-fedex">
<div id="prices_slices_tab" class="tab-pane active form-container">
<div id="table-prices-dhl">
<!-- Prices editing -->
{* -- 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 = "<input type=\"hidden\" name=\"operation\" value=\"add\"/>
<input type=\"hidden\" name=\"area\" value=\"{$ID}\" />
<label for=\"weight_{$ID}\">{intl d='fedex.bo.default' l="Weight up to ... (kg)"}</label></label>
<label for=\"weight_{$ID}\">{intl d='dhl.bo.default' l="Weight up to ... (kg)"}</label></label>
<input type=\"number\" step=\"0.01\" id=\"weight_{$ID}\" name=\"weight\" value=\"1\" class=\"form-control\" pattern=\"\d+\.?\d*\" required/>
<label for=\"price_{$ID}\">{intl d='fedex.bo.default' l="Price (€)"}</label></label>
<label for=\"price_{$ID}\">{intl d='dhl.bo.default' l="Price (€)"}</label></label>
<input type=\"number\" step=\"0.01\" id=\"price_{$ID}\" name=\"price\" value=\"1\" class=\"form-control\" pattern=\"\d+\.?\d*\" required/>"
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"}
}
<div class="table-responsive">
<table class="table table-striped table-condensed table-left-aligned">
<caption class="clearfix">
{intl d='fedex.bo.default' l="Area : "}{$NAME}
{loop type="auth" name="can_create" role="ADMIN" module="fedex" access="CREATE"}
<a class="btn btn-default btn-primary pull-right" title="{intl d='fedex.bo.default' l='Create a new price slice'}" href="#price_slice_create_dialog_{$ID}" data-toggle="modal">
{intl d='dhl.bo.default' l="Area : "}{$NAME}
{loop type="auth" name="can_create" role="ADMIN" module="dhl" access="CREATE"}
<a class="btn btn-default btn-primary pull-right" title="{intl d='dhl.bo.default' l='Create a new price slice'}" href="#price_slice_create_dialog_{$ID}" data-toggle="modal">
<span class="glyphicon glyphicon-plus"></span>
</a>
{/loop}
</caption>
<thead>
<tr>
<th class="col-md-3">{intl d='fedex.bo.default' l="Weight up to ... (kg)"}</th>
<th class="col-md-5">{intl d='fedex.bo.default' l="Price (€)"}</th>
<th class="col-md-1">{intl d='fedex.bo.default' l="Actions"}</th>
<th class="col-md-3">{intl d='dhl.bo.default' l="Weight up to ... (kg)"}</th>
<th class="col-md-5">{intl d='dhl.bo.default' l="Price (€)"}</th>
<th class="col-md-1">{intl d='dhl.bo.default' l="Actions"}</th>
</tr>
</thead>
<tbody>
{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 = "<input type=\"hidden\" name=\"operation\" value=\"add\"/>
<input type=\"hidden\" name=\"area\" value=\"{$ID}\"/>
<input type=\"hidden\" name=\"weight\" value=\"{$MAX_WEIGHT}\"/>
<label for=\"price_edit_{$ID}_{$MAX_WEIGHT}\">{intl d='fedex.bo.default' l='Price (€)'}</label>
<label for=\"price_edit_{$ID}_{$MAX_WEIGHT}\">{intl d='dhl.bo.default' l='Price (€)'}</label>
<input type=\"number\" step=\"0.01\" id=\"price_edit_{$ID}_{$MAX_WEIGHT}\" class=\"form-control\" name=\"price\" value=\"{$PRICE}\" pattern=\"\d+\.?\d*\" required/>"
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 = "<input type=\"hidden\" name=\"operation\" value=\"delete\"/>
<input type=\"hidden\" name=\"area\" value=\"{$ID}\"/>
<input type=\"hidden\" name=\"weight\" value=\"{$MAX_WEIGHT}\"/>
{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"}
}
<tr>
@@ -121,11 +114,11 @@
<td>{$PRICE}</td>
<td>
<div class="btn-group">
{loop type="auth" name="can_change" role="ADMIN" module="fedex" access="UPDATE"}
<a class="btn btn-default btn-xs" title="{intl d='fedex.bo.default' l='Edit this price slice'}" href="#price_slice_edit_dialog_{$ID}_{$MAX_WEIGHT|replace:'.':'-'}" data-toggle="modal">
{loop type="auth" name="can_change" role="ADMIN" module="dhl" access="UPDATE"}
<a class="btn btn-default btn-xs" title="{intl d='dhl.bo.default' l='Edit this price slice'}" href="#price_slice_edit_dialog_{$ID}_{$MAX_WEIGHT|replace:'.':'-'}" data-toggle="modal">
<span class="glyphicon glyphicon-edit"></span>
</a>
<a class="btn btn-default btn-xs" title="{intl d='fedex.bo.default' l='Delete this price slice'}" href="#price_slice_delete_dialog_{$ID}_{$MAX_WEIGHT|replace:'.':'-'}" data-toggle="modal">
<a class="btn btn-default btn-xs" title="{intl d='dhl.bo.default' l='Delete this price slice'}" href="#price_slice_delete_dialog_{$ID}_{$MAX_WEIGHT|replace:'.':'-'}" data-toggle="modal">
<span class="glyphicon glyphicon-trash"></span>
</a>
{/loop}

View File

@@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<config xmlns="http://thelia.net/schema/dic/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
<loops>
<loop class="FedEx\Loop\Price" name="fedex"/>
<loop class="FedEx\Loop\CheckRightsLoop" name="fedex.check.rights" />
<loop class="FedEx\Loop\NotSendLoop" name="fedex.notsend.loop" />
</loops>
<forms>
<form name="fedex.configuration" class="FedEx\Form\Configuration" />
</forms>
<services>
<service id="send.fedex.mail" class="FedEx\Listener\SendMail">
<argument type="service" id="thelia.parser" />
<argument type="service" id="mailer"/>
<tag name="kernel.event_subscriber"/>
</service>
</services>
<hooks>
<hook id="fedex.hook" class="FedEx\Hook\HookManager">
<tag name="hook.event_listener" event="module.configuration" type="back" method="onModuleConfiguration" />
</hook>
</hooks>
</config>

View File

@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
<route id="fedex.edit.prices" path="/admin/module/fedex/prices" methods="post">
<default key="_controller">FedEx\Controller\EditPrices::editprices</default>
</route>
<route id="fedex.configuration" path="/admin/module/fedex/configuration/update" methods="post">
<default key="_controller">FedEx\Controller\Configuration::editConfiguration</default>
</route>
</routes>

View File

@@ -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.',
'<p>{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}Dear {$FIRSTNAME} {$LASTNAME},</p>{/loop}\r\n<p>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"}.</p><p>Your order has been shipped on {format_date date=$update_date}.Please check the FedEx website for tracking your parcel using this link : <a href={$tracking_url}{$package}>{$tracking_url}{$package}</a></p><p>Feel free to contact us for any further information,</p><p>Best Regards.</p>'
),
(@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',
'<p>{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}\r\nCher/chère {$LASTNAME} {$FIRSTNAME},</p>{/loop}\r\n<p>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"}.</p><br><p>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 : <a href={$tracking_url}{$package}>{$tracking_url}{$package}</a></p><p>Nous restons à votre disposition pour toute information complémentaire.</p><p>Cordialement</p>'
);
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -1,143 +0,0 @@
<?php
namespace FedEx;
use FedEx\Model\Config\FedExConfigValue;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Core\Translation\Translator;
use Thelia\Install\Database;
use Thelia\Model\Country;
use Thelia\Model\State;
use Thelia\Module\AbstractDeliveryModule;
use Thelia\Module\Exception\DeliveryException;
class FedEx extends AbstractDeliveryModule
{
const DOMAIN_NAME = 'fedex';
protected $request;
protected $dispatcher;
const TRACKING_URL_PARAMETER = 'tracking_url';
const DEFAULT_TRACKING_URL = "https://www.fedex.com/apps/fedextrack/?action=track&trackingnumber=";
private static $prices = null;
const JSON_PRICE_RESOURCE = "/Config/prices.json";
public static function getPrices()
{
if (null === self::$prices) {
self::$prices = json_decode(FedEx::getConfigValue(FedExConfigValue::PRICES, null), true);
}
return self::$prices;
}
public function postActivation(ConnectionInterface $con = null)
{
self::setConfigValue(FedEx::TRACKING_URL_PARAMETER, FedEx::DEFAULT_TRACKING_URL);
$database = new Database($con);
$database->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;
}
}

View File

@@ -1,33 +0,0 @@
<?php
namespace FedEx\Form;
use FedEx\FedEx;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Form\BaseForm;
/**
* Class Configuration
* @package FedEx\Form
* @author Laurent LE CORRE <laurent@thecoredev.fr>
*/
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)
]
]
);
}
}

View File

@@ -1,23 +0,0 @@
<?php
return array(
'Actions' => '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)',
);

View File

@@ -1,25 +0,0 @@
<?php
return array(
'Actions' => '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 dexpé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)',
);

View File

@@ -1,12 +0,0 @@
<?php
return array(
'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',
'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 =',
);

View File

@@ -1,12 +0,0 @@
<?php
return array(
'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',
'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 =',
);

View File

@@ -1,90 +0,0 @@
<?php
namespace FedEx\Listener;
use FedEx\FedEx;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\Order\OrderEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Template\ParserInterface;
use Thelia\Log\Tlog;
use Thelia\Mailer\MailerFactory;
use Thelia\Model\ConfigQuery;
/**
* Class SendMail
* @package FedEx\Listener
* @author Laurent LE CORRE <laurent@thecoredev.fr>
*/
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)
);
}
}

View File

@@ -1,9 +0,0 @@
<?php
namespace FedEx\Model\Config\Base;
class FedExConfigValue
{
const PRICES = "prices";
const TRACKING_URL = "https://www.fedex.com/apps/fedextrack/?action=track&trackingnumber=";
}

View File

@@ -1,9 +0,0 @@
<?php
namespace FedEx\Model\Config;
use FedEx\Model\Config\Base\FedExConfigValue as BaseFedExConfigValue;
class FedExConfigValue extends BaseFedExConfigValue
{
}

View File

@@ -24,8 +24,7 @@ require __DIR__ . '/../core/vendor/autoload.php';
$trustedIp = array(
'::1',
'127.0.0.1',
'86.210.177.11',
'2a01:e35:2e5e:8350:1b3:4491:7fdf:6bcc'
'86.210.176.132'
);
$request = Request::createFromGlobals();