[12/05/2025] Un peu de paramétrage, notamment les frais de port gratuits en fonction de certains seuils
BIN
local/colissimo-label/ORD000000008739.pdf
Normal file
31
local/modules/ColissimoPickupPoint/AdminIncludes/order-edit.html
Executable file
@@ -0,0 +1,31 @@
|
||||
{loop name="check.module.colissimo.pickup.point.order.edit" type="order" id=$ID status="2,3"}
|
||||
{loop name="check.module.colissimo.pickup.point.id" type="colissimo.pickup.point.id"}
|
||||
{if $MODULE_ID == $DELIVERY_MODULE}
|
||||
<br/>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
{intl l="Export Coliship file" d='colissimo.pickup.point.ai'}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
|
||||
{form name="colissimo.pickup.point.export"}
|
||||
<form action="{url path="/admin/module/ColissimoPickupPoint/export"}" method="post">
|
||||
{form_hidden_fields form=$form}
|
||||
{form_field form=$form field="new_status_id"}
|
||||
<input type="hidden" name="{$name}" value="nochange" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field="order_"|cat:$ID}
|
||||
<input type="hidden" name="{$name}" value="true" />
|
||||
{/form_field}
|
||||
<button type="submit" name="export_order" value="stay" class="form-submit-button btn btn-sm btn-default" title="{intl l='Export' d='colissimo.pickup.point.ai'}">{intl l='Export' d='colissimo.pickup.point.ai'} <span class="glyphicon glyphicon-ok"></span></button>
|
||||
</form>
|
||||
{/form}
|
||||
<br/>
|
||||
|
||||
Suivi du colis: <a href="">ici</a>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/loop}
|
||||
{/loop}
|
||||
342
local/modules/ColissimoPickupPoint/ColissimoPickupPoint.php
Executable file
@@ -0,0 +1,342 @@
|
||||
<?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 ColissimoPickupPoint;
|
||||
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointAreaFreeshippingQuery;
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointFreeshippingQuery;
|
||||
use PDO;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Propel;
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlicesQuery;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Symfony\Component\Finder\SplFileInfo;
|
||||
use Thelia\Model\Country;
|
||||
use Thelia\Model\ModuleImageQuery;
|
||||
use Thelia\Model\ModuleQuery;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Thelia\Install\Database;
|
||||
use Thelia\Module\AbstractDeliveryModule;
|
||||
use Thelia\Module\Exception\DeliveryException;
|
||||
use Thelia\Tools\Version\Version;
|
||||
|
||||
class ColissimoPickupPoint extends AbstractDeliveryModule
|
||||
{
|
||||
protected $request;
|
||||
protected $dispatcher;
|
||||
|
||||
private static $prices = null;
|
||||
|
||||
const DOMAIN = 'colissimopickuppoint';
|
||||
|
||||
const COLISSIMO_USERNAME = 'colissimo_pickup_point_username';
|
||||
|
||||
const COLISSIMO_PASSWORD = 'colissimo_pickup_point_password';
|
||||
|
||||
const COLISSIMO_GOOGLE_KEY = 'colissimo_pickup_point_google_map_key';
|
||||
|
||||
const COLISSIMO_ENDPOINT = 'colissimo_pickup_point_endpoint_url';
|
||||
|
||||
/**
|
||||
* These constants refer to the imported CSV file.
|
||||
* IMPORT_NB_COLS: file's number of columns (begin at 1)
|
||||
* IMPORT_DELIVERY_REF_COL: file's column where delivery reference is set (begin at 0)
|
||||
* IMPORT_ORDER_REF_COL: file's column where order reference is set (begin at 0)
|
||||
*/
|
||||
const IMPORT_NB_COLS = 2;
|
||||
const IMPORT_DELIVERY_REF_COL = 0;
|
||||
const IMPORT_ORDER_REF_COL = 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
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function isValidDelivery(Country $country)
|
||||
{
|
||||
$cartWeight = $this->getRequest()->getSession()->getSessionCart($this->getDispatcher())->getWeight();
|
||||
|
||||
$areaId = $country->getAreaId();
|
||||
|
||||
$prices = ColissimoPickupPointPriceSlicesQuery::create()
|
||||
->filterByAreaId($areaId)
|
||||
->findOne();
|
||||
|
||||
$freeShipping = ColissimoPickupPointFreeshippingQuery::create()
|
||||
->findOneByActive(1);
|
||||
|
||||
/* check if Colissimo delivers the asked area*/
|
||||
if (null !== $prices || null !== $freeShipping) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $areaId
|
||||
* @param $weight
|
||||
* @param $cartAmount
|
||||
*
|
||||
* @return mixed
|
||||
* @throws DeliveryException
|
||||
*/
|
||||
public static function getPostageAmount($areaId, $weight, $cartAmount = 0)
|
||||
{
|
||||
$freeshipping = ColissimoPickupPointFreeshippingQuery::create()
|
||||
->findOneById(1)
|
||||
->getActive()
|
||||
;
|
||||
|
||||
$freeshippingFrom = ColissimoPickupPointFreeshippingQuery::create()
|
||||
->findOneById(1)
|
||||
->getFreeshippingFrom()
|
||||
;
|
||||
|
||||
$postage = 0;
|
||||
|
||||
if (!$freeshipping) {
|
||||
$areaPrices = ColissimoPickupPointPriceSlicesQuery::create()
|
||||
->filterByAreaId($areaId)
|
||||
->filterByWeightMax($weight, Criteria::GREATER_EQUAL)
|
||||
->_or()
|
||||
->filterByWeightMax(null)
|
||||
->filterByPriceMax($cartAmount, Criteria::GREATER_EQUAL)
|
||||
->_or()
|
||||
->filterByPriceMax(null)
|
||||
->orderByWeightMax()
|
||||
->orderByPriceMax();
|
||||
|
||||
$firstPrice = $areaPrices->find()
|
||||
->getFirst();
|
||||
|
||||
if (null === $firstPrice) {
|
||||
throw new DeliveryException('Colissimo delivery unavailable for your cart weight or delivery country');
|
||||
}
|
||||
|
||||
/** If a min price for general freeshipping is defined and the cart reach this amount, return a postage of 0 */
|
||||
if (null !== $freeshippingFrom && $freeshippingFrom <= $cartAmount) {
|
||||
$postage = 0;
|
||||
return $postage;
|
||||
}
|
||||
|
||||
$areaFreeshipping = ColissimoPickupPointAreaFreeshippingQuery::create()
|
||||
->filterByAreaId($areaId)
|
||||
->findOne();
|
||||
|
||||
if ($areaFreeshipping) {
|
||||
$areaFreeshipping = $areaFreeshipping->getCartAmount();
|
||||
}
|
||||
|
||||
/** If a min price for area freeshipping is defined and the cart reach this amount, return a postage of 0 */
|
||||
if (null !== $areaFreeshipping && $areaFreeshipping <= $cartAmount) {
|
||||
$postage = 0;
|
||||
return $postage;
|
||||
}
|
||||
|
||||
$postage = $firstPrice->getPrice();
|
||||
}
|
||||
return $postage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate and return delivery price
|
||||
*
|
||||
* @param Country $country
|
||||
* @return mixed
|
||||
* @throws DeliveryException
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function getPostage(Country $country)
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$cartWeight = $request->getSession()->getSessionCart($this->getDispatcher())->getWeight();
|
||||
$cartAmount = $request->getSession()->getSessionCart($this->getDispatcher())->getTaxedAmount($country);
|
||||
|
||||
$areaIdArray = $this->getAllAreasForCountry($country);
|
||||
if (empty($areaIdArray)) {
|
||||
throw new DeliveryException('Your delivery country is not covered by Colissimo.');
|
||||
}
|
||||
$postage = null;
|
||||
|
||||
if (null === $postage = $this->getMinPostage($areaIdArray, $cartWeight, $cartAmount)) {
|
||||
$postage = $this->getMinPostage($areaIdArray, $cartWeight, $cartAmount);
|
||||
if (null === $postage) {
|
||||
throw new DeliveryException('Colissimo delivery unavailable for your cart weight or delivery country');
|
||||
}
|
||||
}
|
||||
return $postage;
|
||||
}
|
||||
|
||||
|
||||
private function getMinPostage($areaIdArray, $cartWeight, $cartAmount)
|
||||
{
|
||||
$minPostage = null;
|
||||
|
||||
foreach ($areaIdArray as $areaId) {
|
||||
try {
|
||||
$postage = self::getPostageAmount($areaId, $cartWeight, $cartAmount);
|
||||
if ($minPostage === null || $postage < $minPostage) {
|
||||
$minPostage = $postage;
|
||||
if ($minPostage == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
}
|
||||
}
|
||||
|
||||
return $minPostage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns ids of area containing this country and covers by this module
|
||||
* @param Country $country
|
||||
* @return array Area ids
|
||||
*/
|
||||
private function getAllAreasForCountry(Country $country)
|
||||
{
|
||||
$areaArray = [];
|
||||
|
||||
$sql = 'SELECT ca.area_id as area_id FROM country_area ca
|
||||
INNER JOIN area_delivery_module adm ON (ca.area_id = adm.area_id AND adm.delivery_module_id = :p0)
|
||||
WHERE ca.country_id = :p1';
|
||||
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $this->getModuleModel()->getId(), PDO::PARAM_INT);
|
||||
$stmt->bindValue(':p1', $country->getId(), PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$areaArray[] = $row['area_id'];
|
||||
}
|
||||
|
||||
return $areaArray;
|
||||
}
|
||||
|
||||
/** Return the module code */
|
||||
public function getCode()
|
||||
{
|
||||
return 'ColissimoPickupPoint';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the config values exist, and creates them otherwise
|
||||
*/
|
||||
protected function checkModuleConfig() {
|
||||
/** Colissimo Username / Account number */
|
||||
if (null === self::getConfigValue(self::COLISSIMO_USERNAME)) {
|
||||
self::setConfigValue(self::COLISSIMO_USERNAME, '');
|
||||
}
|
||||
|
||||
/** Colissimo password */
|
||||
if (null === self::getConfigValue(self::COLISSIMO_PASSWORD)) {
|
||||
self::setConfigValue(self::COLISSIMO_PASSWORD, '');
|
||||
}
|
||||
|
||||
/** Colissimo Google Map key */
|
||||
if (null === self::getConfigValue(self::COLISSIMO_GOOGLE_KEY)) {
|
||||
self::setConfigValue(self::COLISSIMO_GOOGLE_KEY, '');
|
||||
}
|
||||
|
||||
/** Colissimo Endpoint url for pickup point */
|
||||
if (null === self::getConfigValue(self::COLISSIMO_ENDPOINT)) {
|
||||
self::setConfigValue(self::COLISSIMO_ENDPOINT, 'https://ws.colissimo.fr/pointretrait-ws-cxf/PointRetraitServiceWS/2.0?wsdl');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function postActivation(ConnectionInterface $con = null)
|
||||
{
|
||||
try {
|
||||
// Security to not erase user config on reactivation
|
||||
ColissimoPickupPointPriceSlicesQuery::create()->findOne();
|
||||
ColissimoPickupPointAreaFreeshippingQuery::create()->findOne();
|
||||
ColissimoPickupPointFreeshippingQuery::create()->findOne();
|
||||
} catch (\Exception $e) {
|
||||
$database = new Database($con->getWrappedConnection());
|
||||
$database->insertSql(null, [__DIR__ . '/Config/thelia.sql', __DIR__ . '/Config/insert.sql']);
|
||||
}
|
||||
|
||||
if (!ColissimoPickupPointFreeshippingQuery::create()->filterById(1)->findOne()) {
|
||||
ColissimoPickupPointFreeshippingQuery::create()->filterById(1)->findOneOrCreate()->setActive(0)->save();
|
||||
}
|
||||
|
||||
$this->checkModuleConfig();
|
||||
|
||||
/** Insert the images from image folder if first module activation */
|
||||
$module = $this->getModuleModel();
|
||||
if (ModuleImageQuery::create()->filterByModule($module)->count() === 0) {
|
||||
$this->deployImageFolder($module, sprintf('%s/images', __DIR__), $con);
|
||||
}
|
||||
}
|
||||
|
||||
/** Return the module ID */
|
||||
public static function getModCode()
|
||||
{
|
||||
return ModuleQuery::create()->findOneByCode('ColissimoPickupPoint')->getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function update($currentVersion, $newVersion, ConnectionInterface $con = null)
|
||||
{
|
||||
$this->checkModuleConfig();
|
||||
|
||||
$finder = (new Finder)
|
||||
->files()
|
||||
->name('#.*?\.sql#')
|
||||
->sortByName()
|
||||
->in(__DIR__ . DS . 'Config' . DS . 'update');
|
||||
|
||||
$database = new Database($con);
|
||||
|
||||
/** @var SplFileInfo $updateSQLFile */
|
||||
foreach ($finder as $updateSQLFile) {
|
||||
if (version_compare($currentVersion, str_replace('.sql', '', $updateSQLFile->getFilename()), '<')) {
|
||||
$database->insertSql(
|
||||
null,
|
||||
[
|
||||
$updateSQLFile->getPathname()
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getDeliveryMode()
|
||||
{
|
||||
return "pickup";
|
||||
}
|
||||
}
|
||||
69
local/modules/ColissimoPickupPoint/Config/config.xml
Executable file
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<config xmlns="http://thelia.net/schema/dic/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||
|
||||
<loops>
|
||||
<loop class="ColissimoPickupPoint\Loop\CheckRightsLoop" name="colissimo.pickup.point.check.rights" />
|
||||
<loop class="ColissimoPickupPoint\Loop\ColissimoPickupPointPriceSlices" name="colissimo.pickup.point" />
|
||||
<loop class="ColissimoPickupPoint\Loop\ColissimoPickupPointId" name="colissimo.pickup.point.id" />
|
||||
<loop class="ColissimoPickupPoint\Loop\GetRelais" name="colissimo.pickup.point.around" />
|
||||
<loop class="ColissimoPickupPoint\Loop\ColissimoPickupPointAddress" name="address.colissimo.pickup.point" />
|
||||
<loop class="ColissimoPickupPoint\Loop\NotSentOrders" name="order.notsent.colissimo.pickup.point" />
|
||||
<loop class="ColissimoPickupPoint\Loop\ColissimoPickupPointOrderAddressLoop" name="colissimo.pickup.point.order_address" />
|
||||
<loop class="ColissimoPickupPoint\Loop\AreaFreeshipping" name="colissimo.pickup.point.area.freeshipping" />
|
||||
<loop class="ColissimoPickupPoint\Loop\ColissimoPickupPointFreeshippingLoop" name="colissimo.pickup.point.freeshipping" />
|
||||
</loops>
|
||||
|
||||
<forms>
|
||||
<form name="colissimo.pickup.point.freeshipping.form" class="ColissimoPickupPoint\Form\FreeShippingForm" />
|
||||
<form name="colissimo.pickup.point.configure" class="ColissimoPickupPoint\Form\ConfigureColissimoPickupPoint" />
|
||||
<form name="colissimo.pickup.point.export" class="ColissimoPickupPoint\Form\ExportOrder" />
|
||||
<form name="colissimo.pickup.point.import" class="ColissimoPickupPoint\Form\ImportForm"/>
|
||||
<form name="colissimo.pickup.point.add.price.form" class="ColissimoPickupPoint\Form\AddPriceForm" />
|
||||
<form name="colissimo.pickup.point.update.price.form" class="ColissimoPickupPoint\Form\UpdatePriceForm" />
|
||||
</forms>
|
||||
|
||||
<services>
|
||||
<service id="hook.order.module.colissimo.pickup.point" class="ColissimoPickupPoint\Listener\SetDeliveryModule" scope="request">
|
||||
<argument type="service" id="request"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
<service id="send.colissimo.pickup.point.mail" class="ColissimoPickupPoint\Listener\SendMail" scope="request">
|
||||
<argument type="service" id="thelia.parser" />
|
||||
<argument type="service" id="mailer"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
<service id="api.colissimo.pickup.point" class="ColissimoPickupPoint\Listener\APIListener" scope="request">
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
<service id="colissimo.pickup.point.price.smarty.plugin" class="ColissimoPickupPoint\Smarty\Plugins\ColissimoPickupPointDeliveryPrice" scope="request">
|
||||
<argument type="service" id="request" />
|
||||
<argument type="service" id="event_dispatcher"/>
|
||||
<tag name="thelia.parser.register_plugin" />
|
||||
</service>
|
||||
|
||||
<service id="colissimo.pickup.point.google.map.key.smarty.plugin" class="ColissimoPickupPoint\Smarty\Plugins\ColissimoPickupPointGoogleApiKey" scope="request">
|
||||
<argument type="service" id="request" />
|
||||
<argument type="service" id="event_dispatcher"/>
|
||||
<tag name="thelia.parser.register_plugin" />
|
||||
</service>
|
||||
</services>
|
||||
|
||||
<hooks>
|
||||
<hook id="colissimo.pickup.point.hook.back" class="ColissimoPickupPoint\Hook\BackHook">
|
||||
<tag name="hook.event_listener" event="module.configuration" type="back" method="onModuleConfiguration" />
|
||||
<tag name="hook.event_listener" event="module.config-js" type="back" method="onModuleConfigJs" />
|
||||
</hook>
|
||||
<hook id="colissimo.pickup.point.hook.front" class="ColissimoPickupPoint\Hook\FrontHook" scope="request">
|
||||
<tag name="hook.event_listener" event="order-delivery.extra" />
|
||||
<tag name="hook.event_listener" event="order-invoice.delivery-address" />
|
||||
<tag name="hook.event_listener" event="main.head-bottom" />
|
||||
</hook>
|
||||
<hook id="colissimo.pickup.point.hook.pdf" class="ColissimoPickupPoint\Hook\PdfHook" scope="request">
|
||||
<tag name="hook.event_listener" event="invoice.after-delivery-module" type="pdf" method="onInvoiceAfterDeliveryModule" />
|
||||
</hook>
|
||||
</hooks>
|
||||
|
||||
</config>
|
||||
30
local/modules/ColissimoPickupPoint/Config/insert.sql
Normal file
@@ -0,0 +1,30 @@
|
||||
# This is a fix for InnoDB in MySQL >= 4.1.x
|
||||
# It "suspends judgement" for fkey relationships until are tables are set.
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Mail templates for colissimo pickup point
|
||||
-- ---------------------------------------------------------------------
|
||||
-- First, delete existing entries
|
||||
SET @var := 0;
|
||||
SELECT @var := `id` FROM `message` WHERE name="mail_colissimo_pickup_point";
|
||||
DELETE FROM `message` WHERE `id`=@var;
|
||||
-- Try if ON DELETE constraint isn't set
|
||||
DELETE FROM `message_i18n` WHERE `id`=@var;
|
||||
|
||||
-- Then add new entries
|
||||
SELECT @max := MAX(`id`) FROM `message`;
|
||||
SET @max := @max+1;
|
||||
-- insert message
|
||||
INSERT INTO `message` (`id`, `name`, `secured`) VALUES
|
||||
(@max,
|
||||
'mail_colissimo_pickup_point',
|
||||
'0'
|
||||
);
|
||||
|
||||
-- and template fr_FR
|
||||
INSERT INTO `message_i18n` (`id`, `locale`, `title`, `subject`, `text_message`, `html_message`) VALUES
|
||||
(@max, 'fr_FR', 'Mail livraison Colissimo Point Relais', 'Suivi Colissimo Point Relais commande : {$order_ref}', '{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}\r\n{$LASTNAME} {$FIRSTNAME},\r\n{/loop}\r\nNous vous remercions de votre commande sur notre site {config key="store_name"}\r\nUn colis concernant votre commande {$order_ref} du {format_date date=$order_date} a quitté nos entrepôts pour être pris en charge par La Poste le {format_date date=$update_date}.\r\nSon numéro de suivi est le suivant : {$package}\r\nIl vous permet de suivre votre colis en ligne sur le site de La Poste : www.coliposte.net\r\nNous restons à votre disposition pour toute information complémentaire.\r\nCordialement', '{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}\r\n{$LASTNAME} {$FIRSTNAME},\r\n{/loop}\r\nNous vous remercions de votre commande sur notre site {config key="store_name"}\r\nUn colis concernant votre commande {$order_ref} du {format_date date=$order_date} a quitté nos entrepôts pour être pris en charge par La Poste le {format_date date=$update_date}.\r\nSon numéro de suivi est le suivant : {$package}\r\nIl vous permet de suivre votre colis en ligne sur le site de La Poste : www.coliposte.net\r\nIl vous sera, par ailleurs, très utile si vous étiez absent au moment de la livraison de votre colis : en fournissant ce numéro de Colissimo Suivi, vous pourrez retirer votre colis dans le bureau de Poste le plus proche.\r\nATTENTION ! Si vous ne trouvez pas l''avis de passage normalement déposé dans votre boîte aux lettres au bout de 48 Heures jours ouvrables, n''hésitez pas à aller le réclamer à votre bureau de Poste, muni de votre numéro de Colissimo Suivi.\r\nNous restons à votre disposition pour toute information complémentaire.\r\nCordialement');
|
||||
|
||||
# This restores the fkey checks, after having unset them earlier
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
18
local/modules/ColissimoPickupPoint/Config/module.xml
Executable file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module>
|
||||
<fullnamespace>ColissimoPickupPoint\ColissimoPickupPoint</fullnamespace>
|
||||
<descriptive locale="en_US">
|
||||
<title>Colissimo Pickup Point Delivery</title>
|
||||
</descriptive>
|
||||
<descriptive locale="fr_FR">
|
||||
<title>Livraison Colissimo en Point Retrait</title>
|
||||
</descriptive>
|
||||
<version>1.0.2</version>
|
||||
<author>
|
||||
<name>Thelia</name>
|
||||
<email>info@thelia.net</email>
|
||||
</author>
|
||||
<type>delivery</type>
|
||||
<thelia>2.3.3</thelia>
|
||||
<stability>other</stability>
|
||||
</module>
|
||||
46
local/modules/ColissimoPickupPoint/Config/routing.xml
Executable file
@@ -0,0 +1,46 @@
|
||||
<?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="colissimo.pickup.point.add.price" path="/admin/module/ColissimoPickupPoint/slice/save" methods="post">
|
||||
<default key="_controller">ColissimoPickupPoint\Controller\SliceController::saveSliceAction</default>
|
||||
</route>
|
||||
<route id="colissimo.pickup.point.update.price" path="/admin/module/ColissimoPickupPoint/slice/delete" methods="post">
|
||||
<default key="_controller">ColissimoPickupPoint\Controller\SliceController::deleteSliceAction</default>
|
||||
</route>
|
||||
|
||||
<route id="colissimo.pickup.point.toggle.freeshipping" path="/admin/module/ColissimoPickupPoint/freeshipping" methods="post">
|
||||
<default key="_controller">ColissimoPickupPoint\Controller\FreeShipping::toggleFreeShippingActivation</default>
|
||||
</route>
|
||||
|
||||
<route id="colissimo.pickup.point.edit.areafreeshipping" path="/admin/module/ColissimoPickupPoint/area_freeshipping" methods="post">
|
||||
<default key="_controller">ColissimoPickupPoint\Controller\FreeShipping::setAreaFreeShipping</default>
|
||||
</route>
|
||||
|
||||
<route id="colissimo.pickup.point.configure" path="/admin/module/ColissimoPickupPoint/configure" methods="post">
|
||||
<default key="_controller">ColissimoPickupPoint\Controller\SaveConfig::save</default>
|
||||
</route>
|
||||
|
||||
<route id="colissimo.pickup.point.get.specific.location" path="/module/ColissimoPickupPoint/{countryid}/{zipcode}/{city}/{address}" methods="get">
|
||||
<default key="_controller">ColissimoPickupPoint\Controller\GetSpecificLocation::get</default>
|
||||
<default key="address"></default>
|
||||
<requirement key="city">[a-zA-Z\- ]+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="colissimo.pickup.point.point.info" path="/module/ColissimoPickupPoint/point/{point_id}">
|
||||
<default key="_controller">ColissimoPickupPoint\Controller\GetSpecificLocation::getPointInfo</default>
|
||||
</route>
|
||||
|
||||
<route id="colissimo.pickup.point.point.search" path="/module/ColissimoPickupPoint/points">
|
||||
<default key="_controller">ColissimoPickupPoint\Controller\GetSpecificLocation::search</default>
|
||||
</route>
|
||||
|
||||
<route id="colissimo.pickup.point.export" path="/admin/module/ColissimoPickupPoint/export" methods="post">
|
||||
<default key="_controller">ColissimoPickupPoint\Controller\Export::export</default>
|
||||
</route>
|
||||
|
||||
<route id="colissimo.pickup.point.import" path="/admin/module/ColissimoPickupPoint/import" methods="post">
|
||||
<default key="_controller">ColissimoPickupPoint:Import:import</default>
|
||||
</route>
|
||||
</routes>
|
||||
64
local/modules/ColissimoPickupPoint/Config/schema.xml
Executable file
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<database defaultIdMethod="native" name="thelia" namespace="ColissimoPickupPoint\Model">
|
||||
|
||||
<table name="address_colissimo_pickup_point">
|
||||
<column name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||
<column name="title_id" required="true" type="INTEGER" />
|
||||
<column name="company" size="255" type="VARCHAR" />
|
||||
<column name="firstname" required="true" size="255" type="VARCHAR" />
|
||||
<column name="lastname" required="true" size="255" type="VARCHAR" />
|
||||
<column name="address1" required="true" size="255" type="VARCHAR" />
|
||||
<column name="address2" required="true" size="255" type="VARCHAR" />
|
||||
<column name="address3" required="true" size="255" type="VARCHAR" />
|
||||
<column name="zipcode" required="true" size="10" type="VARCHAR" />
|
||||
<column name="city" required="true" size="255" type="VARCHAR" />
|
||||
<column name="country_id" required="true" type="INTEGER" />
|
||||
<column name="code" required="true" size="10" type="VARCHAR" />
|
||||
<column name="type" required="true" size="10" type="VARCHAR" />
|
||||
<column name="cellphone" required="false" size="20" type="VARCHAR" />
|
||||
<foreign-key foreignTable="customer_title" name="fk_address_colissimo_pickup_point_customer_title_id" onDelete="RESTRICT" onUpdate="RESTRICT">
|
||||
<reference foreign="id" local="title_id" />
|
||||
</foreign-key>
|
||||
<foreign-key foreignTable="country" name="fk_address_colissimo_pickup_point_country_id" onDelete="RESTRICT" onUpdate="RESTRICT">
|
||||
<reference foreign="id" local="country_id" />
|
||||
</foreign-key>
|
||||
</table>
|
||||
|
||||
<table name="order_address_colissimo_pickup_point">
|
||||
<column name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||
<column name="code" size="10" type="VARCHAR" required="true" />
|
||||
<column name="type" size="10" type="VARCHAR" required="true" />
|
||||
<foreign-key foreignTable="order_address" name="fk_order_address_colissimo_pickup_point_order_address_id" onDelete="CASCADE" onUpdate="CASCADE">
|
||||
<reference foreign="id" local="id" />
|
||||
</foreign-key>
|
||||
</table>
|
||||
|
||||
<table name="colissimo_pickup_point_price_slices">
|
||||
<column name="id" primaryKey="true" autoIncrement="true" required="true" type="INTEGER" />
|
||||
<column name="area_id" required="true" type="INTEGER" />
|
||||
<column name="weight_max" type="FLOAT" />
|
||||
<column name="price_max" type="FLOAT" />
|
||||
<column name="franco_min_price" type="FLOAT" />
|
||||
<column name="price" required="true" type="FLOAT" />
|
||||
<foreign-key foreignTable="area" name="fk_colissimo_pickup_point_price_slices_area_id" onDelete="RESTRICT" onUpdate="RESTRICT">
|
||||
<reference foreign="id" local="area_id" />
|
||||
</foreign-key>
|
||||
</table>
|
||||
|
||||
<table name="colissimo_pickup_point_freeshipping">
|
||||
<column name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||
<column name="active" type="BOOLEAN" default="0"/>
|
||||
<column name="freeshipping_from" size="18" scale="2" type="DECIMAL" />
|
||||
</table>
|
||||
|
||||
<table name="colissimo_pickup_point_area_freeshipping">
|
||||
<column name="id" primaryKey="true" autoIncrement="true" required="true" type="INTEGER" />
|
||||
<column name="area_id" required="true" type="INTEGER" />
|
||||
<column name="cart_amount" defaultValue="0.00" size="18" scale="2" type="DECIMAL" />
|
||||
<foreign-key foreignTable="area" name="fk_colissimo_pickup_point_area_freeshipping_pr_area_id" onDelete="RESTRICT" onUpdate="RESTRICT">
|
||||
<reference foreign="id" local="area_id" />
|
||||
</foreign-key>
|
||||
</table>
|
||||
|
||||
<external-schema filename="local/config/schema.xml" referenceOnly="true" />
|
||||
</database>
|
||||
2
local/modules/ColissimoPickupPoint/Config/sqldb.map
Normal file
@@ -0,0 +1,2 @@
|
||||
# Sqlfile -> Database map
|
||||
thelia.sql=thelia
|
||||
120
local/modules/ColissimoPickupPoint/Config/thelia.sql
Normal file
@@ -0,0 +1,120 @@
|
||||
|
||||
# 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;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- address_colissimo_pickup_point
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `address_colissimo_pickup_point`;
|
||||
|
||||
CREATE TABLE `address_colissimo_pickup_point`
|
||||
(
|
||||
`id` INTEGER NOT NULL,
|
||||
`title_id` INTEGER NOT NULL,
|
||||
`company` VARCHAR(255),
|
||||
`firstname` VARCHAR(255) NOT NULL,
|
||||
`lastname` VARCHAR(255) NOT NULL,
|
||||
`address1` VARCHAR(255) NOT NULL,
|
||||
`address2` VARCHAR(255) NOT NULL,
|
||||
`address3` VARCHAR(255) NOT NULL,
|
||||
`zipcode` VARCHAR(10) NOT NULL,
|
||||
`city` VARCHAR(255) NOT NULL,
|
||||
`country_id` INTEGER NOT NULL,
|
||||
`code` VARCHAR(10) NOT NULL,
|
||||
`type` VARCHAR(10) NOT NULL,
|
||||
`cellphone` VARCHAR(20),
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `FI_address_colissimo_pickup_point_customer_title_id` (`title_id`),
|
||||
INDEX `FI_address_colissimo_pickup_point_country_id` (`country_id`),
|
||||
CONSTRAINT `fk_address_colissimo_pickup_point_customer_title_id`
|
||||
FOREIGN KEY (`title_id`)
|
||||
REFERENCES `customer_title` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT,
|
||||
CONSTRAINT `fk_address_colissimo_pickup_point_country_id`
|
||||
FOREIGN KEY (`country_id`)
|
||||
REFERENCES `country` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- order_address_colissimo_pickup_point
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `order_address_colissimo_pickup_point`;
|
||||
|
||||
CREATE TABLE `order_address_colissimo_pickup_point`
|
||||
(
|
||||
`id` INTEGER NOT NULL,
|
||||
`code` VARCHAR(10) NOT NULL,
|
||||
`type` VARCHAR(10) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_order_address_colissimo_pickup_point_order_address_id`
|
||||
FOREIGN KEY (`id`)
|
||||
REFERENCES `order_address` (`id`)
|
||||
ON UPDATE CASCADE
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- colissimo_pickup_point_price_slices
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `colissimo_pickup_point_price_slices`;
|
||||
|
||||
CREATE TABLE `colissimo_pickup_point_price_slices`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`area_id` INTEGER NOT NULL,
|
||||
`weight_max` FLOAT,
|
||||
`price_max` FLOAT,
|
||||
`franco_min_price` FLOAT,
|
||||
`price` FLOAT NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `FI_colissimo_pickup_point_price_slices_area_id` (`area_id`),
|
||||
CONSTRAINT `fk_colissimo_pickup_point_price_slices_area_id`
|
||||
FOREIGN KEY (`area_id`)
|
||||
REFERENCES `area` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- colissimo_pickup_point_freeshipping
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `colissimo_pickup_point_freeshipping`;
|
||||
|
||||
CREATE TABLE `colissimo_pickup_point_freeshipping`
|
||||
(
|
||||
`id` INTEGER NOT NULL,
|
||||
`active` TINYINT(1) DEFAULT 0,
|
||||
`freeshipping_from` DECIMAL(18,2),
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- colissimo_pickup_point_area_freeshipping
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `colissimo_pickup_point_area_freeshipping`;
|
||||
|
||||
CREATE TABLE `colissimo_pickup_point_area_freeshipping`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`area_id` INTEGER NOT NULL,
|
||||
`cart_amount` DECIMAL(18,2) DEFAULT 0.00,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `FI_colissimo_pickup_point_area_freeshipping_pr_area_id` (`area_id`),
|
||||
CONSTRAINT `fk_colissimo_pickup_point_area_freeshipping_pr_area_id`
|
||||
FOREIGN KEY (`area_id`)
|
||||
REFERENCES `area` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
# This restores the fkey checks, after having unset them earlier
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
249
local/modules/ColissimoPickupPoint/Controller/Export.php
Executable file
@@ -0,0 +1,249 @@
|
||||
<?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 ColissimoPickupPoint\Controller;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use ColissimoPickupPoint\Form\ExportOrder;
|
||||
use ColissimoPickupPoint\Format\CSV;
|
||||
use ColissimoPickupPoint\Format\CSVLine;
|
||||
use ColissimoPickupPoint\Model\OrderAddressColissimoPickupPointQuery;
|
||||
use ColissimoPickupPoint\ColissimoPickupPoint;
|
||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\HttpFoundation\Response;
|
||||
use Thelia\Model\Base\CountryQuery;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\CustomerTitleI18nQuery;
|
||||
use Thelia\Model\OrderAddressQuery;
|
||||
use Thelia\Model\OrderQuery;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Model\OrderStatus;
|
||||
use Thelia\Model\OrderStatusQuery;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
|
||||
/**
|
||||
* Class Export
|
||||
* @package ColissimoPickupPoint\Controller
|
||||
* @author Thelia <info@thelia.net>
|
||||
*/
|
||||
class Export extends BaseAdminController
|
||||
{
|
||||
const CSV_SEPARATOR = ';';
|
||||
|
||||
const DEFAULT_PHONE = '0100000000';
|
||||
const DEFAULT_CELLPHONE = '0600000000';
|
||||
|
||||
public function export()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(array(AdminResources::MODULE), array('ColissimoPickupPoint'), AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$csv = new CSV(self::CSV_SEPARATOR);
|
||||
|
||||
try {
|
||||
$form = new ExportOrder($this->getRequest());
|
||||
$vform = $this->validateForm($form);
|
||||
|
||||
// Check status_id
|
||||
$status_id = $vform->get('new_status_id')->getData();
|
||||
if (!preg_match('#^nochange|processing|sent$#',$status_id)) {
|
||||
throw new Exception('Bad value for new_status_id field');
|
||||
}
|
||||
|
||||
$status = OrderStatusQuery::create()
|
||||
->filterByCode(
|
||||
array(
|
||||
OrderStatus::CODE_PAID,
|
||||
OrderStatus::CODE_PROCESSING,
|
||||
OrderStatus::CODE_SENT
|
||||
),
|
||||
Criteria::IN
|
||||
)
|
||||
->find()
|
||||
->toArray('code')
|
||||
;
|
||||
|
||||
$query = OrderQuery::create()
|
||||
->filterByDeliveryModuleId(ColissimoPickupPoint::getModCode())
|
||||
->filterByStatusId(
|
||||
array(
|
||||
$status[OrderStatus::CODE_PAID]['Id'],
|
||||
$status[OrderStatus::CODE_PROCESSING]['Id']),
|
||||
Criteria::IN
|
||||
)
|
||||
->find();
|
||||
|
||||
// check form && exec csv
|
||||
/** @var \Thelia\Model\Order $order */
|
||||
foreach ($query as $order) {
|
||||
$value = $vform->get('order_'.$order->getId())->getData();
|
||||
|
||||
// If checkbox is checked
|
||||
if ($value) {
|
||||
/**
|
||||
* Retrieve user with the order
|
||||
*/
|
||||
$customer = $order->getCustomer();
|
||||
|
||||
/**
|
||||
* Retrieve address with the order
|
||||
*/
|
||||
$address = OrderAddressQuery::create()
|
||||
->findPk($order->getDeliveryOrderAddressId());
|
||||
|
||||
if ($address === null) {
|
||||
throw new Exception("Could not find the order's invoice address");
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve country with the address
|
||||
*/
|
||||
$country = CountryQuery::create()
|
||||
->findPk($address->getCountryId());
|
||||
|
||||
if ($country === null) {
|
||||
throw new Exception("Could not find the order's country");
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Title
|
||||
*/
|
||||
$title = CustomerTitleI18nQuery::create()
|
||||
->filterById($customer->getTitleId())
|
||||
->findOneByLocale(
|
||||
$this->getSession()
|
||||
->getAdminEditionLang()
|
||||
->getLocale()
|
||||
);
|
||||
|
||||
/**
|
||||
* Get user's phone & cellphone
|
||||
* First get invoice address phone,
|
||||
* If empty, try to get default address' phone.
|
||||
* If still empty, set default value
|
||||
*/
|
||||
$phone = $address->getPhone();
|
||||
if (empty($phone)) {
|
||||
$phone = $customer->getDefaultAddress()->getPhone();
|
||||
|
||||
if (empty($phone)) {
|
||||
$phone = self::DEFAULT_PHONE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cellphone
|
||||
*/
|
||||
$cellphone = $customer->getDefaultAddress()->getCellphone();
|
||||
|
||||
if (empty($cellphone)) {
|
||||
$cellphone = self::DEFAULT_CELLPHONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute package weight
|
||||
*/
|
||||
$weight = 0;
|
||||
if ($vform->get('order_weight_'.$order->getId())->getData() == 0) {
|
||||
/** @var \Thelia\Model\OrderProduct $product */
|
||||
foreach ($order->getOrderProducts() as $product) {
|
||||
$weight+=(double) $product->getWeight() * $product->getQuantity();
|
||||
}
|
||||
} else {
|
||||
$weight = $vform->get('order_weight_'.$order->getId())->getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get relay ID
|
||||
*/
|
||||
$relay_id = OrderAddressColissimoPickupPointQuery::create()
|
||||
->findPk($order->getDeliveryOrderAddressId());
|
||||
|
||||
/**
|
||||
* Get store's name
|
||||
*/
|
||||
$store_name = ConfigQuery::read('store_name');
|
||||
/**
|
||||
* Write CSV line
|
||||
*/
|
||||
$csv->addLine(
|
||||
CSVLine::create(
|
||||
array(
|
||||
$address->getFirstname(),
|
||||
$address->getLastname(),
|
||||
$address->getCompany(),
|
||||
$address->getAddress1(),
|
||||
$address->getAddress2(),
|
||||
$address->getAddress3(),
|
||||
$address->getZipcode(),
|
||||
$address->getCity(),
|
||||
$country->getIsoalpha2(),
|
||||
$phone,
|
||||
$cellphone,
|
||||
$order->getRef(),
|
||||
$title->getShort(),
|
||||
// the Expeditor software used to accept a relay id of 0, but no longer does
|
||||
($relay_id !== null) ? ($relay_id->getCode() == 0) ? '' : $relay_id->getCode() : 0,
|
||||
$customer->getEmail(),
|
||||
$weight,
|
||||
$store_name,
|
||||
($relay_id !== null) ? $relay_id->getType() : 0
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Then update order's status if necessary
|
||||
*/
|
||||
if ($status_id === 'processing') {
|
||||
$event = new OrderEvent($order);
|
||||
$event->setStatus($status[OrderStatus::CODE_PROCESSING]['Id']);
|
||||
$this->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event);
|
||||
} elseif ($status_id === 'sent') {
|
||||
$event = new OrderEvent($order);
|
||||
$event->setStatus($status[OrderStatus::CODE_SENT]['Id']);
|
||||
$this->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return Response::create($e->getMessage(),500);
|
||||
}
|
||||
|
||||
return Response::create(
|
||||
utf8_decode($csv->parse()),
|
||||
200,
|
||||
array(
|
||||
'Content-Encoding' => 'ISO-8889-1',
|
||||
'Content-Type' => 'application/csv-tab-delimited-table',
|
||||
'Content-disposition' => 'filename=expeditor_thelia.csv'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
150
local/modules/ColissimoPickupPoint/Controller/FreeShipping.php
Executable file
@@ -0,0 +1,150 @@
|
||||
<?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 ColissimoPickupPoint\Controller;
|
||||
|
||||
use ColissimoPickupPoint\Form\FreeShippingForm;
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointAreaFreeshipping;
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointAreaFreeshippingQuery;
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointFreeshipping;
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointFreeshippingQuery;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use Thelia\Core\HttpFoundation\Response;
|
||||
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Model\AreaQuery;
|
||||
|
||||
class FreeShipping extends BaseAdminController
|
||||
{
|
||||
/**
|
||||
* Toggle on or off free shipping for all areas without minimum cart amount, or set the minimum cart amount to reach for all areas to get free shipping
|
||||
*
|
||||
* @return mixed|JsonResponse|Response|null
|
||||
*/
|
||||
public function toggleFreeShippingActivation()
|
||||
{
|
||||
if (null !== $response = $this
|
||||
->checkAuth(array(AdminResources::MODULE), array('ColissimoPickupPoint'), AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$form = new FreeShippingForm($this->getRequest());
|
||||
$response=null;
|
||||
|
||||
try {
|
||||
$vform = $this->validateForm($form);
|
||||
$freeshipping = $vform->get('freeshipping')->getData();
|
||||
$freeshippingFrom = $vform->get('freeshipping_from')->getData();
|
||||
|
||||
if (null === $deliveryFreeshipping = ColissimoPickupPointFreeshippingQuery::create()->findOneById(1)){
|
||||
$deliveryFreeshipping = new ColissimoPickupPointFreeshipping();
|
||||
}
|
||||
|
||||
$deliveryFreeshipping
|
||||
->setActive($freeshipping)
|
||||
->setFreeshippingFrom($freeshippingFrom)
|
||||
->save()
|
||||
;
|
||||
|
||||
$response = $this->generateRedirectFromRoute(
|
||||
'admin.module.configure',
|
||||
array(),
|
||||
array (
|
||||
'current_tab'=> 'prices_slices_tab',
|
||||
'module_code'=> 'ColissimoPickupPoint',
|
||||
'_controller' => 'Thelia\\Controller\\Admin\\ModuleController::configureAction',
|
||||
'price_error_id' => null,
|
||||
'price_error' => null
|
||||
)
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
$response = JsonResponse::create(array('error' => $e->getMessage()), 500);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed|null|\Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function setAreaFreeShipping()
|
||||
{
|
||||
if (null !== $response = $this
|
||||
->checkAuth(array(AdminResources::MODULE), array('ColissimoPickupPoint'), AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$data = $this->getRequest()->request;
|
||||
|
||||
try {
|
||||
$data = $this->getRequest()->request;
|
||||
|
||||
$colissimo_pickup_area_id = $data->get('area-id');
|
||||
$cartAmount = $data->get('cart-amount');
|
||||
|
||||
if ($cartAmount < 0 || $cartAmount === '') {
|
||||
$cartAmount = null;
|
||||
}
|
||||
|
||||
$aeraQuery = AreaQuery::create()->findOneById($colissimo_pickup_area_id);
|
||||
if (null === $aeraQuery) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$colissimoPickupPointAreaFreeshippingQuery = ColissimoPickupPointAreaFreeshippingQuery::create()
|
||||
->filterByAreaId($colissimo_pickup_area_id)
|
||||
->findOne();
|
||||
|
||||
if (null === $colissimoPickupPointAreaFreeshippingQuery) {
|
||||
$colissimoPickupPointFreeShipping = new ColissimoPickupPointAreaFreeshipping();
|
||||
|
||||
$colissimoPickupPointFreeShipping
|
||||
->setAreaId($colissimo_pickup_area_id)
|
||||
->setCartAmount($cartAmount)
|
||||
->save();
|
||||
}
|
||||
|
||||
$cartAmountQuery = ColissimoPickupPointAreaFreeshippingQuery::create()
|
||||
->filterByAreaId($colissimo_pickup_area_id)
|
||||
->findOneOrCreate()
|
||||
->setCartAmount($cartAmount)
|
||||
->save();
|
||||
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
|
||||
return $this->generateRedirectFromRoute(
|
||||
'admin.module.configure',
|
||||
array(),
|
||||
array(
|
||||
'current_tab' => 'prices_slices_tab',
|
||||
'module_code' => 'ColissimoPickupPoint',
|
||||
'_controller' => 'Thelia\\Controller\\Admin\\ModuleController::configureAction',
|
||||
'price_error_id' => null,
|
||||
'price_error' => null
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
106
local/modules/ColissimoPickupPoint/Controller/GetSpecificLocation.php
Executable file
@@ -0,0 +1,106 @@
|
||||
<?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 ColissimoPickupPoint\Controller;
|
||||
|
||||
use ColissimoPickupPoint\ColissimoPickupPoint;
|
||||
use ColissimoPickupPoint\WebService\FindById;
|
||||
use Exception;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Thelia\Controller\Front\BaseFrontController;
|
||||
use Thelia\Core\HttpFoundation\Response;
|
||||
use Thelia\Core\Template\ParserInterface;
|
||||
use Thelia\Core\Template\TemplateDefinition;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
|
||||
/**
|
||||
* Class SearchCityController
|
||||
* @package IciRelais\Controller
|
||||
* @author Thelia <info@thelia.net>
|
||||
*/
|
||||
class GetSpecificLocation extends BaseFrontController
|
||||
{
|
||||
public function get($countryid, $zipcode, $city, $address="")
|
||||
{
|
||||
$content = $this->renderRaw(
|
||||
'getSpecificLocationColissimoPickupPoint',
|
||||
array(
|
||||
'_countryid_' => $countryid,
|
||||
'_zipcode_' => $zipcode,
|
||||
'_city_' => $city,
|
||||
'_address_' => $address
|
||||
)
|
||||
);
|
||||
$response = new Response($content, 200, $headers = array('Content-Type' => 'application/json'));
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function getPointInfo($point_id)
|
||||
{
|
||||
$req = new FindById();
|
||||
|
||||
$req->setId($point_id)
|
||||
->setLangue('FR')
|
||||
->setDate(date('d/m/Y'))
|
||||
->setAccountNumber(ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_USERNAME))
|
||||
->setPassword(ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_PASSWORD))
|
||||
;
|
||||
|
||||
$response = $req->exec();
|
||||
|
||||
$response = new JsonResponse($response);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function search()
|
||||
{
|
||||
$countryid = $this->getRequest()->query->get('countryid');
|
||||
$zipcode = $this->getRequest()->query->get('zipcode');
|
||||
$city = $this->getRequest()->query->get('city');
|
||||
$addressId = $this->getRequest()->query->get('address');
|
||||
|
||||
return $this->get($countryid, $zipcode, $city, $addressId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $template
|
||||
* @return ParserInterface instance parser
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function getParser($template = null)
|
||||
{
|
||||
$parser = $this->container->get('thelia.parser');
|
||||
|
||||
// Define the template that should be used
|
||||
$parser->setTemplateDefinition(
|
||||
new TemplateDefinition(
|
||||
'default',
|
||||
TemplateDefinition::FRONT_OFFICE
|
||||
)
|
||||
);
|
||||
|
||||
return $parser;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Controller;
|
||||
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Propel;
|
||||
use ColissimoPickupPoint\ColissimoPickupPoint;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Model\Map\OrderTableMap;
|
||||
use Thelia\Model\OrderQuery;
|
||||
use Thelia\Model\OrderStatusQuery;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
/**
|
||||
* Class ImportController
|
||||
* @package ColissimoPickupPoint\Controller
|
||||
* @author Etienne Perriere - OpenStudio <eperriere@openstudio.fr>
|
||||
*/
|
||||
class ImportController extends BaseAdminController
|
||||
{
|
||||
public function importAction()
|
||||
{
|
||||
$i = 0;
|
||||
|
||||
$con = Propel::getWriteConnection(OrderTableMap::DATABASE_NAME);
|
||||
$con->beginTransaction();
|
||||
|
||||
$form = $this->createForm('colissimo.pickup.point.import');
|
||||
|
||||
try {
|
||||
$vForm = $this->validateForm($form);
|
||||
|
||||
// Get file
|
||||
$importedFile = $vForm->getData()['import_file'];
|
||||
|
||||
// Check extension
|
||||
if (strtolower($importedFile->getClientOriginalExtension()) !='csv') {
|
||||
throw new FormValidationException(
|
||||
Translator::getInstance()->trans('Bad file format. CSV expected.',
|
||||
[],
|
||||
ColissimoPickupPoint::DOMAIN)
|
||||
);
|
||||
}
|
||||
|
||||
$csvData = file_get_contents($importedFile);
|
||||
$lines = explode(PHP_EOL, $csvData);
|
||||
|
||||
// For each line, parse columns
|
||||
foreach ($lines as $line) {
|
||||
$parsedLine = str_getcsv($line, ";");
|
||||
|
||||
// Get delivery and order ref
|
||||
$deliveryRef = $parsedLine[ColissimoPickupPoint::IMPORT_DELIVERY_REF_COL];
|
||||
$orderRef = $parsedLine[ColissimoPickupPoint::IMPORT_ORDER_REF_COL];
|
||||
|
||||
// Save delivery ref if there is one
|
||||
if (!empty($deliveryRef)) {
|
||||
$this->importDeliveryRef($deliveryRef, $orderRef, $i);
|
||||
}
|
||||
}
|
||||
|
||||
$con->commit();
|
||||
|
||||
// Get number of affected rows to display
|
||||
$this->getSession()->getFlashBag()->add(
|
||||
'import-result',
|
||||
Translator::getInstance()->trans(
|
||||
'Operation successful. %i orders affected.',
|
||||
['%i' => $i],
|
||||
ColissimoPickupPoint::DOMAIN
|
||||
)
|
||||
);
|
||||
|
||||
// Redirect
|
||||
return $this->generateRedirect(URL::getInstance()->absoluteUrl($form->getSuccessUrl(), ['current_tab' => 'import']));
|
||||
} catch (FormValidationException $e) {
|
||||
$con->rollback();
|
||||
|
||||
$this->setupFormErrorContext(null, $e->getMessage(), $form);
|
||||
|
||||
return $this->render(
|
||||
'module-configure',
|
||||
[
|
||||
'module_code' => ColissimoPickupPoint::getModuleCode(),
|
||||
'current_tab' => 'import'
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update order's delivery ref
|
||||
*
|
||||
* @param string $deliveryRef
|
||||
* @param string $orderRef
|
||||
* @param int $i
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function importDeliveryRef($deliveryRef, $orderRef, &$i)
|
||||
{
|
||||
// Check if the order exists
|
||||
if (null !== $order = OrderQuery::create()->findOneByRef($orderRef)) {
|
||||
$event = new OrderEvent($order);
|
||||
|
||||
// Check if delivery refs are different
|
||||
if ($order->getDeliveryRef() != $deliveryRef) {
|
||||
$event->setDeliveryRef($deliveryRef);
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_UPDATE_DELIVERY_REF, $event);
|
||||
|
||||
$sentStatusId = OrderStatusQuery::create()
|
||||
->filterByCode('sent')
|
||||
->select('ID')
|
||||
->findOne();
|
||||
|
||||
// Set 'sent' order status if not already sent
|
||||
if ($sentStatusId != null && $order->getStatusId() != $sentStatusId) {
|
||||
$event->setStatus($sentStatusId);
|
||||
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event);
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
51
local/modules/ColissimoPickupPoint/Controller/SaveConfig.php
Executable file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Controller;
|
||||
|
||||
use ColissimoPickupPoint\ColissimoPickupPoint;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use ColissimoPickupPoint\Form\ConfigureColissimoPickupPoint;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
class SaveConfig extends BaseAdminController
|
||||
{
|
||||
public function save()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(array(AdminResources::MODULE), array('ColissimoPickupPoint'), AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$form = new ConfigureColissimoPickupPoint($this->getRequest());
|
||||
try {
|
||||
$vform = $this->validateForm($form);
|
||||
|
||||
ColissimoPickupPoint::setConfigValue(ColissimoPickupPoint::COLISSIMO_USERNAME, $vform->get(ColissimoPickupPoint::COLISSIMO_USERNAME)->getData());
|
||||
ColissimoPickupPoint::setConfigValue(ColissimoPickupPoint::COLISSIMO_PASSWORD, $vform->get(ColissimoPickupPoint::COLISSIMO_PASSWORD)->getData());
|
||||
ColissimoPickupPoint::setConfigValue(ColissimoPickupPoint::COLISSIMO_GOOGLE_KEY, $vform->get(ColissimoPickupPoint::COLISSIMO_GOOGLE_KEY)->getData());
|
||||
ColissimoPickupPoint::setConfigValue(ColissimoPickupPoint::COLISSIMO_ENDPOINT, $vform->get(ColissimoPickupPoint::COLISSIMO_ENDPOINT)->getData());
|
||||
|
||||
return $this->generateRedirect(
|
||||
URL::getInstance()->absoluteUrl('/admin/module/ColissimoPickupPoint', ['current_tab' => 'configure'])
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
$this->setupFormErrorContext(
|
||||
Translator::getInstance()->trans('Colissimo Pickup Point update config'),
|
||||
$e->getMessage(),
|
||||
$form,
|
||||
$e
|
||||
);
|
||||
|
||||
return $this->render(
|
||||
'module-configure',
|
||||
[
|
||||
'module_code' => 'ColissimoPickupPoint',
|
||||
'current_tab' => 'configure',
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Controller;
|
||||
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlices;
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlicesQuery;
|
||||
use ColissimoPickupPoint\ColissimoPickupPoint;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
|
||||
class SliceController extends BaseAdminController
|
||||
{
|
||||
public function saveSliceAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(array(AdminResources::MODULE), ['ColissimoPickupPoint'], AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
$responseData = [
|
||||
'success' => false,
|
||||
'message' => '',
|
||||
'slice' => null
|
||||
];
|
||||
|
||||
$messages = [];
|
||||
$response = null;
|
||||
|
||||
try {
|
||||
$requestData = $this->getRequest()->request;
|
||||
|
||||
if (0 !== $id = (int)$requestData->get('id', 0)) {
|
||||
$slice = ColissimoPickupPointPriceSlicesQuery::create()->findPk($id);
|
||||
} else {
|
||||
$slice = new ColissimoPickupPointPriceSlices();
|
||||
}
|
||||
|
||||
|
||||
if (0 !== $areaId = (int)$requestData->get('area', 0)) {
|
||||
$slice->setAreaId($areaId);
|
||||
} else {
|
||||
$messages[] = $this->getTranslator()->trans(
|
||||
'The area is not valid',
|
||||
[],
|
||||
ColissimoPickupPoint::DOMAIN
|
||||
);
|
||||
}
|
||||
|
||||
$requestPriceMax = $requestData->get('priceMax', null);
|
||||
$requestWeightMax = $requestData->get('weightMax', null);
|
||||
|
||||
if (empty($requestPriceMax) && empty($requestWeightMax)) {
|
||||
$messages[] = $this->getTranslator()->trans(
|
||||
'You must specify at least a price max or a weight max value.',
|
||||
[],
|
||||
ColissimoPickupPoint::DOMAIN
|
||||
);
|
||||
} else {
|
||||
if (!empty($requestPriceMax)) {
|
||||
$priceMax = $this->getFloatVal($requestPriceMax);
|
||||
if (0 < $priceMax) {
|
||||
$slice->setPriceMax($priceMax);
|
||||
} else {
|
||||
$messages[] = $this->getTranslator()->trans(
|
||||
'The price max value is not valid',
|
||||
[],
|
||||
ColissimoPickupPoint::DOMAIN
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$slice->setPriceMax(null);
|
||||
}
|
||||
|
||||
if (!empty($requestWeightMax)) {
|
||||
$weightMax = $this->getFloatVal($requestWeightMax);
|
||||
if (0 < $weightMax) {
|
||||
$slice->setWeightMax($weightMax);
|
||||
} else {
|
||||
$messages[] = $this->getTranslator()->trans(
|
||||
'The weight max value is not valid',
|
||||
[],
|
||||
ColissimoPickupPoint::DOMAIN
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$slice->setWeightMax(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$price = $this->getFloatVal($requestData->get('price', 0));
|
||||
if (0 <= $price) {
|
||||
$slice->setPrice($price);
|
||||
} else {
|
||||
$messages[] = $this->getTranslator()->trans(
|
||||
'The price value is not valid',
|
||||
[],
|
||||
ColissimoPickupPoint::DOMAIN
|
||||
);
|
||||
}
|
||||
|
||||
if (0 === count($messages)) {
|
||||
$slice->save();
|
||||
$messages[] = $this->getTranslator()->trans(
|
||||
'Your slice has been saved',
|
||||
[],
|
||||
ColissimoPickupPoint::DOMAIN
|
||||
);
|
||||
|
||||
$responseData['success'] = true;
|
||||
$responseData['slice'] = $slice->toArray(TableMap::TYPE_STUDLYPHPNAME);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$message[] = $e->getMessage();
|
||||
}
|
||||
|
||||
$responseData['message'] = $messages;
|
||||
|
||||
return $this->jsonResponse(json_encode($responseData));
|
||||
}
|
||||
|
||||
protected function getFloatVal($val, $default = -1)
|
||||
{
|
||||
if (preg_match("#^([0-9\.,]+)$#", $val, $match)) {
|
||||
$val = $match[0];
|
||||
if (strstr($val, ",")) {
|
||||
$val = str_replace(".", "", $val);
|
||||
$val = str_replace(",", ".", $val);
|
||||
}
|
||||
$val = (float)$val;
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
return $default;
|
||||
}
|
||||
|
||||
public function deleteSliceAction()
|
||||
{
|
||||
$response = $this->checkAuth([], ['ColissimoPickupPoint'], AccessManager::DELETE);
|
||||
|
||||
if (null !== $response) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$this->checkXmlHttpRequest();
|
||||
|
||||
$responseData = [
|
||||
'success' => false,
|
||||
'message' => '',
|
||||
'slice' => null
|
||||
];
|
||||
|
||||
$response = null;
|
||||
|
||||
try {
|
||||
$requestData = $this->getRequest()->request;
|
||||
|
||||
if (0 !== $id = (int)$requestData->get('id', 0)) {
|
||||
$slice = ColissimoPickupPointPriceSlicesQuery::create()->findPk($id);
|
||||
$slice->delete();
|
||||
$responseData['success'] = true;
|
||||
} else {
|
||||
$responseData['message'] = $this->getTranslator()->trans(
|
||||
'The slice has not been deleted',
|
||||
[],
|
||||
ColissimoPickupPoint::DOMAIN
|
||||
);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$responseData['message'] = $e->getMessage();
|
||||
}
|
||||
|
||||
return $this->jsonResponse(json_encode($responseData));
|
||||
}
|
||||
}
|
||||
85
local/modules/ColissimoPickupPoint/Form/AddPriceForm.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Form;
|
||||
|
||||
use ColissimoPickupPoint\ColissimoPickupPoint;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Form\BaseForm;
|
||||
use Thelia\Model\AreaQuery;
|
||||
|
||||
class AddPriceForm extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add('area', 'integer', array(
|
||||
'constraints' => array(
|
||||
new Constraints\NotBlank(),
|
||||
new Constraints\Callback(array(
|
||||
'methods' => array(
|
||||
array($this,
|
||||
'verifyAreaExist')
|
||||
)
|
||||
))
|
||||
)
|
||||
))
|
||||
->add('weight', 'number', array(
|
||||
'constraints' => array(
|
||||
new Constraints\NotBlank(),
|
||||
new Constraints\Callback(array(
|
||||
'methods' => array(
|
||||
array($this,
|
||||
'verifyValidWeight')
|
||||
)
|
||||
))
|
||||
)
|
||||
))
|
||||
->add('price', 'number', array(
|
||||
'constraints' => array(
|
||||
new Constraints\NotBlank(),
|
||||
new Constraints\Callback(array(
|
||||
'methods' => array(
|
||||
array($this,
|
||||
'verifyValidPrice')
|
||||
)
|
||||
))
|
||||
)
|
||||
))
|
||||
->add('franco', 'number', array())
|
||||
;
|
||||
}
|
||||
|
||||
public function verifyAreaExist($value, ExecutionContextInterface $context)
|
||||
{
|
||||
$area = AreaQuery::create()->findPk($value);
|
||||
if (null === $area) {
|
||||
$context->addViolation(Translator::getInstance()->trans("This area doesn't exists.", [], ColissimoPickupPoint::DOMAIN));
|
||||
}
|
||||
}
|
||||
|
||||
public function verifyValidWeight($value, ExecutionContextInterface $context)
|
||||
{
|
||||
if (!preg_match("#^\d+\.?\d*$#", $value)) {
|
||||
$context->addViolation(Translator::getInstance()->trans("The weight value is not valid.", [], ColissimoPickupPoint::DOMAIN));
|
||||
}
|
||||
|
||||
if ($value < 0) {
|
||||
$context->addViolation(Translator::getInstance()->trans("The weight value must be superior to 0.", [], ColissimoPickupPoint::DOMAIN));
|
||||
}
|
||||
}
|
||||
|
||||
public function verifyValidPrice($value, ExecutionContextInterface $context)
|
||||
{
|
||||
if (!preg_match("#^\d+\.?\d*$#", $value)) {
|
||||
$context->addViolation(Translator::getInstance()->trans("The price value is not valid.", [], ColissimoPickupPoint::DOMAIN));
|
||||
}
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'colissimo_pickup_point_price_slices_create';
|
||||
}
|
||||
}
|
||||
121
local/modules/ColissimoPickupPoint/Form/ConfigureColissimoPickupPoint.php
Executable file
@@ -0,0 +1,121 @@
|
||||
<?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 ColissimoPickupPoint\Form;
|
||||
|
||||
use ColissimoPickupPoint\ColissimoPickupPoint;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Symfony\Component\Validator\Constraints\Url;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Form\BaseForm;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
|
||||
/**
|
||||
* Class ConfigureColissimoPickupPoint
|
||||
* @package ColissimoPickupPoint\Form
|
||||
* @author Thelia <info@thelia.net>
|
||||
*/
|
||||
class ConfigureColissimoPickupPoint extends BaseForm
|
||||
{
|
||||
/**
|
||||
*
|
||||
* in this function you add all the fields you need for your Form.
|
||||
* Form this you have to call add method on $this->formBuilder attribute :
|
||||
*
|
||||
* $this->formBuilder->add("name", "text")
|
||||
* ->add("email", "email", array(
|
||||
* "attr" => array(
|
||||
* "class" => "field"
|
||||
* ),
|
||||
* "label" => "email",
|
||||
* "constraints" => array(
|
||||
* new \Symfony\Component\Validator\Constraints\NotBlank()
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
* ->add('age', 'integer');
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
protected function buildForm()
|
||||
{
|
||||
$translator = Translator::getInstance();
|
||||
$this->formBuilder
|
||||
->add(
|
||||
ColissimoPickupPoint::COLISSIMO_USERNAME,
|
||||
TextType::class,
|
||||
[
|
||||
'constraints' => [new NotBlank()],
|
||||
'data' => ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_USERNAME),
|
||||
'label' => $translator->trans('Account number', [], ColissimoPickupPoint::DOMAIN),
|
||||
'label_attr' => ['for' => ColissimoPickupPoint::COLISSIMO_USERNAME]
|
||||
]
|
||||
)
|
||||
->add(
|
||||
ColissimoPickupPoint::COLISSIMO_PASSWORD,
|
||||
TextType::class,
|
||||
[
|
||||
'constraints' => [new NotBlank()],
|
||||
'data' => ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_PASSWORD),
|
||||
'label' => $translator->trans('Password', [], ColissimoPickupPoint::DOMAIN),
|
||||
'label_attr' => ['for' => ColissimoPickupPoint::COLISSIMO_PASSWORD]
|
||||
]
|
||||
)
|
||||
->add(
|
||||
ColissimoPickupPoint::COLISSIMO_ENDPOINT,
|
||||
TextType::class,
|
||||
[
|
||||
'constraints' => [
|
||||
new NotBlank(),
|
||||
new Url([
|
||||
'protocols' => ['https', 'http']
|
||||
])
|
||||
],
|
||||
'data' => ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_ENDPOINT),
|
||||
'label' => $translator->trans('Colissimo URL prod', [], ColissimoPickupPoint::DOMAIN),
|
||||
'label_attr' => ['for' => ColissimoPickupPoint::COLISSIMO_ENDPOINT]
|
||||
]
|
||||
)
|
||||
->add(
|
||||
ColissimoPickupPoint::COLISSIMO_GOOGLE_KEY,
|
||||
TextType::class,
|
||||
[
|
||||
'constraints' => [],
|
||||
'data' => ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_GOOGLE_KEY),
|
||||
'label' => $translator->trans('Google map API key', [], ColissimoPickupPoint::DOMAIN),
|
||||
'label_attr' => ['for' => ColissimoPickupPoint::COLISSIMO_GOOGLE_KEY]
|
||||
]
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the name of you form. This name must be unique
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'configurecolissimopickuppoint';
|
||||
}
|
||||
}
|
||||
121
local/modules/ColissimoPickupPoint/Form/ExportOrder.php
Executable file
@@ -0,0 +1,121 @@
|
||||
<?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 ColissimoPickupPoint\Form;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use ColissimoPickupPoint\ColissimoPickupPoint;
|
||||
use Thelia\Form\BaseForm;
|
||||
use Thelia\Model\Base\OrderQuery;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Model\Order;
|
||||
use Thelia\Model\OrderStatusQuery;
|
||||
use Thelia\Model\OrderStatus;
|
||||
|
||||
/**
|
||||
* Class ExportOrder
|
||||
* @package ColissimoPickupPoint\Form
|
||||
* @author Thelia <info@thelia.net>
|
||||
*/
|
||||
class ExportOrder extends BaseForm
|
||||
{
|
||||
/**
|
||||
*
|
||||
* in this function you add all the fields you need for your Form.
|
||||
* Form this you have to call add method on $this->formBuilder attribute :
|
||||
*
|
||||
* $this->formBuilder->add("name", "text")
|
||||
* ->add("email", "email", array(
|
||||
* "attr" => array(
|
||||
* "class" => "field"
|
||||
* ),
|
||||
* "label" => "email",
|
||||
* "constraints" => array(
|
||||
* new \Symfony\Component\Validator\Constraints\NotBlank()
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
* ->add('age', 'integer');
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
protected function buildForm()
|
||||
{
|
||||
$status = OrderStatusQuery::create()
|
||||
->filterByCode(
|
||||
array(
|
||||
OrderStatus::CODE_PAID,
|
||||
OrderStatus::CODE_PROCESSING,
|
||||
OrderStatus::CODE_SENT
|
||||
),
|
||||
Criteria::IN
|
||||
)
|
||||
->find()
|
||||
->toArray('code')
|
||||
;
|
||||
$query = OrderQuery::create()
|
||||
->filterByDeliveryModuleId(ColissimoPickupPoint::getModCode())
|
||||
->filterByStatusId(array($status['paid']['Id'], $status['processing']['Id']), Criteria::IN)
|
||||
->find();
|
||||
|
||||
$this->formBuilder
|
||||
->add('new_status_id', 'choice',array(
|
||||
'label' => Translator::getInstance()->trans('server'),
|
||||
'choices' => array(
|
||||
'nochange' => Translator::getInstance()->trans('Do not change'),
|
||||
'processing' => Translator::getInstance()->trans('Set orders status as processing'),
|
||||
'sent' => Translator::getInstance()->trans('Set orders status as sent')
|
||||
),
|
||||
'required' => 'true',
|
||||
'expanded' => true,
|
||||
'multiple' => false,
|
||||
'data' => 'nochange'
|
||||
)
|
||||
);
|
||||
/** @var Order $order */
|
||||
foreach ($query as $order) {
|
||||
$this->formBuilder
|
||||
->add(
|
||||
'order_' . $order->getId(),
|
||||
'checkbox',
|
||||
[
|
||||
'label' => $order->getRef(),
|
||||
'label_attr' => ['for' => 'export_' . $order->getId()]
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'order_weight_' . $order->getId(),
|
||||
'number'
|
||||
)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the name of you form. This name must be unique
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'exportcolissimopickuppointorder';
|
||||
}
|
||||
|
||||
}
|
||||
88
local/modules/ColissimoPickupPoint/Form/FreeShippingForm.php
Executable file
@@ -0,0 +1,88 @@
|
||||
<?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 ColissimoPickupPoint\Form;
|
||||
|
||||
use ColissimoPickupPoint\ColissimoPickupPoint;
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointFreeshippingQuery;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\NumberType;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Form\BaseForm;
|
||||
|
||||
class FreeShippingForm extends BaseForm
|
||||
{
|
||||
/**
|
||||
*
|
||||
* in this function you add all the fields you need for your Form.
|
||||
* Form this you have to call add method on $this->formBuilder attribute :
|
||||
*
|
||||
* $this->formBuilder->add("name", "text")
|
||||
* ->add("email", "email", array(
|
||||
* "attr" => array(
|
||||
* "class" => "field"
|
||||
* ),
|
||||
* "label" => "email",
|
||||
* "constraints" => array(
|
||||
* new \Symfony\Component\Validator\Constraints\NotBlank()
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
* ->add('age', 'integer');
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
'freeshipping',
|
||||
CheckboxType::class,
|
||||
[
|
||||
'label' => Translator::getInstance()->trans('Activate free shipping: ', [], ColissimoPickupPoint::DOMAIN)
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'freeshipping_from',
|
||||
NumberType::class,
|
||||
[
|
||||
'required' => false,
|
||||
'label' => Translator::getInstance()->trans("Free shipping from: ", [], ColissimoPickupPoint::DOMAIN),
|
||||
'data' => ColissimoPickupPointFreeshippingQuery::create()->findOneById(1)->getFreeshippingFrom(),
|
||||
'scale' => 2,
|
||||
]
|
||||
)
|
||||
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the name of you form. This name must be unique
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'colissimopickuppointfreeshipping';
|
||||
}
|
||||
|
||||
}
|
||||
37
local/modules/ColissimoPickupPoint/Form/ImportForm.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Form;
|
||||
|
||||
use ColissimoPickupPoint\ColissimoPickupPoint;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Form\BaseForm;
|
||||
|
||||
/**
|
||||
* Class ImportForm
|
||||
* @package ColissimoPickupPoint\Form
|
||||
* @author Etienne Perriere - OpenStudio <eperriere@openstudio.fr>
|
||||
*/
|
||||
class ImportForm extends BaseForm
|
||||
{
|
||||
public function getName()
|
||||
{
|
||||
return 'import_form';
|
||||
}
|
||||
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
'import_file', 'file',
|
||||
[
|
||||
'label' => Translator::getInstance()->trans('Select file to import', [], ColissimoPickupPoint::DOMAIN),
|
||||
'constraints' => [
|
||||
new Constraints\NotBlank(),
|
||||
new Constraints\File(['mimeTypes' => ['text/csv', 'text/plain']])
|
||||
],
|
||||
'label_attr' => ['for' => 'import_file']
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
68
local/modules/ColissimoPickupPoint/Form/UpdatePriceForm.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Form;
|
||||
|
||||
use ColissimoPickupPoint\ColissimoPickupPoint;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Form\BaseForm;
|
||||
use Thelia\Model\AreaQuery;
|
||||
|
||||
class UpdatePriceForm extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add('area', 'integer', array(
|
||||
'constraints' => array(
|
||||
new Constraints\NotBlank(),
|
||||
new Constraints\Callback(array(
|
||||
'methods' => array(
|
||||
array($this,
|
||||
'verifyAreaExist')
|
||||
)
|
||||
))
|
||||
)
|
||||
))
|
||||
->add('weight', 'number', array(
|
||||
'constraints' => array(
|
||||
new Constraints\NotBlank(),
|
||||
)
|
||||
))
|
||||
->add('price', 'number', array(
|
||||
'constraints' => array(
|
||||
new Constraints\NotBlank(),
|
||||
new Constraints\Callback(array(
|
||||
'methods' => array(
|
||||
array($this,
|
||||
'verifyValidPrice')
|
||||
)
|
||||
))
|
||||
)
|
||||
))
|
||||
->add('franco', 'number', array())
|
||||
;
|
||||
}
|
||||
|
||||
public function verifyAreaExist($value, ExecutionContextInterface $context)
|
||||
{
|
||||
$area = AreaQuery::create()->findPk($value);
|
||||
if (null === $area) {
|
||||
$context->addViolation(Translator::getInstance()->trans("This area doesn't exists.", [], ColissimoPickupPoint::DOMAIN));
|
||||
}
|
||||
}
|
||||
|
||||
public function verifyValidPrice($value, ExecutionContextInterface $context)
|
||||
{
|
||||
if (!preg_match("#^\d+\.?\d*$#", $value)) {
|
||||
$context->addViolation(Translator::getInstance()->trans('The price value is not valid.', [], ColissimoPickupPoint::DOMAIN));
|
||||
}
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'colissimo_pickup_point_price_slices_create';
|
||||
}
|
||||
}
|
||||
99
local/modules/ColissimoPickupPoint/Format/CSV.php
Executable file
@@ -0,0 +1,99 @@
|
||||
<?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 ColissimoPickupPoint\Format;
|
||||
|
||||
/**
|
||||
* Class CSV
|
||||
* @package ColissimoPickupPoint\Format
|
||||
* @author Thelia <info@thelia.net>
|
||||
*/
|
||||
class CSV
|
||||
{
|
||||
protected $separator;
|
||||
protected $lines=array();
|
||||
|
||||
const CRLF = "\r\n";
|
||||
/**
|
||||
* @param $separator
|
||||
* @param array $lines
|
||||
*/
|
||||
public function __construct($separator, array $lines=array())
|
||||
{
|
||||
$this->separator = $separator;
|
||||
|
||||
foreach ($lines as $line) {
|
||||
if ($line instanceof CSVLine) {
|
||||
$this->addLine($line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $separator
|
||||
* @param array $lines
|
||||
* @return CSV
|
||||
*/
|
||||
public static function create($separator, array $lines=array())
|
||||
{
|
||||
return new static($separator, $lines);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CSVLine $line
|
||||
* @return $this
|
||||
*/
|
||||
public function addLine(CSVLine $line)
|
||||
{
|
||||
$this->lines[] = $line;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string parsed CSV
|
||||
*/
|
||||
public function parse()
|
||||
{
|
||||
$buffer = '';
|
||||
|
||||
for ($j=0; $j < ($lineslen = count($this->lines)); ++$j) {
|
||||
/** @var CSVLine $line */
|
||||
$line = $this->lines[$j];
|
||||
$aline = $line->getValues();
|
||||
|
||||
for ($i=0; $i < ($linelen = count($aline)); ++$i) {
|
||||
$buffer .= '"' . $aline[$i] . '"';
|
||||
|
||||
if ($i !== $linelen-1) {
|
||||
$buffer .= $this->separator;
|
||||
}
|
||||
}
|
||||
if ($j !== $lineslen - 1) {
|
||||
$buffer .= self::CRLF;
|
||||
}
|
||||
}
|
||||
|
||||
return $buffer;
|
||||
}
|
||||
}
|
||||
67
local/modules/ColissimoPickupPoint/Format/CSVLine.php
Executable file
@@ -0,0 +1,67 @@
|
||||
<?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 ColissimoPickupPoint\Format;
|
||||
|
||||
/**
|
||||
* Class CSVLine
|
||||
* @package ColissimoPickupPoint\Format
|
||||
* @author Thelia <info@thelia.net>
|
||||
*/
|
||||
class CSVLine
|
||||
{
|
||||
protected $values = array();
|
||||
|
||||
public function __construct(array $values)
|
||||
{
|
||||
$this->values = $values;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $values
|
||||
* @return CSVLine
|
||||
*/
|
||||
public static function create(array $values)
|
||||
{
|
||||
return new static($values);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getValues()
|
||||
{
|
||||
return $this->values;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @return $this
|
||||
*/
|
||||
public function addValue($value)
|
||||
{
|
||||
$this->values[] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
23
local/modules/ColissimoPickupPoint/Hook/BackHook.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Hook;
|
||||
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
|
||||
/**
|
||||
* Class BackHook
|
||||
* @package ColissimoPickupPoint\Hook
|
||||
*/
|
||||
class BackHook extends BaseHook
|
||||
{
|
||||
public function onModuleConfiguration(HookRenderEvent $event)
|
||||
{
|
||||
$event->add($this->render('module_configuration.html'));
|
||||
}
|
||||
|
||||
public function onModuleConfigJs(HookRenderEvent $event)
|
||||
{
|
||||
$event->add($this->render('module-config-js.html'));
|
||||
}
|
||||
}
|
||||
41
local/modules/ColissimoPickupPoint/Hook/FrontHook.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?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 ColissimoPickupPoint\Hook;
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
|
||||
|
||||
/**
|
||||
* Class FrontHook
|
||||
* @package ColissimoPickupPoint\Hook
|
||||
* @author Michaël Espeche <mespeche@openstudio.fr>
|
||||
*/
|
||||
class FrontHook extends BaseHook {
|
||||
public function onOrderDeliveryExtra(HookRenderEvent $event)
|
||||
{
|
||||
$content = $this->render('colissimo-pickup-point.html', $event->getArguments());
|
||||
$event->add($content);
|
||||
}
|
||||
|
||||
public function onOrderInvoiceDeliveryAddress(HookRenderEvent $event)
|
||||
{
|
||||
$content = $this->render('delivery-address.html', $event->getArguments());
|
||||
$event->add($content);
|
||||
}
|
||||
|
||||
public function onMainHeadBottom(HookRenderEvent $event)
|
||||
{
|
||||
$content = $this->addCSS('assets/css/styles.css');
|
||||
$event->add($content);
|
||||
}
|
||||
}
|
||||
38
local/modules/ColissimoPickupPoint/Hook/PdfHook.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?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 ColissimoPickupPoint\Hook;
|
||||
|
||||
use ColissimoPickupPoint\ColissimoPickupPoint;
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
use Thelia\Model\OrderQuery;
|
||||
|
||||
class PdfHook extends BaseHook
|
||||
{
|
||||
public function onInvoiceAfterDeliveryModule(HookRenderEvent $event)
|
||||
{
|
||||
// No So Colissimo information if the delivery module is not ColissimoPickupPoint
|
||||
if (ColissimoPickupPoint::getModuleId() == $event->getArgument('module_id')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$order = OrderQuery::create()->findOneById($event->getArgument('order'));
|
||||
|
||||
if (!is_null($order)) {
|
||||
$event->add($this->render(
|
||||
'delivery_mode_infos.html',
|
||||
['delivery_address_id' => $order->getDeliveryOrderAddressId()]
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Export' => 'Export',
|
||||
'Export Coliship file' => 'Export Coliship file',
|
||||
);
|
||||
6
local/modules/ColissimoPickupPoint/I18n/AdminIncludes/fr_FR.php
Executable file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Export' => 'Export',
|
||||
'Export Coliship file' => 'Export de fichier Coliship',
|
||||
);
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'*If you choose this option, the exported orders would not be available on this page anymore' => '*If you choose this option, the exported orders would not be available on this page anymore',
|
||||
'Actions' => 'Actions',
|
||||
'Activate free shipping from (€) :' => 'Activate free shipping from (€) :',
|
||||
'Activate total free shipping ' => 'Activate total free shipping ',
|
||||
'Add this price slice' => 'Add this price slice',
|
||||
'Advanced configuration' => 'Advanced configuration',
|
||||
'An error occured' => 'An error occured',
|
||||
'Area : ' => 'Area : ',
|
||||
'Change orders status after export' => 'Change orders status after export',
|
||||
'Check all' => 'Check all',
|
||||
'Customer' => 'Customer',
|
||||
'Date' => 'Date',
|
||||
'Delete this price slice' => 'Delete this price slice',
|
||||
'Do not change' => 'Do not change',
|
||||
'Export' => 'Export',
|
||||
'Export Coliship file' => 'Export Coliship file',
|
||||
'If a cart matches multiple slices, it will take the last slice following that order.' => 'If a cart matches multiple slices, it will take the last slice following that order.',
|
||||
'If you don\'t specify a cart price in a slice, it will have priority over the other slices with the same weight.' => 'If you don\'t specify a cart price in a slice, it will have priority over the other slices with the same weight.',
|
||||
'If you don\'t specify a cart weight in a slice, it will have priority over the slices with weight.' => 'If you don\'t specify a cart weight in a slice, it will have priority over the slices with weight.',
|
||||
'If you specify both, the cart will require to have a lower weight AND a lower price in order to match the slice.' => 'If you specify both, the cart will require to have a lower weight AND a lower price in order to match the slice.',
|
||||
'Import Coliship file' => 'Import Coliship file',
|
||||
'Message' => 'Message',
|
||||
'Only use this for compatibility reason or if you have no other choice. For domicile delivery, you should use ColissimoWs instead.' => 'Only use this for compatibility reason or if you have no other choice. For domicile delivery, you should use ColissimoWs instead.',
|
||||
'Or activate free shipping from (€) :' => 'Or activate free shipping from (€) :',
|
||||
'Package weight' => 'Package weight',
|
||||
'Please change the access rights' => 'Please change the access rights',
|
||||
'Price (%symbol)' => 'Price (%symbol)',
|
||||
'Price slices for "%mode"' => 'Price slices for "%mode"',
|
||||
'Processing' => 'Processing',
|
||||
'REF' => 'REF',
|
||||
'Reverse selection' => 'Reverse selection',
|
||||
'Save' => 'Save',
|
||||
'Save changes' => 'Save changes',
|
||||
'Save this price slice' => 'Save this price slice',
|
||||
'Sent' => 'Sent',
|
||||
'The file has to be a CSV with 2 columns. The first contains the delivery reference, the second the order reference.' => 'The file has to be a CSV with 2 columns. The first contains the delivery reference, the second the order reference.',
|
||||
'The slices are ordered by maximum cart weight then by maximum cart price.' => 'The slices are ordered by maximum cart weight then by maximum cart price.',
|
||||
'Total taxed amount' => 'Total taxed amount',
|
||||
'Uncheck all' => 'Uncheck all',
|
||||
'Unknown customer' => 'Unknown customer',
|
||||
'Untaxed Price up to ... %symbol' => 'Untaxed Price up to ... %symbol',
|
||||
'Upload' => 'Upload',
|
||||
'Weight up to ... kg' => 'Weight up to ... kg',
|
||||
'You can create price slices by specifying a maximum cart weight and/or a maximum cart price.' => 'You can create price slices by specifying a maximum cart weight and/or a maximum cart price.',
|
||||
'You should first attribute shipping zones to the modules: ' => 'You should first attribute shipping zones to the modules: ',
|
||||
'manage shipping zones' => 'manage shipping zones',
|
||||
'operations' => 'operations',
|
||||
);
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'*If you choose this option, the exported orders would not be available on this page anymore' => '* Si vous choisissez cette option, les commandes exportées n\'apparaitront plus dans cette page',
|
||||
'Actions' => 'Actions',
|
||||
'Activate free shipping from (€) :' => 'Activer les frais de port gratuits à partir de (€)',
|
||||
'Activate total free shipping ' => 'Activer les frais de port gratuits',
|
||||
'Add this price slice' => 'Ajouter cette tranche de prix',
|
||||
'Advanced configuration' => 'Configuration avancée',
|
||||
'An error occured' => 'Une erreur est survenue',
|
||||
'Area : ' => 'Zone :',
|
||||
'Change orders status after export' => 'Modifier le statut des commandes après l\'export',
|
||||
'Check all' => 'Tout cocher',
|
||||
'Customer' => 'Client',
|
||||
'Date' => 'Date',
|
||||
'Delete this price slice' => 'Supprimer cette tranche de prix',
|
||||
'Do not change' => 'Ne pas modifier',
|
||||
'Export' => 'Export',
|
||||
'Export Coliship file' => 'Export de fichier Coliship',
|
||||
'If a cart matches multiple slices, it will take the last slice following that order.' => 'Si un panier correspond à plusieurs tranches, la dernière tranche sera prise en compte selon cet ordre.',
|
||||
'If you don\'t specify a cart price in a slice, it will have priority over the other slices with the same weight.' => 'Si vous ne renseignez pas de prix de panier max dans une tranche, elle aura la priorité sur les autres tranches ayant le même poids.',
|
||||
'If you don\'t specify a cart weight in a slice, it will have priority over the slices with weight.' => 'Si vous ne renseignez pas de poids max dans une tranche, elle aura la priorité sur les tranches ayant un poids.',
|
||||
'If you specify both, the cart will require to have a lower weight AND a lower price in order to match the slice.' => 'Si vous renseignez les deux, le panier devra avoir à la fois un poids inférieur ET un prix inférieur pour correspondre à cette tranche.',
|
||||
'Import Coliship file' => 'Import de fichier Coliship',
|
||||
'Message' => 'Message',
|
||||
'Only use this for compatibility reason or if you have no other choice. For domicile delivery, you should use ColissimoWs instead.' => 'N\'utilisez ceci que pour des raisons de compatibilité ou si vous n\'avez pas d\'autres choix. Pour la livraison à domicile, utilisez plutôt désormais le module ColissimoWs',
|
||||
'Or activate free shipping from (€) :' => 'Ou activer les frais de port gratuits à partir de (€)',
|
||||
'Package weight' => 'Poids des colis (kg)',
|
||||
'Please change the access rights' => 'Merci de modifier les droits d\'accès',
|
||||
'Price (%symbol)' => 'Frais de livraison (%symbol)',
|
||||
'Price slices for "%mode"' => 'Tranche de prix pour "%mode"',
|
||||
'Processing' => 'En cours',
|
||||
'REF' => 'REF',
|
||||
'Reverse selection' => 'Inverser la sélection',
|
||||
'Save' => 'Sauvegarder',
|
||||
'Save changes' => 'Enregistrer les modifications',
|
||||
'Save this price slice' => 'Enregistrer cette tranche de prix',
|
||||
'Sent' => 'Envoyé',
|
||||
'The file has to be a CSV with 2 columns. The first contains the delivery reference, the second the order reference.' => 'Le fichier doit être au format CSV et contenir 2 colonnes. La première indique les références colis, la seconde les références des commandes.',
|
||||
'The slices are ordered by maximum cart weight then by maximum cart price.' => 'Les tranches sont triés pour poids de panier max puis par prix de panier max.',
|
||||
'Total taxed amount' => 'Montant total (avec taxes)',
|
||||
'Uncheck all' => 'Tout décocher',
|
||||
'Unknown customer' => 'Client inconnu',
|
||||
'Untaxed Price up to ... %symbol' => 'Prix HT max du panier (%symbol)',
|
||||
'Upload' => 'Charger le fichier',
|
||||
'Weight up to ... kg' => 'Poids maximum (kg)',
|
||||
'You can create price slices by specifying a maximum cart weight and/or a maximum cart price.' => 'Vous pouvez créer des tranches de prix pour les frais de port en spécifiant un poids de panier maximum et/ou un prix de panier maximum.',
|
||||
'You should first attribute shipping zones to the modules: ' => 'Vous devez d\'abord attribuer des zones de livraison à ce module :',
|
||||
'manage shipping zones' => 'Configurer les zones de livraison',
|
||||
'operations' => 'Opérations',
|
||||
);
|
||||
34
local/modules/ColissimoPickupPoint/I18n/en_US.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Account number' => 'Account number',
|
||||
'Activate free shipping: ' => 'Activate free shipping: ',
|
||||
'Bad file format. CSV expected.' => 'Bad file format. CSV expected.',
|
||||
'Can\'t read Config directory' => 'Can\'t read Config directory',
|
||||
'Can\'t read file' => 'Can\'t read file',
|
||||
'Colissimo URL prod' => 'Colissimo URL prod',
|
||||
'Do not change' => 'Do not change',
|
||||
'Google map API key' => 'Google map API key',
|
||||
'No relay points were selected' => 'No relay points were selected',
|
||||
'Operation successful. %i orders affected.' => 'Operation successful. %i orders affected.',
|
||||
'Password' => 'Password',
|
||||
'Select file to import' => 'Select file to import',
|
||||
'Set orders status as processing' => 'Set orders status as processing',
|
||||
'Set orders status as sent' => 'Set orders status as sent',
|
||||
'So Colissimo update config' => 'So Colissimo update config',
|
||||
'The area is not valid' => 'The area is not valid',
|
||||
'The delivery mode is not valid' => 'The delivery mode is not valid',
|
||||
'The price max value is not valid' => 'The price max value is not valid',
|
||||
'The price value is not valid' => 'The price value is not valid',
|
||||
'The price value is not valid.' => 'The price value is not valid.',
|
||||
'The slice has not been deleted' => 'The slice has not been deleted',
|
||||
'The weight max value is not valid' => 'The weight max value is not valid',
|
||||
'The weight value is not valid.' => 'The weight value is not valid.',
|
||||
'The weight value must be superior to 0.' => 'The weight value must be superior to 0.',
|
||||
'This area doesn\'t exists.' => 'This area doesn\'t exists.',
|
||||
'This delivery mode doesn\'t exists.' => 'This delivery mode doesn\'t exists.',
|
||||
'You must specify at least a price max or a weight max value.' => 'You must specify at least a price max or a weight max value.',
|
||||
'Your slice has been saved' => 'Your slice has been saved',
|
||||
'[DEPRECATED] Activate Dom delivery' => '[DEPRECATED] Activate Dom delivery',
|
||||
'server' => 'server',
|
||||
);
|
||||
34
local/modules/ColissimoPickupPoint/I18n/fr_FR.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Account number' => 'Numéro de compte',
|
||||
'Activate free shipping: ' => 'Livraison offerte: ',
|
||||
'Bad file format. CSV expected.' => 'Mauvais format de fichier. CSV attendu.',
|
||||
'Can\'t read Config directory' => 'Le dossier Config ne peut être lu',
|
||||
'Can\'t read file' => 'Le fichier suivant ne peut être lu',
|
||||
'Colissimo URL prod' => 'URL de Colissimo en production',
|
||||
'Do not change' => 'Ne pas changer',
|
||||
'Google map API key' => 'Clé API Google map',
|
||||
'No relay points were selected' => 'Aucun point relais n\'a été sélectionné',
|
||||
'Operation successful. %i orders affected.' => 'Opération effectuée avec succès. %i commandes affectées.',
|
||||
'Password' => 'Mot de passe',
|
||||
'Select file to import' => 'Sélectionner un fichier à importer',
|
||||
'Set orders status as processing' => 'En traitement',
|
||||
'Set orders status as sent' => 'Envoyée',
|
||||
'So Colissimo update config' => 'Mise à jour de la configuration de So Colissimo ',
|
||||
'The area is not valid' => 'La zone de livraison n\'est pas valide.',
|
||||
'The delivery mode is not valid' => 'Le mode de livraison n\'est pas valide.',
|
||||
'The price max value is not valid' => 'Le prix maximum n\'est pas valide.',
|
||||
'The price value is not valid' => 'Les frais de livraison ne sont pas valides.',
|
||||
'The price value is not valid.' => 'Le prix n\'est pas valide.',
|
||||
'The slice has not been deleted' => 'La tranche n\'a pas été supprimée.',
|
||||
'The weight max value is not valid' => 'Le poids maximum n\'est pas valide.',
|
||||
'The weight value is not valid.' => 'Le poids n\'est pas valide.',
|
||||
'The weight value must be superior to 0.' => 'Le poids doit être supérieur à 0.',
|
||||
'This area doesn\'t exists.' => 'Cette zone n\'existe pas.',
|
||||
'This delivery mode doesn\'t exists.' => 'Ce mode de livraison n\'existe pas.',
|
||||
'You must specify at least a price max or a weight max value.' => 'Vous devez spécifier au moins un prix maximum ou un poids maximum.',
|
||||
'Your slice has been saved' => 'Votre tranche a été enregistrée.',
|
||||
'[DEPRECATED] Activate Dom delivery' => '[DEPRECIE] Activer la livraison à domicile',
|
||||
'server' => 'Serveur',
|
||||
);
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Actual address can\'t be geolocated' => 'Actual address can\'t be geolocated',
|
||||
'Automatic pickup point' => 'Automatic pickup point',
|
||||
'Choose this delivery mode' => 'Choose this delivery mode',
|
||||
'Colissimo is unavailable. Please choose another delivery method' => 'Colissimo is unavailable. Please choose another delivery method',
|
||||
'Delivery address' => 'Delivery address',
|
||||
'Delivery in France in one of the 500 automatic instructions 7/7 and 24h/24.' => 'Delivery in France in one of the 500 automatic instructions 7/7 and 24h/24.',
|
||||
'Delivery in one of the 10,000 collection points La Poste in France or in a post office in Europe.' => 'Delivery in one of the 10,000 collection points La Poste in France or in a post office in Europe.',
|
||||
'Delivery in one of the 7,500 shops in the PICKUP network.' => 'Delivery in one of the 7,500 shops in the PICKUP network.',
|
||||
'Delivery to you or a personal address of your choice.' => 'Delivery to you or a personal address of your choice.',
|
||||
'Friday' => 'Friday',
|
||||
'Monday' => 'Monday',
|
||||
'My home' => 'My home',
|
||||
'Near you' => 'Near you',
|
||||
'No relay points were selected' => 'No relay points were selected',
|
||||
'Pickup shop' => 'Pickup shop',
|
||||
'Please enter a city and a zipcode' => 'Please enter a city and a zipcode',
|
||||
'Post office' => 'Post office',
|
||||
'Saturday' => 'Saturday',
|
||||
'Search' => 'Search',
|
||||
'Search Colissimo relay in a city' => 'Search Colissimo relay in a city',
|
||||
'Sunday' => 'Sunday',
|
||||
'Thursday' => 'Thursday',
|
||||
'Tuesday' => 'Tuesday',
|
||||
'Wednesday' => 'Wednesday',
|
||||
'address' => 'address',
|
||||
'city' => 'city',
|
||||
'home delivery' => 'home delivery',
|
||||
'include in results' => 'include in results',
|
||||
'zipcode' => 'zipcode',
|
||||
);
|
||||
33
local/modules/ColissimoPickupPoint/I18n/frontOffice/default/fr_FR.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Actual address can\'t be geolocated' => 'Actual address can\'t be geolocated ',
|
||||
'Automatic pickup point' => 'En consigne Pickup Station',
|
||||
'Choose this delivery mode' => 'Choisir ce mode de livraison',
|
||||
'Colissimo is unavailable. Please choose another delivery method' => 'Colissimo est indisponible. Merci de choisir un autre moyen de livraison.',
|
||||
'Delivery address' => 'Adresse de livraison',
|
||||
'Delivery in France in one of the 500 automatic instructions 7/7 and 24h/24.' => 'Livraison en France dans l’une des 500 consignes automatiques de retrait accessibles 7j/7 et 24h/24 (sauf consignes soumises aux horaires des galeries marchandes et zones de transports).',
|
||||
'Delivery in one of the 10,000 collection points La Poste in France or in a post office in Europe.' => 'Livraison dans l\'un des 10 000 points de retrait La Poste en France ou dans un bureau de poste à l\'étranger.',
|
||||
'Delivery in one of the 7,500 shops in the PICKUP network.' => 'Livraison dans l’un des 7500 commerçants de proximité du réseau Pickup.',
|
||||
'Delivery to you or a personal address of your choice.' => '<p>Livraison chez vous ou à une adresse personnelle de votre choix avec tentative de remise en mains propres ou en boîte aux lettres.</p> <p>En cas d\'absence, remise en bureau de poste.</p>',
|
||||
'Friday' => 'Jeudi',
|
||||
'Monday' => 'Lundi',
|
||||
'My home' => 'Mon domicile',
|
||||
'Near you' => 'A proximité de chez vous',
|
||||
'No relay points were selected' => 'Aucun point relais n\'a été sélectionné',
|
||||
'Pickup shop' => 'En relais Pickup',
|
||||
'Please enter a city and a zipcode' => 'Merci de renseigner le code postal et la ville',
|
||||
'Post office' => 'En bureau de poste',
|
||||
'Saturday' => 'Samedi',
|
||||
'Search' => 'Rechercher',
|
||||
'Search Colissimo relay in a city' => 'Rechercher un point de retrait Colissimo dans une ville',
|
||||
'Sunday' => 'Dimanche',
|
||||
'Thursday' => 'Vendredi',
|
||||
'Tuesday' => 'Mardi',
|
||||
'Wednesday' => 'Mercredi',
|
||||
'address' => 'adresse',
|
||||
'city' => 'ville',
|
||||
'home delivery' => 'Livraison à domicile',
|
||||
'include in results' => 'inclure dans la recherche',
|
||||
'zipcode' => 'code postal',
|
||||
);
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Delivered at a relay.' => 'Delivered at a relay.',
|
||||
'Delivered at home.' => 'Delivered at home.',
|
||||
'Relay address:' => 'Relay address:',
|
||||
'no address' => 'no address',
|
||||
);
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Delivered at a relay.' => 'Livré en point relais.',
|
||||
'Delivered at home.' => 'Livré à domicile.',
|
||||
'Relay address:' => 'Adresse du point relais :',
|
||||
'no address' => 'Aucune adresse',
|
||||
);
|
||||
165
local/modules/ColissimoPickupPoint/LICENSE.txt
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.
|
||||
162
local/modules/ColissimoPickupPoint/Listener/APIListener.php
Normal file
@@ -0,0 +1,162 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace ColissimoPickupPoint\Listener;
|
||||
|
||||
|
||||
use ColissimoPickupPoint\ColissimoPickupPoint;
|
||||
use ColissimoPickupPoint\WebService\FindByAddress;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
|
||||
use Thelia\Core\Event\Delivery\PickupLocationEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\PickupLocation;
|
||||
use Thelia\Model\PickupLocationAddress;
|
||||
|
||||
class APIListener implements EventSubscriberInterface
|
||||
{
|
||||
/**
|
||||
* Calls the Colissimo API and returns a response containing the informations of the relay points found
|
||||
*
|
||||
* @param PickupLocationEvent $pickupLocationEvent
|
||||
* @return mixed
|
||||
*/
|
||||
protected function callWebService(PickupLocationEvent $pickupLocationEvent)
|
||||
{
|
||||
$countryCode = '';
|
||||
|
||||
if ($country = $pickupLocationEvent->getCountry()) {
|
||||
$countryCode = $country->getIsoalpha2();
|
||||
}
|
||||
|
||||
// Then ask the Web Service
|
||||
$request = new FindByAddress();
|
||||
$request
|
||||
->setAddress($pickupLocationEvent->getAddress())
|
||||
->setZipCode($pickupLocationEvent->getZipCode())
|
||||
->setCity($pickupLocationEvent->getCity())
|
||||
->setCountryCode($countryCode)
|
||||
->setFilterRelay('1')
|
||||
->setRequestId(md5(microtime()))
|
||||
->setLang('FR')
|
||||
->setOptionInter('1')
|
||||
->setShippingDate(date('d/m/Y'))
|
||||
->setAccountNumber(ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_USERNAME))
|
||||
->setPassword(ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_PASSWORD))
|
||||
;
|
||||
|
||||
try {
|
||||
$responses = $request->exec();
|
||||
} catch (InvalidArgumentException $e) {
|
||||
$responses = array();
|
||||
} catch (\SoapFault $e) {
|
||||
$responses = array();
|
||||
}
|
||||
|
||||
if (!is_array($responses) && $responses !== null) {
|
||||
$newResponse[] = $responses;
|
||||
$responses = $newResponse;
|
||||
}
|
||||
|
||||
return $responses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a new location address
|
||||
*
|
||||
* @param $response
|
||||
* @return PickupLocationAddress
|
||||
*/
|
||||
protected function createPickupLocationAddressFromResponse($response)
|
||||
{
|
||||
/** We create the new location address */
|
||||
$pickupLocationAddress = new PickupLocationAddress();
|
||||
|
||||
/** We set the differents properties of the location address */
|
||||
$pickupLocationAddress
|
||||
->setId($response->identifiant)
|
||||
->setTitle($response->nom)
|
||||
->setAddress1($response->adresse1)
|
||||
->setAddress2($response->adresse2)
|
||||
->setAddress3($response->adresse3)
|
||||
->setCity($response->localite)
|
||||
->setZipCode($response->codePostal)
|
||||
->setPhoneNumber('')
|
||||
->setCellphoneNumber('')
|
||||
->setCompany('')
|
||||
->setCountryCode($response->codePays)
|
||||
->setFirstName('')
|
||||
->setLastName('')
|
||||
->setIsDefault(0)
|
||||
->setLabel('')
|
||||
->setAdditionalData([])
|
||||
;
|
||||
|
||||
return $pickupLocationAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates then returns a location from a response of the WebService
|
||||
*
|
||||
* @param $response
|
||||
* @return PickupLocation
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function createPickupLocationFromResponse($response)
|
||||
{
|
||||
/** We create the new location */
|
||||
$pickupLocation = new PickupLocation();
|
||||
|
||||
/** We set the differents properties of the location */
|
||||
$pickupLocation
|
||||
->setId($response->identifiant)
|
||||
->setTitle($response->nom)
|
||||
->setAddress($this->createPickupLocationAddressFromResponse($response))
|
||||
->setLatitude($response->coordGeolocalisationLatitude)
|
||||
->setLongitude($response->coordGeolocalisationLongitude)
|
||||
->setOpeningHours(PickupLocation::MONDAY_OPENING_HOURS_KEY, $response->horairesOuvertureLundi)
|
||||
->setOpeningHours(PickupLocation::TUESDAY_OPENING_HOURS_KEY, $response->horairesOuvertureMardi)
|
||||
->setOpeningHours(PickupLocation::WEDNESDAY_OPENING_HOURS_KEY, $response->horairesOuvertureMercredi)
|
||||
->setOpeningHours(PickupLocation::THURSDAY_OPENING_HOURS_KEY, $response->horairesOuvertureJeudi)
|
||||
->setOpeningHours(PickupLocation::FRIDAY_OPENING_HOURS_KEY, $response->horairesOuvertureVendredi)
|
||||
->setOpeningHours(PickupLocation::SATURDAY_OPENING_HOURS_KEY, $response->horairesOuvertureSamedi)
|
||||
->setOpeningHours(PickupLocation::SUNDAY_OPENING_HOURS_KEY, $response->horairesOuvertureDimanche)
|
||||
->setModuleId(ColissimoPickupPoint::getModuleId())
|
||||
;
|
||||
|
||||
return $pickupLocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of locations (relay points)
|
||||
*
|
||||
* @param PickupLocationEvent $pickupLocationEvent
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getPickupLocations(PickupLocationEvent $pickupLocationEvent)
|
||||
{
|
||||
if (null !== $moduleIds = $pickupLocationEvent->getModuleIds()) {
|
||||
if (!in_array(ColissimoPickupPoint::getModuleId(), $moduleIds)) {
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
$responses = $this->callWebService($pickupLocationEvent);
|
||||
|
||||
foreach ($responses as $response) {
|
||||
$pickupLocationEvent->appendLocation($this->createPickupLocationFromResponse($response));
|
||||
}
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
$listenedEvents = [];
|
||||
|
||||
/** Check for old versions of Thelia where the events used by the API didn't exists */
|
||||
if (class_exists(PickupLocation::class)) {
|
||||
$listenedEvents[TheliaEvents::MODULE_DELIVERY_GET_PICKUP_LOCATIONS] = array("getPickupLocations", 128);
|
||||
}
|
||||
|
||||
return $listenedEvents;
|
||||
}
|
||||
}
|
||||
123
local/modules/ColissimoPickupPoint/Listener/SendMail.php
Executable file
@@ -0,0 +1,123 @@
|
||||
<?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 ColissimoPickupPoint\Listener;
|
||||
|
||||
use ColissimoPickupPoint\ColissimoPickupPoint;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Template\ParserInterface;
|
||||
use Thelia\Mailer\MailerFactory;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\MessageQuery;
|
||||
|
||||
/**
|
||||
* Class SendMail
|
||||
* @package Colissimo\Listener
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class SendMail implements EventSubscriberInterface
|
||||
{
|
||||
|
||||
protected $parser;
|
||||
|
||||
protected $mailer;
|
||||
|
||||
public function __construct(ParserInterface $parser, MailerFactory $mailer)
|
||||
{
|
||||
$this->parser = $parser;
|
||||
$this->mailer = $mailer;
|
||||
}
|
||||
|
||||
public function updateStatus(OrderEvent $event)
|
||||
{
|
||||
$order = $event->getOrder();
|
||||
$colissimoPickupPoint = new ColissimoPickupPoint();
|
||||
|
||||
if ($order->isSent() && $order->getDeliveryModuleId() == $colissimoPickupPoint->getModuleModel()->getId()) {
|
||||
$contact_email = ConfigQuery::read('store_email');
|
||||
|
||||
if ($contact_email) {
|
||||
|
||||
$message = MessageQuery::create()
|
||||
->filterByName('mail_colissimo_pickup_point')
|
||||
->findOne();
|
||||
|
||||
if (false === $message || null === $message) {
|
||||
throw new \Exception("Failed to load message 'order_confirmation'.");
|
||||
}
|
||||
|
||||
$order = $event->getOrder();
|
||||
$customer = $order->getCustomer();
|
||||
|
||||
$this->parser->assign('customer_id', $customer->getId());
|
||||
$this->parser->assign('order_ref', $order->getRef());
|
||||
$this->parser->assign('order_date', $order->getCreatedAt());
|
||||
$this->parser->assign('update_date', $order->getUpdatedAt());
|
||||
$this->parser->assign('package', $order->getDeliveryRef());
|
||||
|
||||
$message
|
||||
->setLocale($order->getLang()->getLocale());
|
||||
|
||||
$instance = \Swift_Message::newInstance()
|
||||
->addTo($customer->getEmail(), $customer->getFirstname() . ' ' . $customer->getLastname())
|
||||
->addFrom($contact_email, ConfigQuery::read('store_name'))
|
||||
;
|
||||
|
||||
// Build subject and body
|
||||
|
||||
$message->buildMessage($this->parser, $instance);
|
||||
|
||||
$this->mailer->send($instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of event names this subscriber wants to listen to.
|
||||
*
|
||||
* The array keys are event names and the value can be:
|
||||
*
|
||||
* * The method name to call (priority defaults to 0)
|
||||
* * An array composed of the method name to call and the priority
|
||||
* * An array of arrays composed of the method names to call and respective
|
||||
* priorities, or 0 if unset
|
||||
*
|
||||
* For instance:
|
||||
*
|
||||
* * array('eventName' => 'methodName')
|
||||
* * array('eventName' => array('methodName', $priority))
|
||||
* * array('eventName' => array(array('methodName1', $priority), array('methodName2'))
|
||||
*
|
||||
* @return array The event names to listen to
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
TheliaEvents::ORDER_UPDATE_STATUS => array('updateStatus', 128)
|
||||
);
|
||||
}
|
||||
}
|
||||
249
local/modules/ColissimoPickupPoint/Listener/SetDeliveryModule.php
Executable file
@@ -0,0 +1,249 @@
|
||||
<?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 ColissimoPickupPoint\Listener;
|
||||
|
||||
use ColissimoPickupPoint\Utils\ColissimoCodeReseau;
|
||||
use ColissimoPickupPoint\WebService\FindById;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Core\Event\Delivery\DeliveryPostageEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Model\Address;
|
||||
use Thelia\Model\CountryQuery;
|
||||
use Thelia\Model\OrderAddressQuery;
|
||||
use ColissimoPickupPoint\ColissimoPickupPoint;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Model\AddressQuery;
|
||||
use ColissimoPickupPoint\Model\AddressColissimoPickupPointQuery;
|
||||
use ColissimoPickupPoint\Model\AddressColissimoPickupPoint;
|
||||
use ColissimoPickupPoint\Model\OrderAddressColissimoPickupPoint;
|
||||
|
||||
/**
|
||||
* Class SetDeliveryModule
|
||||
* @package ColissimoPickupPoint\Listener
|
||||
* @author Thelia <info@thelia.net>
|
||||
*/
|
||||
class SetDeliveryModule implements EventSubscriberInterface
|
||||
{
|
||||
protected $request;
|
||||
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public function getRequest()
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
protected function check_module($id)
|
||||
{
|
||||
return $id == ColissimoPickupPoint::getModCode();
|
||||
}
|
||||
|
||||
private function callWebServiceFindRelayPointByIdFromRequest(Request $request)
|
||||
{
|
||||
$relay_infos = explode(':', $request->get('colissimo_pickup_point_code'));
|
||||
|
||||
$pr_code = $relay_infos[0];
|
||||
$relayType = count($relay_infos) > 1 ? $relay_infos[1] : null ;
|
||||
$relayCountryCode = count($relay_infos) > 2 ? $relay_infos[2] : null ;
|
||||
|
||||
if (!empty($pr_code)) {
|
||||
$req = new FindById();
|
||||
|
||||
$req->setId($pr_code)
|
||||
->setLangue('FR')
|
||||
->setDate(date('d/m/Y'))
|
||||
->setAccountNumber(ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_USERNAME))
|
||||
->setPassword(ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_PASSWORD));
|
||||
|
||||
// An argument "Code réseau" is now required in addition to the Relay Point Code to identify a relay point outside France.
|
||||
// This argument is optional for relay points inside France.
|
||||
if ($relayType != null && $relayCountryCode != null) {
|
||||
$codeReseau = ColissimoCodeReseau::getCodeReseau($relayCountryCode, $relayType);
|
||||
if ($codeReseau !== null) {
|
||||
$req->setReseau($codeReseau);
|
||||
}
|
||||
}
|
||||
|
||||
return $req->exec();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function isModuleColissimoPickupPoint(OrderEvent $event)
|
||||
{
|
||||
if ($this->check_module($event->getDeliveryModule())) {
|
||||
$request = $this->getRequest();
|
||||
|
||||
$address = AddressColissimoPickupPointQuery::create()
|
||||
->findPk($event->getDeliveryAddress());
|
||||
|
||||
$request->getSession()->set('ColissimoPickupPointDeliveryId', $event->getDeliveryAddress());
|
||||
if ($address === null) {
|
||||
$address = new AddressColissimoPickupPoint();
|
||||
$address->setId($event->getDeliveryAddress());
|
||||
}
|
||||
|
||||
$response = $this->callWebServiceFindRelayPointByIdFromRequest($request);
|
||||
|
||||
if ($response !== null) {
|
||||
$customerName = AddressQuery::create()
|
||||
->findPk($event->getDeliveryAddress());
|
||||
|
||||
$address = AddressColissimoPickupPointQuery::create()
|
||||
->findPk($event->getDeliveryAddress());
|
||||
|
||||
$request->getSession()->set('ColissimoPickupPointDeliveryId', $event->getDeliveryAddress());
|
||||
|
||||
if ($address === null) {
|
||||
$address = new AddressColissimoPickupPoint();
|
||||
$address->setId($event->getDeliveryAddress());
|
||||
}
|
||||
|
||||
$relayCountry = CountryQuery::create()->findOneByIsoalpha2($response->codePays);
|
||||
|
||||
if ($relayCountry == null) {
|
||||
$relayCountry = $customerName->getCountry();
|
||||
}
|
||||
|
||||
$address
|
||||
->setCode($response->identifiant)
|
||||
->setType($response->typeDePoint)
|
||||
->setCompany($response->nom)
|
||||
->setAddress1($response->adresse1)
|
||||
->setAddress2($response->adresse2)
|
||||
->setAddress3($response->adresse3)
|
||||
->setZipcode($response->codePostal)
|
||||
->setCity($response->localite)
|
||||
->setFirstname($customerName->getFirstname())
|
||||
->setLastname($customerName->getLastname())
|
||||
->setTitleId($customerName->getTitleId())
|
||||
->setCountryId($relayCountry->getId())
|
||||
->save()
|
||||
;
|
||||
} else {
|
||||
$message = Translator::getInstance()->trans('No pickup points were selected', [], ColissimoPickupPoint::DOMAIN);
|
||||
throw new \Exception($message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function updateDeliveryAddress(OrderEvent $event)
|
||||
{
|
||||
if ($this->check_module($event->getOrder()->getDeliveryModuleId())) {
|
||||
$request = $this->getRequest();
|
||||
|
||||
$tmp_address = AddressColissimoPickupPointQuery::create()
|
||||
->findPk($request->getSession()->get('ColissimoPickupPointDeliveryId'));
|
||||
|
||||
if ($tmp_address === null) {
|
||||
throw new \ErrorException('Got an error with ColissimoPickupPoint module. Please try again to checkout.');
|
||||
}
|
||||
|
||||
$savecode = new OrderAddressColissimoPickupPoint();
|
||||
|
||||
$savecode
|
||||
->setId($event->getOrder()->getDeliveryOrderAddressId())
|
||||
->setCode($tmp_address->getCode())
|
||||
->setType($tmp_address->getType())
|
||||
->save()
|
||||
;
|
||||
|
||||
$update = OrderAddressQuery::create()
|
||||
->findPK($event->getOrder()->getDeliveryOrderAddressId())
|
||||
->setCompany($tmp_address->getCompany())
|
||||
->setAddress1($tmp_address->getAddress1())
|
||||
->setAddress2($tmp_address->getAddress2())
|
||||
->setAddress3($tmp_address->getAddress3())
|
||||
->setZipcode($tmp_address->getZipcode())
|
||||
->setCity($tmp_address->getCity())
|
||||
->save()
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
public function getPostageRelayPoint(DeliveryPostageEvent $event)
|
||||
{
|
||||
if ($this->check_module($event->getModule()->getModuleModel()->getId())) {
|
||||
$request = $this->getRequest();
|
||||
|
||||
// If the relay point service was chosen, we store the address of the chosen relay point in
|
||||
// the DeliveryPostageEvent in order for Thelia to recalculate the postage cost from this address.
|
||||
|
||||
$response = $this->callWebServiceFindRelayPointByIdFromRequest($request);
|
||||
|
||||
if ($response !== null) {
|
||||
$address = new Address();
|
||||
$relayCountry = CountryQuery::create()->findOneByIsoalpha2($response->codePays);
|
||||
|
||||
$address
|
||||
->setCompany($response->nom)
|
||||
->setAddress1($response->adresse1)
|
||||
->setAddress2($response->adresse2)
|
||||
->setAddress3($response->adresse3)
|
||||
->setZipcode($response->codePostal)
|
||||
->setCity($response->localite)
|
||||
->setCountryId($relayCountry->getId())
|
||||
;
|
||||
|
||||
$event->setAddress($address);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of event names this subscriber wants to listen to.
|
||||
*
|
||||
* The array keys are event names and the value can be:
|
||||
*
|
||||
* * The method name to call (priority defaults to 0)
|
||||
* * An array composed of the method name to call and the priority
|
||||
* * An array of arrays composed of the method names to call and respective
|
||||
* priorities, or 0 if unset
|
||||
*
|
||||
* For instance:
|
||||
*
|
||||
* * array('eventName' => 'methodName')
|
||||
* * array('eventName' => array('methodName', $priority))
|
||||
* * array('eventName' => array(array('methodName1', $priority), array('methodName2'))
|
||||
*
|
||||
* @return array The event names to listen to
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
TheliaEvents::ORDER_SET_DELIVERY_MODULE => array('isModuleColissimoPickupPoint', 64),
|
||||
TheliaEvents::ORDER_BEFORE_PAYMENT => array('updateDeliveryAddress', 256),
|
||||
TheliaEvents::MODULE_DELIVERY_GET_POSTAGE => array('getPostageRelayPoint', 257)
|
||||
);
|
||||
}
|
||||
}
|
||||
54
local/modules/ColissimoPickupPoint/Loop/AreaFreeshipping.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Loop;
|
||||
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointAreaFreeshipping;
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointAreaFreeshippingQuery;
|
||||
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 AreaFreeshipping extends BaseLoop implements PropelSearchLoopInterface
|
||||
{
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntTypeArgument('area_id')
|
||||
);
|
||||
}
|
||||
|
||||
public function buildModelCriteria()
|
||||
{
|
||||
$areaId = $this->getAreaId();
|
||||
|
||||
$modes = ColissimoPickupPointAreaFreeshippingQuery::create();
|
||||
|
||||
if (null !== $areaId) {
|
||||
$modes->filterByAreaId($areaId);
|
||||
}
|
||||
|
||||
return $modes;
|
||||
}
|
||||
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
/** @var ColissimoPickupPointAreaFreeshipping $mode */
|
||||
foreach ($loopResult->getResultDataCollection() as $mode) {
|
||||
$loopResultRow = new LoopResultRow($mode);
|
||||
$loopResultRow
|
||||
->set('ID', $mode->getId())
|
||||
->set('AREA_ID', $mode->getAreaId())
|
||||
->set('CART_AMOUNT', $mode->getCartAmount());
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
return $loopResult;
|
||||
}
|
||||
|
||||
}
|
||||
78
local/modules/ColissimoPickupPoint/Loop/CheckRightsLoop.php
Executable file
@@ -0,0 +1,78 @@
|
||||
<?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 ColissimoPickupPoint\Loop;
|
||||
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\ArraySearchLoopInterface;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
/**
|
||||
* Class CheckRightsLoop
|
||||
* @package Colissimo\Looop
|
||||
* @author Thelia <info@thelia.net>
|
||||
*/
|
||||
|
||||
class CheckRightsLoop extends BaseLoop implements ArraySearchLoopInterface
|
||||
{
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection();
|
||||
}
|
||||
|
||||
public function buildArray()
|
||||
{
|
||||
$ret = array();
|
||||
$dir = __DIR__ . '/../Config/';
|
||||
if (!is_readable($dir)) {
|
||||
$ret[] = array('ERRMES' => Translator::getInstance()->trans("Can't read Config directory"), 'ERRFILE' => '');
|
||||
}
|
||||
if ($handle = opendir($dir)) {
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if (strlen($file) > 5 && substr($file, -5) === '.json') {
|
||||
if (!is_readable($dir.$file)) {
|
||||
$ret[] = array('ERRMES' => Translator::getInstance()->trans("Can't read file"), 'ERRFILE' => 'Colissimo/Config/' . $file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
foreach ($loopResult->getResultDataCollection() as $arr) {
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow
|
||||
->set('ERRMES', $arr['ERRMES'])
|
||||
->set('ERRFILE', $arr['ERRFILE'])
|
||||
;
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
83
local/modules/ColissimoPickupPoint/Loop/ColissimoPickupPointAddress.php
Executable file
@@ -0,0 +1,83 @@
|
||||
<?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 ColissimoPickupPoint\Loop;
|
||||
|
||||
use ColissimoPickupPoint\Model\AddressColissimoPickupPoint;
|
||||
use ColissimoPickupPoint\Model\AddressColissimoPickupPointQuery;
|
||||
use Thelia\Core\Template\Loop\Address;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
/**
|
||||
* class ColissimoPickupPointDelivery
|
||||
* @package ColissimoPickupPoint\Loop
|
||||
* @author Thelia <info@thelia.net>
|
||||
*/
|
||||
class ColissimoPickupPointAddress extends Address
|
||||
{
|
||||
protected $exists = false;
|
||||
protected $timestampable = false;
|
||||
|
||||
protected function setExists($id)
|
||||
{
|
||||
$this->exists = AddressColissimoPickupPointQuery::create()->findPK($id) !== null;
|
||||
}
|
||||
|
||||
public function buildModelCriteria()
|
||||
{
|
||||
$id = $this->getId();
|
||||
$this->setExists($id[0]);
|
||||
|
||||
return $this->exists ?
|
||||
AddressColissimoPickupPointQuery::create()->filterById($id[0]) :
|
||||
parent::buildModelCriteria();
|
||||
}
|
||||
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
if (!$this->exists) {
|
||||
return parent::parseResults($loopResult);
|
||||
}
|
||||
|
||||
/** @var AddressColissimoPickupPoint $address */
|
||||
foreach ($loopResult->getResultDataCollection() as $address) {
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow
|
||||
->set('TITLE', $address->getTitleId())
|
||||
->set('COMPANY', $address->getCompany())
|
||||
->set('FIRSTNAME', $address->getFirstname())
|
||||
->set('LASTNAME', $address->getLastname())
|
||||
->set('ADDRESS1', $address->getAddress1())
|
||||
->set('ADDRESS2', $address->getAddress2())
|
||||
->set('ADDRESS3', $address->getAddress3())
|
||||
->set('ZIPCODE', $address->getZipcode())
|
||||
->set('CITY', $address->getCity())
|
||||
->set('COUNTRY', $address->getCountryId())
|
||||
->set('CELLPHONE', $address->getCellphone())
|
||||
;
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace ColissimoPickupPoint\Loop;
|
||||
|
||||
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointFreeshipping;
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointFreeshippingQuery;
|
||||
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 ColissimoPickupPointFreeshippingLoop extends BaseLoop implements PropelSearchLoopInterface
|
||||
{
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntTypeArgument('id')
|
||||
);
|
||||
}
|
||||
|
||||
public function buildModelCriteria()
|
||||
{
|
||||
if (null === $isFreeShippingActive = ColissimoPickupPointFreeshippingQuery::create()->findOneById(1)){
|
||||
$isFreeShippingActive = new ColissimoPickupPointFreeshipping();
|
||||
$isFreeShippingActive->setId(1);
|
||||
$isFreeShippingActive->setActive(0);
|
||||
$isFreeShippingActive->save();
|
||||
}
|
||||
|
||||
return ColissimoPickupPointFreeshippingQuery::create()->filterById(1);
|
||||
}
|
||||
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
/** @var ColissimoPickupPointFreeshipping $freeshipping */
|
||||
foreach ($loopResult->getResultDataCollection() as $freeshipping) {
|
||||
$loopResultRow = new LoopResultRow($freeshipping);
|
||||
$loopResultRow
|
||||
->set('FREESHIPPING_ACTIVE', $freeshipping->getActive())
|
||||
->set('FREESHIPPING_FROM', $freeshipping->getFreeshippingFrom());
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
71
local/modules/ColissimoPickupPoint/Loop/ColissimoPickupPointId.php
Executable file
@@ -0,0 +1,71 @@
|
||||
<?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 ColissimoPickupPoint\Loop;
|
||||
use ColissimoPickupPoint\ColissimoPickupPoint;
|
||||
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\ArgumentCollection;
|
||||
|
||||
/**
|
||||
* class ColissimoPickupPointId
|
||||
* @package ColissimoPickupPoint\Loop
|
||||
* @author Thelia <info@thelia.net>
|
||||
*/
|
||||
class ColissimoPickupPointId extends BaseLoop implements ArraySearchLoopInterface
|
||||
{
|
||||
/**
|
||||
* this method returns an array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function buildArray()
|
||||
{
|
||||
return array(ColissimoPickupPoint::getModCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param LoopResult $loopResult
|
||||
*
|
||||
* @return LoopResult
|
||||
*/
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
foreach ($loopResult->getResultDataCollection() as $id) {
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResult->addRow(
|
||||
$loopResultRow->set('MODULE_ID', $id)
|
||||
);
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
}
|
||||
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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 ColissimoPickupPoint\Loop;
|
||||
|
||||
use ColissimoPickupPoint\Model\OrderAddressColissimoPickupPoint;
|
||||
use ColissimoPickupPoint\Model\OrderAddressColissimoPickupPointQuery;
|
||||
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 ColissimoPickupPointOrderAddressLoop extends BaseLoop implements PropelSearchLoopInterface
|
||||
{
|
||||
/**
|
||||
* Definition of loop arguments
|
||||
*
|
||||
* example :
|
||||
*
|
||||
* public function getArgDefinitions()
|
||||
* {
|
||||
* return new ArgumentCollection(
|
||||
*
|
||||
* Argument::createIntListTypeArgument('id'),
|
||||
* new Argument(
|
||||
* 'ref',
|
||||
* new TypeCollection(
|
||||
* new Type\AlphaNumStringListType()
|
||||
* )
|
||||
* ),
|
||||
* Argument::createIntListTypeArgument('category'),
|
||||
* Argument::createBooleanTypeArgument('new'),
|
||||
* ...
|
||||
* );
|
||||
* }
|
||||
*
|
||||
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntTypeArgument('id', null, true)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* this method returns a Propel ModelCriteria
|
||||
*
|
||||
* @return \Propel\Runtime\ActiveQuery\ModelCriteria
|
||||
*/
|
||||
public function buildModelCriteria()
|
||||
{
|
||||
$query = OrderAddressColissimoPickupPointQuery::create();
|
||||
|
||||
if (($id = $this->getId()) !== null) {
|
||||
$query->filterById((int)$id);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param LoopResult $loopResult
|
||||
*
|
||||
* @return LoopResult
|
||||
*/
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
/** @var OrderAddressColissimoPickupPoint $orderAddressColissimoPickupPoint */
|
||||
foreach ($loopResult->getResultDataCollection() as $orderAddressColissimoPickupPoint) {
|
||||
$row = new LoopResultRow();
|
||||
$row->set('ID', $orderAddressColissimoPickupPoint->getId());
|
||||
$row->set('CODE', $orderAddressColissimoPickupPoint->getCode());
|
||||
$row->set('TYPE', $orderAddressColissimoPickupPoint->getType());
|
||||
$loopResult->addRow($row)
|
||||
;
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Loop;
|
||||
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlicesQuery;
|
||||
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 ColissimoPickupPointPriceSlices extends BaseLoop implements PropelSearchLoopInterface
|
||||
{
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntTypeArgument('area_id', null, true)
|
||||
);
|
||||
}
|
||||
|
||||
public function buildModelCriteria()
|
||||
{
|
||||
$areaId = $this->getAreaId();
|
||||
|
||||
$areaPrices = ColissimoPickupPointPriceSlicesQuery::create()
|
||||
->filterByAreaId($areaId)
|
||||
->orderByWeightMax();
|
||||
|
||||
return $areaPrices;
|
||||
}
|
||||
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
/** @var \ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlices $price */
|
||||
foreach ($loopResult->getResultDataCollection() as $price) {
|
||||
$loopResultRow = new LoopResultRow($price);
|
||||
$loopResultRow
|
||||
->set('SLICE_ID', $price->getId())
|
||||
->set('MAX_WEIGHT', $price->getWeightMax())
|
||||
->set('MAX_PRICE', $price->getPriceMax())
|
||||
->set('PRICE', $price->getPrice())
|
||||
->set('FRANCO', $price->getFrancoMinPrice())
|
||||
;
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
179
local/modules/ColissimoPickupPoint/Loop/GetRelais.php
Executable file
@@ -0,0 +1,179 @@
|
||||
<?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 ColissimoPickupPoint\Loop;
|
||||
|
||||
use ColissimoPickupPoint\ColissimoPickupPoint;
|
||||
use ColissimoPickupPoint\WebService\FindByAddress;
|
||||
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
|
||||
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\Log\Tlog;
|
||||
use Thelia\Model\AddressQuery;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\CountryQuery;
|
||||
|
||||
/**
|
||||
* Class GetRelais
|
||||
* @package ColissimoPickupPoint\Loop
|
||||
* @author Thelia <info@thelia.net>
|
||||
*/
|
||||
class GetRelais extends BaseLoop implements ArraySearchLoopInterface
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntTypeArgument('countryid', ''),
|
||||
Argument::createAnyTypeArgument('zipcode', ''),
|
||||
Argument::createAnyTypeArgument('city', ''),
|
||||
Argument::createIntTypeArgument('address')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|mixed
|
||||
* @throws \ErrorException
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function buildArray()
|
||||
{
|
||||
// Find the address ... To find ! \m/
|
||||
$zipcode = $this->getZipcode();
|
||||
$city = $this->getCity();
|
||||
$countryId = $this->getCountryid();
|
||||
|
||||
$addressId = $this->getAddress();
|
||||
|
||||
if (!empty($addressId) && (!empty($zipcode) || !empty($city))) {
|
||||
throw new \InvalidArgumentException(
|
||||
"Cannot have argument 'address' and 'zipcode' or 'city' at the same time."
|
||||
);
|
||||
}
|
||||
|
||||
if (null !== $addressModel = AddressQuery::create()->findPk($addressId)) {
|
||||
$address = array(
|
||||
'zipcode' => $addressModel->getZipcode(),
|
||||
'city' => $addressModel->getCity(),
|
||||
'address' => $addressModel->getAddress1(),
|
||||
'countrycode' => $addressModel->getCountry()->getIsoalpha2()
|
||||
);
|
||||
} elseif (empty($zipcode) || empty($city)) {
|
||||
$search = AddressQuery::create();
|
||||
|
||||
$customer = $this->securityContext->getCustomerUser();
|
||||
if ($customer !== null) {
|
||||
$search->filterByCustomerId($customer->getId());
|
||||
$search->filterByIsDefault('1');
|
||||
} else {
|
||||
throw new \ErrorException('Customer not connected.');
|
||||
}
|
||||
|
||||
$search = $search->findOne();
|
||||
$address['zipcode'] = $search->getZipcode();
|
||||
$address['city'] = $search->getCity();
|
||||
$address['address'] = $search->getAddress1();
|
||||
$address['countrycode'] = $search->getCountry()->getIsoalpha2();
|
||||
} else {
|
||||
$address = array(
|
||||
'zipcode' => $zipcode,
|
||||
'city' => $city,
|
||||
'address' => '',
|
||||
'countrycode' => CountryQuery::create()
|
||||
->findOneById($countryId)
|
||||
->getIsoalpha2()
|
||||
);
|
||||
}
|
||||
|
||||
// Then ask the Web Service
|
||||
$request = new FindByAddress();
|
||||
$request
|
||||
->setAddress($address['address'])
|
||||
->setZipCode($address['zipcode'])
|
||||
->setCity($address['city'])
|
||||
->setCountryCode($address['countrycode'])
|
||||
->setFilterRelay('1')
|
||||
->setRequestId(md5(microtime()))
|
||||
->setLang('FR')
|
||||
->setOptionInter('1')
|
||||
->setShippingDate(date('d/m/Y'))
|
||||
->setAccountNumber(ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_USERNAME))
|
||||
->setPassword(ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_PASSWORD))
|
||||
;
|
||||
|
||||
try {
|
||||
$response = $request->exec();
|
||||
} catch (InvalidArgumentException $e) {
|
||||
$response = array();
|
||||
} catch (\SoapFault $e) {
|
||||
$response = array();
|
||||
}
|
||||
|
||||
if (!is_array($response) && $response !== null) {
|
||||
$newResponse[] = $response;
|
||||
$response = $newResponse;
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param LoopResult $loopResult
|
||||
*
|
||||
* @return LoopResult
|
||||
*/
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
foreach ($loopResult->getResultDataCollection() as $item) {
|
||||
$loopResultRow = new LoopResultRow();
|
||||
|
||||
//Tlog::getInstance()->addDebug(print_r($item, true));
|
||||
foreach ($item as $key => $value) {
|
||||
$loopResultRow->set($key, $value);
|
||||
}
|
||||
|
||||
// format distance
|
||||
$distance = (string) $loopResultRow->get('distanceEnMetre');
|
||||
if (strlen($distance) < 4) {
|
||||
$distance .= ' m';
|
||||
} else {
|
||||
$distance = (string)(float)$distance / 1000;
|
||||
while (substr($distance, strlen($distance) - 1, 1) == "0") {
|
||||
$distance = substr($distance, 0, strlen($distance) - 1);
|
||||
}
|
||||
$distance = str_replace('.', ',', $distance) . ' km';
|
||||
}
|
||||
$loopResultRow->set('distance', $distance);
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
75
local/modules/ColissimoPickupPoint/Loop/NotSentOrders.php
Executable file
@@ -0,0 +1,75 @@
|
||||
<?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 ColissimoPickupPoint\Loop;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use ColissimoPickupPoint\ColissimoPickupPoint;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Model\OrderQuery;
|
||||
use Thelia\Core\Template\Loop\Order;
|
||||
use Thelia\Model\OrderStatus;
|
||||
use Thelia\Model\OrderStatusQuery;
|
||||
|
||||
/**
|
||||
* Class NotSentOrders
|
||||
* @package ColissimoPickupPoint\Loop
|
||||
* @author Thelia <info@thelia.net>
|
||||
*/
|
||||
class NotSentOrders extends Order
|
||||
{
|
||||
public function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(Argument::createBooleanTypeArgument('with_prev_next_info', false));
|
||||
}
|
||||
|
||||
/**
|
||||
* this method returns a Propel ModelCriteria
|
||||
*
|
||||
* @return \Propel\Runtime\ActiveQuery\ModelCriteria
|
||||
*/
|
||||
public function buildModelCriteria()
|
||||
{
|
||||
$status = OrderStatusQuery::create()
|
||||
->filterByCode(
|
||||
array(
|
||||
OrderStatus::CODE_PAID,
|
||||
OrderStatus::CODE_PROCESSING,
|
||||
),
|
||||
Criteria::IN
|
||||
)
|
||||
->find()
|
||||
->toArray('code');
|
||||
$query = OrderQuery::create()
|
||||
->filterByDeliveryModuleId(ColissimoPickupPoint::getModCode())
|
||||
->filterByStatusId(
|
||||
array(
|
||||
$status[OrderStatus::CODE_PAID]['Id'],
|
||||
$status[OrderStatus::CODE_PROCESSING]['Id']),
|
||||
Criteria::IN
|
||||
);
|
||||
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Model;
|
||||
|
||||
use ColissimoPickupPoint\Model\Base\AddressColissimoPickupPoint as BaseAddressColissimoPickupPoint;
|
||||
|
||||
class AddressColissimoPickupPoint extends BaseAddressColissimoPickupPoint
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Model;
|
||||
|
||||
use ColissimoPickupPoint\Model\Base\AddressColissimoPickupPointQuery as BaseAddressColissimoPickupPointQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'address_colissimo_pickup_point' 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 AddressColissimoPickupPointQuery extends BaseAddressColissimoPickupPointQuery
|
||||
{
|
||||
|
||||
} // AddressColissimoPickupPointQuery
|
||||
@@ -0,0 +1,964 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use ColissimoPickupPoint\Model\AddressColissimoPickupPoint as ChildAddressColissimoPickupPoint;
|
||||
use ColissimoPickupPoint\Model\AddressColissimoPickupPointQuery as ChildAddressColissimoPickupPointQuery;
|
||||
use ColissimoPickupPoint\Model\Map\AddressColissimoPickupPointTableMap;
|
||||
use ColissimoPickupPoint\Model\Thelia\Model\Country;
|
||||
use ColissimoPickupPoint\Model\Thelia\Model\CustomerTitle;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'address_colissimo_pickup_point' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildAddressColissimoPickupPointQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildAddressColissimoPickupPointQuery orderByTitleId($order = Criteria::ASC) Order by the title_id column
|
||||
* @method ChildAddressColissimoPickupPointQuery orderByCompany($order = Criteria::ASC) Order by the company column
|
||||
* @method ChildAddressColissimoPickupPointQuery orderByFirstname($order = Criteria::ASC) Order by the firstname column
|
||||
* @method ChildAddressColissimoPickupPointQuery orderByLastname($order = Criteria::ASC) Order by the lastname column
|
||||
* @method ChildAddressColissimoPickupPointQuery orderByAddress1($order = Criteria::ASC) Order by the address1 column
|
||||
* @method ChildAddressColissimoPickupPointQuery orderByAddress2($order = Criteria::ASC) Order by the address2 column
|
||||
* @method ChildAddressColissimoPickupPointQuery orderByAddress3($order = Criteria::ASC) Order by the address3 column
|
||||
* @method ChildAddressColissimoPickupPointQuery orderByZipcode($order = Criteria::ASC) Order by the zipcode column
|
||||
* @method ChildAddressColissimoPickupPointQuery orderByCity($order = Criteria::ASC) Order by the city column
|
||||
* @method ChildAddressColissimoPickupPointQuery orderByCountryId($order = Criteria::ASC) Order by the country_id column
|
||||
* @method ChildAddressColissimoPickupPointQuery orderByCode($order = Criteria::ASC) Order by the code column
|
||||
* @method ChildAddressColissimoPickupPointQuery orderByType($order = Criteria::ASC) Order by the type column
|
||||
* @method ChildAddressColissimoPickupPointQuery orderByCellphone($order = Criteria::ASC) Order by the cellphone column
|
||||
*
|
||||
* @method ChildAddressColissimoPickupPointQuery groupById() Group by the id column
|
||||
* @method ChildAddressColissimoPickupPointQuery groupByTitleId() Group by the title_id column
|
||||
* @method ChildAddressColissimoPickupPointQuery groupByCompany() Group by the company column
|
||||
* @method ChildAddressColissimoPickupPointQuery groupByFirstname() Group by the firstname column
|
||||
* @method ChildAddressColissimoPickupPointQuery groupByLastname() Group by the lastname column
|
||||
* @method ChildAddressColissimoPickupPointQuery groupByAddress1() Group by the address1 column
|
||||
* @method ChildAddressColissimoPickupPointQuery groupByAddress2() Group by the address2 column
|
||||
* @method ChildAddressColissimoPickupPointQuery groupByAddress3() Group by the address3 column
|
||||
* @method ChildAddressColissimoPickupPointQuery groupByZipcode() Group by the zipcode column
|
||||
* @method ChildAddressColissimoPickupPointQuery groupByCity() Group by the city column
|
||||
* @method ChildAddressColissimoPickupPointQuery groupByCountryId() Group by the country_id column
|
||||
* @method ChildAddressColissimoPickupPointQuery groupByCode() Group by the code column
|
||||
* @method ChildAddressColissimoPickupPointQuery groupByType() Group by the type column
|
||||
* @method ChildAddressColissimoPickupPointQuery groupByCellphone() Group by the cellphone column
|
||||
*
|
||||
* @method ChildAddressColissimoPickupPointQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildAddressColissimoPickupPointQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildAddressColissimoPickupPointQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildAddressColissimoPickupPointQuery leftJoinCustomerTitle($relationAlias = null) Adds a LEFT JOIN clause to the query using the CustomerTitle relation
|
||||
* @method ChildAddressColissimoPickupPointQuery rightJoinCustomerTitle($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CustomerTitle relation
|
||||
* @method ChildAddressColissimoPickupPointQuery innerJoinCustomerTitle($relationAlias = null) Adds a INNER JOIN clause to the query using the CustomerTitle relation
|
||||
*
|
||||
* @method ChildAddressColissimoPickupPointQuery leftJoinCountry($relationAlias = null) Adds a LEFT JOIN clause to the query using the Country relation
|
||||
* @method ChildAddressColissimoPickupPointQuery rightJoinCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Country relation
|
||||
* @method ChildAddressColissimoPickupPointQuery innerJoinCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the Country relation
|
||||
*
|
||||
* @method ChildAddressColissimoPickupPoint findOne(ConnectionInterface $con = null) Return the first ChildAddressColissimoPickupPoint matching the query
|
||||
* @method ChildAddressColissimoPickupPoint findOneOrCreate(ConnectionInterface $con = null) Return the first ChildAddressColissimoPickupPoint matching the query, or a new ChildAddressColissimoPickupPoint object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildAddressColissimoPickupPoint findOneById(int $id) Return the first ChildAddressColissimoPickupPoint filtered by the id column
|
||||
* @method ChildAddressColissimoPickupPoint findOneByTitleId(int $title_id) Return the first ChildAddressColissimoPickupPoint filtered by the title_id column
|
||||
* @method ChildAddressColissimoPickupPoint findOneByCompany(string $company) Return the first ChildAddressColissimoPickupPoint filtered by the company column
|
||||
* @method ChildAddressColissimoPickupPoint findOneByFirstname(string $firstname) Return the first ChildAddressColissimoPickupPoint filtered by the firstname column
|
||||
* @method ChildAddressColissimoPickupPoint findOneByLastname(string $lastname) Return the first ChildAddressColissimoPickupPoint filtered by the lastname column
|
||||
* @method ChildAddressColissimoPickupPoint findOneByAddress1(string $address1) Return the first ChildAddressColissimoPickupPoint filtered by the address1 column
|
||||
* @method ChildAddressColissimoPickupPoint findOneByAddress2(string $address2) Return the first ChildAddressColissimoPickupPoint filtered by the address2 column
|
||||
* @method ChildAddressColissimoPickupPoint findOneByAddress3(string $address3) Return the first ChildAddressColissimoPickupPoint filtered by the address3 column
|
||||
* @method ChildAddressColissimoPickupPoint findOneByZipcode(string $zipcode) Return the first ChildAddressColissimoPickupPoint filtered by the zipcode column
|
||||
* @method ChildAddressColissimoPickupPoint findOneByCity(string $city) Return the first ChildAddressColissimoPickupPoint filtered by the city column
|
||||
* @method ChildAddressColissimoPickupPoint findOneByCountryId(int $country_id) Return the first ChildAddressColissimoPickupPoint filtered by the country_id column
|
||||
* @method ChildAddressColissimoPickupPoint findOneByCode(string $code) Return the first ChildAddressColissimoPickupPoint filtered by the code column
|
||||
* @method ChildAddressColissimoPickupPoint findOneByType(string $type) Return the first ChildAddressColissimoPickupPoint filtered by the type column
|
||||
* @method ChildAddressColissimoPickupPoint findOneByCellphone(string $cellphone) Return the first ChildAddressColissimoPickupPoint filtered by the cellphone column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildAddressColissimoPickupPoint objects filtered by the id column
|
||||
* @method array findByTitleId(int $title_id) Return ChildAddressColissimoPickupPoint objects filtered by the title_id column
|
||||
* @method array findByCompany(string $company) Return ChildAddressColissimoPickupPoint objects filtered by the company column
|
||||
* @method array findByFirstname(string $firstname) Return ChildAddressColissimoPickupPoint objects filtered by the firstname column
|
||||
* @method array findByLastname(string $lastname) Return ChildAddressColissimoPickupPoint objects filtered by the lastname column
|
||||
* @method array findByAddress1(string $address1) Return ChildAddressColissimoPickupPoint objects filtered by the address1 column
|
||||
* @method array findByAddress2(string $address2) Return ChildAddressColissimoPickupPoint objects filtered by the address2 column
|
||||
* @method array findByAddress3(string $address3) Return ChildAddressColissimoPickupPoint objects filtered by the address3 column
|
||||
* @method array findByZipcode(string $zipcode) Return ChildAddressColissimoPickupPoint objects filtered by the zipcode column
|
||||
* @method array findByCity(string $city) Return ChildAddressColissimoPickupPoint objects filtered by the city column
|
||||
* @method array findByCountryId(int $country_id) Return ChildAddressColissimoPickupPoint objects filtered by the country_id column
|
||||
* @method array findByCode(string $code) Return ChildAddressColissimoPickupPoint objects filtered by the code column
|
||||
* @method array findByType(string $type) Return ChildAddressColissimoPickupPoint objects filtered by the type column
|
||||
* @method array findByCellphone(string $cellphone) Return ChildAddressColissimoPickupPoint objects filtered by the cellphone column
|
||||
*
|
||||
*/
|
||||
abstract class AddressColissimoPickupPointQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \ColissimoPickupPoint\Model\Base\AddressColissimoPickupPointQuery 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 = '\\ColissimoPickupPoint\\Model\\AddressColissimoPickupPoint', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildAddressColissimoPickupPointQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildAddressColissimoPickupPointQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \ColissimoPickupPoint\Model\AddressColissimoPickupPointQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \ColissimoPickupPoint\Model\AddressColissimoPickupPointQuery();
|
||||
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 ChildAddressColissimoPickupPoint|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = AddressColissimoPickupPointTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(AddressColissimoPickupPointTableMap::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 ChildAddressColissimoPickupPoint A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, TITLE_ID, COMPANY, FIRSTNAME, LASTNAME, ADDRESS1, ADDRESS2, ADDRESS3, ZIPCODE, CITY, COUNTRY_ID, CODE, TYPE, CELLPHONE FROM address_colissimo_pickup_point 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 ChildAddressColissimoPickupPoint();
|
||||
$obj->hydrate($row);
|
||||
AddressColissimoPickupPointTableMap::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 ChildAddressColissimoPickupPoint|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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(AddressColissimoPickupPointTableMap::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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(AddressColissimoPickupPointTableMap::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 ChildAddressColissimoPickupPointQuery 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(AddressColissimoPickupPointTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(AddressColissimoPickupPointTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AddressColissimoPickupPointTableMap::ID, $id, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the title_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByTitleId(1234); // WHERE title_id = 1234
|
||||
* $query->filterByTitleId(array(12, 34)); // WHERE title_id IN (12, 34)
|
||||
* $query->filterByTitleId(array('min' => 12)); // WHERE title_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByCustomerTitle()
|
||||
*
|
||||
* @param mixed $titleId 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByTitleId($titleId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($titleId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($titleId['min'])) {
|
||||
$this->addUsingAlias(AddressColissimoPickupPointTableMap::TITLE_ID, $titleId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($titleId['max'])) {
|
||||
$this->addUsingAlias(AddressColissimoPickupPointTableMap::TITLE_ID, $titleId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AddressColissimoPickupPointTableMap::TITLE_ID, $titleId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the company column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCompany('fooValue'); // WHERE company = 'fooValue'
|
||||
* $query->filterByCompany('%fooValue%'); // WHERE company LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $company 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCompany($company = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($company)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $company)) {
|
||||
$company = str_replace('*', '%', $company);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AddressColissimoPickupPointTableMap::COMPANY, $company, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the firstname column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByFirstname('fooValue'); // WHERE firstname = 'fooValue'
|
||||
* $query->filterByFirstname('%fooValue%'); // WHERE firstname LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $firstname 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByFirstname($firstname = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($firstname)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $firstname)) {
|
||||
$firstname = str_replace('*', '%', $firstname);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AddressColissimoPickupPointTableMap::FIRSTNAME, $firstname, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the lastname column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByLastname('fooValue'); // WHERE lastname = 'fooValue'
|
||||
* $query->filterByLastname('%fooValue%'); // WHERE lastname LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $lastname 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByLastname($lastname = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($lastname)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $lastname)) {
|
||||
$lastname = str_replace('*', '%', $lastname);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AddressColissimoPickupPointTableMap::LASTNAME, $lastname, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the address1 column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByAddress1('fooValue'); // WHERE address1 = 'fooValue'
|
||||
* $query->filterByAddress1('%fooValue%'); // WHERE address1 LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $address1 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByAddress1($address1 = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($address1)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $address1)) {
|
||||
$address1 = str_replace('*', '%', $address1);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AddressColissimoPickupPointTableMap::ADDRESS1, $address1, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the address2 column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByAddress2('fooValue'); // WHERE address2 = 'fooValue'
|
||||
* $query->filterByAddress2('%fooValue%'); // WHERE address2 LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $address2 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByAddress2($address2 = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($address2)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $address2)) {
|
||||
$address2 = str_replace('*', '%', $address2);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AddressColissimoPickupPointTableMap::ADDRESS2, $address2, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the address3 column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByAddress3('fooValue'); // WHERE address3 = 'fooValue'
|
||||
* $query->filterByAddress3('%fooValue%'); // WHERE address3 LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $address3 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByAddress3($address3 = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($address3)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $address3)) {
|
||||
$address3 = str_replace('*', '%', $address3);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AddressColissimoPickupPointTableMap::ADDRESS3, $address3, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the zipcode column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByZipcode('fooValue'); // WHERE zipcode = 'fooValue'
|
||||
* $query->filterByZipcode('%fooValue%'); // WHERE zipcode LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $zipcode 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByZipcode($zipcode = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($zipcode)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $zipcode)) {
|
||||
$zipcode = str_replace('*', '%', $zipcode);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AddressColissimoPickupPointTableMap::ZIPCODE, $zipcode, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the city column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCity('fooValue'); // WHERE city = 'fooValue'
|
||||
* $query->filterByCity('%fooValue%'); // WHERE city LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $city 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCity($city = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($city)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $city)) {
|
||||
$city = str_replace('*', '%', $city);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AddressColissimoPickupPointTableMap::CITY, $city, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the country_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCountryId(1234); // WHERE country_id = 1234
|
||||
* $query->filterByCountryId(array(12, 34)); // WHERE country_id IN (12, 34)
|
||||
* $query->filterByCountryId(array('min' => 12)); // WHERE country_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByCountry()
|
||||
*
|
||||
* @param mixed $countryId 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCountryId($countryId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($countryId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($countryId['min'])) {
|
||||
$this->addUsingAlias(AddressColissimoPickupPointTableMap::COUNTRY_ID, $countryId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($countryId['max'])) {
|
||||
$this->addUsingAlias(AddressColissimoPickupPointTableMap::COUNTRY_ID, $countryId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AddressColissimoPickupPointTableMap::COUNTRY_ID, $countryId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the code column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCode('fooValue'); // WHERE code = 'fooValue'
|
||||
* $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $code 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCode($code = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($code)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $code)) {
|
||||
$code = str_replace('*', '%', $code);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AddressColissimoPickupPointTableMap::CODE, $code, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the type column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByType('fooValue'); // WHERE type = 'fooValue'
|
||||
* $query->filterByType('%fooValue%'); // WHERE type LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $type 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByType($type = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($type)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $type)) {
|
||||
$type = str_replace('*', '%', $type);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AddressColissimoPickupPointTableMap::TYPE, $type, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the cellphone column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCellphone('fooValue'); // WHERE cellphone = 'fooValue'
|
||||
* $query->filterByCellphone('%fooValue%'); // WHERE cellphone LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $cellphone 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 ChildAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCellphone($cellphone = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($cellphone)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $cellphone)) {
|
||||
$cellphone = str_replace('*', '%', $cellphone);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(AddressColissimoPickupPointTableMap::CELLPHONE, $cellphone, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \ColissimoPickupPoint\Model\Thelia\Model\CustomerTitle object
|
||||
*
|
||||
* @param \ColissimoPickupPoint\Model\Thelia\Model\CustomerTitle|ObjectCollection $customerTitle The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCustomerTitle($customerTitle, $comparison = null)
|
||||
{
|
||||
if ($customerTitle instanceof \ColissimoPickupPoint\Model\Thelia\Model\CustomerTitle) {
|
||||
return $this
|
||||
->addUsingAlias(AddressColissimoPickupPointTableMap::TITLE_ID, $customerTitle->getId(), $comparison);
|
||||
} elseif ($customerTitle instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(AddressColissimoPickupPointTableMap::TITLE_ID, $customerTitle->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByCustomerTitle() only accepts arguments of type \ColissimoPickupPoint\Model\Thelia\Model\CustomerTitle or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the CustomerTitle relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCustomerTitle($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('CustomerTitle');
|
||||
|
||||
// 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, 'CustomerTitle');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the CustomerTitle relation CustomerTitle 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 \ColissimoPickupPoint\Model\Thelia\Model\CustomerTitleQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCustomerTitleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCustomerTitle($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'CustomerTitle', '\ColissimoPickupPoint\Model\Thelia\Model\CustomerTitleQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \ColissimoPickupPoint\Model\Thelia\Model\Country object
|
||||
*
|
||||
* @param \ColissimoPickupPoint\Model\Thelia\Model\Country|ObjectCollection $country The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCountry($country, $comparison = null)
|
||||
{
|
||||
if ($country instanceof \ColissimoPickupPoint\Model\Thelia\Model\Country) {
|
||||
return $this
|
||||
->addUsingAlias(AddressColissimoPickupPointTableMap::COUNTRY_ID, $country->getId(), $comparison);
|
||||
} elseif ($country instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(AddressColissimoPickupPointTableMap::COUNTRY_ID, $country->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByCountry() only accepts arguments of type \ColissimoPickupPoint\Model\Thelia\Model\Country or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Country relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Country');
|
||||
|
||||
// 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, 'Country');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Country relation Country 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 \ColissimoPickupPoint\Model\Thelia\Model\CountryQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinCountry($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Country', '\ColissimoPickupPoint\Model\Thelia\Model\CountryQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildAddressColissimoPickupPoint $addressColissimoPickupPoint Object to remove from the list of results
|
||||
*
|
||||
* @return ChildAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($addressColissimoPickupPoint = null)
|
||||
{
|
||||
if ($addressColissimoPickupPoint) {
|
||||
$this->addUsingAlias(AddressColissimoPickupPointTableMap::ID, $addressColissimoPickupPoint->getId(), Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the address_colissimo_pickup_point 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(AddressColissimoPickupPointTableMap::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).
|
||||
AddressColissimoPickupPointTableMap::clearInstancePool();
|
||||
AddressColissimoPickupPointTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildAddressColissimoPickupPoint or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildAddressColissimoPickupPoint 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(AddressColissimoPickupPointTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(AddressColissimoPickupPointTableMap::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();
|
||||
|
||||
|
||||
AddressColissimoPickupPointTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
AddressColissimoPickupPointTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
} // AddressColissimoPickupPointQuery
|
||||
@@ -0,0 +1,519 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointAreaFreeshipping as ChildColissimoPickupPointAreaFreeshipping;
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointAreaFreeshippingQuery as ChildColissimoPickupPointAreaFreeshippingQuery;
|
||||
use ColissimoPickupPoint\Model\Map\ColissimoPickupPointAreaFreeshippingTableMap;
|
||||
use ColissimoPickupPoint\Model\Thelia\Model\Area;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'colissimo_pickup_point_area_freeshipping' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildColissimoPickupPointAreaFreeshippingQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildColissimoPickupPointAreaFreeshippingQuery orderByAreaId($order = Criteria::ASC) Order by the area_id column
|
||||
* @method ChildColissimoPickupPointAreaFreeshippingQuery orderByCartAmount($order = Criteria::ASC) Order by the cart_amount column
|
||||
*
|
||||
* @method ChildColissimoPickupPointAreaFreeshippingQuery groupById() Group by the id column
|
||||
* @method ChildColissimoPickupPointAreaFreeshippingQuery groupByAreaId() Group by the area_id column
|
||||
* @method ChildColissimoPickupPointAreaFreeshippingQuery groupByCartAmount() Group by the cart_amount column
|
||||
*
|
||||
* @method ChildColissimoPickupPointAreaFreeshippingQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildColissimoPickupPointAreaFreeshippingQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildColissimoPickupPointAreaFreeshippingQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildColissimoPickupPointAreaFreeshippingQuery leftJoinArea($relationAlias = null) Adds a LEFT JOIN clause to the query using the Area relation
|
||||
* @method ChildColissimoPickupPointAreaFreeshippingQuery rightJoinArea($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Area relation
|
||||
* @method ChildColissimoPickupPointAreaFreeshippingQuery innerJoinArea($relationAlias = null) Adds a INNER JOIN clause to the query using the Area relation
|
||||
*
|
||||
* @method ChildColissimoPickupPointAreaFreeshipping findOne(ConnectionInterface $con = null) Return the first ChildColissimoPickupPointAreaFreeshipping matching the query
|
||||
* @method ChildColissimoPickupPointAreaFreeshipping findOneOrCreate(ConnectionInterface $con = null) Return the first ChildColissimoPickupPointAreaFreeshipping matching the query, or a new ChildColissimoPickupPointAreaFreeshipping object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildColissimoPickupPointAreaFreeshipping findOneById(int $id) Return the first ChildColissimoPickupPointAreaFreeshipping filtered by the id column
|
||||
* @method ChildColissimoPickupPointAreaFreeshipping findOneByAreaId(int $area_id) Return the first ChildColissimoPickupPointAreaFreeshipping filtered by the area_id column
|
||||
* @method ChildColissimoPickupPointAreaFreeshipping findOneByCartAmount(string $cart_amount) Return the first ChildColissimoPickupPointAreaFreeshipping filtered by the cart_amount column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildColissimoPickupPointAreaFreeshipping objects filtered by the id column
|
||||
* @method array findByAreaId(int $area_id) Return ChildColissimoPickupPointAreaFreeshipping objects filtered by the area_id column
|
||||
* @method array findByCartAmount(string $cart_amount) Return ChildColissimoPickupPointAreaFreeshipping objects filtered by the cart_amount column
|
||||
*
|
||||
*/
|
||||
abstract class ColissimoPickupPointAreaFreeshippingQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \ColissimoPickupPoint\Model\Base\ColissimoPickupPointAreaFreeshippingQuery 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 = '\\ColissimoPickupPoint\\Model\\ColissimoPickupPointAreaFreeshipping', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildColissimoPickupPointAreaFreeshippingQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildColissimoPickupPointAreaFreeshippingQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \ColissimoPickupPoint\Model\ColissimoPickupPointAreaFreeshippingQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \ColissimoPickupPoint\Model\ColissimoPickupPointAreaFreeshippingQuery();
|
||||
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 ChildColissimoPickupPointAreaFreeshipping|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = ColissimoPickupPointAreaFreeshippingTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(ColissimoPickupPointAreaFreeshippingTableMap::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 ChildColissimoPickupPointAreaFreeshipping A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, AREA_ID, CART_AMOUNT FROM colissimo_pickup_point_area_freeshipping 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 ChildColissimoPickupPointAreaFreeshipping();
|
||||
$obj->hydrate($row);
|
||||
ColissimoPickupPointAreaFreeshippingTableMap::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 ChildColissimoPickupPointAreaFreeshipping|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 ChildColissimoPickupPointAreaFreeshippingQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::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 ChildColissimoPickupPointAreaFreeshippingQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::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 ChildColissimoPickupPointAreaFreeshippingQuery 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(ColissimoPickupPointAreaFreeshippingTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::ID, $id, $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 ChildColissimoPickupPointAreaFreeshippingQuery 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(ColissimoPickupPointAreaFreeshippingTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($areaId['max'])) {
|
||||
$this->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::AREA_ID, $areaId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the cart_amount column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCartAmount(1234); // WHERE cart_amount = 1234
|
||||
* $query->filterByCartAmount(array(12, 34)); // WHERE cart_amount IN (12, 34)
|
||||
* $query->filterByCartAmount(array('min' => 12)); // WHERE cart_amount > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $cartAmount 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 ChildColissimoPickupPointAreaFreeshippingQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCartAmount($cartAmount = null, $comparison = null)
|
||||
{
|
||||
if (is_array($cartAmount)) {
|
||||
$useMinMax = false;
|
||||
if (isset($cartAmount['min'])) {
|
||||
$this->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::CART_AMOUNT, $cartAmount['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($cartAmount['max'])) {
|
||||
$this->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::CART_AMOUNT, $cartAmount['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::CART_AMOUNT, $cartAmount, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \ColissimoPickupPoint\Model\Thelia\Model\Area object
|
||||
*
|
||||
* @param \ColissimoPickupPoint\Model\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 ChildColissimoPickupPointAreaFreeshippingQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByArea($area, $comparison = null)
|
||||
{
|
||||
if ($area instanceof \ColissimoPickupPoint\Model\Thelia\Model\Area) {
|
||||
return $this
|
||||
->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::AREA_ID, $area->getId(), $comparison);
|
||||
} elseif ($area instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByArea() only accepts arguments of type \ColissimoPickupPoint\Model\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 ChildColissimoPickupPointAreaFreeshippingQuery 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 \ColissimoPickupPoint\Model\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', '\ColissimoPickupPoint\Model\Thelia\Model\AreaQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildColissimoPickupPointAreaFreeshipping $colissimoPickupPointAreaFreeshipping Object to remove from the list of results
|
||||
*
|
||||
* @return ChildColissimoPickupPointAreaFreeshippingQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($colissimoPickupPointAreaFreeshipping = null)
|
||||
{
|
||||
if ($colissimoPickupPointAreaFreeshipping) {
|
||||
$this->addUsingAlias(ColissimoPickupPointAreaFreeshippingTableMap::ID, $colissimoPickupPointAreaFreeshipping->getId(), Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the colissimo_pickup_point_area_freeshipping 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(ColissimoPickupPointAreaFreeshippingTableMap::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).
|
||||
ColissimoPickupPointAreaFreeshippingTableMap::clearInstancePool();
|
||||
ColissimoPickupPointAreaFreeshippingTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildColissimoPickupPointAreaFreeshipping or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildColissimoPickupPointAreaFreeshipping 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(ColissimoPickupPointAreaFreeshippingTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(ColissimoPickupPointAreaFreeshippingTableMap::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();
|
||||
|
||||
|
||||
ColissimoPickupPointAreaFreeshippingTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
ColissimoPickupPointAreaFreeshippingTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
} // ColissimoPickupPointAreaFreeshippingQuery
|
||||
@@ -0,0 +1,420 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointFreeshipping as ChildColissimoPickupPointFreeshipping;
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointFreeshippingQuery as ChildColissimoPickupPointFreeshippingQuery;
|
||||
use ColissimoPickupPoint\Model\Map\ColissimoPickupPointFreeshippingTableMap;
|
||||
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 'colissimo_pickup_point_freeshipping' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildColissimoPickupPointFreeshippingQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildColissimoPickupPointFreeshippingQuery orderByActive($order = Criteria::ASC) Order by the active column
|
||||
* @method ChildColissimoPickupPointFreeshippingQuery orderByFreeshippingFrom($order = Criteria::ASC) Order by the freeshipping_from column
|
||||
*
|
||||
* @method ChildColissimoPickupPointFreeshippingQuery groupById() Group by the id column
|
||||
* @method ChildColissimoPickupPointFreeshippingQuery groupByActive() Group by the active column
|
||||
* @method ChildColissimoPickupPointFreeshippingQuery groupByFreeshippingFrom() Group by the freeshipping_from column
|
||||
*
|
||||
* @method ChildColissimoPickupPointFreeshippingQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildColissimoPickupPointFreeshippingQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildColissimoPickupPointFreeshippingQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildColissimoPickupPointFreeshipping findOne(ConnectionInterface $con = null) Return the first ChildColissimoPickupPointFreeshipping matching the query
|
||||
* @method ChildColissimoPickupPointFreeshipping findOneOrCreate(ConnectionInterface $con = null) Return the first ChildColissimoPickupPointFreeshipping matching the query, or a new ChildColissimoPickupPointFreeshipping object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildColissimoPickupPointFreeshipping findOneById(int $id) Return the first ChildColissimoPickupPointFreeshipping filtered by the id column
|
||||
* @method ChildColissimoPickupPointFreeshipping findOneByActive(boolean $active) Return the first ChildColissimoPickupPointFreeshipping filtered by the active column
|
||||
* @method ChildColissimoPickupPointFreeshipping findOneByFreeshippingFrom(string $freeshipping_from) Return the first ChildColissimoPickupPointFreeshipping filtered by the freeshipping_from column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildColissimoPickupPointFreeshipping objects filtered by the id column
|
||||
* @method array findByActive(boolean $active) Return ChildColissimoPickupPointFreeshipping objects filtered by the active column
|
||||
* @method array findByFreeshippingFrom(string $freeshipping_from) Return ChildColissimoPickupPointFreeshipping objects filtered by the freeshipping_from column
|
||||
*
|
||||
*/
|
||||
abstract class ColissimoPickupPointFreeshippingQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \ColissimoPickupPoint\Model\Base\ColissimoPickupPointFreeshippingQuery 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 = '\\ColissimoPickupPoint\\Model\\ColissimoPickupPointFreeshipping', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildColissimoPickupPointFreeshippingQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildColissimoPickupPointFreeshippingQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \ColissimoPickupPoint\Model\ColissimoPickupPointFreeshippingQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \ColissimoPickupPoint\Model\ColissimoPickupPointFreeshippingQuery();
|
||||
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 ChildColissimoPickupPointFreeshipping|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = ColissimoPickupPointFreeshippingTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(ColissimoPickupPointFreeshippingTableMap::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 ChildColissimoPickupPointFreeshipping A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, ACTIVE, FREESHIPPING_FROM FROM colissimo_pickup_point_freeshipping 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 ChildColissimoPickupPointFreeshipping();
|
||||
$obj->hydrate($row);
|
||||
ColissimoPickupPointFreeshippingTableMap::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 ChildColissimoPickupPointFreeshipping|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 ChildColissimoPickupPointFreeshippingQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(ColissimoPickupPointFreeshippingTableMap::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 ChildColissimoPickupPointFreeshippingQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(ColissimoPickupPointFreeshippingTableMap::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 ChildColissimoPickupPointFreeshippingQuery 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(ColissimoPickupPointFreeshippingTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(ColissimoPickupPointFreeshippingTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimoPickupPointFreeshippingTableMap::ID, $id, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the active column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByActive(true); // WHERE active = true
|
||||
* $query->filterByActive('yes'); // WHERE active = true
|
||||
* </code>
|
||||
*
|
||||
* @param boolean|string $active The value to use as filter.
|
||||
* Non-boolean arguments are converted using the following rules:
|
||||
* * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
|
||||
* * 0, '0', 'false', 'off', and 'no' are converted to boolean false
|
||||
* Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildColissimoPickupPointFreeshippingQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByActive($active = null, $comparison = null)
|
||||
{
|
||||
if (is_string($active)) {
|
||||
$active = in_array(strtolower($active), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimoPickupPointFreeshippingTableMap::ACTIVE, $active, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the freeshipping_from column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByFreeshippingFrom(1234); // WHERE freeshipping_from = 1234
|
||||
* $query->filterByFreeshippingFrom(array(12, 34)); // WHERE freeshipping_from IN (12, 34)
|
||||
* $query->filterByFreeshippingFrom(array('min' => 12)); // WHERE freeshipping_from > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $freeshippingFrom 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 ChildColissimoPickupPointFreeshippingQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByFreeshippingFrom($freeshippingFrom = null, $comparison = null)
|
||||
{
|
||||
if (is_array($freeshippingFrom)) {
|
||||
$useMinMax = false;
|
||||
if (isset($freeshippingFrom['min'])) {
|
||||
$this->addUsingAlias(ColissimoPickupPointFreeshippingTableMap::FREESHIPPING_FROM, $freeshippingFrom['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($freeshippingFrom['max'])) {
|
||||
$this->addUsingAlias(ColissimoPickupPointFreeshippingTableMap::FREESHIPPING_FROM, $freeshippingFrom['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimoPickupPointFreeshippingTableMap::FREESHIPPING_FROM, $freeshippingFrom, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildColissimoPickupPointFreeshipping $colissimoPickupPointFreeshipping Object to remove from the list of results
|
||||
*
|
||||
* @return ChildColissimoPickupPointFreeshippingQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($colissimoPickupPointFreeshipping = null)
|
||||
{
|
||||
if ($colissimoPickupPointFreeshipping) {
|
||||
$this->addUsingAlias(ColissimoPickupPointFreeshippingTableMap::ID, $colissimoPickupPointFreeshipping->getId(), Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the colissimo_pickup_point_freeshipping 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(ColissimoPickupPointFreeshippingTableMap::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).
|
||||
ColissimoPickupPointFreeshippingTableMap::clearInstancePool();
|
||||
ColissimoPickupPointFreeshippingTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildColissimoPickupPointFreeshipping or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildColissimoPickupPointFreeshipping 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(ColissimoPickupPointFreeshippingTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(ColissimoPickupPointFreeshippingTableMap::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();
|
||||
|
||||
|
||||
ColissimoPickupPointFreeshippingTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
ColissimoPickupPointFreeshippingTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
} // ColissimoPickupPointFreeshippingQuery
|
||||
@@ -0,0 +1,654 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlices as ChildColissimoPickupPointPriceSlices;
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlicesQuery as ChildColissimoPickupPointPriceSlicesQuery;
|
||||
use ColissimoPickupPoint\Model\Map\ColissimoPickupPointPriceSlicesTableMap;
|
||||
use ColissimoPickupPoint\Model\Thelia\Model\Area;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'colissimo_pickup_point_price_slices' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildColissimoPickupPointPriceSlicesQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildColissimoPickupPointPriceSlicesQuery orderByAreaId($order = Criteria::ASC) Order by the area_id column
|
||||
* @method ChildColissimoPickupPointPriceSlicesQuery orderByWeightMax($order = Criteria::ASC) Order by the weight_max column
|
||||
* @method ChildColissimoPickupPointPriceSlicesQuery orderByPriceMax($order = Criteria::ASC) Order by the price_max column
|
||||
* @method ChildColissimoPickupPointPriceSlicesQuery orderByFrancoMinPrice($order = Criteria::ASC) Order by the franco_min_price column
|
||||
* @method ChildColissimoPickupPointPriceSlicesQuery orderByPrice($order = Criteria::ASC) Order by the price column
|
||||
*
|
||||
* @method ChildColissimoPickupPointPriceSlicesQuery groupById() Group by the id column
|
||||
* @method ChildColissimoPickupPointPriceSlicesQuery groupByAreaId() Group by the area_id column
|
||||
* @method ChildColissimoPickupPointPriceSlicesQuery groupByWeightMax() Group by the weight_max column
|
||||
* @method ChildColissimoPickupPointPriceSlicesQuery groupByPriceMax() Group by the price_max column
|
||||
* @method ChildColissimoPickupPointPriceSlicesQuery groupByFrancoMinPrice() Group by the franco_min_price column
|
||||
* @method ChildColissimoPickupPointPriceSlicesQuery groupByPrice() Group by the price column
|
||||
*
|
||||
* @method ChildColissimoPickupPointPriceSlicesQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildColissimoPickupPointPriceSlicesQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildColissimoPickupPointPriceSlicesQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildColissimoPickupPointPriceSlicesQuery leftJoinArea($relationAlias = null) Adds a LEFT JOIN clause to the query using the Area relation
|
||||
* @method ChildColissimoPickupPointPriceSlicesQuery rightJoinArea($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Area relation
|
||||
* @method ChildColissimoPickupPointPriceSlicesQuery innerJoinArea($relationAlias = null) Adds a INNER JOIN clause to the query using the Area relation
|
||||
*
|
||||
* @method ChildColissimoPickupPointPriceSlices findOne(ConnectionInterface $con = null) Return the first ChildColissimoPickupPointPriceSlices matching the query
|
||||
* @method ChildColissimoPickupPointPriceSlices findOneOrCreate(ConnectionInterface $con = null) Return the first ChildColissimoPickupPointPriceSlices matching the query, or a new ChildColissimoPickupPointPriceSlices object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildColissimoPickupPointPriceSlices findOneById(int $id) Return the first ChildColissimoPickupPointPriceSlices filtered by the id column
|
||||
* @method ChildColissimoPickupPointPriceSlices findOneByAreaId(int $area_id) Return the first ChildColissimoPickupPointPriceSlices filtered by the area_id column
|
||||
* @method ChildColissimoPickupPointPriceSlices findOneByWeightMax(double $weight_max) Return the first ChildColissimoPickupPointPriceSlices filtered by the weight_max column
|
||||
* @method ChildColissimoPickupPointPriceSlices findOneByPriceMax(double $price_max) Return the first ChildColissimoPickupPointPriceSlices filtered by the price_max column
|
||||
* @method ChildColissimoPickupPointPriceSlices findOneByFrancoMinPrice(double $franco_min_price) Return the first ChildColissimoPickupPointPriceSlices filtered by the franco_min_price column
|
||||
* @method ChildColissimoPickupPointPriceSlices findOneByPrice(double $price) Return the first ChildColissimoPickupPointPriceSlices filtered by the price column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildColissimoPickupPointPriceSlices objects filtered by the id column
|
||||
* @method array findByAreaId(int $area_id) Return ChildColissimoPickupPointPriceSlices objects filtered by the area_id column
|
||||
* @method array findByWeightMax(double $weight_max) Return ChildColissimoPickupPointPriceSlices objects filtered by the weight_max column
|
||||
* @method array findByPriceMax(double $price_max) Return ChildColissimoPickupPointPriceSlices objects filtered by the price_max column
|
||||
* @method array findByFrancoMinPrice(double $franco_min_price) Return ChildColissimoPickupPointPriceSlices objects filtered by the franco_min_price column
|
||||
* @method array findByPrice(double $price) Return ChildColissimoPickupPointPriceSlices objects filtered by the price column
|
||||
*
|
||||
*/
|
||||
abstract class ColissimoPickupPointPriceSlicesQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \ColissimoPickupPoint\Model\Base\ColissimoPickupPointPriceSlicesQuery 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 = '\\ColissimoPickupPoint\\Model\\ColissimoPickupPointPriceSlices', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildColissimoPickupPointPriceSlicesQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildColissimoPickupPointPriceSlicesQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlicesQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlicesQuery();
|
||||
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 ChildColissimoPickupPointPriceSlices|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = ColissimoPickupPointPriceSlicesTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(ColissimoPickupPointPriceSlicesTableMap::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 ChildColissimoPickupPointPriceSlices A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, AREA_ID, WEIGHT_MAX, PRICE_MAX, FRANCO_MIN_PRICE, PRICE FROM colissimo_pickup_point_price_slices 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 ChildColissimoPickupPointPriceSlices();
|
||||
$obj->hydrate($row);
|
||||
ColissimoPickupPointPriceSlicesTableMap::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 ChildColissimoPickupPointPriceSlices|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 ChildColissimoPickupPointPriceSlicesQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::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 ChildColissimoPickupPointPriceSlicesQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::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 ChildColissimoPickupPointPriceSlicesQuery 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(ColissimoPickupPointPriceSlicesTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::ID, $id, $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 ChildColissimoPickupPointPriceSlicesQuery 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(ColissimoPickupPointPriceSlicesTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($areaId['max'])) {
|
||||
$this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::AREA_ID, $areaId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the weight_max column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByWeightMax(1234); // WHERE weight_max = 1234
|
||||
* $query->filterByWeightMax(array(12, 34)); // WHERE weight_max IN (12, 34)
|
||||
* $query->filterByWeightMax(array('min' => 12)); // WHERE weight_max > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $weightMax 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 ChildColissimoPickupPointPriceSlicesQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByWeightMax($weightMax = null, $comparison = null)
|
||||
{
|
||||
if (is_array($weightMax)) {
|
||||
$useMinMax = false;
|
||||
if (isset($weightMax['min'])) {
|
||||
$this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::WEIGHT_MAX, $weightMax['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($weightMax['max'])) {
|
||||
$this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::WEIGHT_MAX, $weightMax['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::WEIGHT_MAX, $weightMax, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the price_max column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByPriceMax(1234); // WHERE price_max = 1234
|
||||
* $query->filterByPriceMax(array(12, 34)); // WHERE price_max IN (12, 34)
|
||||
* $query->filterByPriceMax(array('min' => 12)); // WHERE price_max > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $priceMax 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 ChildColissimoPickupPointPriceSlicesQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPriceMax($priceMax = null, $comparison = null)
|
||||
{
|
||||
if (is_array($priceMax)) {
|
||||
$useMinMax = false;
|
||||
if (isset($priceMax['min'])) {
|
||||
$this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::PRICE_MAX, $priceMax['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($priceMax['max'])) {
|
||||
$this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::PRICE_MAX, $priceMax['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::PRICE_MAX, $priceMax, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the franco_min_price column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByFrancoMinPrice(1234); // WHERE franco_min_price = 1234
|
||||
* $query->filterByFrancoMinPrice(array(12, 34)); // WHERE franco_min_price IN (12, 34)
|
||||
* $query->filterByFrancoMinPrice(array('min' => 12)); // WHERE franco_min_price > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $francoMinPrice 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 ChildColissimoPickupPointPriceSlicesQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByFrancoMinPrice($francoMinPrice = null, $comparison = null)
|
||||
{
|
||||
if (is_array($francoMinPrice)) {
|
||||
$useMinMax = false;
|
||||
if (isset($francoMinPrice['min'])) {
|
||||
$this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::FRANCO_MIN_PRICE, $francoMinPrice['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($francoMinPrice['max'])) {
|
||||
$this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::FRANCO_MIN_PRICE, $francoMinPrice['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::FRANCO_MIN_PRICE, $francoMinPrice, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the price column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByPrice(1234); // WHERE price = 1234
|
||||
* $query->filterByPrice(array(12, 34)); // WHERE price IN (12, 34)
|
||||
* $query->filterByPrice(array('min' => 12)); // WHERE price > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $price 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 ChildColissimoPickupPointPriceSlicesQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrice($price = null, $comparison = null)
|
||||
{
|
||||
if (is_array($price)) {
|
||||
$useMinMax = false;
|
||||
if (isset($price['min'])) {
|
||||
$this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::PRICE, $price['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($price['max'])) {
|
||||
$this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::PRICE, $price['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::PRICE, $price, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \ColissimoPickupPoint\Model\Thelia\Model\Area object
|
||||
*
|
||||
* @param \ColissimoPickupPoint\Model\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 ChildColissimoPickupPointPriceSlicesQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByArea($area, $comparison = null)
|
||||
{
|
||||
if ($area instanceof \ColissimoPickupPoint\Model\Thelia\Model\Area) {
|
||||
return $this
|
||||
->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::AREA_ID, $area->getId(), $comparison);
|
||||
} elseif ($area instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByArea() only accepts arguments of type \ColissimoPickupPoint\Model\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 ChildColissimoPickupPointPriceSlicesQuery 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 \ColissimoPickupPoint\Model\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', '\ColissimoPickupPoint\Model\Thelia\Model\AreaQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildColissimoPickupPointPriceSlices $colissimoPickupPointPriceSlices Object to remove from the list of results
|
||||
*
|
||||
* @return ChildColissimoPickupPointPriceSlicesQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($colissimoPickupPointPriceSlices = null)
|
||||
{
|
||||
if ($colissimoPickupPointPriceSlices) {
|
||||
$this->addUsingAlias(ColissimoPickupPointPriceSlicesTableMap::ID, $colissimoPickupPointPriceSlices->getId(), Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the colissimo_pickup_point_price_slices 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(ColissimoPickupPointPriceSlicesTableMap::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).
|
||||
ColissimoPickupPointPriceSlicesTableMap::clearInstancePool();
|
||||
ColissimoPickupPointPriceSlicesTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildColissimoPickupPointPriceSlices or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildColissimoPickupPointPriceSlices 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(ColissimoPickupPointPriceSlicesTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(ColissimoPickupPointPriceSlicesTableMap::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();
|
||||
|
||||
|
||||
ColissimoPickupPointPriceSlicesTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
ColissimoPickupPointPriceSlicesTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
} // ColissimoPickupPointPriceSlicesQuery
|
||||
@@ -0,0 +1,495 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use ColissimoPickupPoint\Model\OrderAddressColissimoPickupPoint as ChildOrderAddressColissimoPickupPoint;
|
||||
use ColissimoPickupPoint\Model\OrderAddressColissimoPickupPointQuery as ChildOrderAddressColissimoPickupPointQuery;
|
||||
use ColissimoPickupPoint\Model\Map\OrderAddressColissimoPickupPointTableMap;
|
||||
use ColissimoPickupPoint\Model\Thelia\Model\OrderAddress;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'order_address_colissimo_pickup_point' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildOrderAddressColissimoPickupPointQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildOrderAddressColissimoPickupPointQuery orderByCode($order = Criteria::ASC) Order by the code column
|
||||
* @method ChildOrderAddressColissimoPickupPointQuery orderByType($order = Criteria::ASC) Order by the type column
|
||||
*
|
||||
* @method ChildOrderAddressColissimoPickupPointQuery groupById() Group by the id column
|
||||
* @method ChildOrderAddressColissimoPickupPointQuery groupByCode() Group by the code column
|
||||
* @method ChildOrderAddressColissimoPickupPointQuery groupByType() Group by the type column
|
||||
*
|
||||
* @method ChildOrderAddressColissimoPickupPointQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildOrderAddressColissimoPickupPointQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildOrderAddressColissimoPickupPointQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildOrderAddressColissimoPickupPointQuery leftJoinOrderAddress($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderAddress relation
|
||||
* @method ChildOrderAddressColissimoPickupPointQuery rightJoinOrderAddress($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderAddress relation
|
||||
* @method ChildOrderAddressColissimoPickupPointQuery innerJoinOrderAddress($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderAddress relation
|
||||
*
|
||||
* @method ChildOrderAddressColissimoPickupPoint findOne(ConnectionInterface $con = null) Return the first ChildOrderAddressColissimoPickupPoint matching the query
|
||||
* @method ChildOrderAddressColissimoPickupPoint findOneOrCreate(ConnectionInterface $con = null) Return the first ChildOrderAddressColissimoPickupPoint matching the query, or a new ChildOrderAddressColissimoPickupPoint object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildOrderAddressColissimoPickupPoint findOneById(int $id) Return the first ChildOrderAddressColissimoPickupPoint filtered by the id column
|
||||
* @method ChildOrderAddressColissimoPickupPoint findOneByCode(string $code) Return the first ChildOrderAddressColissimoPickupPoint filtered by the code column
|
||||
* @method ChildOrderAddressColissimoPickupPoint findOneByType(string $type) Return the first ChildOrderAddressColissimoPickupPoint filtered by the type column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildOrderAddressColissimoPickupPoint objects filtered by the id column
|
||||
* @method array findByCode(string $code) Return ChildOrderAddressColissimoPickupPoint objects filtered by the code column
|
||||
* @method array findByType(string $type) Return ChildOrderAddressColissimoPickupPoint objects filtered by the type column
|
||||
*
|
||||
*/
|
||||
abstract class OrderAddressColissimoPickupPointQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \ColissimoPickupPoint\Model\Base\OrderAddressColissimoPickupPointQuery 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 = '\\ColissimoPickupPoint\\Model\\OrderAddressColissimoPickupPoint', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildOrderAddressColissimoPickupPointQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildOrderAddressColissimoPickupPointQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \ColissimoPickupPoint\Model\OrderAddressColissimoPickupPointQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \ColissimoPickupPoint\Model\OrderAddressColissimoPickupPointQuery();
|
||||
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 ChildOrderAddressColissimoPickupPoint|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = OrderAddressColissimoPickupPointTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(OrderAddressColissimoPickupPointTableMap::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 ChildOrderAddressColissimoPickupPoint A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, CODE, TYPE FROM order_address_colissimo_pickup_point 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 ChildOrderAddressColissimoPickupPoint();
|
||||
$obj->hydrate($row);
|
||||
OrderAddressColissimoPickupPointTableMap::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 ChildOrderAddressColissimoPickupPoint|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 ChildOrderAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(OrderAddressColissimoPickupPointTableMap::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 ChildOrderAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(OrderAddressColissimoPickupPointTableMap::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>
|
||||
*
|
||||
* @see filterByOrderAddress()
|
||||
*
|
||||
* @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 ChildOrderAddressColissimoPickupPointQuery 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(OrderAddressColissimoPickupPointTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(OrderAddressColissimoPickupPointTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(OrderAddressColissimoPickupPointTableMap::ID, $id, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the code column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCode('fooValue'); // WHERE code = 'fooValue'
|
||||
* $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $code 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 ChildOrderAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCode($code = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($code)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $code)) {
|
||||
$code = str_replace('*', '%', $code);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(OrderAddressColissimoPickupPointTableMap::CODE, $code, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the type column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByType('fooValue'); // WHERE type = 'fooValue'
|
||||
* $query->filterByType('%fooValue%'); // WHERE type LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $type 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 ChildOrderAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByType($type = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($type)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $type)) {
|
||||
$type = str_replace('*', '%', $type);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(OrderAddressColissimoPickupPointTableMap::TYPE, $type, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \ColissimoPickupPoint\Model\Thelia\Model\OrderAddress object
|
||||
*
|
||||
* @param \ColissimoPickupPoint\Model\Thelia\Model\OrderAddress|ObjectCollection $orderAddress The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildOrderAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByOrderAddress($orderAddress, $comparison = null)
|
||||
{
|
||||
if ($orderAddress instanceof \ColissimoPickupPoint\Model\Thelia\Model\OrderAddress) {
|
||||
return $this
|
||||
->addUsingAlias(OrderAddressColissimoPickupPointTableMap::ID, $orderAddress->getId(), $comparison);
|
||||
} elseif ($orderAddress instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(OrderAddressColissimoPickupPointTableMap::ID, $orderAddress->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByOrderAddress() only accepts arguments of type \ColissimoPickupPoint\Model\Thelia\Model\OrderAddress or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the OrderAddress relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildOrderAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinOrderAddress($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('OrderAddress');
|
||||
|
||||
// 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, 'OrderAddress');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the OrderAddress relation OrderAddress 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 \ColissimoPickupPoint\Model\Thelia\Model\OrderAddressQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useOrderAddressQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinOrderAddress($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'OrderAddress', '\ColissimoPickupPoint\Model\Thelia\Model\OrderAddressQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildOrderAddressColissimoPickupPoint $orderAddressColissimoPickupPoint Object to remove from the list of results
|
||||
*
|
||||
* @return ChildOrderAddressColissimoPickupPointQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($orderAddressColissimoPickupPoint = null)
|
||||
{
|
||||
if ($orderAddressColissimoPickupPoint) {
|
||||
$this->addUsingAlias(OrderAddressColissimoPickupPointTableMap::ID, $orderAddressColissimoPickupPoint->getId(), Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the order_address_colissimo_pickup_point 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(OrderAddressColissimoPickupPointTableMap::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).
|
||||
OrderAddressColissimoPickupPointTableMap::clearInstancePool();
|
||||
OrderAddressColissimoPickupPointTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildOrderAddressColissimoPickupPoint or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildOrderAddressColissimoPickupPoint 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(OrderAddressColissimoPickupPointTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(OrderAddressColissimoPickupPointTableMap::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();
|
||||
|
||||
|
||||
OrderAddressColissimoPickupPointTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
OrderAddressColissimoPickupPointTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
} // OrderAddressColissimoPickupPointQuery
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Model;
|
||||
|
||||
use ColissimoPickupPoint\Model\Base\ColissimoPickupPointAreaFreeshipping as BaseColissimoPickupPointAreaFreeshipping;
|
||||
|
||||
class ColissimoPickupPointAreaFreeshipping extends BaseColissimoPickupPointAreaFreeshipping
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Model;
|
||||
|
||||
use ColissimoPickupPoint\Model\Base\ColissimoPickupPointAreaFreeshippingQuery as BaseColissimoPickupPointAreaFreeshippingQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'colissimo_pickup_point_area_freeshipping' 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 ColissimoPickupPointAreaFreeshippingQuery extends BaseColissimoPickupPointAreaFreeshippingQuery
|
||||
{
|
||||
|
||||
} // ColissimoPickupPointAreaFreeshippingQuery
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Model;
|
||||
|
||||
use ColissimoPickupPoint\Model\Base\ColissimoPickupPointFreeshipping as BaseColissimoPickupPointFreeshipping;
|
||||
|
||||
class ColissimoPickupPointFreeshipping extends BaseColissimoPickupPointFreeshipping
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Model;
|
||||
|
||||
use ColissimoPickupPoint\Model\Base\ColissimoPickupPointFreeshippingQuery as BaseColissimoPickupPointFreeshippingQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'colissimo_pickup_point_freeshipping' 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 ColissimoPickupPointFreeshippingQuery extends BaseColissimoPickupPointFreeshippingQuery
|
||||
{
|
||||
|
||||
} // ColissimoPickupPointFreeshippingQuery
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Model;
|
||||
|
||||
use ColissimoPickupPoint\Model\Base\ColissimoPickupPointPriceSlices as BaseColissimoPickupPointPriceSlices;
|
||||
|
||||
class ColissimoPickupPointPriceSlices extends BaseColissimoPickupPointPriceSlices
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Model;
|
||||
|
||||
use ColissimoPickupPoint\Model\Base\ColissimoPickupPointPriceSlicesQuery as BaseColissimoPickupPointPriceSlicesQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'colissimo_pickup_point_price_slices' 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 ColissimoPickupPointPriceSlicesQuery extends BaseColissimoPickupPointPriceSlicesQuery
|
||||
{
|
||||
|
||||
} // ColissimoPickupPointPriceSlicesQuery
|
||||
@@ -0,0 +1,504 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Model\Map;
|
||||
|
||||
use ColissimoPickupPoint\Model\AddressColissimoPickupPoint;
|
||||
use ColissimoPickupPoint\Model\AddressColissimoPickupPointQuery;
|
||||
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 'address_colissimo_pickup_point' 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 AddressColissimoPickupPointTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'ColissimoPickupPoint.Model.Map.AddressColissimoPickupPointTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'address_colissimo_pickup_point';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\ColissimoPickupPoint\\Model\\AddressColissimoPickupPoint';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'ColissimoPickupPoint.Model.AddressColissimoPickupPoint';
|
||||
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 14;
|
||||
|
||||
/**
|
||||
* 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 = 14;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
*/
|
||||
const ID = 'address_colissimo_pickup_point.ID';
|
||||
|
||||
/**
|
||||
* the column name for the TITLE_ID field
|
||||
*/
|
||||
const TITLE_ID = 'address_colissimo_pickup_point.TITLE_ID';
|
||||
|
||||
/**
|
||||
* the column name for the COMPANY field
|
||||
*/
|
||||
const COMPANY = 'address_colissimo_pickup_point.COMPANY';
|
||||
|
||||
/**
|
||||
* the column name for the FIRSTNAME field
|
||||
*/
|
||||
const FIRSTNAME = 'address_colissimo_pickup_point.FIRSTNAME';
|
||||
|
||||
/**
|
||||
* the column name for the LASTNAME field
|
||||
*/
|
||||
const LASTNAME = 'address_colissimo_pickup_point.LASTNAME';
|
||||
|
||||
/**
|
||||
* the column name for the ADDRESS1 field
|
||||
*/
|
||||
const ADDRESS1 = 'address_colissimo_pickup_point.ADDRESS1';
|
||||
|
||||
/**
|
||||
* the column name for the ADDRESS2 field
|
||||
*/
|
||||
const ADDRESS2 = 'address_colissimo_pickup_point.ADDRESS2';
|
||||
|
||||
/**
|
||||
* the column name for the ADDRESS3 field
|
||||
*/
|
||||
const ADDRESS3 = 'address_colissimo_pickup_point.ADDRESS3';
|
||||
|
||||
/**
|
||||
* the column name for the ZIPCODE field
|
||||
*/
|
||||
const ZIPCODE = 'address_colissimo_pickup_point.ZIPCODE';
|
||||
|
||||
/**
|
||||
* the column name for the CITY field
|
||||
*/
|
||||
const CITY = 'address_colissimo_pickup_point.CITY';
|
||||
|
||||
/**
|
||||
* the column name for the COUNTRY_ID field
|
||||
*/
|
||||
const COUNTRY_ID = 'address_colissimo_pickup_point.COUNTRY_ID';
|
||||
|
||||
/**
|
||||
* the column name for the CODE field
|
||||
*/
|
||||
const CODE = 'address_colissimo_pickup_point.CODE';
|
||||
|
||||
/**
|
||||
* the column name for the TYPE field
|
||||
*/
|
||||
const TYPE = 'address_colissimo_pickup_point.TYPE';
|
||||
|
||||
/**
|
||||
* the column name for the CELLPHONE field
|
||||
*/
|
||||
const CELLPHONE = 'address_colissimo_pickup_point.CELLPHONE';
|
||||
|
||||
/**
|
||||
* 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', 'TitleId', 'Company', 'Firstname', 'Lastname', 'Address1', 'Address2', 'Address3', 'Zipcode', 'City', 'CountryId', 'Code', 'Type', 'Cellphone', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'titleId', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'countryId', 'code', 'type', 'cellphone', ),
|
||||
self::TYPE_COLNAME => array(AddressColissimoPickupPointTableMap::ID, AddressColissimoPickupPointTableMap::TITLE_ID, AddressColissimoPickupPointTableMap::COMPANY, AddressColissimoPickupPointTableMap::FIRSTNAME, AddressColissimoPickupPointTableMap::LASTNAME, AddressColissimoPickupPointTableMap::ADDRESS1, AddressColissimoPickupPointTableMap::ADDRESS2, AddressColissimoPickupPointTableMap::ADDRESS3, AddressColissimoPickupPointTableMap::ZIPCODE, AddressColissimoPickupPointTableMap::CITY, AddressColissimoPickupPointTableMap::COUNTRY_ID, AddressColissimoPickupPointTableMap::CODE, AddressColissimoPickupPointTableMap::TYPE, AddressColissimoPickupPointTableMap::CELLPHONE, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'TITLE_ID', 'COMPANY', 'FIRSTNAME', 'LASTNAME', 'ADDRESS1', 'ADDRESS2', 'ADDRESS3', 'ZIPCODE', 'CITY', 'COUNTRY_ID', 'CODE', 'TYPE', 'CELLPHONE', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'title_id', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'country_id', 'code', 'type', 'cellphone', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
|
||||
);
|
||||
|
||||
/**
|
||||
* 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, 'TitleId' => 1, 'Company' => 2, 'Firstname' => 3, 'Lastname' => 4, 'Address1' => 5, 'Address2' => 6, 'Address3' => 7, 'Zipcode' => 8, 'City' => 9, 'CountryId' => 10, 'Code' => 11, 'Type' => 12, 'Cellphone' => 13, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'titleId' => 1, 'company' => 2, 'firstname' => 3, 'lastname' => 4, 'address1' => 5, 'address2' => 6, 'address3' => 7, 'zipcode' => 8, 'city' => 9, 'countryId' => 10, 'code' => 11, 'type' => 12, 'cellphone' => 13, ),
|
||||
self::TYPE_COLNAME => array(AddressColissimoPickupPointTableMap::ID => 0, AddressColissimoPickupPointTableMap::TITLE_ID => 1, AddressColissimoPickupPointTableMap::COMPANY => 2, AddressColissimoPickupPointTableMap::FIRSTNAME => 3, AddressColissimoPickupPointTableMap::LASTNAME => 4, AddressColissimoPickupPointTableMap::ADDRESS1 => 5, AddressColissimoPickupPointTableMap::ADDRESS2 => 6, AddressColissimoPickupPointTableMap::ADDRESS3 => 7, AddressColissimoPickupPointTableMap::ZIPCODE => 8, AddressColissimoPickupPointTableMap::CITY => 9, AddressColissimoPickupPointTableMap::COUNTRY_ID => 10, AddressColissimoPickupPointTableMap::CODE => 11, AddressColissimoPickupPointTableMap::TYPE => 12, AddressColissimoPickupPointTableMap::CELLPHONE => 13, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'TITLE_ID' => 1, 'COMPANY' => 2, 'FIRSTNAME' => 3, 'LASTNAME' => 4, 'ADDRESS1' => 5, 'ADDRESS2' => 6, 'ADDRESS3' => 7, 'ZIPCODE' => 8, 'CITY' => 9, 'COUNTRY_ID' => 10, 'CODE' => 11, 'TYPE' => 12, 'CELLPHONE' => 13, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'title_id' => 1, 'company' => 2, 'firstname' => 3, 'lastname' => 4, 'address1' => 5, 'address2' => 6, 'address3' => 7, 'zipcode' => 8, 'city' => 9, 'country_id' => 10, 'code' => 11, 'type' => 12, 'cellphone' => 13, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
|
||||
);
|
||||
|
||||
/**
|
||||
* 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('address_colissimo_pickup_point');
|
||||
$this->setPhpName('AddressColissimoPickupPoint');
|
||||
$this->setClassName('\\ColissimoPickupPoint\\Model\\AddressColissimoPickupPoint');
|
||||
$this->setPackage('ColissimoPickupPoint.Model');
|
||||
$this->setUseIdGenerator(false);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('TITLE_ID', 'TitleId', 'INTEGER', 'customer_title', 'ID', true, null, null);
|
||||
$this->addColumn('COMPANY', 'Company', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('FIRSTNAME', 'Firstname', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('LASTNAME', 'Lastname', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('ADDRESS1', 'Address1', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('ADDRESS2', 'Address2', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('ADDRESS3', 'Address3', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('ZIPCODE', 'Zipcode', 'VARCHAR', true, 10, null);
|
||||
$this->addColumn('CITY', 'City', 'VARCHAR', true, 255, null);
|
||||
$this->addForeignKey('COUNTRY_ID', 'CountryId', 'INTEGER', 'country', 'ID', true, null, null);
|
||||
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 10, null);
|
||||
$this->addColumn('TYPE', 'Type', 'VARCHAR', true, 10, null);
|
||||
$this->addColumn('CELLPHONE', 'Cellphone', 'VARCHAR', false, 20, null);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('CustomerTitle', '\\ColissimoPickupPoint\\Model\\Thelia\\Model\\CustomerTitle', RelationMap::MANY_TO_ONE, array('title_id' => 'id', ), 'RESTRICT', 'RESTRICT');
|
||||
$this->addRelation('Country', '\\ColissimoPickupPoint\\Model\\Thelia\\Model\\Country', RelationMap::MANY_TO_ONE, array('country_id' => 'id', ), 'RESTRICT', '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 ? AddressColissimoPickupPointTableMap::CLASS_DEFAULT : AddressColissimoPickupPointTableMap::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 (AddressColissimoPickupPoint object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = AddressColissimoPickupPointTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = AddressColissimoPickupPointTableMap::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 + AddressColissimoPickupPointTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = AddressColissimoPickupPointTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
AddressColissimoPickupPointTableMap::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 = AddressColissimoPickupPointTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = AddressColissimoPickupPointTableMap::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;
|
||||
AddressColissimoPickupPointTableMap::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(AddressColissimoPickupPointTableMap::ID);
|
||||
$criteria->addSelectColumn(AddressColissimoPickupPointTableMap::TITLE_ID);
|
||||
$criteria->addSelectColumn(AddressColissimoPickupPointTableMap::COMPANY);
|
||||
$criteria->addSelectColumn(AddressColissimoPickupPointTableMap::FIRSTNAME);
|
||||
$criteria->addSelectColumn(AddressColissimoPickupPointTableMap::LASTNAME);
|
||||
$criteria->addSelectColumn(AddressColissimoPickupPointTableMap::ADDRESS1);
|
||||
$criteria->addSelectColumn(AddressColissimoPickupPointTableMap::ADDRESS2);
|
||||
$criteria->addSelectColumn(AddressColissimoPickupPointTableMap::ADDRESS3);
|
||||
$criteria->addSelectColumn(AddressColissimoPickupPointTableMap::ZIPCODE);
|
||||
$criteria->addSelectColumn(AddressColissimoPickupPointTableMap::CITY);
|
||||
$criteria->addSelectColumn(AddressColissimoPickupPointTableMap::COUNTRY_ID);
|
||||
$criteria->addSelectColumn(AddressColissimoPickupPointTableMap::CODE);
|
||||
$criteria->addSelectColumn(AddressColissimoPickupPointTableMap::TYPE);
|
||||
$criteria->addSelectColumn(AddressColissimoPickupPointTableMap::CELLPHONE);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.TITLE_ID');
|
||||
$criteria->addSelectColumn($alias . '.COMPANY');
|
||||
$criteria->addSelectColumn($alias . '.FIRSTNAME');
|
||||
$criteria->addSelectColumn($alias . '.LASTNAME');
|
||||
$criteria->addSelectColumn($alias . '.ADDRESS1');
|
||||
$criteria->addSelectColumn($alias . '.ADDRESS2');
|
||||
$criteria->addSelectColumn($alias . '.ADDRESS3');
|
||||
$criteria->addSelectColumn($alias . '.ZIPCODE');
|
||||
$criteria->addSelectColumn($alias . '.CITY');
|
||||
$criteria->addSelectColumn($alias . '.COUNTRY_ID');
|
||||
$criteria->addSelectColumn($alias . '.CODE');
|
||||
$criteria->addSelectColumn($alias . '.TYPE');
|
||||
$criteria->addSelectColumn($alias . '.CELLPHONE');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(AddressColissimoPickupPointTableMap::DATABASE_NAME)->getTable(AddressColissimoPickupPointTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(AddressColissimoPickupPointTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(AddressColissimoPickupPointTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new AddressColissimoPickupPointTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a AddressColissimoPickupPoint or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or AddressColissimoPickupPoint 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(AddressColissimoPickupPointTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \ColissimoPickupPoint\Model\AddressColissimoPickupPoint) { // 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(AddressColissimoPickupPointTableMap::DATABASE_NAME);
|
||||
$criteria->add(AddressColissimoPickupPointTableMap::ID, (array) $values, Criteria::IN);
|
||||
}
|
||||
|
||||
$query = AddressColissimoPickupPointQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { AddressColissimoPickupPointTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { AddressColissimoPickupPointTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the address_colissimo_pickup_point 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 AddressColissimoPickupPointQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a AddressColissimoPickupPoint or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or AddressColissimoPickupPoint 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(AddressColissimoPickupPointTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from AddressColissimoPickupPoint object
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = AddressColissimoPickupPointQuery::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;
|
||||
}
|
||||
|
||||
} // AddressColissimoPickupPointTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
AddressColissimoPickupPointTableMap::buildTableMap();
|
||||
@@ -0,0 +1,419 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Model\Map;
|
||||
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointAreaFreeshipping;
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointAreaFreeshippingQuery;
|
||||
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 'colissimo_pickup_point_area_freeshipping' 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 ColissimoPickupPointAreaFreeshippingTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'ColissimoPickupPoint.Model.Map.ColissimoPickupPointAreaFreeshippingTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'colissimo_pickup_point_area_freeshipping';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\ColissimoPickupPoint\\Model\\ColissimoPickupPointAreaFreeshipping';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'ColissimoPickupPoint.Model.ColissimoPickupPointAreaFreeshipping';
|
||||
|
||||
/**
|
||||
* 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 = 'colissimo_pickup_point_area_freeshipping.ID';
|
||||
|
||||
/**
|
||||
* the column name for the AREA_ID field
|
||||
*/
|
||||
const AREA_ID = 'colissimo_pickup_point_area_freeshipping.AREA_ID';
|
||||
|
||||
/**
|
||||
* the column name for the CART_AMOUNT field
|
||||
*/
|
||||
const CART_AMOUNT = 'colissimo_pickup_point_area_freeshipping.CART_AMOUNT';
|
||||
|
||||
/**
|
||||
* 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', 'AreaId', 'CartAmount', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'areaId', 'cartAmount', ),
|
||||
self::TYPE_COLNAME => array(ColissimoPickupPointAreaFreeshippingTableMap::ID, ColissimoPickupPointAreaFreeshippingTableMap::AREA_ID, ColissimoPickupPointAreaFreeshippingTableMap::CART_AMOUNT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'AREA_ID', 'CART_AMOUNT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'area_id', 'cart_amount', ),
|
||||
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, 'AreaId' => 1, 'CartAmount' => 2, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'areaId' => 1, 'cartAmount' => 2, ),
|
||||
self::TYPE_COLNAME => array(ColissimoPickupPointAreaFreeshippingTableMap::ID => 0, ColissimoPickupPointAreaFreeshippingTableMap::AREA_ID => 1, ColissimoPickupPointAreaFreeshippingTableMap::CART_AMOUNT => 2, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'AREA_ID' => 1, 'CART_AMOUNT' => 2, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'area_id' => 1, 'cart_amount' => 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('colissimo_pickup_point_area_freeshipping');
|
||||
$this->setPhpName('ColissimoPickupPointAreaFreeshipping');
|
||||
$this->setClassName('\\ColissimoPickupPoint\\Model\\ColissimoPickupPointAreaFreeshipping');
|
||||
$this->setPackage('ColissimoPickupPoint.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('AREA_ID', 'AreaId', 'INTEGER', 'area', 'ID', true, null, null);
|
||||
$this->addColumn('CART_AMOUNT', 'CartAmount', 'DECIMAL', false, 18, 0);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Area', '\\ColissimoPickupPoint\\Model\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'RESTRICT', '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 ? ColissimoPickupPointAreaFreeshippingTableMap::CLASS_DEFAULT : ColissimoPickupPointAreaFreeshippingTableMap::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 (ColissimoPickupPointAreaFreeshipping object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = ColissimoPickupPointAreaFreeshippingTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = ColissimoPickupPointAreaFreeshippingTableMap::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 + ColissimoPickupPointAreaFreeshippingTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = ColissimoPickupPointAreaFreeshippingTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
ColissimoPickupPointAreaFreeshippingTableMap::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 = ColissimoPickupPointAreaFreeshippingTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = ColissimoPickupPointAreaFreeshippingTableMap::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;
|
||||
ColissimoPickupPointAreaFreeshippingTableMap::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(ColissimoPickupPointAreaFreeshippingTableMap::ID);
|
||||
$criteria->addSelectColumn(ColissimoPickupPointAreaFreeshippingTableMap::AREA_ID);
|
||||
$criteria->addSelectColumn(ColissimoPickupPointAreaFreeshippingTableMap::CART_AMOUNT);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.AREA_ID');
|
||||
$criteria->addSelectColumn($alias . '.CART_AMOUNT');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(ColissimoPickupPointAreaFreeshippingTableMap::DATABASE_NAME)->getTable(ColissimoPickupPointAreaFreeshippingTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(ColissimoPickupPointAreaFreeshippingTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(ColissimoPickupPointAreaFreeshippingTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new ColissimoPickupPointAreaFreeshippingTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ColissimoPickupPointAreaFreeshipping or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ColissimoPickupPointAreaFreeshipping 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(ColissimoPickupPointAreaFreeshippingTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \ColissimoPickupPoint\Model\ColissimoPickupPointAreaFreeshipping) { // 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(ColissimoPickupPointAreaFreeshippingTableMap::DATABASE_NAME);
|
||||
$criteria->add(ColissimoPickupPointAreaFreeshippingTableMap::ID, (array) $values, Criteria::IN);
|
||||
}
|
||||
|
||||
$query = ColissimoPickupPointAreaFreeshippingQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { ColissimoPickupPointAreaFreeshippingTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { ColissimoPickupPointAreaFreeshippingTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the colissimo_pickup_point_area_freeshipping 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 ColissimoPickupPointAreaFreeshippingQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a ColissimoPickupPointAreaFreeshipping or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or ColissimoPickupPointAreaFreeshipping 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(ColissimoPickupPointAreaFreeshippingTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from ColissimoPickupPointAreaFreeshipping object
|
||||
}
|
||||
|
||||
if ($criteria->containsKey(ColissimoPickupPointAreaFreeshippingTableMap::ID) && $criteria->keyContainsValue(ColissimoPickupPointAreaFreeshippingTableMap::ID) ) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key ('.ColissimoPickupPointAreaFreeshippingTableMap::ID.')');
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = ColissimoPickupPointAreaFreeshippingQuery::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;
|
||||
}
|
||||
|
||||
} // ColissimoPickupPointAreaFreeshippingTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
ColissimoPickupPointAreaFreeshippingTableMap::buildTableMap();
|
||||
@@ -0,0 +1,414 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Model\Map;
|
||||
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointFreeshipping;
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointFreeshippingQuery;
|
||||
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 'colissimo_pickup_point_freeshipping' 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 ColissimoPickupPointFreeshippingTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'ColissimoPickupPoint.Model.Map.ColissimoPickupPointFreeshippingTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'colissimo_pickup_point_freeshipping';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\ColissimoPickupPoint\\Model\\ColissimoPickupPointFreeshipping';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'ColissimoPickupPoint.Model.ColissimoPickupPointFreeshipping';
|
||||
|
||||
/**
|
||||
* 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 = 'colissimo_pickup_point_freeshipping.ID';
|
||||
|
||||
/**
|
||||
* the column name for the ACTIVE field
|
||||
*/
|
||||
const ACTIVE = 'colissimo_pickup_point_freeshipping.ACTIVE';
|
||||
|
||||
/**
|
||||
* the column name for the FREESHIPPING_FROM field
|
||||
*/
|
||||
const FREESHIPPING_FROM = 'colissimo_pickup_point_freeshipping.FREESHIPPING_FROM';
|
||||
|
||||
/**
|
||||
* 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', 'Active', 'FreeshippingFrom', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'active', 'freeshippingFrom', ),
|
||||
self::TYPE_COLNAME => array(ColissimoPickupPointFreeshippingTableMap::ID, ColissimoPickupPointFreeshippingTableMap::ACTIVE, ColissimoPickupPointFreeshippingTableMap::FREESHIPPING_FROM, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'ACTIVE', 'FREESHIPPING_FROM', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'active', 'freeshipping_from', ),
|
||||
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, 'Active' => 1, 'FreeshippingFrom' => 2, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'active' => 1, 'freeshippingFrom' => 2, ),
|
||||
self::TYPE_COLNAME => array(ColissimoPickupPointFreeshippingTableMap::ID => 0, ColissimoPickupPointFreeshippingTableMap::ACTIVE => 1, ColissimoPickupPointFreeshippingTableMap::FREESHIPPING_FROM => 2, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'ACTIVE' => 1, 'FREESHIPPING_FROM' => 2, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'active' => 1, 'freeshipping_from' => 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('colissimo_pickup_point_freeshipping');
|
||||
$this->setPhpName('ColissimoPickupPointFreeshipping');
|
||||
$this->setClassName('\\ColissimoPickupPoint\\Model\\ColissimoPickupPointFreeshipping');
|
||||
$this->setPackage('ColissimoPickupPoint.Model');
|
||||
$this->setUseIdGenerator(false);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('ACTIVE', 'Active', 'BOOLEAN', false, 1, false);
|
||||
$this->addColumn('FREESHIPPING_FROM', 'FreeshippingFrom', 'DECIMAL', false, 18, 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 ? ColissimoPickupPointFreeshippingTableMap::CLASS_DEFAULT : ColissimoPickupPointFreeshippingTableMap::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 (ColissimoPickupPointFreeshipping object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = ColissimoPickupPointFreeshippingTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = ColissimoPickupPointFreeshippingTableMap::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 + ColissimoPickupPointFreeshippingTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = ColissimoPickupPointFreeshippingTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
ColissimoPickupPointFreeshippingTableMap::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 = ColissimoPickupPointFreeshippingTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = ColissimoPickupPointFreeshippingTableMap::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;
|
||||
ColissimoPickupPointFreeshippingTableMap::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(ColissimoPickupPointFreeshippingTableMap::ID);
|
||||
$criteria->addSelectColumn(ColissimoPickupPointFreeshippingTableMap::ACTIVE);
|
||||
$criteria->addSelectColumn(ColissimoPickupPointFreeshippingTableMap::FREESHIPPING_FROM);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.ACTIVE');
|
||||
$criteria->addSelectColumn($alias . '.FREESHIPPING_FROM');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(ColissimoPickupPointFreeshippingTableMap::DATABASE_NAME)->getTable(ColissimoPickupPointFreeshippingTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(ColissimoPickupPointFreeshippingTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(ColissimoPickupPointFreeshippingTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new ColissimoPickupPointFreeshippingTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ColissimoPickupPointFreeshipping or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ColissimoPickupPointFreeshipping 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(ColissimoPickupPointFreeshippingTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \ColissimoPickupPoint\Model\ColissimoPickupPointFreeshipping) { // 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(ColissimoPickupPointFreeshippingTableMap::DATABASE_NAME);
|
||||
$criteria->add(ColissimoPickupPointFreeshippingTableMap::ID, (array) $values, Criteria::IN);
|
||||
}
|
||||
|
||||
$query = ColissimoPickupPointFreeshippingQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { ColissimoPickupPointFreeshippingTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { ColissimoPickupPointFreeshippingTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the colissimo_pickup_point_freeshipping 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 ColissimoPickupPointFreeshippingQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a ColissimoPickupPointFreeshipping or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or ColissimoPickupPointFreeshipping 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(ColissimoPickupPointFreeshippingTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from ColissimoPickupPointFreeshipping object
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = ColissimoPickupPointFreeshippingQuery::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;
|
||||
}
|
||||
|
||||
} // ColissimoPickupPointFreeshippingTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
ColissimoPickupPointFreeshippingTableMap::buildTableMap();
|
||||
@@ -0,0 +1,443 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Model\Map;
|
||||
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlices;
|
||||
use ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlicesQuery;
|
||||
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 'colissimo_pickup_point_price_slices' 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 ColissimoPickupPointPriceSlicesTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'ColissimoPickupPoint.Model.Map.ColissimoPickupPointPriceSlicesTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'colissimo_pickup_point_price_slices';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\ColissimoPickupPoint\\Model\\ColissimoPickupPointPriceSlices';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'ColissimoPickupPoint.Model.ColissimoPickupPointPriceSlices';
|
||||
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 6;
|
||||
|
||||
/**
|
||||
* 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 = 6;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
*/
|
||||
const ID = 'colissimo_pickup_point_price_slices.ID';
|
||||
|
||||
/**
|
||||
* the column name for the AREA_ID field
|
||||
*/
|
||||
const AREA_ID = 'colissimo_pickup_point_price_slices.AREA_ID';
|
||||
|
||||
/**
|
||||
* the column name for the WEIGHT_MAX field
|
||||
*/
|
||||
const WEIGHT_MAX = 'colissimo_pickup_point_price_slices.WEIGHT_MAX';
|
||||
|
||||
/**
|
||||
* the column name for the PRICE_MAX field
|
||||
*/
|
||||
const PRICE_MAX = 'colissimo_pickup_point_price_slices.PRICE_MAX';
|
||||
|
||||
/**
|
||||
* the column name for the FRANCO_MIN_PRICE field
|
||||
*/
|
||||
const FRANCO_MIN_PRICE = 'colissimo_pickup_point_price_slices.FRANCO_MIN_PRICE';
|
||||
|
||||
/**
|
||||
* the column name for the PRICE field
|
||||
*/
|
||||
const PRICE = 'colissimo_pickup_point_price_slices.PRICE';
|
||||
|
||||
/**
|
||||
* 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', 'AreaId', 'WeightMax', 'PriceMax', 'FrancoMinPrice', 'Price', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'areaId', 'weightMax', 'priceMax', 'francoMinPrice', 'price', ),
|
||||
self::TYPE_COLNAME => array(ColissimoPickupPointPriceSlicesTableMap::ID, ColissimoPickupPointPriceSlicesTableMap::AREA_ID, ColissimoPickupPointPriceSlicesTableMap::WEIGHT_MAX, ColissimoPickupPointPriceSlicesTableMap::PRICE_MAX, ColissimoPickupPointPriceSlicesTableMap::FRANCO_MIN_PRICE, ColissimoPickupPointPriceSlicesTableMap::PRICE, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'AREA_ID', 'WEIGHT_MAX', 'PRICE_MAX', 'FRANCO_MIN_PRICE', 'PRICE', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'area_id', 'weight_max', 'price_max', 'franco_min_price', 'price', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
|
||||
);
|
||||
|
||||
/**
|
||||
* 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, 'AreaId' => 1, 'WeightMax' => 2, 'PriceMax' => 3, 'FrancoMinPrice' => 4, 'Price' => 5, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'areaId' => 1, 'weightMax' => 2, 'priceMax' => 3, 'francoMinPrice' => 4, 'price' => 5, ),
|
||||
self::TYPE_COLNAME => array(ColissimoPickupPointPriceSlicesTableMap::ID => 0, ColissimoPickupPointPriceSlicesTableMap::AREA_ID => 1, ColissimoPickupPointPriceSlicesTableMap::WEIGHT_MAX => 2, ColissimoPickupPointPriceSlicesTableMap::PRICE_MAX => 3, ColissimoPickupPointPriceSlicesTableMap::FRANCO_MIN_PRICE => 4, ColissimoPickupPointPriceSlicesTableMap::PRICE => 5, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'AREA_ID' => 1, 'WEIGHT_MAX' => 2, 'PRICE_MAX' => 3, 'FRANCO_MIN_PRICE' => 4, 'PRICE' => 5, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'area_id' => 1, 'weight_max' => 2, 'price_max' => 3, 'franco_min_price' => 4, 'price' => 5, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
|
||||
);
|
||||
|
||||
/**
|
||||
* 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('colissimo_pickup_point_price_slices');
|
||||
$this->setPhpName('ColissimoPickupPointPriceSlices');
|
||||
$this->setClassName('\\ColissimoPickupPoint\\Model\\ColissimoPickupPointPriceSlices');
|
||||
$this->setPackage('ColissimoPickupPoint.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('AREA_ID', 'AreaId', 'INTEGER', 'area', 'ID', true, null, null);
|
||||
$this->addColumn('WEIGHT_MAX', 'WeightMax', 'FLOAT', false, null, null);
|
||||
$this->addColumn('PRICE_MAX', 'PriceMax', 'FLOAT', false, null, null);
|
||||
$this->addColumn('FRANCO_MIN_PRICE', 'FrancoMinPrice', 'FLOAT', false, null, null);
|
||||
$this->addColumn('PRICE', 'Price', 'FLOAT', true, null, null);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Area', '\\ColissimoPickupPoint\\Model\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), 'RESTRICT', '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 ? ColissimoPickupPointPriceSlicesTableMap::CLASS_DEFAULT : ColissimoPickupPointPriceSlicesTableMap::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 (ColissimoPickupPointPriceSlices object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = ColissimoPickupPointPriceSlicesTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = ColissimoPickupPointPriceSlicesTableMap::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 + ColissimoPickupPointPriceSlicesTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = ColissimoPickupPointPriceSlicesTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
ColissimoPickupPointPriceSlicesTableMap::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 = ColissimoPickupPointPriceSlicesTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = ColissimoPickupPointPriceSlicesTableMap::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;
|
||||
ColissimoPickupPointPriceSlicesTableMap::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(ColissimoPickupPointPriceSlicesTableMap::ID);
|
||||
$criteria->addSelectColumn(ColissimoPickupPointPriceSlicesTableMap::AREA_ID);
|
||||
$criteria->addSelectColumn(ColissimoPickupPointPriceSlicesTableMap::WEIGHT_MAX);
|
||||
$criteria->addSelectColumn(ColissimoPickupPointPriceSlicesTableMap::PRICE_MAX);
|
||||
$criteria->addSelectColumn(ColissimoPickupPointPriceSlicesTableMap::FRANCO_MIN_PRICE);
|
||||
$criteria->addSelectColumn(ColissimoPickupPointPriceSlicesTableMap::PRICE);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.AREA_ID');
|
||||
$criteria->addSelectColumn($alias . '.WEIGHT_MAX');
|
||||
$criteria->addSelectColumn($alias . '.PRICE_MAX');
|
||||
$criteria->addSelectColumn($alias . '.FRANCO_MIN_PRICE');
|
||||
$criteria->addSelectColumn($alias . '.PRICE');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(ColissimoPickupPointPriceSlicesTableMap::DATABASE_NAME)->getTable(ColissimoPickupPointPriceSlicesTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(ColissimoPickupPointPriceSlicesTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(ColissimoPickupPointPriceSlicesTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new ColissimoPickupPointPriceSlicesTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ColissimoPickupPointPriceSlices or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ColissimoPickupPointPriceSlices 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(ColissimoPickupPointPriceSlicesTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \ColissimoPickupPoint\Model\ColissimoPickupPointPriceSlices) { // 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(ColissimoPickupPointPriceSlicesTableMap::DATABASE_NAME);
|
||||
$criteria->add(ColissimoPickupPointPriceSlicesTableMap::ID, (array) $values, Criteria::IN);
|
||||
}
|
||||
|
||||
$query = ColissimoPickupPointPriceSlicesQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { ColissimoPickupPointPriceSlicesTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { ColissimoPickupPointPriceSlicesTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the colissimo_pickup_point_price_slices 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 ColissimoPickupPointPriceSlicesQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a ColissimoPickupPointPriceSlices or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or ColissimoPickupPointPriceSlices 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(ColissimoPickupPointPriceSlicesTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from ColissimoPickupPointPriceSlices object
|
||||
}
|
||||
|
||||
if ($criteria->containsKey(ColissimoPickupPointPriceSlicesTableMap::ID) && $criteria->keyContainsValue(ColissimoPickupPointPriceSlicesTableMap::ID) ) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key ('.ColissimoPickupPointPriceSlicesTableMap::ID.')');
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = ColissimoPickupPointPriceSlicesQuery::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;
|
||||
}
|
||||
|
||||
} // ColissimoPickupPointPriceSlicesTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
ColissimoPickupPointPriceSlicesTableMap::buildTableMap();
|
||||
@@ -0,0 +1,415 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Model\Map;
|
||||
|
||||
use ColissimoPickupPoint\Model\OrderAddressColissimoPickupPoint;
|
||||
use ColissimoPickupPoint\Model\OrderAddressColissimoPickupPointQuery;
|
||||
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 'order_address_colissimo_pickup_point' 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 OrderAddressColissimoPickupPointTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'ColissimoPickupPoint.Model.Map.OrderAddressColissimoPickupPointTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'order_address_colissimo_pickup_point';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\ColissimoPickupPoint\\Model\\OrderAddressColissimoPickupPoint';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'ColissimoPickupPoint.Model.OrderAddressColissimoPickupPoint';
|
||||
|
||||
/**
|
||||
* 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 = 'order_address_colissimo_pickup_point.ID';
|
||||
|
||||
/**
|
||||
* the column name for the CODE field
|
||||
*/
|
||||
const CODE = 'order_address_colissimo_pickup_point.CODE';
|
||||
|
||||
/**
|
||||
* the column name for the TYPE field
|
||||
*/
|
||||
const TYPE = 'order_address_colissimo_pickup_point.TYPE';
|
||||
|
||||
/**
|
||||
* 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', 'Code', 'Type', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'code', 'type', ),
|
||||
self::TYPE_COLNAME => array(OrderAddressColissimoPickupPointTableMap::ID, OrderAddressColissimoPickupPointTableMap::CODE, OrderAddressColissimoPickupPointTableMap::TYPE, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'CODE', 'TYPE', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'code', 'type', ),
|
||||
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, 'Code' => 1, 'Type' => 2, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, 'type' => 2, ),
|
||||
self::TYPE_COLNAME => array(OrderAddressColissimoPickupPointTableMap::ID => 0, OrderAddressColissimoPickupPointTableMap::CODE => 1, OrderAddressColissimoPickupPointTableMap::TYPE => 2, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, 'TYPE' => 2, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 1, 'type' => 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('order_address_colissimo_pickup_point');
|
||||
$this->setPhpName('OrderAddressColissimoPickupPoint');
|
||||
$this->setClassName('\\ColissimoPickupPoint\\Model\\OrderAddressColissimoPickupPoint');
|
||||
$this->setPackage('ColissimoPickupPoint.Model');
|
||||
$this->setUseIdGenerator(false);
|
||||
// columns
|
||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'order_address', 'ID', true, null, null);
|
||||
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 10, null);
|
||||
$this->addColumn('TYPE', 'Type', 'VARCHAR', true, 10, null);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('OrderAddress', '\\ColissimoPickupPoint\\Model\\Thelia\\Model\\OrderAddress', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', 'CASCADE');
|
||||
} // 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 ? OrderAddressColissimoPickupPointTableMap::CLASS_DEFAULT : OrderAddressColissimoPickupPointTableMap::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 (OrderAddressColissimoPickupPoint object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = OrderAddressColissimoPickupPointTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = OrderAddressColissimoPickupPointTableMap::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 + OrderAddressColissimoPickupPointTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = OrderAddressColissimoPickupPointTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
OrderAddressColissimoPickupPointTableMap::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 = OrderAddressColissimoPickupPointTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = OrderAddressColissimoPickupPointTableMap::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;
|
||||
OrderAddressColissimoPickupPointTableMap::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(OrderAddressColissimoPickupPointTableMap::ID);
|
||||
$criteria->addSelectColumn(OrderAddressColissimoPickupPointTableMap::CODE);
|
||||
$criteria->addSelectColumn(OrderAddressColissimoPickupPointTableMap::TYPE);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.CODE');
|
||||
$criteria->addSelectColumn($alias . '.TYPE');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(OrderAddressColissimoPickupPointTableMap::DATABASE_NAME)->getTable(OrderAddressColissimoPickupPointTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(OrderAddressColissimoPickupPointTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(OrderAddressColissimoPickupPointTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new OrderAddressColissimoPickupPointTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a OrderAddressColissimoPickupPoint or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or OrderAddressColissimoPickupPoint 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(OrderAddressColissimoPickupPointTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \ColissimoPickupPoint\Model\OrderAddressColissimoPickupPoint) { // 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(OrderAddressColissimoPickupPointTableMap::DATABASE_NAME);
|
||||
$criteria->add(OrderAddressColissimoPickupPointTableMap::ID, (array) $values, Criteria::IN);
|
||||
}
|
||||
|
||||
$query = OrderAddressColissimoPickupPointQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { OrderAddressColissimoPickupPointTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { OrderAddressColissimoPickupPointTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the order_address_colissimo_pickup_point 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 OrderAddressColissimoPickupPointQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a OrderAddressColissimoPickupPoint or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or OrderAddressColissimoPickupPoint 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(OrderAddressColissimoPickupPointTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from OrderAddressColissimoPickupPoint object
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = OrderAddressColissimoPickupPointQuery::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;
|
||||
}
|
||||
|
||||
} // OrderAddressColissimoPickupPointTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
OrderAddressColissimoPickupPointTableMap::buildTableMap();
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Model;
|
||||
|
||||
use ColissimoPickupPoint\Model\Base\OrderAddressColissimoPickupPoint as BaseOrderAddressColissimoPickupPoint;
|
||||
|
||||
class OrderAddressColissimoPickupPoint extends BaseOrderAddressColissimoPickupPoint
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Model;
|
||||
|
||||
use ColissimoPickupPoint\Model\Base\OrderAddressColissimoPickupPointQuery as BaseOrderAddressColissimoPickupPointQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'order_address_colissimo_pickup_point' 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 OrderAddressColissimoPickupPointQuery extends BaseOrderAddressColissimoPickupPointQuery
|
||||
{
|
||||
|
||||
} // OrderAddressColissimoPickupPointQuery
|
||||
147
local/modules/ColissimoPickupPoint/README.md
Executable file
@@ -0,0 +1,147 @@
|
||||
# ColissimoHomeDelivery
|
||||
|
||||
Adds a delivery system for Colissimo pickup delivery.
|
||||
For home delivery look at this module https://github.com/thelia-modules/ColissimoPickupPoint
|
||||
|
||||
Summary
|
||||
=======
|
||||
|
||||
1. Install notes
|
||||
2. How to use
|
||||
3. Loops
|
||||
4. Integration
|
||||
|
||||
Instructions
|
||||
=====
|
||||
Install notes
|
||||
-----------
|
||||
### Manually
|
||||
|
||||
* Copy the module into ```<thelia_root>/local/modules/``` directory and be sure that the name of the module is ColissimoPickupPoint.
|
||||
* Activate it in your thelia administration panel
|
||||
|
||||
### Composer
|
||||
|
||||
Add it in your main thelia composer.json file
|
||||
|
||||
```
|
||||
composer require thelia/colissimo-pickup-point-module:~1.0.0
|
||||
```
|
||||
|
||||
How to use
|
||||
-----------
|
||||
First, go to your back office, tab Modules, and activate the module ColissimoPickupPoint.
|
||||
Then go to the ColissimoPickupPoint config page, tab "Advanced Configuration" and enter your Colissimo id and password.
|
||||
To import exported files in Expeditor INET, you need the file THELIA_INET.FMT, that is in the archive.
|
||||
|
||||
Loops
|
||||
-----
|
||||
1. colissimo.pickup.point.check.rights
|
||||
- Arguments:
|
||||
None
|
||||
- Output:
|
||||
1. $ERRMES: Error message
|
||||
2. $ERRFILE: File where the error has been detected
|
||||
- Usage:
|
||||
```{loop name="yourloopname" type="colissimo.pickup.point.check.rights"}<!-- your template -->{/loop}```
|
||||
|
||||
2. colissimo.pickup.point
|
||||
- Arguments:
|
||||
1. area_id | mandatory | id of the area we want to know the price slices of
|
||||
- Output:
|
||||
1. $SLICE_ID: The ID of this price slice
|
||||
2. $MAX_WEIGHT: Max cart weight for the price slice
|
||||
3. $MAX_PRICE: Max cart price for the price slice
|
||||
4. $PRICE: Delivery price for this price slice
|
||||
5. $FRANCO: UNUSED
|
||||
- Usage:
|
||||
```{loop name="yourloopname" type="colissimo.pickup.point"}<!-- your template -->{/loop}```
|
||||
|
||||
3. colissimo.pickup.point.id
|
||||
- Arguments:
|
||||
None
|
||||
- Output:
|
||||
1. $MODULE_ID: Id of the ColissimoPickupPoint module
|
||||
- Usage:
|
||||
```{loop name="yourloopname" type="colissimo.pickup.point.id"}<!-- your template -->{/loop}```
|
||||
|
||||
4. colissimo.pickup.point.around
|
||||
- Arguments:
|
||||
1. countryid | optionnal | Country ID of where the search location is
|
||||
2. zipcode | optionnal | Zipcode of the searched city
|
||||
3. city | optionnal | Name of the searched city
|
||||
4. address | optionnal | Id of the address to use for the search.
|
||||
address cannot be used at the same time as zipcode + city
|
||||
- Output:
|
||||
1. $LONGITUDE: longitude of the pickup & go store
|
||||
2. $LATITUDE : latitude of the pickup & go store
|
||||
3. $CODE : ID of the pickup & go store
|
||||
4. $ADDRESS : address of the pickup & go store
|
||||
5. $ZIPCODE : zipcode of the pickup & go store
|
||||
6. $CITY : city of the pickup & go store
|
||||
7. $DISTANCE : distance between the store and the customer's address/searched address
|
||||
- Usage:
|
||||
```{loop name="yourloopname" type="colissimo.pickup.point.around"}<!-- your template -->{/loop}```
|
||||
|
||||
5. address.colissimo.pickup.point
|
||||
- Arguments:
|
||||
The same as the loop address
|
||||
- Output:
|
||||
The same as the loop address, but with pickup & go store's address
|
||||
- Usage:
|
||||
```{loop name="yourloopname" type="address.colissimo.pickup.point"}<!-- your template -->{/loop}```
|
||||
|
||||
6. order.notsent.colissimo.pickup.point
|
||||
- Arguments:
|
||||
None
|
||||
- Output:
|
||||
The same as the loop order, but with not sent ColissimoPickupPoint orders.
|
||||
- Usage:
|
||||
```{loop name="yourloopname" type="order.notsent.colissimo.pickup.point"}<!-- your template -->{/loop}```
|
||||
|
||||
7. colissimo.pickup.point.order_address
|
||||
- Arguments:
|
||||
1. id | mandatory | ID of the OrderAddressColissimoPickupPoint that should be retrieved by the loop.
|
||||
- Outputs:
|
||||
1. $ID : OrderAddressColissimoPickupPoint ID.
|
||||
2. $CODE : OrderAddressColissimoPickupPoint code.
|
||||
3. $TYPE : OrderAddressColissimoPickupPoint type.
|
||||
- Usage:
|
||||
```{loop name="yourloopname" type="colissimo.pickup.point.order_address"}<!-- your template -->{/loop}```
|
||||
|
||||
8. colissimo.pickup.point.area.freeshipping
|
||||
- Arguments:
|
||||
1. area_id | optionnal | Id of the area we want to know if freeshipping from is active
|
||||
- Outputs:
|
||||
1. $ID : ColissimoPickupPointAreaFreeshipping ID.
|
||||
2. $AREA_ID : The area ID.
|
||||
3. $CART_AMOUNT : The minimum cart amount to have free shipping for this area.
|
||||
- Usage:
|
||||
```{loop name="yourloopname" type="colissimo.pickup.point.area.freeshipping"}<!-- your template -->{/loop}```
|
||||
|
||||
9. colissimo.pickup.point.freeshipping
|
||||
- Arguments:
|
||||
1. id | optionnal | Should always be 1.
|
||||
- Outputs:
|
||||
1. $FREESHIPPING_ACTIVE : Whether free shipping is activated with no restrictions on all area.
|
||||
2. $FREESHIPPING_FROM : The minimum cart amount to have free shipping on all alreas.
|
||||
- Usage:
|
||||
```{loop name="yourloopname" type="colissimo.pickup.point.freeshipping"}<!-- your template -->{/loop}```
|
||||
|
||||
Plugins Smarty
|
||||
-----
|
||||
1. colissimoPickupPointDeliveryPrice
|
||||
- Arguments:
|
||||
1. country | optionnal | The country ID from which you want to get the delivery prices. Defaults to store country
|
||||
- Outputs:
|
||||
1. $isValidMode : Whether the delivery is valid for the cart in session and the chosen country.
|
||||
2. $deliveryPrice : The delivery price for the cart in session in the chosen country.
|
||||
- Usage:
|
||||
```{colissimoPickupPointDeliveryPrice country=64}```
|
||||
|
||||
Integration
|
||||
-----------
|
||||
A integration example is available for the default theme of Thelia.
|
||||
To install it, copy the files of pathToColissimoPickupPoint/templates/frontOffice/default and
|
||||
pathToColissimoPickupPoint/templates/frontOffice/default/ajax respectively in pathToThelia/templates/frontOffice/default
|
||||
and pathToThelia/templates/frontOffice/default/ajax
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Smarty\Plugins;
|
||||
|
||||
use ColissimoPickupPoint\ColissimoPickupPoint;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
use Thelia\Model\CountryQuery;
|
||||
use Thelia\Model\Country;
|
||||
use Thelia\Module\Exception\DeliveryException;
|
||||
use TheliaSmarty\Template\AbstractSmartyPlugin;
|
||||
use TheliaSmarty\Template\SmartyPluginDescriptor;
|
||||
|
||||
class ColissimoPickupPointDeliveryPrice extends AbstractSmartyPlugin
|
||||
{
|
||||
protected $request;
|
||||
protected $dispatcher;
|
||||
|
||||
public function __construct(
|
||||
Request $request,
|
||||
EventDispatcherInterface $dispatcher = null
|
||||
) {
|
||||
$this->request = $request;
|
||||
$this->dispatcher = $dispatcher;
|
||||
}
|
||||
|
||||
public function getPluginDescriptors()
|
||||
{
|
||||
return array(
|
||||
new SmartyPluginDescriptor('function', 'colissimoPickupPointDeliveryPrice', $this, 'colissimoPickupPointDeliveryPrice')
|
||||
);
|
||||
}
|
||||
|
||||
public function colissimoPickupPointDeliveryPrice($params, $smarty)
|
||||
{
|
||||
$country = Country::getShopLocation();
|
||||
if (isset($params['country'])) {
|
||||
$country = CountryQuery::create()->findOneById($params['country']);
|
||||
}
|
||||
|
||||
$cartWeight = $this->request->getSession()->getSessionCart($this->dispatcher)->getWeight();
|
||||
$cartAmount = $this->request->getSession()->getSessionCart($this->dispatcher)->getTaxedAmount($country);
|
||||
|
||||
try {
|
||||
$price = ColissimoPickupPoint::getPostageAmount(
|
||||
$country->getAreaId(),
|
||||
$cartWeight,
|
||||
$cartAmount
|
||||
);
|
||||
} catch (DeliveryException $ex) {
|
||||
$smarty->assign('isValidMode', false);
|
||||
}
|
||||
|
||||
$smarty->assign('deliveryPrice', $price);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace ColissimoPickupPoint\Smarty\Plugins;
|
||||
|
||||
|
||||
use Thelia\Model\ModuleConfigQuery;
|
||||
use TheliaSmarty\Template\AbstractSmartyPlugin;
|
||||
use TheliaSmarty\Template\SmartyPluginDescriptor;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Thelia\Core\HttpFoundation\Request;
|
||||
|
||||
class ColissimoPickupPointGoogleApiKey extends AbstractSmartyPlugin
|
||||
{
|
||||
protected $request;
|
||||
protected $dispatcher;
|
||||
|
||||
public function __construct(
|
||||
Request $request,
|
||||
EventDispatcherInterface $dispatcher = null
|
||||
) {
|
||||
$this->request = $request;
|
||||
$this->dispatcher = $dispatcher;
|
||||
}
|
||||
|
||||
public function getPluginDescriptors()
|
||||
{
|
||||
return array(
|
||||
new SmartyPluginDescriptor('function', 'colissimoPickupPointGoogleApiKey', $this, 'colissimoPickupPointGoogleApiKey')
|
||||
);
|
||||
}
|
||||
|
||||
public function colissimoPickupPointGoogleApiKey($params, $smarty)
|
||||
{
|
||||
$key = ModuleConfigQuery::create()
|
||||
->filterByName('colissimo_pickup_point_google_map_key')
|
||||
->findOne()
|
||||
->getValue()
|
||||
;
|
||||
|
||||
$smarty->assign('colissimoPickupPointGoogleMapKey', $key);
|
||||
|
||||
return $key;
|
||||
}
|
||||
}
|
||||
25
local/modules/ColissimoPickupPoint/THELIA_INET.FMT
Normal file
@@ -0,0 +1,25 @@
|
||||
[GENERAL]
|
||||
DELIMITE=O
|
||||
SEPARATEUR=59
|
||||
DELIMITEUR=34
|
||||
FINDELIGNE=CRLF
|
||||
Unité poids=KG
|
||||
[CHAMPS]
|
||||
Prenom=1
|
||||
NomDestinataire=2
|
||||
RaisonSociale=3
|
||||
Adresse1=4
|
||||
Adresse2=5
|
||||
Adresse3=6
|
||||
CodePostal=7
|
||||
Commune=8
|
||||
CodePays=9
|
||||
Telephone=10
|
||||
Portable=11
|
||||
CodeProduit=12
|
||||
Civilite=13
|
||||
CodePointRetrait=14
|
||||
Mail=15
|
||||
Poids=16
|
||||
NomCommercialChargeur=17
|
||||
typeDePoint=18
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoPickupPoint\Utils;
|
||||
|
||||
use ColissimoPickupPoint\ColissimoPickupPoint;
|
||||
|
||||
/**
|
||||
* Class ColissimoCodeReseau
|
||||
* @package ColissimoPickupPoint\Utils
|
||||
*/
|
||||
class ColissimoCodeReseau
|
||||
{
|
||||
const CODE_RESEAU_ARRAY =
|
||||
[
|
||||
'DE' =>
|
||||
[
|
||||
'CMT' => 'R03',
|
||||
'BDP' => 'X00',
|
||||
'PCS' => 'X00'
|
||||
],
|
||||
'ES' =>
|
||||
[
|
||||
'CMT' => 'R03',
|
||||
'BDP' => 'X00',
|
||||
],
|
||||
'GB' =>
|
||||
[
|
||||
'CMT' => 'R03'
|
||||
],
|
||||
'LU' =>
|
||||
[
|
||||
'CMT' => 'R03'
|
||||
],
|
||||
'NL' =>
|
||||
[
|
||||
'BDP' => 'X00',
|
||||
'CMT' => 'R03',
|
||||
],
|
||||
'BE' =>
|
||||
[
|
||||
'BDP' => 'R12',
|
||||
'CMT' => 'R12',
|
||||
]
|
||||
];
|
||||
|
||||
public static function getCodeReseau($countryCode, $relayTypeCode)
|
||||
{
|
||||
if (array_key_exists($countryCode, self::CODE_RESEAU_ARRAY)) {
|
||||
$innerArray = self::CODE_RESEAU_ARRAY[$countryCode];
|
||||
if (array_key_exists($relayTypeCode, $innerArray)) {
|
||||
return $innerArray[$relayTypeCode];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?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 ColissimoPickupPoint\WebService;
|
||||
|
||||
use ColissimoPickupPoint\ColissimoPickupPoint;
|
||||
|
||||
/**
|
||||
* Class BaseColissimoPickupPointWebService
|
||||
* @package ColissimoPickupPoint\WebService
|
||||
* @author Thelia <info@thelia.net>
|
||||
*
|
||||
* @method BaseColissimoPickupPointWebService getAccountNumber()
|
||||
* @method BaseColissimoPickupPointWebService setAccountNumber($value)
|
||||
* @method BaseColissimoPickupPointWebService getPassword()
|
||||
* @method BaseColissimoPickupPointWebService setPassword($value)
|
||||
* @method BaseColissimoPickupPointWebService getWeight()
|
||||
* @method BaseColissimoPickupPointWebService setWeight($value)
|
||||
*/
|
||||
abstract class BaseColissimoPickupPointWebService extends BaseWebService
|
||||
{
|
||||
|
||||
protected $account_number=null;
|
||||
protected $password=null;
|
||||
protected $filter_relay=null;
|
||||
/** @var string Weight in grammes !*/
|
||||
protected $weight=null;
|
||||
|
||||
public function __construct($function)
|
||||
{
|
||||
$url = ColissimoPickupPoint::getConfigValue(ColissimoPickupPoint::COLISSIMO_ENDPOINT);
|
||||
|
||||
parent::__construct($url, $function);
|
||||
}
|
||||
}
|
||||
229
local/modules/ColissimoPickupPoint/WebService/BaseWebService.php
Executable file
@@ -0,0 +1,229 @@
|
||||
<?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 ColissimoPickupPoint\WebService;
|
||||
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Class BaseWebService
|
||||
* @package ColissimoPickupPoint\WebService
|
||||
* @author Thelia <info@thelia.net>
|
||||
*
|
||||
* @method BaseWebService getSoap()
|
||||
* @method BaseWebService setSoap(\SoapClient $soap)
|
||||
* @method BaseWebService getWebFunction()
|
||||
* @method BaseWebService setWebFunction($value)
|
||||
*/
|
||||
abstract class BaseWebService
|
||||
{
|
||||
protected $soap;
|
||||
protected $web_function;
|
||||
|
||||
public function __construct($wsdl, $web_function=null)
|
||||
{
|
||||
$this->soap = new \SoapClient($wsdl);
|
||||
$this->web_function=$web_function;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @return mixed|string
|
||||
*/
|
||||
private function getProprietyRealName($name)
|
||||
{
|
||||
$propriety_real_name = substr($name,3);
|
||||
|
||||
if (preg_match("#^[A-Z]$#", substr($propriety_real_name, 0,1))) {
|
||||
$propriety_real_name = strtolower(substr($propriety_real_name, 0, 1)).substr($propriety_real_name, 1);
|
||||
$propriety_real_name = preg_replace_callback(
|
||||
"#([A-Z])#",
|
||||
function ($match) {
|
||||
return strtolower("_".$match[0]);
|
||||
},
|
||||
$propriety_real_name
|
||||
);
|
||||
}
|
||||
|
||||
return $propriety_real_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param $arguments
|
||||
* @return mixed
|
||||
* @throws \Symfony\Component\Serializer\Exception\InvalidArgumentException
|
||||
* @throws \BadFunctionCallException
|
||||
*/
|
||||
public function __call($name, $arguments)
|
||||
{
|
||||
if (method_exists($this, $name)) {
|
||||
return call_user_func($this->$name, $arguments);
|
||||
}
|
||||
|
||||
if (substr($name,0,3) === "get") {
|
||||
if (!empty($arguments)) {
|
||||
throw new InvalidArgumentException("The function ".$name." in ".get_class($this)." doesn't take any argument.");
|
||||
}
|
||||
|
||||
$real_name = $this->getProprietyRealName($name);
|
||||
if (property_exists($this, $real_name)) {
|
||||
return $this->$real_name;
|
||||
}
|
||||
|
||||
} elseif (substr($name,0,3) === "set") {
|
||||
if (count($arguments) !== 1) {
|
||||
throw new InvalidArgumentException("The function ".$name." in ".get_class($this)." take only one argument.");
|
||||
}
|
||||
|
||||
$real_name = $this->getProprietyRealName($name);
|
||||
$this->$real_name = $arguments[array_keys($arguments)[0]];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
throw new \BadFunctionCallException("The function ".$name." doesn't exist in ".get_class($this));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @throws \Symfony\Component\Serializer\Exception\InvalidArgumentException
|
||||
*/
|
||||
public function exec()
|
||||
{
|
||||
$function = $this->web_function;
|
||||
$response = $this->soap->$function($this->getArgs());
|
||||
|
||||
if ($this->isError($response)) {
|
||||
throw new InvalidArgumentException($this->getError($response));
|
||||
}
|
||||
|
||||
return $this->getFormattedResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array of web function args
|
||||
*/
|
||||
public function getArgs()
|
||||
{
|
||||
$args= $this->getSoapNames($this->getThisVars());
|
||||
|
||||
/*
|
||||
* Clear array
|
||||
*/
|
||||
foreach ($args as $key => $value) {
|
||||
if ($key == "address" || $key == "city") {
|
||||
$args[$key] = $this->normalize($value);
|
||||
}
|
||||
|
||||
if (empty($value)) {
|
||||
unset($args[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getThisVars()
|
||||
{
|
||||
$this_class_vars = get_object_vars($this);
|
||||
$base_class_vars = get_class_vars("\\ColissimoPickupPoint\\WebService\\BaseWebService");
|
||||
$pks = array_diff_key($this_class_vars, $base_class_vars);
|
||||
|
||||
return $pks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $names
|
||||
* @return array
|
||||
*/
|
||||
protected function getSoapNames(array $names)
|
||||
{
|
||||
foreach ($names as $name=>$value) {
|
||||
$real_name = $this->getSoapName($name);
|
||||
$names[$real_name] = $value;
|
||||
if ($name !== $real_name) {
|
||||
unset($names[$name]);
|
||||
}
|
||||
}
|
||||
|
||||
return $names;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
protected function getSoapName($name)
|
||||
{
|
||||
return preg_replace_callback(
|
||||
"#_([a-z]{1})#",
|
||||
function ($match) {
|
||||
return strtoupper($match[1]);
|
||||
},
|
||||
$name
|
||||
);
|
||||
}
|
||||
|
||||
protected function normalize($text)
|
||||
{
|
||||
$utf8 = array(
|
||||
'/[áàâãªä]/u' => 'a',
|
||||
'/[ÁÀÂÃÄ]/u' => 'A',
|
||||
'/[ÍÌÎÏ]/u' => 'I',
|
||||
'/[íìîï]/u' => 'i',
|
||||
'/[éèêë]/u' => 'e',
|
||||
'/[ÉÈÊË]/u' => 'E',
|
||||
'/[óòôõºö]/u' => 'o',
|
||||
'/[ÓÒÔÕÖ]/u' => 'O',
|
||||
'/[úùûü]/u' => 'u',
|
||||
'/[ÚÙÛÜ]/u' => 'U',
|
||||
'/ç/' => 'c',
|
||||
'/Ç/' => 'C',
|
||||
'/ñ/' => 'n',
|
||||
'/Ñ/' => 'N',
|
||||
'/–/' => '-', // UTF-8 hyphen to "normal" hyphen
|
||||
'/[’‘‹›‚]/u' => ' ', // Literally a single quote
|
||||
'/[“”«»„]/u' => ' ', // Double quote
|
||||
'/ /' => ' ', // nonbreaking space (equiv. to 0x160)
|
||||
);
|
||||
return preg_replace(array_keys($utf8), array_values($utf8), $text);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
abstract public function isError(\stdClass $response);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
abstract public function getError(\stdClass $response);
|
||||
|
||||
/**
|
||||
* @return something
|
||||
*/
|
||||
abstract public function getFormattedResponse(\stdClass $response);
|
||||
}
|
||||
92
local/modules/ColissimoPickupPoint/WebService/FindByAddress.php
Executable file
@@ -0,0 +1,92 @@
|
||||
<?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 ColissimoPickupPoint\WebService;
|
||||
|
||||
use stdClass;
|
||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
||||
|
||||
/**
|
||||
* Class FindByAddress
|
||||
* @package ColissimoPickupPoint\WebService
|
||||
* @author Thelia <info@thelia.net>
|
||||
*
|
||||
* @method FindByAddress getAddress()
|
||||
* @method FindByAddress setAddress($value)
|
||||
* @method FindByAddress getZipCode()
|
||||
* @method FindByAddress setZipCode($value)
|
||||
* @method FindByAddress getCity()
|
||||
* @method FindByAddress setCity($value)
|
||||
* @method FindByAddress getCountryCode()
|
||||
* @method FindByAddress setCountryCode($value)
|
||||
* @method FindByAddress getFilterRelay()
|
||||
* @method FindByAddress setFilterRelay($value)
|
||||
* @method FindByAddress getRequestId()
|
||||
* @method FindByAddress setRequestId($value)
|
||||
* @method FindByAddress getLang()
|
||||
* @method FindByAddress setLang($value)
|
||||
* @method FindByAddress getOptionInter()
|
||||
* @method FindByAddress setOptionInter($value)
|
||||
* @method FindByAddress getShippingDate()
|
||||
* @method FindByAddress setShippingDate($value)
|
||||
*/
|
||||
class FindByAddress extends BaseColissimoPickupPointWebService
|
||||
{
|
||||
protected $address=null;
|
||||
protected $zip_code=null;
|
||||
protected $city=null;
|
||||
protected $country_code=null;
|
||||
protected $request_id=null;
|
||||
protected $lang=null;
|
||||
protected $option_inter=null;
|
||||
protected $shipping_date=null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('findRDVPointRetraitAcheminement');
|
||||
}
|
||||
|
||||
public function isError(stdClass $response)
|
||||
{
|
||||
return isset($response->return->errorCode) && $response->return->errorCode != 0;
|
||||
}
|
||||
|
||||
public function getError(stdClass $response)
|
||||
{
|
||||
return isset($response->return->errorMessage) ? $response->return->errorMessage : 'Unknown error';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param stdClass $response
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getFormattedResponse(stdClass $response)
|
||||
{
|
||||
if (!isset($response->return->listePointRetraitAcheminement)) {
|
||||
throw new Exception('An unknown error happened');
|
||||
}
|
||||
|
||||
return $response->return->listePointRetraitAcheminement;
|
||||
}
|
||||
}
|
||||
79
local/modules/ColissimoPickupPoint/WebService/FindById.php
Executable file
@@ -0,0 +1,79 @@
|
||||
<?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 ColissimoPickupPoint\WebService;
|
||||
use stdClass;
|
||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
||||
|
||||
/**
|
||||
* Class FindById
|
||||
* @package ColissimoPickupPoint\WebService
|
||||
* @author Thelia <info@thelia.net>
|
||||
*
|
||||
* @method FindById getId()
|
||||
* @method FindById setId($value)
|
||||
* @method FindById getReseau()
|
||||
* @method FindById setReseau($value)
|
||||
* @method FindById getLangue()
|
||||
* @method FindById setLangue($value)
|
||||
* @method FindById getDate()
|
||||
* @method FindById setDate($value)
|
||||
*/
|
||||
class FindById extends BaseColissimoPickupPointWebService
|
||||
{
|
||||
protected $id;
|
||||
/** @var string if belgique: R12, else empty */
|
||||
protected $reseau;
|
||||
protected $langue;
|
||||
protected $date;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('findPointRetraitAcheminementByID');
|
||||
}
|
||||
|
||||
public function isError(stdClass $response)
|
||||
{
|
||||
return isset($response->return->errorCode) && $response->return->errorCode != 0;
|
||||
}
|
||||
|
||||
public function getError(stdClass $response)
|
||||
{
|
||||
return isset($response->return->errorMessage) ? $response->return->errorMessage : 'Unknown error';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param stdClass $response
|
||||
* @return stdClass
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getFormattedResponse(stdClass $response)
|
||||
{
|
||||
if (!isset($response->return->pointRetraitAcheminement)) {
|
||||
throw new Exception('An unknown error happened');
|
||||
}
|
||||
|
||||
return $response->return->pointRetraitAcheminement;
|
||||
}
|
||||
|
||||
}
|
||||
11
local/modules/ColissimoPickupPoint/composer.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "thelia/colissimo-pickup-point-module",
|
||||
"license": "LGPL-3.0+",
|
||||
"type": "thelia-module",
|
||||
"require": {
|
||||
"thelia/installer": "~1.1"
|
||||
},
|
||||
"extra": {
|
||||
"installer-name": "ColissimoPickupPoint"
|
||||
}
|
||||
}
|
||||
BIN
local/modules/ColissimoPickupPoint/images/socolissimo.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
@@ -0,0 +1,201 @@
|
||||
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
|
||||
<script src='{$asset_url}'></script>
|
||||
{/javascripts}
|
||||
|
||||
{javascripts file='assets/js/libs/underscore-min.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
var config = {
|
||||
'urlAdd': '{url path="/admin/module/ColissimoPickupPoint/slice/save"}',
|
||||
'urlDelete': '{url path="/admin/module/ColissimoPickupPoint/slice/delete"}',
|
||||
'urlSave': '{url path="/admin/module/ColissimoPickupPoint/slice/save"}'
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
var checkboxes = [];
|
||||
|
||||
{loop name="js.get.orders.colissimo.pickup.point.export" type="order.notsent.colissimo.pickup.point"}
|
||||
checkboxes.push("export_{$ID}");
|
||||
{/loop}
|
||||
//Buttons
|
||||
$("#check-all-but").click( function() {
|
||||
checkboxes.forEach(function(entry) {
|
||||
$("#"+entry).prop('checked', true);
|
||||
});
|
||||
});
|
||||
$("#uncheck-all-but").click( function() {
|
||||
checkboxes.forEach(function(entry) {
|
||||
$("#"+entry).prop('checked', false);
|
||||
});
|
||||
});
|
||||
$("#reverse-all-but").click( function() {
|
||||
checkboxes.forEach(function(entry) {
|
||||
var box=$("#"+entry);
|
||||
box.prop('checked', !box.is(":checked"));
|
||||
});
|
||||
});
|
||||
// Export form button
|
||||
$("button[name=export_colissimo_pickup_point_form]").click(function() {
|
||||
var value = $("input[name='exportcolissimopickuppointorder[new_status_id]']:checked").val();
|
||||
if(value == "sent") {
|
||||
checkboxes.forEach(function(entry) {
|
||||
var box=$("#"+entry);
|
||||
if(box.is(":checked")) {
|
||||
var row= box.parents("tr"); // get first tr parent
|
||||
row.hide('slow', function() {
|
||||
row.remove();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
// Free shipping switch
|
||||
$(".freeshipping-activation-ColissimoPickupPoint").bootstrapSwitch();
|
||||
|
||||
$(".freeshipping-activation-ColissimoPickupPoint").on("switch-change", function(e, data){
|
||||
var is_checked = data.value;
|
||||
var mode = $(this).data("id");
|
||||
var form = $("#freeshippingform");
|
||||
$('body').append('<div class="modal-backdrop fade in" id="loading-event"><div class="loading"></div></div>');
|
||||
$.ajax({
|
||||
url: form.attr('action'),
|
||||
type: form.attr('method'),
|
||||
data: form.serialize()
|
||||
}).done(function(){
|
||||
$("#loading-event").remove();
|
||||
})
|
||||
.success(function() {
|
||||
if (is_checked) {
|
||||
$('#config-btn-0').removeClass('disabled');
|
||||
$('#table-prices-colissimo-pickup-point-'+mode).hide('slow');
|
||||
$('#freeshipping-from-'+mode).hide('slow');
|
||||
} else {
|
||||
$('#config-btn-0').addClass('disabled');
|
||||
$('#table-prices-colissimo-pickup-point-'+mode).show('slow');
|
||||
$('#freeshipping-from-'+mode).show('slow');
|
||||
}
|
||||
})
|
||||
.fail(function(jqXHR, textStatus, errorThrown){
|
||||
$('#freeshipping-failed-body').html(jqXHR.responseJSON.error);
|
||||
$("#freeshipping-failed").modal("show");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
// Price slice
|
||||
|
||||
var tpl = _.template($("#tpl-slice").html());
|
||||
|
||||
var showMessage = function showMessage(message) {
|
||||
$('#colissimo-pickup-point_dialog')
|
||||
.find('.modal-body')
|
||||
.html(message)
|
||||
.end()
|
||||
.modal("show");
|
||||
};
|
||||
|
||||
var getSliceData = function getSliceData($slice) {
|
||||
var data = {
|
||||
id: $slice.data("id"),
|
||||
area: $slice.data("area"),
|
||||
price: $slice.find(".js-slice-price").first().val(),
|
||||
priceMax: $slice.find(".js-slice-price-max").first().val(),
|
||||
weightMax: $slice.find(".js-slice-weight-max").first().val()
|
||||
};
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
// add new slice
|
||||
$('.js-slice-add').on('click', function(){
|
||||
var $slice = $(this).parents('tr').first();
|
||||
var data = getSliceData($slice);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
url: config.urlAdd
|
||||
}).done(function(data, textStatus, jqXHR){
|
||||
var sliceHtml = '';
|
||||
if (data.success) {
|
||||
// reset form
|
||||
$slice.find('input').val('');
|
||||
// add slice
|
||||
sliceHtml = tpl(data.slice);
|
||||
|
||||
$(sliceHtml).insertBefore($slice);
|
||||
} else {
|
||||
showMessage(data.message.join('<br>'));
|
||||
}
|
||||
}).fail(function(jqXHR, textStatus, errorThrown){
|
||||
console.log(jqXHR);
|
||||
showMessage(jqXHR.responseText);
|
||||
});
|
||||
});
|
||||
|
||||
// save new slice
|
||||
$('.slices').on('click', '.js-slice-save', function(){
|
||||
var $slice = $(this).parents('tr').first();
|
||||
var data = getSliceData($slice);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
url: config.urlAdd
|
||||
}).done(function(data, textStatus, jqXHR){
|
||||
if (!data.success) {
|
||||
showMessage(data.message.join('<br>'));
|
||||
} else {
|
||||
var sliceHtml = tpl(data.slice);
|
||||
$(sliceHtml).insertBefore($slice);
|
||||
$slice.remove();
|
||||
// $slice.find('.js-slice-save').removeClass('btn-success');
|
||||
}
|
||||
}).fail(function(jqXHR, textStatus, errorThrown){
|
||||
console.log(jqXHR);
|
||||
showMessage(jqXHR.responseText);
|
||||
});
|
||||
});
|
||||
|
||||
$('.slices').on('change', '.js-slice input', function() {
|
||||
$(this).parents('tr').first().find('.js-slice-save').addClass('btn-success');
|
||||
});
|
||||
|
||||
// delete new slice
|
||||
$('.slices').on('click', '.js-slice-delete', function(){
|
||||
var $slice = $(this).parents('tr').first();
|
||||
var data = getSliceData($slice);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
url: config.urlDelete
|
||||
}).done(function(data, textStatus, jqXHR){
|
||||
var sliceHtml = '';
|
||||
if (data.success) {
|
||||
$slice.remove();
|
||||
} else {
|
||||
showMessage(data.message);
|
||||
}
|
||||
}).fail(function(jqXHR, textStatus, errorThrown){
|
||||
console.log(jqXHR);
|
||||
showMessage(jqXHR.responseText);
|
||||
});
|
||||
});
|
||||
|
||||
// add new slice
|
||||
$('.js-slice input').on('change', function(){
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,474 @@
|
||||
<style>
|
||||
input[type=number]
|
||||
{
|
||||
min-width:100px;
|
||||
}
|
||||
</style>
|
||||
<div class="row">
|
||||
<!-- Errors -->
|
||||
{loop name="checkrights.colissimo.pickup.point" type="colissimo.pickup.point.check.rights"}
|
||||
<div class="alert alert-danger">
|
||||
<p>{$ERRMES} {$ERRFILE} | {intl l="Please change the access rights" d='colissimo.pickup.point.bo.default'}.</p>
|
||||
</div>
|
||||
{/loop}
|
||||
</div>
|
||||
|
||||
{elseloop rel="checkrights.colissimo.pickup.point"}
|
||||
|
||||
<div class="modal fade" id="freeshipping-failed" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3>{intl l="An error occured"}</h3>
|
||||
</div>
|
||||
<div class="modal-body" id="freeshipping-failed-body">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{assign var="tab" value="export"}
|
||||
{if isset($smarty.get.current_tab)}
|
||||
{assign var="tab" value=$smarty.get.current_tab}
|
||||
{/if}
|
||||
|
||||
{* default currency *}
|
||||
{loop type="currency" name="default_currency" default_only="1"}
|
||||
{$currencySymbol=$SYMBOL}
|
||||
{/loop}
|
||||
|
||||
<div class="general-block-decorator">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<ul id="tabbed-menu" class="nav nav-tabs">
|
||||
<li class="{if $tab eq "export"}active{/if}"><a data-toggle="tab" href="#export">{intl l="Export Coliship file" d='colissimo.pickup.point.bo.default'}</a> </li>
|
||||
<li class="{if $tab eq "import"}active{/if}"><a data-toggle="tab" href="#import">{intl l="Import Coliship file" d='colissimo.pickup.point.bo.default'}</a> </li>
|
||||
<li class="{if $tab eq "prices_slices_tab}"}active{/if}"><a data-toggle="tab" href="#prices_slices_tab">{intl l="Price slices (Pickup Point)" d='colissimo.pickup.point.bo.default' mode={$TITLE}}</a></li>
|
||||
<li class="{if $tab eq "configure"}active{/if}"><a data-toggle="tab" href="#configure">{intl l="Advanced configuration" d='colissimo.pickup.point.bo.default'}</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div id="export" class="tab-pane {if $tab eq "export"}active{/if} form-container">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading clearfix">
|
||||
{intl l="operations" d='colissimo.pickup.point.bo.default'}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<button id="check-all-but" title="{intl l="Check all" d='colissimo.pickup.point.bo.default'}" class="form-submit-button btn btn-sm btn-default">{intl l="Check all" d='colissimo.pickup.point.bo.default'}</button>
|
||||
<button id="uncheck-all-but" title="{intl l="Uncheck all" d='colissimo.pickup.point.bo.default'}" class="form-submit-button btn btn-sm btn-default">{intl l="Uncheck all" d='colissimo.pickup.point.bo.default'}</button>
|
||||
<button id="reverse-all-but" title="{intl l="Reverse selection" d='colissimo.pickup.point.bo.default'}" class="form-submit-button btn btn-sm btn-default">{intl l="Reverse selection" d='colissimo.pickup.point.bo.default'}</button>
|
||||
</div>
|
||||
</div>
|
||||
{form name="colissimo.pickup.point.export"}
|
||||
<form action="{url path='/admin/module/ColissimoPickupPoint/export'}" method="post">
|
||||
{form_hidden_fields form=$form}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading clearfix">
|
||||
{intl l="Change orders status after export" d='colissimo.pickup.point.bo.default'}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
{form_field form=$form field="new_status_id"}
|
||||
<table>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="nochange">{intl l="Do not change" d='colissimo.pickup.point.bo.default'}</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="radio" id="nochange" name="{$name}" value="nochange" {if $data eq "nochange"}checked{/if} />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="processing">{intl l="Processing" d='colissimo.pickup.point.bo.default'}</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="radio" id="processing" name="{$name}" value="processing" {if $data eq "processing"}checked{/if} />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="sent">{intl l="Sent" d='colissimo.pickup.point.bo.default'}*</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="radio" id="sent" name="{$name}" value="sent" {if $data eq "sent"}checked{/if} />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{/form_field}
|
||||
<span class="p">{intl l="*If you choose this option, the exported orders would not be available on this page anymore" d='colissimo.pickup.point.bo.default'}</span>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-striped table-condensed">
|
||||
<thead>
|
||||
<th class="object-title">
|
||||
{intl l="REF" d='colissimo.pickup.point.bo.default'}
|
||||
</th>
|
||||
<th class="object-title">
|
||||
{intl l="Customer"}
|
||||
</th>
|
||||
<th class="object-title">
|
||||
{intl l="Date" d='colissimo.pickup.point.bo.default'}
|
||||
</th>
|
||||
<th class="object-title">
|
||||
{intl l="Total taxed amount" d='colissimo.pickup.point.bo.default'}
|
||||
</th>
|
||||
<th class="object-title">
|
||||
{intl l="Package weight" d='colissimo.pickup.point.bo.default'}
|
||||
</th>
|
||||
<th class="object-title">
|
||||
{intl l="Export" d='colissimo.pickup.point.bo.default'}
|
||||
</th>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{loop name="order.notsent.colissimo.pickup.point" type="order.notsent.colissimo.pickup.point"}
|
||||
<tr>
|
||||
<td>
|
||||
<label for="{$label_attr.for}">
|
||||
{form_field form=$form field="order_"|cat:$ID}
|
||||
<a href="{url path='/admin/order/update/%order_id' order_id={$ID}}">{$label}</a>
|
||||
{/form_field}
|
||||
</label>
|
||||
</td>
|
||||
<td>
|
||||
{loop name='order-customer' type='customer' id={$CUSTOMER} current=false}
|
||||
<a href="{url path='/admin/customer/update?customer_id=%customer_id' customer_id={$ID}}">{$FIRSTNAME} {$LASTNAME}</a>
|
||||
{/loop}
|
||||
{elseloop rel='order-customer'}
|
||||
<a href="{url path='/admin/customer/update?customer_id=%customer_id' customer_id={$CUSTOMER}}">{intl l='Unknown customer' d='colissimo.pickup.point.bo.default'}</a>
|
||||
{/elseloop}
|
||||
</td>
|
||||
<td>
|
||||
{format_date date=$CREATE_DATE output="datetime"}
|
||||
</td>
|
||||
<td>
|
||||
{$TOTAL_TAXED_AMOUNT} {loop name="list.colissimo.pickup.point.getcurrency" type="currency" id=$CURRENCY}{$SYMBOL}{/loop}
|
||||
</td>
|
||||
<td>
|
||||
{form_field form=$form field="order_weight_"|cat:$ID}
|
||||
<input class="form-control text-center" type="text" name="{$name}" value="0" required />
|
||||
{/form_field}
|
||||
</td>
|
||||
<td>
|
||||
{form_field form=$form field="order_"|cat:$ID}
|
||||
<input type="checkbox" name="{$name}" id="{$label_attr.for}" value="true" class="form-control"/>
|
||||
{/form_field}
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
</table>
|
||||
<button type="submit" name="export_colissimo_pickup_point_form" value="stay" class="form-submit-button btn btn-sm btn-default" title="{intl l='Export' d='colissimo.pickup.point.bo.default'}">{intl l='Export' d='colissimo.pickup.bo.default'}</button>
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
|
||||
<!-- Import form -->
|
||||
<div id="import" class="tab-pane {if $tab eq "import"}active{/if} form-container">
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading clearfix">
|
||||
{intl l="The file has to be a CSV with 2 columns. The first contains the delivery reference, the second the order reference." d='colissimo.pickup.point.bo.default'}
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
|
||||
{flash type='import-result'}
|
||||
<div class="alert alert-success">
|
||||
{$MESSAGE}
|
||||
</div>
|
||||
{/flash}
|
||||
|
||||
{form name='colissimo.pickup.point.import'}
|
||||
<form action="{url path='/admin/module/ColissimoPickupPoint/import'}" method="post" {form_enctype form=$form}>
|
||||
{form_hidden_fields form=$form}
|
||||
{render_form_field form=$form field="success_url" value={url path="/admin/module/ColissimoPickupPoint"} current_tab="import"}
|
||||
|
||||
{if $form_error}
|
||||
<div class="alert alert-danger">{$form_error_message}</div>
|
||||
{/if}
|
||||
|
||||
{form_field form=$form field="import_file"}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">
|
||||
{$label} :
|
||||
</label>
|
||||
|
||||
<input type="file" id="{$label_attr.for}" name="{$name}" value="{$value}" required/>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
<button type="submit" class="btn btn-primary">{intl d='colissimo.pickup.point.bo.default' l='Upload'}</button>
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="configure" class="tab-pane {if $tab eq "configure"}active{/if} form-container">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
{intl l="Advanced configuration" d='colissimo.pickup.bo.default'}
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
{form name="colissimo.pickup.point.configure"}
|
||||
{if $form_error && $form_error_message}
|
||||
<div class="alert alert-danger">{$form_error_message}</div>
|
||||
{/if}
|
||||
<form action="{url path='/admin/module/ColissimoPickupPoint/configure'}" method="post">
|
||||
{form_hidden_fields form=$form}
|
||||
{form_field form=$form field='colissimo_pickup_point_endpoint_url'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}">
|
||||
</div>
|
||||
{/form_field}
|
||||
{form_field form=$form field='colissimo_pickup_point_username'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" >
|
||||
</div>
|
||||
{/form_field}
|
||||
{form_field form=$form field='colissimo_pickup_point_password'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}">
|
||||
</div>
|
||||
{/form_field}
|
||||
{form_field form=$form field='colissimo_pickup_point_google_map_key'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label}{if $required} <span class="required">*</span>{/if} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}">
|
||||
</div>
|
||||
{/form_field}
|
||||
<br/>
|
||||
<button type="submit" name="save_mode" value="stay" class="form-submit-button btn btn-sm btn-default btn-success" title="{intl l='Save changes' d='colissimo.pickup.bo.default'}">{intl l='Save changes' d='colissimo.pickup.bo.default'} <span class="glyphicon glyphicon-ok"></span></button>
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="prices_slices_tab" class="tab-pane {if $tab eq "prices_slices_tab" }active{/if} form-container">
|
||||
{if null !== $smarty.get.price_error}
|
||||
<div class="alert alert-danger" role="alert">{$smarty.get.price_error}</div>
|
||||
{/if}
|
||||
<br/>
|
||||
|
||||
<div class="row">
|
||||
<!-- checkbox free shipping -->
|
||||
{assign var="isColissimoPickupPointFreeShipping" value=0}
|
||||
{form name="colissimo.pickup.point.freeshipping.form"}
|
||||
<form action='{url path="/admin/module/ColissimoPickupPoint/freeshipping"}' method="post" id="freeshippingform">
|
||||
<div class="col-md-4">
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field="freeshipping"}
|
||||
<label>
|
||||
{intl l="Activate total free shipping " d="colissimo.pickup.point.bo.default"}
|
||||
</label>
|
||||
<div class="switch-small freeshipping-activation-ColissimoPickupPoint" data-id="1" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok-circle'></i>" data-off-label="<i class='glyphicon glyphicon-remove-circle'></i>">
|
||||
{loop type="colissimo.pickup.point.freeshipping" name="freeshipping_colissimo_pickup_point"}
|
||||
<input type="checkbox" name="{$name}" value="true" {if $FREESHIPPING_ACTIVE}checked{assign var="isColissimoPickupPointFreeShipping" value=1}{/if} />
|
||||
{/loop}
|
||||
</div>
|
||||
{/form_field}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6" id="freeshipping-from">
|
||||
<div class="input-group">
|
||||
{form_field form=$form field="freeshipping_from"}
|
||||
{loop type="colissimo.pickup.point.freeshipping" name="freeshipping_colissimo_pickup_point"}
|
||||
<span class="input-group-addon {if $FREESHIPPING_FROM}alert-success{/if}">{intl l="Or activate free shipping from (€) :" d="colissimo.pickup.point.bo.default"}</span>
|
||||
<input type="number" name="{$name}" class="form-control" value="{$value}" step="0.01">
|
||||
{/loop}
|
||||
{/form_field}
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" type="submit">{intl l="Save"}</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
|
||||
|
||||
<br/>
|
||||
|
||||
<div class="alert alert-info">
|
||||
{intl l="You can create price slices by specifying a maximum cart weight and/or a maximum cart price." d='colissimo.pickup.point.bo.default'}
|
||||
{intl l="The slices are ordered by maximum cart weight then by maximum cart price." d='colissimo.pickup.point.bo.default'}
|
||||
{intl l="If a cart matches multiple slices, it will take the last slice following that order." d='colissimo.pickup.point.bo.default'}
|
||||
{intl l="If you don't specify a cart weight in a slice, it will have priority over the slices with weight." d='colissimo.pickup.point.bo.default'}
|
||||
{intl l="If you don't specify a cart price in a slice, it will have priority over the other slices with the same weight." d='colissimo.pickup.point.bo.default'}
|
||||
{intl l="If you specify both, the cart will require to have a lower weight AND a lower price in order to match the slice." d='colissimo.pickup.point.bo.default'}
|
||||
</div>
|
||||
|
||||
<div class="slices" class="form-container">
|
||||
|
||||
{loop type="module" name="module-id-loop" code="ColissimoPickupPoint"}
|
||||
{assign var="module_id" value=$ID}
|
||||
{/loop}
|
||||
{loop type="area" name="area_loop" module_id=$module_id backend_context=true}
|
||||
{$area_id=$ID}
|
||||
<div class="col-md-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<label class="clearfix">
|
||||
<small>{intl d='colissimo.pickup.point.bo.default' l="Area : "}</small> {$NAME}
|
||||
</label>
|
||||
</th>
|
||||
<th width="40%">
|
||||
<div id="area-freeshipping-{$area_id}" {if $isColissimoPickupPointFreeShipping eq 1} style="display:none;" {/if}>
|
||||
<form action="{url path="/admin/module/ColissimoPickupPoint/area_freeshipping"}" method="post">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon {if $area_id }alert-success{/if}">{intl l="Activate free shipping from (€) :" d="colissimo.pickup.point.bo.default"}</span>
|
||||
<input type="hidden" name="area-id" value="{$area_id}">
|
||||
|
||||
{ifloop rel="area_freeshipping"}
|
||||
{loop type="colissimo.pickup.point.area.freeshipping" name="area_freeshipping" area_id=$area_id}
|
||||
<input type="number" step="0.01" name="cart-amount" class="form-control" value="{$CART_AMOUNT}">
|
||||
{/loop}
|
||||
{/ifloop}
|
||||
{elseloop rel="area_freeshipping"}
|
||||
<input type="number" step="0.01" name="cart-amount" class="form-control" value="">
|
||||
{/elseloop}
|
||||
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" type="submit">{intl l="Save"}</button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-md-3">{intl l="Weight up to ... kg" d='colissimo.pickup.point.bo.default'}</th>
|
||||
<th class="col-md-3">{intl l="Untaxed Price up to ... %symbol" symbol=$currencySymbol d='colissimo.pickup.point.bo.default'}</th>
|
||||
<th class="col-md-5">{intl l="Price (%symbol)" symbol=$currencySymbol d='colissimo.pickup.point.bo.default'}</th>
|
||||
<th class="col-md-1">{intl l="Actions" d='colissimo.pickup.point.bo.default'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{loop type="colissimo.pickup.point" name="colissimo_pickup_point_area_$ID" area_id={$area_id} }
|
||||
<tr class="js-slice" data-area="{$area_id}" data-id="{$SLICE_ID}">
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="weight-max" class="form-control js-slice-weight-max" value="{$MAX_WEIGHT}" data-old="{$MAX_WEIGHT}" />
|
||||
</th>
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="price-max" class="form-control js-slice-price-max" value="{$MAX_PRICE}" data-old="{$MAX_PRICE}" />
|
||||
</th>
|
||||
<th class="col-md-5">
|
||||
<input type="text" data-field="price" class="form-control js-slice-price" value="{$PRICE}" data-old="{$PRICE}" />
|
||||
</th>
|
||||
<th class="col-md-1">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="colissimopickuppoint" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs js-slice-save" title="{intl d='colissimo.pickup.point.bo.default' l='Save this price slice'}">
|
||||
<span class="glyphicon glyphicon-floppy-disk"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="colissimopickuppoint" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs js-slice-delete" title="{intl d='colissimo.pickup.point.bo.default' l='Delete this price slice'}" data-id="{$ID}">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{* New slice *}
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="colissimopickuppoint" access="CREATE"}
|
||||
<tr class="js-slice-new" data-area="{$area_id}" data-id="0">
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="weight-max" class="form-control js-slice-weight-max" value="" />
|
||||
</th>
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="price-max" class="form-control js-slice-price-max" value="" />
|
||||
</th>
|
||||
<th class="col-md-5">
|
||||
<input type="text" data-field="price" class="form-control js-slice-price" value="" />
|
||||
</th>
|
||||
<th class="col-md-1">
|
||||
<a class="btn btn-default btn-xs js-slice-add" title="{intl d='colissimo.pickup.point.bo.default' l='Add this price slice'}" >
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
</a>
|
||||
</th>
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/loop}
|
||||
{elseloop rel="area_loop"}
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-warning">
|
||||
{intl d='colissimo.pickup.point.bo.default' l="You should first attribute shipping zones to the modules: "}
|
||||
<a href="{url path="/admin/configuration/shipping_zones/update/$module_id"}">
|
||||
{intl d='colissimo.pickup.point.bo.default' l="manage shipping zones"}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{/elseloop}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{include
|
||||
file = "includes/generic-warning-dialog.html"
|
||||
|
||||
dialog_id = "colissimo_pickup_point_dialog"
|
||||
dialog_title = {intl d='colissimo.pickup.bo.default' l="Message"}
|
||||
dialog_body = ""
|
||||
}
|
||||
|
||||
{* JS Templates *}
|
||||
<script id="tpl-slice" type="text/html">
|
||||
<tr class="js-slice" data-area="<%=areaId %>" data-id="<%=id %>">
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="weight-max" class="form-control js-slice-weight-max" value="<%=weightMax %>" data-old="<%=weightMax %>" />
|
||||
</th>
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="price-max" class="form-control js-slice-price-max" value="<%=priceMax %>" data-old="<%=priceMax %>" />
|
||||
</th>
|
||||
<th class="col-md-5">
|
||||
<input type="text" data-field="price" class="form-control js-slice-price" value="<%=price %>" data-old="<%=price %>" />
|
||||
</th>
|
||||
<th class="col-md-1">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="ColissimoPickupPoint" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs js-slice-save" title="{intl d='colissimo.pickup.bo.default' l='Save this price slice'}">
|
||||
<span class="glyphicon glyphicon-floppy-disk"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="ColissimoPickupPoint" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs js-slice-delete" title="{intl d='colissimo.pickup.bo.default' l='Delete this price slice'}" data-id="<%=id %>">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
{/elseloop}
|
||||
@@ -0,0 +1,7 @@
|
||||
#colissimo-pickup-pointmap .table tbody > tr > th, #colissimo-pickup-pointmap .table tbody > tr > td {
|
||||
padding: 10px 10px 0;
|
||||
}
|
||||
|
||||
.title-colissimo-pickup-point-pickup-type{
|
||||
color: #E47A10;
|
||||
}
|
||||
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
@@ -0,0 +1,487 @@
|
||||
|
||||
{loop type="delivery" name="colissimopickuppoint" id=$module force_return="true" country=$country}
|
||||
<tr style="display: none;">
|
||||
<td colspan="3">
|
||||
<div id="point-colissimo-pickup-point">
|
||||
<div id="google-map-colissimo-pickup-point">
|
||||
{* Point relais *}
|
||||
{* Check if Colissimo webservice is up *}
|
||||
{assign var="isColissimoPickupPointUp" value=0}
|
||||
{colissimoPickupPointDeliveryPrice country=$country}<h1>{$isValidMode}</h1>
|
||||
{if $isValidMode !== false}
|
||||
{loop name="is.colissimo.pickup.point.up" type="colissimo.pickup.point.around"}{/loop}
|
||||
{ifloop rel="is.colissimo.pickup.point.up"}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<strong>{intl l="Near you" d='colissimopickuppoint.fo.default'}</strong> / {$deliveryPrice} {currency attr="symbol"}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<script>
|
||||
var mapSOC = {
|
||||
"map": null,
|
||||
"infowindow": null,
|
||||
"geocoder": null,
|
||||
"listMarker": [],
|
||||
"position": null,
|
||||
"images": {
|
||||
'BPR': '{image file="assets/img/BPR.png" source="ColissimoPickupPoint"}',
|
||||
'ACP': '{image file="assets/img/BPR.png" source="ColissimoPickupPoint"}',
|
||||
'CDI': '{image file="assets/img/BPR.png" source="ColissimoPickupPoint"}',
|
||||
'BDP': '{image file="assets/img/BPR.png" source="ColissimoPickupPoint"}',
|
||||
'A2P': '{image file="assets/img/A2P.png" source="ColissimoPickupPoint"}',
|
||||
'CMT': '{image file="assets/img/A2P.png" source="ColissimoPickupPoint"}',
|
||||
'PCS': '{image file="assets/img/CIT.png" source="ColissimoPickupPoint"}',
|
||||
'HANDICAPE': '{image file="assets/img/mobilite-reduite.gif" source="ColissimoPickupPoint"}'
|
||||
},
|
||||
"address": "",
|
||||
"locations": []
|
||||
};
|
||||
|
||||
function updatemap_colissimo_pickup_point(adr_geoloc, locations) {
|
||||
|
||||
var buf = "",
|
||||
marker,
|
||||
loc,
|
||||
i;
|
||||
|
||||
// save current search
|
||||
if (adr_geoloc !== undefined && locations !== undefined) {
|
||||
mapSOC.address = adr_geoloc;
|
||||
mapSOC.locations = locations;
|
||||
}
|
||||
|
||||
if (mapSOC.map === null) {
|
||||
// Define MAP
|
||||
var mapOptions = {
|
||||
zoom: 13,
|
||||
mapTypeId: google.maps.MapTypeId.ROADMAP
|
||||
}
|
||||
// On va créer la map dans la div qui a l'id relaymap
|
||||
mapSOC.map = new google.maps.Map(document.getElementById('colissimopickuppointmap'), mapOptions);
|
||||
mapSOC.infowindow = new google.maps.InfoWindow({
|
||||
size: new google.maps.Size(50,50)
|
||||
});
|
||||
mapSOC.geocoder = new google.maps.Geocoder();
|
||||
}
|
||||
|
||||
// We get latitude and longitude for the customer's adress
|
||||
var b = [];
|
||||
b['address'] = mapSOC.address;
|
||||
mapSOC.geocoder.geocode(b, function (results, status) {
|
||||
if (status == google.maps.GeocoderStatus.OK) {
|
||||
// Et on centre la map sur cette position
|
||||
mapSOC.map.setCenter(results[0].geometry.location);
|
||||
marker = new google.maps.Marker({
|
||||
position: new google.maps.LatLng(results[0].geometry.location.lat(), results[0].geometry.location.lng()),
|
||||
map: mapSOC.map,
|
||||
icon: "{image file='assets/img/maison.png' source='ColissimoPickupPoint'}"
|
||||
});
|
||||
if (mapSOC.position != null){
|
||||
mapSOC.position.setMap(null);
|
||||
}
|
||||
mapSOC.position = marker;
|
||||
} else {
|
||||
// Sinon on met le centre de la map sur Clermont-Ferrand ;)
|
||||
alert("{intl l="Actual address can't be geolocated"}");
|
||||
var myLatLng = new google.maps.LatLng(45.7789, 3.0782);
|
||||
mapSOC.map.setCenter(myLatLng);
|
||||
mapSOC.map.setZoom(3);
|
||||
}
|
||||
});
|
||||
|
||||
// clean current map
|
||||
$("#table-colissimo-pickup-point").html("");
|
||||
for (i = 0; i < mapSOC.listMarker.length; i++) {
|
||||
//google.maps.event.removeListener(listMarker[i]);
|
||||
mapSOC.listMarker[i].setMap(null);
|
||||
}
|
||||
mapSOC.listMarker = [];
|
||||
|
||||
var servicesCode = {
|
||||
'POSTE' : ['BPR', 'ACP', 'CDI', 'BDP'],
|
||||
'RELAIS' : ['A2P', 'CMT'],
|
||||
'CONSIGNE' : ['PCS']
|
||||
};
|
||||
|
||||
// Get services (or relay point type) that user wants to include in his search
|
||||
var services = {};
|
||||
$("input.toggle-type-colissimo-pickup-point:checked").each(function(){
|
||||
if(servicesCode.hasOwnProperty(this.value)){
|
||||
var codeArray = servicesCode[this.value];
|
||||
codeArray.forEach(function (code) {
|
||||
services[code] = true;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Pour chaque point relais dans locations on crée un nouveau marker
|
||||
// And Complete table-relais
|
||||
for (i = 0; i < mapSOC.locations.length; i++) {
|
||||
loc = mapSOC.locations[i];
|
||||
|
||||
if (! services[loc.type]){
|
||||
continue;
|
||||
}
|
||||
|
||||
buf += '<tr>' +
|
||||
'<td>' +
|
||||
'<img src="' + mapSOC.images[loc.type] + '">' +
|
||||
'<strong>' + loc.name + '</strong> ' +
|
||||
'<br>' +
|
||||
loc.address +
|
||||
'<br>' +
|
||||
loc.zipcode + ' ' + loc.city +
|
||||
' - ' + loc.distance;
|
||||
|
||||
if (loc.disabledPerson == "1"){
|
||||
buf += ' <img src="' + mapSOC.images["HANDICAPE"] + '">';
|
||||
}
|
||||
|
||||
buf += '</td>' +
|
||||
'<td>' +
|
||||
'<div class="radio">' +
|
||||
'<input type="radio" name="colissimo_pickup_point_code" data-marker=' + i + ' class="colissimo_pickup_point" id="colissimo_pickup_point' + loc.id + '" value="' + loc.id + ':'+ loc.type + ':'+ loc.countrycode + '">' +
|
||||
'</div>' +
|
||||
'</td>' +
|
||||
'</tr>';
|
||||
|
||||
marker = new google.maps.Marker({
|
||||
position: new google.maps.LatLng(loc.lat, loc.lng),
|
||||
map: mapSOC.map,
|
||||
icon: mapSOC.images[loc.type]
|
||||
});
|
||||
|
||||
mapSOC.listMarker.push(marker);
|
||||
attachMarker(marker, loc);
|
||||
}
|
||||
document.getElementById("table-colissimo-pickup-point").innerHTML = buf;
|
||||
}
|
||||
|
||||
function attachMarker(marker, data) {
|
||||
google.maps.event.addListener(marker, 'click', function() {
|
||||
$("#colissimo-pickup-point" + data.id).prop('checked', true);
|
||||
//verifyRadio();
|
||||
mapSOC.infowindow.setContent(
|
||||
'<img src="' + mapSOC.images[data.type] + '">' +
|
||||
'<strong>' + data.name + '</strong>' +
|
||||
'<address style="margin: 0">' +
|
||||
data.address +
|
||||
'<br>' +
|
||||
data.zipcode +
|
||||
' ' +
|
||||
data.city +
|
||||
'</address>' +
|
||||
'<p>' + data.distance +
|
||||
' ' +
|
||||
((data.disabledPerson) ? '<img src="' + mapSOC.images["HANDICAPE"] + '">' : "") +
|
||||
'</p>' +
|
||||
'<table class="table table-condensed table-striped table-bordered" style="width: 100%;">' +
|
||||
getHoraireRow('{intl l="Monday" d='colissimopickuppoint.fo.default'}', data.monday) +
|
||||
getHoraireRow('{intl l="Tuesday" d='colissimopickuppoint.fo.default'}', data.tuesday) +
|
||||
getHoraireRow('{intl l="Wednesday" d='colissimopickuppoint.fo.default'}', data.wednesday) +
|
||||
getHoraireRow('{intl l="Friday" d='colissimopickuppoint.fo.default'}', data.friday) +
|
||||
getHoraireRow('{intl l="Thursday" d='colissimopickuppoint.fo.default'}', data.thursday) +
|
||||
getHoraireRow('{intl l="Saturday" d='colissimopickuppoint.fo.default'}', data.saturday) +
|
||||
getHoraireRow('{intl l="Sunday" d='colissimopickuppoint.fo.default'}', data.sunday) +
|
||||
'</table>');
|
||||
mapSOC.infowindow.open(mapSOC.map, marker);
|
||||
});
|
||||
}
|
||||
|
||||
function getHoraireRow(lib, data){
|
||||
var newData = data.replace("00:00-00:00", "", "g").replace(" ", "", "g");
|
||||
var ret = "";
|
||||
if (newData != ""){
|
||||
ret = '<tr><th>' + lib + ' </th><td> ' + newData + '</td></tr>';
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
function initialize_so() {
|
||||
// Get the selected customer address
|
||||
var $selectedAddressInput = $('#form-cart-delivery')
|
||||
.find('[name="thelia_order_delivery[delivery-address]"]')
|
||||
.filter(':checked');
|
||||
|
||||
var selectedAddressId = $selectedAddressInput.val();
|
||||
|
||||
var locationsSearchUrl = "{url path='/module/ColissimoPickupPoint/points'}";
|
||||
|
||||
var addresses_geoloc = [];
|
||||
{loop type="address" name="delivery-selection-colissimo-pickup-point" customer="current"}
|
||||
addresses_geoloc[{$ID}] = "{$ADDRESS1}, {$ZIPCODE} {$CITY}";
|
||||
{/loop}
|
||||
|
||||
var adr_geoloc = addresses_geoloc[selectedAddressId];
|
||||
|
||||
// Get every relay around customer's address
|
||||
var locations = [];
|
||||
$.get(
|
||||
locationsSearchUrl + "?address=" + selectedAddressId,
|
||||
function(data) {
|
||||
locations = data.locations;
|
||||
updatemap_colissimo_pickup_point(adr_geoloc, locations);
|
||||
}
|
||||
);
|
||||
}
|
||||
var normalize = (function () {
|
||||
var a = ['À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ć', 'ć', 'Ĉ', 'ĉ', 'Ċ', 'ċ', 'Č', 'č', 'Ď', 'ď', 'Đ', 'đ', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', 'Ě', 'ě', 'Ĝ', 'ĝ', 'Ğ', 'ğ', 'Ġ', 'ġ', 'Ģ', 'ģ', 'Ĥ', 'ĥ', 'Ħ', 'ħ', 'Ĩ', 'ĩ', 'Ī', 'ī', 'Ĭ', 'ĭ', 'Į', 'į', 'İ', 'ı', 'IJ', 'ij', 'Ĵ', 'ĵ', 'Ķ', 'ķ', 'Ĺ', 'ĺ', 'Ļ', 'ļ', 'Ľ', 'ľ', 'Ŀ', 'ŀ', 'Ł', 'ł', 'Ń', 'ń', 'Ņ', 'ņ', 'Ň', 'ň', 'ʼn', 'Ō', 'ō', 'Ŏ', 'ŏ', 'Ő', 'ő', 'Œ', 'œ', 'Ŕ', 'ŕ', 'Ŗ', 'ŗ', 'Ř', 'ř', 'Ś', 'ś', 'Ŝ', 'ŝ', 'Ş', 'ş', 'Š', 'š', 'Ţ', 'ţ', 'Ť', 'ť', 'Ŧ', 'ŧ', 'Ũ', 'ũ', 'Ū', 'ū', 'Ŭ', 'ŭ', 'Ů', 'ů', 'Ű', 'ű', 'Ų', 'ų', 'Ŵ', 'ŵ', 'Ŷ', 'ŷ', 'Ÿ', 'Ź', 'ź', 'Ż', 'ż', 'Ž', 'ž', 'ſ', 'ƒ', 'Ơ', 'ơ', 'Ư', 'ư', 'Ǎ', 'ǎ', 'Ǐ', 'ǐ', 'Ǒ', 'ǒ', 'Ǔ', 'ǔ', 'Ǖ', 'ǖ', 'Ǘ', 'ǘ', 'Ǚ', 'ǚ', 'Ǜ', 'ǜ', 'Ǻ', 'ǻ', 'Ǽ', 'ǽ', 'Ǿ', 'ǿ'];
|
||||
var b = ['A', 'A', 'A', 'A', 'A', 'A', 'AE', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'D', 'N', 'O', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y', 's', 'a', 'a', 'a', 'a', 'a', 'a', 'ae', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'y', 'A', 'a', 'A', 'a', 'A', 'a', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'D', 'd', 'D', 'd', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'G', 'g', 'G', 'g', 'G', 'g', 'G', 'g', 'H', 'h', 'H', 'h', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'IJ', 'ij', 'J', 'j', 'K', 'k', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'l', 'l', 'N', 'n', 'N', 'n', 'N', 'n', 'n', 'O', 'o', 'O', 'o', 'O', 'o', 'OE', 'oe', 'R', 'r', 'R', 'r', 'R', 'r', 'S', 's', 'S', 's', 'S', 's', 'S', 's', 'T', 't', 'T', 't', 'T', 't', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', 'w', 'Y', 'y', 'Y', 'Z', 'z', 'Z', 'z', 'Z', 'z', 's', 'f', 'O', 'o', 'U', 'u', 'A', 'a', 'I', 'i', 'O', 'o', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'A', 'a', 'AE', 'ae', 'O', 'o'];
|
||||
|
||||
return function (str) {
|
||||
var i = a.length;
|
||||
while (i--) str = str.replace(a[i], b[i]);
|
||||
return str;
|
||||
};
|
||||
}());
|
||||
|
||||
function search_city_colissimo_pickup_point() {
|
||||
var address = document.getElementById("search-address-colissimo-pickup-point").value;
|
||||
var zipcode = document.getElementById("search-zipcode-colissimo-pickup-point").value;
|
||||
var city = document.getElementById("search-city-colissimo-pickup-point").value;
|
||||
var countryid = $("#search-countryid-colissimo-pickup-point").val();
|
||||
if (zipcode == "" || city == "") {
|
||||
alert("{intl l="Please enter a city and a zipcode" d='colissimopickuppoint.fo.default'}");
|
||||
} else {
|
||||
// Get site base url
|
||||
var url_site = '{url path="/"}module/ColissimoPickupPoint/'
|
||||
+ encodeURIComponent(countryid) + '/'
|
||||
+ encodeURIComponent(zipcode) + '/'
|
||||
+ encodeURIComponent(normalize(city));
|
||||
if (address != ""){
|
||||
url_site += '/' + encodeURIComponent(normalize(address));
|
||||
}
|
||||
// Get search address
|
||||
var adr_geoloc = address + " " + zipcode + " " + city;
|
||||
// Get every relay around customer's address
|
||||
var locations = [];
|
||||
$.getJSON(url_site)
|
||||
.done(function(data) {
|
||||
if (!$.isEmptyObject(data)) {
|
||||
locations = data.locations;
|
||||
updatemap_colissimo_pickup_point(adr_geoloc, locations);
|
||||
} else {
|
||||
alert("{intl l='Colissimo is unavailable. Please choose another delivery method' d='colissimopickuppoint.fo.default'}");
|
||||
}
|
||||
})
|
||||
.fail(function( jqxhr, textStatus, error ) {
|
||||
var err = textStatus + ", " + error;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
|
||||
<!-- Bureau de poste -->
|
||||
<div class="col-md-4 col-sm-4">
|
||||
<div style="padding-top: 5px; padding-bottom: 5px;">
|
||||
{images file="assets/img/BPR.png" source="ColissimoPickupPoint"}
|
||||
<img src="{$asset_url}" class="pull-left">
|
||||
{/images}
|
||||
<h5 class="title-colissimo-pickup-point-pickup-type">{intl l="Post office" d='colissimopickuppoint.fo.default'}</h5>
|
||||
<p>{intl l="Delivery in one of the 10,000 collection points La Poste in France or in a post office in Europe." d='colissimopickuppoint.fo.default'}</p>
|
||||
|
||||
<div class="checkbox">
|
||||
<label class="control-label" for="toggle-type-colissimo-pickup-point-4">
|
||||
<input type="checkbox" name="toggle-type-colissimo-pickup-point" id="toggle-type-colissimo-pickup-point-4" class="toggle-type-colissimo-pickup-point" value="POSTE" checked>
|
||||
{intl l="include in results" d='colissimopickuppoint.fo.default'}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- // Bureau de poste -->
|
||||
|
||||
<!-- Relais Pickup -->
|
||||
<div class="col-md-4 col-sm-4">
|
||||
<div style="padding-top: 5px; padding-bottom: 5px;">
|
||||
{images file="assets/img/A2P.png" source="ColissimoPickupPoint"}
|
||||
<img src="{$asset_url}" class="pull-left">
|
||||
{/images}
|
||||
<h5 class="title-colissimo-pickup-point-pickup-type">{intl l="Pickup shop" d='colissimopickuppoint.fo.default'}</h5>
|
||||
<p>{intl l="Delivery in one of the 7,500 shops in the PICKUP network." d='colissimopickuppoint.fo.default'}</p>
|
||||
|
||||
<div class="checkbox">
|
||||
<label class="control-label" for="toggle-type-colissimo-pickup-point-5">
|
||||
<input type="checkbox" name="toggle-type-colissimo-pickup-point" id="toggle-type-colissimo-pickup-point-5" class="toggle-type-colissimo-pickup-point" value="RELAIS" checked>
|
||||
{intl l="include in results" d='colissimopickuppoint.fo.default'}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- // Relais Pickup -->
|
||||
|
||||
<!-- Consigne Pickup Station -->
|
||||
<div class="col-md-4 col-sm-4">
|
||||
<div style="padding-top: 5px; padding-bottom: 5px;">
|
||||
{images file="assets/img/CIT.png" source="ColissimoPickupPoint"}
|
||||
<img src="{$asset_url}" class="pull-left">
|
||||
{/images}
|
||||
<h5 class="title-colissimo-pickup-point-pickup-type">{intl l="Automatic pickup point" d='colissimopickuppoint.fo.default'}</h5>
|
||||
<p>{intl l="Delivery in France in one of the 500 automatic instructions 7/7 and 24h/24." d='colissimopickuppoint.fo.default'}</p>
|
||||
|
||||
<div class="checkbox">
|
||||
<label class="control-label" for="toggle-type-colissimo-pickup-point-6">
|
||||
<input type="checkbox" name="toggle-type-colissimo-pickup-point" id="toggle-type-colissimo-pickup-point-6" class="toggle-type-colissimo-pickup-point" value="CONSIGNE" checked>
|
||||
{intl l="include in results" d='colissimopickuppoint.fo.default'}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- // Consigne Pickup Station -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="container-fluid">
|
||||
<!-- Map -->
|
||||
<div class="col-md-7" style="padding-right: 0;">
|
||||
<div id="colissimopickuppointmap" style="width: 100%; height: 450px;"></div>
|
||||
</div><!-- // Map -->
|
||||
|
||||
<!-- Liste -->
|
||||
<div class="col-md-5" style="padding-left: 0">
|
||||
<div style="height: 450px; overflow-y: scroll;">
|
||||
<table class="table table-bordered table-striped" id="table-colissimo-pickup-point"></table>
|
||||
</div>
|
||||
</div><!-- // Liste -->
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="col-md-12">
|
||||
<h4>{intl l="Search Colissimo relay in a city" d='colissimopickuppoint.fo.default'}</h4>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<label for="search-address-colissimo-pickup-point" class="control-label sr-only">
|
||||
{intl l="address" d='colissimopickuppoint.fo.default'}
|
||||
</label>
|
||||
<input type="text" id="search-address-colissimo-pickup-point" placeholder="{intl l='address' d='colissimopickuppoint.fo.default'}" class="form-control" style="" onPaste=""
|
||||
{literal}onkeydown="if (event.keyCode == 13) {return false;}"{/literal}/>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label for="search-zipcode-colissimo-pickup-point" class="control-label sr-only">
|
||||
{intl l="zipcode" d='colissimopickuppoint.fo.default'}
|
||||
</label>
|
||||
<input type="text" id="search-zipcode-colissimo-pickup-point" placeholder="{intl l='zipcode' d='colissimopickuppoint.fo.default'}" class="form-control" style="" onPaste=""
|
||||
{literal}onkeydown="if (event.keyCode == 13) {search_city_colissimo_pickup_point();return false;}"{/literal}/>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label for="search-city-colissimo-pickup-point" class="control-label sr-only">
|
||||
{intl l="city" d='colissimopickuppoint.fo.default'}
|
||||
</label>
|
||||
<input type="text" id="search-city-colissimo-pickup-point" placeholder="{intl l='city' d='colissimopickuppoint.fo.default'}" class="form-control" style="" onPaste=""
|
||||
{literal}onkeydown="if (event.keyCode == 13) {search_city_colissimo_pickup_point();return false;}"{/literal}/>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<select id="search-countryid-colissimo-pickup-point" class="form-control">
|
||||
{loop type="country" name="country.list"}
|
||||
<option value="{$ID}"
|
||||
{if $value != ""}
|
||||
{if $value == $ID}selected{/if}
|
||||
{else}
|
||||
{if $IS_DEFAULT}selected{/if}
|
||||
{/if}
|
||||
>{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<button type="button" id="search-city-submit-colissimo-pickup-point" class="form-submit-button btn btn-block btn-default" title="{intl l='Search' d='colissimopickuppoint.default'}">
|
||||
<span class="glyphicon glyphicon-search"></span>
|
||||
{intl l='Search' d='colissimopickuppoint.fo.default'}
|
||||
</button>
|
||||
</div>
|
||||
<div class="clearfix col-md-12" style="margin-top: 15px;margin-bottom: 15px;">
|
||||
<button type="submit" name="colissimo-pickup-point-pr" value="PR" class="btn btn-primary pull-right">{intl l="Choose this delivery mode" d="colissimopickuppoint.fo.default"}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- // Search city -->
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{/ifloop}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<script>
|
||||
function loadScript() {
|
||||
|
||||
console.log("loadScript");
|
||||
|
||||
var script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.src = 'https://maps.googleapis.com/maps/api/js'
|
||||
+ '?callback=ColissimoPickupPointInitialize'
|
||||
+ '&key={colissimoPickupPointGoogleApiKey}';
|
||||
document.body.appendChild(script);
|
||||
}
|
||||
|
||||
if (typeof(google) == 'undefined') {
|
||||
loadScript();
|
||||
} else {
|
||||
ColissimoPickupPointInitialize();
|
||||
}
|
||||
|
||||
function ColissimoPickupPointInitialize() {
|
||||
console.log("ColissimoPickupPointInitialize");
|
||||
if (typeof initialize_so == 'function') {
|
||||
initialize_so();
|
||||
// Search city pseudo-form
|
||||
document.getElementById("search-city-submit-colissimo-pickup-point").onclick = search_city_colissimo_pickup_point;
|
||||
}
|
||||
}
|
||||
|
||||
function displayContent () {
|
||||
console.log("displayContent");
|
||||
$("#google-map-colissimo-pickup-point").closest('tr').show(function () {
|
||||
$('.btn-checkout-next').hide();
|
||||
if (typeof initialize_so == 'function') {
|
||||
google.maps.event.trigger(mapSOC.map, 'resize');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(function(){
|
||||
|
||||
if ($("#delivery-method_{$module}").is(':checked')) {
|
||||
displayContent();
|
||||
}
|
||||
|
||||
$('[name="colissimo-pickup-point-pr"]').on('click', function(){
|
||||
var radioChecked = $('input[type="radio"]:checked', '#table-colissimo-pickup-point').length;
|
||||
if (radioChecked === 0) {
|
||||
alert("{intl l='No relay points were selected' d='colissimopickuppoint.fo.default'}");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('[name="thelia_order_delivery[delivery-module]"]', '.table-delivery').on('change', function(){
|
||||
if($(this).attr('id') != 'delivery-method_{$module}') {
|
||||
$("#google-map-colissimo-pickup-point").closest('tr').hide();
|
||||
$('.btn-checkout-next').show();
|
||||
} else {
|
||||
displayContent();
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof initialize_so == 'function') {
|
||||
$(".toggle-type-colissimo-pickup-point").on('change', function () {
|
||||
updatemap_colissimo_pickup_point();
|
||||
});
|
||||
|
||||
$("#delivery-method").on('click', '.colissimo_pickup_point', function () {
|
||||
markerId = $(this).data('marker');
|
||||
google.maps.event.trigger(mapSOC.listMarker[markerId], 'click');
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{/loop}
|
||||
@@ -0,0 +1,29 @@
|
||||
{assign var="addresslooptype" value="address"}
|
||||
|
||||
{loop type="colissimo.pickup.point.id" name="colissimo.pickup.point.id.invoice"}
|
||||
{if $module == {order attr="delivery_module"}}
|
||||
{assign var="addresslooptype" value="address.colissimo.pickup.point"}
|
||||
{/if}
|
||||
{/loop}
|
||||
|
||||
{loop type=$addresslooptype name="delivery-address" id={order attr="delivery_address"}}
|
||||
<div class="panel">
|
||||
<div class="panel-heading">{intl l="Delivery address"}</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></span><br>
|
||||
<span class="cellphone">{$CELLPHONE}</span>
|
||||
</address>
|
||||
</div>
|
||||
</div>
|
||||
{/loop}
|
||||