Des modules ajoutés et mise en page du CSS
This commit is contained in:
3
.idea/nouveau_site.iml
generated
3
.idea/nouveau_site.iml
generated
@@ -100,6 +100,9 @@
|
|||||||
<excludeFolder url="file://$MODULE_DIR$/core/vendor/commerceguys/addressing" />
|
<excludeFolder url="file://$MODULE_DIR$/core/vendor/commerceguys/addressing" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/core/vendor/phpunit/php-token-stream" />
|
<excludeFolder url="file://$MODULE_DIR$/core/vendor/phpunit/php-token-stream" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/core/vendor/tecnickcom/tcpdf" />
|
<excludeFolder url="file://$MODULE_DIR$/core/vendor/tecnickcom/tcpdf" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/core/vendor/paypal/rest-api-sdk-php" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/core/vendor/wazaari/monolog-mysql" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/core/vendor/monolog/monolog" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
|||||||
3
.idea/php.xml
generated
3
.idea/php.xml
generated
@@ -94,6 +94,9 @@
|
|||||||
<path value="$PROJECT_DIR$/core/vendor/commerceguys/addressing" />
|
<path value="$PROJECT_DIR$/core/vendor/commerceguys/addressing" />
|
||||||
<path value="$PROJECT_DIR$/core/vendor/phpunit/php-token-stream" />
|
<path value="$PROJECT_DIR$/core/vendor/phpunit/php-token-stream" />
|
||||||
<path value="$PROJECT_DIR$/core/vendor/tecnickcom/tcpdf" />
|
<path value="$PROJECT_DIR$/core/vendor/tecnickcom/tcpdf" />
|
||||||
|
<path value="$PROJECT_DIR$/core/vendor/paypal/rest-api-sdk-php" />
|
||||||
|
<path value="$PROJECT_DIR$/core/vendor/wazaari/monolog-mysql" />
|
||||||
|
<path value="$PROJECT_DIR$/core/vendor/monolog/monolog" />
|
||||||
</include_path>
|
</include_path>
|
||||||
</component>
|
</component>
|
||||||
<component name="PhpUnit">
|
<component name="PhpUnit">
|
||||||
|
|||||||
@@ -62,7 +62,8 @@
|
|||||||
"symfony/polyfill-php73": "^1.0",
|
"symfony/polyfill-php73": "^1.0",
|
||||||
"symfony/lock": "^3.4|^4.0",
|
"symfony/lock": "^3.4|^4.0",
|
||||||
"thelia/propel": "dev-thelia-2.4",
|
"thelia/propel": "dev-thelia-2.4",
|
||||||
"symfony/var-dumper": "^2.0|^3.0|^4.0"
|
"symfony/var-dumper": "^2.0|^3.0|^4.0",
|
||||||
|
"thelia/paypal-module": "~4.0.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"fzaninotto/faker": "1.5.*",
|
"fzaninotto/faker": "1.5.*",
|
||||||
|
|||||||
316
composer.lock
generated
316
composer.lock
generated
@@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "5775e58f869179ca9e753e2556329f65",
|
"content-hash": "68a6565d5f25e51cac1f294c195b730e",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "commerceguys/addressing",
|
"name": "commerceguys/addressing",
|
||||||
@@ -473,6 +473,88 @@
|
|||||||
],
|
],
|
||||||
"time": "2015-12-24T01:37:31+00:00"
|
"time": "2015-12-24T01:37:31+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "monolog/monolog",
|
||||||
|
"version": "1.26.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/Seldaek/monolog.git",
|
||||||
|
"reference": "2209ddd84e7ef1256b7af205d0717fb62cfc9c33"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/2209ddd84e7ef1256b7af205d0717fb62cfc9c33",
|
||||||
|
"reference": "2209ddd84e7ef1256b7af205d0717fb62cfc9c33",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.0",
|
||||||
|
"psr/log": "~1.0"
|
||||||
|
},
|
||||||
|
"provide": {
|
||||||
|
"psr/log-implementation": "1.0.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"aws/aws-sdk-php": "^2.4.9 || ^3.0",
|
||||||
|
"doctrine/couchdb": "~1.0@dev",
|
||||||
|
"graylog2/gelf-php": "~1.0",
|
||||||
|
"php-amqplib/php-amqplib": "~2.4",
|
||||||
|
"php-console/php-console": "^3.1.3",
|
||||||
|
"phpstan/phpstan": "^0.12.59",
|
||||||
|
"phpunit/phpunit": "~4.5",
|
||||||
|
"ruflin/elastica": ">=0.90 <3.0",
|
||||||
|
"sentry/sentry": "^0.13",
|
||||||
|
"swiftmailer/swiftmailer": "^5.3|^6.0"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
|
||||||
|
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
|
||||||
|
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
|
||||||
|
"ext-mongo": "Allow sending log messages to a MongoDB server",
|
||||||
|
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
|
||||||
|
"mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver",
|
||||||
|
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
|
||||||
|
"php-console/php-console": "Allow sending log messages to Google Chrome",
|
||||||
|
"rollbar/rollbar": "Allow sending log messages to Rollbar",
|
||||||
|
"ruflin/elastica": "Allow sending log messages to an Elastic Search server",
|
||||||
|
"sentry/sentry": "Allow sending log messages to a Sentry server"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Monolog\\": "src/Monolog"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Jordi Boggiano",
|
||||||
|
"email": "j.boggiano@seld.be",
|
||||||
|
"homepage": "http://seld.be"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
|
||||||
|
"homepage": "http://github.com/Seldaek/monolog",
|
||||||
|
"keywords": [
|
||||||
|
"log",
|
||||||
|
"logging",
|
||||||
|
"psr-3"
|
||||||
|
],
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://github.com/Seldaek",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/monolog/monolog",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2020-12-14T12:56:38+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "oyejorge/less.php",
|
"name": "oyejorge/less.php",
|
||||||
"version": "v1.7.0.14",
|
"version": "v1.7.0.14",
|
||||||
@@ -585,6 +667,56 @@
|
|||||||
],
|
],
|
||||||
"time": "2018-07-04T16:31:37+00:00"
|
"time": "2018-07-04T16:31:37+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "paypal/rest-api-sdk-php",
|
||||||
|
"version": "v1.7.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/paypal/PayPal-PHP-SDK.git",
|
||||||
|
"reference": "d2fac37f2cba3ccf2a23ce30d3d23f34d17d099b"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/paypal/PayPal-PHP-SDK/zipball/d2fac37f2cba3ccf2a23ce30d3d23f34d17d099b",
|
||||||
|
"reference": "d2fac37f2cba3ccf2a23ce30d3d23f34d17d099b",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-curl": "*",
|
||||||
|
"ext-json": "*",
|
||||||
|
"php": ">=5.3.0",
|
||||||
|
"psr/log": "1.0.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "3.7.*"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"PayPal": "lib/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"Apache2"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "PayPal",
|
||||||
|
"homepage": "https://github.com/paypal/rest-api-sdk-php/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "PayPal's PHP SDK for REST APIs",
|
||||||
|
"homepage": "http://paypal.github.io/PayPal-PHP-SDK/",
|
||||||
|
"keywords": [
|
||||||
|
"payments",
|
||||||
|
"paypal",
|
||||||
|
"rest",
|
||||||
|
"sdk"
|
||||||
|
],
|
||||||
|
"abandoned": true,
|
||||||
|
"time": "2016-04-22T03:29:29+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "psr/cache",
|
"name": "psr/cache",
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
@@ -3662,6 +3794,58 @@
|
|||||||
"description": "php 5.4 currency tools",
|
"description": "php 5.4 currency tools",
|
||||||
"time": "2017-09-30T16:33:49+00:00"
|
"time": "2017-09-30T16:33:49+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "thelia/installer",
|
||||||
|
"version": "1.3",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/thelia/installer.git",
|
||||||
|
"reference": "dca473563e05011c7aea3aaebc6f154fef4187fe"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/thelia/installer/zipball/dca473563e05011c7aea3aaebc6f154fef4187fe",
|
||||||
|
"reference": "dca473563e05011c7aea3aaebc6f154fef4187fe",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"composer-plugin-api": "^1.0||^2.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"composer/composer": "1.0.*@dev||2.0.*@dev"
|
||||||
|
},
|
||||||
|
"type": "composer-plugin",
|
||||||
|
"extra": {
|
||||||
|
"class": "Thelia\\Composer\\TheliaInstallerPlugin"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Thelia\\Composer": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"LGPL-3.0-or-later"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Manuel Raynaud",
|
||||||
|
"email": "raynaud.manu@gmail.com",
|
||||||
|
"homepage": "https://github.com/lunika"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "custom installer for Thelia.",
|
||||||
|
"keywords": [
|
||||||
|
"Thelia",
|
||||||
|
"Thelia-module",
|
||||||
|
"Thelia-template"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/thelia/installer/issues",
|
||||||
|
"source": "https://github.com/thelia/installer/tree/1.3"
|
||||||
|
},
|
||||||
|
"time": "2020-10-26T10:32:18+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "thelia/math-tools",
|
"name": "thelia/math-tools",
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
@@ -3703,6 +3887,36 @@
|
|||||||
"description": "Number management library",
|
"description": "Number management library",
|
||||||
"time": "2015-11-05T15:52:55+00:00"
|
"time": "2015-11-05T15:52:55+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "thelia/paypal-module",
|
||||||
|
"version": "4.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/thelia-modules/PayPal.git",
|
||||||
|
"reference": "a180202e7abd0313d9390031e1b304a4c06967c6"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/thelia-modules/PayPal/zipball/a180202e7abd0313d9390031e1b304a4c06967c6",
|
||||||
|
"reference": "a180202e7abd0313d9390031e1b304a4c06967c6",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"paypal/rest-api-sdk-php": "1.7.1",
|
||||||
|
"thelia/installer": "~1.1",
|
||||||
|
"wazaari/monolog-mysql": "1.0.3"
|
||||||
|
},
|
||||||
|
"type": "thelia-module",
|
||||||
|
"extra": {
|
||||||
|
"installer-name": "PayPal"
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"LGPL-3.0+"
|
||||||
|
],
|
||||||
|
"description": "PayPal module for Thelia ecommerce solution ",
|
||||||
|
"time": "2020-11-06T11:20:42+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "thelia/propel",
|
"name": "thelia/propel",
|
||||||
"version": "dev-thelia-2.4",
|
"version": "dev-thelia-2.4",
|
||||||
@@ -3767,6 +3981,50 @@
|
|||||||
"persistence"
|
"persistence"
|
||||||
],
|
],
|
||||||
"time": "2020-03-25T14:16:18+00:00"
|
"time": "2020-03-25T14:16:18+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "wazaari/monolog-mysql",
|
||||||
|
"version": "v1.0.3",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/waza-ari/monolog-mysql.git",
|
||||||
|
"reference": "540c7b92245db3e54d6493056ba3a84da2d49b24"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/waza-ari/monolog-mysql/zipball/540c7b92245db3e54d6493056ba3a84da2d49b24",
|
||||||
|
"reference": "540c7b92245db3e54d6493056ba3a84da2d49b24",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"monolog/monolog": ">1.4.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"MySQLHandler\\": "src/MySQLHandler"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Daniel Herrmann",
|
||||||
|
"email": "daniel.herrmann1@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A handler for Monolog that sends messages to MySQL",
|
||||||
|
"homepage": "https://github.com/waza-ari/monolog-mysql",
|
||||||
|
"keywords": [
|
||||||
|
"database",
|
||||||
|
"log",
|
||||||
|
"logging",
|
||||||
|
"monolog",
|
||||||
|
"mysql"
|
||||||
|
],
|
||||||
|
"time": "2015-07-12T22:25:23+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packages-dev": [
|
"packages-dev": [
|
||||||
@@ -3874,6 +4132,7 @@
|
|||||||
"faker",
|
"faker",
|
||||||
"fixtures"
|
"fixtures"
|
||||||
],
|
],
|
||||||
|
"abandoned": true,
|
||||||
"time": "2015-05-29T06:29:14+00:00"
|
"time": "2015-05-29T06:29:14+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -4377,6 +4636,7 @@
|
|||||||
"keywords": [
|
"keywords": [
|
||||||
"tokenizer"
|
"tokenizer"
|
||||||
],
|
],
|
||||||
|
"abandoned": true,
|
||||||
"time": "2017-12-04T08:55:13+00:00"
|
"time": "2017-12-04T08:55:13+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -5082,58 +5342,6 @@
|
|||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"time": "2014-12-24T09:51:48+00:00"
|
"time": "2014-12-24T09:51:48+00:00"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "thelia/installer",
|
|
||||||
"version": "1.3",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/thelia/installer.git",
|
|
||||||
"reference": "dca473563e05011c7aea3aaebc6f154fef4187fe"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/thelia/installer/zipball/dca473563e05011c7aea3aaebc6f154fef4187fe",
|
|
||||||
"reference": "dca473563e05011c7aea3aaebc6f154fef4187fe",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"composer-plugin-api": "^1.0||^2.0"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"composer/composer": "1.0.*@dev||2.0.*@dev"
|
|
||||||
},
|
|
||||||
"type": "composer-plugin",
|
|
||||||
"extra": {
|
|
||||||
"class": "Thelia\\Composer\\TheliaInstallerPlugin"
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-0": {
|
|
||||||
"Thelia\\Composer": "src/"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"LGPL-3.0-or-later"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Manuel Raynaud",
|
|
||||||
"email": "raynaud.manu@gmail.com",
|
|
||||||
"homepage": "https://github.com/lunika"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "custom installer for Thelia.",
|
|
||||||
"keywords": [
|
|
||||||
"Thelia",
|
|
||||||
"Thelia-module",
|
|
||||||
"Thelia-template"
|
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"issues": "https://github.com/thelia/installer/issues",
|
|
||||||
"source": "https://github.com/thelia/installer/tree/1.3"
|
|
||||||
},
|
|
||||||
"time": "2020-10-26T10:32:18+00:00"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "webmozart/assert",
|
"name": "webmozart/assert",
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
@@ -5196,5 +5404,5 @@
|
|||||||
"php": ">=5.6 <7.4"
|
"php": ">=5.6 <7.4"
|
||||||
},
|
},
|
||||||
"platform-dev": [],
|
"platform-dev": [],
|
||||||
"plugin-api-version": "2.0.0"
|
"plugin-api-version": "1.1.0"
|
||||||
}
|
}
|
||||||
|
|||||||
6
core/vendor/composer/ClassLoader.php
vendored
6
core/vendor/composer/ClassLoader.php
vendored
@@ -37,8 +37,8 @@ namespace Composer\Autoload;
|
|||||||
*
|
*
|
||||||
* @author Fabien Potencier <fabien@symfony.com>
|
* @author Fabien Potencier <fabien@symfony.com>
|
||||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||||
* @see https://www.php-fig.org/psr/psr-0/
|
* @see http://www.php-fig.org/psr/psr-0/
|
||||||
* @see https://www.php-fig.org/psr/psr-4/
|
* @see http://www.php-fig.org/psr/psr-4/
|
||||||
*/
|
*/
|
||||||
class ClassLoader
|
class ClassLoader
|
||||||
{
|
{
|
||||||
@@ -60,7 +60,7 @@ class ClassLoader
|
|||||||
public function getPrefixes()
|
public function getPrefixes()
|
||||||
{
|
{
|
||||||
if (!empty($this->prefixesPsr0)) {
|
if (!empty($this->prefixesPsr0)) {
|
||||||
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return array();
|
return array();
|
||||||
|
|||||||
1
core/vendor/composer/autoload_classmap.php
vendored
1
core/vendor/composer/autoload_classmap.php
vendored
@@ -10,7 +10,6 @@ return array(
|
|||||||
'AssertionError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php',
|
'AssertionError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php',
|
||||||
'CallbackFilterIterator' => $vendorDir . '/symfony/polyfill-php54/Resources/stubs/CallbackFilterIterator.php',
|
'CallbackFilterIterator' => $vendorDir . '/symfony/polyfill-php54/Resources/stubs/CallbackFilterIterator.php',
|
||||||
'Collator' => $vendorDir . '/symfony/intl/Resources/stubs/Collator.php',
|
'Collator' => $vendorDir . '/symfony/intl/Resources/stubs/Collator.php',
|
||||||
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
|
||||||
'Datamatrix' => $vendorDir . '/tecnickcom/tcpdf/include/barcodes/datamatrix.php',
|
'Datamatrix' => $vendorDir . '/tecnickcom/tcpdf/include/barcodes/datamatrix.php',
|
||||||
'DivisionByZeroError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php',
|
'DivisionByZeroError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php',
|
||||||
'Error' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/Error.php',
|
'Error' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/Error.php',
|
||||||
|
|||||||
2
core/vendor/composer/autoload_files.php
vendored
2
core/vendor/composer/autoload_files.php
vendored
@@ -14,13 +14,13 @@ return array(
|
|||||||
'3e2471375464aac821502deb0ac64275' => $vendorDir . '/symfony/polyfill-php54/bootstrap.php',
|
'3e2471375464aac821502deb0ac64275' => $vendorDir . '/symfony/polyfill-php54/bootstrap.php',
|
||||||
'32dcc8afd4335739640db7d200c1971d' => $vendorDir . '/symfony/polyfill-apcu/bootstrap.php',
|
'32dcc8afd4335739640db7d200c1971d' => $vendorDir . '/symfony/polyfill-apcu/bootstrap.php',
|
||||||
'667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php',
|
'667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php',
|
||||||
|
'2c102faa651ef8ea5874edb585946bce' => $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php',
|
||||||
'5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php',
|
'5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php',
|
||||||
'6a47392539ca2329373e0d33e1dba053' => $vendorDir . '/symfony/polyfill-intl-icu/bootstrap.php',
|
'6a47392539ca2329373e0d33e1dba053' => $vendorDir . '/symfony/polyfill-intl-icu/bootstrap.php',
|
||||||
'023d27dca8066ef29e6739335ea73bad' => $vendorDir . '/symfony/polyfill-php70/bootstrap.php',
|
'023d27dca8066ef29e6739335ea73bad' => $vendorDir . '/symfony/polyfill-php70/bootstrap.php',
|
||||||
'bd9634f2d41831496de0d3dfe4c94881' => $vendorDir . '/symfony/polyfill-php56/bootstrap.php',
|
'bd9634f2d41831496de0d3dfe4c94881' => $vendorDir . '/symfony/polyfill-php56/bootstrap.php',
|
||||||
'ce89ac35a6c330c55f4710717db9ff78' => $vendorDir . '/kriswallsmith/assetic/src/functions.php',
|
'ce89ac35a6c330c55f4710717db9ff78' => $vendorDir . '/kriswallsmith/assetic/src/functions.php',
|
||||||
'f084d01b0a599f67676cffef638aa95b' => $vendorDir . '/smarty/smarty/libs/bootstrap.php',
|
'f084d01b0a599f67676cffef638aa95b' => $vendorDir . '/smarty/smarty/libs/bootstrap.php',
|
||||||
'2c102faa651ef8ea5874edb585946bce' => $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php',
|
|
||||||
'e277be14c90068cf94faed2c43dbe6d8' => $vendorDir . '/symfony/polyfill-php71/bootstrap.php',
|
'e277be14c90068cf94faed2c43dbe6d8' => $vendorDir . '/symfony/polyfill-php71/bootstrap.php',
|
||||||
'25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php',
|
'25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php',
|
||||||
'0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
|
'0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
|
||||||
|
|||||||
1
core/vendor/composer/autoload_namespaces.php
vendored
1
core/vendor/composer/autoload_namespaces.php
vendored
@@ -12,6 +12,7 @@ return array(
|
|||||||
'Psr\\Log\\' => array($vendorDir . '/psr/log'),
|
'Psr\\Log\\' => array($vendorDir . '/psr/log'),
|
||||||
'Prophecy\\' => array($vendorDir . '/phpspec/prophecy/src'),
|
'Prophecy\\' => array($vendorDir . '/phpspec/prophecy/src'),
|
||||||
'Propel' => array($vendorDir . '/thelia/propel/src'),
|
'Propel' => array($vendorDir . '/thelia/propel/src'),
|
||||||
|
'PayPal' => array($vendorDir . '/paypal/rest-api-sdk-php/lib'),
|
||||||
'Michelf' => array($vendorDir . '/michelf/php-markdown'),
|
'Michelf' => array($vendorDir . '/michelf/php-markdown'),
|
||||||
'Less' => array($vendorDir . '/oyejorge/less.php/lib'),
|
'Less' => array($vendorDir . '/oyejorge/less.php/lib'),
|
||||||
'Imagine' => array($vendorDir . '/imagine/imagine/lib'),
|
'Imagine' => array($vendorDir . '/imagine/imagine/lib'),
|
||||||
|
|||||||
4
core/vendor/composer/autoload_psr4.php
vendored
4
core/vendor/composer/autoload_psr4.php
vendored
@@ -6,7 +6,7 @@ $vendorDir = dirname(dirname(__FILE__));
|
|||||||
$baseDir = dirname(dirname($vendorDir));
|
$baseDir = dirname(dirname($vendorDir));
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'phpDocumentor\\Reflection\\' => array($vendorDir . '/phpdocumentor/reflection-common/src', $vendorDir . '/phpdocumentor/type-resolver/src', $vendorDir . '/phpdocumentor/reflection-docblock/src'),
|
'phpDocumentor\\Reflection\\' => array($vendorDir . '/phpdocumentor/reflection-common/src', $vendorDir . '/phpdocumentor/reflection-docblock/src', $vendorDir . '/phpdocumentor/type-resolver/src'),
|
||||||
'Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'),
|
'Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'),
|
||||||
'Thelia\\Tests\\' => array($baseDir . '/tests/phpunit/Thelia/Tests'),
|
'Thelia\\Tests\\' => array($baseDir . '/tests/phpunit/Thelia/Tests'),
|
||||||
'Thelia\\Math\\' => array($vendorDir . '/thelia/math-tools/src'),
|
'Thelia\\Math\\' => array($vendorDir . '/thelia/math-tools/src'),
|
||||||
@@ -56,6 +56,8 @@ return array(
|
|||||||
'Spipu\\Html2Pdf\\' => array($vendorDir . '/spipu/html2pdf/src'),
|
'Spipu\\Html2Pdf\\' => array($vendorDir . '/spipu/html2pdf/src'),
|
||||||
'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
|
'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
|
||||||
'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'),
|
'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'),
|
||||||
|
'MySQLHandler\\' => array($vendorDir . '/wazaari/monolog-mysql/src/MySQLHandler'),
|
||||||
|
'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'),
|
||||||
'Faker\\' => array($vendorDir . '/fzaninotto/faker/src/Faker'),
|
'Faker\\' => array($vendorDir . '/fzaninotto/faker/src/Faker'),
|
||||||
'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'),
|
'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'),
|
||||||
'Doctrine\\Common\\Cache\\' => array($vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache'),
|
'Doctrine\\Common\\Cache\\' => array($vendorDir . '/doctrine/cache/lib/Doctrine/Common/Cache'),
|
||||||
|
|||||||
4
core/vendor/composer/autoload_real.php
vendored
4
core/vendor/composer/autoload_real.php
vendored
@@ -22,15 +22,13 @@ class ComposerAutoloaderInitdd35a9014b32931842cc80c9a5635083
|
|||||||
return self::$loader;
|
return self::$loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
require __DIR__ . '/platform_check.php';
|
|
||||||
|
|
||||||
spl_autoload_register(array('ComposerAutoloaderInitdd35a9014b32931842cc80c9a5635083', 'loadClassLoader'), true, true);
|
spl_autoload_register(array('ComposerAutoloaderInitdd35a9014b32931842cc80c9a5635083', 'loadClassLoader'), true, true);
|
||||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||||
spl_autoload_unregister(array('ComposerAutoloaderInitdd35a9014b32931842cc80c9a5635083', 'loadClassLoader'));
|
spl_autoload_unregister(array('ComposerAutoloaderInitdd35a9014b32931842cc80c9a5635083', 'loadClassLoader'));
|
||||||
|
|
||||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||||
if ($useStaticLoader) {
|
if ($useStaticLoader) {
|
||||||
require __DIR__ . '/autoload_static.php';
|
require_once __DIR__ . '/autoload_static.php';
|
||||||
|
|
||||||
call_user_func(\Composer\Autoload\ComposerStaticInitdd35a9014b32931842cc80c9a5635083::getInitializer($loader));
|
call_user_func(\Composer\Autoload\ComposerStaticInitdd35a9014b32931842cc80c9a5635083::getInitializer($loader));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
24
core/vendor/composer/autoload_static.php
vendored
24
core/vendor/composer/autoload_static.php
vendored
@@ -15,13 +15,13 @@ class ComposerStaticInitdd35a9014b32931842cc80c9a5635083
|
|||||||
'3e2471375464aac821502deb0ac64275' => __DIR__ . '/..' . '/symfony/polyfill-php54/bootstrap.php',
|
'3e2471375464aac821502deb0ac64275' => __DIR__ . '/..' . '/symfony/polyfill-php54/bootstrap.php',
|
||||||
'32dcc8afd4335739640db7d200c1971d' => __DIR__ . '/..' . '/symfony/polyfill-apcu/bootstrap.php',
|
'32dcc8afd4335739640db7d200c1971d' => __DIR__ . '/..' . '/symfony/polyfill-apcu/bootstrap.php',
|
||||||
'667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php',
|
'667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php',
|
||||||
|
'2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php',
|
||||||
'5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php',
|
'5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php',
|
||||||
'6a47392539ca2329373e0d33e1dba053' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/bootstrap.php',
|
'6a47392539ca2329373e0d33e1dba053' => __DIR__ . '/..' . '/symfony/polyfill-intl-icu/bootstrap.php',
|
||||||
'023d27dca8066ef29e6739335ea73bad' => __DIR__ . '/..' . '/symfony/polyfill-php70/bootstrap.php',
|
'023d27dca8066ef29e6739335ea73bad' => __DIR__ . '/..' . '/symfony/polyfill-php70/bootstrap.php',
|
||||||
'bd9634f2d41831496de0d3dfe4c94881' => __DIR__ . '/..' . '/symfony/polyfill-php56/bootstrap.php',
|
'bd9634f2d41831496de0d3dfe4c94881' => __DIR__ . '/..' . '/symfony/polyfill-php56/bootstrap.php',
|
||||||
'ce89ac35a6c330c55f4710717db9ff78' => __DIR__ . '/..' . '/kriswallsmith/assetic/src/functions.php',
|
'ce89ac35a6c330c55f4710717db9ff78' => __DIR__ . '/..' . '/kriswallsmith/assetic/src/functions.php',
|
||||||
'f084d01b0a599f67676cffef638aa95b' => __DIR__ . '/..' . '/smarty/smarty/libs/bootstrap.php',
|
'f084d01b0a599f67676cffef638aa95b' => __DIR__ . '/..' . '/smarty/smarty/libs/bootstrap.php',
|
||||||
'2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php',
|
|
||||||
'e277be14c90068cf94faed2c43dbe6d8' => __DIR__ . '/..' . '/symfony/polyfill-php71/bootstrap.php',
|
'e277be14c90068cf94faed2c43dbe6d8' => __DIR__ . '/..' . '/symfony/polyfill-php71/bootstrap.php',
|
||||||
'25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php',
|
'25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php',
|
||||||
'0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
|
'0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
|
||||||
@@ -94,6 +94,11 @@ class ComposerStaticInitdd35a9014b32931842cc80c9a5635083
|
|||||||
'Psr\\SimpleCache\\' => 16,
|
'Psr\\SimpleCache\\' => 16,
|
||||||
'Psr\\Cache\\' => 10,
|
'Psr\\Cache\\' => 10,
|
||||||
),
|
),
|
||||||
|
'M' =>
|
||||||
|
array (
|
||||||
|
'MySQLHandler\\' => 13,
|
||||||
|
'Monolog\\' => 8,
|
||||||
|
),
|
||||||
'F' =>
|
'F' =>
|
||||||
array (
|
array (
|
||||||
'Faker\\' => 6,
|
'Faker\\' => 6,
|
||||||
@@ -115,8 +120,8 @@ class ComposerStaticInitdd35a9014b32931842cc80c9a5635083
|
|||||||
'phpDocumentor\\Reflection\\' =>
|
'phpDocumentor\\Reflection\\' =>
|
||||||
array (
|
array (
|
||||||
0 => __DIR__ . '/..' . '/phpdocumentor/reflection-common/src',
|
0 => __DIR__ . '/..' . '/phpdocumentor/reflection-common/src',
|
||||||
1 => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src',
|
1 => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src',
|
||||||
2 => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src',
|
2 => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src',
|
||||||
),
|
),
|
||||||
'Webmozart\\Assert\\' =>
|
'Webmozart\\Assert\\' =>
|
||||||
array (
|
array (
|
||||||
@@ -314,6 +319,14 @@ class ComposerStaticInitdd35a9014b32931842cc80c9a5635083
|
|||||||
array (
|
array (
|
||||||
0 => __DIR__ . '/..' . '/psr/cache/src',
|
0 => __DIR__ . '/..' . '/psr/cache/src',
|
||||||
),
|
),
|
||||||
|
'MySQLHandler\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/wazaari/monolog-mysql/src/MySQLHandler',
|
||||||
|
),
|
||||||
|
'Monolog\\' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/monolog/monolog/src/Monolog',
|
||||||
|
),
|
||||||
'Faker\\' =>
|
'Faker\\' =>
|
||||||
array (
|
array (
|
||||||
0 => __DIR__ . '/..' . '/fzaninotto/faker/src/Faker',
|
0 => __DIR__ . '/..' . '/fzaninotto/faker/src/Faker',
|
||||||
@@ -373,6 +386,10 @@ class ComposerStaticInitdd35a9014b32931842cc80c9a5635083
|
|||||||
array (
|
array (
|
||||||
0 => __DIR__ . '/..' . '/thelia/propel/src',
|
0 => __DIR__ . '/..' . '/thelia/propel/src',
|
||||||
),
|
),
|
||||||
|
'PayPal' =>
|
||||||
|
array (
|
||||||
|
0 => __DIR__ . '/..' . '/paypal/rest-api-sdk-php/lib',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'M' =>
|
'M' =>
|
||||||
array (
|
array (
|
||||||
@@ -427,7 +444,6 @@ class ComposerStaticInitdd35a9014b32931842cc80c9a5635083
|
|||||||
'AssertionError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php',
|
'AssertionError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php',
|
||||||
'CallbackFilterIterator' => __DIR__ . '/..' . '/symfony/polyfill-php54/Resources/stubs/CallbackFilterIterator.php',
|
'CallbackFilterIterator' => __DIR__ . '/..' . '/symfony/polyfill-php54/Resources/stubs/CallbackFilterIterator.php',
|
||||||
'Collator' => __DIR__ . '/..' . '/symfony/intl/Resources/stubs/Collator.php',
|
'Collator' => __DIR__ . '/..' . '/symfony/intl/Resources/stubs/Collator.php',
|
||||||
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
|
||||||
'Datamatrix' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/barcodes/datamatrix.php',
|
'Datamatrix' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/barcodes/datamatrix.php',
|
||||||
'DivisionByZeroError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php',
|
'DivisionByZeroError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php',
|
||||||
'Error' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/Error.php',
|
'Error' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/Error.php',
|
||||||
|
|||||||
520
core/vendor/composer/installed.json
vendored
520
core/vendor/composer/installed.json
vendored
File diff suppressed because it is too large
Load Diff
7
local/I18n/fr_FR.php
Normal file
7
local/I18n/fr_FR.php
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'hookproductsnew.fo.default' => [
|
||||||
|
'Latest' => 'Derniers produits',
|
||||||
|
],
|
||||||
|
];
|
||||||
BIN
local/media/images/module/WireTransfer-1-logo.png
Normal file
BIN
local/media/images/module/WireTransfer-1-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.0 KiB |
@@ -18,8 +18,13 @@
|
|||||||
<a href="tel:{config key="store_phone"}" class="tel" itemprop="telephone">{config key="store_phone"}</a>
|
<a href="tel:{config key="store_phone"}" class="tel" itemprop="telephone">{config key="store_phone"}</a>
|
||||||
</li>
|
</li>
|
||||||
{/if}
|
{/if}
|
||||||
|
<!--
|
||||||
<li class="contact-contact">
|
<li class="contact-contact">
|
||||||
<a href="{url path='/contact'}">{intl l="Find us, Contact us" d="hookcontact.fo.default"}</a>
|
<a href="{url path='/contact'}">{intl l="Find us, Contact us" d="hookcontact.fo.default"}</a>
|
||||||
</li>
|
</li>
|
||||||
|
//-->
|
||||||
|
<li class="contact-email">
|
||||||
|
<a href="mailto:aomc@outil82.fr">aomc@outil82.fr</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return array(
|
||||||
'+ View All' => '+ Tout voir',
|
'+ View All' => '+ Tout voir',
|
||||||
'Latest' => 'Nouveautés',
|
'Latest' => 'Nouveautés',
|
||||||
];
|
);
|
||||||
|
|||||||
31
local/modules/LocalPickup/Config/config.xml
Normal file
31
local/modules/LocalPickup/Config/config.xml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?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">
|
||||||
|
<forms>
|
||||||
|
<form name="localpickup.form" class="LocalPickup\Form\SetDeliveryPrice" />
|
||||||
|
</forms>
|
||||||
|
|
||||||
|
<loops>
|
||||||
|
<loop class="LocalPickup\Loop\LocalAddress" name="address.local" />
|
||||||
|
</loops>
|
||||||
|
|
||||||
|
<hooks>
|
||||||
|
<hook id="local.pickup.hook" class="LocalPickup\Hook\HookManager" scope="request">
|
||||||
|
<tag name="hook.event_listener" event="module.configuration" type="back" method="onModuleConfiguration" />
|
||||||
|
<tag name="hook.event_listener" event="order-invoice.delivery-address" type="front" method="onOrderInvoiceDeliveryAddress" />
|
||||||
|
</hook>
|
||||||
|
|
||||||
|
</hooks>
|
||||||
|
|
||||||
|
<services>
|
||||||
|
<service id="send.localpickup.mail" class="LocalPickup\Listener\SendEMail" scope="request">
|
||||||
|
<argument type="service" id="mailer"/>
|
||||||
|
<tag name="kernel.event_subscriber"/>
|
||||||
|
</service>
|
||||||
|
<service id="update.localpickup.delivery.address" class="LocalPickup\Listener\UpdateDeliveryAddress">
|
||||||
|
<tag name="kernel.event_subscriber" />
|
||||||
|
</service>
|
||||||
|
</services>
|
||||||
|
</config>
|
||||||
18
local/modules/LocalPickup/Config/module.xml
Normal file
18
local/modules/LocalPickup/Config/module.xml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module>
|
||||||
|
<fullnamespace>LocalPickup\LocalPickup</fullnamespace>
|
||||||
|
<descriptive locale="en_US">
|
||||||
|
<title>Local Pickup</title>
|
||||||
|
</descriptive>
|
||||||
|
<descriptive locale="fr_FR">
|
||||||
|
<title>Retrait sur place</title>
|
||||||
|
</descriptive>
|
||||||
|
<version>1.2</version>
|
||||||
|
<author>
|
||||||
|
<name>Thelia</name>
|
||||||
|
<email>info@thelia.net</email>
|
||||||
|
</author>
|
||||||
|
<type>delivery</type>
|
||||||
|
<thelia>2.3.0</thelia>
|
||||||
|
<stability>alpha</stability>
|
||||||
|
</module>
|
||||||
9
local/modules/LocalPickup/Config/routing.xml
Normal file
9
local/modules/LocalPickup/Config/routing.xml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<routes xmlns="http://symfony.com/schema/routing"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||||
|
|
||||||
|
<route id="localpickup.configure" path="/admin/module/localpickup/configure" methods="post">
|
||||||
|
<default key="_controller">LocalPickup\Controller\SetDeliveryPrice::configure</default>
|
||||||
|
</route>
|
||||||
|
</routes>
|
||||||
60
local/modules/LocalPickup/Controller/SetDeliveryPrice.php
Normal file
60
local/modules/LocalPickup/Controller/SetDeliveryPrice.php
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
/*************************************************************************************/
|
||||||
|
/* This file is part of the Thelia package. */
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) OpenStudio */
|
||||||
|
/* email : dev@thelia.net */
|
||||||
|
/* web : http://www.thelia.net */
|
||||||
|
/* */
|
||||||
|
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||||
|
/* file that was distributed with this source code. */
|
||||||
|
/*************************************************************************************/
|
||||||
|
|
||||||
|
namespace LocalPickup\Controller;
|
||||||
|
|
||||||
|
use LocalPickup\LocalPickup;
|
||||||
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||||
|
use Thelia\Controller\Admin\BaseAdminController;
|
||||||
|
use Thelia\Core\Security\AccessManager;
|
||||||
|
use Thelia\Core\Security\Resource\AdminResources;
|
||||||
|
use Thelia\Tools\URL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SetDeliveryPrice
|
||||||
|
* @package LocalPickup\Controller
|
||||||
|
* @author Thelia <info@thelia.net>
|
||||||
|
* @contributor Thomas Arnaud <tarnaud@openstudio.fr>
|
||||||
|
*/
|
||||||
|
class SetDeliveryPrice extends BaseAdminController
|
||||||
|
{
|
||||||
|
public function configure()
|
||||||
|
{
|
||||||
|
if (null !== $response = $this->checkAuth(array(AdminResources::MODULE), array('LocalPickup'), AccessManager::UPDATE)) {
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
$form = $this->createForm('localpickup.form');
|
||||||
|
$errmes=null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$vform = $this->validateForm($form);
|
||||||
|
|
||||||
|
$price = $vform->get('price')->getData();
|
||||||
|
|
||||||
|
LocalPickup::setConfigValue(LocalPickup::PRICE_VAR_NAME, floatval($price));
|
||||||
|
} catch (\Exception $ex) {
|
||||||
|
$errmes = $this->createStandardFormValidationErrorMessage($ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null !== $errmes) {
|
||||||
|
$this->setupFormErrorContext(
|
||||||
|
'configuration',
|
||||||
|
$errmes,
|
||||||
|
$form,
|
||||||
|
$ex
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return RedirectResponse::create(URL::getInstance()->absoluteUrl('/admin/module/LocalPickup'));
|
||||||
|
}
|
||||||
|
}
|
||||||
53
local/modules/LocalPickup/Form/SetDeliveryPrice.php
Normal file
53
local/modules/LocalPickup/Form/SetDeliveryPrice.php
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
/*************************************************************************************/
|
||||||
|
/* This file is part of the Thelia package. */
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) OpenStudio */
|
||||||
|
/* email : dev@thelia.net */
|
||||||
|
/* web : http://www.thelia.net */
|
||||||
|
/* */
|
||||||
|
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||||
|
/* file that was distributed with this source code. */
|
||||||
|
/*************************************************************************************/
|
||||||
|
|
||||||
|
namespace LocalPickup\Form;
|
||||||
|
|
||||||
|
use LocalPickup\LocalPickup;
|
||||||
|
use LocalPickup\Model\LocalPickupShippingQuery;
|
||||||
|
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
|
||||||
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
|
use Thelia\Core\Translation\Translator;
|
||||||
|
use Thelia\Form\BaseForm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SetDeliveryPrice
|
||||||
|
* @package LocalPickup\Form
|
||||||
|
*/
|
||||||
|
class SetDeliveryPrice extends BaseForm
|
||||||
|
{
|
||||||
|
protected function buildForm()
|
||||||
|
{
|
||||||
|
$this->formBuilder
|
||||||
|
->add(
|
||||||
|
"price",
|
||||||
|
"number",
|
||||||
|
[
|
||||||
|
"label"=>Translator::getInstance()->trans("Price", [], LocalPickup::DOMAIN_NAME),
|
||||||
|
"label_attr"=> [
|
||||||
|
"for"=>"pricefield"
|
||||||
|
],
|
||||||
|
"constraints"=> [ new NotBlank(), new GreaterThanOrEqual([ 'value' => 0 ]) ]
|
||||||
|
]
|
||||||
|
)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string the name of you form. This name must be unique
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return "set-delivery-price-localpickup";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
49
local/modules/LocalPickup/Hook/HookManager.php
Normal file
49
local/modules/LocalPickup/Hook/HookManager.php
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
/*************************************************************************************/
|
||||||
|
/* This file is part of the Thelia package. */
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) OpenStudio */
|
||||||
|
/* email : dev@thelia.net */
|
||||||
|
/* web : http://www.thelia.net */
|
||||||
|
/* */
|
||||||
|
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||||
|
/* file that was distributed with this source code. */
|
||||||
|
/*************************************************************************************/
|
||||||
|
|
||||||
|
namespace LocalPickup\Hook;
|
||||||
|
|
||||||
|
use LocalPickup\LocalPickup;
|
||||||
|
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||||
|
use Thelia\Core\Hook\BaseHook;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class HookManager
|
||||||
|
* @package LocalPickup\Hook
|
||||||
|
* @author Thomas Arnaud <tarnaud@openstudio.fr>
|
||||||
|
*/
|
||||||
|
class HookManager extends BaseHook
|
||||||
|
{
|
||||||
|
public function onModuleConfiguration(HookRenderEvent $event)
|
||||||
|
{
|
||||||
|
$event->add(
|
||||||
|
$this->render(
|
||||||
|
"module_configuration.html",
|
||||||
|
[
|
||||||
|
'price' => floatval(LocalPickup::getConfigValue(LocalPickup::PRICE_VAR_NAME, 0))
|
||||||
|
]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function onOrderInvoiceDeliveryAddress(HookRenderEvent $event)
|
||||||
|
{
|
||||||
|
// Show the local delivery template if we're the current delivery module.
|
||||||
|
if ((null !== $order = $this->getSession()->getOrder()) && $order->getDeliveryModuleId() == LocalPickup::getModuleId()) {
|
||||||
|
$event->add(
|
||||||
|
$this->render("localpickup/order-invoice-delivery-address.html", [
|
||||||
|
'order_id' => $event->getArgument('order_id'),
|
||||||
|
])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'Close' => 'Close',
|
||||||
|
'Configure local pickup price' => 'Configure local pickup price ',
|
||||||
|
'Save changes' => 'Save changes ',
|
||||||
|
);
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'Close' => 'Fermer',
|
||||||
|
'Configure local pickup price' => 'Configurer le prix du retrait sur place',
|
||||||
|
'Save changes' => 'Enregistrer les modifications',
|
||||||
|
);
|
||||||
6
local/modules/LocalPickup/I18n/en_US.php
Normal file
6
local/modules/LocalPickup/I18n/en_US.php
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'Price' => 'Price',
|
||||||
|
'price must be a number !' => 'price must be a number !',
|
||||||
|
);
|
||||||
6
local/modules/LocalPickup/I18n/fr_FR.php
Normal file
6
local/modules/LocalPickup/I18n/fr_FR.php
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'Price' => 'Prix',
|
||||||
|
'price must be a number !' => 'Le prix doit être un nombre !',
|
||||||
|
);
|
||||||
674
local/modules/LocalPickup/LICENSE.txt
Normal file
674
local/modules/LocalPickup/LICENSE.txt
Normal file
@@ -0,0 +1,674 @@
|
|||||||
|
GNU 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.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU 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
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||||
92
local/modules/LocalPickup/Listener/SendEMail.php
Normal file
92
local/modules/LocalPickup/Listener/SendEMail.php
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
<?php
|
||||||
|
/*************************************************************************************/
|
||||||
|
/* This file is part of the Thelia package. */
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) OpenStudio */
|
||||||
|
/* email : dev@thelia.net */
|
||||||
|
/* web : http://www.thelia.net */
|
||||||
|
/* */
|
||||||
|
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||||
|
/* file that was distributed with this source code. */
|
||||||
|
/*************************************************************************************/
|
||||||
|
|
||||||
|
namespace LocalPickup\Listener;
|
||||||
|
|
||||||
|
use LocalPickup\LocalPickup;
|
||||||
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
use Thelia\Action\BaseAction;
|
||||||
|
use Thelia\Core\Event\Order\OrderEvent;
|
||||||
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
|
use Thelia\Mailer\MailerFactory;
|
||||||
|
use Thelia\Core\Template\ParserInterface;
|
||||||
|
use Thelia\Model\ConfigQuery;
|
||||||
|
use Thelia\Model\CountryI18nQuery;
|
||||||
|
use Thelia\Model\CountryQuery;
|
||||||
|
use Thelia\Model\MessageQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SendEMail
|
||||||
|
* @package IciRelais\Listener
|
||||||
|
* @author Thelia <info@thelia.net>
|
||||||
|
*/
|
||||||
|
class SendEMail extends BaseAction implements EventSubscriberInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var MailerFactory
|
||||||
|
*/
|
||||||
|
protected $mailer;
|
||||||
|
|
||||||
|
public function __construct(MailerFactory $mailer)
|
||||||
|
{
|
||||||
|
$this->mailer = $mailer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Send a mail to the customer qhen the order is set to the Sent Status.
|
||||||
|
*
|
||||||
|
* @param OrderEvent $event
|
||||||
|
* @throws \Propel\Runtime\Exception\PropelException
|
||||||
|
*/
|
||||||
|
public function updateStatus(OrderEvent $event)
|
||||||
|
{
|
||||||
|
if ($event->getOrder()->getDeliveryModuleId() === LocalPickup::getModuleId()) {
|
||||||
|
if ($event->getOrder()->isSent()) {
|
||||||
|
$order = $event->getOrder();
|
||||||
|
$customer = $order->getCustomer();
|
||||||
|
$store = ConfigQuery::create();
|
||||||
|
|
||||||
|
if (null !== $country = CountryQuery::create()->findPk($store->read("store_country"))) {
|
||||||
|
$countryName = $country->setLocale($order->getLang()->getLocale())->getTitle();
|
||||||
|
} else {
|
||||||
|
$countryName = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->mailer->sendEmailToCustomer(
|
||||||
|
'order_confirmation_localpickup',
|
||||||
|
$customer,
|
||||||
|
[
|
||||||
|
'order_id' => $order->getId(),
|
||||||
|
'order_ref' => $order->getRef(),
|
||||||
|
'store_name' => ConfigQuery::read("store_name"),
|
||||||
|
'store_address1' => ConfigQuery::read("store_address1"),
|
||||||
|
'store_address2' => ConfigQuery::read("store_address2"),
|
||||||
|
'store_address3' => ConfigQuery::read("store_address3"),
|
||||||
|
'store_zipcode' => ConfigQuery::read("store_zipcode"),
|
||||||
|
'store_city' => ConfigQuery::read("store_city"),
|
||||||
|
'store_country' => $countryName
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public static function getSubscribedEvents()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
TheliaEvents::ORDER_UPDATE_STATUS => array("updateStatus", 128)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
107
local/modules/LocalPickup/Listener/UpdateDeliveryAddress.php
Normal file
107
local/modules/LocalPickup/Listener/UpdateDeliveryAddress.php
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
<?php
|
||||||
|
/*************************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* Thelia */
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) OpenStudio */
|
||||||
|
/* email : info@thelia.net */
|
||||||
|
/* web : http://www.thelia.net */
|
||||||
|
/* */
|
||||||
|
/* This program is free software; you can redistribute it and/or modify */
|
||||||
|
/* it under the terms of the GNU General Public License as published by */
|
||||||
|
/* the Free Software Foundation; either version 3 of the License */
|
||||||
|
/* */
|
||||||
|
/* This program is distributed in the hope that it will be useful, */
|
||||||
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||||
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||||
|
/* GNU General Public License for more details. */
|
||||||
|
/* */
|
||||||
|
/* You should have received a copy of the GNU General Public License */
|
||||||
|
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
/* */
|
||||||
|
/*************************************************************************************/
|
||||||
|
|
||||||
|
namespace LocalPickup\Listener;
|
||||||
|
|
||||||
|
use LocalPickup\LocalPickup;
|
||||||
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
use Thelia\Action\BaseAction;
|
||||||
|
use Thelia\Core\Event\Order\OrderAddressEvent;
|
||||||
|
use Thelia\Core\Event\Order\OrderEvent;
|
||||||
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
|
use Thelia\Model\ConfigQuery;
|
||||||
|
use Thelia\Model\OrderAddressQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class UpdateDeliveryAddress
|
||||||
|
* @package LocalPickup\Listener
|
||||||
|
* @contributor Thomas Arnaud <tarnaud@openstudio.fr>
|
||||||
|
*/
|
||||||
|
class UpdateDeliveryAddress extends BaseAction implements EventSubscriberInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param OrderEvent $event
|
||||||
|
* @param $eventName
|
||||||
|
* @param EventDispatcherInterface $dispatcher
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
public function updateAddress(OrderEvent $event, $eventName, EventDispatcherInterface $dispatcher)
|
||||||
|
{
|
||||||
|
if ($event->getOrder()->getDeliveryModuleId() === LocalPickup::getModuleId()) {
|
||||||
|
$address_id = $event->getOrder()->getDeliveryOrderAddressId();
|
||||||
|
$address = OrderAddressQuery::create()->findPk($address_id);
|
||||||
|
|
||||||
|
if ($address !== null) {
|
||||||
|
$address1 = ConfigQuery::read("store_address1");
|
||||||
|
$address2 = ConfigQuery::read("store_address2");
|
||||||
|
$address3 = ConfigQuery::read("store_address3");
|
||||||
|
$zipcode = ConfigQuery::read("store_zipcode");
|
||||||
|
$city = ConfigQuery::read("store_city");
|
||||||
|
$country = ConfigQuery::read("store_country");
|
||||||
|
$name = ConfigQuery::read("store_name");
|
||||||
|
|
||||||
|
if ($address1 !== null && $zipcode !== null && $city !== null && $country !== null) {
|
||||||
|
$address_event = new OrderAddressEvent(
|
||||||
|
$address->getCustomerTitleId(),
|
||||||
|
$address->getFirstname(),
|
||||||
|
$address->getLastname(),
|
||||||
|
$address1,
|
||||||
|
$address2,
|
||||||
|
$address3,
|
||||||
|
$zipcode,
|
||||||
|
$city,
|
||||||
|
$country,
|
||||||
|
$address->getPhone(),
|
||||||
|
$name,
|
||||||
|
$address->getCellphone()
|
||||||
|
);
|
||||||
|
|
||||||
|
$address_event->setOrderAddress($address);
|
||||||
|
|
||||||
|
$dispatcher->dispatch(TheliaEvents::ORDER_UPDATE_ADDRESS, $address_event);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new \Exception("Error: order deliery address doesn't exists");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setAddress(OrderEvent $event)
|
||||||
|
{
|
||||||
|
if ($event->getOrder()->getDeliveryModuleId() === LocalPickup::getModuleId()) {
|
||||||
|
$event->setDeliveryAddress(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public static function getSubscribedEvents()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
TheliaEvents::ORDER_BEFORE_PAYMENT=> ["updateAddress", 130],
|
||||||
|
TheliaEvents::ORDER_SET_DELIVERY_MODULE=> ["setAddress", 128]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
76
local/modules/LocalPickup/LocalPickup.php
Normal file
76
local/modules/LocalPickup/LocalPickup.php
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
<?php
|
||||||
|
/*************************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* Thelia */
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) OpenStudio */
|
||||||
|
/* email : info@thelia.net */
|
||||||
|
/* web : http://www.thelia.net */
|
||||||
|
/* */
|
||||||
|
/* This program is free software; you can redistribute it and/or modify */
|
||||||
|
/* it under the terms of the GNU General Public License as published by */
|
||||||
|
/* the Free Software Foundation; either version 3 of the License */
|
||||||
|
/* */
|
||||||
|
/* This program is distributed in the hope that it will be useful, */
|
||||||
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||||
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||||
|
/* GNU General Public License for more details. */
|
||||||
|
/* */
|
||||||
|
/* You should have received a copy of the GNU General Public License */
|
||||||
|
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
/* */
|
||||||
|
/*************************************************************************************/
|
||||||
|
|
||||||
|
namespace LocalPickup;
|
||||||
|
|
||||||
|
use Propel\Runtime\Connection\ConnectionInterface;
|
||||||
|
use Thelia\Install\Database;
|
||||||
|
use Thelia\Model\Country;
|
||||||
|
use Thelia\Module\AbstractDeliveryModule;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class LocalPickup
|
||||||
|
* @package LocalPickup
|
||||||
|
* @author Thelia <info@thelia.net>
|
||||||
|
*/
|
||||||
|
class LocalPickup extends AbstractDeliveryModule
|
||||||
|
{
|
||||||
|
const DOMAIN_NAME = 'localpickup';
|
||||||
|
|
||||||
|
const PRICE_VAR_NAME = 'price';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function getPostage(Country $country)
|
||||||
|
{
|
||||||
|
return floatval(LocalPickup::getConfigValue(self::PRICE_VAR_NAME, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update($currentVersion, $newVersion, ConnectionInterface $con = null)
|
||||||
|
{
|
||||||
|
if ($newVersion === '1.2') {
|
||||||
|
$db = new Database($con);
|
||||||
|
|
||||||
|
// Migrate previous price from database to module config
|
||||||
|
try {
|
||||||
|
$statement = $db->execute("select price from local_pickup_shipping order by id desc limit 1");
|
||||||
|
|
||||||
|
$price = floatval($statement->fetchColumn(0));
|
||||||
|
|
||||||
|
LocalPickup::setConfigValue(self::PRICE_VAR_NAME, $price);
|
||||||
|
} catch (\Exception $ex) {
|
||||||
|
//LocalPickup::setConfigValue(self::PRICE_VAR_NAME, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function isValidDelivery(Country $country)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
126
local/modules/LocalPickup/Loop/LocalAddress.php
Normal file
126
local/modules/LocalPickup/Loop/LocalAddress.php
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
<?php
|
||||||
|
/*************************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* Thelia */
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) OpenStudio */
|
||||||
|
/* email : info@thelia.net */
|
||||||
|
/* web : http://www.thelia.net */
|
||||||
|
/* */
|
||||||
|
/* This program is free software; you can redistribute it and/or modify */
|
||||||
|
/* it under the terms of the GNU General Public License as published by */
|
||||||
|
/* the Free Software Foundation; either version 3 of the License */
|
||||||
|
/* */
|
||||||
|
/* This program is distributed in the hope that it will be useful, */
|
||||||
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||||
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||||
|
/* GNU General Public License for more details. */
|
||||||
|
/* */
|
||||||
|
/* You should have received a copy of the GNU General Public License */
|
||||||
|
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
/* */
|
||||||
|
/*************************************************************************************/
|
||||||
|
|
||||||
|
namespace LocalPickup\Loop;
|
||||||
|
|
||||||
|
use Symfony\Component\Config\Definition\Exception\Exception;
|
||||||
|
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\AddressQuery;
|
||||||
|
use Thelia\Model\ConfigQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class LocalAddress
|
||||||
|
* @package LocalPickup\Loop
|
||||||
|
* @author Thelia <info@thelia.net>
|
||||||
|
* @method int getId()
|
||||||
|
*/
|
||||||
|
class LocalAddress extends BaseLoop implements ArraySearchLoopInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function buildArray()
|
||||||
|
{
|
||||||
|
$id = $this->getId();
|
||||||
|
|
||||||
|
/** @var \Thelia\Core\HttpFoundation\Session\Session $session */
|
||||||
|
$session = $this->requestStack->getCurrentRequest()->getSession();
|
||||||
|
|
||||||
|
$address = AddressQuery::create()
|
||||||
|
->filterByCustomerId($session->getCustomerUser()->getId())
|
||||||
|
->findPk($id);
|
||||||
|
|
||||||
|
if ($address === null) {
|
||||||
|
throw new Exception("The requested address doesn't exist");
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var \Thelia\Model\Customer $customer */
|
||||||
|
$customer = $session->getCustomerUser();
|
||||||
|
|
||||||
|
return [
|
||||||
|
'Id' => 0,
|
||||||
|
'Label' => $address->getLabel(),
|
||||||
|
'CustomerId' => $address->getCustomerId(),
|
||||||
|
'TitleId' => $address->getTitleId(),
|
||||||
|
'Company' => ConfigQuery::read('store_name'),
|
||||||
|
'Firstname' => $customer->getFirstname(),
|
||||||
|
'Lastname' => $customer->getLastname(),
|
||||||
|
'Address1' => ConfigQuery::read('store_address1'),
|
||||||
|
'Address2' => ConfigQuery::read('store_address2'),
|
||||||
|
'Address3' => ConfigQuery::read('store_address3'),
|
||||||
|
'Zipcode' => ConfigQuery::read('store_zipcode'),
|
||||||
|
'City' => ConfigQuery::read('store_city'),
|
||||||
|
'CountryId' => ConfigQuery::read('store_country'),
|
||||||
|
'Phone' => $address->getPhone(),
|
||||||
|
'Cellphone' => $address->getCellphone(),
|
||||||
|
'IsDefault' => 0
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function parseResults(LoopResult $loopResult)
|
||||||
|
{
|
||||||
|
$address = $loopResult->getResultDataCollection();
|
||||||
|
$loopResultRow = new LoopResultRow($address);
|
||||||
|
|
||||||
|
$loopResultRow
|
||||||
|
->set("ID", $address['Id'])
|
||||||
|
->set("LABEL", $address['Label'])
|
||||||
|
->set("CUSTOMER", $address['CustomerId'])
|
||||||
|
->set("TITLE", $address['TitleId'])
|
||||||
|
->set("COMPANY", $address['Company'])
|
||||||
|
->set("FIRSTNAME", $address['Firstname'])
|
||||||
|
->set("LASTNAME", $address['Lastname'])
|
||||||
|
->set("ADDRESS1", $address['Address1'])
|
||||||
|
->set("ADDRESS2", $address['Address2'])
|
||||||
|
->set("ADDRESS3", $address['Address3'])
|
||||||
|
->set("ZIPCODE", $address['Zipcode'])
|
||||||
|
->set("CITY", $address['City'])
|
||||||
|
->set("COUNTRY", $address['CountryId'])
|
||||||
|
->set("PHONE", $address['Phone'])
|
||||||
|
->set("CELLPHONE", $address['Cellphone'])
|
||||||
|
->set("DEFAULT", $address['IsDefault'])
|
||||||
|
;
|
||||||
|
|
||||||
|
$loopResult->addRow($loopResultRow);
|
||||||
|
|
||||||
|
return $loopResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
protected function getArgDefinitions()
|
||||||
|
{
|
||||||
|
return new ArgumentCollection(
|
||||||
|
Argument::createIntTypeArgument('id', null, true)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
101
local/modules/LocalPickup/README.md
Normal file
101
local/modules/LocalPickup/README.md
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
LocalPickup module
|
||||||
|
==================
|
||||||
|
author: Thelia <info@thelia.net>
|
||||||
|
|
||||||
|
Summary
|
||||||
|
-------
|
||||||
|
|
||||||
|
fr_FR:
|
||||||
|
1. Installation
|
||||||
|
2. Utilisation
|
||||||
|
3. Boucles
|
||||||
|
4. Intégration
|
||||||
|
|
||||||
|
en_US:
|
||||||
|
1. Install notes
|
||||||
|
2. How to use
|
||||||
|
3. Loops
|
||||||
|
4. Integration
|
||||||
|
|
||||||
|
fr_FR
|
||||||
|
-----
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
|
#### Manually
|
||||||
|
|
||||||
|
* Copiez le module dans le dossier ```<thelia_root>/local/modules/``` et assurez-vous que le nom du module est bien LocalPickup.
|
||||||
|
* Activez le depuis votre interface d'administration Thelia.
|
||||||
|
|
||||||
|
#### Composer
|
||||||
|
|
||||||
|
Ajoutez le module à votre fichier composer.json principal :
|
||||||
|
|
||||||
|
```
|
||||||
|
composer require thelia/local-pickup-module:~1.0
|
||||||
|
```
|
||||||
|
|
||||||
|
### Utilisation
|
||||||
|
|
||||||
|
Pour utiliser le module de retrait sur place, allez dans le back-office, onglet Modules, et activez le,
|
||||||
|
puis cliquez sur "Configurer" sur la ligne du module. Renseignez le prix que vous souhaitez donner au retrait sur place
|
||||||
|
et enregistrez.
|
||||||
|
|
||||||
|
### Boucles
|
||||||
|
|
||||||
|
1. `address.local`
|
||||||
|
Même sorties que la boucle `address`, mais avec l'adresse du magasin au lieu de celle du client.
|
||||||
|
- Arguments:
|
||||||
|
1. id | obligatoire | id de l'adresse du client
|
||||||
|
- Sorties:
|
||||||
|
Les mêmes variables que la boucle address, mais l'adresse donnée est celle du magasin.
|
||||||
|
- Utilisation:
|
||||||
|
```
|
||||||
|
{loop type="address.local" name="yourloopname" id="1"}
|
||||||
|
<!-- your template -->
|
||||||
|
{/loop}```
|
||||||
|
|
||||||
|
### Intégration
|
||||||
|
|
||||||
|
L'integration utilise les hooks et ne nécessite pas de travaux particuliers.
|
||||||
|
|
||||||
|
en_US
|
||||||
|
-----
|
||||||
|
|
||||||
|
### Installation notes
|
||||||
|
|
||||||
|
#### Manually
|
||||||
|
|
||||||
|
* Copy the module into ```<thelia_root>/local/modules/``` directory and be sure that the name of the module is LocalPickup.
|
||||||
|
* Activate it in your thelia administration panel
|
||||||
|
|
||||||
|
#### Composer
|
||||||
|
|
||||||
|
Add it in your main thelia composer.json file:
|
||||||
|
|
||||||
|
```
|
||||||
|
composer require thelia/local-pickup-module:~1.0
|
||||||
|
```
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
To use the module, you first need to activate it in the back-office, tab Modules, and click on "Configure" on the line
|
||||||
|
of the module. Enter the price you want for local pickup and save.
|
||||||
|
|
||||||
|
### Loops
|
||||||
|
1. `address.local`
|
||||||
|
Same output as the `address` loop, with the store adresse instead of the customer address.
|
||||||
|
- Arguments:
|
||||||
|
1. id | mandatory | id of the customer's address
|
||||||
|
- Output:
|
||||||
|
The same variables as address loop, but the given address is the store's address.
|
||||||
|
- Usage:
|
||||||
|
```
|
||||||
|
{loop type="address.local" name="yourloopname" id="1"}
|
||||||
|
<!-- your template -->
|
||||||
|
{/loop}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Integration
|
||||||
|
|
||||||
|
The modules uses hooks, and does not require specific work.
|
||||||
11
local/modules/LocalPickup/composer.json
Normal file
11
local/modules/LocalPickup/composer.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "thelia/local-pickup-module",
|
||||||
|
"license": "LGPL-3.0+",
|
||||||
|
"type": "thelia-module",
|
||||||
|
"require": {
|
||||||
|
"thelia/installer": "~1.1"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"installer-name": "LocalPickup"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<div class="general-block-decorator">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 title title-without-tabs">
|
||||||
|
{intl l='Configure local pickup price' d='localpickup.bo.default'}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-container">
|
||||||
|
<form method="POST" action="{url path="/admin/module/localpickup/configure"}">
|
||||||
|
{form name="localpickup.form"}
|
||||||
|
{if isset($smarty.get.errmes) and !empty($smarty.get.errmes)}
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
{$smarty.get.errmes}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{form_hidden_fields form=$form}
|
||||||
|
|
||||||
|
{custom_render_form_field field="price"}
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="text" {form_field_attributes field="price" value=$price}>
|
||||||
|
<span class="input-group-addon">
|
||||||
|
{currency attr="symbol"}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{/custom_render_form_field}
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<a href="{url path="/admin/modules"}" class="btn btn-default" title="{intl l="Close" d='localpickup.bo.default'}">{intl l="Close" d='localpickup.bo.default'} <span class="glyphicon glyphicon-remove"></span></a>
|
||||||
|
<button type="submit" class="btn btn-success" title="{intl l='Save changes' d='localpickup.bo.default'}">{intl l='Save changes' d='localpickup.bo.default'} <span class="glyphicon glyphicon-ok"></span></button>
|
||||||
|
</div>
|
||||||
|
{/form}
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<div class="panel panel-default col-sm-6">
|
||||||
|
{loop type="address.local" name="local-delivery-address" id={order attr="delivery_address"}}
|
||||||
|
<div class="panel-heading">{intl l="Retrait en magasin"}</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<span class="fn">{loop type="title" name="customer.title.info" id=$TITLE}{$SHORT}{/loop} {$LASTNAME|upper} {$FIRSTNAME|ucwords}</span>
|
||||||
|
<span class="org">{$COMPANY}</span>
|
||||||
|
<address class="adr">
|
||||||
|
<span class="street-address">{$ADDRESS1}</span><br>
|
||||||
|
{if $ADDRESS2 != ""}
|
||||||
|
<span class="street-address">{$ADDRESS2}</span><br>
|
||||||
|
{/if}
|
||||||
|
{if $ADDRESS3 != ""}
|
||||||
|
<span class="street-address">{$ADDRESS3}</span><br>
|
||||||
|
{/if}
|
||||||
|
<span class="postal-code">{$ZIPCODE}</span>
|
||||||
|
<span class="locality">
|
||||||
|
{$CITY},
|
||||||
|
<span class="country-name">{loop type="country" name="customer.country.info" id=$COUNTRY}{$TITLE}{/loop}</span>{if $STATE},
|
||||||
|
<span class="state-name">{loop type="state" name="customer.state.info" id=$STATE}{$TITLE}{/loop}</span>
|
||||||
|
{/if}
|
||||||
|
</span>
|
||||||
|
</address>
|
||||||
|
</div>
|
||||||
|
{/loop}
|
||||||
|
</div>
|
||||||
269
local/modules/MondialRelay/Config/config-data.json
Normal file
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
209
local/modules/MondialRelay/Loop/DeliveryPrice.php
Normal file
209
local/modules/MondialRelay/Loop/DeliveryPrice.php
Normal file
@@ -0,0 +1,209 @@
|
|||||||
|
<?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 (null !== $stateId = $this->getStateId()) {
|
||||||
|
$state = StateQuery::create()->findPk($this->$stateId());
|
||||||
|
} 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
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
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
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
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -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
1336
local/modules/MondialRelay/Model/Base/MondialRelayDeliveryPrice.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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
1168
local/modules/MondialRelay/Model/Base/MondialRelayPickupAddress.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -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
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
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`
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user