Ca avance pas mal sur DHL...
This commit is contained in:
@@ -1,425 +0,0 @@
|
|||||||
{
|
|
||||||
"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
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -7,12 +7,12 @@
|
|||||||
<descriptive locale="fr_FR">
|
<descriptive locale="fr_FR">
|
||||||
<title>Livraison par DHL</title>
|
<title>Livraison par DHL</title>
|
||||||
</descriptive>
|
</descriptive>
|
||||||
<version>2.3.3</version>
|
<version>1.0.0</version>
|
||||||
<author>
|
<author>
|
||||||
<name>Laurent LE CORRE</name>
|
<name>Laurent LE CORRE</name>
|
||||||
<email>laurent@thecoredev.fr</email>
|
<email>laurent@thecoredev.fr</email>
|
||||||
</author>
|
</author>
|
||||||
<type>delivery</type>
|
<type>delivery</type>
|
||||||
<thelia>1.0.0</thelia>
|
<thelia>2.3.3</thelia>
|
||||||
<stability>alpha</stability>
|
<stability>alpha</stability>
|
||||||
</module>
|
</module>
|
||||||
|
|||||||
@@ -7,14 +7,6 @@
|
|||||||
<default key="_controller">DHL\Controller\EditPrices::editprices</default>
|
<default key="_controller">DHL\Controller\EditPrices::editprices</default>
|
||||||
</route>
|
</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">
|
<route id="dhl.configuration" path="/admin/module/dhl/configuration/update" methods="post">
|
||||||
<default key="_controller">DHL\Controller\Configuration::editConfiguration</default>
|
<default key="_controller">DHL\Controller\Configuration::editConfiguration</default>
|
||||||
</route>
|
</route>
|
||||||
|
|||||||
@@ -28,5 +28,24 @@ INSERT INTO `message_i18n` (`id`, `locale`, `title`, `subject`, `text_message`,
|
|||||||
(@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, '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');
|
(@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');
|
||||||
|
|
||||||
|
|
||||||
|
-- Create the table to store shipping prices.
|
||||||
|
DROP TABLE IF EXISTS `dhl_delivery_price`;
|
||||||
|
|
||||||
|
CREATE TABLE `dhl_delivery_price`
|
||||||
|
(
|
||||||
|
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||||
|
`max_weight` DECIMAL(16,6) DEFAULT 0.000000 NOT NULL,
|
||||||
|
`price_with_tax` DECIMAL(16,6) DEFAULT 0.000000 NOT NULL,
|
||||||
|
`area_id` INTEGER NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
INDEX `fi_dhl_delivery_price_area_id` (`area_id`),
|
||||||
|
CONSTRAINT `fk_dhl_delivery_price_area_id`
|
||||||
|
FOREIGN KEY (`area_id`)
|
||||||
|
REFERENCES `area` (`id`)
|
||||||
|
ON UPDATE RESTRICT
|
||||||
|
ON DELETE CASCADE
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
# This restores the fkey checks, after having unset them earlier
|
# This restores the fkey checks, after having unset them earlier
|
||||||
SET FOREIGN_KEY_CHECKS = 1;
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
@@ -2,10 +2,15 @@
|
|||||||
|
|
||||||
namespace DHL\Controller;
|
namespace DHL\Controller;
|
||||||
|
|
||||||
use DHL\DHL;
|
use DHL\Model\Map\DHLDeliveryPriceTableMap;
|
||||||
use DHL\Model\Config\DHLConfigValue;
|
use DHL\Model\DHLDeliveryPrice;
|
||||||
|
use DHL\Model\DHLDeliveryPriceQuery;
|
||||||
|
use Propel\Runtime\Connection\ConnectionInterface;
|
||||||
|
use Propel\Runtime\Propel;
|
||||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||||
use Thelia\Model\AreaQuery;
|
use Thelia\Core\Security\AccessManager;
|
||||||
|
use Thelia\Core\Security\Resource\AdminResources;
|
||||||
|
use Thelia\Log\Tlog;
|
||||||
use Thelia\Controller\Admin\BaseAdminController;
|
use Thelia\Controller\Admin\BaseAdminController;
|
||||||
use Thelia\Tools\URL;
|
use Thelia\Tools\URL;
|
||||||
|
|
||||||
@@ -16,54 +21,6 @@ use Thelia\Tools\URL;
|
|||||||
*/
|
*/
|
||||||
class EditPrices extends BaseAdminController
|
class EditPrices extends BaseAdminController
|
||||||
{
|
{
|
||||||
public function editprices()
|
|
||||||
{
|
|
||||||
// Get data & treat
|
|
||||||
$post = $this->getRequest();
|
|
||||||
$operation = $post->get('operation');
|
|
||||||
$area = $post->get('area');
|
|
||||||
$weight = $post->get('weight');
|
|
||||||
$price = $post->get('price');
|
|
||||||
|
|
||||||
if (preg_match("#^add|delete$#", $operation) &&
|
|
||||||
preg_match("#^\d+$#", $area) &&
|
|
||||||
preg_match("#^\d+\.?\d*$#", $weight)
|
|
||||||
) {
|
|
||||||
// check if area exists in db
|
|
||||||
$exists = AreaQuery::create()
|
|
||||||
->findPK($area);
|
|
||||||
if ($exists !== null) {
|
|
||||||
|
|
||||||
if (null !== $data = DHL::getConfigValue(DHLConfigValue::PRICES, null)) {
|
|
||||||
$json_data = json_decode(
|
|
||||||
$data,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if ((float) $weight > 0 && $operation == "add"
|
|
||||||
&& preg_match("#\d+\.?\d*#", $price)) {
|
|
||||||
$json_data[$area]['slices'][$weight] = $price;
|
|
||||||
} elseif ($operation == "delete") {
|
|
||||||
if (isset($json_data[$area]['slices'][$weight])) {
|
|
||||||
unset($json_data[$area]['slices'][$weight]);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new \Exception("Weight must be superior to 0");
|
|
||||||
}
|
|
||||||
ksort($json_data[$area]['slices']);
|
|
||||||
|
|
||||||
DHL::setConfigValue(DHLConfigValue::PRICES, json_encode($json_data));
|
|
||||||
|
|
||||||
} else {
|
|
||||||
throw new \Exception("Area not found");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new \ErrorException("Arguments are missing or invalid");
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->redirectToConfigurationPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redirect to the configuration page
|
* Redirect to the configuration page
|
||||||
*/
|
*/
|
||||||
@@ -71,4 +28,95 @@ class EditPrices extends BaseAdminController
|
|||||||
{
|
{
|
||||||
return RedirectResponse::create(URL::getInstance()->absoluteUrl('/admin/module/DHL'));
|
return RedirectResponse::create(URL::getInstance()->absoluteUrl('/admin/module/DHL'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function editprices()
|
||||||
|
{
|
||||||
|
// Get data & treat
|
||||||
|
$post = $this->getRequest();
|
||||||
|
$operation = $post->get('operation');
|
||||||
|
|
||||||
|
$area = $post->get('area');
|
||||||
|
$module_id = $post->get('module_id');
|
||||||
|
$weight = $post->get('weight');
|
||||||
|
$price = $post->get('price');
|
||||||
|
$price_id = $post->get('price_id');
|
||||||
|
|
||||||
|
$con = Propel::getServiceContainer()->getReadConnection(DHLDeliveryPriceTableMap::DATABASE_NAME);
|
||||||
|
|
||||||
|
switch ($operation) {
|
||||||
|
case "add" :
|
||||||
|
$this->createAction($con, $module_id, $area, $weight, $price);
|
||||||
|
break;
|
||||||
|
case "update" :
|
||||||
|
$this->updateAction($con, $module_id, $price_id, $price);
|
||||||
|
break;
|
||||||
|
case "delete" :
|
||||||
|
$this->deleteAction($con, $module_id, $price_id);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirectToConfigurationPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function updateAction(ConnectionInterface $con, $moduleId, $priceId, $price)
|
||||||
|
{
|
||||||
|
if (null !== $response = $this->checkAuth(AdminResources::MODULE, 'DHL', AccessManager::UPDATE)) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
$errorMessage = false;
|
||||||
|
try {
|
||||||
|
DHLDeliveryPriceQuery::create()->filterById($priceId)
|
||||||
|
->update(['PriceWithTax' => $price],
|
||||||
|
$con);
|
||||||
|
} catch (\Exception $ex) {
|
||||||
|
$errorMessage = $ex->getMessage();
|
||||||
|
Tlog::getInstance()->error("Failed to update price : $errorMessage");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render('module_configuration', [
|
||||||
|
'module_id' => $moduleId,
|
||||||
|
'error_message' => $errorMessage
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function createAction(ConnectionInterface $con, $moduleId, $areaId, $weight, $price)
|
||||||
|
{
|
||||||
|
if (null !== $response = $this->checkAuth(AdminResources::MODULE, 'DHL', AccessManager::UPDATE)) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
$errorMessage = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
(new DHLDeliveryPrice())
|
||||||
|
->setAreaId($areaId)
|
||||||
|
->setPriceWithTax($price)
|
||||||
|
->setMaxWeight($weight)
|
||||||
|
->save();
|
||||||
|
} catch (\Exception $ex) {
|
||||||
|
$errorMessage = $ex->getMessage();
|
||||||
|
Tlog::getInstance()->error("Failed to add price : $errorMessage");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render('module_configuration', [
|
||||||
|
'module_id' => $moduleId,
|
||||||
|
'error_message' => $errorMessage
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function deleteAction(ConnectionInterface $con, $moduleId, $priceId)
|
||||||
|
{
|
||||||
|
if (null !== $response = $this->checkAuth(AdminResources::MODULE, 'DHL', AccessManager::DELETE)) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
DHLDeliveryPriceQuery::create()->filterById($priceId)->delete();
|
||||||
|
|
||||||
|
return $this->render('module_configuration', [ 'module_id' => $moduleId ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ namespace DHL;
|
|||||||
|
|
||||||
use DHL\Model\Config\DHLConfigValue;
|
use DHL\Model\Config\DHLConfigValue;
|
||||||
use DHL\Model\DHLDeliveryPrice;
|
use DHL\Model\DHLDeliveryPrice;
|
||||||
|
use DHL\Model\DHLDeliveryPriceQuery;
|
||||||
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
use Propel\Runtime\Connection\ConnectionInterface;
|
use Propel\Runtime\Connection\ConnectionInterface;
|
||||||
use Thelia\Core\Translation\Translator;
|
use Thelia\Core\Translation\Translator;
|
||||||
use Thelia\Exception\TheliaProcessException;
|
use Thelia\Exception\TheliaProcessException;
|
||||||
@@ -14,7 +16,6 @@ use Thelia\Model\AreaQuery;
|
|||||||
use Thelia\Model\Country;
|
use Thelia\Model\Country;
|
||||||
use Thelia\Model\CountryArea;
|
use Thelia\Model\CountryArea;
|
||||||
use Thelia\Model\CountryQuery;
|
use Thelia\Model\CountryQuery;
|
||||||
use Thelia\Model\Currency;
|
|
||||||
use Thelia\Module\AbstractDeliveryModule;
|
use Thelia\Module\AbstractDeliveryModule;
|
||||||
use Thelia\Module\Exception\DeliveryException;
|
use Thelia\Module\Exception\DeliveryException;
|
||||||
|
|
||||||
@@ -29,10 +30,11 @@ class DHL extends AbstractDeliveryModule
|
|||||||
const JSON_PRICE_RESOURCE = "/Config/prices.json";
|
const JSON_PRICE_RESOURCE = "/Config/prices.json";
|
||||||
const WEBSERVICE_URL = 'tracking_url';
|
const WEBSERVICE_URL = 'tracking_url';
|
||||||
|
|
||||||
public static function getPrices()
|
public static function getPrices($areaId)
|
||||||
{
|
{
|
||||||
if (null === self::$prices) {
|
if (null === self::$prices) {
|
||||||
self::$prices = json_decode(DHL::getConfigValue(DHLConfigValue::PRICES, null), true);
|
self::$prices = DHLDeliveryPriceQuery::create()
|
||||||
|
->findByAreaId($areaId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$prices;
|
return self::$prices;
|
||||||
@@ -40,14 +42,13 @@ class DHL extends AbstractDeliveryModule
|
|||||||
|
|
||||||
public function postActivation(ConnectionInterface $con = null)
|
public function postActivation(ConnectionInterface $con = null)
|
||||||
{
|
{
|
||||||
self::setConfigValue(DHLConfigValue::ENABLED, 1);
|
self::setConfigValue(self::WEBSERVICE_URL, "https://www.dhl.com/fr-fr/home/suivi.html?tracking-id=");
|
||||||
|
|
||||||
$database = new Database($con);
|
$database = new Database($con);
|
||||||
$database->insertSql(null, array(__DIR__ . '/Config/thelia.sql'));
|
$database->insertSql(null, array(__DIR__ . '/Config/thelia.sql'));
|
||||||
|
|
||||||
// Create DHL shipping zones for relay and home delivery
|
// Create DHL shipping zones for home delivery
|
||||||
$moduleId = self::getModuleId();
|
$moduleId = self::getModuleId();
|
||||||
$rateFromEuro = Currency::getDefaultCurrency()->getRate();
|
|
||||||
$moduleConfiguration = json_decode(file_get_contents(__DIR__. '/Config/prices.json'));
|
$moduleConfiguration = json_decode(file_get_contents(__DIR__. '/Config/prices.json'));
|
||||||
if (false === $moduleConfiguration) {
|
if (false === $moduleConfiguration) {
|
||||||
throw new TheliaProcessException("Invalid JSON configuration for DHL module");
|
throw new TheliaProcessException("Invalid JSON configuration for DHL module");
|
||||||
@@ -82,34 +83,26 @@ class DHL extends AbstractDeliveryModule
|
|||||||
(new DHLDeliveryPrice())
|
(new DHLDeliveryPrice())
|
||||||
->setAreaId($area->getId())
|
->setAreaId($area->getId())
|
||||||
->setMaxWeight($price->up_to)
|
->setMaxWeight($price->up_to)
|
||||||
->setPriceWithTax($price->price_euro * $rateFromEuro)
|
->setPriceWithTax($price->price_euro)
|
||||||
->save();
|
->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isValidDelivery(Country $country)
|
public function isValidDelivery(Country $country)
|
||||||
{
|
{
|
||||||
if (0 == self::getConfigValue(DHLConfigValue::ENABLED, 1)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null !== $area = $this->getAreaForCountry($country)) {
|
if (null !== $area = $this->getAreaForCountry($country)) {
|
||||||
$areaId = $area->getId();
|
$areaId = $area->getId();
|
||||||
|
$prices = self::getPrices($areaId);
|
||||||
$prices = self::getPrices();
|
|
||||||
|
|
||||||
/* Check if DHL delivers the area */
|
/* Check if DHL delivers the area */
|
||||||
if (isset($prices[$areaId]) && isset($prices[$areaId]["slices"])) {
|
if (isset($prices)) {
|
||||||
// Yes ! Check if the cart weight is below slice limit
|
// Yes ! Check if the cart weight is below slice limit
|
||||||
$areaPrices = $prices[$areaId]["slices"];
|
$maxWeight = DHLDeliveryPriceQuery::create()
|
||||||
ksort($areaPrices);
|
->orderByMaxWeight(Criteria::DESC)
|
||||||
|
->findOneByAreaId($areaId)
|
||||||
/* Check cart weight is below the maximum weight */
|
->getMaxWeight();
|
||||||
end($areaPrices);
|
|
||||||
$maxWeight = key($areaPrices);
|
|
||||||
|
|
||||||
$cartWeight = $this->getRequest()->getSession()->getSessionCart($this->getDispatcher())->getWeight();
|
$cartWeight = $this->getRequest()->getSession()->getSessionCart($this->getDispatcher())->getWeight();
|
||||||
|
|
||||||
@@ -132,10 +125,10 @@ class DHL extends AbstractDeliveryModule
|
|||||||
public static function getPostageAmount($areaId, $weight)
|
public static function getPostageAmount($areaId, $weight)
|
||||||
{
|
{
|
||||||
$postage = 0;
|
$postage = 0;
|
||||||
$prices = self::getPrices();
|
$prices = self::getPrices($areaId);
|
||||||
|
|
||||||
/* check if DHL delivers the asked area */
|
/* check if DHL delivers the asked area */
|
||||||
if (!isset($prices[$areaId]) || !isset($prices[$areaId]["slices"])) {
|
if (!isset($prices)) {
|
||||||
throw new DeliveryException(
|
throw new DeliveryException(
|
||||||
Translator::getInstance()->trans(
|
Translator::getInstance()->trans(
|
||||||
"DHL delivery unavailable for the delivery country",
|
"DHL delivery unavailable for the delivery country",
|
||||||
@@ -145,12 +138,12 @@ class DHL extends AbstractDeliveryModule
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$areaPrices = $prices[$areaId]["slices"];
|
$maxWeight = DHLDeliveryPriceQuery::create()
|
||||||
ksort($areaPrices);
|
->orderByMaxWeight(Criteria::DESC)
|
||||||
|
->findOneByAreaId($areaId)
|
||||||
|
->getMaxWeight();
|
||||||
|
|
||||||
/* Check cart weight is below the maximum weight */
|
/* Check cart weight is below the maximum weight */
|
||||||
end($areaPrices);
|
|
||||||
$maxWeight = key($areaPrices);
|
|
||||||
if ($weight > $maxWeight) {
|
if ($weight > $maxWeight) {
|
||||||
throw new DeliveryException(
|
throw new DeliveryException(
|
||||||
Translator::getInstance()->trans(
|
Translator::getInstance()->trans(
|
||||||
@@ -161,7 +154,10 @@ class DHL extends AbstractDeliveryModule
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$postage = current($areaPrices);
|
$postageArray = DHLDeliveryPriceQuery::create()
|
||||||
|
->findByAreaId($areaId);
|
||||||
|
|
||||||
|
$postage = current($postageArray);
|
||||||
|
|
||||||
while (prev($areaPrices)) {
|
while (prev($areaPrices)) {
|
||||||
if ($weight > key($areaPrices)) {
|
if ($weight > key($areaPrices)) {
|
||||||
@@ -194,11 +190,12 @@ class DHL extends AbstractDeliveryModule
|
|||||||
return $postage;
|
return $postage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update($currentVersion, $newVersion, ConnectionInterface $con = null)
|
// public function update($currentVersion, $newVersion, ConnectionInterface $con = null)
|
||||||
{
|
// {
|
||||||
$uploadDir = __DIR__ . '/Config/prices.json';
|
// $uploadDir = __DIR__ . '/Config/prices.json';
|
||||||
if (is_readable($uploadDir) && DHL::getConfigValue(DHLConfigValue::PRICES, null) == null) {
|
// if (is_readable($uploadDir) && DHL::getConfigValue(DHLConfigValue::PRICES, null) == null) {
|
||||||
DHL::setConfigValue(DHLConfigValue::PRICES, file_get_contents($uploadDir));
|
// DHL::setConfigValue(DHLConfigValue::PRICES, file_get_contents($uploadDir));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,16 @@
|
|||||||
<?php
|
<?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 DHL\Loop;
|
||||||
|
|
||||||
use DHL\DHL;
|
use DHL\Model\DHLDeliveryPrice;
|
||||||
use Thelia\Core\Template\Element\ArraySearchLoopInterface;
|
use DHL\Model\DHLDeliveryPriceQuery;
|
||||||
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
use Thelia\Core\Template\Element\BaseLoop;
|
use Thelia\Core\Template\Element\BaseLoop;
|
||||||
use Thelia\Core\Template\Element\LoopResult;
|
use Thelia\Core\Template\Element\LoopResult;
|
||||||
use Thelia\Core\Template\Element\LoopResultRow;
|
use Thelia\Core\Template\Element\LoopResultRow;
|
||||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
|
||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -27,47 +19,52 @@ use Thelia\Core\Template\Loop\Argument\Argument;
|
|||||||
*
|
*
|
||||||
* Class Price
|
* Class Price
|
||||||
* @package DHL\Loop
|
* @package DHL\Loop
|
||||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
* @method int getAreaId()
|
||||||
|
* @author Laurent LE CORRE <laurent@thecoredev.>
|
||||||
*/
|
*/
|
||||||
class Price extends BaseLoop implements ArraySearchLoopInterface
|
class Price extends BaseLoop implements PropelSearchLoopInterface
|
||||||
{
|
{
|
||||||
/* set countable to false since we need to preserve keys */
|
/* set countable to false since we need to preserve keys */
|
||||||
protected $countable = false;
|
protected $countable = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return ArgumentCollection
|
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
|
||||||
*/
|
*/
|
||||||
protected function getArgDefinitions()
|
protected function getArgDefinitions()
|
||||||
{
|
{
|
||||||
return new ArgumentCollection(
|
return new ArgumentCollection(
|
||||||
Argument::createIntTypeArgument('area', null, true)
|
Argument::createIntListTypeArgument('area_id')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildArray()
|
public function buildModelCriteria()
|
||||||
{
|
{
|
||||||
$area = $this->getArea();
|
$query = DHLDeliveryPriceQuery::create();
|
||||||
$prices = DHL::getPrices();
|
|
||||||
|
|
||||||
if (!isset($prices[$area]) || !isset($prices[$area]["slices"])) {
|
if (null !== $areaId = $this->getAreaId()) {
|
||||||
return array();
|
$query->filterByAreaId($areaId, Criteria::IN);
|
||||||
}
|
}
|
||||||
|
$query->orderByMaxWeight();
|
||||||
|
|
||||||
$areaPrices = $prices[$area]["slices"];
|
return $query;
|
||||||
ksort($areaPrices);
|
|
||||||
|
|
||||||
return $areaPrices;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function parseResults(LoopResult $loopResult)
|
public function parseResults(LoopResult $loopResult)
|
||||||
{
|
{
|
||||||
foreach ($loopResult->getResultDataCollection() as $maxWeight => $price) {
|
/** @var DHLDeliveryPrice $item */
|
||||||
$loopResultRow = new LoopResultRow();
|
foreach ($loopResult->getResultDataCollection() as $item) {
|
||||||
$loopResultRow->set("MAX_WEIGHT", $maxWeight)
|
$loopResultRow = new LoopResultRow($item);
|
||||||
->set("PRICE", $price);
|
|
||||||
|
$loopResultRow
|
||||||
|
->set('ID', $item->getId())
|
||||||
|
->set('MAX_WEIGHT', $item->getMaxWeight())
|
||||||
|
->set('PRICE', $item->getPriceWithTax())
|
||||||
|
->set('AREA_ID', $item->getAreaId())
|
||||||
|
;
|
||||||
|
|
||||||
$loopResult->addRow($loopResultRow);
|
$loopResult->addRow($loopResultRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $loopResult;
|
return $loopResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1336
local/modules/DHL/Model/Base/DHLDeliveryPrice.php
Normal file
1336
local/modules/DHL/Model/Base/DHLDeliveryPrice.php
Normal file
File diff suppressed because it is too large
Load Diff
564
local/modules/DHL/Model/Base/DHLDeliveryPriceQuery.php
Normal file
564
local/modules/DHL/Model/Base/DHLDeliveryPriceQuery.php
Normal file
@@ -0,0 +1,564 @@
|
|||||||
|
<?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\Collection;
|
||||||
|
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 dhl_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 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 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
|
||||||
427
local/modules/DHL/Model/Map/DHLDeliveryPriceTableMap.php
Normal file
427
local/modules/DHL/Model/Map/DHLDeliveryPriceTableMap.php
Normal file
@@ -0,0 +1,427 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace DHL\Model\Map;
|
||||||
|
|
||||||
|
use DHL\Model\DHLDeliveryPrice;
|
||||||
|
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();
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
<form method="POST" action="{url path='/admin/module/dhl/configuration/update'}">
|
<form method="POST" action="{url path='/admin/module/dhl/configuration/update'}">
|
||||||
{form_hidden_fields form=$form}
|
{form_hidden_fields form=$form}
|
||||||
|
|
||||||
{render_form_field field="tracking_url" value={module_config module="DHL" key='tracking_url' locale="fr_FR"}}
|
{render_form_field field="tracking_url" value={module_config module="DHL" key='tracking_url' locale="en_US"}}
|
||||||
|
|
||||||
<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'}">
|
<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'}
|
{intl d='dhl.bo.default' l='Save'}
|
||||||
@@ -47,6 +47,7 @@
|
|||||||
dialog_id = "price_slice_create_dialog_{$ID}"
|
dialog_id = "price_slice_create_dialog_{$ID}"
|
||||||
dialog_title = {intl d='dhl.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\"/>
|
dialog_body = "<input type=\"hidden\" name=\"operation\" value=\"add\"/>
|
||||||
|
<input type=\"hidden\" name=\"module_id\" value={$module_id}>
|
||||||
<input type=\"hidden\" name=\"area\" value=\"{$ID}\" />
|
<input type=\"hidden\" name=\"area\" value=\"{$ID}\" />
|
||||||
<label for=\"weight_{$ID}\">{intl d='dhl.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/>
|
<input type=\"number\" step=\"0.01\" id=\"weight_{$ID}\" name=\"weight\" value=\"1\" class=\"form-control\" pattern=\"\d+\.?\d*\" required/>
|
||||||
@@ -76,15 +77,17 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{loop type="dhl" name="dhl" area=$ID}
|
{loop type="dhl" name="dhl" area_id=$ID}
|
||||||
{* -- EDIT price slice confirmation dialog ----------------------------------- *}
|
{* -- EDIT price slice confirmation dialog ----------------------------------- *}
|
||||||
{include
|
{include
|
||||||
file = "includes/generic-confirm-dialog.html"
|
file = "includes/generic-confirm-dialog.html"
|
||||||
|
|
||||||
dialog_id = "price_slice_edit_dialog_{$ID}_{$MAX_WEIGHT|replace:'.':'-'}"
|
dialog_id = "price_slice_edit_dialog_{$ID}_{$MAX_WEIGHT|replace:'.':'-'}"
|
||||||
dialog_title = {intl d='dhl.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\"/>
|
dialog_message = "<input type=\"hidden\" name=\"operation\" value=\"update\"/>
|
||||||
<input type=\"hidden\" name=\"area\" value=\"{$ID}\"/>
|
<input type=\"hidden\" name=\"module_id\" value={$module_id}>
|
||||||
|
<input type=\"hidden\" name=\"area\" value=\"{$AREA_ID}\"/>
|
||||||
|
<input type=\"hidden\" name=\"price_id\" value=\"{$ID}\"/>
|
||||||
<input type=\"hidden\" name=\"weight\" value=\"{$MAX_WEIGHT}\"/>
|
<input type=\"hidden\" name=\"weight\" value=\"{$MAX_WEIGHT}\"/>
|
||||||
<label for=\"price_edit_{$ID}_{$MAX_WEIGHT}\">{intl d='dhl.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/>"
|
<input type=\"number\" step=\"0.01\" id=\"price_edit_{$ID}_{$MAX_WEIGHT}\" class=\"form-control\" name=\"price\" value=\"{$PRICE}\" pattern=\"\d+\.?\d*\" required/>"
|
||||||
@@ -100,7 +103,9 @@
|
|||||||
dialog_id = "price_slice_delete_dialog_{$ID}_{$MAX_WEIGHT|replace:'.':'-'}"
|
dialog_id = "price_slice_delete_dialog_{$ID}_{$MAX_WEIGHT|replace:'.':'-'}"
|
||||||
dialog_title = {intl d='dhl.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\"/>
|
dialog_message = "<input type=\"hidden\" name=\"operation\" value=\"delete\"/>
|
||||||
<input type=\"hidden\" name=\"area\" value=\"{$ID}\"/>
|
<input type=\"hidden\" name=\"module_id\" value={$module_id}>
|
||||||
|
<input type=\"hidden\" name=\"area\" value=\"{$AREA_ID}\"/>
|
||||||
|
<input type=\"hidden\" name=\"price_id\" value=\"{$ID}\"/>
|
||||||
<input type=\"hidden\" name=\"weight\" value=\"{$MAX_WEIGHT}\"/>
|
<input type=\"hidden\" name=\"weight\" value=\"{$MAX_WEIGHT}\"/>
|
||||||
{intl d='dhl.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 ?"}"
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ require __DIR__ . '/../core/vendor/autoload.php';
|
|||||||
$trustedIp = array(
|
$trustedIp = array(
|
||||||
'::1',
|
'::1',
|
||||||
'127.0.0.1',
|
'127.0.0.1',
|
||||||
'86.210.176.132'
|
'86.210.176.132',
|
||||||
);
|
);
|
||||||
|
|
||||||
$request = Request::createFromGlobals();
|
$request = Request::createFromGlobals();
|
||||||
|
|||||||
Reference in New Issue
Block a user