Ajout des modules ColissimoWs et ColissimoLabel.php
Ne pas oublier de vérifier si les tables nécessaires sont bien créées en BDD.
This commit is contained in:
26
local/modules/ColissimoWs/.gitignore
vendored
Normal file
26
local/modules/ColissimoWs/.gitignore
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
337
local/modules/ColissimoWs/ColissimoWs.php
Normal file
337
local/modules/ColissimoWs/ColissimoWs.php
Normal file
@@ -0,0 +1,337 @@
|
||||
<?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 ColissimoWs;
|
||||
|
||||
use ColissimoWs\Model\ColissimowsFreeshippingQuery;
|
||||
use ColissimoWs\Model\ColissimowsPriceSlices;
|
||||
use PDO;
|
||||
use ColissimoWs\Model\ColissimowsLabelQuery;
|
||||
use ColissimoWs\Model\ColissimowsPriceSlicesQuery;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Propel;
|
||||
use SoColissimo\Model\SocolissimoDeliveryModeQuery;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\Country;
|
||||
use Thelia\Model\Message;
|
||||
use Thelia\Model\MessageQuery;
|
||||
use Thelia\Model\ModuleQuery;
|
||||
use Thelia\Model\Order;
|
||||
use Thelia\Module\AbstractDeliveryModule;
|
||||
use Thelia\Module\BaseModule;
|
||||
use Thelia\Module\DeliveryModuleInterface;
|
||||
use Thelia\Module\Exception\DeliveryException;
|
||||
|
||||
class ColissimoWs extends AbstractDeliveryModule
|
||||
{
|
||||
/** @var string */
|
||||
const DOMAIN_NAME = 'colissimows';
|
||||
|
||||
// The shipping confirmation message identifier
|
||||
const CONFIRMATION_MESSAGE_NAME = 'order_confirmation_colissimows';
|
||||
|
||||
// Events
|
||||
const GENERATE_LABEL_EVENT = 'colissimows.generate_label_event';
|
||||
const CLEAR_LABEL_EVENT = 'colissimows.clear_label_event';
|
||||
|
||||
// Configuration parameters
|
||||
const COLISSIMO_USERNAME = 'colissimo_username';
|
||||
const COLISSIMO_PASSWORD = 'colissimo_password';
|
||||
const AFFRANCHISSEMENT_ENDPOINT_URL = 'affranchissement_endpoint_url';
|
||||
const FORMAT_ETIQUETTE = 'format_etiquette';
|
||||
const ACTIVATE_DETAILED_DEBUG = 'activate_detailed_debug';
|
||||
|
||||
const FROM_NAME = 'company_name';
|
||||
const FROM_ADDRESS_1 = 'from_address_1';
|
||||
const FROM_ADDRESS_2 = 'from_address_2';
|
||||
const FROM_CITY = 'from_city';
|
||||
const FROM_ZIPCODE = 'from_zipcode';
|
||||
const FROM_COUNTRY = 'from_country';
|
||||
const FROM_CONTACT_EMAIL = 'from_contact_email';
|
||||
const FROM_PHONE = 'from_phone';
|
||||
|
||||
/**
|
||||
* @param ConnectionInterface|null $con
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function postActivation(ConnectionInterface $con = null)
|
||||
{
|
||||
// Create table if required.
|
||||
try {
|
||||
ColissimowsLabelQuery::create()->findOne();
|
||||
} catch (\Exception $ex) {
|
||||
$database = new \Thelia\Install\Database($con->getWrappedConnection());
|
||||
$database->insertSql(null, [__DIR__ . "/Config/thelia.sql"]);
|
||||
|
||||
self::setConfigValue(self::AFFRANCHISSEMENT_ENDPOINT_URL, 'https://ws.colissimo.fr/sls-ws/SlsServiceWS?wsdl');
|
||||
|
||||
self::setConfigValue(ColissimoWs::FROM_NAME, ConfigQuery::getStoreName());
|
||||
self::setConfigValue(ColissimoWs::FROM_ADDRESS_1, ConfigQuery::read('store_address1'));
|
||||
self::setConfigValue(ColissimoWs::FROM_ADDRESS_2, ConfigQuery::read('store_address2'));
|
||||
self::setConfigValue(ColissimoWs::FROM_CITY, ConfigQuery::read('store_city'));
|
||||
self::setConfigValue(ColissimoWs::FROM_ZIPCODE, ConfigQuery::read('store_zipcode'));
|
||||
self::setConfigValue(ColissimoWs::FROM_CONTACT_EMAIL, ConfigQuery::read('store_email'));
|
||||
self::setConfigValue(ColissimoWs::FROM_COUNTRY, Country::getShopLocation()->getIsoalpha2());
|
||||
self::setConfigValue(ColissimoWs::FROM_PHONE, ConfigQuery::read('store_phone'));
|
||||
}
|
||||
|
||||
if (null === MessageQuery::create()->findOneByName(self::CONFIRMATION_MESSAGE_NAME)) {
|
||||
$message = new Message();
|
||||
|
||||
$message
|
||||
->setName(self::CONFIRMATION_MESSAGE_NAME)
|
||||
->setHtmlLayoutFileName('order_shipped.html')
|
||||
->setTextLayoutFileName('order_shipped.txt')
|
||||
->setLocale('en_US')
|
||||
->setTitle('Order send confirmation')
|
||||
->setSubject('Order send confirmation')
|
||||
|
||||
->setLocale('fr_FR')
|
||||
->setTitle('Confirmation d\'envoi de commande')
|
||||
->setSubject('Confirmation d\'envoi de commande')
|
||||
|
||||
->save()
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static function getLabelFileType()
|
||||
{
|
||||
return strtolower(substr(ColissimoWs::getConfigValue(ColissimoWs::FORMAT_ETIQUETTE, 'PDF'), 0, 3));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $areaId
|
||||
* @param $weight
|
||||
* @param $cartAmount
|
||||
* @param $deliverModeCode
|
||||
*
|
||||
* @return mixed
|
||||
* @throws DeliveryException
|
||||
*/
|
||||
public static function getPostageAmount($areaId, $weight, $cartAmount = 0)
|
||||
{
|
||||
//@TODO : Handle Freeshipping (button activation sets a variable in module config ?)
|
||||
//$freeshipping = getFreeshippingActive();
|
||||
$freeshipping = false;
|
||||
|
||||
//@TODO : Handle FreeshippingFrom
|
||||
//$freeshippingFrom = getFreeshippingFrom();
|
||||
$freeshippingFrom = null;
|
||||
|
||||
//@TODO : Handle FreeShippingByArea (needs a dedicated function and probably a dedicated table too)
|
||||
|
||||
|
||||
$postage = 0;
|
||||
|
||||
if (!$freeshipping) {
|
||||
$areaPrices = ColissimowsPriceSlicesQuery::create()
|
||||
->filterByAreaId($areaId)
|
||||
->filterByMaxWeight($weight, Criteria::GREATER_EQUAL)
|
||||
->_or()
|
||||
->filterByMaxWeight(null)
|
||||
->filterByMaxPrice($cartAmount, Criteria::GREATER_EQUAL)
|
||||
->_or()
|
||||
->filterByMaxPrice(null)
|
||||
->orderByMaxWeight()
|
||||
->orderByMaxPrice()
|
||||
;
|
||||
|
||||
/** @var ColissimowsPriceSlices $firstPrice */
|
||||
$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 freeshipping is defined and the cart amount reaches this value, return 0 (aka free shipping)
|
||||
if (null !== $freeshippingFrom && $freeshippingFrom <= $cartAmount) {
|
||||
$postage = 0;
|
||||
return $postage;
|
||||
}
|
||||
|
||||
$postage = $firstPrice->getShipping();
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate and return delivery price
|
||||
*
|
||||
* @param Country $country
|
||||
* @return mixed
|
||||
* @throws DeliveryException
|
||||
*/
|
||||
public function getPostage(Country $country)
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$postage = 0;
|
||||
|
||||
$freeshippingIsActive = ColissimowsFreeshippingQuery::create()->findOneById(1)->getActive();
|
||||
|
||||
if (false === $freeshippingIsActive){
|
||||
$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.");
|
||||
}
|
||||
|
||||
if (null === $postage = $this->getMinPostage($areaIdArray, $cartWeight, $cartAmount)) {
|
||||
throw new DeliveryException("Colissimo delivery unavailable for your cart weight or delivery country");
|
||||
}
|
||||
}
|
||||
|
||||
return $postage;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called by the Delivery loop, to check if the current module has to be displayed to the customer.
|
||||
* Override it to implements your delivery rules/
|
||||
*
|
||||
* If you return true, the delivery method will de displayed to the customer
|
||||
* If you return false, the delivery method will not be displayed
|
||||
*
|
||||
* @param Country $country the country to deliver to.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isValidDelivery(Country $country)
|
||||
{
|
||||
$areaId = $country->getAreaId();
|
||||
|
||||
$prices = ColissimowsPriceSlicesQuery::create()
|
||||
->filterByAreaId($areaId)
|
||||
->findOne();
|
||||
|
||||
|
||||
|
||||
/* check if Colissimo delivers the asked area*/
|
||||
if (null !== $prices) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function canOrderBeNotSigned(Order $order)
|
||||
{
|
||||
$areas = $order->getOrderAddressRelatedByDeliveryOrderAddressId()->getCountry()->getAreas();
|
||||
|
||||
$areas_id = [];
|
||||
|
||||
foreach ($areas as $area){
|
||||
$areas_id[] = $area->getId();
|
||||
}
|
||||
|
||||
if (in_array(4, $areas_id) || in_array(5, $areas_id)) // If order's country isn't in Europe or in DOM-TOM so order has to be signed
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Order $order
|
||||
* @return string
|
||||
* Get the area code for order (used to generate colissimoWs label with or without signature)
|
||||
* Codes :
|
||||
* - FR : France
|
||||
* - DT : Dom-Tom
|
||||
* - EU : Europe
|
||||
* - WO : World
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public static function getOrderShippingArea(Order $order){
|
||||
$areas = $order->getOrderAddressRelatedByDeliveryOrderAddressId()->getCountry()->getAreas();
|
||||
|
||||
$areas_id = [];
|
||||
|
||||
foreach ($areas as $area){
|
||||
$areas_id[] = $area->getId();
|
||||
}
|
||||
|
||||
if (in_array(1, $areas_id)){
|
||||
return 'FR';
|
||||
}
|
||||
|
||||
if (in_array(2, $areas_id) || in_array(3, $areas_id)){
|
||||
return 'EU';
|
||||
}
|
||||
|
||||
if (in_array(4, $areas_id) || in_array(5, $areas_id)){
|
||||
return 'WO';
|
||||
}
|
||||
|
||||
if (in_array(6, $areas_id)){
|
||||
return 'DT';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function getModCode()
|
||||
{
|
||||
return ModuleQuery::create()->findOneByCode("ColissimoWs")->getId();
|
||||
}
|
||||
}
|
||||
40
local/modules/ColissimoWs/Config/config.xml
Normal file
40
local/modules/ColissimoWs/Config/config.xml
Normal file
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<config xmlns="http://thelia.net/schema/dic/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||
|
||||
<loops>
|
||||
<loop name="colissimows.orders-not-sent" class="ColissimoWs\Loop\OrdersNotYetSentLoop" />
|
||||
<loop name="colissimows.label-info" class="ColissimoWs\Loop\ColissimoWsLabelInfo" />
|
||||
<loop name="colissimows.price-slices" class="ColissimoWs\Loop\PriceSlicesLoop" />
|
||||
<loop name="colissimows.freeshipping" class="ColissimoWs\Loop\ColissimoWsFreeShippingLoop" />
|
||||
</loops>
|
||||
|
||||
<forms>
|
||||
<form name="colissimows_configuration_form" class="ColissimoWs\Form\ConfigurationForm" />
|
||||
<form name="colissimows_export_form" class="ColissimoWs\Form\LabelGenerationForm" />
|
||||
<form name="colissimows.freeshipping.form" class="ColissimoWs\Form\FreeShippingForm" />
|
||||
</forms>
|
||||
|
||||
<services>
|
||||
<service id="colissimows.label_generator" class="ColissimoWs\EventListeners\ShippingLabelGenerator">
|
||||
<argument type="service" id="request_stack" />
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
|
||||
<service id="colissimows.notification_mail" class="ColissimoWs\EventListeners\ShippingNotificationSender">
|
||||
<argument type="service" id="thelia.parser" />
|
||||
<argument type="service" id="mailer"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
</services>
|
||||
|
||||
<hooks>
|
||||
<hook id="colissimows.hooks" class="ColissimoWs\Hook\HookManager">
|
||||
<tag name="hook.event_listener" event="module.configuration" type="back" method="onModuleConfigure" />
|
||||
<tag name="hook.event_listener" event="main.top-menu-tools" type="back" method="onMainTopMenuTools" />
|
||||
<tag name="hook.event_listener" event="module.config-js" type="back" method="onModuleConfigJs" />
|
||||
</hook>
|
||||
</hooks>
|
||||
</config>
|
||||
32
local/modules/ColissimoWs/Config/module.xml
Normal file
32
local/modules/ColissimoWs/Config/module.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module xmlns="http://thelia.net/schema/dic/module"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_2.xsd">
|
||||
<fullnamespace>ColissimoWs\ColissimoWs</fullnamespace>
|
||||
<descriptive locale="en_US">
|
||||
<title>Home delivery with Colissimo</title>
|
||||
<subtitle>Use Colissimo web services to get labels and tracking numbers</subtitle>
|
||||
</descriptive>
|
||||
<descriptive locale="fr_FR">
|
||||
<title>Livraison à domicile avec Colissimo</title>
|
||||
<subtitle>Utilisez les web services Colissimo pour obtenir les étiquettes d'affranchissement et les numéros de suivi.</subtitle>
|
||||
</descriptive>
|
||||
<languages>
|
||||
<language>en_US</language>
|
||||
<language>fr_FR</language>
|
||||
</languages>
|
||||
<version>1.1.6</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Franck Allimant</name>
|
||||
<company>CQFDev</company>
|
||||
<email>thelia@cqfdev.fr</email>
|
||||
<website>www.cqfdev.fr</website>
|
||||
</author>
|
||||
</authors>
|
||||
<type>delivery</type>
|
||||
<thelia>2.3.4</thelia>
|
||||
<stability>other</stability>
|
||||
<mandatory>0</mandatory>
|
||||
<hidden>0</hidden>
|
||||
</module>
|
||||
50
local/modules/ColissimoWs/Config/routing.xml
Normal file
50
local/modules/ColissimoWs/Config/routing.xml
Normal file
@@ -0,0 +1,50 @@
|
||||
<?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="colissimows.config" path="/admin/module/colissimows/configure">
|
||||
<default key="_controller">ColissimoWs\Controller\ConfigurationController::configure</default>
|
||||
</route>
|
||||
|
||||
<route id="colissimows.export" path="/admin/module/colissimows/export">
|
||||
<default key="_controller">ColissimoWs\Controller\LabelController::export</default>
|
||||
</route>
|
||||
|
||||
<route id="colissimows.label" path="/admin/module/colissimows/label/{orderId}">
|
||||
<default key="_controller">ColissimoWs\Controller\LabelController::getLabel</default>
|
||||
<requirement key="orderId">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="colissimows.customs-invoice" path="/admin/module/colissimows/customs-invoice/{orderId}">
|
||||
<default key="_controller">ColissimoWs\Controller\LabelController::getCustomsInvoice</default>
|
||||
<requirement key="orderId">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="colissimows.clear_label" path="/admin/module/colissimows/label/clear/{orderId}">
|
||||
<default key="_controller">ColissimoWs\Controller\LabelController::clearLabel</default>
|
||||
<requirement key="orderId">\d+</requirement>
|
||||
</route>
|
||||
|
||||
<route id="colissimows.get_zip" path="/admin/module/colissimows/labels-zip/{base64EncodedZipFilename}">
|
||||
<default key="_controller">ColissimoWs\Controller\LabelController::getLabelZip</default>
|
||||
<requirement key="base64ZipFilePath">[A-Za-z0-9]+</requirement>
|
||||
</route>
|
||||
|
||||
<!-- Price Slices -->
|
||||
|
||||
<route id="colissimows.toggle.freeshipping" path="/admin/module/colissimows/freeshipping" methods="post">
|
||||
<default key="_controller">ColissimoWs\Controller\FreeShippingController::toggleFreeShippingActivation</default>
|
||||
</route>
|
||||
|
||||
<route id="colissimows.add.price-slice" path="/admin/module/colissimows/price-slice/save" methods="post">
|
||||
<default key="_controller">ColissimoWs\Controller\PriceSliceController::savePriceSliceAction</default>
|
||||
</route>
|
||||
|
||||
<route id="colissimows.update.price-slice" path="/admin/module/colissimows/price-slice/delete" methods="post">
|
||||
<default key="_controller">ColissimoWs\Controller\PriceSliceController::deletePriceSliceAction</default>
|
||||
</route>
|
||||
|
||||
|
||||
</routes>
|
||||
45
local/modules/ColissimoWs/Config/schema.xml
Normal file
45
local/modules/ColissimoWs/Config/schema.xml
Normal file
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<database defaultIdMethod="native" name="thelia"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../../../core/vendor/propel/propel/resources/xsd/database.xsd" >
|
||||
|
||||
<table name="colissimows_label" namespace="ColissimoWs\Model">
|
||||
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||
<column name="order_id" type="INTEGER" required="true"/>
|
||||
<column name="order_ref" type="VARCHAR" size="255" required="true"/>
|
||||
<column name="error" type="BOOLEAN" required="true" default="0" />
|
||||
<column name="error_message" type="VARCHAR" size="255" default="" />
|
||||
<column name="tracking_number" type="VARCHAR" size="64" default="" />
|
||||
<column name="label_data" type="CLOB" />
|
||||
<column name="label_type" type="VARCHAR" size="4" />
|
||||
<column name="weight" type="float" required="true" />
|
||||
<column name="signed" type="BOOLEAN" default="0"/>
|
||||
<column name="with_customs_invoice" type="BOOLEAN" required="true" default="0" />
|
||||
|
||||
<foreign-key foreignTable="order" name="fk_colissimows_label_order" onDelete="CASCADE" onUpdate="RESTRICT">
|
||||
<reference foreign="id" local="order_id" />
|
||||
</foreign-key>
|
||||
|
||||
<behavior name="timestampable" />
|
||||
</table>
|
||||
|
||||
<table name="colissimows_price_slices" namespace="ColissimoWs\Model">
|
||||
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||
<column name="area_id" type="INTEGER" required="true"/>
|
||||
<column name="max_weight" type="FLOAT"/>
|
||||
<column name="max_price" type="FLOAT"/>
|
||||
<column name="shipping" type="FLOAT" required="true"/>
|
||||
<column name="franco_min_price" type="FLOAT" />
|
||||
|
||||
<foreign-key foreignTable="area" name="fk_colissimows_price_slices_area_id" onDelete="RESTRICT" onUpdate="RESTRICT">
|
||||
<reference foreign="id" local="area_id" />
|
||||
</foreign-key>
|
||||
</table>
|
||||
|
||||
<table name="colissimows_freeshipping" namespace="ColissimoWs\Model">
|
||||
<column name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||
<column name="active" type="BOOLEAN" default="0"/>
|
||||
</table>
|
||||
|
||||
<external-schema filename="local/config/schema.xml" referenceOnly="true" />
|
||||
</database>
|
||||
2
local/modules/ColissimoWs/Config/sqldb.map
Normal file
2
local/modules/ColissimoWs/Config/sqldb.map
Normal file
@@ -0,0 +1,2 @@
|
||||
# Sqlfile -> Database map
|
||||
thelia.sql=thelia
|
||||
73
local/modules/ColissimoWs/Config/thelia.sql
Normal file
73
local/modules/ColissimoWs/Config/thelia.sql
Normal file
@@ -0,0 +1,73 @@
|
||||
|
||||
# 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;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- colissimows_label
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `colissimows_label`;
|
||||
|
||||
CREATE TABLE `colissimows_label`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`order_id` INTEGER NOT NULL,
|
||||
`order_ref` VARCHAR(255) NOT NULL,
|
||||
`error` TINYINT(1) DEFAULT 0 NOT NULL,
|
||||
`error_message` VARCHAR(255) DEFAULT '',
|
||||
`tracking_number` VARCHAR(64) DEFAULT '',
|
||||
`label_data` LONGTEXT,
|
||||
`label_type` VARCHAR(4),
|
||||
`weight` FLOAT NOT NULL,
|
||||
`signed` TINYINT(1) DEFAULT 0,
|
||||
`with_customs_invoice` TINYINT(1) DEFAULT 0 NOT NULL,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `fi_colissimows_label_order` (`order_id`),
|
||||
CONSTRAINT `fk_colissimows_label_order`
|
||||
FOREIGN KEY (`order_id`)
|
||||
REFERENCES `order` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- colissimows_price_slices
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `colissimows_price_slices`;
|
||||
|
||||
CREATE TABLE `colissimows_price_slices`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`area_id` INTEGER NOT NULL,
|
||||
`max_weight` FLOAT,
|
||||
`max_price` FLOAT,
|
||||
`shipping` FLOAT NOT NULL,
|
||||
`franco_min_price` FLOAT,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `fi_colissimows_price_slices_area_id` (`area_id`),
|
||||
CONSTRAINT `fk_colissimows_price_slices_area_id`
|
||||
FOREIGN KEY (`area_id`)
|
||||
REFERENCES `area` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- colissimows_freeshipping
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `colissimows_freeshipping`;
|
||||
|
||||
CREATE TABLE `colissimows_freeshipping`
|
||||
(
|
||||
`id` INTEGER NOT NULL,
|
||||
`active` TINYINT(1) DEFAULT 0,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
# This restores the fkey checks, after having unset them earlier
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
/**
|
||||
* Created by Franck Allimant, CQFDev <franck@cqfdev.fr>
|
||||
* Date: 17/08/2019 12:26
|
||||
*/
|
||||
namespace ColissimoWs\Controller;
|
||||
|
||||
use ColissimoWs\ColissimoWs;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
class ConfigurationController extends BaseAdminController
|
||||
{
|
||||
public function configure()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE, ColissimoWs::DOMAIN_NAME, AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$configurationForm = $this->createForm('colissimows_configuration_form');
|
||||
|
||||
$message = false;
|
||||
|
||||
$url = '/admin/module/ColissimoWs';
|
||||
|
||||
try {
|
||||
$form = $this->validateForm($configurationForm);
|
||||
|
||||
// Get the form field values
|
||||
$data = $form->getData();
|
||||
|
||||
foreach ($data as $name => $value) {
|
||||
if (is_array($value)) {
|
||||
$value = implode(';', $value);
|
||||
}
|
||||
|
||||
ColissimoWs::setConfigValue($name, $value);
|
||||
}
|
||||
|
||||
// Log configuration modification
|
||||
$this->adminLogAppend(
|
||||
"colissimoWs.configuration.message",
|
||||
AccessManager::UPDATE,
|
||||
"ColissimoWs configuration updated"
|
||||
);
|
||||
|
||||
// Redirect to the success URL,
|
||||
if (!$this->getRequest()->get('save_mode') == 'stay') {
|
||||
$url = '/admin/modules';
|
||||
}
|
||||
} catch (FormValidationException $ex) {
|
||||
$message = $this->createStandardFormValidationErrorMessage($ex);
|
||||
} catch (\Exception $ex) {
|
||||
$message = $ex->getMessage();
|
||||
}
|
||||
|
||||
if ($message !== false) {
|
||||
$this->setupFormErrorContext(
|
||||
$this->getTranslator()->trans("ColissimoWs configuration", [], ColissimoWs::DOMAIN_NAME),
|
||||
$message,
|
||||
$configurationForm,
|
||||
$ex
|
||||
);
|
||||
}
|
||||
|
||||
return $this->generateRedirect(URL::getInstance()->absoluteUrl($url, [ 'tab' => 'config', 'success' => $message === false ]));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?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 ColissimoWs\Controller;
|
||||
|
||||
use ColissimoWs\Form\FreeShippingForm;
|
||||
use ColissimoWs\Model\ColissimowsFreeshipping;
|
||||
use ColissimoWs\Model\ColissimowsFreeshippingQuery;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
|
||||
class FreeShippingController extends BaseAdminController
|
||||
{
|
||||
public function toggleFreeShippingActivation()
|
||||
{
|
||||
if (null !== $response = $this
|
||||
->checkAuth(array(AdminResources::MODULE), array('ColissimoWs'), AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$form = new FreeShippingForm($this->getRequest());
|
||||
$response=null;
|
||||
|
||||
try {
|
||||
$vform = $this->validateForm($form);
|
||||
$freeshipping = $vform->get('freeshipping')->getData();
|
||||
|
||||
if (null === $isFreeShippingActive = ColissimowsFreeshippingQuery::create()->findOneById(1)){
|
||||
$isFreeShippingActive = new ColissimowsFreeshipping();
|
||||
}
|
||||
|
||||
$isFreeShippingActive->setActive($freeshipping);
|
||||
|
||||
$isFreeShippingActive->save();
|
||||
|
||||
$response = JsonResponse::create(array("success"=>"Freeshipping activated"), 200);
|
||||
} catch (\Exception $e) {
|
||||
$response = JsonResponse::create(array("error"=>$e->getMessage()), 500);
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
370
local/modules/ColissimoWs/Controller/LabelController.php
Normal file
370
local/modules/ColissimoWs/Controller/LabelController.php
Normal file
@@ -0,0 +1,370 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
/**
|
||||
* Created by Franck Allimant, CQFDev <franck@cqfdev.fr>
|
||||
* Date: 04/09/2019 21:51
|
||||
*/
|
||||
namespace ColissimoWs\Controller;
|
||||
|
||||
use ColissimoLabel\Model\ColissimoLabelQuery;
|
||||
use ColissimoWs\ColissimoWs;
|
||||
use ColissimoWs\Event\LabelEvent;
|
||||
use ColissimoWs\Model\ColissimowsLabel;
|
||||
use ColissimoWs\Model\ColissimowsLabelQuery;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\PdfEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\HttpFoundation\Response;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Exception\TheliaProcessException;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\ModuleQuery;
|
||||
use Thelia\Model\OrderQuery;
|
||||
use Thelia\Model\OrderStatusQuery;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
class LabelController extends BaseAdminController
|
||||
{
|
||||
/** @TODO : Compatibility with colissimo_label module */
|
||||
const LABEL_DIRECTORY = THELIA_LOCAL_DIR . 'colissimo-label';
|
||||
|
||||
/**
|
||||
* @return mixed|\Symfony\Component\HttpFoundation\Response|StreamedResponse
|
||||
*/
|
||||
public function export()
|
||||
{
|
||||
static $codesPaysEurope = [
|
||||
'DE',
|
||||
'AT',
|
||||
'BE',
|
||||
'BG',
|
||||
'CY',
|
||||
'HR',
|
||||
'DK',
|
||||
'ES',
|
||||
'EE',
|
||||
'FI',
|
||||
'FR',
|
||||
'GR',
|
||||
'HU',
|
||||
'IE',
|
||||
'IT',
|
||||
'LV',
|
||||
'LT',
|
||||
'MT',
|
||||
'LU',
|
||||
'NL',
|
||||
'PL',
|
||||
'PT',
|
||||
'CZ',
|
||||
'RO',
|
||||
'GB',
|
||||
'SK',
|
||||
'SI',
|
||||
'SE '
|
||||
];
|
||||
|
||||
if (null !== $response = $this->checkAuth(array(AdminResources::MODULE), array('ColissimoWs'), AccessManager::UPDATE)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$exportForm = $this->createForm('colissimows_export_form');
|
||||
|
||||
$files = $params = [];
|
||||
|
||||
if (!@mkdir(self::LABEL_DIRECTORY) && !is_dir(self::LABEL_DIRECTORY)) {
|
||||
throw new TheliaProcessException("Failed to create directory " . self::LABEL_DIRECTORY);
|
||||
}
|
||||
|
||||
try {
|
||||
$form = $this->validateForm($exportForm);
|
||||
|
||||
$data = $form->getData();
|
||||
|
||||
// Check status_id
|
||||
$newStatus = OrderStatusQuery::create()->findOneByCode($data['new_status']);
|
||||
|
||||
ColissimoWs::setConfigValue("new_status", $data['new_status']);
|
||||
|
||||
$weight_array = $data['weight'];
|
||||
$signed_array = $data['signed'];
|
||||
|
||||
foreach($data['order_id'] as $orderId) {
|
||||
if (null !== $order = OrderQuery::create()->findPk($orderId)) {
|
||||
if (! isset($weight_array[$orderId]) || 0 === (float)$weight_array[$orderId]) {
|
||||
$weight = $order->getWeight();
|
||||
} else {
|
||||
$weight = (float) $weight_array[$orderId];
|
||||
}
|
||||
|
||||
if ($weight === null) {
|
||||
throw new \Exception($this->getTranslator()->trans("Please enter a weight for every selected order"));
|
||||
}
|
||||
|
||||
if (array_key_exists ($orderId , $signed_array)){
|
||||
$signed = $signed_array[$orderId];
|
||||
} else {
|
||||
$signed = false;
|
||||
}
|
||||
|
||||
$event = (new LabelEvent($orderId))
|
||||
->setWeight($weight)
|
||||
->setSigned($signed);
|
||||
|
||||
$this->getDispatcher()->dispatch(ColissimoWs::GENERATE_LABEL_EVENT, $event);
|
||||
|
||||
if ($event->hasLabel() && $event->getColissimoWsLabel()->getError() === false) {
|
||||
$fileType = ColissimoWs::getLabelFileType();
|
||||
|
||||
$labelFileName = self::LABEL_DIRECTORY . DS . $order->getRef() . '.' . $fileType;
|
||||
|
||||
file_put_contents($labelFileName, $event->getColissimoWsLabel()->getLabelData());
|
||||
|
||||
$files[] = $labelFileName;
|
||||
|
||||
$destinationEurope =
|
||||
in_array(
|
||||
strtoupper($order->getOrderAddressRelatedByDeliveryOrderAddressId()->getCountry()->getIsoalpha2()),
|
||||
$codesPaysEurope
|
||||
)
|
||||
;
|
||||
|
||||
/** Comment this to disable "no customs invoice template" error */
|
||||
// Generate customs invoice for non-FR foreign shipping
|
||||
if (!$destinationEurope) {
|
||||
$files[] = $this->createCustomsInvoice($orderId, $order->getRef());
|
||||
|
||||
// We have a customs invoice !
|
||||
$event
|
||||
->getColissimoWsLabel()
|
||||
->setWithCustomsInvoice(true)
|
||||
->setSigned(true)
|
||||
->save();
|
||||
}
|
||||
|
||||
if (null !== $newStatus) {
|
||||
$event = new OrderEvent($order);
|
||||
$event->setStatus($newStatus->getId());
|
||||
|
||||
$this->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event);
|
||||
}
|
||||
|
||||
// Ajouter la facture au zip
|
||||
$labelFileName = self::LABEL_DIRECTORY . DS . $order->getRef() . '-invoice.pdf';
|
||||
|
||||
$response = $this->generateOrderPdf($orderId, ConfigQuery::read('pdf_invoice_file', 'invoice'));
|
||||
|
||||
if (file_put_contents($labelFileName, $response->getContent())) {
|
||||
$files[] = $labelFileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($files) > 0) {
|
||||
$zip = new \ZipArchive();
|
||||
$zipFilename = sys_get_temp_dir() .DS. uniqid('colissimo-labels-', false);
|
||||
|
||||
if (true !== $zip->open($zipFilename, \ZipArchive::CREATE)) {
|
||||
throw new TheliaProcessException("Cannot open zip file $zipFilename\n");
|
||||
}
|
||||
|
||||
foreach ($files as $file) {
|
||||
$zip->addFile($file, basename($file));
|
||||
}
|
||||
|
||||
$zip->close();
|
||||
|
||||
// Perform cleanup
|
||||
/*
|
||||
foreach ($files as $file) {
|
||||
@unlink($file);
|
||||
}
|
||||
*/
|
||||
|
||||
$params = [ 'zip' => base64_encode($zipFilename) ];
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
$this->setupFormErrorContext("Generation étiquettes Colissimo", $ex->getMessage(), $exportForm, $ex);
|
||||
}
|
||||
|
||||
return $this->generateRedirect(URL::getInstance()->absoluteUrl("admin/module/ColissimoWs", $params));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $orderId
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function getLabelZip($base64EncodedZipFilename)
|
||||
{
|
||||
$zipFilename = base64_decode($base64EncodedZipFilename);
|
||||
|
||||
if (file_exists($zipFilename)) {
|
||||
return new StreamedResponse(
|
||||
function () use ($zipFilename) {
|
||||
readfile($zipFilename);
|
||||
@unlink($zipFilename);
|
||||
},
|
||||
200,
|
||||
[
|
||||
'Content-Type' => 'application/zip',
|
||||
"Content-disposition" => "attachement; filename=colissimo-labels.zip",
|
||||
"Content-Length" => filesize($zipFilename)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
return new \Symfony\Component\HttpFoundation\Response("File no longer exists");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $orderId
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function getLabel($orderId)
|
||||
{
|
||||
if (null !== $labelInfo = ColissimowsLabelQuery::create()->findOneByOrderId($orderId)) {
|
||||
return $this->generateResponseForLabel($labelInfo);
|
||||
}
|
||||
|
||||
return $this->generateRedirect(URL::getInstance()->absoluteUrl("admin/module/ColissimoWs"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $orderId
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getCustomsInvoice($orderId)
|
||||
{
|
||||
if (null !== $order = OrderQuery::create()->findPk($orderId)) {
|
||||
$fileName = $this->createCustomsInvoice($orderId, $order->getRef());
|
||||
|
||||
return Response::create(
|
||||
file_get_contents($fileName),
|
||||
200,
|
||||
[
|
||||
"Content-Type" => "application/pdf",
|
||||
"Content-disposition" => "Attachement;filename=" . basename($fileName)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
return $this->generateRedirect(URL::getInstance()->absoluteUrl("admin/module/ColissimoWs"));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $orderId
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function clearLabel($orderId)
|
||||
{
|
||||
/** @var ColissimowsLabel $order */
|
||||
$order = ColissimowsLabelQuery::create()->filterByOrderId($orderId)->findOne();
|
||||
|
||||
$orderRef = $order->getOrderRef();
|
||||
$fileType = $order->getLabelType();
|
||||
$order->delete();
|
||||
|
||||
$file = self::LABEL_DIRECTORY . DS . $orderRef;
|
||||
$invoice = $file . '-invoice.pdf';
|
||||
$file .= ".$fileType";
|
||||
@unlink($file);
|
||||
@unlink($invoice);
|
||||
|
||||
///** Compatibility with module SoColissimoLabel /!\ Do not use strict comparison */
|
||||
//if (ModuleQuery::create()->findOneByCode('ColissimoLabel')->getActivate() == true)
|
||||
//{
|
||||
// ColissimoLabelQuery::create()->findOneByOrderId($orderId)->delete();
|
||||
//}
|
||||
|
||||
return $this->generateRedirect(URL::getInstance()->absoluteUrl("admin/module/ColissimoWs") . '#order-' . $orderId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $orderId
|
||||
* @param $orderRef
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function createCustomsInvoice($orderId, $orderRef)
|
||||
{
|
||||
$html = $this->renderRaw(
|
||||
"customs-invoice",
|
||||
array(
|
||||
'order_id' => $orderId
|
||||
),
|
||||
$this->getTemplateHelper()->getActivePdfTemplate()
|
||||
);
|
||||
|
||||
try {
|
||||
$pdfEvent = new PdfEvent($html);
|
||||
|
||||
$this->dispatch(TheliaEvents::GENERATE_PDF, $pdfEvent);
|
||||
|
||||
$pdfFileName = self::LABEL_DIRECTORY . DS . $orderRef . '-customs-invoice.pdf';
|
||||
|
||||
file_put_contents($pdfFileName, $pdfEvent->getPdf());
|
||||
|
||||
return $pdfFileName;
|
||||
} catch (\Exception $e) {
|
||||
Tlog::getInstance()->error(
|
||||
sprintf(
|
||||
'error during generating invoice pdf for order id : %d with message "%s"',
|
||||
$orderId,
|
||||
$e->getMessage()
|
||||
)
|
||||
);
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ColissimowsLabel $labelInfo
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
protected function generateResponseForLabel($labelInfo)
|
||||
{
|
||||
$fileType = $labelInfo->getLabelType();
|
||||
|
||||
if ($fileType === 'pdf') {
|
||||
return new BinaryFileResponse(
|
||||
self::LABEL_DIRECTORY . DS . $labelInfo->getOrderRef() . ".$fileType",
|
||||
200,
|
||||
[
|
||||
"Content-Type" => "application/pdf",
|
||||
"Content-disposition" => "Attachement;filename=" . $labelInfo->getOrder()->getRef() . ".pdf"
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
return new BinaryFileResponse(
|
||||
self::LABEL_DIRECTORY . DS . $labelInfo->getOrderRef() . ".$fileType",
|
||||
200,
|
||||
[
|
||||
"Content-Type" => "application/octet-stream",
|
||||
"Content-disposition" => "Attachement;filename=" . $labelInfo->getOrder()->getRef() . ".$fileType"
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
184
local/modules/ColissimoWs/Controller/PriceSliceController.php
Normal file
184
local/modules/ColissimoWs/Controller/PriceSliceController.php
Normal file
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace ColissimoWs\Controller;
|
||||
|
||||
|
||||
|
||||
use ColissimoWs\ColissimoWs;
|
||||
use ColissimoWs\Model\ColissimowsPriceSlices;
|
||||
use ColissimoWs\Model\ColissimowsPriceSlicesQuery;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Thelia\Controller\Admin\BaseAdminController;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
|
||||
class PriceSliceController extends BaseAdminController
|
||||
{
|
||||
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 savePriceSliceAction()
|
||||
{
|
||||
$response = $this->checkAuth([], ['colissimows'], AccessManager::UPDATE);
|
||||
|
||||
if (null !== $response) {
|
||||
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 = ColissimowsPriceSlicesQuery::create()->findPk($id);
|
||||
} else {
|
||||
$slice = new ColissimowsPriceSlices();
|
||||
}
|
||||
|
||||
|
||||
if (0 !== $areaId = (int)$requestData->get('area', 0)) {
|
||||
$slice->setAreaId($areaId);
|
||||
} else {
|
||||
$messages[] = $this->getTranslator()->trans(
|
||||
'The area is not valid',
|
||||
[],
|
||||
ColissimoWs::DOMAIN_NAME
|
||||
);
|
||||
}
|
||||
|
||||
$requestPriceMax = $requestData->get('maxPrice', null);
|
||||
$requestmaxWeight = $requestData->get('maxWeight', null);
|
||||
|
||||
if (empty($requestPriceMax) && empty($requestmaxWeight)) {
|
||||
$messages[] = $this->getTranslator()->trans(
|
||||
'You must specify at least a price max or a weight max value.',
|
||||
[],
|
||||
ColissimoWs::DOMAIN_NAME
|
||||
);
|
||||
} else {
|
||||
if (!empty($requestPriceMax)) {
|
||||
$maxPrice = $this->getFloatVal($requestPriceMax);
|
||||
if (0 < $maxPrice) {
|
||||
$slice->setMaxPrice($maxPrice);
|
||||
} else {
|
||||
$messages[] = $this->getTranslator()->trans(
|
||||
'The price max value is not valid',
|
||||
[],
|
||||
ColissimoWs::DOMAIN_NAME
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$slice->setMaxPrice(null);
|
||||
}
|
||||
|
||||
if (!empty($requestmaxWeight)) {
|
||||
$maxWeight = $this->getFloatVal($requestmaxWeight);
|
||||
if (0 < $maxWeight) {
|
||||
$slice->setMaxWeight($maxWeight);
|
||||
} else {
|
||||
$messages[] = $this->getTranslator()->trans(
|
||||
'The weight max value is not valid',
|
||||
[],
|
||||
ColissimoWs::DOMAIN_NAME
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$slice->setMaxWeight(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$price = $this->getFloatVal($requestData->get('shipping', 0));
|
||||
if (0 <= $price) {
|
||||
$slice->setShipping($price);
|
||||
} else {
|
||||
$messages[] = $this->getTranslator()->trans(
|
||||
'The price value is not valid',
|
||||
[],
|
||||
ColissimoWs::DOMAIN_NAME
|
||||
);
|
||||
}
|
||||
|
||||
if (0 === count($messages)) {
|
||||
$slice->save();
|
||||
$messages[] = $this->getTranslator()->trans(
|
||||
'Your slice has been saved',
|
||||
[],
|
||||
ColissimoWs::DOMAIN_NAME
|
||||
);
|
||||
|
||||
$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));
|
||||
}
|
||||
|
||||
public function deletePriceSliceAction()
|
||||
{
|
||||
$response = $this->checkAuth([], ['colissimows'], 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)) {
|
||||
$priceSlice = ColissimowsPriceSlicesQuery::create()->findPk($id);
|
||||
$priceSlice->delete();
|
||||
$responseData['success'] = true;
|
||||
} else {
|
||||
$responseData['message'] = $this->getTranslator()->trans(
|
||||
'The slice has not been deleted',
|
||||
[],
|
||||
ColissimoWs::DOMAIN_NAME
|
||||
);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$responseData['message'] = $e->getMessage();
|
||||
}
|
||||
|
||||
return $this->jsonResponse(json_encode($responseData));
|
||||
}
|
||||
}
|
||||
109
local/modules/ColissimoWs/Event/LabelEvent.php
Normal file
109
local/modules/ColissimoWs/Event/LabelEvent.php
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
/**
|
||||
* Created by Franck Allimant, CQFDev <franck@cqfdev.fr>
|
||||
* Date: 04/09/2019 15:23
|
||||
*/
|
||||
|
||||
namespace ColissimoWs\Event;
|
||||
|
||||
use ColissimoWs\Model\ColissimowsLabel;
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
|
||||
class LabelEvent extends ActionEvent
|
||||
{
|
||||
/** @var int */
|
||||
protected $orderId;
|
||||
|
||||
/** @var ColissimowsLabel */
|
||||
protected $colissimoWsLabel = null;
|
||||
|
||||
/** @var float|null */
|
||||
protected $weight = null;
|
||||
|
||||
/** @var bool|null */
|
||||
protected $signed = null;
|
||||
/**
|
||||
* LabelEvent constructor.
|
||||
* @param int $orderId
|
||||
*/
|
||||
public function __construct($orderId)
|
||||
{
|
||||
$this->orderId = $orderId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getOrderId()
|
||||
{
|
||||
return $this->orderId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ColissimowsLabel
|
||||
*/
|
||||
public function getColissimoWsLabel()
|
||||
{
|
||||
return $this->colissimoWsLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ColissimowsLabel $colissimoWsLabel
|
||||
* @return $this
|
||||
*/
|
||||
public function setColissimoWsLabel($colissimoWsLabel)
|
||||
{
|
||||
$this->colissimoWsLabel = $colissimoWsLabel;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function hasLabel()
|
||||
{
|
||||
return null !== $this->colissimoWsLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float|null
|
||||
*/
|
||||
public function getWeight()
|
||||
{
|
||||
return $this->weight;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float|null $weight
|
||||
* @return $this
|
||||
*/
|
||||
public function setWeight($weight)
|
||||
{
|
||||
$this->weight = $weight;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|null
|
||||
*/
|
||||
public function getSigned()
|
||||
{
|
||||
return $this->signed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool|null $signed
|
||||
* @return $this
|
||||
*/
|
||||
public function setSigned($signed)
|
||||
{
|
||||
$this->signed = $signed;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,463 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
/**
|
||||
* Created by Franck Allimant, CQFDev <franck@cqfdev.fr>
|
||||
* Date: 04/09/2019 14:34
|
||||
*/
|
||||
|
||||
namespace ColissimoWs\EventListeners;
|
||||
|
||||
use ColissimoLabel\ColissimoLabel;
|
||||
use ColissimoLabel\Model\ColissimoLabelQuery;
|
||||
use ColissimoPostage\ServiceType\Generate;
|
||||
use ColissimoPostage\StructType\Address;
|
||||
use ColissimoPostage\StructType\Addressee;
|
||||
use ColissimoPostage\StructType\Article;
|
||||
use ColissimoPostage\StructType\Category;
|
||||
use ColissimoPostage\StructType\Contents;
|
||||
use ColissimoPostage\StructType\CustomsDeclarations;
|
||||
use ColissimoPostage\StructType\GenerateLabel;
|
||||
use ColissimoPostage\StructType\GenerateLabelRequest;
|
||||
use ColissimoPostage\StructType\Letter;
|
||||
use ColissimoPostage\StructType\OutputFormat;
|
||||
use ColissimoPostage\StructType\Parcel;
|
||||
use ColissimoPostage\StructType\Sender;
|
||||
use ColissimoPostage\StructType\Service;
|
||||
use ColissimoWs\ColissimoWs;
|
||||
use ColissimoWs\Event\LabelEvent;
|
||||
use ColissimoWs\Model\ColissimowsLabel;
|
||||
use ColissimoWs\Model\ColissimowsLabelQuery;
|
||||
use ColissimoWs\Soap\GenerateWithAttachments;
|
||||
use ColissimoWs\Soap\SoapClientWithAttachements;
|
||||
use libphonenumber\NumberParseException;
|
||||
use libphonenumber\PhoneNumberUtil;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Thelia\Action\BaseAction;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\Country;
|
||||
use Thelia\Model\ModuleQuery;
|
||||
use Thelia\Model\OrderProduct;
|
||||
use Thelia\Model\OrderQuery;
|
||||
use Thelia\Tools\MoneyFormat;
|
||||
use WsdlToPhp\PackageBase\AbstractSoapClientBase;
|
||||
|
||||
class ShippingLabelGenerator extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
/** @var array */
|
||||
protected $options;
|
||||
|
||||
/** @var Generate */
|
||||
protected $generate;
|
||||
|
||||
/** @var RequestStack */
|
||||
protected $requestStack;
|
||||
|
||||
/** @var bool */
|
||||
protected $verbose;
|
||||
|
||||
/**
|
||||
* ShippingLabelGenerator constructor.
|
||||
*/
|
||||
public function __construct(RequestStack $requestStack)
|
||||
{
|
||||
$this->options = [
|
||||
AbstractSoapClientBase::WSDL_URL => ColissimoWs::getConfigValue(ColissimoWs::AFFRANCHISSEMENT_ENDPOINT_URL),
|
||||
AbstractSoapClientBase::WSDL_CLASSMAP => \ColissimoPostage\ClassMap::get(),
|
||||
];
|
||||
|
||||
// Générer les services
|
||||
$this->generate = new GenerateWithAttachments($this->options);
|
||||
|
||||
$this->requestStack = $requestStack;
|
||||
|
||||
$this->verbose = 0 !== (int) ColissimoWs::getConfigValue(ColissimoWs::ACTIVATE_DETAILED_DEBUG, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return [
|
||||
ColissimoWs::GENERATE_LABEL_EVENT => [ 'generateShippingLabel', 128 ],
|
||||
ColissimoWs::CLEAR_LABEL_EVENT => [ 'clearShippingLabel', 128 ],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clear a label
|
||||
*
|
||||
* @param LabelEvent $event
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function clearShippingLabel(LabelEvent $event)
|
||||
{
|
||||
ColissimowsLabelQuery::create()
|
||||
->filterByOrderId($event->getOrderId())
|
||||
->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new label from the order
|
||||
*
|
||||
* @param LabelEvent $event
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function generateShippingLabel(LabelEvent $event)
|
||||
{
|
||||
$erreur = false;
|
||||
|
||||
$trackingNumber = $labelContent = $message = '';
|
||||
|
||||
$request = $this->requestStack->getCurrentRequest();
|
||||
|
||||
$customsDeclaration = null;
|
||||
|
||||
if (null !== $order = OrderQuery::create()->findPk($event->getOrderId())) {
|
||||
$totalWeight = 0;
|
||||
|
||||
$signed = $event->getSigned();
|
||||
|
||||
$shopCountryCode = strtoupper(Country::getShopLocation()->getIsoalpha2());
|
||||
|
||||
$articles = [];
|
||||
|
||||
/** @var OrderProduct $orderProduct */
|
||||
foreach ($order->getOrderProducts() as $orderProduct) {
|
||||
$totalWeight += $orderProduct->getQuantity() * $orderProduct->getWeight();
|
||||
|
||||
$articles[] = new Article(
|
||||
$orderProduct->getTitle(),
|
||||
$orderProduct->getQuantity(),
|
||||
$orderProduct->getWeight(),
|
||||
MoneyFormat::getInstance($request)->formatStandardMoney($orderProduct->getPrice()),
|
||||
'3303001000',
|
||||
$shopCountryCode,
|
||||
$order->getCurrency()->getCode(),
|
||||
null,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
$customer = $order->getCustomer();
|
||||
$defaultAddress = $customer->getDefaultAddress();
|
||||
$deliveryAddress = $order->getOrderAddressRelatedByDeliveryOrderAddressId();
|
||||
|
||||
$mobilePhone = $this->formatterTelephone($defaultAddress->getCellphone(), $defaultAddress->getCountry()->getIsoalpha2());
|
||||
$landPhone = $this->formatterTelephone($defaultAddress->getPhone(), $defaultAddress->getCountry()->getIsoalpha2());
|
||||
|
||||
$storePhone = $this->formatterTelephone(
|
||||
ColissimoWs::getConfigValue(ColissimoWs::FROM_PHONE, ConfigQuery::read('store_phone')),
|
||||
ColissimoWs::getConfigValue(ColissimoWs::FROM_COUNTRY, Country::getShopLocation()->getIsoalpha2())
|
||||
);
|
||||
|
||||
switch(ColissimoWs::getOrderShippingArea($order)){
|
||||
case 'FR':
|
||||
if($signed) {
|
||||
$colissimoProductCode = "DOS";
|
||||
} else {
|
||||
$colissimoProductCode = "DOM";
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'EU':
|
||||
if($signed) {
|
||||
$colissimoProductCode = "DOS";
|
||||
} else {
|
||||
$colissimoProductCode = "COLI";
|
||||
}
|
||||
$customsDeclaration = new CustomsDeclarations(
|
||||
true,
|
||||
new Contents(
|
||||
$articles,
|
||||
new Category(3)
|
||||
)
|
||||
);
|
||||
break;
|
||||
|
||||
case 'WO':
|
||||
$colissimoProductCode = "COLI";
|
||||
|
||||
$customsDeclaration = new CustomsDeclarations(
|
||||
true,
|
||||
new Contents(
|
||||
$articles,
|
||||
new Category(3)
|
||||
)
|
||||
);
|
||||
break;
|
||||
|
||||
case 'DT':
|
||||
if($signed) {
|
||||
$colissimoProductCode = "CDS";
|
||||
} else {
|
||||
$colissimoProductCode = "COM";
|
||||
}
|
||||
|
||||
$customsDeclaration = new CustomsDeclarations(
|
||||
true,
|
||||
new Contents(
|
||||
$articles,
|
||||
new Category(3)
|
||||
)
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new \InvalidArgumentException("Failed to find order area " . $event->getOrderId());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Use provided weight if any.
|
||||
if (!empty($event->getWeight())) {
|
||||
// The specified weight cannot be less than the total articles weight
|
||||
if ($event->getWeight() > $totalWeight) {
|
||||
$totalWeight = $event->getWeight();
|
||||
}
|
||||
}
|
||||
|
||||
// Envoyer la requête
|
||||
$success = $this->generate->generateLabel(
|
||||
new GenerateLabel(
|
||||
new GenerateLabelRequest(
|
||||
ColissimoWs::getConfigValue(ColissimoWs::COLISSIMO_USERNAME),
|
||||
ColissimoWs::getConfigValue(ColissimoWs::COLISSIMO_PASSWORD),
|
||||
|
||||
new OutputFormat(0, 0, ColissimoWs::getConfigValue(ColissimoWs::FORMAT_ETIQUETTE, 'PDF_10x15_300dpi'), true, ''),
|
||||
new Letter(
|
||||
new Service(
|
||||
$colissimoProductCode,
|
||||
date('Y-m-d', strtotime('tomorrow')),
|
||||
false,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
round(100 * MoneyFormat::getInstance($request)->formatStandardMoney($order->getTotalAmount())),
|
||||
$order->getRef(),
|
||||
ConfigQuery::getStoreName(),
|
||||
3 // Ne pas retourner
|
||||
),
|
||||
new Parcel(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
$totalWeight,
|
||||
false,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
null,
|
||||
null
|
||||
),
|
||||
$customsDeclaration,
|
||||
new Sender(
|
||||
$order->getRef(),
|
||||
new Address(
|
||||
ColissimoWs::getConfigValue(ColissimoWs::FROM_NAME, ConfigQuery::getStoreName()),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
ColissimoWs::getConfigValue(ColissimoWs::FROM_ADDRESS_1, ConfigQuery::read('store_address1')),
|
||||
ColissimoWs::getConfigValue(ColissimoWs::FROM_ADDRESS_2, ConfigQuery::read('store_address2')),
|
||||
'FR',
|
||||
ColissimoWs::getConfigValue(ColissimoWs::FROM_CITY, ConfigQuery::read('store_city')),
|
||||
ColissimoWs::getConfigValue(ColissimoWs::FROM_ZIPCODE, ConfigQuery::read('store_zipcode')),
|
||||
$storePhone,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
ColissimoWs::getConfigValue(ColissimoWs::FROM_CONTACT_EMAIL, ConfigQuery::read('store_email')),
|
||||
null,
|
||||
strtoupper(ColissimoWs::getConfigValue(ColissimoWs::FROM_COUNTRY, Country::getShopLocation()->getIsoalpha2()))
|
||||
)
|
||||
),
|
||||
new Addressee(
|
||||
$customer->getRef(),
|
||||
false,
|
||||
null,
|
||||
null,
|
||||
new Address(
|
||||
'',
|
||||
$this->cleanUpAddresse($deliveryAddress->getFirstname()),
|
||||
$this->cleanUpAddresse($deliveryAddress->getLastname()),
|
||||
null,
|
||||
null,
|
||||
$this->cleanUpAddresse($deliveryAddress->getAddress1()),
|
||||
$this->cleanUpAddresse($deliveryAddress->getAddress2()),
|
||||
strtoupper($deliveryAddress->getCountry()->getIsoalpha2()),
|
||||
$this->corrigerLocalite($deliveryAddress->getCity()),
|
||||
preg_replace("/[\s]/", "", $deliveryAddress->getZipcode()),
|
||||
$landPhone,
|
||||
$mobilePhone,
|
||||
null,
|
||||
null,
|
||||
$customer->getEmail(),
|
||||
null,
|
||||
strtoupper($customer->getCustomerLang()->getCode()))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
Tlog::getInstance()->debug("Colissimo shipping label request: " . $this->generate->getLastRequest());
|
||||
|
||||
/*
|
||||
echo "<pre>";
|
||||
echo 'XML Request: ' . htmlspecialchars($this->generate->getLastRequest()) . "\r\n";
|
||||
echo 'Headers Request: ' . htmlspecialchars($this->generate->getLastRequestHeaders()) . "\r\n";
|
||||
echo 'XML Response: ' . htmlspecialchars($this->generate->getLastResponse()) . "\r\n";
|
||||
echo 'Headers Response: ' . htmlspecialchars($this->generate->getLastResponseHeaders()) . "\r\n";
|
||||
echo "</pre>";
|
||||
*/
|
||||
if ($this->generate->getLastResponse(true) instanceof \DOMDocument) {
|
||||
$response = $this->generate->getLastResponse();
|
||||
Tlog::getInstance()->debug("Colissimo shipping label response: " . $response);
|
||||
|
||||
echo $response;
|
||||
|
||||
$domDocument = $this->generate->getLastResponse(true);
|
||||
|
||||
$type = $domDocument->getElementsByTagName('type')->item(0)->nodeValue;
|
||||
|
||||
if ($type !== 'ERROR') {
|
||||
$pdfUrlElement = $domDocument->getElementsByTagName('pdfUrl');
|
||||
$includeElement = $domDocument->getElementsByTagName('Include');
|
||||
|
||||
if ($pdfUrlElement->length > 0) {
|
||||
$urlPdf = $pdfUrlElement->item(0)->nodeValue;
|
||||
|
||||
if (!empty($urlPdf)) {
|
||||
$labelContent = file_get_contents($urlPdf);
|
||||
}
|
||||
} elseif ($includeElement->length > 0) {
|
||||
$href = str_replace('cid:', '', $includeElement->item(0)->attributes['href']->value);
|
||||
|
||||
$rawResponse = $this->generate->getRawResponse();
|
||||
|
||||
preg_match("/.*Content-ID: <$href>(.*)--uuid.*$/s", $rawResponse, $matches);
|
||||
|
||||
if (isset($matches[1])) {
|
||||
$labelContent = trim($matches[1]);
|
||||
}
|
||||
}
|
||||
|
||||
$trackingNumber = $domDocument->getElementsByTagName('parcelNumber')->item(0)->nodeValue;
|
||||
|
||||
// Update tracking number.
|
||||
$order
|
||||
->setDeliveryRef($trackingNumber)
|
||||
->save();
|
||||
|
||||
$message = "L'étiquette a été générée correctement.";
|
||||
} else {
|
||||
$erreur = true;
|
||||
$message = $domDocument->getElementsByTagName('messageContent')->item(0)->nodeValue;
|
||||
}
|
||||
} else {
|
||||
$erreur = true;
|
||||
$message = $this->generate->getLastErrorForMethod('ColissimoPostage\ServiceType\Generate::generateLabel')->getMessage();
|
||||
}
|
||||
|
||||
if (null === $label = ColissimowsLabelQuery::create()->findOneByOrderId($order->getId())) {
|
||||
$label = (new ColissimowsLabel())
|
||||
->setOrderId($order->getId())
|
||||
->setOrderRef($order->getRef())
|
||||
;
|
||||
}
|
||||
|
||||
$label
|
||||
->setError($erreur)
|
||||
->setErrorMessage($message)
|
||||
->setTrackingNumber($trackingNumber)
|
||||
->setLabelData($labelContent)
|
||||
->setLabelType(ColissimoWs::getLabelFileType())
|
||||
->setWeight($totalWeight)
|
||||
->setSigned($signed)
|
||||
;
|
||||
|
||||
$label ->save();
|
||||
|
||||
///** Compatibility with module SoColissimoLabel /!\ Do not use strict comparison */
|
||||
//if (ModuleQuery::create()->findOneByCode('ColissimoLabel')->getActivate() == true)
|
||||
//{
|
||||
// if (null === $labelCompat = ColissimoLabelQuery::create()->findOneByOrderId($order->getId())) {
|
||||
// /** @var $labelCompat */
|
||||
// $labelCompat = (new \ColissimoLabel\Model\ColissimoLabel())
|
||||
// ->setOrderId($order->getId())
|
||||
// ;
|
||||
// }
|
||||
//
|
||||
// $labelCompat
|
||||
// ->setWeight($totalWeight)
|
||||
// ->setSigned($signed)
|
||||
// ->setNumber($trackingNumber)
|
||||
// ;
|
||||
//
|
||||
// $labelCompat->save();
|
||||
//}
|
||||
|
||||
$event->setColissimoWsLabel($label);
|
||||
} else {
|
||||
throw new \InvalidArgumentException("Failed to find order ID " . $event->getOrderId());
|
||||
}
|
||||
}
|
||||
|
||||
protected function formatterTelephone($numero, $codePays)
|
||||
{
|
||||
$phoneUtil = PhoneNumberUtil::getInstance();
|
||||
|
||||
try {
|
||||
$normalizedNumber = $phoneUtil->parse($numero, strtoupper($codePays));
|
||||
|
||||
return $phoneUtil->format($normalizedNumber, \libphonenumber\PhoneNumberFormat::E164);
|
||||
} catch (NumberParseException $e) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
protected function corrigerLocalite($localite)
|
||||
{
|
||||
$localite = strtoupper($localite);
|
||||
|
||||
$localite = str_replace(['SAINTE', 'SAINT', '/'], array('STE', 'ST', ''), $localite);
|
||||
|
||||
return $localite;
|
||||
}
|
||||
|
||||
protected function cleanUpAddresse($str)
|
||||
{
|
||||
return preg_replace("/[^A-Za-z0-9]/", ' ', $this->removeAccents($str));
|
||||
}
|
||||
|
||||
protected function cleanupUserEnteredString($str)
|
||||
{
|
||||
$str = preg_replace("/&#[0-9]+;/", '', $str);
|
||||
$str = preg_replace("/[^A-Za-z0-9]/", ' ', $this->removeAccents($str));
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
protected function removeAccents($str)
|
||||
{
|
||||
return \Transliterator::create('NFD; [:Nonspacing Mark:] Remove; NFC')->transliterate($str);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
/**
|
||||
* Created by Franck Allimant, CQFDev <franck@cqfdev.fr>
|
||||
* Date: 04/09/2019 14:34
|
||||
*/
|
||||
namespace ColissimoWs\EventListeners;
|
||||
|
||||
use ColissimoWs\ColissimoWs;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Action\BaseAction;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Template\ParserInterface;
|
||||
use Thelia\Mailer\MailerFactory;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
|
||||
class ShippingNotificationSender extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
/** @var MailerFactory */
|
||||
protected $mailer;
|
||||
/** @var ParserInterface */
|
||||
protected $parser;
|
||||
|
||||
public function __construct(ParserInterface $parser, MailerFactory $mailer)
|
||||
{
|
||||
$this->parser = $parser;
|
||||
$this->mailer = $mailer;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return [
|
||||
TheliaEvents::ORDER_UPDATE_STATUS => ["sendShippingNotification", 128]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OrderEvent $event
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function sendShippingNotification(OrderEvent $event)
|
||||
{
|
||||
if ($event->getOrder()->isSent()) {
|
||||
$contact_email = ConfigQuery::getStoreEmail();
|
||||
|
||||
if ($contact_email) {
|
||||
$order = $event->getOrder();
|
||||
$customer = $order->getCustomer();
|
||||
|
||||
$this->mailer->sendEmailToCustomer(
|
||||
ColissimoWs::CONFIRMATION_MESSAGE_NAME,
|
||||
$order->getCustomer(),
|
||||
[
|
||||
'order_id' => $order->getId(),
|
||||
'order_ref' => $order->getRef(),
|
||||
'customer_id' => $customer->getId(),
|
||||
'order_date' => $order->getCreatedAt(),
|
||||
'update_date' => $order->getUpdatedAt(),
|
||||
'package' => $order->getDeliveryRef()
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
182
local/modules/ColissimoWs/Form/ConfigurationForm.php
Normal file
182
local/modules/ColissimoWs/Form/ConfigurationForm.php
Normal file
@@ -0,0 +1,182 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
/**
|
||||
* Created by Franck Allimant, CQFDev <franck@cqfdev.fr>
|
||||
* Date: 17/08/2019 12:26
|
||||
*/
|
||||
namespace ColissimoWs\Form;
|
||||
|
||||
use ColissimoWs\ColissimoWs;
|
||||
use SimpleDhl\SimpleDhl;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Thelia\Form\BaseForm;
|
||||
|
||||
class ConfigurationForm extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
ColissimoWs::COLISSIMO_USERNAME,
|
||||
'text',
|
||||
[
|
||||
'constraints' => [
|
||||
new NotBlank(),
|
||||
],
|
||||
'label' => $this->translator->trans('Colissimo username', [], ColissimoWs::DOMAIN_NAME),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans(
|
||||
'Nom d\'utilisateur Colissimo. C\'est l\'identifiants qui vous permet d’accéder à votre espace client à l\'adresse https://www.colissimo.fr/entreprise',
|
||||
[],
|
||||
ColissimoWs::DOMAIN_NAME
|
||||
)
|
||||
]
|
||||
]
|
||||
)
|
||||
->add(
|
||||
ColissimoWs::COLISSIMO_PASSWORD,
|
||||
'text',
|
||||
[
|
||||
'constraints' => [
|
||||
new NotBlank(),
|
||||
],
|
||||
'label' => $this->translator->trans('Colissimo password', [], ColissimoWs::DOMAIN_NAME),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans(
|
||||
'Le mot de passe qui vous permet d’accéder à votre espace client à l\'adresse https://www.colissimo.fr/entreprise',
|
||||
[],
|
||||
ColissimoWs::DOMAIN_NAME
|
||||
)
|
||||
]
|
||||
]
|
||||
)->add(
|
||||
ColissimoWs::AFFRANCHISSEMENT_ENDPOINT_URL,
|
||||
'url',
|
||||
[
|
||||
'constraints' => [
|
||||
new NotBlank(),
|
||||
],
|
||||
'label' => $this->translator->trans('Endpoint du web service d\'affranchissement', [], ColissimoWs::DOMAIN_NAME),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans(
|
||||
'Indiquez le endpoint de base à utiliser, par exemple https://domain.tld/transactionaldata/api/v1',
|
||||
[],
|
||||
ColissimoWs::DOMAIN_NAME
|
||||
)
|
||||
]
|
||||
]
|
||||
)->add(
|
||||
ColissimoWs::FORMAT_ETIQUETTE,
|
||||
'choice',
|
||||
[
|
||||
'constraints' => [
|
||||
new NotBlank(),
|
||||
],
|
||||
'choices' => [
|
||||
'PDF_A4_300dpi' => 'Bureautique PDF, A4, résolution 300dpi',
|
||||
'PDF_10x15_300dpi' => 'Bureautique PDF, 10cm par 15cm, résolution 300dpi',
|
||||
'ZPL_10x15_203dpi' => 'Thermique en ZPL, de dimension 10cm par 15cm, et de résolution 203dpi',
|
||||
'ZPL_10x15_300dpi' => 'Thermique ZPL, 10cm par 15cm, résolution 300dpi',
|
||||
'DPL_10x15_203dpi' => 'Thermique DPL, 10cm par 15cm, résolution 203dpi',
|
||||
'DPL_10x15_300dpi' => 'Thermique DPL, 10cm par 15cm, résolution 300dpi',
|
||||
],
|
||||
'label' => $this->translator->trans('Format des étiquettes', [], ColissimoWs::DOMAIN_NAME),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans(
|
||||
'Indiquez le format des étiquettes à générer, en fonction de l\'imprimante dont vous disposez.',
|
||||
[],
|
||||
ColissimoWs::DOMAIN_NAME
|
||||
)
|
||||
]
|
||||
]
|
||||
)->add(
|
||||
ColissimoWs::ACTIVATE_DETAILED_DEBUG,
|
||||
'checkbox',
|
||||
[
|
||||
'required' => false,
|
||||
'label' => $this->translator->trans('Activer les logs détaillés', [], ColissimoWs::DOMAIN_NAME),
|
||||
'label_attr' => [
|
||||
'help' => $this->translator->trans(
|
||||
'Si cette case est cochée, le texte complet des requêtes et des réponses figurera dans le log Thelia',
|
||||
[],
|
||||
ColissimoWs::DOMAIN_NAME
|
||||
)
|
||||
]
|
||||
]
|
||||
)
|
||||
->add(
|
||||
ColissimoWs::FROM_NAME,
|
||||
'text',
|
||||
[
|
||||
'constraints' => [
|
||||
new NotBlank(),
|
||||
],
|
||||
'label' => $this->translator->trans('Nom de société', [], ColissimoWs::DOMAIN_NAME),
|
||||
]
|
||||
)
|
||||
->add(
|
||||
ColissimoWs::FROM_ADDRESS_1,
|
||||
'text',
|
||||
[
|
||||
'constraints' => [ new NotBlank() ],
|
||||
'label' => $this->translator->trans('Adresse', [], ColissimoWs::DOMAIN_NAME)
|
||||
]
|
||||
)
|
||||
->add(
|
||||
ColissimoWs::FROM_ADDRESS_2,
|
||||
'text',
|
||||
[
|
||||
'constraints' => [ ],
|
||||
'required' => false,
|
||||
'label' => $this->translator->trans('Adresse (suite)', [], ColissimoWs::DOMAIN_NAME)
|
||||
]
|
||||
)
|
||||
->add(
|
||||
ColissimoWs::FROM_CITY,
|
||||
'text',
|
||||
[
|
||||
'constraints' => [ new NotBlank() ],
|
||||
'label' => $this->translator->trans('Ville', [], ColissimoWs::DOMAIN_NAME)
|
||||
]
|
||||
)
|
||||
->add(
|
||||
ColissimoWs::FROM_ZIPCODE,
|
||||
'text',
|
||||
[
|
||||
'constraints' => [ new NotBlank() ],
|
||||
'label' => $this->translator->trans('Code postal', [], ColissimoWs::DOMAIN_NAME)
|
||||
]
|
||||
)
|
||||
->add(
|
||||
ColissimoWs::FROM_COUNTRY,
|
||||
'text',
|
||||
[
|
||||
'constraints' => [ new NotBlank() ],
|
||||
'label' => $this->translator->trans('Pays', [], ColissimoWs::DOMAIN_NAME)
|
||||
]
|
||||
)->add(
|
||||
ColissimoWs::FROM_CONTACT_EMAIL,
|
||||
'email',
|
||||
[
|
||||
'constraints' => [ new NotBlank() ],
|
||||
'label' => $this->translator->trans('Adresse e-mail de contact pour les expéditions', [], ColissimoWs::DOMAIN_NAME)
|
||||
]
|
||||
)->add(
|
||||
ColissimoWs::FROM_PHONE,
|
||||
'text',
|
||||
[
|
||||
'constraints' => [ new NotBlank() ],
|
||||
'label' => $this->translator->trans('Téléphone', [], ColissimoWs::DOMAIN_NAME)
|
||||
]
|
||||
)
|
||||
;
|
||||
}
|
||||
}
|
||||
69
local/modules/ColissimoWs/Form/FreeShippingForm.php
Normal file
69
local/modules/ColissimoWs/Form/FreeShippingForm.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?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 ColissimoWs\Form;
|
||||
|
||||
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("delivery_mode", "integer")
|
||||
->add("freeshipping", "checkbox", array(
|
||||
'label'=>Translator::getInstance()->trans("Activate free shipping: ")
|
||||
))
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the name of you form. This name must be unique
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return "colissimowsfreeshipping";
|
||||
}
|
||||
|
||||
}
|
||||
71
local/modules/ColissimoWs/Form/LabelGenerationForm.php
Normal file
71
local/modules/ColissimoWs/Form/LabelGenerationForm.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
/**
|
||||
* Created by Franck Allimant, CQFDev <franck@cqfdev.fr>
|
||||
* Date: 17/08/2019 12:26
|
||||
*/
|
||||
namespace ColissimoWs\Form;
|
||||
|
||||
use ColissimoWs\ColissimoWs;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Form\BaseForm;
|
||||
|
||||
class LabelGenerationForm extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add(
|
||||
'new_status',
|
||||
'choice', [
|
||||
'label' => Translator::getInstance()->trans('Order status after export'),
|
||||
'choices' => [
|
||||
"nochange" => Translator::getInstance()->trans("Do not change", [], ColissimoWs::DOMAIN_NAME),
|
||||
"processing" => Translator::getInstance()->trans("Set orders status as processing", [], ColissimoWs::DOMAIN_NAME),
|
||||
"sent" => Translator::getInstance()->trans("Set orders status as sent", [], ColissimoWs::DOMAIN_NAME)
|
||||
],
|
||||
'required' => 'true',
|
||||
'expanded' => true,
|
||||
'multiple' => false,
|
||||
'data' => ColissimoWs::getConfigValue("new_status", 'nochange')
|
||||
]
|
||||
)
|
||||
->add(
|
||||
'order_id',
|
||||
'collection',
|
||||
[
|
||||
'type' => 'integer',
|
||||
'allow_add' => true,
|
||||
'allow_delete' => true,
|
||||
]
|
||||
)
|
||||
->add(
|
||||
"weight",
|
||||
'collection',
|
||||
[
|
||||
'type' => 'number',
|
||||
'allow_add' => true,
|
||||
'allow_delete' => true,
|
||||
]
|
||||
)
|
||||
->add(
|
||||
"signed",
|
||||
"collection",
|
||||
[
|
||||
'type' => 'checkbox',
|
||||
'label' => 'Signature',
|
||||
'allow_add' => true,
|
||||
'allow_delete' => true,
|
||||
]);
|
||||
|
||||
;
|
||||
}
|
||||
}
|
||||
65
local/modules/ColissimoWs/Hook/HookManager.php
Normal file
65
local/modules/ColissimoWs/Hook/HookManager.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
/**
|
||||
* Created by Franck Allimant, CQFDev <franck@cqfdev.fr>
|
||||
* Date: 17/08/2019 14:34
|
||||
*/
|
||||
namespace ColissimoWs\Hook;
|
||||
|
||||
use ColissimoWs\ColissimoWs;
|
||||
use ColissimoWs\Model\ColissimowsLabelQuery;
|
||||
use Thelia\Core\Event\Hook\HookRenderBlockEvent;
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
use Thelia\Model\ModuleConfig;
|
||||
use Thelia\Model\ModuleConfigQuery;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
class HookManager extends BaseHook
|
||||
{
|
||||
public function onModuleConfigure(HookRenderEvent $event)
|
||||
{
|
||||
$vars = [ ];
|
||||
|
||||
if (null !== $params = ModuleConfigQuery::create()->findByModuleId(ColissimoWs::getModuleId())) {
|
||||
|
||||
/** @var ModuleConfig $param */
|
||||
foreach ($params as $param) {
|
||||
$vars[ $param->getName() ] = $param->getValue();
|
||||
}
|
||||
}
|
||||
|
||||
$event->add(
|
||||
$this->render(
|
||||
'colissimows/module_configuration.html',
|
||||
$vars
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function onMainTopMenuTools(HookRenderBlockEvent $event)
|
||||
{
|
||||
$event->add(
|
||||
[
|
||||
'id' => 'tools_menu_colissimows',
|
||||
'class' => '',
|
||||
'url' => URL::getInstance()->absoluteUrl('/admin/module/ColissimoWs'),
|
||||
'title' => $this->translator->trans("Colissimo labels (%num)", [ '%num' => ColissimowsLabelQuery::create()->count() ], ColissimoWs::DOMAIN_NAME)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function onModuleConfigJs(HookRenderEvent $event)
|
||||
{
|
||||
$event->add($this->render('colissimows/module-config-js.html'));
|
||||
}
|
||||
|
||||
}
|
||||
52
local/modules/ColissimoWs/I18n/backOffice/default/fr_FR.php
Normal file
52
local/modules/ColissimoWs/I18n/backOffice/default/fr_FR.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Actions' => 'Actions',
|
||||
'Activate total free shipping ' => 'Activer la livraison gratuite totale',
|
||||
'Add this price slice' => 'Ajouter cette tranche de prix',
|
||||
'Area : ' => 'Zone :',
|
||||
'Change to "Processing"' => 'Statut "Traitement"',
|
||||
'Change to "Sent". If you choose this option, the delivery notification email is sent to the customer, and the processed order are removed from this page.' => 'Statut "Envoyé". Si vous choisissez cette option, la notification d\'expédition est envoyée au client, et la commande n\'apparaît plus dans cette page',
|
||||
'Clear label' => 'Supprimer l\'étiquette et le numéro de suivi de cette commande',
|
||||
'Colissimo Web service configuration' => 'Configuration Colissimo Affranchissement',
|
||||
'Configuration' => 'Configuration',
|
||||
'Configuration du service' => 'Configuration du service',
|
||||
'Coordonnées de d\'expéditeur' => 'Coordonnées de d\'expéditeur',
|
||||
'Customs invoice' => 'Facture douanes',
|
||||
'Delete this price slice' => 'Supprimer cette tranche de prix',
|
||||
'Destination' => 'Destination',
|
||||
'Do not change' => 'Inchangé',
|
||||
'Do you want to clear label and tracking number for this order ?' => 'Voulez-vous supprimer l\'étiquette et le numéro de suivi de cette commande ?',
|
||||
'Download and print Colissimo labels for not sent orders' => 'Télécharger et imprimer les étiquettes d\'affranchissement pour les commandes qui n\'ont pas encore été envoyées',
|
||||
'Download customs invoice (PDF)' => 'Télécharger la facture de douanes (PDF)',
|
||||
'Download label (%fmt)' => 'Télécharger l\'étiquette (%fmt)',
|
||||
'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.',
|
||||
'Label' => 'Etiquette',
|
||||
'Label cannot be created. Error is: ' => 'La création de l\'étiquette a échoué. L\'erreur est:',
|
||||
'Message' => 'Message',
|
||||
'Non disponible' => 'Non disponible',
|
||||
'Order date' => 'Date de commande',
|
||||
'Order status change after processing' => 'Statut des commandes après traitement',
|
||||
'Price slices (Dom)' => 'Tranches de prix (Domicile)',
|
||||
'Price slices for domicile delivery' => 'Tranches de prix pour la livraison à domicile',
|
||||
'Process selected orders' => 'Traiter les commandes sélectionnées',
|
||||
'REF' => 'Ref.',
|
||||
'Save this price slice' => 'Sauvegarder cette tranche de prix',
|
||||
'Sel.' => 'Sel.',
|
||||
'Shipping Price ($)' => 'Frais de livraison',
|
||||
'Shipping labels' => 'Étiquettes d\'affranchissement',
|
||||
'Signature' => 'Signature',
|
||||
'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.',
|
||||
'There are currently no orders to ship with Colissimo' => 'Il n\'y a aucune commande à livrer avec Colissimo pour le moment.',
|
||||
'Tracking' => 'No. de suivi',
|
||||
'Untaxed Price up to ... ($)' => 'Prix (HT) jusqu\'à :',
|
||||
'Weight' => 'Poids (kg)',
|
||||
'Weight up to ... kg' => 'Poids (kg) jusqu\'à :',
|
||||
'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 tout d\'abord ajouter des zones de livraisons au module',
|
||||
'kg' => 'kg',
|
||||
'manage shipping zones' => 'Gérer les zones de livraison',
|
||||
);
|
||||
15
local/modules/ColissimoWs/I18n/email/default/fr_FR.php
Normal file
15
local/modules/ColissimoWs/I18n/email/default/fr_FR.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'<a href="https://www.colissimo.fr/portail_colissimo/suivreResultat.do?parcelnumber=%package">Click here</a> to track your shipment. You can also enter the tracking number on <a href="https://www.laposte.fr/outils/suivre-vos-envois">https://www.laposte.fr/outils/suivre-vos-envois</a>' => '<a href="https://www.colissimo.fr/portail_colissimo/suivreResultat.do?parcelnumber=%package">Cliquez ici</a> pour suivre l\'acheminement. Vous pouvez aussi entrer le numéro de suivi sur <a href="https://www.laposte.fr/outils/suivre-vos-envois">https://www.laposte.fr/outils/suivre-vos-envois</a>',
|
||||
'Dear Mr. ' => 'Cher Mr',
|
||||
'Dear Ms. ' => 'Cher Mme',
|
||||
'Please display this message in HTML' => 'Afficher ce message en HTML',
|
||||
'Thank you for your shopping with us and hope to see you soon on <a href="#">www.yourshop.com</a>' => 'Nous vous remercions pour votre achat et espérons vous revoir très vite sur <a href="#">www.votreboutique.com</a>',
|
||||
'We are pleased to inform you that your order number' => 'Nous sommes heureux de vous informer que votre commande N°',
|
||||
'Your on-line store Manager' => 'Nom de personne chargé de la communication',
|
||||
'Your order confirmation Nº %ref' => 'Votre commande N° %ref',
|
||||
'Your shop' => 'Votre boutique',
|
||||
'has been shipped on' => 'a été envoyé le',
|
||||
'with the tracking number' => 'avec le numéro de suivi',
|
||||
);
|
||||
4
local/modules/ColissimoWs/I18n/en_US.php
Normal file
4
local/modules/ColissimoWs/I18n/en_US.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
return array(
|
||||
// 'an english string' => 'The displayed english string',
|
||||
);
|
||||
37
local/modules/ColissimoWs/I18n/fr_FR.php
Normal file
37
local/modules/ColissimoWs/I18n/fr_FR.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Activate free shipping: ' => 'Activer les frais de ports gratuits',
|
||||
'Activer les logs détaillés' => 'Activer les logs détaillés',
|
||||
'Adresse' => 'Adresse',
|
||||
'Adresse (suite)' => 'Adresse (suite)',
|
||||
'Adresse e-mail de contact pour les expéditions' => 'Adresse e-mail de contact pour les expéditions',
|
||||
'Code postal' => 'Code postal',
|
||||
'Colissimo labels (%num)' => 'Etiquettes colissimo (%num)',
|
||||
'Colissimo password' => 'Mot de passe Colissimo',
|
||||
'Colissimo username' => 'Nom d\'utilisateur Colissimo',
|
||||
'ColissimoWs configuration' => 'Configuration Colissimo Affranchissement',
|
||||
'Do not change' => 'Inchangé',
|
||||
'Endpoint du web service d\'affranchissement' => 'Endpoint du web service d\'affranchissement',
|
||||
'Format des étiquettes' => 'Format des étiquettes',
|
||||
'Indiquez le endpoint de base à utiliser, par exemple https://domain.tld/transactionaldata/api/v1' => 'Indiquez le endpoint de base à utiliser, par exemple https://domain.tld/transactionaldata/api/v1',
|
||||
'Indiquez le format des étiquettes à générer, en fonction de l\'imprimante dont vous disposez.' => 'Indiquez le format des étiquettes à générer, en fonction de l\'imprimante dont vous disposez.',
|
||||
'Le mot de passe qui vous permet d’accéder à votre espace client à l\'adresse https://www.colissimo.fr/entreprise' => 'Le mot de passe qui vous permet d’accéder à votre espace client à l\'adresse https://www.colissimo.fr/entreprise',
|
||||
'Nom d\'utilisateur Colissimo. C\'est l\'identifiants qui vous permet d’accéder à votre espace client à l\'adresse https://www.colissimo.fr/entreprise' => 'Nom d\'utilisateur Colissimo. C\'est l\'identifiants qui vous permet d’accéder à votre espace client à l\'adresse https://www.colissimo.fr/entreprise',
|
||||
'Nom de société' => 'Nom de société',
|
||||
'Order status after export' => 'Statut de commande après le traitement',
|
||||
'Pays' => 'Pays',
|
||||
'Please enter a weight for every selected order' => 'Merci d\'indiquer un poids pour chacune des commandes sélectionnées',
|
||||
'Set orders status as processing' => 'Placer la commande en "Traitement"',
|
||||
'Set orders status as sent' => 'Placer la commande "Envoyée"',
|
||||
'Si cette case est cochée, le texte complet des requêtes et des réponses figurera dans le log Thelia' => 'Si cette case est cochée, le texte complet des requêtes et des réponses figurera dans le log Thelia',
|
||||
'The area is not valid' => 'La zone n\'est pas valide',
|
||||
'The price max value is not valid' => 'La valeur du prix max. n\'est pas valide',
|
||||
'The price value is not valid' => 'La valeur du prix n\'est pas valide',
|
||||
'The slice has not been deleted' => 'La tranche de prix n\'a pas été supprimée',
|
||||
'The weight max value is not valid' => 'La valeur du poids max. n\'est pas valide',
|
||||
'Téléphone' => 'Téléphone',
|
||||
'Ville' => 'Ville',
|
||||
'You must specify at least a price max or a weight max value.' => 'Vous devez spécifier au moins un prix max. ou un poids max.',
|
||||
'Your slice has been saved' => 'La tranche de prix a été sauvegardée',
|
||||
);
|
||||
17
local/modules/ColissimoWs/I18n/pdf/default/fr_FR.php
Normal file
17
local/modules/ColissimoWs/I18n/pdf/default/fr_FR.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Country' => 'Pays',
|
||||
'Engraving ' => 'Gravure',
|
||||
'Font ' => 'Police de caractère',
|
||||
'Free samples ' => 'Échantillons gratuits ',
|
||||
'Full Description of Goods' => 'Description complète des biens',
|
||||
'Position ' => 'Position',
|
||||
'Quantity' => 'Quantité',
|
||||
'Style ' => 'Style',
|
||||
'Subtotal value' => 'Sous-total',
|
||||
'Unit net weight' => 'Poids net unitaire',
|
||||
'Unit value' => 'Valeur unitaire',
|
||||
'Your gift ' => 'Votre cadeau',
|
||||
'Your text ' => 'Votre texte',
|
||||
);
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoWs\Loop;
|
||||
|
||||
use ColissimoWs\Model\ColissimowsFreeshipping;
|
||||
use ColissimoWs\Model\ColissimowsFreeshippingQuery;
|
||||
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 ColissimoWsFreeShippingLoop extends BaseLoop implements PropelSearchLoopInterface
|
||||
{
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntTypeArgument('id')
|
||||
);
|
||||
}
|
||||
|
||||
public function buildModelCriteria()
|
||||
{
|
||||
if (null === $isFreeShippingActive = ColissimowsFreeshippingQuery::create()->findOneById(1)){
|
||||
$isFreeShippingActive = new ColissimowsFreeshipping();
|
||||
$isFreeShippingActive->setId(1);
|
||||
$isFreeShippingActive->setActive(0);
|
||||
$isFreeShippingActive->save();
|
||||
}
|
||||
|
||||
return ColissimowsFreeshippingQuery::create()->filterById(1);
|
||||
}
|
||||
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
/** @var \ColissimoWs\Model\ColissimowsFreeshipping $freeshipping */
|
||||
foreach ($loopResult->getResultDataCollection() as $freeshipping) {
|
||||
$loopResultRow = new LoopResultRow($freeshipping);
|
||||
$loopResultRow->set("FREESHIPPING_ACTIVE", $freeshipping->getActive());
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
return $loopResult;
|
||||
}
|
||||
|
||||
}
|
||||
102
local/modules/ColissimoWs/Loop/ColissimoWsLabelInfo.php
Normal file
102
local/modules/ColissimoWs/Loop/ColissimoWsLabelInfo.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
/**
|
||||
* Created by Franck Allimant, CQFDev <franck@cqfdev.fr>
|
||||
* Date: 04/09/2019 17:56
|
||||
*/
|
||||
namespace ColissimoWs\Loop;
|
||||
|
||||
use ColissimoWs\ColissimoWs;
|
||||
use ColissimoWs\Model\ColissimowsLabel;
|
||||
use ColissimoWs\Model\ColissimowsLabelQuery;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Model\OrderQuery;
|
||||
use Thelia\Tools\URL;
|
||||
|
||||
/**
|
||||
* @package SimpleDhl\Loop
|
||||
* @method int getOrderId()
|
||||
*/
|
||||
class ColissimoWsLabelInfo extends BaseLoop implements PropelSearchLoopInterface
|
||||
{
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntTypeArgument('order_id', null, true)
|
||||
);
|
||||
}
|
||||
|
||||
public function buildModelCriteria()
|
||||
{
|
||||
return ColissimowsLabelQuery::create()
|
||||
->filterByOrderId($this->getOrderId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param LoopResult $loopResult
|
||||
* @return LoopResult
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
if ($loopResult->getResultDataCollectionCount() === 0) {
|
||||
if (null !== $order = OrderQuery::create()->findPk($this->getOrderId())) {
|
||||
$loopResultRow = new LoopResultRow();
|
||||
|
||||
$loopResultRow
|
||||
->set("ORDER_ID", $this->getOrderId())
|
||||
->set("HAS_ERROR", false)
|
||||
->set("ERROR_MESSAGE", null)
|
||||
->set("WEIGHT", $order->getWeight())
|
||||
->set("SIGNED", true)
|
||||
->set("TRACKING_NUMBER", null)
|
||||
->set("HAS_LABEL", false)
|
||||
->set("LABEL_URL", URL::getInstance()->absoluteUrl("/admin/module/colissimows/label/" . $this->getOrderId()))
|
||||
->set("CLEAR_LABEL_URL", URL::getInstance()->absoluteUrl("/admin/module/colissimows/label/clear/" . $this->getOrderId()))
|
||||
->set("CAN_BE_NOT_SIGNED", ColissimoWs::canOrderBeNotSigned($order));
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
} else {
|
||||
/** @var ColissimowsLabel $result */
|
||||
foreach ($loopResult->getResultDataCollection() as $result) {
|
||||
$loopResultRow = new LoopResultRow();
|
||||
|
||||
$loopResultRow
|
||||
->set("ORDER_ID", $result->getOrderId())
|
||||
->set("HAS_ERROR", $result->getError())
|
||||
->set("ERROR_MESSAGE", $result->getErrorMessage())
|
||||
->set("WEIGHT", empty($result->getWeight()) ? $result->getOrder()->getWeight() : $result->getWeight())
|
||||
->set("SIGNED", $result->getSigned())
|
||||
->set("TRACKING_NUMBER", $result->getTrackingNumber())
|
||||
->set("HAS_LABEL", ! empty($result->getLabelData()))
|
||||
->set("LABEL_TYPE", $result->getLabelType())
|
||||
->set("HAS_CUSTOMS_INVOICE", $result->getWithCustomsInvoice())
|
||||
->set("LABEL_URL", URL::getInstance()->absoluteUrl("/admin/module/colissimows/label/" . $result->getOrderId()))
|
||||
->set("CUSTOMS_INVOICE_URL", URL::getInstance()->absoluteUrl("/admin/module/colissimows/customs-invoice/" . $result->getOrderId()))
|
||||
->set("CLEAR_LABEL_URL", URL::getInstance()->absoluteUrl("/admin/module/colissimows/label/clear/" . $result->getOrderId()))
|
||||
->set("CAN_BE_NOT_SIGNED", ColissimoWs::canOrderBeNotSigned($result->getOrder()));
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
61
local/modules/ColissimoWs/Loop/OrdersNotYetSentLoop.php
Normal file
61
local/modules/ColissimoWs/Loop/OrdersNotYetSentLoop.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
/**
|
||||
* Created by Franck Allimant, CQFDev <franck@cqfdev.fr>
|
||||
* Date: 04/09/2019 17:53
|
||||
*/
|
||||
namespace ColissimoWs\Loop;
|
||||
|
||||
use ColissimoWs\ColissimoWs;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Order;
|
||||
use Thelia\Model\OrderQuery;
|
||||
use Thelia\Model\OrderStatus;
|
||||
use Thelia\Model\OrderStatusQuery;
|
||||
|
||||
class OrdersNotYetSentLoop 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(ColissimoWs::getModCode())
|
||||
->filterByStatusId(
|
||||
array(
|
||||
$status[OrderStatus::CODE_PAID]['Id'],
|
||||
$status[OrderStatus::CODE_PROCESSING]['Id']),
|
||||
Criteria::IN
|
||||
);
|
||||
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
57
local/modules/ColissimoWs/Loop/PriceSlicesLoop.php
Normal file
57
local/modules/ColissimoWs/Loop/PriceSlicesLoop.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace ColissimoWs\Loop;
|
||||
|
||||
|
||||
use ColissimoWs\Model\ColissimowsPriceSlicesQuery;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use function mysql_xdevapi\getSession;
|
||||
|
||||
class PriceSlicesLoop 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 = ColissimowsPriceSlicesQuery::create()
|
||||
->filterByAreaId($areaId)
|
||||
->orderByMaxWeight()
|
||||
->orderByMaxPrice()
|
||||
;
|
||||
|
||||
return $areaPrices;
|
||||
}
|
||||
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
/** @var \ColissimoWs\Model\ColissimoWsPriceSlices $priceSlice */
|
||||
foreach ($loopResult->getResultDataCollection() as $priceSlice) {
|
||||
$loopResultRow = new LoopResultRow($priceSlice);
|
||||
$loopResultRow
|
||||
->set("SLICE_ID", $priceSlice->getId())
|
||||
->set("MAX_WEIGHT", $priceSlice->getMaxWeight())
|
||||
->set("MAX_PRICE", $priceSlice->getMaxPrice())
|
||||
->set("SHIPPING", $priceSlice->getShipping())
|
||||
->set("FRANCO", $priceSlice->getFrancoMinPrice())
|
||||
;
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
1126
local/modules/ColissimoWs/Model/Base/ColissimowsFreeshipping.php
Normal file
1126
local/modules/ColissimoWs/Model/Base/ColissimowsFreeshipping.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,375 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoWs\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use ColissimoWs\Model\ColissimowsFreeshipping as ChildColissimowsFreeshipping;
|
||||
use ColissimoWs\Model\ColissimowsFreeshippingQuery as ChildColissimowsFreeshippingQuery;
|
||||
use ColissimoWs\Model\Map\ColissimowsFreeshippingTableMap;
|
||||
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 'colissimows_freeshipping' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildColissimowsFreeshippingQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildColissimowsFreeshippingQuery orderByActive($order = Criteria::ASC) Order by the active column
|
||||
*
|
||||
* @method ChildColissimowsFreeshippingQuery groupById() Group by the id column
|
||||
* @method ChildColissimowsFreeshippingQuery groupByActive() Group by the active column
|
||||
*
|
||||
* @method ChildColissimowsFreeshippingQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildColissimowsFreeshippingQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildColissimowsFreeshippingQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildColissimowsFreeshipping findOne(ConnectionInterface $con = null) Return the first ChildColissimowsFreeshipping matching the query
|
||||
* @method ChildColissimowsFreeshipping findOneOrCreate(ConnectionInterface $con = null) Return the first ChildColissimowsFreeshipping matching the query, or a new ChildColissimowsFreeshipping object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildColissimowsFreeshipping findOneById(int $id) Return the first ChildColissimowsFreeshipping filtered by the id column
|
||||
* @method ChildColissimowsFreeshipping findOneByActive(boolean $active) Return the first ChildColissimowsFreeshipping filtered by the active column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildColissimowsFreeshipping objects filtered by the id column
|
||||
* @method array findByActive(boolean $active) Return ChildColissimowsFreeshipping objects filtered by the active column
|
||||
*
|
||||
*/
|
||||
abstract class ColissimowsFreeshippingQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \ColissimoWs\Model\Base\ColissimowsFreeshippingQuery 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 = '\\ColissimoWs\\Model\\ColissimowsFreeshipping', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildColissimowsFreeshippingQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildColissimowsFreeshippingQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \ColissimoWs\Model\ColissimowsFreeshippingQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \ColissimoWs\Model\ColissimowsFreeshippingQuery();
|
||||
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 ChildColissimowsFreeshipping|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = ColissimowsFreeshippingTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(ColissimowsFreeshippingTableMap::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 ChildColissimowsFreeshipping A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, ACTIVE FROM colissimows_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 ChildColissimowsFreeshipping();
|
||||
$obj->hydrate($row);
|
||||
ColissimowsFreeshippingTableMap::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 ChildColissimowsFreeshipping|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 ChildColissimowsFreeshippingQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(ColissimowsFreeshippingTableMap::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 ChildColissimowsFreeshippingQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(ColissimowsFreeshippingTableMap::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 ChildColissimowsFreeshippingQuery 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(ColissimowsFreeshippingTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(ColissimowsFreeshippingTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimowsFreeshippingTableMap::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 ChildColissimowsFreeshippingQuery 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(ColissimowsFreeshippingTableMap::ACTIVE, $active, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildColissimowsFreeshipping $colissimowsFreeshipping Object to remove from the list of results
|
||||
*
|
||||
* @return ChildColissimowsFreeshippingQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($colissimowsFreeshipping = null)
|
||||
{
|
||||
if ($colissimowsFreeshipping) {
|
||||
$this->addUsingAlias(ColissimowsFreeshippingTableMap::ID, $colissimowsFreeshipping->getId(), Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the colissimows_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(ColissimowsFreeshippingTableMap::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).
|
||||
ColissimowsFreeshippingTableMap::clearInstancePool();
|
||||
ColissimowsFreeshippingTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildColissimowsFreeshipping or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildColissimowsFreeshipping 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(ColissimowsFreeshippingTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(ColissimowsFreeshippingTableMap::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();
|
||||
|
||||
|
||||
ColissimowsFreeshippingTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
ColissimowsFreeshippingTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
} // ColissimowsFreeshippingQuery
|
||||
1952
local/modules/ColissimoWs/Model/Base/ColissimowsLabel.php
Normal file
1952
local/modules/ColissimoWs/Model/Base/ColissimowsLabel.php
Normal file
File diff suppressed because it is too large
Load Diff
937
local/modules/ColissimoWs/Model/Base/ColissimowsLabelQuery.php
Normal file
937
local/modules/ColissimoWs/Model/Base/ColissimowsLabelQuery.php
Normal file
@@ -0,0 +1,937 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoWs\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use ColissimoWs\Model\ColissimowsLabel as ChildColissimowsLabel;
|
||||
use ColissimoWs\Model\ColissimowsLabelQuery as ChildColissimowsLabelQuery;
|
||||
use ColissimoWs\Model\Map\ColissimowsLabelTableMap;
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelJoin;
|
||||
use Propel\Runtime\Collection\Collection;
|
||||
use Propel\Runtime\Collection\ObjectCollection;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Thelia\Model\Order;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'colissimows_label' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildColissimowsLabelQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildColissimowsLabelQuery orderByOrderId($order = Criteria::ASC) Order by the order_id column
|
||||
* @method ChildColissimowsLabelQuery orderByOrderRef($order = Criteria::ASC) Order by the order_ref column
|
||||
* @method ChildColissimowsLabelQuery orderByError($order = Criteria::ASC) Order by the error column
|
||||
* @method ChildColissimowsLabelQuery orderByErrorMessage($order = Criteria::ASC) Order by the error_message column
|
||||
* @method ChildColissimowsLabelQuery orderByTrackingNumber($order = Criteria::ASC) Order by the tracking_number column
|
||||
* @method ChildColissimowsLabelQuery orderByLabelData($order = Criteria::ASC) Order by the label_data column
|
||||
* @method ChildColissimowsLabelQuery orderByLabelType($order = Criteria::ASC) Order by the label_type column
|
||||
* @method ChildColissimowsLabelQuery orderByWeight($order = Criteria::ASC) Order by the weight column
|
||||
* @method ChildColissimowsLabelQuery orderBySigned($order = Criteria::ASC) Order by the signed column
|
||||
* @method ChildColissimowsLabelQuery orderByWithCustomsInvoice($order = Criteria::ASC) Order by the with_customs_invoice column
|
||||
* @method ChildColissimowsLabelQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildColissimowsLabelQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
* @method ChildColissimowsLabelQuery groupById() Group by the id column
|
||||
* @method ChildColissimowsLabelQuery groupByOrderId() Group by the order_id column
|
||||
* @method ChildColissimowsLabelQuery groupByOrderRef() Group by the order_ref column
|
||||
* @method ChildColissimowsLabelQuery groupByError() Group by the error column
|
||||
* @method ChildColissimowsLabelQuery groupByErrorMessage() Group by the error_message column
|
||||
* @method ChildColissimowsLabelQuery groupByTrackingNumber() Group by the tracking_number column
|
||||
* @method ChildColissimowsLabelQuery groupByLabelData() Group by the label_data column
|
||||
* @method ChildColissimowsLabelQuery groupByLabelType() Group by the label_type column
|
||||
* @method ChildColissimowsLabelQuery groupByWeight() Group by the weight column
|
||||
* @method ChildColissimowsLabelQuery groupBySigned() Group by the signed column
|
||||
* @method ChildColissimowsLabelQuery groupByWithCustomsInvoice() Group by the with_customs_invoice column
|
||||
* @method ChildColissimowsLabelQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildColissimowsLabelQuery groupByUpdatedAt() Group by the updated_at column
|
||||
*
|
||||
* @method ChildColissimowsLabelQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildColissimowsLabelQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildColissimowsLabelQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildColissimowsLabelQuery leftJoinOrder($relationAlias = null) Adds a LEFT JOIN clause to the query using the Order relation
|
||||
* @method ChildColissimowsLabelQuery rightJoinOrder($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Order relation
|
||||
* @method ChildColissimowsLabelQuery innerJoinOrder($relationAlias = null) Adds a INNER JOIN clause to the query using the Order relation
|
||||
*
|
||||
* @method ChildColissimowsLabel findOne(ConnectionInterface $con = null) Return the first ChildColissimowsLabel matching the query
|
||||
* @method ChildColissimowsLabel findOneOrCreate(ConnectionInterface $con = null) Return the first ChildColissimowsLabel matching the query, or a new ChildColissimowsLabel object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildColissimowsLabel findOneById(int $id) Return the first ChildColissimowsLabel filtered by the id column
|
||||
* @method ChildColissimowsLabel findOneByOrderId(int $order_id) Return the first ChildColissimowsLabel filtered by the order_id column
|
||||
* @method ChildColissimowsLabel findOneByOrderRef(string $order_ref) Return the first ChildColissimowsLabel filtered by the order_ref column
|
||||
* @method ChildColissimowsLabel findOneByError(boolean $error) Return the first ChildColissimowsLabel filtered by the error column
|
||||
* @method ChildColissimowsLabel findOneByErrorMessage(string $error_message) Return the first ChildColissimowsLabel filtered by the error_message column
|
||||
* @method ChildColissimowsLabel findOneByTrackingNumber(string $tracking_number) Return the first ChildColissimowsLabel filtered by the tracking_number column
|
||||
* @method ChildColissimowsLabel findOneByLabelData(string $label_data) Return the first ChildColissimowsLabel filtered by the label_data column
|
||||
* @method ChildColissimowsLabel findOneByLabelType(string $label_type) Return the first ChildColissimowsLabel filtered by the label_type column
|
||||
* @method ChildColissimowsLabel findOneByWeight(double $weight) Return the first ChildColissimowsLabel filtered by the weight column
|
||||
* @method ChildColissimowsLabel findOneBySigned(boolean $signed) Return the first ChildColissimowsLabel filtered by the signed column
|
||||
* @method ChildColissimowsLabel findOneByWithCustomsInvoice(boolean $with_customs_invoice) Return the first ChildColissimowsLabel filtered by the with_customs_invoice column
|
||||
* @method ChildColissimowsLabel findOneByCreatedAt(string $created_at) Return the first ChildColissimowsLabel filtered by the created_at column
|
||||
* @method ChildColissimowsLabel findOneByUpdatedAt(string $updated_at) Return the first ChildColissimowsLabel filtered by the updated_at column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildColissimowsLabel objects filtered by the id column
|
||||
* @method array findByOrderId(int $order_id) Return ChildColissimowsLabel objects filtered by the order_id column
|
||||
* @method array findByOrderRef(string $order_ref) Return ChildColissimowsLabel objects filtered by the order_ref column
|
||||
* @method array findByError(boolean $error) Return ChildColissimowsLabel objects filtered by the error column
|
||||
* @method array findByErrorMessage(string $error_message) Return ChildColissimowsLabel objects filtered by the error_message column
|
||||
* @method array findByTrackingNumber(string $tracking_number) Return ChildColissimowsLabel objects filtered by the tracking_number column
|
||||
* @method array findByLabelData(string $label_data) Return ChildColissimowsLabel objects filtered by the label_data column
|
||||
* @method array findByLabelType(string $label_type) Return ChildColissimowsLabel objects filtered by the label_type column
|
||||
* @method array findByWeight(double $weight) Return ChildColissimowsLabel objects filtered by the weight column
|
||||
* @method array findBySigned(boolean $signed) Return ChildColissimowsLabel objects filtered by the signed column
|
||||
* @method array findByWithCustomsInvoice(boolean $with_customs_invoice) Return ChildColissimowsLabel objects filtered by the with_customs_invoice column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildColissimowsLabel objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildColissimowsLabel objects filtered by the updated_at column
|
||||
*
|
||||
*/
|
||||
abstract class ColissimowsLabelQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \ColissimoWs\Model\Base\ColissimowsLabelQuery 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 = '\\ColissimoWs\\Model\\ColissimowsLabel', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildColissimowsLabelQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildColissimowsLabelQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \ColissimoWs\Model\ColissimowsLabelQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \ColissimoWs\Model\ColissimowsLabelQuery();
|
||||
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 ChildColissimowsLabel|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = ColissimowsLabelTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(ColissimowsLabelTableMap::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 ChildColissimowsLabel A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, ORDER_ID, ORDER_REF, ERROR, ERROR_MESSAGE, TRACKING_NUMBER, LABEL_DATA, LABEL_TYPE, WEIGHT, SIGNED, WITH_CUSTOMS_INVOICE, CREATED_AT, UPDATED_AT FROM colissimows_label 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 ChildColissimowsLabel();
|
||||
$obj->hydrate($row);
|
||||
ColissimowsLabelTableMap::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 ChildColissimowsLabel|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 ChildColissimowsLabelQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(ColissimowsLabelTableMap::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 ChildColissimowsLabelQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(ColissimowsLabelTableMap::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 ChildColissimowsLabelQuery 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(ColissimowsLabelTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(ColissimowsLabelTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimowsLabelTableMap::ID, $id, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the order_id column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByOrderId(1234); // WHERE order_id = 1234
|
||||
* $query->filterByOrderId(array(12, 34)); // WHERE order_id IN (12, 34)
|
||||
* $query->filterByOrderId(array('min' => 12)); // WHERE order_id > 12
|
||||
* </code>
|
||||
*
|
||||
* @see filterByOrder()
|
||||
*
|
||||
* @param mixed $orderId 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 ChildColissimowsLabelQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByOrderId($orderId = null, $comparison = null)
|
||||
{
|
||||
if (is_array($orderId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($orderId['min'])) {
|
||||
$this->addUsingAlias(ColissimowsLabelTableMap::ORDER_ID, $orderId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($orderId['max'])) {
|
||||
$this->addUsingAlias(ColissimowsLabelTableMap::ORDER_ID, $orderId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimowsLabelTableMap::ORDER_ID, $orderId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the order_ref column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByOrderRef('fooValue'); // WHERE order_ref = 'fooValue'
|
||||
* $query->filterByOrderRef('%fooValue%'); // WHERE order_ref LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $orderRef 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 ChildColissimowsLabelQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByOrderRef($orderRef = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($orderRef)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $orderRef)) {
|
||||
$orderRef = str_replace('*', '%', $orderRef);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimowsLabelTableMap::ORDER_REF, $orderRef, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the error column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByError(true); // WHERE error = true
|
||||
* $query->filterByError('yes'); // WHERE error = true
|
||||
* </code>
|
||||
*
|
||||
* @param boolean|string $error 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 ChildColissimowsLabelQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByError($error = null, $comparison = null)
|
||||
{
|
||||
if (is_string($error)) {
|
||||
$error = in_array(strtolower($error), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimowsLabelTableMap::ERROR, $error, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the error_message column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByErrorMessage('fooValue'); // WHERE error_message = 'fooValue'
|
||||
* $query->filterByErrorMessage('%fooValue%'); // WHERE error_message LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $errorMessage 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 ChildColissimowsLabelQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByErrorMessage($errorMessage = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($errorMessage)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $errorMessage)) {
|
||||
$errorMessage = str_replace('*', '%', $errorMessage);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimowsLabelTableMap::ERROR_MESSAGE, $errorMessage, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the tracking_number column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByTrackingNumber('fooValue'); // WHERE tracking_number = 'fooValue'
|
||||
* $query->filterByTrackingNumber('%fooValue%'); // WHERE tracking_number LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $trackingNumber 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 ChildColissimowsLabelQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByTrackingNumber($trackingNumber = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($trackingNumber)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $trackingNumber)) {
|
||||
$trackingNumber = str_replace('*', '%', $trackingNumber);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimowsLabelTableMap::TRACKING_NUMBER, $trackingNumber, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the label_data column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByLabelData('fooValue'); // WHERE label_data = 'fooValue'
|
||||
* $query->filterByLabelData('%fooValue%'); // WHERE label_data LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $labelData 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 ChildColissimowsLabelQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByLabelData($labelData = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($labelData)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $labelData)) {
|
||||
$labelData = str_replace('*', '%', $labelData);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimowsLabelTableMap::LABEL_DATA, $labelData, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the label_type column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByLabelType('fooValue'); // WHERE label_type = 'fooValue'
|
||||
* $query->filterByLabelType('%fooValue%'); // WHERE label_type LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $labelType 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 ChildColissimowsLabelQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByLabelType($labelType = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($labelType)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $labelType)) {
|
||||
$labelType = str_replace('*', '%', $labelType);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimowsLabelTableMap::LABEL_TYPE, $labelType, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the weight column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByWeight(1234); // WHERE weight = 1234
|
||||
* $query->filterByWeight(array(12, 34)); // WHERE weight IN (12, 34)
|
||||
* $query->filterByWeight(array('min' => 12)); // WHERE weight > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $weight 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 ChildColissimowsLabelQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByWeight($weight = null, $comparison = null)
|
||||
{
|
||||
if (is_array($weight)) {
|
||||
$useMinMax = false;
|
||||
if (isset($weight['min'])) {
|
||||
$this->addUsingAlias(ColissimowsLabelTableMap::WEIGHT, $weight['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($weight['max'])) {
|
||||
$this->addUsingAlias(ColissimowsLabelTableMap::WEIGHT, $weight['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimowsLabelTableMap::WEIGHT, $weight, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the signed column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterBySigned(true); // WHERE signed = true
|
||||
* $query->filterBySigned('yes'); // WHERE signed = true
|
||||
* </code>
|
||||
*
|
||||
* @param boolean|string $signed 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 ChildColissimowsLabelQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterBySigned($signed = null, $comparison = null)
|
||||
{
|
||||
if (is_string($signed)) {
|
||||
$signed = in_array(strtolower($signed), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimowsLabelTableMap::SIGNED, $signed, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the with_customs_invoice column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByWithCustomsInvoice(true); // WHERE with_customs_invoice = true
|
||||
* $query->filterByWithCustomsInvoice('yes'); // WHERE with_customs_invoice = true
|
||||
* </code>
|
||||
*
|
||||
* @param boolean|string $withCustomsInvoice 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 ChildColissimowsLabelQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByWithCustomsInvoice($withCustomsInvoice = null, $comparison = null)
|
||||
{
|
||||
if (is_string($withCustomsInvoice)) {
|
||||
$with_customs_invoice = in_array(strtolower($withCustomsInvoice), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimowsLabelTableMap::WITH_CUSTOMS_INVOICE, $withCustomsInvoice, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
|
||||
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
|
||||
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $createdAt The value to use as filter.
|
||||
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||
* Empty strings are treated as NULL.
|
||||
* 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 ChildColissimowsLabelQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCreatedAt($createdAt = null, $comparison = null)
|
||||
{
|
||||
if (is_array($createdAt)) {
|
||||
$useMinMax = false;
|
||||
if (isset($createdAt['min'])) {
|
||||
$this->addUsingAlias(ColissimowsLabelTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($createdAt['max'])) {
|
||||
$this->addUsingAlias(ColissimowsLabelTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimowsLabelTableMap::CREATED_AT, $createdAt, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the updated_at column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
|
||||
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
|
||||
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $updatedAt The value to use as filter.
|
||||
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||
* Empty strings are treated as NULL.
|
||||
* 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 ChildColissimowsLabelQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
|
||||
{
|
||||
if (is_array($updatedAt)) {
|
||||
$useMinMax = false;
|
||||
if (isset($updatedAt['min'])) {
|
||||
$this->addUsingAlias(ColissimowsLabelTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($updatedAt['max'])) {
|
||||
$this->addUsingAlias(ColissimowsLabelTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimowsLabelTableMap::UPDATED_AT, $updatedAt, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Order object
|
||||
*
|
||||
* @param \Thelia\Model\Order|ObjectCollection $order The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildColissimowsLabelQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByOrder($order, $comparison = null)
|
||||
{
|
||||
if ($order instanceof \Thelia\Model\Order) {
|
||||
return $this
|
||||
->addUsingAlias(ColissimowsLabelTableMap::ORDER_ID, $order->getId(), $comparison);
|
||||
} elseif ($order instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(ColissimowsLabelTableMap::ORDER_ID, $order->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByOrder() only accepts arguments of type \Thelia\Model\Order or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Order relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildColissimowsLabelQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinOrder($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Order');
|
||||
|
||||
// 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, 'Order');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Order relation Order object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\OrderQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useOrderQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinOrder($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Order', '\Thelia\Model\OrderQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildColissimowsLabel $colissimowsLabel Object to remove from the list of results
|
||||
*
|
||||
* @return ChildColissimowsLabelQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($colissimowsLabel = null)
|
||||
{
|
||||
if ($colissimowsLabel) {
|
||||
$this->addUsingAlias(ColissimowsLabelTableMap::ID, $colissimowsLabel->getId(), Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the colissimows_label 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(ColissimowsLabelTableMap::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).
|
||||
ColissimowsLabelTableMap::clearInstancePool();
|
||||
ColissimowsLabelTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildColissimowsLabel or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildColissimowsLabel 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(ColissimowsLabelTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(ColissimowsLabelTableMap::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();
|
||||
|
||||
|
||||
ColissimowsLabelTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
ColissimowsLabelTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
// timestampable behavior
|
||||
|
||||
/**
|
||||
* Filter by the latest updated
|
||||
*
|
||||
* @param int $nbDays Maximum age of the latest update in days
|
||||
*
|
||||
* @return ChildColissimowsLabelQuery The current query, for fluid interface
|
||||
*/
|
||||
public function recentlyUpdated($nbDays = 7)
|
||||
{
|
||||
return $this->addUsingAlias(ColissimowsLabelTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter by the latest created
|
||||
*
|
||||
* @param int $nbDays Maximum age of in days
|
||||
*
|
||||
* @return ChildColissimowsLabelQuery The current query, for fluid interface
|
||||
*/
|
||||
public function recentlyCreated($nbDays = 7)
|
||||
{
|
||||
return $this->addUsingAlias(ColissimowsLabelTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by update date desc
|
||||
*
|
||||
* @return ChildColissimowsLabelQuery The current query, for fluid interface
|
||||
*/
|
||||
public function lastUpdatedFirst()
|
||||
{
|
||||
return $this->addDescendingOrderByColumn(ColissimowsLabelTableMap::UPDATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by update date asc
|
||||
*
|
||||
* @return ChildColissimowsLabelQuery The current query, for fluid interface
|
||||
*/
|
||||
public function firstUpdatedFirst()
|
||||
{
|
||||
return $this->addAscendingOrderByColumn(ColissimowsLabelTableMap::UPDATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by create date desc
|
||||
*
|
||||
* @return ChildColissimowsLabelQuery The current query, for fluid interface
|
||||
*/
|
||||
public function lastCreatedFirst()
|
||||
{
|
||||
return $this->addDescendingOrderByColumn(ColissimowsLabelTableMap::CREATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by create date asc
|
||||
*
|
||||
* @return ChildColissimowsLabelQuery The current query, for fluid interface
|
||||
*/
|
||||
public function firstCreatedFirst()
|
||||
{
|
||||
return $this->addAscendingOrderByColumn(ColissimowsLabelTableMap::CREATED_AT);
|
||||
}
|
||||
|
||||
} // ColissimowsLabelQuery
|
||||
1427
local/modules/ColissimoWs/Model/Base/ColissimowsPriceSlices.php
Normal file
1427
local/modules/ColissimoWs/Model/Base/ColissimowsPriceSlices.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,654 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoWs\Model\Base;
|
||||
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use ColissimoWs\Model\ColissimowsPriceSlices as ChildColissimowsPriceSlices;
|
||||
use ColissimoWs\Model\ColissimowsPriceSlicesQuery as ChildColissimowsPriceSlicesQuery;
|
||||
use ColissimoWs\Model\Map\ColissimowsPriceSlicesTableMap;
|
||||
use Propel\Runtime\Propel;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Propel\Runtime\ActiveQuery\ModelJoin;
|
||||
use Propel\Runtime\Collection\Collection;
|
||||
use Propel\Runtime\Collection\ObjectCollection;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Thelia\Model\Area;
|
||||
|
||||
/**
|
||||
* Base class that represents a query for the 'colissimows_price_slices' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @method ChildColissimowsPriceSlicesQuery orderById($order = Criteria::ASC) Order by the id column
|
||||
* @method ChildColissimowsPriceSlicesQuery orderByAreaId($order = Criteria::ASC) Order by the area_id column
|
||||
* @method ChildColissimowsPriceSlicesQuery orderByMaxWeight($order = Criteria::ASC) Order by the max_weight column
|
||||
* @method ChildColissimowsPriceSlicesQuery orderByMaxPrice($order = Criteria::ASC) Order by the max_price column
|
||||
* @method ChildColissimowsPriceSlicesQuery orderByShipping($order = Criteria::ASC) Order by the shipping column
|
||||
* @method ChildColissimowsPriceSlicesQuery orderByFrancoMinPrice($order = Criteria::ASC) Order by the franco_min_price column
|
||||
*
|
||||
* @method ChildColissimowsPriceSlicesQuery groupById() Group by the id column
|
||||
* @method ChildColissimowsPriceSlicesQuery groupByAreaId() Group by the area_id column
|
||||
* @method ChildColissimowsPriceSlicesQuery groupByMaxWeight() Group by the max_weight column
|
||||
* @method ChildColissimowsPriceSlicesQuery groupByMaxPrice() Group by the max_price column
|
||||
* @method ChildColissimowsPriceSlicesQuery groupByShipping() Group by the shipping column
|
||||
* @method ChildColissimowsPriceSlicesQuery groupByFrancoMinPrice() Group by the franco_min_price column
|
||||
*
|
||||
* @method ChildColissimowsPriceSlicesQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildColissimowsPriceSlicesQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
* @method ChildColissimowsPriceSlicesQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||
*
|
||||
* @method ChildColissimowsPriceSlicesQuery leftJoinArea($relationAlias = null) Adds a LEFT JOIN clause to the query using the Area relation
|
||||
* @method ChildColissimowsPriceSlicesQuery rightJoinArea($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Area relation
|
||||
* @method ChildColissimowsPriceSlicesQuery innerJoinArea($relationAlias = null) Adds a INNER JOIN clause to the query using the Area relation
|
||||
*
|
||||
* @method ChildColissimowsPriceSlices findOne(ConnectionInterface $con = null) Return the first ChildColissimowsPriceSlices matching the query
|
||||
* @method ChildColissimowsPriceSlices findOneOrCreate(ConnectionInterface $con = null) Return the first ChildColissimowsPriceSlices matching the query, or a new ChildColissimowsPriceSlices object populated from the query conditions when no match is found
|
||||
*
|
||||
* @method ChildColissimowsPriceSlices findOneById(int $id) Return the first ChildColissimowsPriceSlices filtered by the id column
|
||||
* @method ChildColissimowsPriceSlices findOneByAreaId(int $area_id) Return the first ChildColissimowsPriceSlices filtered by the area_id column
|
||||
* @method ChildColissimowsPriceSlices findOneByMaxWeight(double $max_weight) Return the first ChildColissimowsPriceSlices filtered by the max_weight column
|
||||
* @method ChildColissimowsPriceSlices findOneByMaxPrice(double $max_price) Return the first ChildColissimowsPriceSlices filtered by the max_price column
|
||||
* @method ChildColissimowsPriceSlices findOneByShipping(double $shipping) Return the first ChildColissimowsPriceSlices filtered by the shipping column
|
||||
* @method ChildColissimowsPriceSlices findOneByFrancoMinPrice(double $franco_min_price) Return the first ChildColissimowsPriceSlices filtered by the franco_min_price column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildColissimowsPriceSlices objects filtered by the id column
|
||||
* @method array findByAreaId(int $area_id) Return ChildColissimowsPriceSlices objects filtered by the area_id column
|
||||
* @method array findByMaxWeight(double $max_weight) Return ChildColissimowsPriceSlices objects filtered by the max_weight column
|
||||
* @method array findByMaxPrice(double $max_price) Return ChildColissimowsPriceSlices objects filtered by the max_price column
|
||||
* @method array findByShipping(double $shipping) Return ChildColissimowsPriceSlices objects filtered by the shipping column
|
||||
* @method array findByFrancoMinPrice(double $franco_min_price) Return ChildColissimowsPriceSlices objects filtered by the franco_min_price column
|
||||
*
|
||||
*/
|
||||
abstract class ColissimowsPriceSlicesQuery extends ModelCriteria
|
||||
{
|
||||
|
||||
/**
|
||||
* Initializes internal state of \ColissimoWs\Model\Base\ColissimowsPriceSlicesQuery 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 = '\\ColissimoWs\\Model\\ColissimowsPriceSlices', $modelAlias = null)
|
||||
{
|
||||
parent::__construct($dbName, $modelName, $modelAlias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new ChildColissimowsPriceSlicesQuery object.
|
||||
*
|
||||
* @param string $modelAlias The alias of a model in the query
|
||||
* @param Criteria $criteria Optional Criteria to build the query from
|
||||
*
|
||||
* @return ChildColissimowsPriceSlicesQuery
|
||||
*/
|
||||
public static function create($modelAlias = null, $criteria = null)
|
||||
{
|
||||
if ($criteria instanceof \ColissimoWs\Model\ColissimowsPriceSlicesQuery) {
|
||||
return $criteria;
|
||||
}
|
||||
$query = new \ColissimoWs\Model\ColissimowsPriceSlicesQuery();
|
||||
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 ChildColissimowsPriceSlices|array|mixed the result, formatted by the current formatter
|
||||
*/
|
||||
public function findPk($key, $con = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return null;
|
||||
}
|
||||
if ((null !== ($obj = ColissimowsPriceSlicesTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
||||
// the object is already in the instance pool
|
||||
return $obj;
|
||||
}
|
||||
if ($con === null) {
|
||||
$con = Propel::getServiceContainer()->getReadConnection(ColissimowsPriceSlicesTableMap::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 ChildColissimowsPriceSlices A model object, or null if the key is not found
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, AREA_ID, MAX_WEIGHT, MAX_PRICE, SHIPPING, FRANCO_MIN_PRICE FROM colissimows_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 ChildColissimowsPriceSlices();
|
||||
$obj->hydrate($row);
|
||||
ColissimowsPriceSlicesTableMap::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 ChildColissimowsPriceSlices|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 ChildColissimowsPriceSlicesQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKey($key)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(ColissimowsPriceSlicesTableMap::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 ChildColissimowsPriceSlicesQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByPrimaryKeys($keys)
|
||||
{
|
||||
|
||||
return $this->addUsingAlias(ColissimowsPriceSlicesTableMap::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 ChildColissimowsPriceSlicesQuery 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(ColissimowsPriceSlicesTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($id['max'])) {
|
||||
$this->addUsingAlias(ColissimowsPriceSlicesTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimowsPriceSlicesTableMap::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 ChildColissimowsPriceSlicesQuery 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(ColissimowsPriceSlicesTableMap::AREA_ID, $areaId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($areaId['max'])) {
|
||||
$this->addUsingAlias(ColissimowsPriceSlicesTableMap::AREA_ID, $areaId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimowsPriceSlicesTableMap::AREA_ID, $areaId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the max_weight column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByMaxWeight(1234); // WHERE max_weight = 1234
|
||||
* $query->filterByMaxWeight(array(12, 34)); // WHERE max_weight IN (12, 34)
|
||||
* $query->filterByMaxWeight(array('min' => 12)); // WHERE max_weight > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $maxWeight The value to use as filter.
|
||||
* Use scalar values for equality.
|
||||
* Use array values for in_array() equivalent.
|
||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildColissimowsPriceSlicesQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByMaxWeight($maxWeight = null, $comparison = null)
|
||||
{
|
||||
if (is_array($maxWeight)) {
|
||||
$useMinMax = false;
|
||||
if (isset($maxWeight['min'])) {
|
||||
$this->addUsingAlias(ColissimowsPriceSlicesTableMap::MAX_WEIGHT, $maxWeight['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($maxWeight['max'])) {
|
||||
$this->addUsingAlias(ColissimowsPriceSlicesTableMap::MAX_WEIGHT, $maxWeight['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimowsPriceSlicesTableMap::MAX_WEIGHT, $maxWeight, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the max_price column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByMaxPrice(1234); // WHERE max_price = 1234
|
||||
* $query->filterByMaxPrice(array(12, 34)); // WHERE max_price IN (12, 34)
|
||||
* $query->filterByMaxPrice(array('min' => 12)); // WHERE max_price > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $maxPrice 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 ChildColissimowsPriceSlicesQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByMaxPrice($maxPrice = null, $comparison = null)
|
||||
{
|
||||
if (is_array($maxPrice)) {
|
||||
$useMinMax = false;
|
||||
if (isset($maxPrice['min'])) {
|
||||
$this->addUsingAlias(ColissimowsPriceSlicesTableMap::MAX_PRICE, $maxPrice['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($maxPrice['max'])) {
|
||||
$this->addUsingAlias(ColissimowsPriceSlicesTableMap::MAX_PRICE, $maxPrice['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimowsPriceSlicesTableMap::MAX_PRICE, $maxPrice, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the shipping column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByShipping(1234); // WHERE shipping = 1234
|
||||
* $query->filterByShipping(array(12, 34)); // WHERE shipping IN (12, 34)
|
||||
* $query->filterByShipping(array('min' => 12)); // WHERE shipping > 12
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $shipping 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 ChildColissimowsPriceSlicesQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByShipping($shipping = null, $comparison = null)
|
||||
{
|
||||
if (is_array($shipping)) {
|
||||
$useMinMax = false;
|
||||
if (isset($shipping['min'])) {
|
||||
$this->addUsingAlias(ColissimowsPriceSlicesTableMap::SHIPPING, $shipping['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($shipping['max'])) {
|
||||
$this->addUsingAlias(ColissimowsPriceSlicesTableMap::SHIPPING, $shipping['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimowsPriceSlicesTableMap::SHIPPING, $shipping, $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 ChildColissimowsPriceSlicesQuery 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(ColissimowsPriceSlicesTableMap::FRANCO_MIN_PRICE, $francoMinPrice['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($francoMinPrice['max'])) {
|
||||
$this->addUsingAlias(ColissimowsPriceSlicesTableMap::FRANCO_MIN_PRICE, $francoMinPrice['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(ColissimowsPriceSlicesTableMap::FRANCO_MIN_PRICE, $francoMinPrice, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related \Thelia\Model\Area object
|
||||
*
|
||||
* @param \Thelia\Model\Area|ObjectCollection $area The related object(s) to use as filter
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return ChildColissimowsPriceSlicesQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByArea($area, $comparison = null)
|
||||
{
|
||||
if ($area instanceof \Thelia\Model\Area) {
|
||||
return $this
|
||||
->addUsingAlias(ColissimowsPriceSlicesTableMap::AREA_ID, $area->getId(), $comparison);
|
||||
} elseif ($area instanceof ObjectCollection) {
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
|
||||
return $this
|
||||
->addUsingAlias(ColissimowsPriceSlicesTableMap::AREA_ID, $area->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
||||
} else {
|
||||
throw new PropelException('filterByArea() only accepts arguments of type \Thelia\Model\Area or Collection');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JOIN clause to the query using the Area relation
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return ChildColissimowsPriceSlicesQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinArea($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Area');
|
||||
|
||||
// create a ModelJoin object for this join
|
||||
$join = new ModelJoin();
|
||||
$join->setJoinType($joinType);
|
||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||
if ($previousJoin = $this->getPreviousJoin()) {
|
||||
$join->setPreviousJoin($previousJoin);
|
||||
}
|
||||
|
||||
// add the ModelJoin to the current object
|
||||
if ($relationAlias) {
|
||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||
$this->addJoinObject($join, $relationAlias);
|
||||
} else {
|
||||
$this->addJoinObject($join, 'Area');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the Area relation Area object
|
||||
*
|
||||
* @see useQuery()
|
||||
*
|
||||
* @param string $relationAlias optional alias for the relation,
|
||||
* to be used as main alias in the secondary query
|
||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||
*
|
||||
* @return \Thelia\Model\AreaQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useAreaQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinArea($relationAlias, $joinType)
|
||||
->useQuery($relationAlias ? $relationAlias : 'Area', '\Thelia\Model\AreaQuery');
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
* @param ChildColissimowsPriceSlices $colissimowsPriceSlices Object to remove from the list of results
|
||||
*
|
||||
* @return ChildColissimowsPriceSlicesQuery The current query, for fluid interface
|
||||
*/
|
||||
public function prune($colissimowsPriceSlices = null)
|
||||
{
|
||||
if ($colissimowsPriceSlices) {
|
||||
$this->addUsingAlias(ColissimowsPriceSlicesTableMap::ID, $colissimowsPriceSlices->getId(), Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the colissimows_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(ColissimowsPriceSlicesTableMap::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).
|
||||
ColissimowsPriceSlicesTableMap::clearInstancePool();
|
||||
ColissimowsPriceSlicesTableMap::clearRelatedInstancePool();
|
||||
|
||||
$con->commit();
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $affectedRows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ChildColissimowsPriceSlices or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ChildColissimowsPriceSlices 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(ColissimowsPriceSlicesTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
$criteria = $this;
|
||||
|
||||
// Set the correct dbName
|
||||
$criteria->setDbName(ColissimowsPriceSlicesTableMap::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();
|
||||
|
||||
|
||||
ColissimowsPriceSlicesTableMap::removeInstanceFromPool($criteria);
|
||||
|
||||
$affectedRows += ModelCriteria::delete($con);
|
||||
ColissimowsPriceSlicesTableMap::clearRelatedInstancePool();
|
||||
$con->commit();
|
||||
|
||||
return $affectedRows;
|
||||
} catch (PropelException $e) {
|
||||
$con->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
} // ColissimowsPriceSlicesQuery
|
||||
20
local/modules/ColissimoWs/Model/ColissimowsFreeshipping.php
Normal file
20
local/modules/ColissimoWs/Model/ColissimowsFreeshipping.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoWs\Model;
|
||||
|
||||
use ColissimoWs\Model\Base\ColissimowsFreeshipping as BaseColissimowsFreeshipping;
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'colissimows_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 ColissimowsFreeshipping extends BaseColissimowsFreeshipping
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoWs\Model;
|
||||
|
||||
use ColissimoWs\Model\Base\ColissimowsFreeshippingQuery as BaseColissimowsFreeshippingQuery;
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'colissimows_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 ColissimowsFreeshippingQuery extends BaseColissimowsFreeshippingQuery
|
||||
{
|
||||
|
||||
}
|
||||
20
local/modules/ColissimoWs/Model/ColissimowsLabel.php
Normal file
20
local/modules/ColissimoWs/Model/ColissimowsLabel.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoWs\Model;
|
||||
|
||||
use ColissimoWs\Model\Base\ColissimowsLabel as BaseColissimowsLabel;
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'colissimows_label' 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 ColissimowsLabel extends BaseColissimowsLabel
|
||||
{
|
||||
|
||||
}
|
||||
20
local/modules/ColissimoWs/Model/ColissimowsLabelQuery.php
Normal file
20
local/modules/ColissimoWs/Model/ColissimowsLabelQuery.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoWs\Model;
|
||||
|
||||
use ColissimoWs\Model\Base\ColissimowsLabelQuery as BaseColissimowsLabelQuery;
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'colissimows_label' 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 ColissimowsLabelQuery extends BaseColissimowsLabelQuery
|
||||
{
|
||||
|
||||
}
|
||||
20
local/modules/ColissimoWs/Model/ColissimowsPriceSlices.php
Normal file
20
local/modules/ColissimoWs/Model/ColissimowsPriceSlices.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoWs\Model;
|
||||
|
||||
use ColissimoWs\Model\Base\ColissimowsPriceSlices as BaseColissimowsPriceSlices;
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'colissimows_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 ColissimowsPriceSlices extends BaseColissimowsPriceSlices
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoWs\Model;
|
||||
|
||||
use ColissimoWs\Model\Base\ColissimowsPriceSlicesQuery as BaseColissimowsPriceSlicesQuery;
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'colissimows_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 ColissimowsPriceSlicesQuery extends BaseColissimowsPriceSlicesQuery
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,406 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoWs\Model\Map;
|
||||
|
||||
use ColissimoWs\Model\ColissimowsFreeshipping;
|
||||
use ColissimoWs\Model\ColissimowsFreeshippingQuery;
|
||||
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 'colissimows_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 ColissimowsFreeshippingTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'ColissimoWs.Model.Map.ColissimowsFreeshippingTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'colissimows_freeshipping';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\ColissimoWs\\Model\\ColissimowsFreeshipping';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'ColissimoWs.Model.ColissimowsFreeshipping';
|
||||
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 2;
|
||||
|
||||
/**
|
||||
* 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 = 2;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
*/
|
||||
const ID = 'colissimows_freeshipping.ID';
|
||||
|
||||
/**
|
||||
* the column name for the ACTIVE field
|
||||
*/
|
||||
const ACTIVE = 'colissimows_freeshipping.ACTIVE';
|
||||
|
||||
/**
|
||||
* 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', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'active', ),
|
||||
self::TYPE_COLNAME => array(ColissimowsFreeshippingTableMap::ID, ColissimowsFreeshippingTableMap::ACTIVE, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'ACTIVE', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'active', ),
|
||||
self::TYPE_NUM => array(0, 1, )
|
||||
);
|
||||
|
||||
/**
|
||||
* 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, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'active' => 1, ),
|
||||
self::TYPE_COLNAME => array(ColissimowsFreeshippingTableMap::ID => 0, ColissimowsFreeshippingTableMap::ACTIVE => 1, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'ACTIVE' => 1, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'active' => 1, ),
|
||||
self::TYPE_NUM => array(0, 1, )
|
||||
);
|
||||
|
||||
/**
|
||||
* 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('colissimows_freeshipping');
|
||||
$this->setPhpName('ColissimowsFreeshipping');
|
||||
$this->setClassName('\\ColissimoWs\\Model\\ColissimowsFreeshipping');
|
||||
$this->setPackage('ColissimoWs.Model');
|
||||
$this->setUseIdGenerator(false);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addColumn('ACTIVE', 'Active', 'BOOLEAN', false, 1, false);
|
||||
} // 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 ? ColissimowsFreeshippingTableMap::CLASS_DEFAULT : ColissimowsFreeshippingTableMap::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 (ColissimowsFreeshipping object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = ColissimowsFreeshippingTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = ColissimowsFreeshippingTableMap::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 + ColissimowsFreeshippingTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = ColissimowsFreeshippingTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
ColissimowsFreeshippingTableMap::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 = ColissimowsFreeshippingTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = ColissimowsFreeshippingTableMap::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;
|
||||
ColissimowsFreeshippingTableMap::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(ColissimowsFreeshippingTableMap::ID);
|
||||
$criteria->addSelectColumn(ColissimowsFreeshippingTableMap::ACTIVE);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.ACTIVE');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(ColissimowsFreeshippingTableMap::DATABASE_NAME)->getTable(ColissimowsFreeshippingTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(ColissimowsFreeshippingTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(ColissimowsFreeshippingTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new ColissimowsFreeshippingTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ColissimowsFreeshipping or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ColissimowsFreeshipping 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(ColissimowsFreeshippingTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \ColissimoWs\Model\ColissimowsFreeshipping) { // 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(ColissimowsFreeshippingTableMap::DATABASE_NAME);
|
||||
$criteria->add(ColissimowsFreeshippingTableMap::ID, (array) $values, Criteria::IN);
|
||||
}
|
||||
|
||||
$query = ColissimowsFreeshippingQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { ColissimowsFreeshippingTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { ColissimowsFreeshippingTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the colissimows_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 ColissimowsFreeshippingQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a ColissimowsFreeshipping or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or ColissimowsFreeshipping 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(ColissimowsFreeshippingTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from ColissimowsFreeshipping object
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = ColissimowsFreeshippingQuery::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;
|
||||
}
|
||||
|
||||
} // ColissimowsFreeshippingTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
ColissimowsFreeshippingTableMap::buildTableMap();
|
||||
512
local/modules/ColissimoWs/Model/Map/ColissimowsLabelTableMap.php
Normal file
512
local/modules/ColissimoWs/Model/Map/ColissimowsLabelTableMap.php
Normal file
@@ -0,0 +1,512 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoWs\Model\Map;
|
||||
|
||||
use ColissimoWs\Model\ColissimowsLabel;
|
||||
use ColissimoWs\Model\ColissimowsLabelQuery;
|
||||
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 'colissimows_label' 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 ColissimowsLabelTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'ColissimoWs.Model.Map.ColissimowsLabelTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'colissimows_label';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\ColissimoWs\\Model\\ColissimowsLabel';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'ColissimoWs.Model.ColissimowsLabel';
|
||||
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 13;
|
||||
|
||||
/**
|
||||
* 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 = 13;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
*/
|
||||
const ID = 'colissimows_label.ID';
|
||||
|
||||
/**
|
||||
* the column name for the ORDER_ID field
|
||||
*/
|
||||
const ORDER_ID = 'colissimows_label.ORDER_ID';
|
||||
|
||||
/**
|
||||
* the column name for the ORDER_REF field
|
||||
*/
|
||||
const ORDER_REF = 'colissimows_label.ORDER_REF';
|
||||
|
||||
/**
|
||||
* the column name for the ERROR field
|
||||
*/
|
||||
const ERROR = 'colissimows_label.ERROR';
|
||||
|
||||
/**
|
||||
* the column name for the ERROR_MESSAGE field
|
||||
*/
|
||||
const ERROR_MESSAGE = 'colissimows_label.ERROR_MESSAGE';
|
||||
|
||||
/**
|
||||
* the column name for the TRACKING_NUMBER field
|
||||
*/
|
||||
const TRACKING_NUMBER = 'colissimows_label.TRACKING_NUMBER';
|
||||
|
||||
/**
|
||||
* the column name for the LABEL_DATA field
|
||||
*/
|
||||
const LABEL_DATA = 'colissimows_label.LABEL_DATA';
|
||||
|
||||
/**
|
||||
* the column name for the LABEL_TYPE field
|
||||
*/
|
||||
const LABEL_TYPE = 'colissimows_label.LABEL_TYPE';
|
||||
|
||||
/**
|
||||
* the column name for the WEIGHT field
|
||||
*/
|
||||
const WEIGHT = 'colissimows_label.WEIGHT';
|
||||
|
||||
/**
|
||||
* the column name for the SIGNED field
|
||||
*/
|
||||
const SIGNED = 'colissimows_label.SIGNED';
|
||||
|
||||
/**
|
||||
* the column name for the WITH_CUSTOMS_INVOICE field
|
||||
*/
|
||||
const WITH_CUSTOMS_INVOICE = 'colissimows_label.WITH_CUSTOMS_INVOICE';
|
||||
|
||||
/**
|
||||
* the column name for the CREATED_AT field
|
||||
*/
|
||||
const CREATED_AT = 'colissimows_label.CREATED_AT';
|
||||
|
||||
/**
|
||||
* the column name for the UPDATED_AT field
|
||||
*/
|
||||
const UPDATED_AT = 'colissimows_label.UPDATED_AT';
|
||||
|
||||
/**
|
||||
* 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', 'OrderId', 'OrderRef', 'Error', 'ErrorMessage', 'TrackingNumber', 'LabelData', 'LabelType', 'Weight', 'Signed', 'WithCustomsInvoice', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'orderId', 'orderRef', 'error', 'errorMessage', 'trackingNumber', 'labelData', 'labelType', 'weight', 'signed', 'withCustomsInvoice', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(ColissimowsLabelTableMap::ID, ColissimowsLabelTableMap::ORDER_ID, ColissimowsLabelTableMap::ORDER_REF, ColissimowsLabelTableMap::ERROR, ColissimowsLabelTableMap::ERROR_MESSAGE, ColissimowsLabelTableMap::TRACKING_NUMBER, ColissimowsLabelTableMap::LABEL_DATA, ColissimowsLabelTableMap::LABEL_TYPE, ColissimowsLabelTableMap::WEIGHT, ColissimowsLabelTableMap::SIGNED, ColissimowsLabelTableMap::WITH_CUSTOMS_INVOICE, ColissimowsLabelTableMap::CREATED_AT, ColissimowsLabelTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'ORDER_ID', 'ORDER_REF', 'ERROR', 'ERROR_MESSAGE', 'TRACKING_NUMBER', 'LABEL_DATA', 'LABEL_TYPE', 'WEIGHT', 'SIGNED', 'WITH_CUSTOMS_INVOICE', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'order_id', 'order_ref', 'error', 'error_message', 'tracking_number', 'label_data', 'label_type', 'weight', 'signed', 'with_customs_invoice', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
|
||||
);
|
||||
|
||||
/**
|
||||
* 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, 'OrderId' => 1, 'OrderRef' => 2, 'Error' => 3, 'ErrorMessage' => 4, 'TrackingNumber' => 5, 'LabelData' => 6, 'LabelType' => 7, 'Weight' => 8, 'Signed' => 9, 'WithCustomsInvoice' => 10, 'CreatedAt' => 11, 'UpdatedAt' => 12, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'orderId' => 1, 'orderRef' => 2, 'error' => 3, 'errorMessage' => 4, 'trackingNumber' => 5, 'labelData' => 6, 'labelType' => 7, 'weight' => 8, 'signed' => 9, 'withCustomsInvoice' => 10, 'createdAt' => 11, 'updatedAt' => 12, ),
|
||||
self::TYPE_COLNAME => array(ColissimowsLabelTableMap::ID => 0, ColissimowsLabelTableMap::ORDER_ID => 1, ColissimowsLabelTableMap::ORDER_REF => 2, ColissimowsLabelTableMap::ERROR => 3, ColissimowsLabelTableMap::ERROR_MESSAGE => 4, ColissimowsLabelTableMap::TRACKING_NUMBER => 5, ColissimowsLabelTableMap::LABEL_DATA => 6, ColissimowsLabelTableMap::LABEL_TYPE => 7, ColissimowsLabelTableMap::WEIGHT => 8, ColissimowsLabelTableMap::SIGNED => 9, ColissimowsLabelTableMap::WITH_CUSTOMS_INVOICE => 10, ColissimowsLabelTableMap::CREATED_AT => 11, ColissimowsLabelTableMap::UPDATED_AT => 12, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'ORDER_ID' => 1, 'ORDER_REF' => 2, 'ERROR' => 3, 'ERROR_MESSAGE' => 4, 'TRACKING_NUMBER' => 5, 'LABEL_DATA' => 6, 'LABEL_TYPE' => 7, 'WEIGHT' => 8, 'SIGNED' => 9, 'WITH_CUSTOMS_INVOICE' => 10, 'CREATED_AT' => 11, 'UPDATED_AT' => 12, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'order_id' => 1, 'order_ref' => 2, 'error' => 3, 'error_message' => 4, 'tracking_number' => 5, 'label_data' => 6, 'label_type' => 7, 'weight' => 8, 'signed' => 9, 'with_customs_invoice' => 10, 'created_at' => 11, 'updated_at' => 12, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
|
||||
);
|
||||
|
||||
/**
|
||||
* 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('colissimows_label');
|
||||
$this->setPhpName('ColissimowsLabel');
|
||||
$this->setClassName('\\ColissimoWs\\Model\\ColissimowsLabel');
|
||||
$this->setPackage('ColissimoWs.Model');
|
||||
$this->setUseIdGenerator(true);
|
||||
// columns
|
||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('ORDER_ID', 'OrderId', 'INTEGER', 'order', 'ID', true, null, null);
|
||||
$this->addColumn('ORDER_REF', 'OrderRef', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('ERROR', 'Error', 'BOOLEAN', true, 1, false);
|
||||
$this->addColumn('ERROR_MESSAGE', 'ErrorMessage', 'VARCHAR', false, 255, '');
|
||||
$this->addColumn('TRACKING_NUMBER', 'TrackingNumber', 'VARCHAR', false, 64, '');
|
||||
$this->addColumn('LABEL_DATA', 'LabelData', 'CLOB', false, null, null);
|
||||
$this->addColumn('LABEL_TYPE', 'LabelType', 'VARCHAR', false, 4, null);
|
||||
$this->addColumn('WEIGHT', 'Weight', 'FLOAT', true, null, null);
|
||||
$this->addColumn('SIGNED', 'Signed', 'BOOLEAN', false, 1, false);
|
||||
$this->addColumn('WITH_CUSTOMS_INVOICE', 'WithCustomsInvoice', 'BOOLEAN', true, 1, false);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Order', '\\Thelia\\Model\\Order', RelationMap::MANY_TO_ONE, array('order_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
*
|
||||
* Gets the list of behaviors registered for this table
|
||||
*
|
||||
* @return array Associative array (name => parameters) of behaviors
|
||||
*/
|
||||
public function getBehaviors()
|
||||
{
|
||||
return array(
|
||||
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
|
||||
);
|
||||
} // getBehaviors()
|
||||
|
||||
/**
|
||||
* 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 ? ColissimowsLabelTableMap::CLASS_DEFAULT : ColissimowsLabelTableMap::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 (ColissimowsLabel object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = ColissimowsLabelTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = ColissimowsLabelTableMap::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 + ColissimowsLabelTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = ColissimowsLabelTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
ColissimowsLabelTableMap::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 = ColissimowsLabelTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = ColissimowsLabelTableMap::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;
|
||||
ColissimowsLabelTableMap::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(ColissimowsLabelTableMap::ID);
|
||||
$criteria->addSelectColumn(ColissimowsLabelTableMap::ORDER_ID);
|
||||
$criteria->addSelectColumn(ColissimowsLabelTableMap::ORDER_REF);
|
||||
$criteria->addSelectColumn(ColissimowsLabelTableMap::ERROR);
|
||||
$criteria->addSelectColumn(ColissimowsLabelTableMap::ERROR_MESSAGE);
|
||||
$criteria->addSelectColumn(ColissimowsLabelTableMap::TRACKING_NUMBER);
|
||||
$criteria->addSelectColumn(ColissimowsLabelTableMap::LABEL_DATA);
|
||||
$criteria->addSelectColumn(ColissimowsLabelTableMap::LABEL_TYPE);
|
||||
$criteria->addSelectColumn(ColissimowsLabelTableMap::WEIGHT);
|
||||
$criteria->addSelectColumn(ColissimowsLabelTableMap::SIGNED);
|
||||
$criteria->addSelectColumn(ColissimowsLabelTableMap::WITH_CUSTOMS_INVOICE);
|
||||
$criteria->addSelectColumn(ColissimowsLabelTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(ColissimowsLabelTableMap::UPDATED_AT);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.ORDER_ID');
|
||||
$criteria->addSelectColumn($alias . '.ORDER_REF');
|
||||
$criteria->addSelectColumn($alias . '.ERROR');
|
||||
$criteria->addSelectColumn($alias . '.ERROR_MESSAGE');
|
||||
$criteria->addSelectColumn($alias . '.TRACKING_NUMBER');
|
||||
$criteria->addSelectColumn($alias . '.LABEL_DATA');
|
||||
$criteria->addSelectColumn($alias . '.LABEL_TYPE');
|
||||
$criteria->addSelectColumn($alias . '.WEIGHT');
|
||||
$criteria->addSelectColumn($alias . '.SIGNED');
|
||||
$criteria->addSelectColumn($alias . '.WITH_CUSTOMS_INVOICE');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(ColissimowsLabelTableMap::DATABASE_NAME)->getTable(ColissimowsLabelTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(ColissimowsLabelTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(ColissimowsLabelTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new ColissimowsLabelTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ColissimowsLabel or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ColissimowsLabel 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(ColissimowsLabelTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \ColissimoWs\Model\ColissimowsLabel) { // 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(ColissimowsLabelTableMap::DATABASE_NAME);
|
||||
$criteria->add(ColissimowsLabelTableMap::ID, (array) $values, Criteria::IN);
|
||||
}
|
||||
|
||||
$query = ColissimowsLabelQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { ColissimowsLabelTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { ColissimowsLabelTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the colissimows_label 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 ColissimowsLabelQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a ColissimowsLabel or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or ColissimowsLabel 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(ColissimowsLabelTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from ColissimowsLabel object
|
||||
}
|
||||
|
||||
if ($criteria->containsKey(ColissimowsLabelTableMap::ID) && $criteria->keyContainsValue(ColissimowsLabelTableMap::ID) ) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key ('.ColissimowsLabelTableMap::ID.')');
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = ColissimowsLabelQuery::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;
|
||||
}
|
||||
|
||||
} // ColissimowsLabelTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
ColissimowsLabelTableMap::buildTableMap();
|
||||
@@ -0,0 +1,443 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoWs\Model\Map;
|
||||
|
||||
use ColissimoWs\Model\ColissimowsPriceSlices;
|
||||
use ColissimoWs\Model\ColissimowsPriceSlicesQuery;
|
||||
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 'colissimows_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 ColissimowsPriceSlicesTableMap extends TableMap
|
||||
{
|
||||
use InstancePoolTrait;
|
||||
use TableMapTrait;
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'ColissimoWs.Model.Map.ColissimowsPriceSlicesTableMap';
|
||||
|
||||
/**
|
||||
* The default database name for this class
|
||||
*/
|
||||
const DATABASE_NAME = 'thelia';
|
||||
|
||||
/**
|
||||
* The table name for this class
|
||||
*/
|
||||
const TABLE_NAME = 'colissimows_price_slices';
|
||||
|
||||
/**
|
||||
* The related Propel class for this table
|
||||
*/
|
||||
const OM_CLASS = '\\ColissimoWs\\Model\\ColissimowsPriceSlices';
|
||||
|
||||
/**
|
||||
* A class that can be returned by this tableMap
|
||||
*/
|
||||
const CLASS_DEFAULT = 'ColissimoWs.Model.ColissimowsPriceSlices';
|
||||
|
||||
/**
|
||||
* 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 = 'colissimows_price_slices.ID';
|
||||
|
||||
/**
|
||||
* the column name for the AREA_ID field
|
||||
*/
|
||||
const AREA_ID = 'colissimows_price_slices.AREA_ID';
|
||||
|
||||
/**
|
||||
* the column name for the MAX_WEIGHT field
|
||||
*/
|
||||
const MAX_WEIGHT = 'colissimows_price_slices.MAX_WEIGHT';
|
||||
|
||||
/**
|
||||
* the column name for the MAX_PRICE field
|
||||
*/
|
||||
const MAX_PRICE = 'colissimows_price_slices.MAX_PRICE';
|
||||
|
||||
/**
|
||||
* the column name for the SHIPPING field
|
||||
*/
|
||||
const SHIPPING = 'colissimows_price_slices.SHIPPING';
|
||||
|
||||
/**
|
||||
* the column name for the FRANCO_MIN_PRICE field
|
||||
*/
|
||||
const FRANCO_MIN_PRICE = 'colissimows_price_slices.FRANCO_MIN_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', 'MaxWeight', 'MaxPrice', 'Shipping', 'FrancoMinPrice', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'areaId', 'maxWeight', 'maxPrice', 'shipping', 'francoMinPrice', ),
|
||||
self::TYPE_COLNAME => array(ColissimowsPriceSlicesTableMap::ID, ColissimowsPriceSlicesTableMap::AREA_ID, ColissimowsPriceSlicesTableMap::MAX_WEIGHT, ColissimowsPriceSlicesTableMap::MAX_PRICE, ColissimowsPriceSlicesTableMap::SHIPPING, ColissimowsPriceSlicesTableMap::FRANCO_MIN_PRICE, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'AREA_ID', 'MAX_WEIGHT', 'MAX_PRICE', 'SHIPPING', 'FRANCO_MIN_PRICE', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'area_id', 'max_weight', 'max_price', 'shipping', 'franco_min_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, 'MaxWeight' => 2, 'MaxPrice' => 3, 'Shipping' => 4, 'FrancoMinPrice' => 5, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'areaId' => 1, 'maxWeight' => 2, 'maxPrice' => 3, 'shipping' => 4, 'francoMinPrice' => 5, ),
|
||||
self::TYPE_COLNAME => array(ColissimowsPriceSlicesTableMap::ID => 0, ColissimowsPriceSlicesTableMap::AREA_ID => 1, ColissimowsPriceSlicesTableMap::MAX_WEIGHT => 2, ColissimowsPriceSlicesTableMap::MAX_PRICE => 3, ColissimowsPriceSlicesTableMap::SHIPPING => 4, ColissimowsPriceSlicesTableMap::FRANCO_MIN_PRICE => 5, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'AREA_ID' => 1, 'MAX_WEIGHT' => 2, 'MAX_PRICE' => 3, 'SHIPPING' => 4, 'FRANCO_MIN_PRICE' => 5, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'area_id' => 1, 'max_weight' => 2, 'max_price' => 3, 'shipping' => 4, 'franco_min_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('colissimows_price_slices');
|
||||
$this->setPhpName('ColissimowsPriceSlices');
|
||||
$this->setClassName('\\ColissimoWs\\Model\\ColissimowsPriceSlices');
|
||||
$this->setPackage('ColissimoWs.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('MAX_WEIGHT', 'MaxWeight', 'FLOAT', false, null, null);
|
||||
$this->addColumn('MAX_PRICE', 'MaxPrice', 'FLOAT', false, null, null);
|
||||
$this->addColumn('SHIPPING', 'Shipping', 'FLOAT', true, null, null);
|
||||
$this->addColumn('FRANCO_MIN_PRICE', 'FrancoMinPrice', 'FLOAT', false, null, null);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
* Build the RelationMap objects for this table relationships
|
||||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('Area', '\\Thelia\\Model\\Area', RelationMap::MANY_TO_ONE, array('area_id' => 'id', ), '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 ? ColissimowsPriceSlicesTableMap::CLASS_DEFAULT : ColissimowsPriceSlicesTableMap::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 (ColissimowsPriceSlices object, last column rank)
|
||||
*/
|
||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
||||
{
|
||||
$key = ColissimowsPriceSlicesTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
||||
if (null !== ($obj = ColissimowsPriceSlicesTableMap::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 + ColissimowsPriceSlicesTableMap::NUM_HYDRATE_COLUMNS;
|
||||
} else {
|
||||
$cls = ColissimowsPriceSlicesTableMap::OM_CLASS;
|
||||
$obj = new $cls();
|
||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
||||
ColissimowsPriceSlicesTableMap::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 = ColissimowsPriceSlicesTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
||||
if (null !== ($obj = ColissimowsPriceSlicesTableMap::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;
|
||||
ColissimowsPriceSlicesTableMap::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(ColissimowsPriceSlicesTableMap::ID);
|
||||
$criteria->addSelectColumn(ColissimowsPriceSlicesTableMap::AREA_ID);
|
||||
$criteria->addSelectColumn(ColissimowsPriceSlicesTableMap::MAX_WEIGHT);
|
||||
$criteria->addSelectColumn(ColissimowsPriceSlicesTableMap::MAX_PRICE);
|
||||
$criteria->addSelectColumn(ColissimowsPriceSlicesTableMap::SHIPPING);
|
||||
$criteria->addSelectColumn(ColissimowsPriceSlicesTableMap::FRANCO_MIN_PRICE);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.AREA_ID');
|
||||
$criteria->addSelectColumn($alias . '.MAX_WEIGHT');
|
||||
$criteria->addSelectColumn($alias . '.MAX_PRICE');
|
||||
$criteria->addSelectColumn($alias . '.SHIPPING');
|
||||
$criteria->addSelectColumn($alias . '.FRANCO_MIN_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(ColissimowsPriceSlicesTableMap::DATABASE_NAME)->getTable(ColissimowsPriceSlicesTableMap::TABLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a TableMap instance to the database for this tableMap class.
|
||||
*/
|
||||
public static function buildTableMap()
|
||||
{
|
||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(ColissimowsPriceSlicesTableMap::DATABASE_NAME);
|
||||
if (!$dbMap->hasTable(ColissimowsPriceSlicesTableMap::TABLE_NAME)) {
|
||||
$dbMap->addTableObject(new ColissimowsPriceSlicesTableMap());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a DELETE on the database, given a ColissimowsPriceSlices or Criteria object OR a primary key value.
|
||||
*
|
||||
* @param mixed $values Criteria or ColissimowsPriceSlices 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(ColissimowsPriceSlicesTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($values instanceof Criteria) {
|
||||
// rename for clarity
|
||||
$criteria = $values;
|
||||
} elseif ($values instanceof \ColissimoWs\Model\ColissimowsPriceSlices) { // 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(ColissimowsPriceSlicesTableMap::DATABASE_NAME);
|
||||
$criteria->add(ColissimowsPriceSlicesTableMap::ID, (array) $values, Criteria::IN);
|
||||
}
|
||||
|
||||
$query = ColissimowsPriceSlicesQuery::create()->mergeWith($criteria);
|
||||
|
||||
if ($values instanceof Criteria) { ColissimowsPriceSlicesTableMap::clearInstancePool();
|
||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
||||
foreach ((array) $values as $singleval) { ColissimowsPriceSlicesTableMap::removeInstanceFromPool($singleval);
|
||||
}
|
||||
}
|
||||
|
||||
return $query->delete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all rows from the colissimows_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 ColissimowsPriceSlicesQuery::create()->doDeleteAll($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs an INSERT on the database, given a ColissimowsPriceSlices or Criteria object.
|
||||
*
|
||||
* @param mixed $criteria Criteria or ColissimowsPriceSlices 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(ColissimowsPriceSlicesTableMap::DATABASE_NAME);
|
||||
}
|
||||
|
||||
if ($criteria instanceof Criteria) {
|
||||
$criteria = clone $criteria; // rename for clarity
|
||||
} else {
|
||||
$criteria = $criteria->buildCriteria(); // build Criteria from ColissimowsPriceSlices object
|
||||
}
|
||||
|
||||
if ($criteria->containsKey(ColissimowsPriceSlicesTableMap::ID) && $criteria->keyContainsValue(ColissimowsPriceSlicesTableMap::ID) ) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key ('.ColissimowsPriceSlicesTableMap::ID.')');
|
||||
}
|
||||
|
||||
|
||||
// Set the correct dbName
|
||||
$query = ColissimowsPriceSlicesQuery::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;
|
||||
}
|
||||
|
||||
} // ColissimowsPriceSlicesTableMap
|
||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||
//
|
||||
ColissimowsPriceSlicesTableMap::buildTableMap();
|
||||
30
local/modules/ColissimoWs/Readme.md
Normal file
30
local/modules/ColissimoWs/Readme.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# Colissimo Ws
|
||||
|
||||
Module de livraison Colissimo avec génération des étiquettes d'expédition
|
||||
et récupération des numéros de suivi via les Web Services Colissimo.
|
||||
|
||||
Bien veiller à régénérer l'auto-loader en production :
|
||||
|
||||
`composer dump-autoload -o `
|
||||
|
||||
La facture pour les douanes doit se trouver dans le fichier
|
||||
|
||||
templates/pdf/votre-site/customs-invoice.html
|
||||
|
||||
Si vous utilisez la facture par défaut, pensez-bien à faire les "traductions" de la facture adaptées
|
||||
à vos envois.
|
||||
|
||||
## Installation
|
||||
|
||||
### Manually
|
||||
|
||||
* Copy the module into ```<thelia_root>/local/modules/``` directory and be sure that the name of the module is ProcessAndInvoice.
|
||||
* Activate it in your Thelia administration panel
|
||||
|
||||
### Composer
|
||||
|
||||
Add it in your main Thelia composer.json file
|
||||
|
||||
```
|
||||
composer require thelia/process-and-invoice-module:~1.0.0
|
||||
```
|
||||
29
local/modules/ColissimoWs/Soap/GenerateWithAttachments.php
Normal file
29
local/modules/ColissimoWs/Soap/GenerateWithAttachments.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
/**
|
||||
* Created by Franck Allimant, CQFDev <franck@cqfdev.fr>
|
||||
* Date: 06/09/2019 01:27
|
||||
*/
|
||||
|
||||
namespace ColissimoWs\Soap;
|
||||
|
||||
use ColissimoPostage\ServiceType\Generate;
|
||||
|
||||
class GenerateWithAttachments extends Generate
|
||||
{
|
||||
const DEFAULT_SOAP_CLIENT_CLASS = '\ColissimoWs\Soap\SoapClientWithAttachements';
|
||||
|
||||
|
||||
public function getRawResponse()
|
||||
{
|
||||
return self::getSoapClient()->getRawResponse();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoWs\Soap;
|
||||
|
||||
/**
|
||||
* This class can be overridden at your will.
|
||||
* Its only purpose is to show you how you can use your own SoapClient client.
|
||||
*/
|
||||
class SoapClientWithAttachements extends \SoapClient
|
||||
{
|
||||
/**
|
||||
* Final XML request
|
||||
* @var string
|
||||
*/
|
||||
public $lastRequest;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $rawResponse;
|
||||
|
||||
/**
|
||||
* @see SoapClientWithAttachements::__doRequest()
|
||||
*/
|
||||
public function __doRequest($request, $location, $action, $version, $oneWay = null)
|
||||
{
|
||||
/**
|
||||
* Colissimo does not support type definition
|
||||
*/
|
||||
$request = str_replace(' xsi:type="ns1:outputFormat"', '', $request);
|
||||
$request = str_replace(' xsi:type="ns1:letter"', '', $request);
|
||||
$request = str_replace(' xsi:type="ns1:address"', '', $request);
|
||||
$request = str_replace(' xsi:type="ns1:sender"', '', $request);
|
||||
|
||||
/**
|
||||
* Colissimo returns headers and boundary parts
|
||||
*/
|
||||
$response = parent::__doRequest($this->lastRequest = $request, $location, $action, $version, $oneWay);
|
||||
|
||||
$this->rawResponse = $response;
|
||||
|
||||
/**
|
||||
* So we only keep the XML envelope
|
||||
*/
|
||||
$response = substr($response, strpos($response, '<soap:Envelope '), strrpos($response, '</soap:Envelope>') - strpos($response, '<soap:Envelope ') + strlen('</soap:Envelope>'));
|
||||
return '<?xml version="1.0" encoding="UTF-8"?>' . trim($response);
|
||||
}
|
||||
/**
|
||||
* Override it in order to return the final XML Request
|
||||
* @return string
|
||||
* @see SoapClientWithAttachements::__getLastRequest()
|
||||
*/
|
||||
public function __getLastRequest()
|
||||
{
|
||||
return $this->lastRequest;
|
||||
}
|
||||
|
||||
public function getRawResponse()
|
||||
{
|
||||
return $this->rawResponse;
|
||||
}
|
||||
}
|
||||
13
local/modules/ColissimoWs/composer.json
Normal file
13
local/modules/ColissimoWs/composer.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "thelia/colissimows-module",
|
||||
"license": "LGPL-3.0-or-later",
|
||||
"type": "thelia-module",
|
||||
"require": {
|
||||
"thelia/installer": "~1.1",
|
||||
"wsdltophp/package-colissimo-postage": "~1.0.0",
|
||||
"giggsey/libphonenumber-for-php": "^8.11"
|
||||
},
|
||||
"extra": {
|
||||
"installer-name": "ColissimoWs"
|
||||
}
|
||||
}
|
||||
BIN
local/modules/ColissimoWs/spec_ws_affranchissement.pdf
Normal file
BIN
local/modules/ColissimoWs/spec_ws_affranchissement.pdf
Normal file
Binary file not shown.
@@ -0,0 +1,153 @@
|
||||
{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/colissimows/price-slice/save"}',
|
||||
'urlDelete': '{url path="/admin/module/colissimows/price-slice/delete"}',
|
||||
'urlSave': '{url path="/admin/module/colissimows/price-slice/save"}'
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
var checkboxes = [];
|
||||
|
||||
// Price slice
|
||||
var tpl = _.template($("#tpl-slice").html());
|
||||
|
||||
var showMessage = function showMessage(message) {
|
||||
$('#colissimows_dialog')
|
||||
.find('.modal-body')
|
||||
.html(message)
|
||||
.end()
|
||||
.modal("show");
|
||||
};
|
||||
|
||||
var getSliceData = function getSliceData($slice) {
|
||||
var data = {
|
||||
id: $slice.data("id"),
|
||||
area: $slice.data("area"),
|
||||
shipping: $slice.find(".js-slice-shipping").first().val(),
|
||||
maxPrice: $slice.find(".js-slice-max-price").first().val(),
|
||||
maxWeight: $slice.find(".js-slice-max-weight").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(){
|
||||
|
||||
});
|
||||
|
||||
$(".freeshipping-activation-ColissimoWs").bootstrapSwitch();
|
||||
|
||||
$(".freeshipping-activation-ColissimoWs").on("switch-change", function(e, data){
|
||||
var is_checked = data.value;
|
||||
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();
|
||||
})
|
||||
.fail(function(jqXHR, textStatus, errorThrown){
|
||||
$('#freeshipping-failed-body').html(jqXHR.responseJSON.error);
|
||||
$("#freeshipping-failed").modal("show");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,466 @@
|
||||
{if isset($smarty.get.tab)}
|
||||
{$tab=$smarty.get.tab}
|
||||
{else}
|
||||
{$tab='labels'}
|
||||
{/if}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<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 "labels"}active{/if}"><a data-toggle="tab" href="#labels">{intl l="Shipping labels" d='colissimows.bo.default'}</a> </li>
|
||||
<li class="{if $tab eq "prices-dom"}active{/if}"><a data-toggle="tab" href="#prices-dom">{intl l="Price slices (Dom)" d='colissimows.bo.default'}</a> </li>
|
||||
<li class="{if $tab eq "config"}active{/if}"><a data-toggle="tab" href="#config">{intl l="Configuration" d='colissimows.bo.default'}</a> </li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div id="labels" class="tab-pane {if $tab eq "labels"}active{/if} form-container">
|
||||
<br>
|
||||
<div class="title">
|
||||
{intl l="Download and print Colissimo labels for not sent orders" d='colissimows.bo.default'}
|
||||
</div>
|
||||
|
||||
{form name="colissimows_export_form"}
|
||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||
|
||||
<form action="{url path='/admin/module/colissimows/export'}" id="export-form" method="post">
|
||||
{form_hidden_fields}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading clearfix">
|
||||
{intl d='colissimows.bo.default' l="Order status change after processing"}
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
{form_field field="new_status"}
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="{$name}" value="nochange" {if $data == "nochange"}checked{/if}>
|
||||
{intl l="Do not change" d='colissimows.bo.default'}
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="{$name}" value="processing" {if $data == "processing"}checked{/if}>
|
||||
{intl l="Change to \"Processing\"" d='colissimows.bo.default'}
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="{$name}" value="sent" {if $data == "sent"}checked{/if}>
|
||||
{intl l="Change to \"Sent\". If you choose this option, the delivery notification email is sent to the customer, and the processed order are removed from this page." d='colissimows.bo.default'}
|
||||
</label>
|
||||
</div>
|
||||
{/form_field}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table table-condensed">
|
||||
<thead>
|
||||
<tr class="active">
|
||||
<th>
|
||||
{intl d='colissimows.bo.default' l="REF"}
|
||||
</th>
|
||||
<th class="text-center">
|
||||
{intl d='colissimows.bo.default' l="Order date"}
|
||||
</th>
|
||||
<th>
|
||||
{intl d='colissimows.bo.default' l="Destination"}
|
||||
</th>
|
||||
<th class="text-center">
|
||||
{intl d='colissimows.bo.default' l="Weight"}
|
||||
</th>
|
||||
<th class="text-center">
|
||||
{intl d='colissimows.bo.default' l="Price (with taxes)"}
|
||||
</th>
|
||||
<th class="text-center">
|
||||
{intl d='colissimows.bo.default' l="Signature"}
|
||||
</th>
|
||||
<th class="text-center">
|
||||
{intl d='colissimows.bo.default' l="Tracking"}
|
||||
</th>
|
||||
<th class="text-center">
|
||||
{intl d='colissimows.bo.default' l="Label"}
|
||||
</th>
|
||||
<th class="text-center">
|
||||
{intl d='colissimows.bo.default' l="Customs invoice"}
|
||||
</th>
|
||||
<th class="text-center">
|
||||
{intl l="Sel." d='colissimows.bo.default'}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tr>
|
||||
{loop name="orders.not.sent" type="colissimows.orders-not-sent"}
|
||||
{loop type="colissimows.label-info" name="label-info" order_id=$ID}
|
||||
|
||||
<tr id="order-{$ORDER_ID}"{if $HAS_ERROR} class="bg-warning"{/if}>
|
||||
<td>
|
||||
<a href="{url path="/admin/order/update/%id" id=$ID tab='bill'}" target="_blank">{$REF}</a>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{format_date date=$CREATE_DATE}
|
||||
</td>
|
||||
<td>
|
||||
{loop type='order_address' name='colissimows.address' backend_context=1 id=$DELIVERY_ADDRESS}
|
||||
{$CITY|strtoupper} {$ZIPCODE|strtoupper}, {loop backend_context=1 type="country" name="adrctry" id=$COUNTRY}{$TITLE|strtoupper}{/loop}
|
||||
{/loop}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{form_field field="weight" value_key=$ORDER_ID}
|
||||
<div class="input-group">
|
||||
<input class="form-control input-sm" type="text" name="{$name}" value="{$WEIGHT}" >
|
||||
<span class="input-group-addon">{intl l="kg" d='colissimows.bo.default'}</span>
|
||||
</div>
|
||||
{/form_field}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{$TOTAL_TAXED_AMOUNT|string_format:"%.2f"}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{form_field field="signed" value_key=$ORDER_ID}
|
||||
<input class="form-control order_checkbox" type="checkbox" name="{$name}" {if $SIGNED} checked {/if} {if !$CAN_BE_NOT_SIGNED} disabled {/if}>
|
||||
{/form_field}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{if $TRACKING_NUMBER}
|
||||
<a href="https://www.colissimo.fr/portail_colissimo/suivreResultat.do?parcelnumber={$TRACKING_NUMBER}">{$TRACKING_NUMBER}</a>
|
||||
{else}
|
||||
<i title="{intl l="Non disponible" d='colissimows.bo.default'}" class="glyphicon glyphicon-ban-circle"></i>
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
<td class="text-center">
|
||||
{if $HAS_LABEL}
|
||||
<a class="btn btn-default btn-xs" href="{$LABEL_URL}" target="_blank" title="{intl d='colissimows.bo.default' l="Download label (%fmt)" fmt=$LABEL_TYPE|upper}">
|
||||
<i class="glyphicon glyphicon-download-alt"></i>
|
||||
</a>
|
||||
{else}
|
||||
<i title="{intl l="Non disponible" d='colissimows.bo.default'}" class="glyphicon glyphicon-ban-circle"></i>
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
<td class="text-center">
|
||||
{if $HAS_CUSTOMS_INVOICE}
|
||||
<a class="btn btn-default btn-xs" href="{$CUSTOMS_INVOICE_URL}" target="_blank" title="{intl d='colissimows.bo.default' l="Download customs invoice (PDF)"}">
|
||||
<i class="glyphicon glyphicon-download"></i>
|
||||
</a>
|
||||
{else}
|
||||
-
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
<td class="text-center">
|
||||
{if !$HAS_LABEL}
|
||||
{form_field field="order_id" value_key=$ORDER_ID}
|
||||
<input type="checkbox" name="{$name}" value="{$ORDER_ID}" class="form-control order_checkbox">
|
||||
{/form_field}
|
||||
{else}
|
||||
<a onclick="return confirm('{intl l="Do you want to clear label and tracking number for this order ?"}')" href="{url path='/admin/module/colissimows/label/clear/%orderId' orderId=$ORDER_ID}" class="btn btn-danger btn-xs" title="{intl l='Clear label'}">
|
||||
<i class="glyphicon glyphicon-trash"></i>
|
||||
</a>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{if $HAS_ERROR}
|
||||
<tr class="bg-warning">
|
||||
<td colspan="99" style="padding-top:0;border:none">
|
||||
<i class="glyphicon glyphicon-warning-sign"></i> {intl l="Label cannot be created. Error is: " d='colissimows.bo.default'}
|
||||
{$ERROR_MESSAGE nofilter}
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
{/loop}
|
||||
{/loop}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{elseloop rel="orders.not.sent"}
|
||||
<div class="alert alert-info">{intl d='colissimows.bo.default' l="There are currently no orders to ship with Colissimo"}</div>
|
||||
{/elseloop}
|
||||
|
||||
{ifloop rel="orders.not.sent"}
|
||||
<div class="pull-right">
|
||||
<button type="submit" value="stay" class="btn btn-primary" title="{intl l='Process selected orders' d='colissimows.bo.default'}">{intl l='Process selected orders' d='colissimows.bo.default'}</button>
|
||||
</div>
|
||||
{/ifloop}
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
|
||||
<div id="config" class="tab-pane {if $tab eq "config"}active{/if} form-container">
|
||||
<br>
|
||||
<div class="title">
|
||||
{intl l="Colissimo Web service configuration" d='colissimows.bo.default'}
|
||||
</div>
|
||||
|
||||
{form name="colissimows_configuration_form"}
|
||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||
|
||||
<form action="{url path="/admin/module/colissimows/configure"}" method="post">
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{include file = "includes/inner-form-toolbar.html"
|
||||
hide_flags = true
|
||||
page_url = "{url path='/admin/module/ColissimoWs'}"
|
||||
close_url = "{url path='/admin/modules'}"
|
||||
}
|
||||
|
||||
{if $form_error}
|
||||
<div class="alert alert-danger">{$form_error_message}</div>
|
||||
{/if}
|
||||
|
||||
{if $smarty.get.success}
|
||||
<div class="alert alert-success">Les données de configuration ont été mises à jour.</div>
|
||||
{/if}
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<div class="panel-title">{intl d='colissimows.bo.default' l="Configuration du service"}</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row" style="margin-top: 20px;">
|
||||
<div class="col-md-6">
|
||||
{render_form_field field="colissimo_username" value=$colissimo_username}
|
||||
{render_form_field field="colissimo_password" value=$colissimo_password}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{render_form_field field="affranchissement_endpoint_url" value=$affranchissement_endpoint_url}
|
||||
{render_form_field field="format_etiquette" value=$format_etiquette}
|
||||
{render_form_field field="activate_detailed_debug" value=$activate_detailed_debug}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<div class="panel-title">{intl d='colissimows.bo.default' l="Coordonnées de d'expéditeur"}</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
{render_form_field field="company_name" value=$company_name}
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
{render_form_field field="from_contact_email" value=$from_contact_email}
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
{render_form_field field="from_phone" value=$from_phone}
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
{render_form_field field="from_address_1" value=$from_address_1}
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
{render_form_field field="from_address_2" value=$from_address_2}
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
{render_form_field field="from_zipcode" value=$from_zipcode}
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
{render_form_field field="from_city" value=$from_city}
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
{custom_render_form_field form=$form field="from_country"}
|
||||
<select {form_field_attributes field="from_country"}>
|
||||
{loop type="country" name="strore_country" backend_context="true"}
|
||||
{$isocode = $ISOALPHA2|strtoupper}
|
||||
<option value="{$isocode}"{if $isocode == $from_country} selected{/if}>{$TITLE} ({$isocode})</option>
|
||||
{/loop}
|
||||
</select>
|
||||
{/custom_render_form_field}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{/form}
|
||||
</div>
|
||||
|
||||
<div id="prices-dom" class="tab-pane {if $tab eq "prices-dom"}active{/if} form-container">
|
||||
<br>
|
||||
<div class="title">
|
||||
{intl l="Price slices for domicile delivery" d='colissimows.bo.default'}
|
||||
</div>
|
||||
|
||||
<!-- ********* FREE SHIPPING BUTTON ********* -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<!-- checkbox free shipping -->
|
||||
{assign var="ColissimoWsFreeShipping" value=0}
|
||||
{form name="colissimows.freeshipping.form"}
|
||||
|
||||
<form action='{url path="/admin/module/colissimows/freeshipping"}' method="post" id="freeshippingform">
|
||||
{form_hidden_fields form=$form}
|
||||
{form_field form=$form field="freeshipping"}
|
||||
|
||||
<label>
|
||||
{intl l="Activate total free shipping " d="colissimows.bo.default"}
|
||||
</label>
|
||||
|
||||
<div class="switch-small freeshipping-activation-ColissimoWs" 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="colissimows.freeshipping" name="freeshipping_colissimows"}
|
||||
<input type="checkbox" name="{$name}" value="true" {if $FREESHIPPING_ACTIVE}checked{assign var="isColissimoWsFreeShipping" value=1}{/if} />
|
||||
{/loop}
|
||||
</div>
|
||||
|
||||
{/form_field}
|
||||
</form>
|
||||
|
||||
{/form}
|
||||
</div>
|
||||
</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='colissimows.bo.default'}
|
||||
{intl l="The slices are ordered by maximum cart weight then by maximum cart price." d='colissimows.bo.default'}
|
||||
{intl l="If a cart matches multiple slices, it will take the last slice following that order." d='colissimows.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='colissimows.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='colissimows.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='colissimows.bo.default'}
|
||||
</div>
|
||||
|
||||
<div class="slices form-container">
|
||||
{loop type="module" name="colissimows_id" code="ColissimoWs"}
|
||||
{loop type="area" name="area_loop" module_id={$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='colissimows.bo.default' l="Area : "}</small> {$NAME}
|
||||
</label>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-md-3">{intl l="Weight up to ... kg" d='colissimows.bo.default'}</th>
|
||||
<th class="col-md-3">{intl l="Untaxed Price up to ... ($)" d='colissimows.bo.default'}</th>
|
||||
<th class="col-md-5">{intl l="Shipping Price ($)" d='colissimows.bo.default'}</th>
|
||||
<th class="col-md-1">{intl l="Actions" d='colissimows.bo.default'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{loop type="colissimows.price-slices" name="colissimows_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="max-weight" class="form-control js-slice-max-weight" value="{$MAX_WEIGHT}" data-old="{$MAX_WEIGHT}" />
|
||||
</th>
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="max-price" class="form-control js-slice-max-price" value="{$MAX_PRICE}" data-old="{$MAX_PRICE}" />
|
||||
</th>
|
||||
<th class="col-md-5">
|
||||
<input type="text" data-field="shipping" class="form-control js-slice-shipping" value="{$SHIPPING}" data-old="{$SHIPPING}" />
|
||||
</th>
|
||||
<th class="col-md-1">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="customdelivery" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs js-slice-save" title="{intl d='colissimows.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="customdelivery" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs js-slice-delete" title="{intl d='colissimows.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="colissimows" access="CREATE"}
|
||||
<tr class="js-slice-new" data-area="{$area_id}" data-id="0">
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="max-weight" class="form-control js-slice-max-weight" value="" />
|
||||
</th>
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="max-price" class="form-control js-slice-max-price" value="" />
|
||||
</th>
|
||||
<th class="col-md-5">
|
||||
<input type="text" data-field="shipping" class="form-control js-slice-shipping" value="" />
|
||||
</th>
|
||||
<th class="col-md-1">
|
||||
<a class="btn btn-default btn-xs js-slice-add" title="{intl d='colissimows.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='colissimows.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='colissimows.bo.default' l="manage shipping zones"}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{/elseloop}
|
||||
{/loop}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{include
|
||||
file = "includes/generic-warning-dialog.html"
|
||||
|
||||
dialog_id = "colissimows_dialog"
|
||||
dialog_title = {intl d='colissimows.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="max-weight" class="form-control js-slice-max-weight" value="<%=maxWeight %>" data-old="<%=maxWeight %>" />
|
||||
</th>
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="max-price" class="form-control js-slice-max-price" value="<%=maxPrice %>" data-old="<%=maxPrice %>" />
|
||||
</th>
|
||||
<th class="col-md-5">
|
||||
<input type="text" data-field="shipping" class="form-control js-slice-shipping" value="<%=shipping %>" data-old="<%=shipping %>" />
|
||||
</th>
|
||||
<th class="col-md-1">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="colissimows" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs js-slice-save" title="{intl d='colissimows.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="colissimows" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs js-slice-delete" title="{intl d='colissimows.bo.default' l='Delete this price slice'}" data-id="<%=id %>">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{* Download zip file if we have the name in the URL parameters *}
|
||||
{if $smarty.get.zip}
|
||||
<iframe style="width:100%;height:20px;border:none" src="{url path="/admin/module/colissimows/labels-zip/%hash" hash={$smarty.get.zip}}"></iframe>
|
||||
{/if}
|
||||
@@ -0,0 +1,34 @@
|
||||
{extends file="email-layout.tpl"}
|
||||
|
||||
{* Do not provide a "Open in browser" link *}
|
||||
{block name="browser"}{/block}
|
||||
{* No pre-header *}
|
||||
{block name="pre-header"}{/block}
|
||||
|
||||
{* Subject *}
|
||||
{block name="email-subject"}{intl l="Your order confirmation Nº %ref" ref={$order_ref}}{/block}
|
||||
|
||||
{* Title *}
|
||||
{block name="email-title"}{/block}
|
||||
|
||||
{* Content *}
|
||||
{block name="email-content"}
|
||||
|
||||
{loop type="customer" name="customer.politesse" id={$customer_id} current="0"}
|
||||
{assign var="customerRef" value=$REF}
|
||||
|
||||
<p>{if {$TITLE} == 9}{intl l="Dear Mr. "}
|
||||
{else}{intl l="Dear Ms. "}
|
||||
{/if}
|
||||
{$FIRSTNAME} {$LASTNAME},
|
||||
</p>
|
||||
|
||||
{/loop}
|
||||
|
||||
<p>{intl l="We are pleased to inform you that your order number"} {$order_ref} {intl l="has been shipped on"} {format_date date=$update_date output="date"} {intl l="with the tracking number"} <strong>{$package}</strong>.</p>
|
||||
|
||||
<p>{intl l='<a href="https://www.colissimo.fr/portail_colissimo/suivreResultat.do?parcelnumber=%package">Click here</a> to track your shipment. You can also enter the tracking number on <a href="https://www.laposte.fr/outils/suivre-vos-envois">https://www.laposte.fr/outils/suivre-vos-envois</a>' package=$package}</p>
|
||||
<p>{intl l='Thank you for your shopping with us and hope to see you soon on <a href="#">www.yourshop.com</a>'}</p>
|
||||
<p>{intl l="Your on-line store Manager"}<br/>
|
||||
{intl l="Your shop"}</p>
|
||||
{/block}
|
||||
@@ -0,0 +1 @@
|
||||
{intl l="Please display this message in HTML"}
|
||||
@@ -0,0 +1,381 @@
|
||||
{*************************************************************************************/
|
||||
/* 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. */
|
||||
/*************************************************************************************}
|
||||
|
||||
{* -- Define some stuff for Smarty ------------------------------------------ *}
|
||||
{assign var="store_name" value={config key="store_name"}}
|
||||
{assign var="store_description" value={config key="store_description"}}
|
||||
{assign var="store_phone" value={config key="store_phone"}}
|
||||
{assign var="store_email" value={config key="store_email"}}
|
||||
{assign var="store_description" value={config key="store_description"}}
|
||||
|
||||
{assign var="store_address1" value={config key="store_address1"}}
|
||||
{assign var="store_address2" value={config key="store_address2"}}
|
||||
{assign var="store_address3" value={config key="store_address3"}}
|
||||
{assign var="store_zipcode" value={config key="store_zipcode"}}
|
||||
{assign var="store_city" value={config key="store_city"}}
|
||||
{assign var="store_country_code" value={config key="store_country_code"}}
|
||||
|
||||
{loop type="country" name="store_country_name_loop" id="$store_country_code"}
|
||||
{assign var="store_country_name" value=$TITLE}
|
||||
{/loop}
|
||||
|
||||
{assign var="lang_code" value={lang attr="code"}}
|
||||
{assign var="lang_locale" value={lang attr="locale"}}
|
||||
{if not $store_name}{assign var="store_name" value={intl l='Thelia V2'}}{/if}
|
||||
{if not $store_description}{assign var="store_description" value={$store_name}}{/if}
|
||||
|
||||
{* Set the default translation domain, that will be used by {intl} when the 'd' parameter is not set *}
|
||||
{default_translation_domain domain='colissimows.bo.default'}
|
||||
|
||||
{* Declare assets directory, relative to template base directory *}
|
||||
{declare_assets directory='assets'}
|
||||
{literal}
|
||||
|
||||
<style>
|
||||
|
||||
body, table, .footer {
|
||||
font-size: 10px;
|
||||
color: #000;
|
||||
line-height: 12px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
text-align: center;
|
||||
margin-bottom: 10px;
|
||||
font-size: 10px;
|
||||
|
||||
}
|
||||
|
||||
.logo img {
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
tr {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.borders {
|
||||
border: 0.2px solid #9d9d9c;
|
||||
}
|
||||
|
||||
.titre-container {
|
||||
margin-bottom: 5mm;
|
||||
}
|
||||
|
||||
.titre-container .titre {
|
||||
font-size: 5mm;
|
||||
text-transform: uppercase;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 10px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
{
|
||||
hook name = "invoice.css"
|
||||
}
|
||||
|
||||
.goods tr td, .goods tr th {
|
||||
padding: 1mm;
|
||||
}
|
||||
|
||||
.recap p {
|
||||
margin: 2mm 0;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
{/literal}
|
||||
<page backtop="10mm" backleft="10mm" backright="10mm" backbottom="10mm">
|
||||
<page_header>
|
||||
|
||||
</page_header>
|
||||
|
||||
<page_footer>
|
||||
<div class="footer">
|
||||
{intl l="{$store_name} - {$store_address1} - Phone : {$store_phone}"}
|
||||
|
||||
<br>
|
||||
{intl l="{$store_description} - Legal numbers (ex: SIRET)"}
|
||||
<br>
|
||||
{intl l="Shop - Email : {$store_email} - Phone : {$store_phone}"}
|
||||
</div>
|
||||
</page_footer>
|
||||
|
||||
{$taxes = []}
|
||||
|
||||
{loop name="order.invoice" type="order" id=$order_id customer="*"}
|
||||
|
||||
{loop name="currency.order" type="currency" id=$CURRENCY}
|
||||
{assign "orderCurrency" $ISOCODE}
|
||||
{assign "orderCurrencySymbol" $SYMBOL}
|
||||
{/loop}
|
||||
|
||||
<table>
|
||||
<col style="width: 60%; padding: 0; margin: 0; padding-right: 2mm;">
|
||||
<col style="width: 40%; padding: 0; margin: 0; padding-left: 2mm;">
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<table>
|
||||
<col style="width: 100%; padding: 2mm;">
|
||||
<tr>
|
||||
<td class="borders titre">Sender</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="borders">
|
||||
<p>
|
||||
{$store_name}
|
||||
{$store_address1}<br>
|
||||
{if $store_address2!=null} {$store_address2} <br> {/if}
|
||||
{if $store_address3!=null} {$store_address3} <br> {/if}
|
||||
{$store_zipcode} {$store_city}<br>
|
||||
{$store_country}<br>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="titre-container">
|
||||
<div class="titre">Commercial Invoice</div>
|
||||
Date: {format_date date=$INVOICE_DATE output="date"}<br>
|
||||
Invoice number: {$REF}
|
||||
</div>
|
||||
<div class="bloc-adresse">
|
||||
<table>
|
||||
<col style="width: 50%; padding: 0; margin: 0; padding-right: 2mm;">
|
||||
<col style="width: 50%; padding: 0; margin: 0; padding-left: 2mm;">
|
||||
<tr>
|
||||
<td>
|
||||
<table>
|
||||
<col style="width: 100%; padding: 2mm;">
|
||||
<tr>
|
||||
<td class="borders titre">Delivery address</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="borders" height="92">
|
||||
<p>
|
||||
{loop type="order_address" name="delivery_address" id=$DELIVERY_ADDRESS}
|
||||
{loop type="title" name="order-invoice-address-title" id=$TITLE}{$LONG} {/loop} {$FIRSTNAME} {$LASTNAME}
|
||||
<br/>
|
||||
{if ! empty($COMPANY)}
|
||||
{$COMPANY}
|
||||
<br/>
|
||||
{/if}
|
||||
{$ADDRESS1} {$ADDRESS2} {$ADDRESS3}
|
||||
<br/>
|
||||
{$ZIPCODE} {$CITY}
|
||||
<br/>
|
||||
{loop type="country" name="country_delivery" id=$COUNTRY}{$TITLE}{/loop}
|
||||
<br/>
|
||||
{$PHONE}
|
||||
{/loop}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<table>
|
||||
<col style="width: 100%; padding: 2mm;">
|
||||
<tr>
|
||||
<td class="borders titre">Invoice address</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="borders" height="92">
|
||||
<p>
|
||||
{loop type="order_address" name="delivery_address" id=$INVOICE_ADDRESS}
|
||||
{loop type="title" name="order-invoice-address-title" id=$TITLE}{$LONG} {/loop}{$FIRSTNAME} {$LASTNAME}
|
||||
<br/>
|
||||
{if ! empty($COMPANY)}
|
||||
{$COMPANY}
|
||||
<br/>
|
||||
{/if}
|
||||
{$ADDRESS1} {$ADDRESS2} {$ADDRESS3}
|
||||
<br/>
|
||||
{$ZIPCODE} {$CITY}
|
||||
<br/>
|
||||
{loop type="country" name="country_delivery" id=$COUNTRY}{$TITLE}{/loop}
|
||||
<br/>
|
||||
{$PHONE} {$MOBILE}
|
||||
{/loop}
|
||||
<br/>
|
||||
{loop type="customer" name="customer_email" id=$CUSTOMER current="0"}
|
||||
{$EMAIL}
|
||||
{/loop}
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{$totalValue = $TOTAL_TAXED_AMOUNT - $POSTAGE_UNTAXED}
|
||||
{$itemCount = 0}
|
||||
|
||||
<!-- le tableau des produits -->
|
||||
<table class="goods" cellspacing="0" cellpadding="0" style="padding-top: 20px; width: 100%; margin-bottom: 0;">
|
||||
<col style="width: 40%;"/>
|
||||
<col style="width: 5%; "/>
|
||||
<col style="width: 10%;"/>
|
||||
<col style="width: 13%;"/>
|
||||
<col style="width: 15%;"/>
|
||||
<col style="width: 7%;"/>
|
||||
<col style="width: 10%;"/>
|
||||
|
||||
<tr class="table-1">
|
||||
<td class="borders titre">{intl l="Full Description of Goods"}</td>
|
||||
<td class="borders titre right">{intl l="Quantity"}</td>
|
||||
<td class="borders titre right">{intl l="Unit value"}</td>
|
||||
<td class="borders titre right">{intl l="Subtotal value"}</td>
|
||||
<td class="borders titre right">{intl l="Unit net weight"}</td>
|
||||
<td class="borders titre">{intl l="Country"}</td>
|
||||
<td class="borders titre">{intl l="Comm. code"}</td>
|
||||
</tr>
|
||||
|
||||
{loop type="order_product" name="order-products" order=$ID}
|
||||
{if $WAS_IN_PROMO == 1}
|
||||
{assign "realPrice" $PROMO_PRICE}
|
||||
{assign "realTax" $PROMO_PRICE_TAX}
|
||||
{assign "realTaxedPrice" $TAXED_PROMO_PRICE}
|
||||
{else}
|
||||
{assign "realPrice" $PRICE}
|
||||
{assign "realTax" $PRICE_TAX}
|
||||
{assign "realTaxedPrice" $TAXED_PRICE}
|
||||
{/if}
|
||||
|
||||
{if $realTax==null}
|
||||
{assign "realTax" 0}
|
||||
{/if}
|
||||
|
||||
{$taxes[{$TAX_RULE_TITLE}][] = $realTax * $QUANTITY}
|
||||
|
||||
<tr class="table-2">
|
||||
<td class="borders" style="line-height:14px;">
|
||||
|
||||
{$itemCount = $itemCount + $QUANTITY}
|
||||
|
||||
{$TITLE}
|
||||
{ifloop rel="combinations"}
|
||||
<br>
|
||||
{loop type="order_product_attribute_combination" name="combinations" order_product=$ID}
|
||||
- {$ATTRIBUTE_TITLE} - {$ATTRIBUTE_AVAILABILITY_TITLE}
|
||||
<br>
|
||||
{/loop}
|
||||
{/ifloop}
|
||||
|
||||
{loop type="marquage.orderproduct" name="gravures" order_product_id=$ID}
|
||||
{loop type="marquage.police" name="police" id=$POLICE}
|
||||
{$nomPolice = $NOM}
|
||||
{/loop}
|
||||
<br/>
|
||||
{intl l='Engraving '}:
|
||||
<br/>
|
||||
- {intl l='Font '}: {$nomPolice}
|
||||
<br/>
|
||||
- {intl l='Position '}: {$POSITION}
|
||||
<br/>
|
||||
- {intl l='Style '}: {$TYPE}
|
||||
<br/>
|
||||
- {intl l='Your text '}: {$TEXTE}
|
||||
{/loop}
|
||||
|
||||
</td>
|
||||
<td class="borders right">{$QUANTITY}</td>
|
||||
<td class="borders right">{format_money number=$realTaxedPrice symbol=$orderCurrencySymbol}</td>
|
||||
<td class="borders right">{format_money number={$realTaxedPrice * $QUANTITY} symbol=$orderCurrencySymbol}</td>
|
||||
<td class="borders right">{$WEIGHT}</td>
|
||||
<td class="borders">France</td>
|
||||
<td class="borders"> </td>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
</table>
|
||||
|
||||
{if $POSTAGE_TAX_RULE_TITLE}
|
||||
{$taxes[$POSTAGE_TAX_RULE_TITLE][] = $POSTAGE_TAX}
|
||||
{/if}
|
||||
|
||||
<table class="recap" align="right" cellspacing="0" cellpadding="0" style="width: 100%;">
|
||||
<col style="width: 40%; padding: 2mm;"/>
|
||||
<col style="width: 30%; padding: 2mm;"/>
|
||||
<col style="width: 30%; padding: 2mm;"/>
|
||||
<tr>
|
||||
<td style="border-right: 0.2px solid #9d9d9c;"> </td>
|
||||
<td class="borders">
|
||||
<p>Total declared value : {format_money number={$totalValue} symbol=$orderCurrency}</p>
|
||||
<p>Total units: {$itemCount}</p>
|
||||
</td>
|
||||
<td class="borders">
|
||||
<p>Total Net Weight: {$WEIGHT} kg(s)</p>
|
||||
{* Mettre une estimation du poids brut *}
|
||||
<p>Total Gross Weight: {$WEIGHT + 0} kg(s)</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="recap" align="right" cellspacing="0" cellpadding="0" style="width: 100%; margin-top: 10mm">
|
||||
<col style="width: 50%; padding: 2mm;"/>
|
||||
<col style="width: 50%; padding: 2mm;"/>
|
||||
<tr>
|
||||
<td>
|
||||
<p>Type of Export: permanent</p>
|
||||
<p>Reason for Export:</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Currency Code: {$orderCurrency}</p>
|
||||
<p>Terms of Trade: DAP</p>
|
||||
<p>City Name of liability:</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<table class="recap" align="right" cellspacing="0" cellpadding="0" style="width: 100%; margin-top: 10mm">
|
||||
<col style="width: 50%; padding: 2mm;"/>
|
||||
<col style="width: 50%; padding: 2mm;"/>
|
||||
<tr>
|
||||
<td>
|
||||
<p>Signature: {intl l=""}</p>
|
||||
<p>Airwaybill Number:</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>Company Stamp: {$store_name}</p>
|
||||
<p>{$store_zipcode} {$store_city}</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
{/loop}
|
||||
</page>
|
||||
Reference in New Issue
Block a user