Module MondialRelay
269
local/modules/MondialRelay/Config/config-data.json
Normal file
@@ -0,0 +1,269 @@
|
||||
{
|
||||
"shippingZones": [
|
||||
{
|
||||
"name": "Mondial Relay - Relay delivery Zone 1",
|
||||
"delivery_time_in_days": 3,
|
||||
"delivery_type": 1,
|
||||
"countries": [
|
||||
"FRA",
|
||||
"BEL",
|
||||
"LUX",
|
||||
"MCO"
|
||||
],
|
||||
"prices": [
|
||||
{
|
||||
"up_to": 0.5,
|
||||
"price_euro": 4.55
|
||||
},
|
||||
{
|
||||
"up_to": 1,
|
||||
"price_euro": 5.25
|
||||
},
|
||||
{
|
||||
"up_to": 2,
|
||||
"price_euro": 5.95
|
||||
},
|
||||
{
|
||||
"up_to": 3,
|
||||
"price_euro": 6.80
|
||||
},
|
||||
{
|
||||
"up_to": 5,
|
||||
"price_euro": 8
|
||||
},
|
||||
{
|
||||
"up_to": 7,
|
||||
"price_euro": 10.50
|
||||
},
|
||||
{
|
||||
"up_to": 10,
|
||||
"price_euro": 12.75
|
||||
},
|
||||
{
|
||||
"up_to": 15,
|
||||
"price_euro": 15.35
|
||||
},
|
||||
{
|
||||
"up_to": 30,
|
||||
"price_euro": 19.10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Mondial Relay - Relay delivery Zone 2",
|
||||
"delivery_time_in_days": 5,
|
||||
"delivery_type": 1,
|
||||
"countries": [
|
||||
"ESP"
|
||||
],
|
||||
"prices": [
|
||||
{
|
||||
"up_to": 0.5,
|
||||
"price_euro": 8.40
|
||||
},
|
||||
{
|
||||
"up_to": 1,
|
||||
"price_euro": 9
|
||||
},
|
||||
{
|
||||
"up_to": 2,
|
||||
"price_euro": 9.80
|
||||
},
|
||||
{
|
||||
"up_to": 3,
|
||||
"price_euro": 10.50
|
||||
},
|
||||
{
|
||||
"up_to": 5,
|
||||
"price_euro": 12.80
|
||||
},
|
||||
{
|
||||
"up_to": 7,
|
||||
"price_euro": 15.20
|
||||
},
|
||||
{
|
||||
"up_to": 10,
|
||||
"price_euro": 17.40
|
||||
},
|
||||
{
|
||||
"up_to": 15,
|
||||
"price_euro": 22.80
|
||||
},
|
||||
{
|
||||
"up_to": 30,
|
||||
"price_euro": 27.50
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Mondial Relay - Home delivery Zone 1",
|
||||
"delivery_time_in_days": 3,
|
||||
"delivery_type": 2,
|
||||
"countries": [
|
||||
"DEU",
|
||||
"BEL",
|
||||
"LUX"
|
||||
],
|
||||
"prices": [
|
||||
{
|
||||
"up_to": 0.5,
|
||||
"price_euro": 9.50
|
||||
},
|
||||
{
|
||||
"up_to": 1,
|
||||
"price_euro": 9.50
|
||||
},
|
||||
{
|
||||
"up_to": 2,
|
||||
"price_euro": 10.20
|
||||
},
|
||||
{
|
||||
"up_to": 3,
|
||||
"price_euro": 10.90
|
||||
},
|
||||
{
|
||||
"up_to": 5,
|
||||
"price_euro": 12.30
|
||||
},
|
||||
{
|
||||
"up_to": 7,
|
||||
"price_euro": 13.70
|
||||
},
|
||||
{
|
||||
"up_to": 10,
|
||||
"price_euro": 15.80
|
||||
},
|
||||
{
|
||||
"up_to": 15,
|
||||
"price_euro": 19.30
|
||||
},
|
||||
{
|
||||
"up_to": 30,
|
||||
"price_euro": 29.80
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Mondial Relay - Home delivery Zone 2",
|
||||
"delivery_time_in_days": 5,
|
||||
"delivery_type": 2,
|
||||
"countries": [
|
||||
"GBR",
|
||||
"ESP"
|
||||
],
|
||||
"prices": [
|
||||
{
|
||||
"up_to": 0.5,
|
||||
"price_euro": 10.20
|
||||
},
|
||||
{
|
||||
"up_to": 1,
|
||||
"price_euro": 10.20
|
||||
},
|
||||
{
|
||||
"up_to": 2,
|
||||
"price_euro": 11.30
|
||||
},
|
||||
{
|
||||
"up_to": 3,
|
||||
"price_euro": 12.40
|
||||
},
|
||||
{
|
||||
"up_to": 5,
|
||||
"price_euro": 14.60
|
||||
},
|
||||
{
|
||||
"up_to": 7,
|
||||
"price_euro": 16.80
|
||||
},
|
||||
{
|
||||
"up_to": 10,
|
||||
"price_euro": 20.10
|
||||
},
|
||||
{
|
||||
"up_to": 15,
|
||||
"price_euro": 25.60
|
||||
},
|
||||
{
|
||||
"up_to": 30,
|
||||
"price_euro": 36.60
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Mondial Relay - Home delivery Zone 3",
|
||||
"delivery_time_in_days": 6,
|
||||
"delivery_type": 2,
|
||||
"countries": [
|
||||
"ITA",
|
||||
"PRT",
|
||||
"AUT"
|
||||
],
|
||||
"prices": [
|
||||
{
|
||||
"up_to": 0.5,
|
||||
"price_euro": 11.20
|
||||
},
|
||||
{
|
||||
"up_to": 1,
|
||||
"price_euro": 11.20
|
||||
},
|
||||
{
|
||||
"up_to": 2,
|
||||
"price_euro": 12.30
|
||||
},
|
||||
{
|
||||
"up_to": 3,
|
||||
"price_euro": 13.40
|
||||
},
|
||||
{
|
||||
"up_to": 5,
|
||||
"price_euro": 15.60
|
||||
},
|
||||
{
|
||||
"up_to": 7,
|
||||
"price_euro": 17.80
|
||||
},
|
||||
{
|
||||
"up_to": 10,
|
||||
"price_euro": 21.10
|
||||
},
|
||||
{
|
||||
"up_to": 15,
|
||||
"price_euro": 26.60
|
||||
},
|
||||
{
|
||||
"up_to": 30,
|
||||
"price_euro": 37.60
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"insurances": [
|
||||
{
|
||||
"level": 1,
|
||||
"value": 50,
|
||||
"price_with_tax_euro": 2
|
||||
},
|
||||
{
|
||||
"level": 2,
|
||||
"value": 125,
|
||||
"price_with_tax_euro": 3.50
|
||||
},
|
||||
{
|
||||
"level": 3,
|
||||
"value": 250,
|
||||
"price_with_tax_euro": 5
|
||||
},
|
||||
{
|
||||
"level": 4,
|
||||
"value": 375,
|
||||
"price_with_tax_euro": 6.50
|
||||
},
|
||||
{
|
||||
"level": 5,
|
||||
"value": 500,
|
||||
"price_with_tax_euro": 8
|
||||
}
|
||||
]
|
||||
}
|
||||
76
local/modules/MondialRelay/Config/config.xml
Normal file
@@ -0,0 +1,76 @@
|
||||
<?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 name="mondialrelay.prices" class="MondialRelay\Loop\Prices" />
|
||||
<loop name="mondialrelay.area-attributes" class="MondialRelay\Loop\AreaAttributes" />
|
||||
<loop name="mondialrelay.insurances" class="MondialRelay\Loop\Insurances" />
|
||||
|
||||
<loop name="mondialrelay.delivery-price" class="MondialRelay\Loop\DeliveryPrice" />
|
||||
<loop name="mondialrelay.pickup-points" class="MondialRelay\Loop\PickupPoints" />
|
||||
<loop name="mondialrelay.selected-pickup-point" class="MondialRelay\Loop\SelectedPickupPoint" />
|
||||
</loops>
|
||||
|
||||
<forms>
|
||||
<form name="mondialrelay.settings_form" class="MondialRelay\Form\SettingsForm" />
|
||||
|
||||
<form name="mondialrelay.area_attributes_update_form" class="MondialRelay\Form\PriceAttributesUpdateForm" />
|
||||
|
||||
<form name="mondialrelay.price_form" class="MondialRelay\Form\PriceCreateForm" />
|
||||
<form name="mondialrelay.prices_update_form" class="MondialRelay\Form\PricesUpdateForm" />
|
||||
|
||||
<form name="mondialrelay.insurances_update_form" class="MondialRelay\Form\InsurancesUpdateForm" />
|
||||
<form name="mondialrelay.insurance_create_form" class="MondialRelay\Form\InsuranceCreateForm" />
|
||||
</forms>
|
||||
|
||||
<services>
|
||||
<service id="mondialrelay.delivery.service" class="MondialRelay\EventListeners\DeliveryListener">
|
||||
<argument type="service" id="request_stack" />
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
<service id="mondialrelay.mailing.service" class="MondialRelay\EventListeners\SendDeliveryEmail">
|
||||
<argument type="service" id="mailer" />
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
|
||||
</services>
|
||||
|
||||
<hooks>
|
||||
<hook id="mondialrelay.admin.hookmanager" class="MondialRelay\Hook\AdminHookManager">
|
||||
<tag name="hook.event_listener" event="module.configuration" type="back" method="onModuleConfigure" />
|
||||
<tag name="hook.event_listener" event="module.config-js" type="back" method="onModuleConfigureJs" />
|
||||
<tag name="hook.event_listener" event="main.top-menu-tools" type="back" method="onMainTopMenuTools" />
|
||||
</hook>
|
||||
|
||||
<hook id="mondialrelay.front.hookmanager" class="MondialRelay\Hook\FrontHookManager">
|
||||
<tag name="hook.event_listener" event="order-delivery.extra" type="front" method="onOrderDeliveryExtra" />
|
||||
<tag name="hook.event_listener" event="order-delivery.stylesheet" type="front" templates="css:mondialrelay/assets/css/styles.css" />
|
||||
<tag name="hook.event_listener" event="order-invoice.delivery-address" type="front" templates="render:mondialrelay/delivery-address.html"/>
|
||||
<tag name="hook.event_listener" event="account-order.delivery-address" type="front" method="onAccountOrderDeliveryAddress"/>
|
||||
</hook>
|
||||
|
||||
<hook id="mondialrelay.email.hookmanager" class="MondialRelay\Hook\EmailHookManager">
|
||||
<tag name="hook.event_listener" event="email-html.order-confirmation.delivery-address" type="email" method="onDeliveryAddressHtml"/>
|
||||
<tag name="hook.event_listener" event="email-txt.order-confirmation.delivery-address" type="email" method="onDeliveryAddressText"/>
|
||||
<tag name="hook.event_listener" event="email-html.order-notification.delivery-address" type="email" method="onDeliveryAddressHtml"/>
|
||||
<tag name="hook.event_listener" event="email-txt.order-notification.delivery-address" type="email" method="onDeliveryAddressText"/>
|
||||
|
||||
<tag name="hook.event_listener" event="email-html.order-confirmation.after-products" type="email" method="onAfterProductsHtml"/>
|
||||
<tag name="hook.event_listener" event="email-txt.order-confirmation.after-products" type="email" method="onAfterProductsText"/>
|
||||
<tag name="hook.event_listener" event="email-html.order-notification.after-products" type="email" method="onAfterProductsHtml"/>
|
||||
<tag name="hook.event_listener" event="email-txt.order-notification.after-products" type="email" method="onAfterProductsText"/>
|
||||
</hook>
|
||||
|
||||
<hook id="mondialrelay.pdf.hookmanager" class="MondialRelay\Hook\PdfHookManager">
|
||||
<tag name="hook.event_listener" event="delivery.delivery-address" type="pdf" method="onDeliveryAddress"/>
|
||||
<tag name="hook.event_listener" event="invoice.delivery-address" type="pdf" method="onDeliveryAddress"/>
|
||||
|
||||
<tag name="hook.event_listener" event="delivery.after-delivery-module" type="pdf" method="onAfterDeliveryModule"/>
|
||||
<tag name="hook.event_listener" event="invoice.after-delivery-module" type="pdf" method="onAfterDeliveryModule"/>
|
||||
|
||||
</hook>
|
||||
</hooks>
|
||||
</config>
|
||||
8
local/modules/MondialRelay/Config/drop.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
DROP TABLE IF EXISTS `mondial_relay_pickup_address`;
|
||||
DROP TABLE IF EXISTS `mondial_relay_delivery_price`;
|
||||
DROP TABLE IF EXISTS `mondial_relay_delivery_insurance`;
|
||||
DROP TABLE IF EXISTS `mondial_relay_zone_configuration`;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
26
local/modules/MondialRelay/Config/module.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module xmlns="http://thelia.net/schema/dic/module"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_1.xsd">
|
||||
<fullnamespace>MondialRelay\MondialRelay</fullnamespace>
|
||||
<descriptive locale="en_US">
|
||||
<title>Mondial Relay delivery</title>
|
||||
</descriptive>
|
||||
<descriptive locale="fr_FR">
|
||||
<title>Livraison avec Mondial Relay</title>
|
||||
</descriptive>
|
||||
<languages>
|
||||
<language>en_US</language>
|
||||
<language>fr_FR</language>
|
||||
</languages>
|
||||
<version>1.0.7</version>
|
||||
<author>
|
||||
<name>Franck Allimant</name>
|
||||
<company>CQFDev</company>
|
||||
<email>thelia@cqfdev.fr</email>
|
||||
<website>www.cqfdev.fr</website>
|
||||
</author>
|
||||
<type>delivery</type>
|
||||
<thelia>2.3.0</thelia>
|
||||
<stability>prod</stability>
|
||||
</module>
|
||||
64
local/modules/MondialRelay/Config/routing.xml
Normal file
@@ -0,0 +1,64 @@
|
||||
<?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">
|
||||
|
||||
|
||||
<!-- Settings management -->
|
||||
|
||||
<route id="mondial_relay.settings.save" path="/admin/module/MondialRelay/settings/save">
|
||||
<default key="_controller">MondialRelay\Controller\BackOffice\ConfigurationController::saveAction</default>
|
||||
</route>
|
||||
|
||||
|
||||
<!-- Area attributes management -->
|
||||
|
||||
<route id="mondial_relay.area-attributes.save" path="/admin/module/MondialRelay/area-attributes/save/{areaId}/{moduleId}">
|
||||
<default key="_controller">MondialRelay\Controller\BackOffice\AreaAttributesController::saveAction</default>
|
||||
<requirement key="areaId">\d+</requirement>
|
||||
<requirement key="moduleId">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<!-- Prices management -->
|
||||
|
||||
<route id="mondial_relay.price.save" path="/admin/module/MondialRelay/prices/save/{areaId}/{moduleId}">
|
||||
<default key="_controller">MondialRelay\Controller\BackOffice\PriceController::saveAction</default>
|
||||
<requirement key="areaId">\d+</requirement>
|
||||
<requirement key="moduleId">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="mondial_relay.price.create" path="/admin/module/MondialRelay/prices/create/{areaId}/{moduleId}">
|
||||
<default key="_controller">MondialRelay\Controller\BackOffice\PriceController::createAction</default>
|
||||
<requirement key="areaId">\d+</requirement>
|
||||
<requirement key="moduleId">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="mondial_relay.price.delete" path="/admin/module/MondialRelay/prices/delete/{priceId}/{moduleId}">
|
||||
<default key="_controller">MondialRelay\Controller\BackOffice\PriceController::deleteAction</default>
|
||||
<requirement key="priceId">\d+</requirement>
|
||||
<requirement key="moduleId">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<!-- Insurances management -->
|
||||
|
||||
<route id="mondial_relay.insurance.save" path="/admin/module/MondialRelay/insurances/save">
|
||||
<default key="_controller">MondialRelay\Controller\BackOffice\InsuranceController::saveAction</default>
|
||||
</route>
|
||||
|
||||
<route id="mondial_relay.insurance.create" path="/admin/module/MondialRelay/insurances/create">
|
||||
<default key="_controller">MondialRelay\Controller\BackOffice\InsuranceController::createAction</default>
|
||||
</route>
|
||||
|
||||
<route id="mondial_relay.insurance.delete" path="/admin/module/MondialRelay/insurances/delete/{insuranceId}">
|
||||
<default key="_controller">MondialRelay\Controller\BackOffice\InsuranceController::deleteAction</default>
|
||||
<requirement key="insuranceId">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<!-- Front routes -->
|
||||
|
||||
<route id="mondial_relay.relay_map" path="MondialRelay/relay-map">
|
||||
<default key="_controller">MondialRelay\Controller\FrontOffice\MapManagement::getRelayMapAction</default>
|
||||
</route>
|
||||
|
||||
</routes>
|
||||
42
local/modules/MondialRelay/Config/schema.xml
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<database defaultIdMethod="native" name="thelia"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../../core/vendor/propel/propel/resources/xsd/database.xsd" >
|
||||
|
||||
<table name="mondial_relay_pickup_address" namespace="MondialRelay\Model">
|
||||
<column name="id" primaryKey="true" required="true" type="INTEGER" autoIncrement="true" />
|
||||
<column name="json_relay_data" required="true" type="CLOB"/>
|
||||
<column name="order_address_id" required="true" type="INTEGER"/>
|
||||
</table>
|
||||
|
||||
<table name="mondial_relay_delivery_price" namespace="MondialRelay\Model">
|
||||
<column name="id" primaryKey="true" required="true" type="INTEGER" autoIncrement="true" />
|
||||
<column name="max_weight" defaultValue="0.000000" required="true" scale="6" size="16" type="DECIMAL" />
|
||||
<column name="price_with_tax" defaultValue="0.000000" required="true" scale="6" size="16" type="DECIMAL" />
|
||||
<column name="area_id" required="true" type="INTEGER" />
|
||||
|
||||
<foreign-key foreignTable="area" name="fk_mondial_relay_delivery_price_area_id" onDelete="CASCADE" onUpdate="RESTRICT">
|
||||
<reference foreign="id" local="area_id" />
|
||||
</foreign-key>
|
||||
</table>
|
||||
|
||||
<table name="mondial_relay_delivery_insurance" namespace="MondialRelay\Model">
|
||||
<column name="id" primaryKey="true" required="true" type="INTEGER" autoIncrement="true" />
|
||||
<column name="level" required="true" type="INTEGER" />
|
||||
<column name="max_value" defaultValue="0.000000" required="true" scale="6" size="16" type="DECIMAL" />
|
||||
<column name="price_with_tax" defaultValue="0.000000" required="true" scale="6" size="16" type="DECIMAL" />
|
||||
</table>
|
||||
|
||||
<table name="mondial_relay_zone_configuration" namespace="MondialRelay\Model">
|
||||
<column name="id" primaryKey="true" required="true" type="INTEGER" autoIncrement="true" />
|
||||
<column name="delivery_time" required="true" type="INTEGER" />
|
||||
<column name="delivery_type" required="true" type="INTEGER" size="1" />
|
||||
<column name="area_id" required="true" type="INTEGER" />
|
||||
|
||||
<foreign-key foreignTable="area" name="fk_mondial_relay_zone_configuration_area_id" onDelete="CASCADE" onUpdate="RESTRICT">
|
||||
<reference foreign="id" local="area_id" />
|
||||
</foreign-key>
|
||||
</table>
|
||||
|
||||
<external-schema filename="local/config/schema.xml" referenceOnly="true" />
|
||||
</database>
|
||||
78
local/modules/MondialRelay/Config/thelia.sql
Normal file
@@ -0,0 +1,78 @@
|
||||
|
||||
# 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;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- mondial_relay_pickup_address
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `mondial_relay_pickup_address`;
|
||||
|
||||
CREATE TABLE `mondial_relay_pickup_address`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`json_relay_data` LONGTEXT NOT NULL,
|
||||
`order_address_id` INTEGER NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- mondial_relay_delivery_price
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `mondial_relay_delivery_price`;
|
||||
|
||||
CREATE TABLE `mondial_relay_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_mondial_relay_delivery_price_area_id` (`area_id`),
|
||||
CONSTRAINT `fk_mondial_relay_delivery_price_area_id`
|
||||
FOREIGN KEY (`area_id`)
|
||||
REFERENCES `area` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- mondial_relay_delivery_insurance
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `mondial_relay_delivery_insurance`;
|
||||
|
||||
CREATE TABLE `mondial_relay_delivery_insurance`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`level` INTEGER NOT NULL,
|
||||
`max_value` DECIMAL(16,6) DEFAULT 0.000000 NOT NULL,
|
||||
`price_with_tax` DECIMAL(16,6) DEFAULT 0.000000 NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- mondial_relay_zone_configuration
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `mondial_relay_zone_configuration`;
|
||||
|
||||
CREATE TABLE `mondial_relay_zone_configuration`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`delivery_time` INTEGER NOT NULL,
|
||||
`delivery_type` INTEGER(1) NOT NULL,
|
||||
`area_id` INTEGER NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `fi_mondial_relay_zone_configuration_area_id` (`area_id`),
|
||||
CONSTRAINT `fk_mondial_relay_zone_configuration_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
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace MondialRelay\Controller\BackOffice;
|
||||
|
||||
use MondialRelay\Model\MondialRelayZoneConfiguration;
|
||||
use MondialRelay\Model\MondialRelayZoneConfigurationQuery;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Log\Tlog;
|
||||
|
||||
/**
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class AreaAttributesController extends BaseAdminController
|
||||
{
|
||||
public function saveAction($areaId, $moduleId)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE, 'MondialRelay', AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$form = $this->createForm('mondialrelay.area_attributes_update_form');
|
||||
|
||||
$errorMessage = false;
|
||||
|
||||
try {
|
||||
$viewForm = $this->validateForm($form);
|
||||
|
||||
$data = $viewForm->getData();
|
||||
|
||||
if (null === $zoneConfig = MondialRelayZoneConfigurationQuery::create()->findOneByAreaId($areaId)) {
|
||||
$zoneConfig = new MondialRelayZoneConfiguration();
|
||||
}
|
||||
|
||||
$zoneConfig
|
||||
->setAreaId($areaId)
|
||||
->setDeliveryTime($data['delivery_time'])
|
||||
->setDeliveryType($data['delivery_type'])
|
||||
->save();
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$errorMessage = $ex->getMessage();
|
||||
|
||||
Tlog::getInstance()->error("Failed to validate area attributes form: $errorMessage");
|
||||
}
|
||||
|
||||
return $this->render('mondialrelay/ajax/prices', [
|
||||
'module_id' => $moduleId,
|
||||
'error_message' => $errorMessage
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace MondialRelay\Controller\BackOffice;
|
||||
|
||||
use MondialRelay\MondialRelay;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Log\Tlog;
|
||||
|
||||
/**
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class ConfigurationController extends BaseAdminController
|
||||
{
|
||||
public function saveAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE, 'MondialRelay', AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$form = $this->createForm('mondialrelay.settings_form');
|
||||
|
||||
$errorMessage = false;
|
||||
|
||||
try {
|
||||
$viewForm = $this->validateForm($form);
|
||||
|
||||
$data = $viewForm->getData();
|
||||
|
||||
foreach ($data as $name => $value) {
|
||||
MondialRelay::setConfigValue($name, $value);
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
$errorMessage = $ex->getMessage();
|
||||
|
||||
Tlog::getInstance()->error("Failed to validate configuration form: $errorMessage");
|
||||
}
|
||||
|
||||
return $this->render('mondialrelay/ajax/general', [ 'error_message' => $errorMessage ]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace MondialRelay\Controller\BackOffice;
|
||||
|
||||
use MondialRelay\Model\MondialRelayDeliveryInsurance;
|
||||
use MondialRelay\Model\MondialRelayDeliveryInsuranceQuery;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Log\Tlog;
|
||||
|
||||
/**
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class InsuranceController extends BaseAdminController
|
||||
{
|
||||
public function saveAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE, 'MondialRelay', AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$form = $this->createForm('mondialrelay.insurances_update_form');
|
||||
|
||||
$errorMessage = false;
|
||||
|
||||
try {
|
||||
$viewForm = $this->validateForm($form);
|
||||
|
||||
$data = $viewForm->getData();
|
||||
|
||||
foreach ($data['max_value'] as $key => $value) {
|
||||
if (null !== $insurance = MondialRelayDeliveryInsuranceQuery::create()->findPk($key)) {
|
||||
$insurance
|
||||
->setMaxValue($value)
|
||||
->setPriceWithTax($data['price_with_tax'][$key])
|
||||
->save();
|
||||
}
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
$errorMessage = $ex->getMessage();
|
||||
|
||||
Tlog::getInstance()->error("Failed to validate insurances form: $errorMessage");
|
||||
}
|
||||
|
||||
return $this->render('mondialrelay/ajax/insurances', [ 'error_message' => $errorMessage ]);
|
||||
}
|
||||
|
||||
public function createAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE, 'MondialRelay', AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$form = $this->createForm('mondialrelay.insurance_create_form');
|
||||
|
||||
$errorMessage = false;
|
||||
|
||||
try {
|
||||
$viewForm = $this->validateForm($form);
|
||||
|
||||
$data = $viewForm->getData();
|
||||
|
||||
MondialRelayDeliveryInsuranceQuery::create()->filterByMaxValue($data['max_value'])->delete();
|
||||
|
||||
(new MondialRelayDeliveryInsurance())
|
||||
->setPriceWithTax($data['price_with_tax'])
|
||||
->setMaxValue($data['max_value'])
|
||||
->save();
|
||||
} catch (\Exception $ex) {
|
||||
$errorMessage = $ex->getMessage();
|
||||
|
||||
Tlog::getInstance()->error("Failed to validate insurances form: $errorMessage");
|
||||
}
|
||||
|
||||
return $this->render('mondialrelay/ajax/insurances', [ 'error_message' => $errorMessage ]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $insuranceId
|
||||
* @return mixed|\Thelia\Core\HttpFoundation\Response
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function deleteAction($insuranceId)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE, 'MondialRelay', AccessManager::DELETE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
MondialRelayDeliveryInsuranceQuery::create()->filterById($insuranceId)->delete();
|
||||
|
||||
return $this->render('mondialrelay/ajax/insurances');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace MondialRelay\Controller\BackOffice;
|
||||
|
||||
use MondialRelay\Model\MondialRelayDeliveryPrice;
|
||||
use MondialRelay\Model\MondialRelayDeliveryPriceQuery;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Log\Tlog;
|
||||
|
||||
/**
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class PriceController extends BaseAdminController
|
||||
{
|
||||
public function saveAction($areaId, $moduleId)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE, 'MondialRelay', AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$form = $this->createForm('mondialrelay.prices_update_form');
|
||||
|
||||
$errorMessage = false;
|
||||
|
||||
try {
|
||||
$viewForm = $this->validateForm($form);
|
||||
|
||||
$data = $viewForm->getData();
|
||||
|
||||
MondialRelayDeliveryPriceQuery::create()->filterByAreaId($areaId)->delete();
|
||||
|
||||
foreach ($data['max_weight'] as $key => $value) {
|
||||
(new MondialRelayDeliveryPrice())
|
||||
->setAreaId($areaId)
|
||||
->setMaxWeight($value)
|
||||
->setPriceWithTax($data['price'][$key])
|
||||
->save();
|
||||
}
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$errorMessage = $ex->getMessage();
|
||||
|
||||
Tlog::getInstance()->error("Failed to validate price form: $errorMessage");
|
||||
}
|
||||
|
||||
return $this->render('mondialrelay/ajax/prices', [
|
||||
'module_id' => $moduleId,
|
||||
'error_message' => $errorMessage
|
||||
]);
|
||||
}
|
||||
|
||||
public function createAction($areaId, $moduleId)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE, 'MondialRelay', AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$form = $this->createForm('mondialrelay.price_form');
|
||||
|
||||
$errorMessage = false;
|
||||
|
||||
try {
|
||||
$viewForm = $this->validateForm($form);
|
||||
|
||||
$data = $viewForm->getData();
|
||||
|
||||
MondialRelayDeliveryPriceQuery::create()->filterByMaxWeight($data['max_weight'])->delete();
|
||||
|
||||
(new MondialRelayDeliveryPrice())
|
||||
->setAreaId($areaId)
|
||||
->setPriceWithTax($data['price'])
|
||||
->setMaxWeight($data['max_weight'])
|
||||
->save();
|
||||
} catch (\Exception $ex) {
|
||||
$errorMessage = $ex->getMessage();
|
||||
|
||||
Tlog::getInstance()->error("Failed to validate price form: $errorMessage");
|
||||
}
|
||||
|
||||
return $this->render('mondialrelay/ajax/prices', [
|
||||
'module_id' => $moduleId,
|
||||
'error_message' => $errorMessage
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $insuranceId
|
||||
* @return mixed|\Thelia\Core\HttpFoundation\Response
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function deleteAction($priceId, $moduleId)
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE, 'MondialRelay', AccessManager::DELETE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
MondialRelayDeliveryPriceQuery::create()->filterById($priceId)->delete();
|
||||
|
||||
return $this->render('mondialrelay/ajax/prices', [ 'module_id' => $moduleId ]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
/**
|
||||
* Created by Franck Allimant, CQFDev <franck@cqfdev.fr>
|
||||
* Date: 12/03/2018 10:41
|
||||
*/
|
||||
|
||||
namespace MondialRelay\Controller\FrontOffice;
|
||||
|
||||
use MondialRelay\Event\FindRelayEvent;
|
||||
use MondialRelay\Event\MondialRelayEvents;
|
||||
use Thelia\Controller\Front\BaseFrontController;
|
||||
use Thelia\Core\HttpFoundation\JsonResponse;
|
||||
|
||||
require __DIR__ . "/../../vendor/autoload.php";
|
||||
|
||||
class MapManagement extends BaseFrontController
|
||||
{
|
||||
public function getRelayMapAction()
|
||||
{
|
||||
$event = new FindRelayEvent(
|
||||
intval($this->getRequest()->get('country_id', 0)),
|
||||
$this->getRequest()->get('city', ''),
|
||||
$this->getRequest()->get('zipcode', ''),
|
||||
floatval($this->getRequest()->get('radius', 10))
|
||||
);
|
||||
|
||||
$this->getDispatcher()->dispatch(MondialRelayEvents::FIND_RELAYS, $event);
|
||||
|
||||
|
||||
return new JsonResponse([
|
||||
'points' => $event->getPoints(),
|
||||
'error' => $event->getError()
|
||||
]);
|
||||
}
|
||||
}
|
||||
151
local/modules/MondialRelay/Event/FindRelayEvent.php
Normal file
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* This file is not free software */
|
||||
/* */
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
/**
|
||||
* Created by Franck Allimant, CQFDev <franck@cqfdev.fr>
|
||||
* Date: 28/04/2016 14:41
|
||||
*/
|
||||
namespace MondialRelay\Event;
|
||||
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
|
||||
class FindRelayEvent extends ActionEvent
|
||||
{
|
||||
/** @var int */
|
||||
protected $countryId;
|
||||
|
||||
/** @var string */
|
||||
protected $city;
|
||||
|
||||
/** @var string */
|
||||
protected $zipcode;
|
||||
|
||||
/** @var float */
|
||||
protected $searchRadius;
|
||||
|
||||
/** @var array */
|
||||
protected $points;
|
||||
|
||||
/** @var string */
|
||||
protected $numPointRelais = '';
|
||||
|
||||
/** @var bool */
|
||||
protected $error = '';
|
||||
|
||||
/**
|
||||
* FindRelayEvent constructor.
|
||||
* @param int $countryId
|
||||
* @param string $city
|
||||
* @param string $zipcode
|
||||
* @param float $searchRadius
|
||||
*/
|
||||
public function __construct($countryId, $city, $zipcode, $searchRadius)
|
||||
{
|
||||
$this->countryId = $countryId;
|
||||
$this->city = $city;
|
||||
$this->zipcode = $zipcode;
|
||||
$this->searchRadius = $searchRadius;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getCountryId()
|
||||
{
|
||||
return $this->countryId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCity()
|
||||
{
|
||||
return $this->city;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getZipcode()
|
||||
{
|
||||
return $this->zipcode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getSearchRadius()
|
||||
{
|
||||
return $this->searchRadius;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getPoints()
|
||||
{
|
||||
return $this->points;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $points
|
||||
* @return $this
|
||||
*/
|
||||
public function setPoints($points)
|
||||
{
|
||||
$this->points = $points;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getNumPointRelais()
|
||||
{
|
||||
return $this->numPointRelais;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $numPointRelais
|
||||
* @return $this
|
||||
*/
|
||||
public function setNumPointRelais($numPointRelais)
|
||||
{
|
||||
$this->numPointRelais = $numPointRelais;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasError()
|
||||
{
|
||||
return ! empty($this->error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $error
|
||||
* @return $this
|
||||
*/
|
||||
public function setError($error)
|
||||
{
|
||||
$this->error = $error;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string $error
|
||||
*/
|
||||
public function getError()
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
}
|
||||
21
local/modules/MondialRelay/Event/MondialRelayEvents.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
/**
|
||||
* Created by Franck Allimant, CQFDev <franck@cqfdev.fr>
|
||||
* Date: 12/03/2018 19:39
|
||||
*/
|
||||
|
||||
namespace MondialRelay\Event;
|
||||
|
||||
class MondialRelayEvents
|
||||
{
|
||||
const FIND_RELAYS = "mondialrelay.event.find-relays";
|
||||
}
|
||||
432
local/modules/MondialRelay/EventListeners/DeliveryListener.php
Normal file
@@ -0,0 +1,432 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace MondialRelay\EventListeners;
|
||||
|
||||
use MondialRelay\ApiClient;
|
||||
use MondialRelay\BussinessHours\BussinessHours;
|
||||
use MondialRelay\Event\FindRelayEvent;
|
||||
use MondialRelay\Event\MondialRelayEvents;
|
||||
use MondialRelay\Model\MondialRelayDeliveryPriceQuery;
|
||||
use MondialRelay\Model\MondialRelayPickupAddress;
|
||||
use MondialRelay\Model\MondialRelayPickupAddressQuery;
|
||||
use MondialRelay\Model\MondialRelayZoneConfiguration;
|
||||
use MondialRelay\Model\MondialRelayZoneConfigurationQuery;
|
||||
use MondialRelay\MondialRelay;
|
||||
use MondialRelay\Point\Point;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Thelia\Action\BaseAction;
|
||||
use Thelia\Core\Event\Delivery\DeliveryPostageEvent;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Core\HttpFoundation\Session\Session;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Exception\TheliaProcessException;
|
||||
use Thelia\Model\AreaDeliveryModule;
|
||||
use Thelia\Model\AreaDeliveryModuleQuery;
|
||||
use Thelia\Model\CountryArea;
|
||||
use Thelia\Model\CountryAreaQuery;
|
||||
use Thelia\Model\CountryQuery;
|
||||
use Thelia\Model\ModuleQuery;
|
||||
use Thelia\Model\OrderAddressQuery;
|
||||
|
||||
require __DIR__ . "/../vendor/autoload.php";
|
||||
|
||||
class DeliveryListener extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
/** @var RequestStack */
|
||||
protected $requestStack;
|
||||
|
||||
/**
|
||||
* DeliveryPostageListener constructor.
|
||||
* @param RequestStack $requestStack
|
||||
*/
|
||||
public function __construct(RequestStack $requestStack)
|
||||
{
|
||||
$this->requestStack = $requestStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ApiClient
|
||||
* @throws \SoapFault
|
||||
*/
|
||||
protected function getWebServiceClient()
|
||||
{
|
||||
return new ApiClient(
|
||||
new \SoapClient(
|
||||
MondialRelay::getConfigValue(MondialRelay::WEBSERVICE_URL)
|
||||
),
|
||||
MondialRelay::getConfigValue(MondialRelay::CODE_ENSEIGNE),
|
||||
MondialRelay::getConfigValue(MondialRelay::PRIVATE_KEY)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DeliveryPostageEvent $event
|
||||
* @param $eventName
|
||||
* @param EventDispatcherInterface $dispatcher
|
||||
* @throws \Exception
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function processDeliveryPostageEvent(DeliveryPostageEvent $event, $eventName, EventDispatcherInterface $dispatcher)
|
||||
{
|
||||
$valid = false;
|
||||
|
||||
/** @var Request $session */
|
||||
$request = $this->requestStack->getCurrentRequest();
|
||||
|
||||
/** @var Session $session */
|
||||
$session = $request->getSession();
|
||||
|
||||
// Get and store selected delivery type, if it is defined
|
||||
switch($request->get('mondial-relay-selected-delivery-mode')) {
|
||||
case 'pickup':
|
||||
$selectedDeliveryType = MondialRelayZoneConfiguration::RELAY_DELIVERY_TYPE;
|
||||
break;
|
||||
case 'home':
|
||||
$selectedDeliveryType = MondialRelayZoneConfiguration::HOME_DELIVERY_TYPE;
|
||||
break;
|
||||
default:
|
||||
$selectedDeliveryType = $session->get(MondialRelay::SESSION_SELECTED_DELIVERY_TYPE);
|
||||
}
|
||||
|
||||
if (null !== $selectedDeliveryType) {
|
||||
$session->set(MondialRelay::SESSION_SELECTED_DELIVERY_TYPE, $selectedDeliveryType);
|
||||
}
|
||||
|
||||
// Use the minimum weight if the cart is below this minimum.
|
||||
$weight = max(MondialRelay::MIN_WEIGHT_KG, $session->getSessionCart($dispatcher)->getWeight());
|
||||
|
||||
if ($weight <= MondialRelay::MAX_WEIGHT_KG) {
|
||||
$moduleModel = ModuleQuery::create()->findOneByCode(MondialRelay::getModuleCode());
|
||||
|
||||
// Find all allowed delivery types for the destination country
|
||||
$countryHasRelay = $countryHasHome = false;
|
||||
|
||||
$countryInAreaList = CountryAreaQuery::findByCountryAndState($event->getCountry(), $event->getState());
|
||||
|
||||
$price = PHP_INT_MAX;
|
||||
|
||||
/** @var CountryArea $countryInArea */
|
||||
foreach ($countryInAreaList as $countryInArea) {
|
||||
$areas = AreaDeliveryModuleQuery::create()->filterByAreaId($countryInArea->getAreaId())
|
||||
->filterByModule($moduleModel)
|
||||
->find();
|
||||
|
||||
/** @var AreaDeliveryModule $area */
|
||||
foreach ($areas as $area) {
|
||||
if (null !== $zoneConfig = MondialRelayZoneConfigurationQuery::create()->findOneByAreaId($area->getAreaId())) {
|
||||
$zoneDeliveryType = $zoneConfig->getDeliveryType();
|
||||
|
||||
switch ($zoneDeliveryType) {
|
||||
case MondialRelayZoneConfiguration::ALL_DELIVERY_TYPE:
|
||||
$countryHasRelay = $countryHasHome = true;
|
||||
break;
|
||||
case MondialRelayZoneConfiguration::HOME_DELIVERY_TYPE:
|
||||
$countryHasHome = true;
|
||||
break;
|
||||
case MondialRelayZoneConfiguration::RELAY_DELIVERY_TYPE:
|
||||
$countryHasRelay = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// If the area delivery type matches the selected one, or if no zone is selected
|
||||
if (null === $selectedDeliveryType || $zoneDeliveryType === $selectedDeliveryType) {
|
||||
// Check if we have a price slice
|
||||
if (null !== $deliveryPrice = MondialRelayDeliveryPriceQuery::create()
|
||||
->filterByAreaId($area->getAreaId())
|
||||
->filterByMaxWeight($weight, Criteria::GREATER_EQUAL)
|
||||
->orderByMaxWeight(Criteria::ASC)
|
||||
->findOne()) {
|
||||
$price = min($price, $deliveryPrice->getPriceWithTax());
|
||||
|
||||
$deliveryDelay = $zoneConfig->getDeliveryTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$relayAllowed = MondialRelay::getConfigValue(MondialRelay::ALLOW_RELAY_DELIVERY, true);
|
||||
$homeAllowed = MondialRelay::getConfigValue(MondialRelay::ALLOW_HOME_DELIVERY, true);
|
||||
|
||||
if (($countryHasHome && $homeAllowed) || ($countryHasRelay && $relayAllowed) && $price !== PHP_INT_MAX) {
|
||||
// The module could be used !
|
||||
$valid = true;
|
||||
|
||||
$deliveryDate = (new \DateTime())->add(new \DateInterval("P" . $deliveryDelay . "D"));
|
||||
|
||||
$event
|
||||
->setPostage($price)
|
||||
->setDeliveryDate($deliveryDate);
|
||||
}
|
||||
}
|
||||
|
||||
$event->setValidModule($valid);
|
||||
|
||||
$event->stopPropagation();
|
||||
}
|
||||
|
||||
protected function makeHoraire($str)
|
||||
{
|
||||
return substr($str, 0, 2) . ':' . substr($str, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FindRelayEvent $event
|
||||
* @param $eventName
|
||||
* @param EventDispatcherInterface $dispatcher
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function findRelays(FindRelayEvent $event, $eventName, EventDispatcherInterface $dispatcher)
|
||||
{
|
||||
$days = [
|
||||
'monday' => Translator::getInstance()->trans("Monday"),
|
||||
'tuesday' => Translator::getInstance()->trans("Tuesday"),
|
||||
'wednesday' => Translator::getInstance()->trans("Wednesday"),
|
||||
'thursday' => Translator::getInstance()->trans("Thursday"),
|
||||
'friday' => Translator::getInstance()->trans("Friday"),
|
||||
'saturday' => Translator::getInstance()->trans("Saturday"),
|
||||
'sunday' => Translator::getInstance()->trans("Sunday")
|
||||
];
|
||||
|
||||
$points = [];
|
||||
|
||||
if (null !== $country = CountryQuery::create()->findPk($event->getCountryId())) {
|
||||
$apiClient = new ApiClient(
|
||||
new \SoapClient(MondialRelay::getConfigValue(MondialRelay::WEBSERVICE_URL)),
|
||||
MondialRelay::getConfigValue(MondialRelay::CODE_ENSEIGNE),
|
||||
MondialRelay::getConfigValue(MondialRelay::PRIVATE_KEY)
|
||||
);
|
||||
|
||||
$cartWeightInGrammes = 1000 * $this->requestStack
|
||||
->getCurrentRequest()
|
||||
->getSession()
|
||||
->getSessionCart($dispatcher)
|
||||
->getWeight();
|
||||
|
||||
$requestParams = [
|
||||
'NumPointRelais' => $event->getNumPointRelais(),
|
||||
'Pays' => strtoupper($country->getIsoalpha2()),
|
||||
'Ville' => $event->getCity(),
|
||||
'CP' => $event->getZipcode(),
|
||||
//'Latitude' => "",
|
||||
//'Longitude' => "",
|
||||
//'Taille' => "",
|
||||
'Poids' => $cartWeightInGrammes,
|
||||
//'Action' => "",
|
||||
//'DelaiEnvoi' => "0",
|
||||
'RayonRecherche' => $event->getSearchRadius()
|
||||
];
|
||||
|
||||
try {
|
||||
$points = $apiClient->findDeliveryPoints($requestParams);
|
||||
} catch (\Exception $ex) {
|
||||
$points = [];
|
||||
|
||||
$event->setError($ex->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
$normalizedPoints = [];
|
||||
|
||||
/** @var Point $point */
|
||||
foreach ($points as $point) {
|
||||
$normalizedPoint = [
|
||||
'id' => $point->id(),
|
||||
'latitude' => $point->latitude(),
|
||||
'longitude' => $point->longitude(),
|
||||
'zipcode' => $point->cp(),
|
||||
'city' => $point->city(),
|
||||
'country' => $point->country(),
|
||||
'distance' => $point->distance(),
|
||||
'distance_km' => round($point->distance() / 1000, 1)
|
||||
];
|
||||
|
||||
$addresses = $point->address();
|
||||
|
||||
$nom = $addresses[0];
|
||||
if (! empty($adresses[1])) {
|
||||
$nom .= '<br> ' . $addresses[1];
|
||||
}
|
||||
|
||||
$normalizedPoint["name"] = $nom;
|
||||
|
||||
$address = $addresses[2];
|
||||
if (! empty($adresses[3])) {
|
||||
$address .= '<br> ' . $addresses[3];
|
||||
}
|
||||
|
||||
$normalizedPoint["address"] = $address;
|
||||
|
||||
|
||||
$horaires = [];
|
||||
|
||||
/** @var BussinessHours $horaire */
|
||||
foreach ($point->business_hours() as $horaire) {
|
||||
if ($horaire->openingTime1() != '0000' && $horaire->openingTime2() !== '0000') {
|
||||
$data = [ 'day' => $days[$horaire->day()]];
|
||||
|
||||
$o1 = $horaire->openingTime1();
|
||||
$o2 = $horaire->openingTime2();
|
||||
|
||||
if (! empty($o1) && $o1 != '0000') {
|
||||
$data['opening_time_1'] = $this->makeHoraire($horaire->openingTime1());
|
||||
$data['closing_time_1'] = $this->makeHoraire($horaire->closingTime1());
|
||||
}
|
||||
|
||||
if (! empty($o2) && $o2 != '0000') {
|
||||
$data['opening_time_2'] = $this->makeHoraire($horaire->openingTime2());
|
||||
$data['closing_time_2'] = $this->makeHoraire($horaire->closingTime2());
|
||||
}
|
||||
|
||||
$horaires[] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
$normalizedPoint["openings"] = $horaires;
|
||||
|
||||
$normalizedPoints[] = $normalizedPoint;
|
||||
}
|
||||
|
||||
$event->setPoints($normalizedPoints);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the order delivery address with MondialRelay point data
|
||||
*
|
||||
* @param OrderEvent $event
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function updateOrderDeliveryAddress(OrderEvent $event)
|
||||
{
|
||||
/** @var Session $session */
|
||||
$session = $this->requestStack->getCurrentRequest()->getSession();
|
||||
|
||||
if (null !== $mrAddressId = $session->get(MondialRelay::SESSION_SELECTED_PICKUP_RELAY_ID)) {
|
||||
if (null !== $mrRelayPickup = MondialRelayPickupAddressQuery::create()->findPk($mrAddressId)) {
|
||||
if (false !== $relayData = json_decode($mrRelayPickup->getJsonRelayData(), true)) {
|
||||
if (null !== $orderAddress = OrderAddressQuery::create()->findPK($event->getOrder()->getDeliveryOrderAddressId())) {
|
||||
$orderAddress
|
||||
->setCompany($relayData['name'])
|
||||
->setFirstname(
|
||||
Translator::getInstance()->trans(
|
||||
"Pickup relay #%number",
|
||||
[ '%number' => $relayData['id']],
|
||||
MondialRelay::DOMAIN_NAME
|
||||
)
|
||||
)
|
||||
->setLastname('')
|
||||
->setAddress1($relayData['address'])
|
||||
->setAddress2('')
|
||||
->setAddress3('')
|
||||
->setZipcode($relayData['zipcode'])
|
||||
->setCity($relayData['city'])
|
||||
->setCountry(CountryQuery::create()->findOneByIsoalpha2($relayData['country']))
|
||||
->save();
|
||||
|
||||
$mrRelayPickup
|
||||
->setOrderAddressId($orderAddress->getId())
|
||||
->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OrderEvent $event
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function updateCurrentDeliveryAddress(OrderEvent $event, $eventName, EventDispatcherInterface $dispatcher)
|
||||
{
|
||||
/** @var Request $request */
|
||||
$request = $this->requestStack->getCurrentRequest();
|
||||
|
||||
/** @var Session $session */
|
||||
$session = $request->getSession();
|
||||
|
||||
// Reset stored pickup address, if any
|
||||
if (null !== $mrAddressId = $session->remove(MondialRelay::SESSION_SELECTED_PICKUP_RELAY_ID)) {
|
||||
// Do not delete, as the customer may have do a back, and restart another order
|
||||
// MondialRelayPickupAddressQuery::create()->filterById($mrAddressId)->delete();
|
||||
}
|
||||
|
||||
if ($event->getDeliveryModule() == MondialRelay::getModuleId()) {
|
||||
// Check selected MondialRlay mode
|
||||
$mode = $request->get('mondial-relay-selected-delivery-mode');
|
||||
|
||||
if ($mode == 'pickup') {
|
||||
// Get the selected pickup relay
|
||||
if (null !== $relayId = $request->get('mondialrelay_relay', null)) {
|
||||
$countryId = $request->get('mondial_relay_country_id', 0);
|
||||
|
||||
// Load pickup data for the selected point
|
||||
$relayDataEvent = new FindRelayEvent($countryId, '', '', 0);
|
||||
$relayDataEvent->setNumPointRelais($relayId);
|
||||
|
||||
$dispatcher->dispatch(MondialRelayEvents::FIND_RELAYS, $relayDataEvent);
|
||||
|
||||
// We're supposed to get only one point
|
||||
$points = $relayDataEvent->getPoints();
|
||||
|
||||
if (isset($points[0])) {
|
||||
// Create a new record to store the pickup data
|
||||
$pickupAddress = new MondialRelayPickupAddress();
|
||||
$pickupAddress
|
||||
->setJsonRelayData(json_encode($points[0]))
|
||||
->save();
|
||||
|
||||
$session->set(MondialRelay::SESSION_SELECTED_PICKUP_RELAY_ID, $pickupAddress->getId());
|
||||
}
|
||||
} else {
|
||||
throw new TheliaProcessException("No Mondial Relay pickeup relay selected.");
|
||||
}
|
||||
} elseif ($mode !== 'home') {
|
||||
throw new TheliaProcessException("Mondial Relay delivery mode was not selected.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear stored information once the order has been processed.
|
||||
*
|
||||
* @param OrderEvent $event
|
||||
* @param $eventName
|
||||
* @param EventDispatcherInterface $dispatcher
|
||||
*/
|
||||
public function clearDeliveryData(OrderEvent $event, $eventName, EventDispatcherInterface $dispatcher)
|
||||
{
|
||||
$session = $this->requestStack->getCurrentRequest()->getSession();
|
||||
|
||||
// Clear the session context
|
||||
$session->remove(MondialRelay::SESSION_SELECTED_DELIVERY_TYPE);
|
||||
$session->remove(MondialRelay::SESSION_SELECTED_PICKUP_RELAY_ID);
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return [
|
||||
TheliaEvents::getModuleEvent(
|
||||
TheliaEvents::MODULE_DELIVERY_GET_POSTAGE,
|
||||
MondialRelay::getModuleCode()
|
||||
) => [ "processDeliveryPostageEvent", 128 ],
|
||||
TheliaEvents::ORDER_SET_DELIVERY_MODULE => ['updateCurrentDeliveryAddress', 64],
|
||||
TheliaEvents::ORDER_BEFORE_PAYMENT => ['updateOrderDeliveryAddress', 256],
|
||||
TheliaEvents::ORDER_CART_CLEAR => ['clearDeliveryData', 256],
|
||||
|
||||
MondialRelayEvents::FIND_RELAYS => [ "findRelays" , 128]
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace MondialRelay\EventListeners;
|
||||
|
||||
use MondialRelay\MondialRelay;
|
||||
use SoColissimo\SoColissimo;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Mailer\MailerFactory;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
|
||||
class SendDeliveryEmail implements EventSubscriberInterface
|
||||
{
|
||||
/**
|
||||
* @var MailerFactory
|
||||
*/
|
||||
protected $mailer;
|
||||
|
||||
public function __construct(MailerFactory $mailer)
|
||||
{
|
||||
$this->mailer = $mailer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OrderEvent $event
|
||||
* @throws \Exception
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function updateStatus(OrderEvent $event)
|
||||
{
|
||||
$order = $event->getOrder();
|
||||
|
||||
$deliveryRef = $order->getDeliveryRef();
|
||||
|
||||
if ($order->isSent()
|
||||
&&
|
||||
! empty($deliveryRef)
|
||||
&&
|
||||
$order->getDeliveryModuleId() == MondialRelay::getModuleId()
|
||||
) {
|
||||
if (null !== $contactEmail = ConfigQuery::read('store_email')) {
|
||||
$this->mailer->sendEmailToCustomer(
|
||||
MondialRelay::TRACKING_MESSAGE_NAME,
|
||||
$order->getCustomer(),
|
||||
[
|
||||
'order_id' => $order->getId(),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
TheliaEvents::ORDER_UPDATE_STATUS => array("updateStatus", 128)
|
||||
);
|
||||
}
|
||||
}
|
||||
42
local/modules/MondialRelay/Form/InsuranceCreateForm.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace MondialRelay\Form;
|
||||
|
||||
use MondialRelay\MondialRelay;
|
||||
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
|
||||
use Thelia\Form\BaseForm;
|
||||
|
||||
/**
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class InsuranceCreateForm extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
'max_value',
|
||||
'number',
|
||||
[
|
||||
"constraints" => [new GreaterThanOrEqual([ 'value' => 0 ])],
|
||||
'label' => $this->translator->trans('Cart value', [], MondialRelay::DOMAIN_NAME),
|
||||
]
|
||||
)->add(
|
||||
'price_with_tax',
|
||||
'number',
|
||||
[
|
||||
"constraints" => [new GreaterThanOrEqual([ 'value' => 0 ])],
|
||||
'label' => $this->translator->trans('Insurance price', [], MondialRelay::DOMAIN_NAME),
|
||||
]
|
||||
)
|
||||
;
|
||||
}
|
||||
}
|
||||
50
local/modules/MondialRelay/Form/InsurancesUpdateForm.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace MondialRelay\Form;
|
||||
|
||||
use MondialRelay\MondialRelay;
|
||||
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
|
||||
use Thelia\Form\BaseForm;
|
||||
|
||||
/**
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class InsurancesUpdateForm extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
'max_value',
|
||||
'collection',
|
||||
[
|
||||
"type" => 'number',
|
||||
"constraints" => [new GreaterThanOrEqual([ 'value' => 0 ])],
|
||||
'label' => $this->translator->trans('Cart value', [], MondialRelay::DOMAIN_NAME),
|
||||
'label_attr' => [ ],
|
||||
'allow_add' => true,
|
||||
'allow_delete' => true,
|
||||
]
|
||||
)->add(
|
||||
'price_with_tax',
|
||||
'collection',
|
||||
[
|
||||
"type" => 'number',
|
||||
"constraints" => [new GreaterThanOrEqual([ 'value' => 0 ])],
|
||||
'label' => $this->translator->trans('Insurance price', [], MondialRelay::DOMAIN_NAME),
|
||||
'label_attr' => [ ],
|
||||
'allow_add' => true,
|
||||
'allow_delete' => true,
|
||||
]
|
||||
)
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace MondialRelay\Form;
|
||||
|
||||
use MondialRelay\Model\MondialRelayZoneConfiguration;
|
||||
use MondialRelay\MondialRelay;
|
||||
use Symfony\Component\Validator\Constraints\GreaterThan;
|
||||
use Thelia\Form\BaseForm;
|
||||
|
||||
/**
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class PriceAttributesUpdateForm extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
'delivery_time',
|
||||
'integer',
|
||||
[
|
||||
"constraints" => [new GreaterThan([ 'value' => 0 ])],
|
||||
'label' => $this->translator->trans('Delivery delay', [], MondialRelay::DOMAIN_NAME),
|
||||
]
|
||||
)->add(
|
||||
'delivery_type',
|
||||
'choice',
|
||||
[
|
||||
"choices" => [
|
||||
MondialRelayZoneConfiguration::RELAY_DELIVERY_TYPE => $this->translator->trans('Relay delivery', [], MondialRelay::DOMAIN_NAME),
|
||||
MondialRelayZoneConfiguration::HOME_DELIVERY_TYPE => $this->translator->trans('Home delivery', [], MondialRelay::DOMAIN_NAME),
|
||||
MondialRelayZoneConfiguration::ALL_DELIVERY_TYPE => $this->translator->trans('Home and relay delivery', [], MondialRelay::DOMAIN_NAME)
|
||||
],
|
||||
'label' => $this->translator->trans('Delivery type', [], MondialRelay::DOMAIN_NAME),
|
||||
]
|
||||
)
|
||||
;
|
||||
}
|
||||
}
|
||||
42
local/modules/MondialRelay/Form/PriceCreateForm.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace MondialRelay\Form;
|
||||
|
||||
use MondialRelay\MondialRelay;
|
||||
use Symfony\Component\Validator\Constraints\GreaterThan;
|
||||
use Thelia\Form\BaseForm;
|
||||
|
||||
/**
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class PriceCreateForm extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
'max_weight',
|
||||
'number',
|
||||
[
|
||||
"constraints" => [new GreaterThan([ 'value' => 0 ])],
|
||||
'label' => $this->translator->trans('Weight up to...', [], MondialRelay::DOMAIN_NAME),
|
||||
]
|
||||
)->add(
|
||||
'price',
|
||||
'number',
|
||||
[
|
||||
"constraints" => [new GreaterThan([ 'value' => 0 ])],
|
||||
'label' => $this->translator->trans('Price', [], MondialRelay::DOMAIN_NAME),
|
||||
]
|
||||
)
|
||||
;
|
||||
}
|
||||
}
|
||||
48
local/modules/MondialRelay/Form/PricesUpdateForm.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace MondialRelay\Form;
|
||||
|
||||
use MondialRelay\MondialRelay;
|
||||
use Symfony\Component\Validator\Constraints\GreaterThan;
|
||||
use Thelia\Form\BaseForm;
|
||||
|
||||
/**
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class PricesUpdateForm extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
'max_weight',
|
||||
'collection',
|
||||
[
|
||||
"type" => "number",
|
||||
"constraints" => [new GreaterThan([ 'value' => 0 ])],
|
||||
'label' => $this->translator->trans('Weight up to...', [], MondialRelay::DOMAIN_NAME),
|
||||
'allow_add' => true,
|
||||
'allow_delete' => true,
|
||||
]
|
||||
)->add(
|
||||
'price',
|
||||
'collection',
|
||||
[
|
||||
"type" => "number",
|
||||
"constraints" => [new GreaterThan([ 'value' => 0 ])],
|
||||
'label' => $this->translator->trans('Price', [], MondialRelay::DOMAIN_NAME),
|
||||
'allow_add' => true,
|
||||
'allow_delete' => true,
|
||||
]
|
||||
)
|
||||
;
|
||||
}
|
||||
}
|
||||
105
local/modules/MondialRelay/Form/SettingsForm.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace MondialRelay\Form;
|
||||
|
||||
use MondialRelay\MondialRelay;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Thelia\Form\BaseForm;
|
||||
|
||||
/**
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class SettingsForm extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
MondialRelay::CODE_ENSEIGNE,
|
||||
'text',
|
||||
[
|
||||
"constraints" => [new NotBlank()],
|
||||
'label' => $this->translator->trans('Mondial Relay store code', [], MondialRelay::DOMAIN_NAME),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans('This is the store code, as provided by Mondial Relay.', [], MondialRelay::DOMAIN_NAME)
|
||||
]
|
||||
|
||||
]
|
||||
)->add(
|
||||
MondialRelay::PRIVATE_KEY,
|
||||
'text',
|
||||
[
|
||||
"constraints" => [new NotBlank()],
|
||||
'label' => $this->translator->trans('Private key', [], MondialRelay::DOMAIN_NAME),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans('Your private key, as provided by Mondial Relay.', [], MondialRelay::DOMAIN_NAME)
|
||||
]
|
||||
|
||||
]
|
||||
)->add(
|
||||
MondialRelay::ALLOW_HOME_DELIVERY,
|
||||
'checkbox',
|
||||
[
|
||||
'required' => false,
|
||||
'label' => $this->translator->trans('Allow home delivery', [], MondialRelay::DOMAIN_NAME),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans('Check this box to allow delivery at customer address in supported countries.', [], MondialRelay::DOMAIN_NAME)
|
||||
]
|
||||
|
||||
]
|
||||
)->add(
|
||||
MondialRelay::ALLOW_RELAY_DELIVERY,
|
||||
'checkbox',
|
||||
[
|
||||
'required' => false,
|
||||
'label' => $this->translator->trans('Allow relay delivery', [], MondialRelay::DOMAIN_NAME),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans('Check this box to allow delivery in relays in supported countries.', [], MondialRelay::DOMAIN_NAME)
|
||||
]
|
||||
|
||||
]
|
||||
)->add(
|
||||
MondialRelay::ALLOW_INSURANCE,
|
||||
'checkbox',
|
||||
[
|
||||
'required' => false,
|
||||
'label' => $this->translator->trans('Allow optional insurance', [], MondialRelay::DOMAIN_NAME),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans('Check this box to allow an optionnal insurance selection depending on cart value.', [], MondialRelay::DOMAIN_NAME)
|
||||
]
|
||||
|
||||
]
|
||||
)->add(
|
||||
MondialRelay::WEBSERVICE_URL,
|
||||
'text',
|
||||
[
|
||||
'label' => $this->translator->trans('Mondial Relay Web service WSDL URL', [], MondialRelay::DOMAIN_NAME),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans('This is the URL of the Mondial Relay web service WSDL.', [], MondialRelay::DOMAIN_NAME)
|
||||
]
|
||||
]
|
||||
)->add(
|
||||
MondialRelay::GOOGLE_MAPS_API_KEY,
|
||||
'text',
|
||||
[
|
||||
'label' => $this->translator->trans('Google Map API Key', [], MondialRelay::DOMAIN_NAME),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans(
|
||||
'This key is required to display relays map. <a href="%get_key_url">Click here</a> to get one.',
|
||||
[ "%get_key_url" => "https://developers.google.com/maps/documentation/javascript/get-api-key" ],
|
||||
MondialRelay::DOMAIN_NAME
|
||||
)
|
||||
]
|
||||
]
|
||||
);
|
||||
;
|
||||
}
|
||||
}
|
||||
57
local/modules/MondialRelay/Hook/AdminHookManager.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace MondialRelay\Hook;
|
||||
|
||||
use MondialRelay\MondialRelay;
|
||||
use Thelia\Core\Event\Hook\HookRenderBlockEvent;
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
class AdminHookManager extends BaseHook
|
||||
{
|
||||
public function onModuleConfigure(HookRenderEvent $event)
|
||||
{
|
||||
$vars = [
|
||||
'code_enseigne' => MondialRelay::getConfigValue(MondialRelay::CODE_ENSEIGNE),
|
||||
'private_key' => MondialRelay::getConfigValue(MondialRelay::PRIVATE_KEY),
|
||||
'allow_relay_delivery' => MondialRelay::getConfigValue(MondialRelay::ALLOW_RELAY_DELIVERY),
|
||||
'allow_home_delivery' => MondialRelay::getConfigValue(MondialRelay::ALLOW_HOME_DELIVERY),
|
||||
'allow_insurance' => MondialRelay::getConfigValue(MondialRelay::ALLOW_INSURANCE),
|
||||
|
||||
'module_id' => MondialRelay::getModuleId()
|
||||
];
|
||||
|
||||
$event->add(
|
||||
$this->render('mondialrelay/module-configuration.html', $vars)
|
||||
);
|
||||
}
|
||||
|
||||
public function onMainTopMenuTools(HookRenderBlockEvent $event)
|
||||
{
|
||||
$event->add(
|
||||
[
|
||||
'id' => 'tools_mondial_relay',
|
||||
'class' => '',
|
||||
'url' => URL::getInstance()->absoluteUrl('/admin/module/MondialRelay'),
|
||||
'title' => $this->trans('Mondial Relay', [], MondialRelay::DOMAIN_NAME)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function onModuleConfigureJs(HookRenderEvent $event)
|
||||
{
|
||||
$event
|
||||
->add($this->render("mondialrelay/assets/js/mondialrelay.js.html"))
|
||||
->add($this->addJS("mondialrelay/assets/js/bootstrap-notify.min.js"))
|
||||
;
|
||||
}
|
||||
}
|
||||
65
local/modules/MondialRelay/Hook/EmailHookManager.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace MondialRelay\Hook;
|
||||
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
|
||||
class EmailHookManager extends BaseHook
|
||||
{
|
||||
protected function renderAddressTemplate(HookRenderEvent $event, $htmlMode = false)
|
||||
{
|
||||
$event->add(
|
||||
$this->render(
|
||||
'mondialrelay/order-delivery-address.html',
|
||||
[
|
||||
'module_id' => $event->getArgument('module'),
|
||||
'order_id' => $event->getArgument('order'),
|
||||
'html_mode' => $htmlMode ? '1' : '0'
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function onDeliveryAddressText(HookRenderEvent $event)
|
||||
{
|
||||
$this->renderAddressTemplate($event, false);
|
||||
}
|
||||
|
||||
public function onDeliveryAddressHtml(HookRenderEvent $event)
|
||||
{
|
||||
$this->renderAddressTemplate($event, true);
|
||||
}
|
||||
|
||||
public function onAfterProductsText(HookRenderEvent $event)
|
||||
{
|
||||
$event->add(
|
||||
$this->render(
|
||||
'mondialrelay/opening-hours-text.html',
|
||||
[
|
||||
'order_id' => $event->getArgument('order'),
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function onAfterProductsHtml(HookRenderEvent $event)
|
||||
{
|
||||
$event->add(
|
||||
$this->render(
|
||||
'mondialrelay/opening-hours-html.html',
|
||||
[
|
||||
'order_id' => $event->getArgument('order'),
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
53
local/modules/MondialRelay/Hook/FrontHookManager.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace MondialRelay\Hook;
|
||||
|
||||
use MondialRelay\MondialRelay;
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
|
||||
class FrontHookManager extends BaseHook
|
||||
{
|
||||
public function onOrderDeliveryExtra(HookRenderEvent $event)
|
||||
{
|
||||
// Clear the session context
|
||||
$this->getSession()->remove(MondialRelay::SESSION_SELECTED_DELIVERY_TYPE);
|
||||
$this->getSession()->remove(MondialRelay::SESSION_SELECTED_PICKUP_RELAY_ID);
|
||||
|
||||
// Get the address id from the request, as the hook don(t give it to us.
|
||||
$addressId = $this->getRequest()->get('address_id', 0);
|
||||
|
||||
$event->add(
|
||||
$this->render(
|
||||
'mondialrelay/order-delivery-extra.html',
|
||||
[
|
||||
'module_id' => MondialRelay::getModuleId(),
|
||||
'address_id' => $addressId
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function onAccountOrderDeliveryAddress(HookRenderEvent $event)
|
||||
{
|
||||
$event->add(
|
||||
$this->render(
|
||||
'mondialrelay/order-delivery-address.html',
|
||||
[
|
||||
'order_id' => $event->getArgument('order'),
|
||||
'module_id' => $event->getArgument('module')
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
42
local/modules/MondialRelay/Hook/PdfHookManager.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace MondialRelay\Hook;
|
||||
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
|
||||
class PdfHookManager extends BaseHook
|
||||
{
|
||||
public function onDeliveryAddress(HookRenderEvent $event)
|
||||
{
|
||||
$event->add(
|
||||
$this->render(
|
||||
'mondialrelay/order-delivery-address.html',
|
||||
[
|
||||
'module_id' => $event->getArgument('module'),
|
||||
'order_id' => $event->getArgument('order'),
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
public function onAfterDeliveryModule(HookRenderEvent $event)
|
||||
{
|
||||
$event->add(
|
||||
$this->render(
|
||||
'mondialrelay/opening-hours.html',
|
||||
[
|
||||
'module_id' => $event->getArgument('module'),
|
||||
'order_id' => $event->getArgument('order'),
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
30
local/modules/MondialRelay/I18n/backOffice/default/en_US.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Add a new insurance' => 'Add a new insurance',
|
||||
'Add a new price' => 'Add a new price',
|
||||
'Add new insurance' => 'Add new insurance',
|
||||
'Add this price' => 'Add this price',
|
||||
'Area properties' => 'Area properties',
|
||||
'Cart value' => 'Cart value',
|
||||
'Cart weight up to...' => 'Cart weight up to...',
|
||||
'Configuration' => 'Configuration',
|
||||
'Delete this insurance' => 'Delete this insurance',
|
||||
'Delete this price' => 'Delete this price',
|
||||
'Delivery prices' => 'Delivery prices',
|
||||
'Development of this module is sponsored by <a href="https://www.younivers.fr">you\'Nivers</a> web and communication agency in Roanne.' => 'Development of this module is sponsored by <a href="https://www.younivers.fr">you\'Nivers</a>, web and communication agency in Roanne.',
|
||||
'Insurance price with tax' => 'Insurance price with tax',
|
||||
'Insurances' => 'Insurances',
|
||||
'Mondial Relay delivery configuration' => 'Mondial Relay delivery configuration',
|
||||
'Price with tax' => 'Price with tax',
|
||||
'Prices' => 'Prices',
|
||||
'Save' => 'Save',
|
||||
'Save changes' => 'Save changes',
|
||||
'Saving data, please wait...' => 'Saving data, please wait...',
|
||||
'Shipping zone "%name"' => 'Shipping zone "%name"',
|
||||
'Sorry, something goes wrong. Please try again.' => 'Sorry, something goes wrong. Please try again.',
|
||||
'There\'s no shipping zone defined for Mondial Relay. Please <a href="%url">click here</a> to configure module\'s shipping zones.' => 'There\'s no shipping zone defined for Mondial Relay. Please <a href="%url">click here</a> to configure module\'s shipping zones.',
|
||||
'Update finished.' => 'Update finished.',
|
||||
'days' => 'days',
|
||||
'kg' => 'kg',
|
||||
);
|
||||
30
local/modules/MondialRelay/I18n/backOffice/default/fr_FR.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Add a new insurance' => 'Ajouter une assurance',
|
||||
'Add a new price' => 'Ajouter un prix',
|
||||
'Add new insurance' => 'Ajouter une assurance',
|
||||
'Add this price' => 'Ajouter ce prix',
|
||||
'Area properties' => 'Propriétés de la zone',
|
||||
'Cart value' => 'Montant du panier',
|
||||
'Cart weight up to...' => 'Jusqu\'au poids...',
|
||||
'Configuration' => 'Configuration',
|
||||
'Delete this insurance' => 'Supprimer cette assurance',
|
||||
'Delete this price' => 'Supprimer ce prix',
|
||||
'Delivery prices' => 'Prix de livraison',
|
||||
'Development of this module is sponsored by <a href="https://www.younivers.fr">you\'Nivers</a> web and communication agency in Roanne.' => 'Le développement de ce module est financé par <a href="https://www.younivers.fr">you\'Nivers</a>, créateurs de site Internet à Roanne.',
|
||||
'Insurance price with tax' => 'Prix de l\'assurance TTC',
|
||||
'Insurances' => 'Assurances',
|
||||
'Mondial Relay delivery configuration' => 'Configuration des livraisons avec Mondial Relay',
|
||||
'Price with tax' => 'Prix TTC',
|
||||
'Prices' => 'Prix',
|
||||
'Save' => 'Enregistrer',
|
||||
'Save changes' => 'Enregistrer',
|
||||
'Saving data, please wait...' => 'Enregistrement en cours, merci de patienter...',
|
||||
'Shipping zone "%name"' => 'Zone de livraison "%name"',
|
||||
'Sorry, something goes wrong. Please try again.' => 'Quelque chose s\'est mal passé, merdi de ré-essayer.',
|
||||
'There\'s no shipping zone defined for Mondial Relay. Please <a href="%url">click here</a> to configure module\'s shipping zones.' => 'Il n\'y a pas de zone de livraison attaché à Mondial Relay. <a href="%url">Cliquez ici</a> pour configurer les zones de livraison du module',
|
||||
'Update finished.' => 'Enregistrement terminé.',
|
||||
'days' => 'jours',
|
||||
'kg' => 'kg',
|
||||
);
|
||||
15
local/modules/MondialRelay/I18n/email/default/en_US.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Dear %first %last' => 'Dear %first %last',
|
||||
'Details about this order are available <a href="%account_url">in your customer account</a>.' => 'Details about this order are available <a href="%account_url">in your customer account</a>.',
|
||||
'Details about this order are available in your customer account: %account_url.' => 'Details about this order are available in your customer account: %account_url.',
|
||||
'Mondial Relay pickup location #%num' => 'Mondial Relay pickup location #%num',
|
||||
'Pickup relay opening hours:' => 'Pickup relay opening hours:',
|
||||
'See you soon at %store at the following address: %url' => 'See you soon at %store at the following address: %url',
|
||||
'See you soon at <a href="%url">%store</a>' => 'See you soon at <a href="%url">%store</a>',
|
||||
'The %store team.' => 'The %store team.',
|
||||
'Your %ref order has been shipped' => 'Your %ref order has been shipped',
|
||||
'Your order %order_ref has just been shipped from our store. The tracking number for this order is %tracking_ref. Please <a href="https://www.mondialrelay.fr/suivi-de-colis">click here</a> to track the delivery.' => 'Your order %order_ref has just been shipped from our store. The tracking number for this order is %tracking_ref. Please <a href="https://www.mondialrelay.fr/suivi-de-colis">click here</a> to track the delivery.',
|
||||
'Your order %order_ref has just been shipped from our store. The tracking number for this order is %tracking_ref. Tracking data is available at this address: https://www.mondialrelay.fr/suivi-de-colis' => 'Your order %order_ref has just been shipped from our store. The tracking number for this order is %tracking_ref. Tracking data is available at this address: https://www.mondialrelay.fr/suivi-de-colis',
|
||||
);
|
||||
15
local/modules/MondialRelay/I18n/email/default/fr_FR.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Dear %first %last' => 'Bonjour %first %last',
|
||||
'Details about this order are available <a href="%account_url">in your customer account</a>.' => 'Les détails de cette commande sont disponibles <a href="%account_url">dans votre compte client</a>.',
|
||||
'Details about this order are available in your customer account: %account_url.' => 'Les détails de cette commande sont disponibles dans votre compte client: %account_url.',
|
||||
'Mondial Relay pickup location #%num' => 'Point relais Mondial Relay No. %num',
|
||||
'Pickup relay opening hours:' => 'Horaires d\'ouverture du relais',
|
||||
'See you soon at %store at the following address: %url' => 'A bientôt sur %store en suivant ce lien: %url',
|
||||
'See you soon at <a href="%url">%store</a>' => 'A bientôt sur <a href="%url">%store</a>',
|
||||
'The %store team.' => 'L\'équipe %store.',
|
||||
'Your %ref order has been shipped' => 'Votre commande %ref a été expédiée.',
|
||||
'Your order %order_ref has just been shipped from our store. The tracking number for this order is %tracking_ref. Please <a href="https://www.mondialrelay.fr/suivi-de-colis">click here</a> to track the delivery.' => 'Votre commande %order_ref vient de quitter nos entrepôts. Le numéro de suivi est %tracking_ref. <a href="https://www.mondialrelay.fr/suivi-de-colis">Merci de cliquer ici</a> pour obtenir les informations de suivi.',
|
||||
'Your order %order_ref has just been shipped from our store. The tracking number for this order is %tracking_ref. Tracking data is available at this address: https://www.mondialrelay.fr/suivi-de-colis' => 'Votre commande %order_ref vient de quitter nos entrepôts. Le numéro de suivi est %tracking_ref. Pour obtenir des informations sur l\'avancement de votre commande, merci de suivre ce lien: https://www.mondialrelay.fr/suivi-de-colis',
|
||||
);
|
||||
38
local/modules/MondialRelay/I18n/en_US.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Allow home delivery' => 'Allow home delivery',
|
||||
'Allow optional insurance' => 'Allow optional insurance',
|
||||
'Allow relay delivery' => 'Allow relay delivery',
|
||||
'Cart value' => 'Cart value',
|
||||
'Check this box to allow an optionnal insurance selection depending on cart value.' => 'Check this box to allow an optionnal insurance selection depending on cart value.',
|
||||
'Check this box to allow delivery at customer address in supported countries.' => 'Check this box to allow delivery at customer address in supported countries.',
|
||||
'Check this box to allow delivery in relays in supported countries.' => 'Check this box to allow delivery in relays in supported countries.',
|
||||
'Delivery delay' => 'Delivery delay',
|
||||
'Delivery type' => 'Delivery type',
|
||||
'Friday' => 'Friday',
|
||||
'Google Map API Key' => 'Google Map API Key',
|
||||
'Home and relay delivery' => 'Home and relay delivery',
|
||||
'Home delivery' => 'Home delivery',
|
||||
'Insurance price' => 'Insurance price',
|
||||
'Monday' => 'Monday',
|
||||
'Mondial Relay' => 'Mondial Relay',
|
||||
'Mondial Relay Web service WSDL URL' => 'Mondial Relay Web service WSDL URL',
|
||||
'Mondial Relay store code' => 'Mondial Relay store code',
|
||||
'Mondial Relay tracking information' => 'Mondial Relay tracking information',
|
||||
'Pickup relay #%number' => 'Pickup relay #%number',
|
||||
'Price' => 'Price',
|
||||
'Private key' => 'Private key',
|
||||
'Relay delivery' => 'Relay delivery',
|
||||
'Saturday' => 'Saturday',
|
||||
'Sunday' => 'Sunday',
|
||||
'This is the URL of the Mondial Relay web service WSDL.' => 'This is the URL of the Mondial Relay web service WSDL.',
|
||||
'This is the store code, as provided by Mondial Relay.' => 'This is the store code, as provided by Mondial Relay.',
|
||||
'This key is required to display relays map. <a href="%get_key_url">Click here</a> to get one.' => 'This key is required to display relays map. <a href="%get_key_url">Click here</a> to get one.',
|
||||
'Thursday' => 'Thursday',
|
||||
'Tuesday' => 'Tuesday',
|
||||
'Wednesday' => 'Wednesday',
|
||||
'Weight up to...' => 'Weight up to...',
|
||||
'Your order has been shipped' => 'Your order has been shipped',
|
||||
'Your private key, as provided by Mondial Relay.' => 'Your private key, as provided by Mondial Relay.',
|
||||
);
|
||||
38
local/modules/MondialRelay/I18n/fr_FR.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Allow home delivery' => 'Autoriser la livraison à domicile',
|
||||
'Allow optional insurance' => 'Proposer une assurance optionnelle',
|
||||
'Allow relay delivery' => 'Autoriser la livraison en point relais',
|
||||
'Cart value' => 'Valeur du panier',
|
||||
'Check this box to allow an optionnal insurance selection depending on cart value.' => 'Cochez cette case pour proposer à vos client une assurance optionnelle, fonction du montant du panier',
|
||||
'Check this box to allow delivery at customer address in supported countries.' => 'Cochez cette case pour autoriser les livraison à domicile dans les pays ou Mondial Relay le propose',
|
||||
'Check this box to allow delivery in relays in supported countries.' => 'Cochez cette case pour autoriser les livraison en pojt relais dans les pays ou Mondial Relay le propose',
|
||||
'Delivery delay' => 'Délai de livraison',
|
||||
'Delivery type' => 'Type de livraison',
|
||||
'Friday' => 'Vendredi',
|
||||
'Google Map API Key' => 'Clef d\'API Google Maps',
|
||||
'Home and relay delivery' => 'Livraison en point relais ou à domicile',
|
||||
'Home delivery' => 'Livraison à mon domicile',
|
||||
'Insurance price' => 'Montant de l\'assurance',
|
||||
'Monday' => 'Lundi',
|
||||
'Mondial Relay' => 'Mondial Relay',
|
||||
'Mondial Relay Web service WSDL URL' => 'URL du WSDL du web service Mondial Relay',
|
||||
'Mondial Relay store code' => 'Code magasin Mondial Relay',
|
||||
'Mondial Relay tracking information' => 'Informations de suivi Mondial Relay',
|
||||
'Pickup relay #%number' => 'Point relais No. %number',
|
||||
'Price' => 'Prix',
|
||||
'Private key' => 'Clef privée',
|
||||
'Relay delivery' => 'Livraison en point relais',
|
||||
'Saturday' => 'Samedi',
|
||||
'Sunday' => 'Dimanche',
|
||||
'This is the URL of the Mondial Relay web service WSDL.' => 'Il s\'agit de l\'URL du descripteur du web service Mondial Relay, qui sera appelée par le module',
|
||||
'This is the store code, as provided by Mondial Relay.' => 'Il s\'agit du code magasin fourni par Mondial Relay',
|
||||
'This key is required to display relays map. <a href="%get_key_url">Click here</a> to get one.' => 'Cette clef est indispensable pour afficher la carte des points relais. <a href="%get_key_url">Cliquez ici</a> pour en obtenir une.',
|
||||
'Thursday' => 'Jeudi',
|
||||
'Tuesday' => 'Mardi',
|
||||
'Wednesday' => 'Mercredi',
|
||||
'Weight up to...' => 'Jusqu\'au poids...',
|
||||
'Your order has been shipped' => 'Votre commande a été expédiée',
|
||||
'Your private key, as provided by Mondial Relay.' => 'Votre clef privée, fournie par Mondial Relay',
|
||||
);
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'City' => 'City',
|
||||
'Current address can\'t be geolocated' => 'Current address can\'t be geolocated',
|
||||
'Expected delivery date: %delivery_date' => 'Expected delivery date: %delivery_date',
|
||||
'Find' => 'Find',
|
||||
'Find a pickup location around you' => 'Find a pickup location around you',
|
||||
'Loading...' => 'Loading...',
|
||||
'Mondial Relay home delivery' => 'Mondial Relay home delivery',
|
||||
'Mondial Relay pickup location' => 'Mondial Relay pickup location',
|
||||
'Mondial Relay pickup location #%num' => 'Mondial Relay pickup #%num',
|
||||
'No pickup locations were found for this address.' => 'No pickup locations were found for this address.',
|
||||
'Oops, something goes wrong, please try again.' => 'Oops, something goes wrong, please try again.',
|
||||
'Pickup location #%number' => 'Pickup location #%number',
|
||||
'Pickup location address' => 'Pickup location address',
|
||||
'Pickup location opening hours' => 'Pickup location opening hours',
|
||||
'Please select a pickup location.' => 'Please select a pickup location.',
|
||||
'Search radius' => 'Search radius',
|
||||
'Sorry, we failed to get pickup locations. Error is : __ERR__.' => 'Sorry, we failed to get pickup locations. Error is : __ERR__.',
|
||||
'Zip code' => 'Zip code',
|
||||
'km' => 'km',
|
||||
);
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'City' => 'Ville',
|
||||
'Current address can\'t be geolocated' => 'L\'adresse sélectionné ne peut être géolocalisée, merci de vérifier qu\'elle est correcte.',
|
||||
'Expected delivery date: %delivery_date' => 'Date de livraison estimée: %delivery_date',
|
||||
'Find' => 'Go',
|
||||
'Find a pickup location around you' => 'Trouver un point relais autour de vous',
|
||||
'Loading...' => 'Chargement...',
|
||||
'Mondial Relay home delivery' => 'Livraison Mondial Relay à mon domicile',
|
||||
'Mondial Relay pickup location' => 'Adresse du point relais Mondial Relay',
|
||||
'Mondial Relay pickup location #%num' => 'Point relais Mondial Relay No. %num',
|
||||
'No pickup locations were found for this address.' => 'Nous n\'avons pas trouvé de point relais autour de cette adresse.',
|
||||
'Oops, something goes wrong, please try again.' => 'Oups, quelque chose n\'a pas fonctionné correctement. Merci de recommencer.',
|
||||
'Pickup location #%number' => 'Point relais No. %number',
|
||||
'Pickup location address' => 'Adresse du point relais',
|
||||
'Pickup location opening hours' => 'Horaires d\'ouverture du relais',
|
||||
'Please select a pickup location.' => 'Merci de choisir un point relais.',
|
||||
'Search radius' => 'Rayon de recherche',
|
||||
'Sorry, we failed to get pickup locations. Error is : __ERR__.' => 'Impossible d\'obtenir les points relais. L\'erreur est : __ERR__.',
|
||||
'Zip code' => 'Code postal',
|
||||
'km' => 'km',
|
||||
);
|
||||
6
local/modules/MondialRelay/I18n/pdf/default/en_US.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Mondial Relay pickup location #%num' => 'Mondial Relay pickup location #%num',
|
||||
'Pickup relay opening hours:' => 'Pickup relay opening hours:',
|
||||
);
|
||||
6
local/modules/MondialRelay/I18n/pdf/default/fr_FR.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Mondial Relay pickup location #%num' => 'Point relais Mondial Relay No. %num',
|
||||
'Pickup relay opening hours:' => 'Horaires d\'ouverture du relais',
|
||||
);
|
||||
165
local/modules/MondialRelay/LICENSE
Normal 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.
|
||||
76
local/modules/MondialRelay/Loop/AreaAttributes.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace MondialRelay\Loop;
|
||||
|
||||
use MondialRelay\Model\MondialRelayZoneConfiguration;
|
||||
use MondialRelay\Model\MondialRelayZoneConfigurationQuery;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
|
||||
/**
|
||||
* Class AreaAttributes
|
||||
* @package MondialRelay\Loop
|
||||
* @method int[] getAreaId()
|
||||
* @method int[] getDeliveryType()
|
||||
*/
|
||||
class AreaAttributes extends BaseLoop implements PropelSearchLoopInterface
|
||||
{
|
||||
/**
|
||||
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntListTypeArgument('area_id'),
|
||||
Argument::createIntListTypeArgument('delivery_type')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function buildModelCriteria()
|
||||
{
|
||||
$query = MondialRelayZoneConfigurationQuery::create();
|
||||
|
||||
if (null !== $areaId = $this->getAreaId()) {
|
||||
$query->filterByAreaId($areaId, Criteria::IN);
|
||||
}
|
||||
|
||||
if (null !== $delivTypes = $this->getDeliveryType()) {
|
||||
$query->filterByDeliveryType($delivTypes, Criteria::IN);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
/** @var MondialRelayZoneConfiguration $item */
|
||||
foreach ($loopResult->getResultDataCollection() as $item) {
|
||||
$loopResultRow = new LoopResultRow($item);
|
||||
|
||||
$loopResultRow
|
||||
->set('ID', $item->getId())
|
||||
->set('DELIVERY_TYPE', $item->getDeliveryType())
|
||||
->set('DELIVERY_TIME', $item->getDeliveryTime())
|
||||
->set('AREA_ID', $item->getAreaId())
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
213
local/modules/MondialRelay/Loop/DeliveryPrice.php
Normal file
@@ -0,0 +1,213 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace MondialRelay\Loop;
|
||||
|
||||
use MondialRelay\Model\MondialRelayDeliveryInsuranceQuery;
|
||||
use MondialRelay\Model\MondialRelayDeliveryPrice;
|
||||
use MondialRelay\Model\MondialRelayDeliveryPriceQuery;
|
||||
use MondialRelay\Model\MondialRelayZoneConfiguration;
|
||||
use MondialRelay\Model\MondialRelayZoneConfigurationQuery;
|
||||
use MondialRelay\MondialRelay;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Template\Element\ArraySearchLoopInterface;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Model\AreaDeliveryModuleQuery;
|
||||
use Thelia\Model\Cart;
|
||||
use Thelia\Model\CountryArea;
|
||||
use Thelia\Model\CountryAreaQuery;
|
||||
use Thelia\Model\CountryQuery;
|
||||
use Thelia\Model\ModuleQuery;
|
||||
use Thelia\Model\StateQuery;
|
||||
use Thelia\Type\EnumType;
|
||||
use Thelia\Type\TypeCollection;
|
||||
|
||||
/**
|
||||
* Class Prices
|
||||
* @package MondialRelay\Loop
|
||||
* @method int getCountryId()
|
||||
* @method int getStateId()
|
||||
* @method string getMode()
|
||||
* @method string getInsurance()
|
||||
*/
|
||||
class DeliveryPrice extends BaseLoop implements ArraySearchLoopInterface
|
||||
{
|
||||
/**
|
||||
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntTypeArgument('country_id', null, true),
|
||||
Argument::createIntTypeArgument('state_id'),
|
||||
Argument::createBooleanTypeArgument('insurance', null, false),
|
||||
new Argument(
|
||||
'mode',
|
||||
new TypeCollection(
|
||||
new EnumType(['home', 'relay', 'all'])
|
||||
),
|
||||
null,
|
||||
true
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function buildArray()
|
||||
{
|
||||
$results = [];
|
||||
|
||||
if (null !== $country = CountryQuery::create()->findPk($this->getCountryId())) {
|
||||
if ($country->getHasStates()) {
|
||||
if (null !== $stateId = $this->getStateId()) {
|
||||
$state = StateQuery::create()->findPk($this->$stateId());
|
||||
} else {
|
||||
$state = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
$state = null;
|
||||
|
||||
$mode = $this->getMode();
|
||||
|
||||
switch ($mode) {
|
||||
case 'home':
|
||||
$deliveryType = MondialRelayZoneConfiguration::HOME_DELIVERY_TYPE;
|
||||
|
||||
if (! MondialRelay::getConfigValue(MondialRelay::ALLOW_HOME_DELIVERY, true)) {
|
||||
return [];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'relay':
|
||||
$deliveryType = MondialRelayZoneConfiguration::RELAY_DELIVERY_TYPE;
|
||||
|
||||
if (! MondialRelay::getConfigValue(MondialRelay::ALLOW_RELAY_DELIVERY, true)) {
|
||||
return [];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'all':
|
||||
$deliveryType = MondialRelayZoneConfiguration::ALL_DELIVERY_TYPE;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Find all areas which contains this country
|
||||
$countryInAreaList = CountryAreaQuery::findByCountryAndState($country, $state);
|
||||
|
||||
$areaIdList = [];
|
||||
|
||||
$module = ModuleQuery::create()->findOneByCode(MondialRelay::getModuleCode());
|
||||
|
||||
/** @var CountryArea $countryInArea */
|
||||
foreach ($countryInAreaList as $countryInArea) {
|
||||
// Check if module is attached to the area
|
||||
if (AreaDeliveryModuleQuery::create()
|
||||
->filterByAreaId($countryInArea->getAreaId())
|
||||
->filterByModule($module)
|
||||
->count() > 0) {
|
||||
$areaIdList[] = $countryInArea->getAreaId();
|
||||
}
|
||||
}
|
||||
|
||||
// Find zones with the required delivery type
|
||||
$zones = MondialRelayZoneConfigurationQuery::create()
|
||||
->filterByAreaId($areaIdList, Criteria::IN)
|
||||
->filterByDeliveryType($deliveryType)
|
||||
->find();
|
||||
|
||||
/** @var Cart $cart */
|
||||
$cart = $this->requestStack
|
||||
->getCurrentRequest()
|
||||
->getSession()
|
||||
->getSessionCart($this->dispatcher)
|
||||
;
|
||||
|
||||
$cartWeight = $cart->getWeight();
|
||||
$cartValue = $cart->getTaxedAmount($country);
|
||||
|
||||
/** @var MondialRelayZoneConfiguration $zone */
|
||||
foreach ($zones as $zone) {
|
||||
$result = [];
|
||||
|
||||
if (null !== $deliveryPrice = MondialRelayDeliveryPriceQuery::create()
|
||||
->filterByAreaId($zone->getAreaId())
|
||||
->filterByMaxWeight($cartWeight, Criteria::GREATER_EQUAL)
|
||||
->orderByMaxWeight(Criteria::ASC)
|
||||
->findOne()) {
|
||||
$deliveryDate = (new \DateTime())->add(new \DateInterval("P" . $zone->getDeliveryTime() . "D"));
|
||||
|
||||
// We have a price
|
||||
$result['PRICE'] = $deliveryPrice->getPriceWithTax();
|
||||
$result['MAX_WEIGHT'] = $deliveryPrice->getMaxWeight();
|
||||
$result['AREA_ID'] = $deliveryPrice->getAreaId();
|
||||
$result['DELIVERY_DELAY'] = $zone->getDeliveryTime();
|
||||
$result['DELIVERY_DATE'] = $deliveryDate;
|
||||
switch ($zone->getDeliveryType()) {
|
||||
case MondialRelayZoneConfiguration::HOME_DELIVERY_TYPE:
|
||||
$result['ZONE_TYPE'] = 'home';
|
||||
break;
|
||||
|
||||
case MondialRelayZoneConfiguration::RELAY_DELIVERY_TYPE:
|
||||
$result['ZONE_TYPE'] = 'relay';
|
||||
break;
|
||||
|
||||
default:
|
||||
$result['ZONE_TYPE'] = '?';
|
||||
}
|
||||
|
||||
$result['TYPE'] = $zone->getDeliveryType();
|
||||
|
||||
// Get insurance cost
|
||||
if (null !== $insurance = MondialRelayDeliveryInsuranceQuery::create()
|
||||
->filterByMaxValue($cartValue, Criteria::GREATER_EQUAL)
|
||||
->orderByMaxValue(Criteria::ASC)
|
||||
->findOne()
|
||||
) {
|
||||
$result['INSURANCE_AVAILABLE'] = true;
|
||||
$result['INSURANCE_PRICE'] = $insurance->getPriceWithTax();
|
||||
$result['INSURANCE_REF_VALUE'] = $insurance->getMaxValue();
|
||||
} else {
|
||||
$result['INSURANCE_AVAILABLE'] = false;
|
||||
}
|
||||
|
||||
$results[] = $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
/** @var MondialRelayDeliveryPrice $item */
|
||||
foreach ($loopResult->getResultDataCollection() as $resultItem) {
|
||||
$loopResultRow = new LoopResultRow($item);
|
||||
|
||||
foreach ($resultItem as $name => $value) {
|
||||
$loopResultRow->set($name, $value);
|
||||
}
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
64
local/modules/MondialRelay/Loop/Insurances.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace MondialRelay\Loop;
|
||||
|
||||
use MondialRelay\Model\MondialRelayDeliveryInsurance;
|
||||
use MondialRelay\Model\MondialRelayDeliveryInsuranceQuery;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
|
||||
/**
|
||||
* Class Insurances
|
||||
* @package MondialRelay\Loop
|
||||
* @method int getAreaId()
|
||||
*/
|
||||
class Insurances extends BaseLoop implements PropelSearchLoopInterface
|
||||
{
|
||||
/**
|
||||
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function buildModelCriteria()
|
||||
{
|
||||
$query = MondialRelayDeliveryInsuranceQuery::create();
|
||||
|
||||
$query->orderByMaxValue();
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
/** @var MondialRelayDeliveryInsurance $item */
|
||||
foreach ($loopResult->getResultDataCollection() as $item) {
|
||||
$loopResultRow = new LoopResultRow($item);
|
||||
|
||||
$loopResultRow
|
||||
->set('ID', $item->getId())
|
||||
->set('MAX_VALUE', $item->getMaxValue())
|
||||
->set('PRICE', $item->getPriceWithTax())
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
90
local/modules/MondialRelay/Loop/PickupPoints.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace MondialRelay\Loop;
|
||||
|
||||
use MondialRelay\Event\FindRelayEvent;
|
||||
use MondialRelay\Event\MondialRelayEvents;
|
||||
use Thelia\Core\Template\Element\ArraySearchLoopInterface;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
|
||||
require __DIR__ . "/../vendor/autoload.php";
|
||||
|
||||
/**
|
||||
* Class Prices
|
||||
* @package MondialRelay\Loop
|
||||
* @method int getCountryId()
|
||||
* @method int getCity()
|
||||
* @method string getZipcode()
|
||||
* @method string getSearchRadius()
|
||||
*/
|
||||
class PickupPoints extends BaseLoop implements ArraySearchLoopInterface
|
||||
{
|
||||
/**
|
||||
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntTypeArgument('country_id', null, true),
|
||||
Argument::createAnyTypeArgument('city', null, true),
|
||||
Argument::createAnyTypeArgument('zipcode', null, true),
|
||||
Argument::createFloatTypeArgument('search_radius', 10)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function buildArray()
|
||||
{
|
||||
$event = new FindRelayEvent(
|
||||
$this->getCountryId(),
|
||||
$this->getCity(),
|
||||
$this->getZipcode(),
|
||||
$this->getSearchRadius()
|
||||
);
|
||||
|
||||
$this->dispatcher->dispatch(MondialRelayEvents::FIND_RELAYS, $event);
|
||||
|
||||
return $event->getPoints();
|
||||
}
|
||||
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
foreach ($loopResult->getResultDataCollection() as $item) {
|
||||
$loopResultRow = new LoopResultRow($item);
|
||||
|
||||
$loopResultRow
|
||||
->set("ID", $item['id'])
|
||||
->set("LATITUDE", $item['latitude'])
|
||||
->set("LONGITUDE", $item['longitude'])
|
||||
->set("ZIPCODE", $item['zipcode'])
|
||||
->set("CITY", $item['city'])
|
||||
->set("COUNTRY", $item['country'])
|
||||
->set("NAME", $item['name'])
|
||||
->set("ADDRESS", $item['address'])
|
||||
->set("DISTANCE", $item['distance'])
|
||||
->set("OPENINGS", $item['openings'])
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
72
local/modules/MondialRelay/Loop/Prices.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace MondialRelay\Loop;
|
||||
|
||||
use MondialRelay\Model\MondialRelayDeliveryPrice;
|
||||
use MondialRelay\Model\MondialRelayDeliveryPriceQuery;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
|
||||
/**
|
||||
* Class Prices
|
||||
* @package MondialRelay\Loop
|
||||
* @method int getAreaId()
|
||||
*/
|
||||
class Prices extends BaseLoop implements PropelSearchLoopInterface
|
||||
{
|
||||
/**
|
||||
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntListTypeArgument('area_id')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function buildModelCriteria()
|
||||
{
|
||||
$query = MondialRelayDeliveryPriceQuery::create();
|
||||
|
||||
if (null !== $areaId = $this->getAreaId()) {
|
||||
$query->filterByAreaId($areaId, Criteria::IN);
|
||||
}
|
||||
|
||||
$query->orderByMaxWeight();
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
/** @var MondialRelayDeliveryPrice $item */
|
||||
foreach ($loopResult->getResultDataCollection() as $item) {
|
||||
$loopResultRow = new LoopResultRow($item);
|
||||
|
||||
$loopResultRow
|
||||
->set('ID', $item->getId())
|
||||
->set('MAX_WEIGHT', $item->getMaxWeight())
|
||||
->set('PRICE', $item->getPriceWithTax())
|
||||
->set('AREA_ID', $item->getAreaId())
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
89
local/modules/MondialRelay/Loop/SelectedPickupPoint.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace MondialRelay\Loop;
|
||||
|
||||
use MondialRelay\Model\MondialRelayPickupAddress;
|
||||
use MondialRelay\Model\MondialRelayPickupAddressQuery;
|
||||
use MondialRelay\MondialRelay;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Model\OrderQuery;
|
||||
|
||||
/**
|
||||
* @package MondialRelay\Loop
|
||||
* @method int getOrderAddressId()
|
||||
* @method int getOrderId()
|
||||
*/
|
||||
class SelectedPickupPoint extends BaseLoop implements PropelSearchLoopInterface
|
||||
{
|
||||
/**
|
||||
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntTypeArgument('order_address_id'),
|
||||
Argument::createIntTypeArgument('order_id')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
* @return MondialRelayPickupAddressQuery|null
|
||||
*/
|
||||
public function buildModelCriteria()
|
||||
{
|
||||
if (null !== $relayId = $this->getCurrentRequest()->getSession()->get(MondialRelay::SESSION_SELECTED_PICKUP_RELAY_ID)) {
|
||||
return MondialRelayPickupAddressQuery::create()->filterById($relayId);
|
||||
} elseif (null !== $orderAddressId = $this->getOrderAddressId()) {
|
||||
return MondialRelayPickupAddressQuery::create()->filterByOrderAddressId($orderAddressId);
|
||||
} elseif (null !== $orderId = $this->getOrderId()) {
|
||||
if (null !== $order = OrderQuery::create()->findPk($orderId)) {
|
||||
return MondialRelayPickupAddressQuery::create()
|
||||
->filterByOrderAddressId($order->getDeliveryOrderAddressId());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
/** @var MondialRelayPickupAddress $item */
|
||||
foreach ($loopResult->getResultDataCollection() as $item) {
|
||||
$loopResultRow = new LoopResultRow($item);
|
||||
|
||||
$relayData = json_decode($item->getJsonRelayData(), true);
|
||||
|
||||
$loopResultRow
|
||||
->set("ID", $relayData['id'])
|
||||
->set("LATITUDE", $relayData['latitude'])
|
||||
->set("LONGITUDE", $relayData['longitude'])
|
||||
->set("ZIPCODE", $relayData['zipcode'])
|
||||
->set("CITY", $relayData['city'])
|
||||
->set("COUNTRY", $relayData['country'])
|
||||
->set("NAME", $relayData['name'])
|
||||
->set("ADDRESS", $relayData['address'])
|
||||
->set("DISTANCE", $relayData['distance'])
|
||||
->set("OPENINGS", $relayData['openings'])
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,479 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use MondialRelay\Model\MondialRelayDeliveryInsurance as ChildMondialRelayDeliveryInsurance;
|
||||
use MondialRelay\Model\MondialRelayDeliveryInsuranceQuery as ChildMondialRelayDeliveryInsuranceQuery;
|
||||
use MondialRelay\Model\Map\MondialRelayDeliveryInsuranceTableMap;
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'mondial_relay_delivery_insurance' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildMondialRelayDeliveryInsuranceQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildMondialRelayDeliveryInsuranceQuery orderByLevel($order = Criteria::ASC) Order by the level column
|
||||
* @method ChildMondialRelayDeliveryInsuranceQuery orderByMaxValue($order = Criteria::ASC) Order by the max_value column
|
||||
* @method ChildMondialRelayDeliveryInsuranceQuery orderByPriceWithTax($order = Criteria::ASC) Order by the price_with_tax column
|
||||
*
|
||||
* @method ChildMondialRelayDeliveryInsuranceQuery groupById() Group by the id column
|
||||
* @method ChildMondialRelayDeliveryInsuranceQuery groupByLevel() Group by the level column
|
||||
* @method ChildMondialRelayDeliveryInsuranceQuery groupByMaxValue() Group by the max_value column
|
||||
* @method ChildMondialRelayDeliveryInsuranceQuery groupByPriceWithTax() Group by the price_with_tax column
|
||||
*
|
||||
* @method ChildMondialRelayDeliveryInsuranceQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildMondialRelayDeliveryInsuranceQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildMondialRelayDeliveryInsuranceQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildMondialRelayDeliveryInsurance findOne(ConnectionInterface $con = null) Return the first ChildMondialRelayDeliveryInsurance matching the query
|
||||
* @method ChildMondialRelayDeliveryInsurance findOneOrCreate(ConnectionInterface $con = null) Return the first ChildMondialRelayDeliveryInsurance matching the query, or a new ChildMondialRelayDeliveryInsurance object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildMondialRelayDeliveryInsurance findOneById(int $id) Return the first ChildMondialRelayDeliveryInsurance filtered by the id column
|
||||
* @method ChildMondialRelayDeliveryInsurance findOneByLevel(int $level) Return the first ChildMondialRelayDeliveryInsurance filtered by the level column
|
||||
* @method ChildMondialRelayDeliveryInsurance findOneByMaxValue(string $max_value) Return the first ChildMondialRelayDeliveryInsurance filtered by the max_value column
|
||||
* @method ChildMondialRelayDeliveryInsurance findOneByPriceWithTax(string $price_with_tax) Return the first ChildMondialRelayDeliveryInsurance filtered by the price_with_tax column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildMondialRelayDeliveryInsurance objects filtered by the id column
|
||||
* @method array findByLevel(int $level) Return ChildMondialRelayDeliveryInsurance objects filtered by the level column
|
||||
* @method array findByMaxValue(string $max_value) Return ChildMondialRelayDeliveryInsurance objects filtered by the max_value column
|
||||
* @method array findByPriceWithTax(string $price_with_tax) Return ChildMondialRelayDeliveryInsurance objects filtered by the price_with_tax column
|
||||
*
|
||||
*/
|
||||
abstract class MondialRelayDeliveryInsuranceQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \MondialRelay\Model\Base\MondialRelayDeliveryInsuranceQuery 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 = '\\MondialRelay\\Model\\MondialRelayDeliveryInsurance', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildMondialRelayDeliveryInsuranceQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildMondialRelayDeliveryInsuranceQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \MondialRelay\Model\MondialRelayDeliveryInsuranceQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \MondialRelay\Model\MondialRelayDeliveryInsuranceQuery();
|
||||
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 ChildMondialRelayDeliveryInsurance|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = MondialRelayDeliveryInsuranceTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(MondialRelayDeliveryInsuranceTableMap::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 ChildMondialRelayDeliveryInsurance A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, LEVEL, MAX_VALUE, PRICE_WITH_TAX FROM mondial_relay_delivery_insurance 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 ChildMondialRelayDeliveryInsurance();
|
||||
$obj->hydrate($row);
|
||||
MondialRelayDeliveryInsuranceTableMap::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 ChildMondialRelayDeliveryInsurance|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 ChildMondialRelayDeliveryInsuranceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::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 ChildMondialRelayDeliveryInsuranceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::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 ChildMondialRelayDeliveryInsuranceQuery 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(MondialRelayDeliveryInsuranceTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::ID, $id, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the level column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByLevel(1234); // WHERE level = 1234
|
||||
* $query->filterByLevel(array(12, 34)); // WHERE level IN (12, 34)
|
||||
* $query->filterByLevel(array('min' => 12)); // WHERE level > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $level 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 ChildMondialRelayDeliveryInsuranceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByLevel($level = null, $comparison = null)
|
||||
{
|
||||
if (is_array($level)) {
|
||||
$useMinMax = false;
|
||||
if (isset($level['min'])) {
|
||||
$this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::LEVEL, $level['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($level['max'])) {
|
||||
$this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::LEVEL, $level['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::LEVEL, $level, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the max_value column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByMaxValue(1234); // WHERE max_value = 1234
|
||||
* $query->filterByMaxValue(array(12, 34)); // WHERE max_value IN (12, 34)
|
||||
* $query->filterByMaxValue(array('min' => 12)); // WHERE max_value > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $maxValue 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 ChildMondialRelayDeliveryInsuranceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByMaxValue($maxValue = null, $comparison = null)
|
||||
{
|
||||
if (is_array($maxValue)) {
|
||||
$useMinMax = false;
|
||||
if (isset($maxValue['min'])) {
|
||||
$this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::MAX_VALUE, $maxValue['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($maxValue['max'])) {
|
||||
$this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::MAX_VALUE, $maxValue['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::MAX_VALUE, $maxValue, $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 ChildMondialRelayDeliveryInsuranceQuery 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(MondialRelayDeliveryInsuranceTableMap::PRICE_WITH_TAX, $priceWithTax['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($priceWithTax['max'])) {
|
||||
$this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::PRICE_WITH_TAX, $priceWithTax['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::PRICE_WITH_TAX, $priceWithTax, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildMondialRelayDeliveryInsurance $mondialRelayDeliveryInsurance Object to remove from the list of results
|
||||
*
|
||||
* @return ChildMondialRelayDeliveryInsuranceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($mondialRelayDeliveryInsurance = null)
|
||||
{
|
||||
if ($mondialRelayDeliveryInsurance) {
|
||||
$this->addUsingAlias(MondialRelayDeliveryInsuranceTableMap::ID, $mondialRelayDeliveryInsurance->getId(), Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the mondial_relay_delivery_insurance 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(MondialRelayDeliveryInsuranceTableMap::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).
|
||||
MondialRelayDeliveryInsuranceTableMap::clearInstancePool();
|
||||
MondialRelayDeliveryInsuranceTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildMondialRelayDeliveryInsurance or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildMondialRelayDeliveryInsurance 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(MondialRelayDeliveryInsuranceTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(MondialRelayDeliveryInsuranceTableMap::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();
|
||||
|
||||
|
||||
MondialRelayDeliveryInsuranceTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
MondialRelayDeliveryInsuranceTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
} // MondialRelayDeliveryInsuranceQuery
|
||||
1336
local/modules/MondialRelay/Model/Base/MondialRelayDeliveryPrice.php
Normal file
@@ -0,0 +1,564 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use MondialRelay\Model\MondialRelayDeliveryPrice as ChildMondialRelayDeliveryPrice;
|
||||
use MondialRelay\Model\MondialRelayDeliveryPriceQuery as ChildMondialRelayDeliveryPriceQuery;
|
||||
use MondialRelay\Model\Map\MondialRelayDeliveryPriceTableMap;
|
||||
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 'mondial_relay_delivery_price' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildMondialRelayDeliveryPriceQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildMondialRelayDeliveryPriceQuery orderByMaxWeight($order = Criteria::ASC) Order by the max_weight column
|
||||
* @method ChildMondialRelayDeliveryPriceQuery orderByPriceWithTax($order = Criteria::ASC) Order by the price_with_tax column
|
||||
* @method ChildMondialRelayDeliveryPriceQuery orderByAreaId($order = Criteria::ASC) Order by the area_id column
|
||||
*
|
||||
* @method ChildMondialRelayDeliveryPriceQuery groupById() Group by the id column
|
||||
* @method ChildMondialRelayDeliveryPriceQuery groupByMaxWeight() Group by the max_weight column
|
||||
* @method ChildMondialRelayDeliveryPriceQuery groupByPriceWithTax() Group by the price_with_tax column
|
||||
* @method ChildMondialRelayDeliveryPriceQuery groupByAreaId() Group by the area_id column
|
||||
*
|
||||
* @method ChildMondialRelayDeliveryPriceQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildMondialRelayDeliveryPriceQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildMondialRelayDeliveryPriceQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildMondialRelayDeliveryPriceQuery leftJoinArea($relationAlias = null) Adds a LEFT JOIN clause to the query using the Area relation
|
||||
* @method ChildMondialRelayDeliveryPriceQuery rightJoinArea($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Area relation
|
||||
* @method ChildMondialRelayDeliveryPriceQuery innerJoinArea($relationAlias = null) Adds a INNER JOIN clause to the query using the Area relation
|
||||
*
|
||||
* @method ChildMondialRelayDeliveryPrice findOne(ConnectionInterface $con = null) Return the first ChildMondialRelayDeliveryPrice matching the query
|
||||
* @method ChildMondialRelayDeliveryPrice findOneOrCreate(ConnectionInterface $con = null) Return the first ChildMondialRelayDeliveryPrice matching the query, or a new ChildMondialRelayDeliveryPrice object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildMondialRelayDeliveryPrice findOneById(int $id) Return the first ChildMondialRelayDeliveryPrice filtered by the id column
|
||||
* @method ChildMondialRelayDeliveryPrice findOneByMaxWeight(string $max_weight) Return the first ChildMondialRelayDeliveryPrice filtered by the max_weight column
|
||||
* @method ChildMondialRelayDeliveryPrice findOneByPriceWithTax(string $price_with_tax) Return the first ChildMondialRelayDeliveryPrice filtered by the price_with_tax column
|
||||
* @method ChildMondialRelayDeliveryPrice findOneByAreaId(int $area_id) Return the first ChildMondialRelayDeliveryPrice filtered by the area_id column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildMondialRelayDeliveryPrice objects filtered by the id column
|
||||
* @method array findByMaxWeight(string $max_weight) Return ChildMondialRelayDeliveryPrice objects filtered by the max_weight column
|
||||
* @method array findByPriceWithTax(string $price_with_tax) Return ChildMondialRelayDeliveryPrice objects filtered by the price_with_tax column
|
||||
* @method array findByAreaId(int $area_id) Return ChildMondialRelayDeliveryPrice objects filtered by the area_id column
|
||||
*
|
||||
*/
|
||||
abstract class MondialRelayDeliveryPriceQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \MondialRelay\Model\Base\MondialRelayDeliveryPriceQuery 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 = '\\MondialRelay\\Model\\MondialRelayDeliveryPrice', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildMondialRelayDeliveryPriceQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildMondialRelayDeliveryPriceQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \MondialRelay\Model\MondialRelayDeliveryPriceQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \MondialRelay\Model\MondialRelayDeliveryPriceQuery();
|
||||
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 ChildMondialRelayDeliveryPrice|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = MondialRelayDeliveryPriceTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(MondialRelayDeliveryPriceTableMap::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 ChildMondialRelayDeliveryPrice 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 ChildMondialRelayDeliveryPrice();
|
||||
$obj->hydrate($row);
|
||||
MondialRelayDeliveryPriceTableMap::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 ChildMondialRelayDeliveryPrice|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 ChildMondialRelayDeliveryPriceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(MondialRelayDeliveryPriceTableMap::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 ChildMondialRelayDeliveryPriceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(MondialRelayDeliveryPriceTableMap::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 ChildMondialRelayDeliveryPriceQuery 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(MondialRelayDeliveryPriceTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(MondialRelayDeliveryPriceTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(MondialRelayDeliveryPriceTableMap::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 ChildMondialRelayDeliveryPriceQuery 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(MondialRelayDeliveryPriceTableMap::MAX_WEIGHT, $maxWeight['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($maxWeight['max'])) {
|
||||
$this->addUsingAlias(MondialRelayDeliveryPriceTableMap::MAX_WEIGHT, $maxWeight['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(MondialRelayDeliveryPriceTableMap::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 ChildMondialRelayDeliveryPriceQuery 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(MondialRelayDeliveryPriceTableMap::PRICE_WITH_TAX, $priceWithTax['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($priceWithTax['max'])) {
|
||||
$this->addUsingAlias(MondialRelayDeliveryPriceTableMap::PRICE_WITH_TAX, $priceWithTax['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(MondialRelayDeliveryPriceTableMap::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 ChildMondialRelayDeliveryPriceQuery 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(MondialRelayDeliveryPriceTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($areaId['max'])) {
|
||||
$this->addUsingAlias(MondialRelayDeliveryPriceTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(MondialRelayDeliveryPriceTableMap::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 ChildMondialRelayDeliveryPriceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByArea($area, $comparison = null)
|
||||
{
|
||||
if ($area instanceof \Thelia\Model\Area) {
|
||||
return $this
|
||||
->addUsingAlias(MondialRelayDeliveryPriceTableMap::AREA_ID, $area->getId(), $comparison);
|
||||
} elseif ($area instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(MondialRelayDeliveryPriceTableMap::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 ChildMondialRelayDeliveryPriceQuery 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 ChildMondialRelayDeliveryPrice $mondialRelayDeliveryPrice Object to remove from the list of results
|
||||
*
|
||||
* @return ChildMondialRelayDeliveryPriceQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($mondialRelayDeliveryPrice = null)
|
||||
{
|
||||
if ($mondialRelayDeliveryPrice) {
|
||||
$this->addUsingAlias(MondialRelayDeliveryPriceTableMap::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(MondialRelayDeliveryPriceTableMap::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).
|
||||
MondialRelayDeliveryPriceTableMap::clearInstancePool();
|
||||
MondialRelayDeliveryPriceTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildMondialRelayDeliveryPrice or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildMondialRelayDeliveryPrice 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(MondialRelayDeliveryPriceTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(MondialRelayDeliveryPriceTableMap::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();
|
||||
|
||||
|
||||
MondialRelayDeliveryPriceTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
MondialRelayDeliveryPriceTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
} // MondialRelayDeliveryPriceQuery
|
||||
1168
local/modules/MondialRelay/Model/Base/MondialRelayPickupAddress.php
Normal file
@@ -0,0 +1,422 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use MondialRelay\Model\MondialRelayPickupAddress as ChildMondialRelayPickupAddress;
|
||||
use MondialRelay\Model\MondialRelayPickupAddressQuery as ChildMondialRelayPickupAddressQuery;
|
||||
use MondialRelay\Model\Map\MondialRelayPickupAddressTableMap;
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'mondial_relay_pickup_address' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildMondialRelayPickupAddressQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildMondialRelayPickupAddressQuery orderByJsonRelayData($order = Criteria::ASC) Order by the json_relay_data column
|
||||
* @method ChildMondialRelayPickupAddressQuery orderByOrderAddressId($order = Criteria::ASC) Order by the order_address_id column
|
||||
*
|
||||
* @method ChildMondialRelayPickupAddressQuery groupById() Group by the id column
|
||||
* @method ChildMondialRelayPickupAddressQuery groupByJsonRelayData() Group by the json_relay_data column
|
||||
* @method ChildMondialRelayPickupAddressQuery groupByOrderAddressId() Group by the order_address_id column
|
||||
*
|
||||
* @method ChildMondialRelayPickupAddressQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildMondialRelayPickupAddressQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildMondialRelayPickupAddressQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildMondialRelayPickupAddress findOne(ConnectionInterface $con = null) Return the first ChildMondialRelayPickupAddress matching the query
|
||||
* @method ChildMondialRelayPickupAddress findOneOrCreate(ConnectionInterface $con = null) Return the first ChildMondialRelayPickupAddress matching the query, or a new ChildMondialRelayPickupAddress object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildMondialRelayPickupAddress findOneById(int $id) Return the first ChildMondialRelayPickupAddress filtered by the id column
|
||||
* @method ChildMondialRelayPickupAddress findOneByJsonRelayData(string $json_relay_data) Return the first ChildMondialRelayPickupAddress filtered by the json_relay_data column
|
||||
* @method ChildMondialRelayPickupAddress findOneByOrderAddressId(int $order_address_id) Return the first ChildMondialRelayPickupAddress filtered by the order_address_id column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildMondialRelayPickupAddress objects filtered by the id column
|
||||
* @method array findByJsonRelayData(string $json_relay_data) Return ChildMondialRelayPickupAddress objects filtered by the json_relay_data column
|
||||
* @method array findByOrderAddressId(int $order_address_id) Return ChildMondialRelayPickupAddress objects filtered by the order_address_id column
|
||||
*
|
||||
*/
|
||||
abstract class MondialRelayPickupAddressQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \MondialRelay\Model\Base\MondialRelayPickupAddressQuery 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 = '\\MondialRelay\\Model\\MondialRelayPickupAddress', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildMondialRelayPickupAddressQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildMondialRelayPickupAddressQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \MondialRelay\Model\MondialRelayPickupAddressQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \MondialRelay\Model\MondialRelayPickupAddressQuery();
|
||||
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 ChildMondialRelayPickupAddress|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = MondialRelayPickupAddressTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(MondialRelayPickupAddressTableMap::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 ChildMondialRelayPickupAddress A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, JSON_RELAY_DATA, ORDER_ADDRESS_ID FROM mondial_relay_pickup_address 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 ChildMondialRelayPickupAddress();
|
||||
$obj->hydrate($row);
|
||||
MondialRelayPickupAddressTableMap::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 ChildMondialRelayPickupAddress|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 ChildMondialRelayPickupAddressQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(MondialRelayPickupAddressTableMap::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 ChildMondialRelayPickupAddressQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(MondialRelayPickupAddressTableMap::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 ChildMondialRelayPickupAddressQuery 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(MondialRelayPickupAddressTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(MondialRelayPickupAddressTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(MondialRelayPickupAddressTableMap::ID, $id, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the json_relay_data column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByJsonRelayData('fooValue'); // WHERE json_relay_data = 'fooValue'
|
||||
* $query->filterByJsonRelayData('%fooValue%'); // WHERE json_relay_data LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $jsonRelayData The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildMondialRelayPickupAddressQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByJsonRelayData($jsonRelayData = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($jsonRelayData)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $jsonRelayData)) {
|
||||
$jsonRelayData = str_replace('*', '%', $jsonRelayData);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(MondialRelayPickupAddressTableMap::JSON_RELAY_DATA, $jsonRelayData, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the order_address_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByOrderAddressId(1234); // WHERE order_address_id = 1234
|
||||
* $query->filterByOrderAddressId(array(12, 34)); // WHERE order_address_id IN (12, 34)
|
||||
* $query->filterByOrderAddressId(array('min' => 12)); // WHERE order_address_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $orderAddressId 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 ChildMondialRelayPickupAddressQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByOrderAddressId($orderAddressId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($orderAddressId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($orderAddressId['min'])) {
|
||||
$this->addUsingAlias(MondialRelayPickupAddressTableMap::ORDER_ADDRESS_ID, $orderAddressId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($orderAddressId['max'])) {
|
||||
$this->addUsingAlias(MondialRelayPickupAddressTableMap::ORDER_ADDRESS_ID, $orderAddressId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(MondialRelayPickupAddressTableMap::ORDER_ADDRESS_ID, $orderAddressId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildMondialRelayPickupAddress $mondialRelayPickupAddress Object to remove from the list of results
|
||||
*
|
||||
* @return ChildMondialRelayPickupAddressQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($mondialRelayPickupAddress = null)
|
||||
{
|
||||
if ($mondialRelayPickupAddress) {
|
||||
$this->addUsingAlias(MondialRelayPickupAddressTableMap::ID, $mondialRelayPickupAddress->getId(), Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the mondial_relay_pickup_address 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(MondialRelayPickupAddressTableMap::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).
|
||||
MondialRelayPickupAddressTableMap::clearInstancePool();
|
||||
MondialRelayPickupAddressTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildMondialRelayPickupAddress or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildMondialRelayPickupAddress 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(MondialRelayPickupAddressTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(MondialRelayPickupAddressTableMap::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();
|
||||
|
||||
|
||||
MondialRelayPickupAddressTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
MondialRelayPickupAddressTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
} // MondialRelayPickupAddressQuery
|
||||
@@ -0,0 +1,564 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use MondialRelay\Model\MondialRelayZoneConfiguration as ChildMondialRelayZoneConfiguration;
|
||||
use MondialRelay\Model\MondialRelayZoneConfigurationQuery as ChildMondialRelayZoneConfigurationQuery;
|
||||
use MondialRelay\Model\Map\MondialRelayZoneConfigurationTableMap;
|
||||
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 'mondial_relay_zone_configuration' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildMondialRelayZoneConfigurationQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildMondialRelayZoneConfigurationQuery orderByDeliveryTime($order = Criteria::ASC) Order by the delivery_time column
|
||||
* @method ChildMondialRelayZoneConfigurationQuery orderByDeliveryType($order = Criteria::ASC) Order by the delivery_type column
|
||||
* @method ChildMondialRelayZoneConfigurationQuery orderByAreaId($order = Criteria::ASC) Order by the area_id column
|
||||
*
|
||||
* @method ChildMondialRelayZoneConfigurationQuery groupById() Group by the id column
|
||||
* @method ChildMondialRelayZoneConfigurationQuery groupByDeliveryTime() Group by the delivery_time column
|
||||
* @method ChildMondialRelayZoneConfigurationQuery groupByDeliveryType() Group by the delivery_type column
|
||||
* @method ChildMondialRelayZoneConfigurationQuery groupByAreaId() Group by the area_id column
|
||||
*
|
||||
* @method ChildMondialRelayZoneConfigurationQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildMondialRelayZoneConfigurationQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildMondialRelayZoneConfigurationQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildMondialRelayZoneConfigurationQuery leftJoinArea($relationAlias = null) Adds a LEFT JOIN clause to the query using the Area relation
|
||||
* @method ChildMondialRelayZoneConfigurationQuery rightJoinArea($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Area relation
|
||||
* @method ChildMondialRelayZoneConfigurationQuery innerJoinArea($relationAlias = null) Adds a INNER JOIN clause to the query using the Area relation
|
||||
*
|
||||
* @method ChildMondialRelayZoneConfiguration findOne(ConnectionInterface $con = null) Return the first ChildMondialRelayZoneConfiguration matching the query
|
||||
* @method ChildMondialRelayZoneConfiguration findOneOrCreate(ConnectionInterface $con = null) Return the first ChildMondialRelayZoneConfiguration matching the query, or a new ChildMondialRelayZoneConfiguration object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildMondialRelayZoneConfiguration findOneById(int $id) Return the first ChildMondialRelayZoneConfiguration filtered by the id column
|
||||
* @method ChildMondialRelayZoneConfiguration findOneByDeliveryTime(int $delivery_time) Return the first ChildMondialRelayZoneConfiguration filtered by the delivery_time column
|
||||
* @method ChildMondialRelayZoneConfiguration findOneByDeliveryType(int $delivery_type) Return the first ChildMondialRelayZoneConfiguration filtered by the delivery_type column
|
||||
* @method ChildMondialRelayZoneConfiguration findOneByAreaId(int $area_id) Return the first ChildMondialRelayZoneConfiguration filtered by the area_id column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildMondialRelayZoneConfiguration objects filtered by the id column
|
||||
* @method array findByDeliveryTime(int $delivery_time) Return ChildMondialRelayZoneConfiguration objects filtered by the delivery_time column
|
||||
* @method array findByDeliveryType(int $delivery_type) Return ChildMondialRelayZoneConfiguration objects filtered by the delivery_type column
|
||||
* @method array findByAreaId(int $area_id) Return ChildMondialRelayZoneConfiguration objects filtered by the area_id column
|
||||
*
|
||||
*/
|
||||
abstract class MondialRelayZoneConfigurationQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \MondialRelay\Model\Base\MondialRelayZoneConfigurationQuery 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 = '\\MondialRelay\\Model\\MondialRelayZoneConfiguration', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildMondialRelayZoneConfigurationQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildMondialRelayZoneConfigurationQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \MondialRelay\Model\MondialRelayZoneConfigurationQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \MondialRelay\Model\MondialRelayZoneConfigurationQuery();
|
||||
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 ChildMondialRelayZoneConfiguration|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = MondialRelayZoneConfigurationTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(MondialRelayZoneConfigurationTableMap::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 ChildMondialRelayZoneConfiguration A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, DELIVERY_TIME, DELIVERY_TYPE, AREA_ID FROM mondial_relay_zone_configuration 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 ChildMondialRelayZoneConfiguration();
|
||||
$obj->hydrate($row);
|
||||
MondialRelayZoneConfigurationTableMap::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 ChildMondialRelayZoneConfiguration|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 ChildMondialRelayZoneConfigurationQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(MondialRelayZoneConfigurationTableMap::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 ChildMondialRelayZoneConfigurationQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(MondialRelayZoneConfigurationTableMap::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 ChildMondialRelayZoneConfigurationQuery 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(MondialRelayZoneConfigurationTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(MondialRelayZoneConfigurationTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(MondialRelayZoneConfigurationTableMap::ID, $id, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the delivery_time column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByDeliveryTime(1234); // WHERE delivery_time = 1234
|
||||
* $query->filterByDeliveryTime(array(12, 34)); // WHERE delivery_time IN (12, 34)
|
||||
* $query->filterByDeliveryTime(array('min' => 12)); // WHERE delivery_time > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $deliveryTime 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 ChildMondialRelayZoneConfigurationQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDeliveryTime($deliveryTime = null, $comparison = null)
|
||||
{
|
||||
if (is_array($deliveryTime)) {
|
||||
$useMinMax = false;
|
||||
if (isset($deliveryTime['min'])) {
|
||||
$this->addUsingAlias(MondialRelayZoneConfigurationTableMap::DELIVERY_TIME, $deliveryTime['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($deliveryTime['max'])) {
|
||||
$this->addUsingAlias(MondialRelayZoneConfigurationTableMap::DELIVERY_TIME, $deliveryTime['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(MondialRelayZoneConfigurationTableMap::DELIVERY_TIME, $deliveryTime, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the delivery_type column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByDeliveryType(1234); // WHERE delivery_type = 1234
|
||||
* $query->filterByDeliveryType(array(12, 34)); // WHERE delivery_type IN (12, 34)
|
||||
* $query->filterByDeliveryType(array('min' => 12)); // WHERE delivery_type > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $deliveryType 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 ChildMondialRelayZoneConfigurationQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDeliveryType($deliveryType = null, $comparison = null)
|
||||
{
|
||||
if (is_array($deliveryType)) {
|
||||
$useMinMax = false;
|
||||
if (isset($deliveryType['min'])) {
|
||||
$this->addUsingAlias(MondialRelayZoneConfigurationTableMap::DELIVERY_TYPE, $deliveryType['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($deliveryType['max'])) {
|
||||
$this->addUsingAlias(MondialRelayZoneConfigurationTableMap::DELIVERY_TYPE, $deliveryType['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(MondialRelayZoneConfigurationTableMap::DELIVERY_TYPE, $deliveryType, $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 ChildMondialRelayZoneConfigurationQuery 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(MondialRelayZoneConfigurationTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($areaId['max'])) {
|
||||
$this->addUsingAlias(MondialRelayZoneConfigurationTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(MondialRelayZoneConfigurationTableMap::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 ChildMondialRelayZoneConfigurationQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByArea($area, $comparison = null)
|
||||
{
|
||||
if ($area instanceof \Thelia\Model\Area) {
|
||||
return $this
|
||||
->addUsingAlias(MondialRelayZoneConfigurationTableMap::AREA_ID, $area->getId(), $comparison);
|
||||
} elseif ($area instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(MondialRelayZoneConfigurationTableMap::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 ChildMondialRelayZoneConfigurationQuery 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 ChildMondialRelayZoneConfiguration $mondialRelayZoneConfiguration Object to remove from the list of results
|
||||
*
|
||||
* @return ChildMondialRelayZoneConfigurationQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($mondialRelayZoneConfiguration = null)
|
||||
{
|
||||
if ($mondialRelayZoneConfiguration) {
|
||||
$this->addUsingAlias(MondialRelayZoneConfigurationTableMap::ID, $mondialRelayZoneConfiguration->getId(), Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the mondial_relay_zone_configuration 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(MondialRelayZoneConfigurationTableMap::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).
|
||||
MondialRelayZoneConfigurationTableMap::clearInstancePool();
|
||||
MondialRelayZoneConfigurationTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildMondialRelayZoneConfiguration or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildMondialRelayZoneConfiguration 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(MondialRelayZoneConfigurationTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(MondialRelayZoneConfigurationTableMap::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();
|
||||
|
||||
|
||||
MondialRelayZoneConfigurationTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
MondialRelayZoneConfigurationTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
} // MondialRelayZoneConfigurationQuery
|
||||
@@ -0,0 +1,426 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay\Model\Map;
|
||||
|
||||
use MondialRelay\Model\MondialRelayDeliveryInsurance;
|
||||
use MondialRelay\Model\MondialRelayDeliveryInsuranceQuery;
|
||||
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 'mondial_relay_delivery_insurance' 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 MondialRelayDeliveryInsuranceTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'MondialRelay.Model.Map.MondialRelayDeliveryInsuranceTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'mondial_relay_delivery_insurance';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\MondialRelay\\Model\\MondialRelayDeliveryInsurance';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'MondialRelay.Model.MondialRelayDeliveryInsurance';
|
||||
|
||||
/**
|
||||
* 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 = 'mondial_relay_delivery_insurance.ID';
|
||||
|
||||
/**
|
||||
* the column name for the LEVEL field
|
||||
*/
|
||||
const LEVEL = 'mondial_relay_delivery_insurance.LEVEL';
|
||||
|
||||
/**
|
||||
* the column name for the MAX_VALUE field
|
||||
*/
|
||||
const MAX_VALUE = 'mondial_relay_delivery_insurance.MAX_VALUE';
|
||||
|
||||
/**
|
||||
* the column name for the PRICE_WITH_TAX field
|
||||
*/
|
||||
const PRICE_WITH_TAX = 'mondial_relay_delivery_insurance.PRICE_WITH_TAX';
|
||||
|
||||
/**
|
||||
* 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', 'Level', 'MaxValue', 'PriceWithTax', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'level', 'maxValue', 'priceWithTax', ),
|
||||
self::TYPE_COLNAME => array(MondialRelayDeliveryInsuranceTableMap::ID, MondialRelayDeliveryInsuranceTableMap::LEVEL, MondialRelayDeliveryInsuranceTableMap::MAX_VALUE, MondialRelayDeliveryInsuranceTableMap::PRICE_WITH_TAX, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'LEVEL', 'MAX_VALUE', 'PRICE_WITH_TAX', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'level', 'max_value', 'price_with_tax', ),
|
||||
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, 'Level' => 1, 'MaxValue' => 2, 'PriceWithTax' => 3, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'level' => 1, 'maxValue' => 2, 'priceWithTax' => 3, ),
|
||||
self::TYPE_COLNAME => array(MondialRelayDeliveryInsuranceTableMap::ID => 0, MondialRelayDeliveryInsuranceTableMap::LEVEL => 1, MondialRelayDeliveryInsuranceTableMap::MAX_VALUE => 2, MondialRelayDeliveryInsuranceTableMap::PRICE_WITH_TAX => 3, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'LEVEL' => 1, 'MAX_VALUE' => 2, 'PRICE_WITH_TAX' => 3, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'level' => 1, 'max_value' => 2, 'price_with_tax' => 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('mondial_relay_delivery_insurance');
|
||||
$this->setPhpName('MondialRelayDeliveryInsurance');
|
||||
$this->setClassName('\\MondialRelay\\Model\\MondialRelayDeliveryInsurance');
|
||||
$this->setPackage('MondialRelay.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('LEVEL', 'Level', 'INTEGER', true, null, null);
|
||||
$this->addColumn('MAX_VALUE', 'MaxValue', 'DECIMAL', true, 16, 0);
|
||||
$this->addColumn('PRICE_WITH_TAX', 'PriceWithTax', 'DECIMAL', true, 16, 0);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
} // 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 ? MondialRelayDeliveryInsuranceTableMap::CLASS_DEFAULT : MondialRelayDeliveryInsuranceTableMap::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 (MondialRelayDeliveryInsurance object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = MondialRelayDeliveryInsuranceTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = MondialRelayDeliveryInsuranceTableMap::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 + MondialRelayDeliveryInsuranceTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = MondialRelayDeliveryInsuranceTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
MondialRelayDeliveryInsuranceTableMap::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 = MondialRelayDeliveryInsuranceTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = MondialRelayDeliveryInsuranceTableMap::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;
|
||||
MondialRelayDeliveryInsuranceTableMap::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(MondialRelayDeliveryInsuranceTableMap::ID);
|
||||
$criteria->addSelectColumn(MondialRelayDeliveryInsuranceTableMap::LEVEL);
|
||||
$criteria->addSelectColumn(MondialRelayDeliveryInsuranceTableMap::MAX_VALUE);
|
||||
$criteria->addSelectColumn(MondialRelayDeliveryInsuranceTableMap::PRICE_WITH_TAX);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.LEVEL');
|
||||
$criteria->addSelectColumn($alias . '.MAX_VALUE');
|
||||
$criteria->addSelectColumn($alias . '.PRICE_WITH_TAX');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(MondialRelayDeliveryInsuranceTableMap::DATABASE_NAME)->getTable(MondialRelayDeliveryInsuranceTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(MondialRelayDeliveryInsuranceTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(MondialRelayDeliveryInsuranceTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new MondialRelayDeliveryInsuranceTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a MondialRelayDeliveryInsurance or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or MondialRelayDeliveryInsurance 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(MondialRelayDeliveryInsuranceTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \MondialRelay\Model\MondialRelayDeliveryInsurance) { // 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(MondialRelayDeliveryInsuranceTableMap::DATABASE_NAME);
|
||||
$criteria->add(MondialRelayDeliveryInsuranceTableMap::ID, (array) $values, Criteria::IN);
|
||||
}
|
||||
|
||||
$query = MondialRelayDeliveryInsuranceQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { MondialRelayDeliveryInsuranceTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { MondialRelayDeliveryInsuranceTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the mondial_relay_delivery_insurance 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 MondialRelayDeliveryInsuranceQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a MondialRelayDeliveryInsurance or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or MondialRelayDeliveryInsurance 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(MondialRelayDeliveryInsuranceTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from MondialRelayDeliveryInsurance object
|
||||
}
|
||||
|
||||
if ($criteria->containsKey(MondialRelayDeliveryInsuranceTableMap::ID) && $criteria->keyContainsValue(MondialRelayDeliveryInsuranceTableMap::ID) ) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key ('.MondialRelayDeliveryInsuranceTableMap::ID.')');
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = MondialRelayDeliveryInsuranceQuery::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;
|
||||
}
|
||||
|
||||
} // MondialRelayDeliveryInsuranceTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
MondialRelayDeliveryInsuranceTableMap::buildTableMap();
|
||||
@@ -0,0 +1,427 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay\Model\Map;
|
||||
|
||||
use MondialRelay\Model\MondialRelayDeliveryPrice;
|
||||
use MondialRelay\Model\MondialRelayDeliveryPriceQuery;
|
||||
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 'mondial_relay_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 MondialRelayDeliveryPriceTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'MondialRelay.Model.Map.MondialRelayDeliveryPriceTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'mondial_relay_delivery_price';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\MondialRelay\\Model\\MondialRelayDeliveryPrice';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'MondialRelay.Model.MondialRelayDeliveryPrice';
|
||||
|
||||
/**
|
||||
* 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 = 'mondial_relay_delivery_price.ID';
|
||||
|
||||
/**
|
||||
* the column name for the MAX_WEIGHT field
|
||||
*/
|
||||
const MAX_WEIGHT = 'mondial_relay_delivery_price.MAX_WEIGHT';
|
||||
|
||||
/**
|
||||
* the column name for the PRICE_WITH_TAX field
|
||||
*/
|
||||
const PRICE_WITH_TAX = 'mondial_relay_delivery_price.PRICE_WITH_TAX';
|
||||
|
||||
/**
|
||||
* the column name for the AREA_ID field
|
||||
*/
|
||||
const AREA_ID = 'mondial_relay_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(MondialRelayDeliveryPriceTableMap::ID, MondialRelayDeliveryPriceTableMap::MAX_WEIGHT, MondialRelayDeliveryPriceTableMap::PRICE_WITH_TAX, MondialRelayDeliveryPriceTableMap::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(MondialRelayDeliveryPriceTableMap::ID => 0, MondialRelayDeliveryPriceTableMap::MAX_WEIGHT => 1, MondialRelayDeliveryPriceTableMap::PRICE_WITH_TAX => 2, MondialRelayDeliveryPriceTableMap::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('mondial_relay_delivery_price');
|
||||
$this->setPhpName('MondialRelayDeliveryPrice');
|
||||
$this->setClassName('\\MondialRelay\\Model\\MondialRelayDeliveryPrice');
|
||||
$this->setPackage('MondialRelay.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 ? MondialRelayDeliveryPriceTableMap::CLASS_DEFAULT : MondialRelayDeliveryPriceTableMap::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 (MondialRelayDeliveryPrice object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = MondialRelayDeliveryPriceTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = MondialRelayDeliveryPriceTableMap::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 + MondialRelayDeliveryPriceTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = MondialRelayDeliveryPriceTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
MondialRelayDeliveryPriceTableMap::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 = MondialRelayDeliveryPriceTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = MondialRelayDeliveryPriceTableMap::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;
|
||||
MondialRelayDeliveryPriceTableMap::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(MondialRelayDeliveryPriceTableMap::ID);
|
||||
$criteria->addSelectColumn(MondialRelayDeliveryPriceTableMap::MAX_WEIGHT);
|
||||
$criteria->addSelectColumn(MondialRelayDeliveryPriceTableMap::PRICE_WITH_TAX);
|
||||
$criteria->addSelectColumn(MondialRelayDeliveryPriceTableMap::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(MondialRelayDeliveryPriceTableMap::DATABASE_NAME)->getTable(MondialRelayDeliveryPriceTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(MondialRelayDeliveryPriceTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(MondialRelayDeliveryPriceTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new MondialRelayDeliveryPriceTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a MondialRelayDeliveryPrice or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or MondialRelayDeliveryPrice 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(MondialRelayDeliveryPriceTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \MondialRelay\Model\MondialRelayDeliveryPrice) { // 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(MondialRelayDeliveryPriceTableMap::DATABASE_NAME);
|
||||
$criteria->add(MondialRelayDeliveryPriceTableMap::ID, (array) $values, Criteria::IN);
|
||||
}
|
||||
|
||||
$query = MondialRelayDeliveryPriceQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { MondialRelayDeliveryPriceTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { MondialRelayDeliveryPriceTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 static function doDeleteAll(ConnectionInterface $con = null)
|
||||
{
|
||||
return MondialRelayDeliveryPriceQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a MondialRelayDeliveryPrice or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or MondialRelayDeliveryPrice 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(MondialRelayDeliveryPriceTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from MondialRelayDeliveryPrice object
|
||||
}
|
||||
|
||||
if ($criteria->containsKey(MondialRelayDeliveryPriceTableMap::ID) && $criteria->keyContainsValue(MondialRelayDeliveryPriceTableMap::ID) ) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key ('.MondialRelayDeliveryPriceTableMap::ID.')');
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = MondialRelayDeliveryPriceQuery::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;
|
||||
}
|
||||
|
||||
} // MondialRelayDeliveryPriceTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
MondialRelayDeliveryPriceTableMap::buildTableMap();
|
||||
@@ -0,0 +1,418 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay\Model\Map;
|
||||
|
||||
use MondialRelay\Model\MondialRelayPickupAddress;
|
||||
use MondialRelay\Model\MondialRelayPickupAddressQuery;
|
||||
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 'mondial_relay_pickup_address' 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 MondialRelayPickupAddressTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'MondialRelay.Model.Map.MondialRelayPickupAddressTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'mondial_relay_pickup_address';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\MondialRelay\\Model\\MondialRelayPickupAddress';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'MondialRelay.Model.MondialRelayPickupAddress';
|
||||
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 3;
|
||||
|
||||
/**
|
||||
* 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 = 3;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
*/
|
||||
const ID = 'mondial_relay_pickup_address.ID';
|
||||
|
||||
/**
|
||||
* the column name for the JSON_RELAY_DATA field
|
||||
*/
|
||||
const JSON_RELAY_DATA = 'mondial_relay_pickup_address.JSON_RELAY_DATA';
|
||||
|
||||
/**
|
||||
* the column name for the ORDER_ADDRESS_ID field
|
||||
*/
|
||||
const ORDER_ADDRESS_ID = 'mondial_relay_pickup_address.ORDER_ADDRESS_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', 'JsonRelayData', 'OrderAddressId', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'jsonRelayData', 'orderAddressId', ),
|
||||
self::TYPE_COLNAME => array(MondialRelayPickupAddressTableMap::ID, MondialRelayPickupAddressTableMap::JSON_RELAY_DATA, MondialRelayPickupAddressTableMap::ORDER_ADDRESS_ID, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'JSON_RELAY_DATA', 'ORDER_ADDRESS_ID', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'json_relay_data', 'order_address_id', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, )
|
||||
);
|
||||
|
||||
/**
|
||||
* 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, 'JsonRelayData' => 1, 'OrderAddressId' => 2, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'jsonRelayData' => 1, 'orderAddressId' => 2, ),
|
||||
self::TYPE_COLNAME => array(MondialRelayPickupAddressTableMap::ID => 0, MondialRelayPickupAddressTableMap::JSON_RELAY_DATA => 1, MondialRelayPickupAddressTableMap::ORDER_ADDRESS_ID => 2, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'JSON_RELAY_DATA' => 1, 'ORDER_ADDRESS_ID' => 2, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'json_relay_data' => 1, 'order_address_id' => 2, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, )
|
||||
);
|
||||
|
||||
/**
|
||||
* 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('mondial_relay_pickup_address');
|
||||
$this->setPhpName('MondialRelayPickupAddress');
|
||||
$this->setClassName('\\MondialRelay\\Model\\MondialRelayPickupAddress');
|
||||
$this->setPackage('MondialRelay.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('JSON_RELAY_DATA', 'JsonRelayData', 'CLOB', true, null, null);
|
||||
$this->addColumn('ORDER_ADDRESS_ID', 'OrderAddressId', 'INTEGER', true, null, null);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
} // 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 ? MondialRelayPickupAddressTableMap::CLASS_DEFAULT : MondialRelayPickupAddressTableMap::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 (MondialRelayPickupAddress object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = MondialRelayPickupAddressTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = MondialRelayPickupAddressTableMap::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 + MondialRelayPickupAddressTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = MondialRelayPickupAddressTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
MondialRelayPickupAddressTableMap::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 = MondialRelayPickupAddressTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = MondialRelayPickupAddressTableMap::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;
|
||||
MondialRelayPickupAddressTableMap::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(MondialRelayPickupAddressTableMap::ID);
|
||||
$criteria->addSelectColumn(MondialRelayPickupAddressTableMap::JSON_RELAY_DATA);
|
||||
$criteria->addSelectColumn(MondialRelayPickupAddressTableMap::ORDER_ADDRESS_ID);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.JSON_RELAY_DATA');
|
||||
$criteria->addSelectColumn($alias . '.ORDER_ADDRESS_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(MondialRelayPickupAddressTableMap::DATABASE_NAME)->getTable(MondialRelayPickupAddressTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(MondialRelayPickupAddressTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(MondialRelayPickupAddressTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new MondialRelayPickupAddressTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a MondialRelayPickupAddress or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or MondialRelayPickupAddress 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(MondialRelayPickupAddressTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \MondialRelay\Model\MondialRelayPickupAddress) { // 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(MondialRelayPickupAddressTableMap::DATABASE_NAME);
|
||||
$criteria->add(MondialRelayPickupAddressTableMap::ID, (array) $values, Criteria::IN);
|
||||
}
|
||||
|
||||
$query = MondialRelayPickupAddressQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { MondialRelayPickupAddressTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { MondialRelayPickupAddressTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the mondial_relay_pickup_address 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 MondialRelayPickupAddressQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a MondialRelayPickupAddress or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or MondialRelayPickupAddress 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(MondialRelayPickupAddressTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from MondialRelayPickupAddress object
|
||||
}
|
||||
|
||||
if ($criteria->containsKey(MondialRelayPickupAddressTableMap::ID) && $criteria->keyContainsValue(MondialRelayPickupAddressTableMap::ID) ) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key ('.MondialRelayPickupAddressTableMap::ID.')');
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = MondialRelayPickupAddressQuery::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;
|
||||
}
|
||||
|
||||
} // MondialRelayPickupAddressTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
MondialRelayPickupAddressTableMap::buildTableMap();
|
||||
@@ -0,0 +1,427 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay\Model\Map;
|
||||
|
||||
use MondialRelay\Model\MondialRelayZoneConfiguration;
|
||||
use MondialRelay\Model\MondialRelayZoneConfigurationQuery;
|
||||
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 'mondial_relay_zone_configuration' 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 MondialRelayZoneConfigurationTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'MondialRelay.Model.Map.MondialRelayZoneConfigurationTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'mondial_relay_zone_configuration';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\MondialRelay\\Model\\MondialRelayZoneConfiguration';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'MondialRelay.Model.MondialRelayZoneConfiguration';
|
||||
|
||||
/**
|
||||
* 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 = 'mondial_relay_zone_configuration.ID';
|
||||
|
||||
/**
|
||||
* the column name for the DELIVERY_TIME field
|
||||
*/
|
||||
const DELIVERY_TIME = 'mondial_relay_zone_configuration.DELIVERY_TIME';
|
||||
|
||||
/**
|
||||
* the column name for the DELIVERY_TYPE field
|
||||
*/
|
||||
const DELIVERY_TYPE = 'mondial_relay_zone_configuration.DELIVERY_TYPE';
|
||||
|
||||
/**
|
||||
* the column name for the AREA_ID field
|
||||
*/
|
||||
const AREA_ID = 'mondial_relay_zone_configuration.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', 'DeliveryTime', 'DeliveryType', 'AreaId', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'deliveryTime', 'deliveryType', 'areaId', ),
|
||||
self::TYPE_COLNAME => array(MondialRelayZoneConfigurationTableMap::ID, MondialRelayZoneConfigurationTableMap::DELIVERY_TIME, MondialRelayZoneConfigurationTableMap::DELIVERY_TYPE, MondialRelayZoneConfigurationTableMap::AREA_ID, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'DELIVERY_TIME', 'DELIVERY_TYPE', 'AREA_ID', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'delivery_time', 'delivery_type', '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, 'DeliveryTime' => 1, 'DeliveryType' => 2, 'AreaId' => 3, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'deliveryTime' => 1, 'deliveryType' => 2, 'areaId' => 3, ),
|
||||
self::TYPE_COLNAME => array(MondialRelayZoneConfigurationTableMap::ID => 0, MondialRelayZoneConfigurationTableMap::DELIVERY_TIME => 1, MondialRelayZoneConfigurationTableMap::DELIVERY_TYPE => 2, MondialRelayZoneConfigurationTableMap::AREA_ID => 3, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'DELIVERY_TIME' => 1, 'DELIVERY_TYPE' => 2, 'AREA_ID' => 3, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'delivery_time' => 1, 'delivery_type' => 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('mondial_relay_zone_configuration');
|
||||
$this->setPhpName('MondialRelayZoneConfiguration');
|
||||
$this->setClassName('\\MondialRelay\\Model\\MondialRelayZoneConfiguration');
|
||||
$this->setPackage('MondialRelay.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('DELIVERY_TIME', 'DeliveryTime', 'INTEGER', true, null, null);
|
||||
$this->addColumn('DELIVERY_TYPE', 'DeliveryType', 'INTEGER', true, 1, null);
|
||||
$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 ? MondialRelayZoneConfigurationTableMap::CLASS_DEFAULT : MondialRelayZoneConfigurationTableMap::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 (MondialRelayZoneConfiguration object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = MondialRelayZoneConfigurationTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = MondialRelayZoneConfigurationTableMap::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 + MondialRelayZoneConfigurationTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = MondialRelayZoneConfigurationTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
MondialRelayZoneConfigurationTableMap::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 = MondialRelayZoneConfigurationTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = MondialRelayZoneConfigurationTableMap::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;
|
||||
MondialRelayZoneConfigurationTableMap::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(MondialRelayZoneConfigurationTableMap::ID);
|
||||
$criteria->addSelectColumn(MondialRelayZoneConfigurationTableMap::DELIVERY_TIME);
|
||||
$criteria->addSelectColumn(MondialRelayZoneConfigurationTableMap::DELIVERY_TYPE);
|
||||
$criteria->addSelectColumn(MondialRelayZoneConfigurationTableMap::AREA_ID);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.DELIVERY_TIME');
|
||||
$criteria->addSelectColumn($alias . '.DELIVERY_TYPE');
|
||||
$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(MondialRelayZoneConfigurationTableMap::DATABASE_NAME)->getTable(MondialRelayZoneConfigurationTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(MondialRelayZoneConfigurationTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(MondialRelayZoneConfigurationTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new MondialRelayZoneConfigurationTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a MondialRelayZoneConfiguration or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or MondialRelayZoneConfiguration 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(MondialRelayZoneConfigurationTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \MondialRelay\Model\MondialRelayZoneConfiguration) { // 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(MondialRelayZoneConfigurationTableMap::DATABASE_NAME);
|
||||
$criteria->add(MondialRelayZoneConfigurationTableMap::ID, (array) $values, Criteria::IN);
|
||||
}
|
||||
|
||||
$query = MondialRelayZoneConfigurationQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { MondialRelayZoneConfigurationTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { MondialRelayZoneConfigurationTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the mondial_relay_zone_configuration 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 MondialRelayZoneConfigurationQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a MondialRelayZoneConfiguration or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or MondialRelayZoneConfiguration 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(MondialRelayZoneConfigurationTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from MondialRelayZoneConfiguration object
|
||||
}
|
||||
|
||||
if ($criteria->containsKey(MondialRelayZoneConfigurationTableMap::ID) && $criteria->keyContainsValue(MondialRelayZoneConfigurationTableMap::ID) ) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key ('.MondialRelayZoneConfigurationTableMap::ID.')');
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = MondialRelayZoneConfigurationQuery::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;
|
||||
}
|
||||
|
||||
} // MondialRelayZoneConfigurationTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
MondialRelayZoneConfigurationTableMap::buildTableMap();
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay\Model;
|
||||
|
||||
use MondialRelay\Model\Base\MondialRelayDeliveryInsurance as BaseMondialRelayDeliveryInsurance;
|
||||
|
||||
class MondialRelayDeliveryInsurance extends BaseMondialRelayDeliveryInsurance
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay\Model;
|
||||
|
||||
use MondialRelay\Model\Base\MondialRelayDeliveryInsuranceQuery as BaseMondialRelayDeliveryInsuranceQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'mondial_relay_delivery_insurance' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
*/
|
||||
class MondialRelayDeliveryInsuranceQuery extends BaseMondialRelayDeliveryInsuranceQuery
|
||||
{
|
||||
|
||||
} // MondialRelayDeliveryInsuranceQuery
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay\Model;
|
||||
|
||||
use MondialRelay\Model\Base\MondialRelayDeliveryPrice as BaseMondialRelayDeliveryPrice;
|
||||
|
||||
class MondialRelayDeliveryPrice extends BaseMondialRelayDeliveryPrice
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay\Model;
|
||||
|
||||
use MondialRelay\Model\Base\MondialRelayDeliveryPriceQuery as BaseMondialRelayDeliveryPriceQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'mondial_relay_delivery_price' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
*/
|
||||
class MondialRelayDeliveryPriceQuery extends BaseMondialRelayDeliveryPriceQuery
|
||||
{
|
||||
|
||||
} // MondialRelayDeliveryPriceQuery
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay\Model;
|
||||
|
||||
use MondialRelay\Model\Base\MondialRelayPickupAddress as BaseMondialRelayPickupAddress;
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'mondial_relay_pickup_address' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
*/
|
||||
class MondialRelayPickupAddress extends BaseMondialRelayPickupAddress
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay\Model;
|
||||
|
||||
use MondialRelay\Model\Base\MondialRelayPickupAddressQuery as BaseMondialRelayPickupAddressQuery;
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'mondial_relay_pickup_address' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
*/
|
||||
class MondialRelayPickupAddressQuery extends BaseMondialRelayPickupAddressQuery
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay\Model;
|
||||
|
||||
use MondialRelay\Model\Base\MondialRelayZoneConfiguration as BaseMondialRelayZoneConfiguration;
|
||||
|
||||
class MondialRelayZoneConfiguration extends BaseMondialRelayZoneConfiguration
|
||||
{
|
||||
const RELAY_DELIVERY_TYPE = 1;
|
||||
const HOME_DELIVERY_TYPE = 2;
|
||||
const ALL_DELIVERY_TYPE = 3;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay\Model;
|
||||
|
||||
use MondialRelay\Model\Base\MondialRelayZoneConfigurationQuery as BaseMondialRelayZoneConfigurationQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'mondial_relay_zone_configuration' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
*/
|
||||
class MondialRelayZoneConfigurationQuery extends BaseMondialRelayZoneConfigurationQuery
|
||||
{
|
||||
|
||||
} // MondialRelayZoneConfigurationQuery
|
||||
234
local/modules/MondialRelay/MondialRelay.php
Normal file
@@ -0,0 +1,234 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace MondialRelay;
|
||||
|
||||
use MondialRelay\Model\MondialRelayDeliveryInsurance;
|
||||
use MondialRelay\Model\MondialRelayDeliveryPrice;
|
||||
use MondialRelay\Model\MondialRelayDeliveryPriceQuery;
|
||||
use MondialRelay\Model\MondialRelayZoneConfiguration;
|
||||
use Payzen\Model\Thelia\Model\ModuleConfigQuery;
|
||||
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\Model\Lang;
|
||||
use Thelia\Model\LangQuery;
|
||||
use Thelia\Model\Message;
|
||||
use Thelia\Model\MessageQuery;
|
||||
use Thelia\Model\ModuleConfig;
|
||||
use Thelia\Model\ModuleImageQuery;
|
||||
use Thelia\Model\OrderPostage;
|
||||
use Thelia\Module\AbstractDeliveryModule;
|
||||
use Thelia\Module\Exception\DeliveryException;
|
||||
|
||||
class MondialRelay extends AbstractDeliveryModule
|
||||
{
|
||||
const DOMAIN_NAME = 'mondialrelay';
|
||||
|
||||
const CODE_ENSEIGNE = 'code_enseigne';
|
||||
const PRIVATE_KEY = 'private_key';
|
||||
const WEBSERVICE_URL = 'webservice_url';
|
||||
const GOOGLE_MAPS_API_KEY = 'google_maps_api_key';
|
||||
|
||||
const ALLOW_RELAY_DELIVERY = 'allow_relay_delivery';
|
||||
const ALLOW_HOME_DELIVERY = 'allow_home_delivery';
|
||||
|
||||
const ALLOW_INSURANCE = 'allow_insurance';
|
||||
|
||||
const SESSION_SELECTED_PICKUP_RELAY_ID = 'MondialRelayPickupAddressId';
|
||||
const SESSION_SELECTED_DELIVERY_TYPE = 'MondialRelaySelectedDeliveryType';
|
||||
|
||||
const TRACKING_MESSAGE_NAME = 'mondial-relay-tracking-message';
|
||||
|
||||
const MAX_WEIGHT_KG = 30;
|
||||
const MIN_WEIGHT_KG = 0.1;
|
||||
|
||||
/**
|
||||
* This method is called by the Delivery loop, to check if the current module has to be displayed to the customer.
|
||||
* Override it to implements your delivery rules/
|
||||
*
|
||||
* If you return true, the delivery method will de displayed to the customer
|
||||
* If you return false, the delivery method will not be displayed
|
||||
*
|
||||
* @param Country $country the country to deliver to.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isValidDelivery(Country $country)
|
||||
{
|
||||
// TODO: Implement isValidDelivery() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate and return delivery price in the shop's default currency
|
||||
*
|
||||
* @param Country $country the country to deliver to.
|
||||
*
|
||||
* @return OrderPostage|float the delivery price
|
||||
* @throws DeliveryException if the postage price cannot be calculated.
|
||||
*/
|
||||
public function getPostage(Country $country)
|
||||
{
|
||||
// TODO: Implement getPostage() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ConnectionInterface|null $con
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function postActivation(ConnectionInterface $con = null)
|
||||
{
|
||||
try {
|
||||
MondialRelayDeliveryPriceQuery::create()->findOne();
|
||||
} catch (\Exception $e) {
|
||||
$database = new Database($con);
|
||||
$database->insertSql(null, [ __DIR__ . '/Config/thelia.sql' ]);
|
||||
|
||||
// Test Enseigne and private key
|
||||
self::setConfigValue(self::CODE_ENSEIGNE, "BDTEST13");
|
||||
self::setConfigValue(self::PRIVATE_KEY, "PrivateK");
|
||||
self::setConfigValue(self::WEBSERVICE_URL, "https://api.mondialrelay.com/Web_Services.asmx?WSDL");
|
||||
self::setConfigValue(self::GOOGLE_MAPS_API_KEY, "get_your_own_api_key");
|
||||
self::setConfigValue(self::ALLOW_HOME_DELIVERY, true);
|
||||
self::setConfigValue(self::ALLOW_RELAY_DELIVERY, true);
|
||||
self::setConfigValue(self::ALLOW_INSURANCE, true);
|
||||
|
||||
// Create mondial relay shipping zones for relay and home delivery
|
||||
|
||||
$moduleId = self::getModuleId();
|
||||
|
||||
$rateFromEuro = Currency::getDefaultCurrency()->getRate();
|
||||
|
||||
$moduleConfiguration = json_decode(file_get_contents(__DIR__. '/Config/config-data.json'));
|
||||
|
||||
if (false === $moduleConfiguration) {
|
||||
throw new TheliaProcessException("Invalid JSON configuration for Mondial Relay module");
|
||||
}
|
||||
|
||||
// Create all shipping zones, and associate Mondial relay 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();
|
||||
}
|
||||
}
|
||||
|
||||
// Define zone attributes
|
||||
(new MondialRelayZoneConfiguration())
|
||||
->setAreaId($area->getId())
|
||||
->setDeliveryType($shippingZone->delivery_type)
|
||||
->setDeliveryTime($shippingZone->delivery_time_in_days)
|
||||
->save();
|
||||
|
||||
// Attach this zone to our module
|
||||
(new AreaDeliveryModule())
|
||||
->setArea($area)
|
||||
->setDeliveryModuleId($moduleId)
|
||||
->save();
|
||||
|
||||
// Create base prices
|
||||
foreach ($shippingZone->prices as $price) {
|
||||
(new MondialRelayDeliveryPrice())
|
||||
->setAreaId($area->getId())
|
||||
->setMaxWeight($price->up_to)
|
||||
->setPriceWithTax($price->price_euro * $rateFromEuro)
|
||||
->save();
|
||||
}
|
||||
}
|
||||
|
||||
// Insurances
|
||||
foreach ($moduleConfiguration->insurances as $insurance) {
|
||||
(new MondialRelayDeliveryInsurance())
|
||||
->setMaxValue($insurance->value)
|
||||
->setPriceWithTax($insurance->price_with_tax_euro)
|
||||
->setLevel($insurance->level)
|
||||
->save();
|
||||
}
|
||||
|
||||
if (null === MessageQuery::create()->findOneByName(self::TRACKING_MESSAGE_NAME)) {
|
||||
$message = new Message();
|
||||
$message
|
||||
->setName(self::TRACKING_MESSAGE_NAME)
|
||||
->setHtmlLayoutFileName('')
|
||||
->setHtmlTemplateFileName(self::TRACKING_MESSAGE_NAME.'.html')
|
||||
->setTextLayoutFileName('')
|
||||
->setTextTemplateFileName(self::TRACKING_MESSAGE_NAME.'.txt')
|
||||
;
|
||||
|
||||
$languages = LangQuery::create()->find();
|
||||
|
||||
/** @var Lang $language */
|
||||
foreach ($languages as $language) {
|
||||
$locale = $language->getLocale();
|
||||
$message->setLocale($locale);
|
||||
|
||||
$message->setTitle(
|
||||
Translator::getInstance()->trans('Mondial Relay tracking information', [], self::DOMAIN_NAME, $locale)
|
||||
);
|
||||
|
||||
$message->setSubject(
|
||||
Translator::getInstance()->trans('Your order has been shipped', [], self::DOMAIN_NAME, $locale)
|
||||
);
|
||||
}
|
||||
|
||||
$message->save();
|
||||
}
|
||||
|
||||
/* Deploy the module's image */
|
||||
$module = $this->getModuleModel();
|
||||
if (ModuleImageQuery::create()->filterByModule($module)->count() == 0) {
|
||||
$this->deployImageFolder($module, sprintf('%s/images', __DIR__), $con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ConnectionInterface|null $con
|
||||
* @param bool $deleteModuleData
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function destroy(ConnectionInterface $con = null, $deleteModuleData = false)
|
||||
{
|
||||
if ($deleteModuleData) {
|
||||
// Delete message
|
||||
MessageQuery::create()->filterByName(self::TRACKING_MESSAGE_NAME)->delete($con);
|
||||
|
||||
// Delete module config data
|
||||
ModuleConfigQuery::create()->filterByModuleId(self::getModuleId())->delete($con);
|
||||
|
||||
// Delete module tables.
|
||||
if (null !== $con) {
|
||||
$database = new Database($con);
|
||||
$database->insertSql(null, [__DIR__ . '/Config/drop.sql']);
|
||||
}
|
||||
}
|
||||
|
||||
parent::destroy($con, $deleteModuleData);
|
||||
}
|
||||
}
|
||||
39
local/modules/MondialRelay/Readme.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# Module de livraison Mondial Relay
|
||||
|
||||
Ce module vous permet de proposer à vos clients une livraison avec le transporteur Mondial Relay,
|
||||
en point relais ou directement à domicile, en fonction des options disponibles
|
||||
dans le pays de destination.
|
||||
|
||||
## Installation
|
||||
|
||||
Ajoutez le module depuis la page Modules de votre back-office, ou directement sur votre serveur si vous préférez. Vous
|
||||
pouvez aussi utiliser composer :
|
||||
|
||||
composer require thelia/mondialrelay:~1.0
|
||||
|
||||
## Configuration
|
||||
|
||||
Par défaut, le module utilise des identifiants de test. Rendez-vous dans la configuration du module pour indiquer vos
|
||||
propres identifiants Mondial Relay, et configurer les divers aspects du module.
|
||||
|
||||
Lors de son installation, le module crée cinq zones de livraison, qui correspondent aux zones proposées par
|
||||
Mondial Relay [sur la page des tarifs](http://www.mondialrelay.fr/envoi-de-colis/premiere-visite/#Tarifs "sur cette page").
|
||||
|
||||
Chacun de ces zones de livraison peut proposer la livraison en point relais, la livraison à domicile, ou les deux.
|
||||
Vous pouvez régler ceci dans l'onglet "Prix" de la configuration du module.
|
||||
|
||||
Pour chaque zone, vous pouvez définir des prix par tranche de poids. Ces prix sont initialisés l'installation du module
|
||||
avec les prix de mars 2018.
|
||||
|
||||
## Intégration
|
||||
|
||||
Le module utilise les hooks de Thelia, aucun travail d'intégration n'est nécessaire.
|
||||
|
||||
Pour une livraison en point relais, les caractéristiques du relais (numéro, coordonnées, horaires d'ouverture) sont
|
||||
communiquées à vos clients dans les e-mails, documents PDF et historique de commande.
|
||||
|
||||
## Notifications par email
|
||||
|
||||
Si vous avez saisi un numéro de suivi, une notification d'envoi est expédiée à vos clients lorsque la commande passe à
|
||||
l'état "envoyé". Vous pouvez modifier le contenu de ce mail dans les fichiers
|
||||
`templates/email/default/mondial-relay-tracking-message.html` et `templates/email/default/mondial-relay-tracking-message.txt`
|
||||
BIN
local/modules/MondialRelay/Solution-Web-Service-V5.4.pdf
Normal file
11
local/modules/MondialRelay/composer.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "thelia/mondial-relay-module",
|
||||
"license": "LGPL-3.0-or-later",
|
||||
"type": "thelia-module",
|
||||
"require": {
|
||||
"xaviborja/php-mondialrelay-api": "dev-master"
|
||||
},
|
||||
"extra": {
|
||||
"installer-name": "MondialRelay"
|
||||
}
|
||||
}
|
||||
59
local/modules/MondialRelay/composer.lock
generated
Normal file
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "9dba6910bb06325dfa941ec161c6c334",
|
||||
"packages": [
|
||||
{
|
||||
"name": "xaviborja/php-mondialrelay-api",
|
||||
"version": "dev-master",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/xaviborja/php-mondialrelay-api.git",
|
||||
"reference": "b57f7da5f3f2ce983c8bea3d8239b7fdbe7ebcbf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/xaviborja/php-mondialrelay-api/zipball/b57f7da5f3f2ce983c8bea3d8239b7fdbe7ebcbf",
|
||||
"reference": "b57f7da5f3f2ce983c8bea3d8239b7fdbe7ebcbf",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"xaviborja/php-mondialrelay-api": "dev-master"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^5.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"MondialRelay\\": "src/MondialRelay/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Xavier Borja",
|
||||
"email": "xavibm86@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "A PHP library for dealing with Mondial Relay API (http://api.mondialrelay.com)",
|
||||
"time": "2017-06-21T12:22:06+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": {
|
||||
"xaviborja/php-mondialrelay-api": 20
|
||||
},
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform-dev": []
|
||||
}
|
||||
BIN
local/modules/MondialRelay/images/logo-mr.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,37 @@
|
||||
{form name="mondialrelay.settings_form"}
|
||||
<form action="{url path="/admin/module/MondialRelay/settings/save"}" {form_enctype form=$form} method="post" data-ajax-target="#general-form-container">
|
||||
{include file = "includes/inner-form-toolbar.html"
|
||||
hide_flags = true
|
||||
page_url = "{url path='/admin/module/MondialRelay'}"
|
||||
close_url = "{url path='/admin/modules'}"
|
||||
hide_save_and_close_button = true
|
||||
}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{render_form_field field="code_enseigne" value={module_config module="MondialRelay" key='code_enseigne' locale="en_US"}}
|
||||
{render_form_field field="private_key" value={module_config module="MondialRelay" key='private_key' locale="en_US"}}
|
||||
{render_form_field field="webservice_url" value={module_config module="MondialRelay" key='webservice_url' locale="en_US"}}
|
||||
{render_form_field field="google_maps_api_key" value={module_config module="MondialRelay" key='google_maps_api_key' locale="en_US"}}
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
{render_form_field field="allow_relay_delivery" value={module_config module="MondialRelay" key='allow_relay_delivery' locale="en_US"}}
|
||||
{render_form_field field="allow_home_delivery" value={module_config module="MondialRelay" key='allow_home_delivery' locale="en_US"}}
|
||||
{*
|
||||
{render_form_field field="allow_insurance" value={module_config module="MondialRelay" key='allow_insurance' locale="en_US"}}
|
||||
*}
|
||||
|
||||
<div class="text-center" style="margin-top: 40px; padding: 0 20%;">
|
||||
<p><a href="https://www.younivers.fr"><img src="{image file="mondialrelay/assets/img/younivers.png" source="MondialRelay"}"></a></p>
|
||||
<p>{intl l='Development of this module is sponsored by <a href="https://www.younivers.fr">you\'Nivers</a> web and communication agency in Roanne.' d="mondialrelay.bo.default"}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{/form}
|
||||
|
||||
{include file="mondialrelay/includes/error-dialog.html"}
|
||||
@@ -0,0 +1,98 @@
|
||||
{form name="mondialrelay.insurances_update_form"}
|
||||
<form action="{url path="/admin/module/MondialRelay/insurances/save"}" {form_enctype form=$form} method="post" data-ajax-target="#insurances-form-container">
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||
|
||||
<table class="table table-condensed table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l='Cart value' d='mondialrelay.bo.default'}</th>
|
||||
<th>{intl l='Insurance price with tax' d='mondialrelay.bo.default'}</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop type="mondialrelay.insurances" name="insurances"}
|
||||
<tr>
|
||||
<td>
|
||||
{form_field field="max_value"}
|
||||
<div class="input-group">
|
||||
<input type="text" {form_field_attributes field="max_value" value_key=$ID value=$MAX_VALUE|string_format:"%.2f"}>
|
||||
<span class="input-group-addon">{currency attr="symbol"}</span>
|
||||
</div>
|
||||
{/form_field}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{form_field field="price_with_tax"}
|
||||
<div class="input-group">
|
||||
<input type="text" {form_field_attributes field="price_with_tax" value_key=$ID value=$PRICE|string_format:"%.2f"}>
|
||||
<span class="input-group-addon">{currency attr="symbol"}</span>
|
||||
</div>
|
||||
{/form_field}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<a href="{url path="/admin/module/MondialRelay/insurances/delete/$ID"}" data-ajax-target="#insurances-form-container" class="btn btn-danger" title="{intl l='Delete this insurance' d='mondialrelay.bo.default'}">
|
||||
<i class="glyphicon glyphicon-remove"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="99" class="text-right">
|
||||
<button class="btn btn-primary" type="submit">
|
||||
<i class="glyphicon glyphicon-ok"></i>
|
||||
{intl l='Save changes' d='mondialrelay.bo.default'}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
{/form}
|
||||
|
||||
{form name="mondialrelay.insurance_create_form"}
|
||||
<form action="{url path="/admin/module/MondialRelay/insurances/create"}" {form_enctype form=$form} method="post" data-ajax-target="#insurances-form-container">
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||
|
||||
<table class="table table-condensed table-striped">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th colspan="99">{intl l='Add a new insurance' d='mondialrelay.bo.default'}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{form_field field="max_value"}
|
||||
<div class="input-group">
|
||||
<input type="text" {form_field_attributes field="max_value"}>
|
||||
<span class="input-group-addon">{currency attr="symbol"}</span>
|
||||
</div>
|
||||
{/form_field}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{form_field field="price_with_tax"}
|
||||
<div class="input-group">
|
||||
<input type="text" {form_field_attributes field="price_with_tax"}>
|
||||
<span class="input-group-addon">{currency attr="symbol"}</span>
|
||||
</div>
|
||||
{/form_field}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<button type="submit" class="btn btn-primary" title="{intl l='Add new insurance' d='mondialrelay.bo.default'}"><i class="glyphicon glyphicon-plus"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
{/form}
|
||||
|
||||
{include file="mondialrelay/includes/error-dialog.html"}
|
||||
@@ -0,0 +1,158 @@
|
||||
{$module_id = {$smarty.request.module_id|default:$module_id|default:0}}
|
||||
|
||||
{ifloop rel="module-areas"}
|
||||
<p> </p>
|
||||
|
||||
{loop type="area" name="module-areas" module_id=$module_id order='id'}
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading text-uppercase">
|
||||
{intl l="Shipping zone \"%name\"" name=$NAME d='mondialrelay.bo.default'}
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
{intl l='Delivery prices' d='mondialrelay.bo.default'}
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
{form name="mondialrelay.prices_update_form"}
|
||||
<form action="{url path="/admin/module/MondialRelay/prices/save/$ID/$module_id"}" data-ajax-target="#prices-form-container" {form_enctype form=$form} method="post">
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
<table class="table table-condensed table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{intl l='Cart weight up to...' d='mondialrelay.bo.default'}</th>
|
||||
<th>{intl l='Price with tax' d='mondialrelay.bo.default'}</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop type="mondialrelay.prices" name="prices" area_id=$ID}
|
||||
<tr>
|
||||
<td>
|
||||
{form_field field="max_weight" value_key=$ID}
|
||||
<div class="input-group">
|
||||
<input type="text" {form_field_attributes field="max_weight" value_key=$ID value=$MAX_WEIGHT|string_format:"%.2f"}>
|
||||
<span class="input-group-addon">{intl l='kg' d='mondialrelay.bo.default'}</span>
|
||||
</div>
|
||||
{/form_field}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{form_field field="price" value_key=$ID}
|
||||
<div class="input-group">
|
||||
<input type="text" {form_field_attributes field="price" value_key=$ID value=$PRICE|string_format:"%.2f"}>
|
||||
<span class="input-group-addon">{currency attr="symbol"}</span>
|
||||
</div>
|
||||
{/form_field}
|
||||
</td>
|
||||
|
||||
<td class="text-nowrap">
|
||||
<a href="{url path="/admin/module/MondialRelay/prices/delete/$ID/$module_id"}" data-ajax-target="#prices-form-container" class="btn btn-danger" title="{intl l='Delete this price' d='mondialrelay.bo.default'}"><i class="glyphicon glyphicon-remove"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="99" class="text-right">
|
||||
<button class="btn btn-primary" type="submit">
|
||||
<i class="glyphicon glyphicon-ok"></i>
|
||||
{intl l='Save changes' d='mondialrelay.bo.default'}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
{/form}
|
||||
|
||||
{form name="mondialrelay.price_form"}
|
||||
<form action="{url path="/admin/module/MondialRelay/prices/create/$ID/$module_id"}" data-ajax-target="#prices-form-container" {form_enctype form=$form} method="post">
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
<table class="table table-condensed table-striped">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th colspan="99">{intl l='Add a new price' d='mondialrelay.bo.default'}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{form_field field="max_weight"}
|
||||
<div class="input-group">
|
||||
<input type="text" {form_field_attributes field="max_weight"}>
|
||||
<span class="input-group-addon">{intl l='kg' d='mondialrelay.bo.default'}</span>
|
||||
</div>
|
||||
{/form_field}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{form_field field="price"}
|
||||
<div class="input-group">
|
||||
<input type="text" {form_field_attributes field="price"}>
|
||||
<span class="input-group-addon">{currency attr="symbol"}</span>
|
||||
</div>
|
||||
{/form_field}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<button class="btn btn-primary" title="{intl l='Add this price' d='mondialrelay.bo.default'}"><i class="glyphicon glyphicon-plus"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-4">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
{intl l='Area properties' d='mondialrelay.bo.default'}
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
{form name="mondialrelay.area_attributes_update_form"}
|
||||
<form action="{url path="/admin/module/MondialRelay/area-attributes/save/$ID/$module_id"}" data-ajax-target="#prices-form-container" {form_enctype form=$form} method="post">
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{loop type="mondialrelay.area-attributes" name="area-attributes" area_id=$ID}
|
||||
{custom_render_form_field field="delivery_time"}
|
||||
<div class="input-group">
|
||||
<input type="text" {form_field_attributes field="delivery_time" value=$DELIVERY_TIME}>
|
||||
<span class="input-group-addon">{intl l='days' d='mondialrelay.bo.default'}</span>
|
||||
</div>
|
||||
{/custom_render_form_field}
|
||||
|
||||
{render_form_field field="delivery_type" value=$DELIVERY_TYPE}
|
||||
|
||||
<button type="submit" class="btn btn-primary" title="{intl l='Save changes' d='mondialrelay.bo.default'}"><i class="glyphicon glyphicon-ok"></i> {intl l="Save" d='mondialrelay.bo.default'}</button>
|
||||
{/loop}
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/loop}
|
||||
{/ifloop}
|
||||
|
||||
{elseloop rel="module-areas"}
|
||||
<div class="alert alert-warning">
|
||||
{intl l='There\'s no shipping zone defined for Mondial Relay. Please <a href="%url">click here</a> to configure module\'s shipping zones.' url={url path='/admin/configuration/shipping_zones'} d='mondialrelay.bo.default'}
|
||||
</div>
|
||||
{/elseloop}
|
||||
|
||||
{include file="mondialrelay/includes/error-dialog.html"}
|
||||
|
After Width: | Height: | Size: 5.0 KiB |
@@ -0,0 +1,53 @@
|
||||
<script>
|
||||
$(function() {
|
||||
function ajaxSubmit($zis) {
|
||||
var data, url;
|
||||
|
||||
var notif = $.notify({
|
||||
message: '<i class="glyphicon glyphicon-time"></i> {intl l="Saving data, please wait..." d="mondialrelay.bo.default"}'
|
||||
}, {
|
||||
type: 'info',
|
||||
allow_dismiss: true
|
||||
});
|
||||
|
||||
if ($zis.attr('action')) {
|
||||
data = $zis.serialize();
|
||||
url = $zis.attr('action');
|
||||
} else {
|
||||
url = $zis.attr('href');
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
method: 'post',
|
||||
data: data,
|
||||
success: function (result) {
|
||||
$($zis.data('ajax-target')).html(result);
|
||||
|
||||
notif.close();
|
||||
$.notify({
|
||||
message: '<i class="glyphicon glyphicon-ok"></i> {intl l="Update finished." d="mondialrelay.bo.default"}'
|
||||
}, {
|
||||
type: 'success',
|
||||
allow_dismiss: true,
|
||||
delay: 2000
|
||||
});
|
||||
},
|
||||
error: function () {
|
||||
notif.close();
|
||||
alert("{intl l='Sorry, something goes wrong. Please try again.' d='mondialrelay.bo.default'}");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('submit', 'form[data-ajax-target]', function (ev) {
|
||||
ajaxSubmit($(this));
|
||||
ev.preventDefault();
|
||||
});
|
||||
|
||||
$(document).on('click', 'a[data-ajax-target]', function (ev) {
|
||||
ajaxSubmit($(this));
|
||||
ev.preventDefault();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,27 @@
|
||||
{if $error_message}
|
||||
<div class="modal fade" id="error-dialog" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>An error occured</h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
{$error_message}
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" data-dismiss="modal" class="btn btn-primary"><span class="glyphicon glyphicon-check"></span> Continue</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$('#error-dialog').modal('show');
|
||||
});
|
||||
</script>
|
||||
{/if}
|
||||
@@ -0,0 +1,38 @@
|
||||
{$current_tab = {$smarty.get.tab|default:'general'}}
|
||||
<div class="col-md-12 general-block-decorator">
|
||||
<div class="row">
|
||||
<div class="col-md-12 title">
|
||||
{intl l="Mondial Relay delivery configuration" d='mondialrelay.bo.default'}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="nav nav-tabs clearfix">
|
||||
<li {if $current_tab == 'general'}class="active"{/if}><a href="#general" data-tab-name="general" data-toggle="tab">{intl l="Configuration" d='mondialrelay.bo.default'}</a></li>
|
||||
<li {if $current_tab == 'prices'}class="active"{/if}><a href="#prices" data-tab-name="prices" data-toggle="tab">{intl l="Prices" d='mondialrelay.bo.default'}</a></li>
|
||||
{*
|
||||
<li {if $current_tab == 'insurances'}class="active"{/if}><a href="#insurances" data-tab-name="insurances" data-toggle="tab">{intl l="Insurances" d='mondialrelay.bo.default'}</a></li>
|
||||
*}
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade {if $current_tab == 'general'}active in{/if}" id="general">
|
||||
<div class="form-container" id="general-form-container">
|
||||
{include file="mondialrelay/ajax/general.html"}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade {if $current_tab == 'prices'}active in{/if}" id="prices">
|
||||
<div class="form-container" id="prices-form-container">
|
||||
{include file="mondialrelay/ajax/prices.html" module_id=$module_id}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{*
|
||||
<div class="tab-pane fade {if $current_tab == 'insurances'}active in{/if}" id="insurances">
|
||||
<div class="form-container" id="insurances-form-container">
|
||||
{include file="mondialrelay/ajax/insurances.html"}
|
||||
</div>
|
||||
</div>
|
||||
*}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,28 @@
|
||||
{extends file="email-layout.tpl"}
|
||||
|
||||
{default_translation_domain domain='mondialrelay.email.default'}
|
||||
|
||||
{* Do not provide a "Open in browser" link *}
|
||||
{block name="browser"}{/block}
|
||||
{* No pre-header *}
|
||||
{block name="pre-header"}{/block}
|
||||
|
||||
{* Subject *}
|
||||
{block name="email-subject"}{intl l="Your %ref order has been shipped" ref=$REF}{/block}
|
||||
|
||||
{* Title *}
|
||||
{block name="email-title"}{intl l="Your %ref order has been shipped" ref=$REF}{/block}
|
||||
|
||||
{* Content *}
|
||||
{block name="email-content"}
|
||||
{loop type="order" name="order" id=$order_id}
|
||||
{loop type="customer" name="customer.order" current=false id=$CUSTOMER backend_context="1"}
|
||||
<p>{intl l="Dear %first %last" last=$LASTNAME first=$FIRSTNAME},</p>
|
||||
{/loop}
|
||||
|
||||
<p>{intl l="Your order %order_ref has just been shipped from our store. The tracking number for this order is %tracking_ref. Please <a href=\"https://www.mondialrelay.fr/suivi-de-colis\">click here</a> to track the delivery." order_ref=$REF tracking_ref=$DELIVERY_REF}</p>
|
||||
<p>{intl l="Details about this order are available <a href=\"%account_url\">in your customer account</a>." account_url={url path="/account"}}</p>
|
||||
<p>{intl l="See you soon at <a href=\"%url\">%store</a>" url={navigate to='index'} store={config key="store_name"}}</p>
|
||||
<p>{intl l="The %store team." store={config key="store_name"}}</p>
|
||||
{/loop}
|
||||
{/block}
|
||||
@@ -0,0 +1,11 @@
|
||||
{default_translation_domain domain='mondialrelay.email.default'}
|
||||
{default_locale locale={$locale}}
|
||||
{loop type="order" name="order" id=$order_id}
|
||||
{loop type="customer" name="customer.order" current=false id=$CUSTOMER backend_context="1"}
|
||||
{intl l="Dear %first %last" last=$LASTNAME first=$FIRSTNAME},<br>
|
||||
{/loop}
|
||||
{intl l="Your order %order_ref has just been shipped from our store. The tracking number for this order is %tracking_ref. Tracking data is available at this address: https://www.mondialrelay.fr/suivi-de-colis" order_ref=$REF tracking_ref=$DELIVERY_REF}<br>
|
||||
{intl l="Details about this order are available in your customer account: %account_url." account_url={url path="/account"}}<br>
|
||||
{intl l="See you soon at %store at the following address: %url" url={navigate to='index'} store={config key="store_name"}}<br>
|
||||
{intl l="The %store team." store={config key="store_name"}}
|
||||
{/loop}
|
||||
@@ -0,0 +1,26 @@
|
||||
{strip}
|
||||
{loop type="mondialrelay.selected-pickup-point" name="avec-pickup" order_id=$order_id}
|
||||
{if count($OPENINGS) > 0}
|
||||
<div class="opening hours">
|
||||
<p>{intl l="Pickup relay opening hours:" d="mondialrelay.email.default"}</p>
|
||||
<table>
|
||||
{foreach $OPENINGS as $opening}
|
||||
<tr>
|
||||
<td><b>{$opening.day}</b></td>
|
||||
{if $opening.opening_time_1}
|
||||
<td>{$opening.opening_time_1} - {$opening.closing_time_1}</td>
|
||||
{else}
|
||||
<td> </td>
|
||||
{/if}
|
||||
{if $opening.opening_time_2}
|
||||
<td>{$opening.opening_time_2} - {$opening.closing_time_2}</td>
|
||||
{else}
|
||||
<td> </td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
{/loop}
|
||||
{/strip}
|
||||
@@ -0,0 +1,8 @@
|
||||
{strip}
|
||||
{loop type="mondialrelay.selected-pickup-point" name="avec-pickup" order_id=$order_id}
|
||||
{if count($OPENINGS) > 0}{foreach $OPENINGS as $opening}
|
||||
{intl l="Pickup relay opening hours:" d="mondialrelay.email.default"}
|
||||
{$opening.day}: {if $opening.opening_time_1}{$opening.opening_time_1} - {$opening.closing_time_1}{/if} {if $opening.opening_time_2}{$opening.opening_time_2} - {$opening.closing_time_2}{/if}
|
||||
{/foreach}{/if}
|
||||
{/loop}
|
||||
{/strip}
|
||||
@@ -0,0 +1,13 @@
|
||||
{strip}
|
||||
{loop type="mondialrelay.selected-pickup-point" name="avec-pickup" order_id=$order_id}
|
||||
{intl l="Mondial Relay pickup location #%num" num=$ID d="mondialrelay.email.default"}<br>
|
||||
{format_address
|
||||
country_code=$COUNTRY
|
||||
locality=$CITY
|
||||
postal_code=$ZIPCODE
|
||||
address_line1=$ADDRESS
|
||||
organization=$NAME
|
||||
html=$html_mode
|
||||
}
|
||||
{/loop}
|
||||
{/strip}
|
||||
@@ -0,0 +1,66 @@
|
||||
.location-form {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.location-form button {
|
||||
padding: 6px 12px !important;
|
||||
}
|
||||
|
||||
#relay_info {
|
||||
height: 450px;
|
||||
overflow-y: scroll;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
#relay_info table {
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#relay_info table.pickup-points > tbody > tr > td {
|
||||
border-bottom: 1px solid #ccc;
|
||||
margin: 0;
|
||||
padding: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
#relay_info table.pickup-points > tbody > tr:hover {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
#relay_info table.pickup-points > tbody > tr > td .name {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#relay_info table.pickup-points > tbody > tr > td .name .numero {
|
||||
display: inline-block;
|
||||
border-radius: 2px;
|
||||
background-color:#e64b62;
|
||||
color: #fff;
|
||||
padding: 0 5px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
#relay_info table.opening-hours {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#relay_info table.opening-hours tr td {
|
||||
font-size: 90%;
|
||||
padding: 3px;
|
||||
}
|
||||
#relay_info table.opening-hours tr:nth-child(even) {
|
||||
background-color:#f5f5f5;
|
||||
}
|
||||
|
||||
#mondial-relay-pickup {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.pickup-home-separator {
|
||||
margin-top: 20px;
|
||||
border-top: 1px solid #eee;
|
||||
padding-top: 30px;
|
||||
margin-left: -30px;
|
||||
margin-right: -30px;
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.2 KiB |