Quelques modifs de style front-office
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/cache/
|
||||||
|
/log/
|
||||||
BIN
local/media/images/carousel/img_2866-9.jpg
Normal file
|
After Width: | Height: | Size: 124 KiB |
BIN
local/media/images/carousel/img_3268-6.jpg
Normal file
|
After Width: | Height: | Size: 67 KiB |
BIN
local/media/images/carousel/img_4834-7.jpg
Normal file
|
After Width: | Height: | Size: 94 KiB |
BIN
local/media/images/carousel/img_6025-8.jpg
Normal file
|
After Width: | Height: | Size: 103 KiB |
BIN
local/media/images/product/abricot_106-14.jpg
Normal file
|
After Width: | Height: | Size: 203 KiB |
BIN
local/media/images/product/abricot_400-13.jpg
Normal file
|
After Width: | Height: | Size: 146 KiB |
@@ -1,23 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
|
|
||||||
<config xmlns="http://thelia.net/schema/dic/config"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
|
||||||
|
|
||||||
<forms>
|
|
||||||
<form name="betterpassword.configuration" class="BetterPassword\Form\ConfigForm" />
|
|
||||||
</forms>
|
|
||||||
|
|
||||||
<services>
|
|
||||||
<service id="betterpassword.listener" class="BetterPassword\EventListeners\FormHandler">
|
|
||||||
<argument type="service" id="request_stack"/>
|
|
||||||
<tag name="kernel.event_subscriber"/>
|
|
||||||
</service>
|
|
||||||
</services>
|
|
||||||
|
|
||||||
<hooks>
|
|
||||||
<hook id="betterpassword.configuration.hook" class="BetterPassword\Hook\HookManager">
|
|
||||||
<tag name="hook.event_listener" event="module.configuration" type="back" method="onModuleConfigure" />
|
|
||||||
</hook>
|
|
||||||
</hooks>
|
|
||||||
</config>
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?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="betterpassword.config" path="/admin/module/betterpassword/configure" methods="post">
|
|
||||||
<default key="_controller">BetterPassword\Controller\ConfigureController::configure</default>
|
|
||||||
</route>
|
|
||||||
</routes>
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
<?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: 03/03/2019 18:30
|
|
||||||
*/
|
|
||||||
namespace BetterPassword\Controller;
|
|
||||||
|
|
||||||
use BetterPassword\BetterPassword;
|
|
||||||
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 ConfigureController extends BaseAdminController
|
|
||||||
{
|
|
||||||
public function configure()
|
|
||||||
{
|
|
||||||
if (null !== $response = $this->checkAuth(AdminResources::MODULE, 'betterpassword', AccessManager::UPDATE)) {
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
$configurationForm = $this->createForm('betterpassword.configuration');
|
|
||||||
$message = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
$form = $this->validateForm($configurationForm);
|
|
||||||
|
|
||||||
// Get the form field values
|
|
||||||
$data = $form->getData();
|
|
||||||
|
|
||||||
foreach ($data as $name => $value) {
|
|
||||||
if (is_array($value)) {
|
|
||||||
foreach ($value as $locale => $text) {
|
|
||||||
BetterPassword::setConfigValue($name, $text, $locale);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
BetterPassword::setConfigValue($name, $value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Log configuration modification
|
|
||||||
$this->adminLogAppend(
|
|
||||||
"betterpassword.configuration.message",
|
|
||||||
AccessManager::UPDATE,
|
|
||||||
"Better Password configuration updated"
|
|
||||||
);
|
|
||||||
|
|
||||||
// Redirect to the success URL,
|
|
||||||
if ($this->getRequest()->get('save_mode') == 'stay') {
|
|
||||||
// If we have to stay on the same page, redisplay the configuration page/
|
|
||||||
$url = '/admin/module/BetterPassword';
|
|
||||||
} else {
|
|
||||||
// If we have to close the page, go back to the module back-office page.
|
|
||||||
$url = '/admin/modules';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->generateRedirect(URL::getInstance()->absoluteUrl($url));
|
|
||||||
} catch (FormValidationException $ex) {
|
|
||||||
$message = $this->createStandardFormValidationErrorMessage($ex);
|
|
||||||
} catch (\Exception $ex) {
|
|
||||||
$message = $ex->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->setupFormErrorContext(
|
|
||||||
$this->getTranslator()->trans("BetterPassword configuration", [], BetterPassword::DOMAIN_NAME),
|
|
||||||
$message,
|
|
||||||
$configurationForm,
|
|
||||||
$ex
|
|
||||||
);
|
|
||||||
|
|
||||||
return $this->generateRedirect(URL::getInstance()->absoluteUrl('/admin/module/BetterPassword'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,104 +0,0 @@
|
|||||||
<?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: 03/03/2019 17:38
|
|
||||||
*/
|
|
||||||
namespace BetterPassword\EventListeners;
|
|
||||||
|
|
||||||
use BetterPassword\BetterPassword;
|
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|
||||||
use Symfony\Component\HttpFoundation\RequestStack;
|
|
||||||
use Symfony\Component\Validator\Constraints\Callback;
|
|
||||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
|
||||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
|
||||||
use Thelia\Core\Event\TheliaEvents;
|
|
||||||
use Thelia\Core\Event\TheliaFormEvent;
|
|
||||||
use Thelia\Core\HttpFoundation\Request;
|
|
||||||
use Thelia\Core\Translation\Translator;
|
|
||||||
|
|
||||||
class FormHandler implements EventSubscriberInterface
|
|
||||||
{
|
|
||||||
/** @var RequestStack */
|
|
||||||
protected $requestStack;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FormHandler constructor.
|
|
||||||
* @param RequestStack $requestStack
|
|
||||||
*/
|
|
||||||
public function __construct(RequestStack $requestStack)
|
|
||||||
{
|
|
||||||
$this->requestStack = $requestStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function changeCreatePasswordVerification(TheliaFormEvent $event)
|
|
||||||
{
|
|
||||||
$this->changePasswordVerification($event, 'password');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function changeUpdatePasswordVerification(TheliaFormEvent $event)
|
|
||||||
{
|
|
||||||
$this->changePasswordVerification($event, 'password');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getLocale()
|
|
||||||
{
|
|
||||||
/** @var Request $request */
|
|
||||||
$request = $this->requestStack->getCurrentRequest();
|
|
||||||
|
|
||||||
return $request->getSession()->getLang()->getLocale();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function changePasswordVerification(TheliaFormEvent $event, $fieldName)
|
|
||||||
{
|
|
||||||
$formBuilder = $event->getForm()->getFormBuilder();
|
|
||||||
|
|
||||||
$passwordField = $formBuilder->get($fieldName);
|
|
||||||
|
|
||||||
$options = $passwordField->getOptions();
|
|
||||||
$type = $passwordField->getType()->getName();
|
|
||||||
|
|
||||||
$options['constraints'] = [
|
|
||||||
new NotBlank(),
|
|
||||||
new Callback([ "methods" => [[ $this, "checkPasswordValidity" ]]])
|
|
||||||
];
|
|
||||||
|
|
||||||
$options['label_attr']['help'] = BetterPassword::getConfigValue('password_requirements', '', $this->getLocale());
|
|
||||||
|
|
||||||
$formBuilder->add($fieldName, $type, $options);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function checkPasswordValidity($value, ExecutionContextInterface $context)
|
|
||||||
{
|
|
||||||
$expression = BetterPassword::getConfigValue('password_expression', null);
|
|
||||||
|
|
||||||
if (null !== $expression && ! preg_match("/$expression/", $value)) {
|
|
||||||
$context->addViolation(
|
|
||||||
Translator::getInstance()->trans(
|
|
||||||
"Your password does not match the requirements : %requirement_text",
|
|
||||||
[
|
|
||||||
'%requirement_text' => BetterPassword::getConfigValue('password_requirements', '', $this->getLocale())
|
|
||||||
],
|
|
||||||
BetterPassword::DOMAIN_NAME
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getSubscribedEvents()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
TheliaEvents::FORM_AFTER_BUILD . ".thelia_customer_create" => ['changeCreatePasswordVerification', 128],
|
|
||||||
TheliaEvents::FORM_AFTER_BUILD . ".thelia_customer_password_update" => ['changeUpdatePasswordVerification', 128]
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
<?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: 03/03/2019 18:26
|
|
||||||
*/
|
|
||||||
namespace BetterPassword\Form;
|
|
||||||
|
|
||||||
use BetterPassword\BetterPassword;
|
|
||||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
|
||||||
use Thelia\Core\Translation\Translator;
|
|
||||||
use Thelia\Form\BaseForm;
|
|
||||||
|
|
||||||
class ConfigForm extends BaseForm
|
|
||||||
{
|
|
||||||
protected function buildForm()
|
|
||||||
{
|
|
||||||
$translator = Translator::getInstance();
|
|
||||||
|
|
||||||
$this->formBuilder
|
|
||||||
->add(
|
|
||||||
BetterPassword::VAR_REGULAR_EXPRESSION,
|
|
||||||
'text',
|
|
||||||
[
|
|
||||||
'constraints' => [
|
|
||||||
new NotBlank(),
|
|
||||||
],
|
|
||||||
'label' => $translator->trans('Regular expression to match', [], BetterPassword::DOMAIN_NAME),
|
|
||||||
'label_attr' => [
|
|
||||||
'help' => $this->translator->trans(
|
|
||||||
'This is the regular expression the passwords must match.',
|
|
||||||
[],
|
|
||||||
BetterPassword::DOMAIN_NAME
|
|
||||||
)
|
|
||||||
]
|
|
||||||
]
|
|
||||||
)->add(
|
|
||||||
BetterPassword::VAR_PASSWORD_REQUIREMENTS,
|
|
||||||
'collection',
|
|
||||||
[
|
|
||||||
'type' => 'text',
|
|
||||||
'allow_add' => true,
|
|
||||||
'allow_delete' => true,
|
|
||||||
'label' => $translator->trans('Password requirements description', [], BetterPassword::DOMAIN_NAME),
|
|
||||||
'label_attr' => [
|
|
||||||
'help' => $this->translator->trans(
|
|
||||||
'Please enter the password requirements description that will be displayed to your customers.',
|
|
||||||
[],
|
|
||||||
BetterPassword::DOMAIN_NAME
|
|
||||||
)
|
|
||||||
],
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
<?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: 03/03/2019 18:14
|
|
||||||
*/
|
|
||||||
namespace BetterPassword\Hook;
|
|
||||||
|
|
||||||
use BetterPassword\BetterPassword;
|
|
||||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
|
||||||
use Thelia\Core\Hook\BaseHook;
|
|
||||||
use Thelia\Model\Lang;
|
|
||||||
use Thelia\Model\LangQuery;
|
|
||||||
|
|
||||||
class HookManager extends BaseHook
|
|
||||||
{
|
|
||||||
public function onModuleConfigure(HookRenderEvent $event)
|
|
||||||
{
|
|
||||||
$langs = LangQuery::create()->findByActive(true);
|
|
||||||
|
|
||||||
$requirements = [];
|
|
||||||
|
|
||||||
/** @var Lang $lang */
|
|
||||||
foreach ($langs as $lang) {
|
|
||||||
$requirements[$lang->getLocale()] =
|
|
||||||
BetterPassword::getConfigValue(
|
|
||||||
BetterPassword::VAR_PASSWORD_REQUIREMENTS, '', $lang->getLocale()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$event->add(
|
|
||||||
$this->render(
|
|
||||||
'betterpassword/module-configuration.html',
|
|
||||||
[
|
|
||||||
BetterPassword::VAR_REGULAR_EXPRESSION => BetterPassword::getConfigValue(BetterPassword::VAR_REGULAR_EXPRESSION) ,
|
|
||||||
BetterPassword::VAR_PASSWORD_REQUIREMENTS => $requirements
|
|
||||||
]
|
|
||||||
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return array(
|
|
||||||
'Ce module vous permet d\'indiquer une expression régulière (cf. <a href="https://regex101.com">https://regex101.com</a>) que les mots de passe de vos clients devront satisfaire. Vous devrez aussi indiquer une description des contraintes à satisfaire. Cette description sera affiché à vos clients.' => 'In this module you can define a regular expression (see <a href="https://regex101.com">https://regex101.com</a>) your customer passwords must match. You must also enter a description of the requirements. This description will be displayed to your customers.',
|
|
||||||
'Demander des mots de passe sécurisés' => 'Require secure customer passwords',
|
|
||||||
);
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return array(
|
|
||||||
'Ce module vous permet d\'indiquer une expression régulière (cf. <a href="https://regex101.com">https://regex101.com</a>) que les mots de passe de vos clients devront satisfaire. Vous devrez aussi indiquer une description des contraintes à satisfaire. Cette description sera affiché à vos clients.' => 'Ce module vous permet d\'indiquer une expression régulière (cf. <a href="https://regex101.com">https://regex101.com</a>) que les mots de passe de vos clients devront satisfaire. Vous devrez aussi indiquer une description des contraintes à satisfaire. Cette description sera affiché à vos clients.',
|
|
||||||
'Demander des mots de passe sécurisés' => 'Demander des mots de passe sécurisés',
|
|
||||||
);
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return array(
|
|
||||||
'BetterPassword configuration' => 'BetterPassword configuration',
|
|
||||||
'Password requirements description' => 'Password requirements description',
|
|
||||||
'Please enter the password requirements description that will be displayed to your customers.' => 'Please enter the password requirements description that will be displayed to your customers.',
|
|
||||||
'Regular expression to match' => 'Regular expression to match',
|
|
||||||
'This is the regular expression the passwords must match.' => 'This is the regular expression the passwords must match.',
|
|
||||||
'Your password does not match the requirements : %requirement_text' => 'Your password does not match the requirements : %requirement_text',
|
|
||||||
);
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return array(
|
|
||||||
'BetterPassword configuration' => 'Configuration BetterPassowrd',
|
|
||||||
'Password requirements description' => 'Description des exigences',
|
|
||||||
'Please enter the password requirements description that will be displayed to your customers.' => 'Décrivez ici les exigences que les mots de passe de vos clients doivent satisfaire.',
|
|
||||||
'Regular expression to match' => 'Expression régulière à satisfaire',
|
|
||||||
'This is the regular expression the passwords must match.' => 'Il s\'agit de l\'expression régulière que les mots de passe de vos clients doivent satisfaire',
|
|
||||||
'Your password does not match the requirements : %requirement_text' => 'Votre mot de passe ne satisfait pas les conditions requises : %requirement_text',
|
|
||||||
);
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
# Better Password
|
|
||||||
|
|
||||||
Ce module permet de contrôler que les mots de passe saisis par les clients respectent une expression régulière.
|
|
||||||
|
|
||||||
Ceci permet de forcer vos clients à utiliser des mots de passe plus sécurisés.
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
<div class="row">
|
|
||||||
<div class="col-md-12 general-block-decorator">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12 title title-without-tabs">
|
|
||||||
{intl d='betterpassword.bo.default' l="Demander des mots de passe sécurisés"}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
{form name="betterpassword.configuration"}
|
|
||||||
<form action="{url path="/admin/module/betterpassword/configure"}" method="post">
|
|
||||||
{form_hidden_fields form=$form}
|
|
||||||
|
|
||||||
{include file = "includes/inner-form-toolbar.html"
|
|
||||||
hide_flags = true
|
|
||||||
page_url = "{url path='/admin/module/BetterPassword'}"
|
|
||||||
close_url = "{url path='/admin/modules'}"
|
|
||||||
}
|
|
||||||
|
|
||||||
{if $form_error}
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<div class="alert alert-danger">{$form_error_message}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<p>
|
|
||||||
{intl d='betterpassword.bo.default' l='Ce module vous permet d\'indiquer une expression régulière (cf. <a href="https://regex101.com">https://regex101.com</a>) que les mots de passe de vos clients devront satisfaire. Vous devrez aussi indiquer une description des contraintes à satisfaire. Cette description sera affiché à vos clients.'}
|
|
||||||
<p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-6">
|
|
||||||
{render_form_field field="password_expression" value=$password_expression}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-12">
|
|
||||||
{form_field field="password_requirements"}
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label">
|
|
||||||
{$label}<span class="required">*</span>
|
|
||||||
</label>
|
|
||||||
{loop type="lang" name="lang" active=1}
|
|
||||||
{form_field field="password_requirements" value_key=$LOCALE}
|
|
||||||
<div class="input-group" style="margin-bottom: 2px">
|
|
||||||
<input {form_field_attributes form=$form field="password_requirements" value_key=$LOCALE value=$password_requirements[$LOCALE]}>
|
|
||||||
<span class="input-group-addon">
|
|
||||||
<img src="{image file="assets/img/flags/{$CODE}.png"}" alt="{$TITLE}"
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
{/loop}
|
|
||||||
<span class="help-block">{$label_attr.help nofilter}</span>
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
{/form}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
<language>en_US</language>
|
<language>en_US</language>
|
||||||
<language>fr_FR</language>
|
<language>fr_FR</language>
|
||||||
</languages>
|
</languages>
|
||||||
<version>2.3.4</version>
|
<version>2.3.5</version>
|
||||||
<author>
|
<author>
|
||||||
<name>Manuel Raynaud, Franck Allimant</name>
|
<name>Manuel Raynaud, Franck Allimant</name>
|
||||||
<email>manu@raynaud.io, franck@cqfdev.fr</email>
|
<email>manu@raynaud.io, franck@cqfdev.fr</email>
|
||||||
|
|||||||
@@ -1,76 +0,0 @@
|
|||||||
{javascripts file='assets/js/bootstrap-switch/bootstrap-switch.js'}
|
|
||||||
<script src='{$asset_url}'></script>
|
|
||||||
{/javascripts}
|
|
||||||
|
|
||||||
<script>
|
|
||||||
$(document).ready(function() {
|
|
||||||
$(".freeshipping-activation-IciRelais").bootstrapSwitch();
|
|
||||||
$(".freeshipping-activation-IciRelais").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();
|
|
||||||
})
|
|
||||||
.success(function() {
|
|
||||||
if (is_checked) {
|
|
||||||
$('#config-btn-0').removeClass('disabled');
|
|
||||||
$('#table-prices-icirelais').hide('slow');
|
|
||||||
} else {
|
|
||||||
$('#config-btn-0').addClass('disabled');
|
|
||||||
$('#table-prices-icirelais').show('slow');
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.fail(function(jqXHR, textStatus, errorThrown){
|
|
||||||
$("#loading-event").remove();
|
|
||||||
$('#freeshipping-failed-body').html(jqXHR.responseJSON.error);
|
|
||||||
$("#freeshipping-failed").modal("show");
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
checkboxes = [{loop name="icirelais.get.checkboxes.names" type="icirelais.orders"}"{$REF|replace:'.':'-'}",{/loop}];
|
|
||||||
$("#check-all-but").click( function(ev) {
|
|
||||||
checkboxes.forEach(function(entry) {
|
|
||||||
$("#"+entry).prop('checked', true);
|
|
||||||
});
|
|
||||||
ev.preventDefault();
|
|
||||||
});
|
|
||||||
$("#uncheck-all-but").click( function(ev) {
|
|
||||||
checkboxes.forEach(function(entry) {
|
|
||||||
$("#"+entry).prop('checked', false);
|
|
||||||
});
|
|
||||||
ev.preventDefault();
|
|
||||||
});
|
|
||||||
$("#reverse-all-but").click( function(ev) {
|
|
||||||
checkboxes.forEach(function(entry) {
|
|
||||||
var box=$("#"+entry);
|
|
||||||
box.prop('checked', !box.is(":checked"));
|
|
||||||
});
|
|
||||||
ev.preventDefault();
|
|
||||||
});
|
|
||||||
$("button[name=save_mode]").click(function() {
|
|
||||||
var value = $("input[name='exportexaprintselection[new_status_id]']:checked").val();
|
|
||||||
if(value == "sent") {
|
|
||||||
checkboxes.forEach(function(entry) {
|
|
||||||
var box=$("#"+entry);
|
|
||||||
if(box.is(":checked")) {
|
|
||||||
var row= box.parents("tr"); // get first tr parent
|
|
||||||
row.hide('slow', function() {
|
|
||||||
row.remove();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
{if ! empty($current_tab)}
|
|
||||||
$('.nav-tabs a[href="#{$current_tab}"]').trigger("click");
|
|
||||||
{/if}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@@ -1,400 +0,0 @@
|
|||||||
<div class="row">
|
|
||||||
<!-- Errors -->
|
|
||||||
{loop name="checkrights" type="icirelais.check.rights"}
|
|
||||||
<div class="alert alert-danger">
|
|
||||||
<p>{$ERRMES} {$ERRFILE} | {intl d='icirelais.ai' l="Please change the access rights"}.</p>
|
|
||||||
</div>
|
|
||||||
{/loop}
|
|
||||||
</div>
|
|
||||||
{elseloop rel="checkrights"}
|
|
||||||
{loop type="currency" name="curncy" default_only=1}
|
|
||||||
{$currencySymbol = $SYMBOL}
|
|
||||||
{/loop}
|
|
||||||
|
|
||||||
{* Calc tab selection *}
|
|
||||||
{assign var="tab" value="0"}
|
|
||||||
{if isset($smarty.get.current_tab)}
|
|
||||||
{if $smarty.get.current_tab eq "configure_export_exaprint"}
|
|
||||||
{assign var="tab" value="1"}
|
|
||||||
{/if}
|
|
||||||
{if $smarty.get.current_tab eq "price_slices_tab"}
|
|
||||||
{assign var="tab" value="2"}
|
|
||||||
{/if}
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<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 "0"}active{/if}"><a data-toggle="tab" href="#export_exaprint">{intl d='icirelais.ai' l="Export EXAPRINT file"}</a></li>
|
|
||||||
<li class="{if $tab eq "1"}active{/if}"><a data-toggle="tab" href="#configure_export_exaprint">{intl d='icirelais.ai' l="Configure EXAPRINT file"}</a></li>
|
|
||||||
<li class="{if $tab eq "2"}active{/if}"><a data-toggle="tab" href="#prices_slices_tab">{intl d='icirelais.ai' l="Price slices"}</a></li>
|
|
||||||
</ul>
|
|
||||||
<br/>
|
|
||||||
<div class="tab-content">
|
|
||||||
<div id="export_exaprint" class="tab-pane {if $tab eq "0"}active{/if} form-container">
|
|
||||||
{ifloop rel="list.icirelais.orders"}
|
|
||||||
{form name="icirelais.selection"}
|
|
||||||
<form method="post" action="{url path="/admin/module/icirelais/exportgo"}">
|
|
||||||
<div class="panel panel-default">
|
|
||||||
|
|
||||||
<div class="panel-heading clearfix">
|
|
||||||
{intl d='icirelais.ai' l="Change orders status after export"}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="panel-body">
|
|
||||||
{form_field form=$form field="new_status_id"}
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<label for="nochange">{intl d='icirelais.ai' l="Do not change"}</label>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<input type="radio" id="nochange" name="{$name}" value="nochange" {if $data eq "nochange"}checked{/if} />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<label for="processing">{intl d='icirelais.ai' l="Processing"}</label>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<input type="radio" id="processing" name="{$name}" value="processing" {if $data eq "processing"}checked{/if} />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<label for="sent">{intl d='icirelais.ai' l="Sent"}</label>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<input type="radio" id="sent" name="{$name}" value="sent" {if $data eq "sent"}checked{/if} />
|
|
||||||
<span>{intl d='icirelais.ai' l="If you choose this option, the exported orders would not be available on this page anymore"}</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
{/form_field}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{form_hidden_fields form=$form}
|
|
||||||
|
|
||||||
<table class="table table-striped table-condensed">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
{intl d='icirelais.ai' l="REF"}
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
{intl d='icirelais.ai' l="Date"}
|
|
||||||
</th>
|
|
||||||
<th class="text-right">
|
|
||||||
{intl d='icirelais.ai' l="Total taxed amount"}
|
|
||||||
</th>
|
|
||||||
<th class="text-center">
|
|
||||||
{intl d='icirelais.ai' l="Package warranty"}
|
|
||||||
</th>
|
|
||||||
<th class="text-center">
|
|
||||||
{intl d='icirelais.ai' l="Export"}
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody id="icirelais-orders-form-selection-container">
|
|
||||||
{loop name="list.icirelais.orders" type="icirelais.orders"}
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<label for="{$REF|replace:'.':'-'}">
|
|
||||||
{$REF}
|
|
||||||
</label>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{format_date date=$CREATE_DATE output="datetime"}
|
|
||||||
</td>
|
|
||||||
<td class="text-right">
|
|
||||||
{loop name="list.icirelais.getcurrency" type="currency" id=$CURRENCY}
|
|
||||||
{format_money number=$TOTAL_TAXED_AMOUNT symbol=$SYMBOL}
|
|
||||||
{/loop}
|
|
||||||
</td>
|
|
||||||
{assign var="assurref" value="`$REF|replace:'.':'-'`-assur"}
|
|
||||||
{form_field form=$form field=$assurref}
|
|
||||||
<td>
|
|
||||||
<input type="checkbox" name="{$name}" value="true" class="form-control" />
|
|
||||||
</td>
|
|
||||||
{/form_field}
|
|
||||||
{form_field form=$form field=$REF|replace:'.':'-'}
|
|
||||||
<td>
|
|
||||||
<input type="checkbox" name="{$name}" id="{$label_attr.for}" value=="true" class="form-control"/>
|
|
||||||
</td>
|
|
||||||
{/form_field}
|
|
||||||
</tr>
|
|
||||||
{/loop}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<button type="submit" name="save_mode" value="stay" class="form-submit-button btn btn-sm btn-primary" title="{intl d='icirelais.ai' l='Export'}">{intl d='icirelais.ai' l='Export'} <span class="glyphicon glyphicon-ok"></span></button>
|
|
||||||
|
|
||||||
<div class="pull-right">
|
|
||||||
<button type="button" id="check-all-but" title="{intl d='icirelais.ai' l="Check all"}" class="btn btn-xs btn-default">{intl d='icirelais.ai' l="Check all"}</button>
|
|
||||||
<button type="button" id="uncheck-all-but" title="{intl d='icirelais.ai' l="Uncheck all"}" class="btn btn-xs btn-default">{intl d='icirelais.ai' l="Uncheck all"}</button>
|
|
||||||
<button type="button" id="reverse-all-but" title="{intl d='icirelais.ai' l="Reverse selection"}" class="btn btn-xs btn-default">{intl d='icirelais.ai' l="Reverse selection"}</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
{/form}
|
|
||||||
{/ifloop}
|
|
||||||
|
|
||||||
{elseloop rel='list.icirelais.orders'}
|
|
||||||
<div class="alert alert-warning">
|
|
||||||
{intl l="There are currently no pending order to ship by IciRelais."}
|
|
||||||
</div>
|
|
||||||
{/elseloop}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="configure_export_exaprint" class="tab-pane {if $tab eq "1"}active{/if} form-container">
|
|
||||||
{form name="icirelais.export"}
|
|
||||||
<form action="{url path="/admin/module/icirelais/export"}" method="POST" {form_enctype form=$form}>
|
|
||||||
{form_hidden_fields form=$form}
|
|
||||||
|
|
||||||
{if $form_error}
|
|
||||||
<div class="alert alert-danger">{$form_error_message}</div>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{form_field form=$form field="name"}
|
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
|
||||||
<label for="{$label_attr.for}" class="control-label">
|
|
||||||
{$label} :
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<input type="text" id="{$label_attr.for}" name="{$name}" value="{$value}" placeholder="{intl d='icirelais.ai' l='name'}" class="form-control" required/>
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field="addr"}
|
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
|
||||||
<label for="{$label_attr.for}" class="control-label">
|
|
||||||
{$label} :
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<input type="text" id="{$label_attr.for}" name="{$name}" value="{$value}" placeholder="{intl d='icirelais.ai' l='addr'}" class="form-control" required/>
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field="addr2"}
|
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
|
||||||
<label for="{$label_attr.for}" class="control-label">
|
|
||||||
{$label} :
|
|
||||||
</label>
|
|
||||||
<input type="text" id="{$label_attr.for}" name="{$name}" value="{$value}" placeholder="{intl d='icirelais.ai' l='addr2'}" class="form-control"/>
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field="zipcode"}
|
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
|
||||||
<label for="{$label_attr.for}" class="control-label">
|
|
||||||
{$label} :
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<input type="text" id="{$label_attr.for}" name="{$name}" value="{$value}" placeholder="{intl d='icirelais.ai' l='zipcode'}" class="form-control" {literal}pattern="((2[A-B])|(\d{2}))\d{3}"{/literal} required/>
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field="city"}
|
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
|
||||||
<label for="{$label_attr.for}" class="control-label">
|
|
||||||
{$label} :
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<input type="text" id="{$label_attr.for}" name="{$name}" value="{$value}" placeholder="{intl d='icirelais.ai' l='city'}" class="form-control" required/>
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field="tel"}
|
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
|
||||||
<label for="{$label_attr.for}" class="control-label">
|
|
||||||
{$label} :
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<input type="text" id="{$label_attr.for}" name="{$name}" value="{$value}" placeholder="{intl d='icirelais.ai' l='tel'}" {literal}pattern="0([1-5]|[8-9]){1}\d{8}"{/literal} class="form-control" required/>
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field="mobile"}
|
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
|
||||||
<label for="{$label_attr.for}" class="control-label">
|
|
||||||
{$label} :
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<input type="text" id="{$label_attr.for}" name="{$name}" value="{$value}" placeholder="{intl d='icirelais.ai' l='mobile'}" {literal}pattern="0[6-7]{1}\d{8}"{/literal} class="form-control" required/>
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field="mail"}
|
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
|
||||||
<label for="{$label_attr.for}" class="control-label">
|
|
||||||
{$label} :
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<input type="email" id="{$label_attr.for}" name="{$name}" value="{$value}" placeholder="{intl d='icirelais.ai' l='mail'}" class="form-control" required/>
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field="expcode"}
|
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
|
||||||
<label for="{$label_attr.for}" class="control-label">
|
|
||||||
{$label} :
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<input type="text" id="{$label_attr.for}" name="{$name}" value="{$value}" placeholder="{intl d='icirelais.ai' l='expcode'}" class="form-control" {literal}pattern="\d{8}"{/literal}/>
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<button type="submit" name="save_mode" value="stay" class="form-submit-button btn btn-sm btn-default btn-success" title="{intl d='icirelais.ai' l='Save changes'}">{intl d='icirelais.ai' l='Save changes'} <span class="glyphicon glyphicon-ok"></span></button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
{/form}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="prices_slices_tab" class="tab-pane {if $tab eq "2"}active{/if} form-container">
|
|
||||||
|
|
||||||
<div class="alert alert-info">
|
|
||||||
<p>{intl d='icirelais.ai' l="Ici Relais Module allows you to send your products in France."}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="general-block-decorator">
|
|
||||||
|
|
||||||
<!-- checkbox free shipping -->
|
|
||||||
{assign var="isIcirelaisFreeShipping" value=0}
|
|
||||||
{form name="icirelais.freeshipping.form"}
|
|
||||||
<form action="{url path="/admin/module/icirelais/freeshipping"}" method="post" id="freeshippingform">
|
|
||||||
{form_hidden_fields form=$form}
|
|
||||||
|
|
||||||
{form_field form=$form field="freeshipping"}
|
|
||||||
<label>
|
|
||||||
{$label}
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<div class="switch-small freeshipping-activation-IciRelais" data-id="0" 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>">
|
|
||||||
<input type="checkbox" name="{$name}" value="true" {if $data}checked{assign var="isIcirelaisFreeShipping" value=1}{/if} />
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
</form>
|
|
||||||
{/form}
|
|
||||||
<div id="table-prices-icirelais" {if $isIcirelaisFreeShipping eq 1} style="display:none;" {/if}>
|
|
||||||
<!-- Prices editing -->
|
|
||||||
{* -- Add price slice confirmation dialog ----------------------------------- *}
|
|
||||||
{loop type="area" name="list area" backend_context=true}
|
|
||||||
|
|
||||||
{capture name="create_dialog"}
|
|
||||||
<input type="hidden" name="operation" value="add"/>
|
|
||||||
<input type="hidden" name="area" value="{$ID}" />
|
|
||||||
<label for="weight_{$ID}">{intl d='icirelais.ai' l="Weight up to ... (kg)"}</label>
|
|
||||||
<input type="text" id="weight_{$ID}" name="weight" value="1" class="form-control" pattern="\d+\.?\d*" required/>
|
|
||||||
<label for="price_{$ID}">{intl d='icirelais.ai' l="Price (%sym)" sym=$currencySymbol}</label>
|
|
||||||
<input type="text" id="price_{$ID}" name="price" value="1" class="form-control" pattern="\d+\.?\d*" required/>
|
|
||||||
{/capture}
|
|
||||||
|
|
||||||
{include
|
|
||||||
file = "includes/generic-create-dialog.html"
|
|
||||||
|
|
||||||
dialog_id = "price_slice_create_dialog_{$ID}"
|
|
||||||
dialog_title = {intl d='icirelais.ai' l="Create a price slice"}
|
|
||||||
dialog_body = {$smarty.capture.create_dialog nofilter}
|
|
||||||
|
|
||||||
form_action= {url path='/admin/module/icirelais/prices'}
|
|
||||||
|
|
||||||
dialog_ok_label = {intl d='icirelais.ai' l="Create"}
|
|
||||||
dialog_cancel_label = {intl d='icirelais.ai' l="Cancel"}
|
|
||||||
}
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-striped table-condensed table-left-aligned">
|
|
||||||
<caption class="clearfix">
|
|
||||||
{intl d='icirelais.ai' l="Area : "}{$NAME}
|
|
||||||
{loop type="auth" name="can_create" role="ADMIN" module="icirelais" access="CREATE"}
|
|
||||||
<a class="btn btn-default btn-primary pull-right" title="{intl d='icirelais.ai' l='Create a new price slice'}" href="#price_slice_create_dialog_{$ID}" data-toggle="modal">
|
|
||||||
<span class="glyphicon glyphicon-plus"></span>
|
|
||||||
</a>
|
|
||||||
{/loop}
|
|
||||||
</caption>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th class="col-md-3">{intl d='icirelais.ai' l="Weight up to ... (kg)"}</th>
|
|
||||||
<th class="col-md-5">{intl d='icirelais.ai' l="Price (%sym)" sym=$currencySymbol}</th>
|
|
||||||
<th class="col-md-1">{intl d='icirelais.ai' l="Actions"}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
|
|
||||||
{loop type="icirelais" name="icirelais" area=$ID}
|
|
||||||
{* -- EDIT price slice confirmation dialog ----------------------------------- *}
|
|
||||||
|
|
||||||
{capture name="edit_dialog"}
|
|
||||||
<input type="hidden" name="operation" value="add"/>
|
|
||||||
<input type="hidden" name="area" value="{$ID}"/>
|
|
||||||
<input type="hidden" name="weight" value="{$MAX_WEIGHT}"/>
|
|
||||||
<label for="price_edit_{$ID}_{$MAX_WEIGHT}">{intl d='icirelais.ai' l='Price (%sym)' sym=$currencySymbol}</label>
|
|
||||||
<input type="text" id="price_edit_{$ID}_{$MAX_WEIGHT}" class="form-control" name="price" value="{$PRICE}" pattern="\d+\.?\d*" required/>
|
|
||||||
{/capture}
|
|
||||||
|
|
||||||
{$dialog_id = "{$ID}_{$MAX_WEIGHT|replace:'.':'-'}"}
|
|
||||||
|
|
||||||
{include
|
|
||||||
file = "includes/generic-confirm-dialog.html"
|
|
||||||
dialog_id = "price_slice_edit_dialog_{$dialog_id}"
|
|
||||||
dialog_title = {intl d='icirelais.ai' l='Edit a price slice'}
|
|
||||||
dialog_message = {$smarty.capture.edit_dialog nofilter}
|
|
||||||
|
|
||||||
form_action= {url path="/admin/module/icirelais/prices"}
|
|
||||||
dialog_ok_label = {intl d='icirelais.ai' l="Edit"}
|
|
||||||
dialog_cancel_label = {intl d='icirelais.ai' l="Cancel"}
|
|
||||||
}
|
|
||||||
|
|
||||||
{* -- Delete price slice confirmation dialog ----------------------------------- *}
|
|
||||||
|
|
||||||
{capture name="delete_dialog"}
|
|
||||||
<input type="hidden" name="operation" value="delete"/>
|
|
||||||
<input type="hidden" name="area" value="{$ID}"/>
|
|
||||||
<input type="hidden" name="weight" value="{$MAX_WEIGHT}"/>
|
|
||||||
{intl d='icirelais.ai' l="Do you really want to delete this slice ?"}
|
|
||||||
{/capture}
|
|
||||||
|
|
||||||
{include
|
|
||||||
file = "includes/generic-confirm-dialog.html"
|
|
||||||
|
|
||||||
dialog_id = "price_slice_delete_dialog_{$dialog_id}"
|
|
||||||
dialog_title = {intl d='icirelais.ai' l="Delete a price slice"}
|
|
||||||
dialog_message = {$smarty.capture.delete_dialog nofilter}
|
|
||||||
|
|
||||||
form_action= {url path="/admin/module/icirelais/prices"}
|
|
||||||
dialog_ok_label = {intl d='icirelais.ai' l="Delete"}
|
|
||||||
dialog_cancel_label = {intl d='icirelais.ai' l="Cancel"}
|
|
||||||
}
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>{$MAX_WEIGHT}</td>
|
|
||||||
<td>{$PRICE}</td>
|
|
||||||
<td>
|
|
||||||
<div class="btn-group">
|
|
||||||
{loop type="auth" name="can_change" role="ADMIN" module="icirelais" access="UPDATE"}
|
|
||||||
<a class="btn btn-default btn-xs" title="{intl d='icirelais.ai' l='Edit this price slice'}" href="#price_slice_edit_dialog_{$ID}_{$MAX_WEIGHT|replace:'.':'-'}" data-toggle="modal">
|
|
||||||
<span class="glyphicon glyphicon-edit"></span>
|
|
||||||
</a>
|
|
||||||
<a class="btn btn-default btn-xs" title="{intl d='icirelais.ai' l='Delete this price slice'}" href="#price_slice_delete_dialog_{$ID}_{$MAX_WEIGHT|replace:'.':'-'}" data-toggle="modal">
|
|
||||||
<span class="glyphicon glyphicon-trash"></span>
|
|
||||||
</a>
|
|
||||||
{/loop}
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{/loop}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
{/loop}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/elseloop}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
{loop name="tracking" type="icirelais.urltracking" ref=$REF}
|
|
||||||
<br/>
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading">
|
|
||||||
{intl l="Export EXAPRINT file of this order"}
|
|
||||||
</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
|
|
||||||
{form name="icirelais.selection"}
|
|
||||||
<form action="{url path="/admin/module/icirelais/exportgo"}">
|
|
||||||
{form_hidden_fields form=$form}
|
|
||||||
{form_field form=$form field="new_status_id"}
|
|
||||||
<input type="hidden" name="{$name}" value="nochange" />
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field={$REF|replace:'.':'-'}}
|
|
||||||
<input type="hidden" name="{$name}" value="true" />
|
|
||||||
{/form_field}
|
|
||||||
<button type="submit" name="export_order" value="stay" class="form-submit-button btn btn-sm btn-default" title="{intl l='Export'}">{intl l='Export'} <span class="glyphicon glyphicon-ok"></span></button>
|
|
||||||
</form>
|
|
||||||
{/form}
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
Suivi du colis: <a href="{$URL}">ici</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/loop}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
<?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="delivery.ici" class="IciRelais\Loop\IciRelaisDelivery" />
|
|
||||||
<loop name="address.ici" class="IciRelais\Loop\IciRelaisAddress" />
|
|
||||||
<loop name="icirelais" class="IciRelais\Loop\IciRelaisPrice" />
|
|
||||||
<loop name="icirelais.relais.around" class="IciRelais\Loop\IciRelaisAround" />
|
|
||||||
<loop name="icirelais.check.rights" class="IciRelais\Loop\CheckRightsLoop" />
|
|
||||||
<loop name="icirelais.orders" class="IciRelais\Loop\IciRelaisOrders" />
|
|
||||||
<loop name="icirelais.urltracking" class="IciRelais\Loop\IciRelaisUrlTracking" />
|
|
||||||
</loops>
|
|
||||||
|
|
||||||
<forms>
|
|
||||||
<form name="icirelais.export" class="IciRelais\Form\ExportExaprintForm"/>
|
|
||||||
<form name="icirelais.selection" class="IciRelais\Form\ExportExaprintSelection" />
|
|
||||||
<form name="icirelais.freeshipping.form" class="IciRelais\Form\FreeShipping" />
|
|
||||||
|
|
||||||
</forms>
|
|
||||||
|
|
||||||
<commands>
|
|
||||||
<!--
|
|
||||||
<command class="MyModule\Command\MySuperCommand" />
|
|
||||||
-->
|
|
||||||
</commands>
|
|
||||||
|
|
||||||
<templateDirectives>
|
|
||||||
<!-- Sample definition
|
|
||||||
<templateDirectives class="MyModule\Directive\MyTemplateDirective" name="my_filter"/>
|
|
||||||
-->
|
|
||||||
</templateDirectives>
|
|
||||||
|
|
||||||
|
|
||||||
<services>
|
|
||||||
<service id="hook.order.module" class="IciRelais\Listener\SetDeliveryModule" scope="request">
|
|
||||||
<argument type="service" id="request"/>
|
|
||||||
<tag name="kernel.event_subscriber"/>
|
|
||||||
</service>
|
|
||||||
<service id="send.icirelais.mail" class="IciRelais\Listener\SendEMail" scope="request">
|
|
||||||
<argument type="service" id="thelia.parser" />
|
|
||||||
<argument type="service" id="mailer"/>
|
|
||||||
<tag name="kernel.event_subscriber"/>
|
|
||||||
</service>
|
|
||||||
</services>
|
|
||||||
|
|
||||||
</config>
|
|
||||||
@@ -1,254 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://exapaq.pickup-services.com/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://exapaq.pickup-services.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
|
|
||||||
<wsdl:types>
|
|
||||||
<s:schema elementFormDefault="qualified" targetNamespace="http://exapaq.pickup-services.com/">
|
|
||||||
<s:element name="GetPudoList">
|
|
||||||
<s:complexType>
|
|
||||||
<s:sequence>
|
|
||||||
<s:element minOccurs="0" maxOccurs="1" name="address" type="s:string" />
|
|
||||||
<s:element minOccurs="0" maxOccurs="1" name="zipCode" type="s:string" />
|
|
||||||
<s:element minOccurs="0" maxOccurs="1" name="city" type="s:string" />
|
|
||||||
|
|
||||||
<s:element minOccurs="0" maxOccurs="1" name="request_id" type="s:string" />
|
|
||||||
<s:element minOccurs="0" maxOccurs="1" name="date_from" type="s:string" />
|
|
||||||
</s:sequence>
|
|
||||||
</s:complexType>
|
|
||||||
</s:element>
|
|
||||||
<s:element name="GetPudoListResponse">
|
|
||||||
<s:complexType>
|
|
||||||
<s:sequence>
|
|
||||||
<s:element minOccurs="0" maxOccurs="1" name="GetPudoListResult">
|
|
||||||
|
|
||||||
<s:complexType mixed="true">
|
|
||||||
<s:sequence>
|
|
||||||
<s:any />
|
|
||||||
</s:sequence>
|
|
||||||
</s:complexType>
|
|
||||||
</s:element>
|
|
||||||
</s:sequence>
|
|
||||||
</s:complexType>
|
|
||||||
</s:element>
|
|
||||||
|
|
||||||
<s:element name="GetPudoDetails">
|
|
||||||
<s:complexType>
|
|
||||||
<s:sequence>
|
|
||||||
<s:element minOccurs="0" maxOccurs="1" name="pudo_id" type="s:string" />
|
|
||||||
</s:sequence>
|
|
||||||
</s:complexType>
|
|
||||||
</s:element>
|
|
||||||
<s:element name="GetPudoDetailsResponse">
|
|
||||||
<s:complexType>
|
|
||||||
|
|
||||||
<s:sequence>
|
|
||||||
<s:element minOccurs="0" maxOccurs="1" name="GetPudoDetailsResult">
|
|
||||||
<s:complexType mixed="true">
|
|
||||||
<s:sequence>
|
|
||||||
<s:any />
|
|
||||||
</s:sequence>
|
|
||||||
</s:complexType>
|
|
||||||
</s:element>
|
|
||||||
</s:sequence>
|
|
||||||
|
|
||||||
</s:complexType>
|
|
||||||
</s:element>
|
|
||||||
</s:schema>
|
|
||||||
</wsdl:types>
|
|
||||||
<wsdl:message name="GetPudoListSoapIn">
|
|
||||||
<wsdl:part name="parameters" element="tns:GetPudoList" />
|
|
||||||
</wsdl:message>
|
|
||||||
<wsdl:message name="GetPudoListSoapOut">
|
|
||||||
<wsdl:part name="parameters" element="tns:GetPudoListResponse" />
|
|
||||||
|
|
||||||
</wsdl:message>
|
|
||||||
<wsdl:message name="GetPudoDetailsSoapIn">
|
|
||||||
<wsdl:part name="parameters" element="tns:GetPudoDetails" />
|
|
||||||
</wsdl:message>
|
|
||||||
<wsdl:message name="GetPudoDetailsSoapOut">
|
|
||||||
<wsdl:part name="parameters" element="tns:GetPudoDetailsResponse" />
|
|
||||||
</wsdl:message>
|
|
||||||
<wsdl:message name="GetPudoListHttpGetIn">
|
|
||||||
<wsdl:part name="address" type="s:string" />
|
|
||||||
|
|
||||||
<wsdl:part name="zipCode" type="s:string" />
|
|
||||||
<wsdl:part name="city" type="s:string" />
|
|
||||||
<wsdl:part name="request_id" type="s:string" />
|
|
||||||
<wsdl:part name="date_from" type="s:string" />
|
|
||||||
</wsdl:message>
|
|
||||||
<wsdl:message name="GetPudoListHttpGetOut">
|
|
||||||
<wsdl:part name="Body" />
|
|
||||||
</wsdl:message>
|
|
||||||
<wsdl:message name="GetPudoDetailsHttpGetIn">
|
|
||||||
|
|
||||||
<wsdl:part name="pudo_id" type="s:string" />
|
|
||||||
</wsdl:message>
|
|
||||||
<wsdl:message name="GetPudoDetailsHttpGetOut">
|
|
||||||
<wsdl:part name="Body" />
|
|
||||||
</wsdl:message>
|
|
||||||
<wsdl:message name="GetPudoListHttpPostIn">
|
|
||||||
<wsdl:part name="address" type="s:string" />
|
|
||||||
<wsdl:part name="zipCode" type="s:string" />
|
|
||||||
<wsdl:part name="city" type="s:string" />
|
|
||||||
|
|
||||||
<wsdl:part name="request_id" type="s:string" />
|
|
||||||
<wsdl:part name="date_from" type="s:string" />
|
|
||||||
</wsdl:message>
|
|
||||||
<wsdl:message name="GetPudoListHttpPostOut">
|
|
||||||
<wsdl:part name="Body" />
|
|
||||||
</wsdl:message>
|
|
||||||
<wsdl:message name="GetPudoDetailsHttpPostIn">
|
|
||||||
<wsdl:part name="pudo_id" type="s:string" />
|
|
||||||
</wsdl:message>
|
|
||||||
|
|
||||||
<wsdl:message name="GetPudoDetailsHttpPostOut">
|
|
||||||
<wsdl:part name="Body" />
|
|
||||||
</wsdl:message>
|
|
||||||
<wsdl:portType name="exapaqSoap">
|
|
||||||
<wsdl:operation name="GetPudoList">
|
|
||||||
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get all pudos nearest to a postal address</wsdl:documentation>
|
|
||||||
<wsdl:input message="tns:GetPudoListSoapIn" />
|
|
||||||
<wsdl:output message="tns:GetPudoListSoapOut" />
|
|
||||||
|
|
||||||
</wsdl:operation>
|
|
||||||
<wsdl:operation name="GetPudoDetails">
|
|
||||||
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get properties of pudo by its ID</wsdl:documentation>
|
|
||||||
<wsdl:input message="tns:GetPudoDetailsSoapIn" />
|
|
||||||
<wsdl:output message="tns:GetPudoDetailsSoapOut" />
|
|
||||||
</wsdl:operation>
|
|
||||||
</wsdl:portType>
|
|
||||||
<wsdl:portType name="exapaqHttpGet">
|
|
||||||
|
|
||||||
<wsdl:operation name="GetPudoList">
|
|
||||||
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get all pudos nearest to a postal address</wsdl:documentation>
|
|
||||||
<wsdl:input message="tns:GetPudoListHttpGetIn" />
|
|
||||||
<wsdl:output message="tns:GetPudoListHttpGetOut" />
|
|
||||||
</wsdl:operation>
|
|
||||||
<wsdl:operation name="GetPudoDetails">
|
|
||||||
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get properties of pudo by its ID</wsdl:documentation>
|
|
||||||
<wsdl:input message="tns:GetPudoDetailsHttpGetIn" />
|
|
||||||
|
|
||||||
<wsdl:output message="tns:GetPudoDetailsHttpGetOut" />
|
|
||||||
</wsdl:operation>
|
|
||||||
</wsdl:portType>
|
|
||||||
<wsdl:portType name="exapaqHttpPost">
|
|
||||||
<wsdl:operation name="GetPudoList">
|
|
||||||
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get all pudos nearest to a postal address</wsdl:documentation>
|
|
||||||
<wsdl:input message="tns:GetPudoListHttpPostIn" />
|
|
||||||
<wsdl:output message="tns:GetPudoListHttpPostOut" />
|
|
||||||
|
|
||||||
</wsdl:operation>
|
|
||||||
<wsdl:operation name="GetPudoDetails">
|
|
||||||
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get properties of pudo by its ID</wsdl:documentation>
|
|
||||||
<wsdl:input message="tns:GetPudoDetailsHttpPostIn" />
|
|
||||||
<wsdl:output message="tns:GetPudoDetailsHttpPostOut" />
|
|
||||||
</wsdl:operation>
|
|
||||||
</wsdl:portType>
|
|
||||||
<wsdl:binding name="exapaqSoap" type="tns:exapaqSoap">
|
|
||||||
|
|
||||||
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
|
|
||||||
<wsdl:operation name="GetPudoList">
|
|
||||||
<soap:operation soapAction="http://exapaq.pickup-services.com/Exapaq/mypudofull.asmx/GetPudoList" style="document" />
|
|
||||||
<wsdl:input>
|
|
||||||
<soap:body use="literal" />
|
|
||||||
</wsdl:input>
|
|
||||||
<wsdl:output>
|
|
||||||
<soap:body use="literal" />
|
|
||||||
</wsdl:output>
|
|
||||||
|
|
||||||
</wsdl:operation>
|
|
||||||
<wsdl:operation name="GetPudoDetails">
|
|
||||||
<soap:operation soapAction="http://exapaq.pickup-services.com/Exapaq/mypudofull.asmx/GetPudoDetails" style="document" />
|
|
||||||
<wsdl:input>
|
|
||||||
<soap:body use="literal" />
|
|
||||||
</wsdl:input>
|
|
||||||
<wsdl:output>
|
|
||||||
<soap:body use="literal" />
|
|
||||||
</wsdl:output>
|
|
||||||
|
|
||||||
</wsdl:operation>
|
|
||||||
</wsdl:binding>
|
|
||||||
<wsdl:binding name="exapaqSoap12" type="tns:exapaqSoap">
|
|
||||||
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
|
|
||||||
<wsdl:operation name="GetPudoList">
|
|
||||||
<soap12:operation soapAction="http://exapaq.pickup-services.com/Exapaq/mypudofull.asmx/GetPudoList" style="document" />
|
|
||||||
<wsdl:input>
|
|
||||||
<soap12:body use="literal" />
|
|
||||||
</wsdl:input>
|
|
||||||
|
|
||||||
<wsdl:output>
|
|
||||||
<soap12:body use="literal" />
|
|
||||||
</wsdl:output>
|
|
||||||
</wsdl:operation>
|
|
||||||
<wsdl:operation name="GetPudoDetails">
|
|
||||||
<soap12:operation soapAction="http://exapaq.pickup-services.com/Exapaq/mypudofull.asmx/GetPudoDetails" style="document" />
|
|
||||||
<wsdl:input>
|
|
||||||
<soap12:body use="literal" />
|
|
||||||
</wsdl:input>
|
|
||||||
|
|
||||||
<wsdl:output>
|
|
||||||
<soap12:body use="literal" />
|
|
||||||
</wsdl:output>
|
|
||||||
</wsdl:operation>
|
|
||||||
</wsdl:binding>
|
|
||||||
<wsdl:binding name="exapaqHttpGet" type="tns:exapaqHttpGet">
|
|
||||||
<http:binding verb="GET" />
|
|
||||||
<wsdl:operation name="GetPudoList">
|
|
||||||
<http:operation location="/Exapaq/mypudofull.asmx/Exapaq/mypudofull.asmx/GetPudoList" />
|
|
||||||
|
|
||||||
<wsdl:input>
|
|
||||||
<http:urlEncoded />
|
|
||||||
</wsdl:input>
|
|
||||||
<wsdl:output>
|
|
||||||
<mime:content part="Body" type="text/xml" />
|
|
||||||
</wsdl:output>
|
|
||||||
</wsdl:operation>
|
|
||||||
<wsdl:operation name="GetPudoDetails">
|
|
||||||
<http:operation location="/Exapaq/mypudofull.asmx/GetPudoDetails" />
|
|
||||||
|
|
||||||
<wsdl:input>
|
|
||||||
<http:urlEncoded />
|
|
||||||
</wsdl:input>
|
|
||||||
<wsdl:output>
|
|
||||||
<mime:content part="Body" type="text/xml" />
|
|
||||||
</wsdl:output>
|
|
||||||
</wsdl:operation>
|
|
||||||
</wsdl:binding>
|
|
||||||
<wsdl:binding name="exapaqHttpPost" type="tns:exapaqHttpPost">
|
|
||||||
|
|
||||||
<http:binding verb="POST" />
|
|
||||||
<wsdl:operation name="GetPudoList">
|
|
||||||
<http:operation location="/Exapaq/mypudofull.asmx/GetPudoList" />
|
|
||||||
<wsdl:input>
|
|
||||||
<mime:content type="application/x-www-form-urlencoded" />
|
|
||||||
</wsdl:input>
|
|
||||||
<wsdl:output>
|
|
||||||
<mime:content part="Body" type="text/xml" />
|
|
||||||
</wsdl:output>
|
|
||||||
|
|
||||||
</wsdl:operation>
|
|
||||||
<wsdl:operation name="GetPudoDetails">
|
|
||||||
<http:operation location="/Exapaq/mypudofull.asmx/GetPudoDetails" />
|
|
||||||
<wsdl:input>
|
|
||||||
<mime:content type="application/x-www-form-urlencoded" />
|
|
||||||
</wsdl:input>
|
|
||||||
<wsdl:output>
|
|
||||||
<mime:content part="Body" type="text/xml" />
|
|
||||||
</wsdl:output>
|
|
||||||
|
|
||||||
</wsdl:operation>
|
|
||||||
</wsdl:binding>
|
|
||||||
<wsdl:service name="exapaq">
|
|
||||||
<wsdl:port name="exapaqSoap" binding="tns:exapaqSoap">
|
|
||||||
<soap:address location="http://exapaq.pickup-services.com/Exapaq/mypudofull.asmx" />
|
|
||||||
</wsdl:port>
|
|
||||||
<wsdl:port name="exapaqSoap12" binding="tns:exapaqSoap12">
|
|
||||||
<soap12:address location="http://exapaq.pickup-services.com/Exapaq/mypudofull.asmx" />
|
|
||||||
</wsdl:port>
|
|
||||||
|
|
||||||
<wsdl:port name="exapaqHttpGet" binding="tns:exapaqHttpGet">
|
|
||||||
<http:address location="http://exapaq.pickup-services.com/Exapaq/mypudofull.asmx" />
|
|
||||||
</wsdl:port>
|
|
||||||
<wsdl:port name="exapaqHttpPost" binding="tns:exapaqHttpPost">
|
|
||||||
<http:address location="http://exapaq.pickup-services.com/Exapaq/mypudofull.asmx" />
|
|
||||||
</wsdl:port>
|
|
||||||
</wsdl:service>
|
|
||||||
</wsdl:definitions>
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module xmlns="http://thelia.net/schema/dic/module"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_1.xsd">
|
|
||||||
|
|
||||||
<fullnamespace>IciRelais\IciRelais</fullnamespace>
|
|
||||||
<descriptive locale="en_US">
|
|
||||||
<title>IciRelais\IciRelais</title>
|
|
||||||
</descriptive>
|
|
||||||
|
|
||||||
<descriptive locale="fr_FR">
|
|
||||||
<title>Livraison en point ICI relais par Exapaq</title>
|
|
||||||
<subtitle>Livraison 24/ 48H parmi 5 000 relais en France</subtitle>
|
|
||||||
<description>[[<![CDATA[
|
|
||||||
<p>Choisissez la livraison sans contrainte avec ICI relais !</p>
|
|
||||||
<p>Faites-vous livrer dans l’un de nos 5 000 commerces de proximité disponibles sur toute la France. Vous avez la liberté de choisir le commerce qui vous convient le mieux : près de chez vous ou encore près de votre travail, et d’aller y retirer votre colis 7/7 jours (*).</p>
|
|
||||||
<p>Dès que votre colis est livré dans l’espace ICI relais préalablement choisi, vous êtes automatiquement prévenus par email ou SMS de sa disponibilité.<br/>
|
|
||||||
Si vous ne pouvez pas le récupérer le jour même, pas de souci, votre colis reste disponible jusqu’à 9 jours !</p>
|
|
||||||
<p>ICI relais c’est l’assurance d’une livraison de qualité avec :
|
|
||||||
<ul>
|
|
||||||
<li>Une livraison toute France en 24/48 H</li>
|
|
||||||
<li>Un choix parmi plus de 5 000 commerces répartis sur toute la France et rigoureusement sélectionnés (situation géographique, capacité de stockage, horaires d’ouverture…)</li>
|
|
||||||
<li>Un suivi détaillé (tracing) de votre colis disponible 24/24H sur www.icirelais.com</li>
|
|
||||||
<li>Une alerte (email / SMS) dès l’arrivée de votre colis dans l’espace ICI relais</li>
|
|
||||||
<li>Des outils innovants en phase avec la tendance de mobilité : des applications ICI relais pour Iphone et Android.</li>
|
|
||||||
</ul></p>
|
|
||||||
]]>
|
|
||||||
</description>
|
|
||||||
</descriptive>
|
|
||||||
<languages>
|
|
||||||
<language>en_US</language>
|
|
||||||
<language>fr_FR</language>
|
|
||||||
</languages>
|
|
||||||
<version>1.1</version>
|
|
||||||
<author>
|
|
||||||
<name>Thelia</name>
|
|
||||||
<email>info@thelia.net</email>
|
|
||||||
</author>
|
|
||||||
<type>delivery</type>
|
|
||||||
<thelia>2.1.0</thelia>
|
|
||||||
<stability>beta</stability>
|
|
||||||
</module>
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{"1":{"_info":"area 1 : France","slices":{"0.25":"5.16","0.5":"5.59","1":5.89,"2":6.19,"3":6.51,"5":7.15,"6":7.52,"7":7.89,"8":8.26,"9":8.63,"10":9,"11":9.4,"12":9.79,"13":10.2,"14":10.62,"15":11.05,"16":11.55,"17":12.05,"18":12.55,"19":13.05,"20":13.55}},"2":{"slices":[]}}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
<?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="icirelais.searchroute" path="/module/icirelais/{zipcode}/{city}" methods="get">
|
|
||||||
<default key="_controller">IciRelais\Controller\SearchCityController::searchAction</default>
|
|
||||||
<requirement key="zipcode">\d{5}</requirement>
|
|
||||||
<requirement key="city">.+</requirement>
|
|
||||||
</route>
|
|
||||||
|
|
||||||
<route id="icirelais.export" path="/admin/module/icirelais/exportgo" methods="post">
|
|
||||||
<default key="_controller">IciRelais\Controller\Export::exportfile</default>
|
|
||||||
</route>
|
|
||||||
|
|
||||||
<route id="icirelais.export.exaprint" path="/admin/module/icirelais/export" methods="post">
|
|
||||||
<default key="_controller">IciRelais\Controller\ExportExaprint::export</default>
|
|
||||||
</route>
|
|
||||||
|
|
||||||
<route id="icirelais.edit.prices" path="/admin/module/icirelais/prices" methods="post">
|
|
||||||
<default key="_controller">IciRelais\Controller\EditPrices::editprices</default>
|
|
||||||
</route>
|
|
||||||
|
|
||||||
<route id="icirelais.edit.freeshipping" path="/admin/module/icirelais/freeshipping" methods="post">
|
|
||||||
<default key="_controller">IciRelais\Controller\FreeShipping::set</default>
|
|
||||||
</route>
|
|
||||||
</routes>
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<database defaultIdMethod="native" name="thelia" namespace="IciRelais\Model">
|
|
||||||
<table name="order_address_icirelais">
|
|
||||||
<column name="id" primaryKey="true" required="true" type="INTEGER" />
|
|
||||||
<column name="code" size="10" type="VARCHAR" required="true" />
|
|
||||||
<foreign-key foreignTable="order_address" name="fk_order_address_icirelais_order_address_id" onDelete="CASCADE" onUpdate="CASCADE">
|
|
||||||
<reference foreign="id" local="id" />
|
|
||||||
</foreign-key>
|
|
||||||
</table>
|
|
||||||
<table name="address_icirelais">
|
|
||||||
<column name="id" primaryKey="true" required="true" type="INTEGER" />
|
|
||||||
<column name="title_id" required="true" type="INTEGER" />
|
|
||||||
<column name="company" size="255" type="VARCHAR" />
|
|
||||||
<column name="firstname" required="true" size="255" type="VARCHAR" />
|
|
||||||
<column name="lastname" required="true" size="255" type="VARCHAR" />
|
|
||||||
<column name="address1" required="true" size="255" type="VARCHAR" />
|
|
||||||
<column name="address2" required="true" size="255" type="VARCHAR" />
|
|
||||||
<column name="address3" required="true" size="255" type="VARCHAR" />
|
|
||||||
<column name="zipcode" required="true" size="10" type="VARCHAR" />
|
|
||||||
<column name="city" required="true" size="255" type="VARCHAR" />
|
|
||||||
<column name="country_id" required="true" type="INTEGER" />
|
|
||||||
<column name="code" required="true" size="10" type="VARCHAR" />
|
|
||||||
<foreign-key foreignTable="customer_title" name="fk_address_icirelais_customer_title_id" onDelete="RESTRICT" onUpdate="RESTRICT">
|
|
||||||
<reference foreign="id" local="title_id" />
|
|
||||||
</foreign-key>
|
|
||||||
<foreign-key foreignTable="country" name="fk_address_country_id" onDelete="RESTRICT" onUpdate="RESTRICT">
|
|
||||||
<reference foreign="id" local="country_id" />
|
|
||||||
</foreign-key>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<table name="icirelais_freeshipping">
|
|
||||||
<column name="id" primaryKey="true" autoIncrement="true" required="true" type="INTEGER" />
|
|
||||||
<column name="active" required="true" type="BOOLEAN" />
|
|
||||||
<behavior name="timestampable" />
|
|
||||||
</table>
|
|
||||||
<external-schema filename="/home/benjamin/dev/thelia2/local/config/schema.xml" referenceOnly="true" />
|
|
||||||
</database>
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
<?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 IciRelais\Controller;
|
|
||||||
use IciRelais\IciRelais;
|
|
||||||
use Thelia\Model\AreaQuery;
|
|
||||||
use Thelia\Controller\Admin\BaseAdminController;
|
|
||||||
use Thelia\Core\Security\Resource\AdminResources;
|
|
||||||
use Thelia\Core\Security\AccessManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class EditPrices
|
|
||||||
* @package IciRelais\Controller
|
|
||||||
* @author Thelia <info@thelia.net>
|
|
||||||
*/
|
|
||||||
class EditPrices extends BaseAdminController
|
|
||||||
{
|
|
||||||
|
|
||||||
public function editprices()
|
|
||||||
{
|
|
||||||
if (null !== $response = $this->checkAuth(array(AdminResources::MODULE), array('IciRelais'), AccessManager::UPDATE)) {
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
// Get data & treat
|
|
||||||
$post = $this->getRequest();
|
|
||||||
$operation = $post->get('operation');
|
|
||||||
$area = $post->get('area');
|
|
||||||
$weight = $post->get('weight');
|
|
||||||
$price = $post->get('price');
|
|
||||||
if( preg_match("#^add|delete$#", $operation) &&
|
|
||||||
preg_match("#^\d+$#", $area) &&
|
|
||||||
preg_match("#^\d+\.?\d*$#", $weight)
|
|
||||||
) {
|
|
||||||
// check if area exists in db
|
|
||||||
$exists = AreaQuery::create()
|
|
||||||
->findPK($area);
|
|
||||||
if ($exists !== null) {
|
|
||||||
$json_path= __DIR__."/../".IciRelais::JSON_PRICE_RESOURCE;
|
|
||||||
|
|
||||||
if (is_readable($json_path)) {
|
|
||||||
$json_data = json_decode(file_get_contents($json_path),true);
|
|
||||||
} elseif (!file_exists($json_path)) {
|
|
||||||
$json_data = array();
|
|
||||||
} else {
|
|
||||||
throw new \Exception("Can't read IciRelais".IciRelais::JSON_PRICE_RESOURCE.". Please change the rights on the file.");
|
|
||||||
}
|
|
||||||
if((float) $weight > 0 && $operation == "add"
|
|
||||||
&& preg_match("#\d+\.?\d*#", $price)) {
|
|
||||||
$json_data[$area]['slices'][$weight] = $price;
|
|
||||||
} elseif ($operation == "delete") {
|
|
||||||
if(isset($json_data[$area]['slices'][$weight]))
|
|
||||||
unset($json_data[$area]['slices'][$weight]);
|
|
||||||
} else {
|
|
||||||
throw new \Exception("Weight must be superior to 0");
|
|
||||||
}
|
|
||||||
ksort($json_data[$area]['slices']);
|
|
||||||
if ((file_exists($json_path) ?is_writable($json_path):is_writable(__DIR__."/../"))) {
|
|
||||||
$file = fopen($json_path, 'w');
|
|
||||||
fwrite($file, json_encode($json_data));;
|
|
||||||
fclose($file);
|
|
||||||
} else {
|
|
||||||
throw new \Exception("Can't write IciRelais".IciRelais::JSON_PRICE_RESOURCE.". Please change the rights on the file.");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new \Exception("Area not found");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new \ErrorException("Arguments are missing or invalid");
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->redirectToRoute("admin.module.configure",array(),
|
|
||||||
array ( 'module_code'=>"IciRelais",
|
|
||||||
'current_tab'=>"price_slices_tab",
|
|
||||||
'_controller' => 'Thelia\\Controller\\Admin\\ModuleController::configureAction'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,325 +0,0 @@
|
|||||||
<?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 IciRelais\Controller;
|
|
||||||
|
|
||||||
use IciRelais\Form\ExportExaprintSelection;
|
|
||||||
use IciRelais\IciRelais;
|
|
||||||
use IciRelais\Loop\IciRelaisOrders;
|
|
||||||
use Thelia\Controller\Admin\BaseAdminController;
|
|
||||||
use Thelia\Core\Event\Order\OrderEvent;
|
|
||||||
use Thelia\Core\Event\TheliaEvents;
|
|
||||||
use Thelia\Core\Translation\Translator;
|
|
||||||
|
|
||||||
use IciRelais\Model\OrderAddressIcirelaisQuery;
|
|
||||||
use Thelia\Core\HttpFoundation\Response;
|
|
||||||
use Thelia\Log\Tlog;
|
|
||||||
use Thelia\Model\AddressQuery;
|
|
||||||
use Thelia\Model\OrderAddressQuery;
|
|
||||||
use Thelia\Model\OrderQuery;
|
|
||||||
use Thelia\Model\OrderProductQuery;
|
|
||||||
use Thelia\Model\CustomerQuery;
|
|
||||||
|
|
||||||
use Thelia\Core\Security\Resource\AdminResources;
|
|
||||||
use Thelia\Core\Security\AccessManager;
|
|
||||||
use Thelia\Model\OrderStatus;
|
|
||||||
use Thelia\Model\OrderStatusQuery;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class Export
|
|
||||||
* @package IciRelais\Controller
|
|
||||||
* @author Thelia <info@thelia.net>
|
|
||||||
* @original_author etienne roudeix <eroudeix@openstudio.fr>
|
|
||||||
*/
|
|
||||||
class Export extends BaseAdminController
|
|
||||||
{
|
|
||||||
// FONCTION POUR LE FICHIER D'EXPORT BY Maitre eroudeix@openstudio.fr
|
|
||||||
// extended by bperche9@gmail.com
|
|
||||||
public static function harmonise($value, $type, $len)
|
|
||||||
{
|
|
||||||
switch ($type) {
|
|
||||||
case 'numeric':
|
|
||||||
$value = (string)$value;
|
|
||||||
if (mb_strlen($value, 'utf8') > $len) {
|
|
||||||
$value = substr($value, 0, $len);
|
|
||||||
}
|
|
||||||
for ($i = mb_strlen($value, 'utf8'); $i < $len; $i++) {
|
|
||||||
$value = '0' . $value;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'alphanumeric':
|
|
||||||
$value = (string)$value;
|
|
||||||
if (mb_strlen($value, 'utf8') > $len) {
|
|
||||||
$value = substr($value, 0, $len);
|
|
||||||
}
|
|
||||||
for ($i = mb_strlen($value, 'utf8'); $i < $len; $i++) {
|
|
||||||
$value .= ' ';
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'float':
|
|
||||||
if (!preg_match("#\d{1,6}\.\d{1,}#", $value)) {
|
|
||||||
$value = str_repeat("0", $len - 3) . ".00";
|
|
||||||
} else {
|
|
||||||
$value = explode(".", $value);
|
|
||||||
$int = self::harmonise($value[0], 'numeric', $len - 3);
|
|
||||||
$dec = substr($value[1], 0, 2) . "." . substr($value[1], 2, strlen($value[1]));
|
|
||||||
$dec = (string)ceil(floatval($dec));
|
|
||||||
$dec = str_repeat("0", 2 - strlen($dec)) . $dec;
|
|
||||||
$value = $int . "." . $dec;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function exportfile()
|
|
||||||
{
|
|
||||||
if (null !== $response = $this->checkAuth(
|
|
||||||
array(AdminResources::MODULE),
|
|
||||||
array('IciRelais'),
|
|
||||||
AccessManager::UPDATE
|
|
||||||
)) {
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
if (is_readable(ExportExaprint::getJSONpath())) {
|
|
||||||
$admici = json_decode(file_get_contents(ExportExaprint::getJSONpath()), true);
|
|
||||||
$keys = array("name", "addr", "zipcode", "city", "tel", "mobile", "mail", "expcode");
|
|
||||||
$valid = true;
|
|
||||||
foreach ($keys as $key) {
|
|
||||||
$valid &= isset($admici[$key]) && ($key === "assur" ? true : !empty($admici[$key]));
|
|
||||||
}
|
|
||||||
if (!$valid) {
|
|
||||||
return Response::create(
|
|
||||||
Translator::getInstance()->trans(
|
|
||||||
"The file IciRelais/Config/exportdat.json is not valid. Please correct it.",
|
|
||||||
[],
|
|
||||||
IciRelais::DOMAIN
|
|
||||||
),
|
|
||||||
500
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return Response::create(
|
|
||||||
Translator::getInstance()->trans(
|
|
||||||
"Can't read IciRelais/Config/exportdat.json. Did you save the export information ?",
|
|
||||||
[],
|
|
||||||
IciRelais::DOMAIN
|
|
||||||
),
|
|
||||||
500
|
|
||||||
);
|
|
||||||
}
|
|
||||||
$exp_name = $admici['name'];
|
|
||||||
$exp_address1 = $admici['addr'];
|
|
||||||
$exp_address2 = isset($admici['addr2']) ? $admici['addr2'] : "";
|
|
||||||
$exp_zipcode = $admici['zipcode'];
|
|
||||||
$exp_city = $admici['city'];
|
|
||||||
$exp_phone = $admici['tel'];
|
|
||||||
$exp_cellphone = $admici['mobile'];
|
|
||||||
$exp_email = $admici['mail'];
|
|
||||||
$exp_code = $admici['expcode'];
|
|
||||||
$res = self::harmonise('$' . "VERSION=110", 'alphanumeric', 12) . "\r\n";
|
|
||||||
|
|
||||||
$orders = OrderQuery::create()
|
|
||||||
->filterByDeliveryModuleId(IciRelais::getModuleId())
|
|
||||||
->find();
|
|
||||||
|
|
||||||
// FORM VALIDATION
|
|
||||||
$form = new ExportExaprintSelection($this->getRequest());
|
|
||||||
$status_id = null;
|
|
||||||
try {
|
|
||||||
$vform = $this->validateForm($form);
|
|
||||||
$status_id = $vform->get("new_status_id")->getData();
|
|
||||||
if (!preg_match("#^nochange|processing|sent$#", $status_id)) {
|
|
||||||
throw new \Exception("Invalid status ID. Expecting nochange or processing or sent");
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
Tlog::getInstance()->error("Form icirelais.selection sent with bad infos. ");
|
|
||||||
|
|
||||||
return Response::create(
|
|
||||||
Translator::getInstance()->trans(
|
|
||||||
"Got invalid data : %err",
|
|
||||||
['%err' => $e->getMessage()],
|
|
||||||
IciRelais::DOMAIN
|
|
||||||
),
|
|
||||||
500
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---
|
|
||||||
foreach ($orders as $order) {
|
|
||||||
$orderRef = str_replace(".", "-", $order->getRef());
|
|
||||||
|
|
||||||
if ($vform->get($orderRef)->getData()) {
|
|
||||||
$assur_package = $vform->get($orderRef . "-assur")->getData();
|
|
||||||
if ($status_id == "processing") {
|
|
||||||
$event = new OrderEvent($order);
|
|
||||||
|
|
||||||
$status = OrderStatusQuery::create()
|
|
||||||
->findOneByCode(OrderStatus::CODE_PROCESSING);
|
|
||||||
$event->setStatus($status->getId());
|
|
||||||
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event);
|
|
||||||
|
|
||||||
} elseif ($status_id == "sent") {
|
|
||||||
$event = new OrderEvent($order);
|
|
||||||
$status = OrderStatusQuery::create()
|
|
||||||
->findOneByCode(OrderStatus::CODE_SENT);
|
|
||||||
$event->setStatus($status->getId());
|
|
||||||
$this->getDispatcher()->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event);
|
|
||||||
}
|
|
||||||
//Get OrderAddress object - customer's address
|
|
||||||
$address = OrderAddressQuery::create()
|
|
||||||
->findPK($order->getInvoiceOrderAddressId());
|
|
||||||
|
|
||||||
//Get Customer object
|
|
||||||
$customer = CustomerQuery::create()
|
|
||||||
->findPK($order->getCustomerId());
|
|
||||||
|
|
||||||
//Get OrderAddressIciRelais object
|
|
||||||
$icirelais_code = OrderAddressIcirelaisQuery::create()
|
|
||||||
->findPK($order->getDeliveryOrderAddressId());
|
|
||||||
if ($icirelais_code !== null) {
|
|
||||||
//Get OrderProduct object
|
|
||||||
$products = OrderProductQuery::create()
|
|
||||||
->filterByOrderId($order->getId())
|
|
||||||
->find();
|
|
||||||
|
|
||||||
// Get Customer's cellphone
|
|
||||||
$cellphone = AddressQuery::create()
|
|
||||||
->filterByCustomerId($order->getCustomerId())
|
|
||||||
->filterByIsDefault("1")
|
|
||||||
->findOne()
|
|
||||||
->getCellphone();
|
|
||||||
|
|
||||||
//Weigth & price calc
|
|
||||||
$weight = 0.0;
|
|
||||||
$price = 0;
|
|
||||||
$price = $order->getTotalAmount($price, false); // tax = 0 && include postage = flase
|
|
||||||
foreach ($products as $p) {
|
|
||||||
$weight += ((float)$p->getWeight()) * (int)$p->getQuantity();
|
|
||||||
}
|
|
||||||
$weight = floor($weight * 100);
|
|
||||||
$assur_price = ($assur_package == 'true') ? $price : 0;
|
|
||||||
$date_format = date("d/m/Y", $order->getUpdatedAt()->getTimestamp());
|
|
||||||
|
|
||||||
$res .= self::harmonise($order->getRef(), 'alphanumeric', 35);
|
|
||||||
$res .= self::harmonise("", 'alphanumeric', 2);
|
|
||||||
$res .= self::harmonise($weight, 'numeric', 8);
|
|
||||||
$res .= self::harmonise("", 'alphanumeric', 15);
|
|
||||||
$res .= self::harmonise($customer->getLastname(), 'alphanumeric', 35);
|
|
||||||
$res .= self::harmonise($customer->getFirstname(), 'alphanumeric', 35);
|
|
||||||
$res .= self::harmonise($address->getAddress2(), 'alphanumeric', 35);
|
|
||||||
$res .= self::harmonise($address->getAddress3(), 'alphanumeric', 35);
|
|
||||||
$res .= self::harmonise("", 'alphanumeric', 35);
|
|
||||||
$res .= self::harmonise("", 'alphanumeric', 35);
|
|
||||||
$res .= self::harmonise($address->getZipcode(), 'alphanumeric', 10);
|
|
||||||
$res .= self::harmonise($address->getCity(), 'alphanumeric', 35);
|
|
||||||
$res .= self::harmonise("", 'alphanumeric', 10);
|
|
||||||
$res .= self::harmonise($address->getAddress1(), 'alphanumeric', 35);
|
|
||||||
$res .= self::harmonise("", 'alphanumeric', 10);
|
|
||||||
$res .= self::harmonise(
|
|
||||||
"F",
|
|
||||||
'alphanumeric',
|
|
||||||
3
|
|
||||||
); // CODE PAYS DESTINATAIRE PAR DEFAUT F
|
|
||||||
$res .= self::harmonise($address->getPhone(), 'alphanumeric', 30);
|
|
||||||
$res .= self::harmonise("", 'alphanumeric', 15);
|
|
||||||
$res .= self::harmonise($exp_name, 'alphanumeric', 35); // DEBUT EXPEDITEUR
|
|
||||||
$res .= self::harmonise($exp_address2, 'alphanumeric', 35);
|
|
||||||
$res .= self::harmonise("", 'alphanumeric', 140);
|
|
||||||
$res .= self::harmonise($exp_zipcode, 'alphanumeric', 10);
|
|
||||||
$res .= self::harmonise($exp_city, 'alphanumeric', 35);
|
|
||||||
$res .= self::harmonise("", 'alphanumeric', 10);
|
|
||||||
$res .= self::harmonise($exp_address1, 'alphanumeric', 35);
|
|
||||||
$res .= self::harmonise("", 'alphanumeric', 10);
|
|
||||||
$res .= self::harmonise(
|
|
||||||
"F",
|
|
||||||
'alphanumeric',
|
|
||||||
3
|
|
||||||
); // CODE PAYS EXPEDITEUR PAR DEFAUT F
|
|
||||||
$res .= self::harmonise($exp_phone, 'alphanumeric', 30);
|
|
||||||
$res .= self::harmonise(
|
|
||||||
"",
|
|
||||||
'alphanumeric',
|
|
||||||
35
|
|
||||||
); // COMMENTAIRE 1 DE LA COMMANDE
|
|
||||||
$res .= self::harmonise(
|
|
||||||
"",
|
|
||||||
'alphanumeric',
|
|
||||||
35
|
|
||||||
); // COMMENTAIRE 2 DE LA COMMANDE
|
|
||||||
$res .= self::harmonise(
|
|
||||||
"",
|
|
||||||
'alphanumeric',
|
|
||||||
35
|
|
||||||
); // COMMENTAIRE 3 DE LA COMMANDE
|
|
||||||
$res .= self::harmonise(
|
|
||||||
"",
|
|
||||||
'alphanumeric',
|
|
||||||
35
|
|
||||||
); // COMMENTAIRE 3 DE LA COMMANDE
|
|
||||||
$res .= self::harmonise($date_format, 'alphanumeric', 10);
|
|
||||||
$res .= self::harmonise(
|
|
||||||
$exp_code,
|
|
||||||
'numeric',
|
|
||||||
8
|
|
||||||
); // N° COMPTE CHARGEUR ICIRELAIS ?
|
|
||||||
$res .= self::harmonise("", 'alphanumeric', 35); // CODE BARRE
|
|
||||||
$res .= self::harmonise($customer->getRef(), 'alphanumeric', 35);
|
|
||||||
$res .= self::harmonise("", 'alphanumeric', 29);
|
|
||||||
$res .= self::harmonise(
|
|
||||||
$assur_price,
|
|
||||||
'float',
|
|
||||||
9
|
|
||||||
); // MONTANT DE LA VALEUR MARCHANDE A ASSURER EX: 20 euros -> 000020.00
|
|
||||||
$res .= self::harmonise("", 'alphanumeric', 8);
|
|
||||||
$res .= self::harmonise($customer->getId(), 'alphanumeric', 35);
|
|
||||||
$res .= self::harmonise("", 'alphanumeric', 46);
|
|
||||||
$res .= self::harmonise($exp_email, 'alphanumeric', 80);
|
|
||||||
$res .= self::harmonise($exp_cellphone, 'alphanumeric', 35);
|
|
||||||
$res .= self::harmonise($customer->getEmail(), 'alphanumeric', 80);
|
|
||||||
$res .= self::harmonise($cellphone, 'alphanumeric', 35);
|
|
||||||
$res .= self::harmonise("", 'alphanumeric', 96);
|
|
||||||
$res .= self::harmonise(
|
|
||||||
$icirelais_code->getCode(),
|
|
||||||
'alphanumeric',
|
|
||||||
8
|
|
||||||
); // IDENTIFIANT ESPACE ICIRELAIS
|
|
||||||
|
|
||||||
$res .= "\r\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$response = new Response(
|
|
||||||
$res,
|
|
||||||
200,
|
|
||||||
array(
|
|
||||||
'Content-Type' => 'application/csv-tab-delimited-table',
|
|
||||||
'Content-disposition' => 'filename=export.dat'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,121 +0,0 @@
|
|||||||
<?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 IciRelais\Controller;
|
|
||||||
|
|
||||||
use IciRelais\Form\ExportExaprintForm;
|
|
||||||
use IciRelais\IciRelais;
|
|
||||||
use Thelia\Controller\Admin\BaseAdminController;
|
|
||||||
use Thelia\Core\Translation\Translator;
|
|
||||||
|
|
||||||
use Thelia\Core\Security\Resource\AdminResources;
|
|
||||||
use Thelia\Core\Security\AccessManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class ExportExaprint
|
|
||||||
* @package IciRelais\Controller
|
|
||||||
* @author Thelia <info@thelia.net>
|
|
||||||
*/
|
|
||||||
class ExportExaprint extends BaseAdminController
|
|
||||||
{
|
|
||||||
public static function getJSONpath()
|
|
||||||
{
|
|
||||||
return __DIR__ . "/../Config/exportdat.json";
|
|
||||||
}
|
|
||||||
|
|
||||||
public function export()
|
|
||||||
{
|
|
||||||
if (null !== $response = $this->checkAuth(
|
|
||||||
array(AdminResources::MODULE),
|
|
||||||
array('IciRelais'),
|
|
||||||
AccessManager::UPDATE
|
|
||||||
)) {
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
$form = new ExportExaprintForm($this->getRequest());
|
|
||||||
$error_message = null;
|
|
||||||
try {
|
|
||||||
$vform = $this->validateForm($form);
|
|
||||||
|
|
||||||
$file_path = self::getJSONpath();
|
|
||||||
|
|
||||||
if ((file_exists($file_path) ? is_writable($file_path) : is_writable(__DIR__ . "/../Config/"))) {
|
|
||||||
$file = fopen(self::getJSONpath(), 'w');
|
|
||||||
fwrite(
|
|
||||||
$file,
|
|
||||||
json_encode(
|
|
||||||
array(
|
|
||||||
"name" => $vform->get('name')->getData(),
|
|
||||||
"addr" => $vform->get('addr')->getData(),
|
|
||||||
"addr2" => $vform->get('addr2')->getData(),
|
|
||||||
"zipcode" => $vform->get('zipcode')->getData(),
|
|
||||||
"city" => $vform->get('city')->getData(),
|
|
||||||
"tel" => $vform->get('tel')->getData(),
|
|
||||||
"mobile" => $vform->get('mobile')->getData(),
|
|
||||||
"mail" => $vform->get('mail')->getData(),
|
|
||||||
"expcode" => ($vform->get('expcode')->getData())
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
fclose($file);
|
|
||||||
|
|
||||||
return $this->generateRedirectFromRoute(
|
|
||||||
"admin.module.configure",
|
|
||||||
[],
|
|
||||||
[
|
|
||||||
'module_code' => "IciRelais",
|
|
||||||
'current_tab' => "configure_export_exaprint",
|
|
||||||
'_controller' => 'Thelia\\Controller\\Admin\\ModuleController::configureAction'
|
|
||||||
]
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
throw new \Exception(
|
|
||||||
Translator::getInstance()->trans(
|
|
||||||
"Can't write IciRelais/Config/exportdat.json. Please change the rights on the file and/or the directory.",
|
|
||||||
[],
|
|
||||||
IciRelais::DOMAIN
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
$error_message = $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->setupFormErrorContext(
|
|
||||||
'erreur export fichier exaprint',
|
|
||||||
$error_message,
|
|
||||||
$form
|
|
||||||
);
|
|
||||||
|
|
||||||
return $this->render(
|
|
||||||
'module-configure',
|
|
||||||
[
|
|
||||||
'module_code' => IciRelais::getModuleCode(),
|
|
||||||
'current_tab' => "configure_export_exaprint"
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
<?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 IciRelais\Controller;
|
|
||||||
|
|
||||||
use IciRelais\Model\IciRelaisFreeshipping;
|
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
|
||||||
use Thelia\Controller\Admin\BaseAdminController;
|
|
||||||
use Thelia\Core\HttpFoundation\Response;
|
|
||||||
|
|
||||||
use Thelia\Core\Security\Resource\AdminResources;
|
|
||||||
use Thelia\Core\Security\AccessManager;
|
|
||||||
|
|
||||||
class FreeShipping extends BaseAdminController
|
|
||||||
{
|
|
||||||
public function set()
|
|
||||||
{
|
|
||||||
if (null !== $response = $this->checkAuth(array(AdminResources::MODULE), array('IciRelais'), AccessManager::UPDATE)) {
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
$form = new \IciRelais\Form\FreeShipping($this->getRequest());
|
|
||||||
$response=null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
$vform = $this->validateForm($form);
|
|
||||||
$data = $vform->get('freeshipping')->getData();
|
|
||||||
|
|
||||||
$save = new IcirelaisFreeshipping();
|
|
||||||
$save->setActive(!empty($data))->save();
|
|
||||||
$response = Response::create('');
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
$response = JsonResponse::create(array("error"=>$e->getMessage()), 500);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
<?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 IciRelais\Controller;
|
|
||||||
|
|
||||||
use Thelia\Controller\Front\BaseFrontController;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class SearchCityController
|
|
||||||
* @package IciRelais\Controller
|
|
||||||
* @author Thelia <info@thelia.net>
|
|
||||||
*/
|
|
||||||
class SearchCityController extends BaseFrontController
|
|
||||||
{
|
|
||||||
public function searchAction($zipcode, $city)
|
|
||||||
{
|
|
||||||
return $this->render("getSpecificLocation", array("_zipcode_"=>$zipcode, "_city_"=>$city));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,162 +0,0 @@
|
|||||||
<?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 IciRelais\Form;
|
|
||||||
|
|
||||||
use IciRelais\IciRelais;
|
|
||||||
use Symfony\Component\Validator\Constraints\Regex;
|
|
||||||
use Thelia\Form\BaseForm;
|
|
||||||
use Thelia\Core\Translation\Translator;
|
|
||||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
|
||||||
use IciRelais\Controller\ExportExaprint;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class ExportExaprintForm
|
|
||||||
* @package IciRelais\Form
|
|
||||||
* @author Thelia <info@thelia.net>
|
|
||||||
*/
|
|
||||||
class ExportExaprintForm extends BaseForm
|
|
||||||
{
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return "exportexaprintform";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function buildForm()
|
|
||||||
{
|
|
||||||
// Add value(s) if Config/exportdat.json exists
|
|
||||||
|
|
||||||
if (is_readable(ExportExaprint::getJSONpath())) {
|
|
||||||
$values = json_decode(file_get_contents(ExportExaprint::getJSONpath()), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->formBuilder
|
|
||||||
->add(
|
|
||||||
'name',
|
|
||||||
'text',
|
|
||||||
array(
|
|
||||||
'label' => Translator::getInstance()->trans('Sender\'s name', [], IciRelais::DOMAIN),
|
|
||||||
'data' => (isset($values['name']) ? $values['name'] : ""),
|
|
||||||
'constraints' => array(new NotBlank()),
|
|
||||||
'label_attr' => array(
|
|
||||||
'for' => 'name'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
->add(
|
|
||||||
'addr',
|
|
||||||
'text',
|
|
||||||
array(
|
|
||||||
'label' => Translator::getInstance()->trans('Sender\'s address1', [], IciRelais::DOMAIN),
|
|
||||||
'data' => (isset($values['addr']) ? $values['addr'] : ""),
|
|
||||||
'constraints' => array(new NotBlank()),
|
|
||||||
'label_attr' => array(
|
|
||||||
'for' => 'addr'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
->add(
|
|
||||||
'addr2',
|
|
||||||
'text',
|
|
||||||
array(
|
|
||||||
'label' => Translator::getInstance()->trans('Sender\'s address2', [], IciRelais::DOMAIN),
|
|
||||||
'data' => (isset($values['addr2']) ? $values['addr2'] : ""),
|
|
||||||
'label_attr' => array(
|
|
||||||
'for' => 'addr2'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
->add(
|
|
||||||
'zipcode',
|
|
||||||
'text',
|
|
||||||
array(
|
|
||||||
'label' => Translator::getInstance()->trans('Sender\'s zipcode', [], IciRelais::DOMAIN),
|
|
||||||
'data' => (isset($values['zipcode']) ? $values['zipcode'] : ""),
|
|
||||||
'constraints' => array(new NotBlank(), new Regex(['pattern' => "/^(2[A-B])|([0-9]{2})\d{3}$/"])),
|
|
||||||
'label_attr' => array(
|
|
||||||
'for' => 'zipcode'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
->add(
|
|
||||||
'city',
|
|
||||||
'text',
|
|
||||||
array(
|
|
||||||
'label' => Translator::getInstance()->trans('Sender\'s city', [], IciRelais::DOMAIN),
|
|
||||||
'data' => (isset($values['city']) ? $values['city'] : ""),
|
|
||||||
'constraints' => array(new NotBlank()),
|
|
||||||
'label_attr' => array(
|
|
||||||
'for' => 'city'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
->add(
|
|
||||||
'tel',
|
|
||||||
'text',
|
|
||||||
array(
|
|
||||||
'label' => Translator::getInstance()->trans('Sender\'s phone', [], IciRelais::DOMAIN),
|
|
||||||
'data' => (isset($values['tel']) ? $values['tel'] : ""),
|
|
||||||
'constraints' => array(new NotBlank(), new Regex(['pattern' => "/^0[1-9]\d{8}$/"])),
|
|
||||||
'label_attr' => array(
|
|
||||||
'for' => 'tel'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
->add(
|
|
||||||
'mobile',
|
|
||||||
'text',
|
|
||||||
array(
|
|
||||||
'label' => Translator::getInstance()->trans('Sender\'s mobile phone', [], IciRelais::DOMAIN),
|
|
||||||
'data' => (isset($values['mobile']) ? $values['mobile'] : ""),
|
|
||||||
'constraints' => array(new NotBlank(), new Regex(['pattern' => "#^0[6-7]{1}\d{8}$#"])),
|
|
||||||
'label_attr' => array(
|
|
||||||
'for' => 'mobile'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
->add(
|
|
||||||
'mail',
|
|
||||||
'email',
|
|
||||||
array(
|
|
||||||
'label' => Translator::getInstance()->trans('Sender\'s email', [], IciRelais::DOMAIN),
|
|
||||||
'data' => (isset($values['mail']) ? $values['mail'] : ""),
|
|
||||||
'constraints' => array(new NotBlank()),
|
|
||||||
'label_attr' => array(
|
|
||||||
'for' => 'mail'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
->add(
|
|
||||||
'expcode',
|
|
||||||
'text',
|
|
||||||
array(
|
|
||||||
'label' => Translator::getInstance()->trans('IciRelais Sender\'s code', [], IciRelais::DOMAIN),
|
|
||||||
'constraints' => array(new NotBlank(), new Regex(['pattern' => "#^\d{8}$#"])),
|
|
||||||
'data' => (isset($values['expcode']) ? $values['expcode'] : ""),
|
|
||||||
'label_attr' => array(
|
|
||||||
'for' => 'expcode'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
<?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 IciRelais\Form;
|
|
||||||
|
|
||||||
use IciRelais\IciRelais;
|
|
||||||
use Thelia\Form\BaseForm;
|
|
||||||
use Thelia\Core\Translation\Translator;
|
|
||||||
use Thelia\Model\OrderQuery;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class ExportExaprintSelection
|
|
||||||
* @package IciRelais\Form
|
|
||||||
* @author Thelia <info@thelia.net>
|
|
||||||
*/
|
|
||||||
class ExportExaprintSelection extends BaseForm
|
|
||||||
{
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return "exportexaprintselection";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function buildForm()
|
|
||||||
{
|
|
||||||
$entries = OrderQuery::create()
|
|
||||||
->filterByDeliveryModuleId(IciRelais::getModuleId())
|
|
||||||
->find();
|
|
||||||
|
|
||||||
$this->formBuilder
|
|
||||||
->add(
|
|
||||||
'new_status_id',
|
|
||||||
'choice',
|
|
||||||
array(
|
|
||||||
'label' => Translator::getInstance()->trans('Change order status to', [], IciRelais::DOMAIN),
|
|
||||||
'choices' => array(
|
|
||||||
"nochange" => Translator::getInstance()->trans("Do not change", [], IciRelais::DOMAIN),
|
|
||||||
"processing" => Translator::getInstance()->trans("Set orders status as processing", [], IciRelais::DOMAIN),
|
|
||||||
"sent" => Translator::getInstance()->trans("Set orders status as sent", [], IciRelais::DOMAIN)
|
|
||||||
),
|
|
||||||
'required' => true,
|
|
||||||
'expanded' => true,
|
|
||||||
'multiple' => false,
|
|
||||||
'data' => 'nochange'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($entries as $order) {
|
|
||||||
$orderRef = str_replace(".", "-", $order->getRef());
|
|
||||||
|
|
||||||
$this->formBuilder
|
|
||||||
->add(
|
|
||||||
$orderRef,
|
|
||||||
'checkbox',
|
|
||||||
array(
|
|
||||||
'label' => $orderRef,
|
|
||||||
'label_attr' => array(
|
|
||||||
'for' => $orderRef
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
->add(
|
|
||||||
$orderRef . "-assur",
|
|
||||||
'checkbox'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
<?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 IciRelais\Form;
|
|
||||||
|
|
||||||
use IciRelais\IciRelais;
|
|
||||||
use IciRelais\Model\IcirelaisFreeshippingQuery;
|
|
||||||
use Thelia\Core\Translation\Translator;
|
|
||||||
use Thelia\Form\BaseForm;
|
|
||||||
|
|
||||||
class FreeShipping extends BaseForm
|
|
||||||
{
|
|
||||||
protected function buildForm()
|
|
||||||
{
|
|
||||||
$freeshipping = IcirelaisFreeshippingQuery::create()->getLast();
|
|
||||||
|
|
||||||
$this->formBuilder
|
|
||||||
->add(
|
|
||||||
"freeshipping",
|
|
||||||
"checkbox",
|
|
||||||
array(
|
|
||||||
'data' => $freeshipping,
|
|
||||||
'label' => Translator::getInstance()->trans("Activate free shipping: ", [], IciRelais::DOMAIN)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string the name of you form. This name must be unique
|
|
||||||
*/
|
|
||||||
public function getName()
|
|
||||||
{
|
|
||||||
return "icirelaisfreeshipping";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return array(
|
|
||||||
'Actions' => 'Actions',
|
|
||||||
'Area : ' => 'Shipping zone : ',
|
|
||||||
'Cancel' => 'Cancel',
|
|
||||||
'Change orders status after export' => 'Change orders status after export',
|
|
||||||
'Check all' => 'Check all',
|
|
||||||
'Configure EXAPRINT file' => 'Configure EXAPRINT file',
|
|
||||||
'Create' => 'Create',
|
|
||||||
'Create a new price slice' => 'Create a new price slice',
|
|
||||||
'Create a price slice' => 'Create a price slice',
|
|
||||||
'Date' => 'Date',
|
|
||||||
'Delete' => 'Delete',
|
|
||||||
'Delete a price slice' => 'Delete a price slice',
|
|
||||||
'Delete this price slice' => 'Delete this price slice',
|
|
||||||
'Do not change' => 'Do not change',
|
|
||||||
'Do you really want to delete this slice ?' => 'Do you really want to delete this slice ?',
|
|
||||||
'Edit' => 'Edit',
|
|
||||||
'Edit a price slice' => 'Edit a price slice',
|
|
||||||
'Edit this price slice' => 'Edit this price slice',
|
|
||||||
'Export' => 'Export',
|
|
||||||
'Export EXAPRINT file' => 'Export EXAPRINT file',
|
|
||||||
'Export EXAPRINT file of this order' => 'Export EXAPRINT file for this order',
|
|
||||||
'Ici Relais Module allows you to send your products in France.' => 'Ici Relais Module allows you to send your products in France.',
|
|
||||||
'If you choose this option, the exported orders would not be available on this page anymore' => 'If you choose this option, the exported orders would not be available on this page anymore',
|
|
||||||
'Package warranty' => 'Package warranty',
|
|
||||||
'Please change the access rights' => 'Please change the access rights',
|
|
||||||
'Price (%sym)' => 'Price (%sym)',
|
|
||||||
'Price slices' => 'Price slices',
|
|
||||||
'Processing' => 'Processing',
|
|
||||||
'REF' => 'REF',
|
|
||||||
'Reverse selection' => 'Reverse selection',
|
|
||||||
'Save changes' => 'Save changes',
|
|
||||||
'Sent' => 'Sent',
|
|
||||||
'There are currently no pending order to ship by IciRelais.' => 'There are currently no pending order to ship by IciRelais.',
|
|
||||||
'Total taxed amount' => 'Total taxed amount',
|
|
||||||
'Uncheck all' => 'Uncheck all',
|
|
||||||
'Weight up to ... (kg)' => 'Weight up to ... (Kg)',
|
|
||||||
'addr' => 'Sender address',
|
|
||||||
'addr2' => 'Sender address (continued)',
|
|
||||||
'city' => 'Sender city',
|
|
||||||
'expcode' => 'IciRelais Sender\'s code',
|
|
||||||
'mail' => 'Sender e-mail',
|
|
||||||
'mobile' => 'Sender mobile phone',
|
|
||||||
'name' => 'Sender name',
|
|
||||||
'tel' => 'Sender phone',
|
|
||||||
'zipcode' => 'Sender zip code',
|
|
||||||
);
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return array(
|
|
||||||
'Actions' => 'Actions',
|
|
||||||
'Area : ' => 'Zone de livraison : ',
|
|
||||||
'Cancel' => 'Annuler',
|
|
||||||
'Change orders status after export' => 'Modifier le statut des commandes après l\'export',
|
|
||||||
'Check all' => 'Tout cocher',
|
|
||||||
'Configure EXAPRINT file' => 'Configuration du fichier EXAPRINT',
|
|
||||||
'Create' => 'Créer',
|
|
||||||
'Create a new price slice' => 'Créer une nouvelle tranche de prix',
|
|
||||||
'Create a price slice' => 'Créer une tranche de prix',
|
|
||||||
'Date' => 'Date',
|
|
||||||
'Delete' => 'Supprimer',
|
|
||||||
'Delete a price slice' => 'Supprimer une tranche de prix',
|
|
||||||
'Delete this price slice' => 'Supprimer cette tranche de prix',
|
|
||||||
'Do not change' => 'Ne pas changer',
|
|
||||||
'Do you really want to delete this slice ?' => 'Voulez-vous réellement supprimer cette tranche de prix ?',
|
|
||||||
'Edit' => 'Modifier',
|
|
||||||
'Edit a price slice' => 'Modifier une tranche de prix',
|
|
||||||
'Edit this price slice' => 'Editer cette tranche de prix',
|
|
||||||
'Export' => 'Exporter',
|
|
||||||
'Export EXAPRINT file' => 'Exporter le fichier EXAPRINT',
|
|
||||||
'Export EXAPRINT file of this order' => 'Exporter le fichier EXAPRINT de cette commande',
|
|
||||||
'Ici Relais Module allows you to send your products in France.' => 'Le module IciRelais vous permet d\'envoyer des colis en France.',
|
|
||||||
'If you choose this option, the exported orders would not be available on this page anymore' => 'En choisissant cette option, les commandes exportées ne seront plus disponible sur cette page',
|
|
||||||
'Package warranty' => 'Garantie du colis',
|
|
||||||
'Please change the access rights' => 'Veuillez changer les droits d\'accès',
|
|
||||||
'Price (%sym)' => 'Prix (%sym)',
|
|
||||||
'Price slices' => 'Tranches de prix',
|
|
||||||
'Processing' => 'Traitement',
|
|
||||||
'REF' => 'Référence',
|
|
||||||
'Reverse selection' => 'Inverser la sélection',
|
|
||||||
'Save changes' => 'Enregistrer les changements',
|
|
||||||
'Sent' => 'Envoyée',
|
|
||||||
'There are currently no pending order to ship by IciRelais.' => 'Vous n\'avez actuellement aucune commande en attente d\'expédition par IciRelais.',
|
|
||||||
'Total taxed amount' => 'Montant T.T.C.',
|
|
||||||
'Uncheck all' => 'Tout décocher',
|
|
||||||
'Weight up to ... (kg)' => 'Poids ... (kg)',
|
|
||||||
'addr' => 'Adresse',
|
|
||||||
'addr2' => 'Adresse 2',
|
|
||||||
'city' => 'Ville',
|
|
||||||
'expcode' => 'Code IciRelais de l\'expéditeur',
|
|
||||||
'mail' => 'Email',
|
|
||||||
'mobile' => 'Téléphone mobile',
|
|
||||||
'name' => 'Nom',
|
|
||||||
'tel' => 'Téléphone',
|
|
||||||
'zipcode' => 'Code postal',
|
|
||||||
);
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return array(
|
|
||||||
'Activate free shipping: ' => 'Activate free shipping: ',
|
|
||||||
'Can\'t read Config directory' => 'Can\'t read Config directory',
|
|
||||||
'Can\'t read IciRelais/Config/exportdat.json. Did you save the export information ?' => 'Can\'t read IciRelais/Config/exportdat.json. Did you save the export information ?',
|
|
||||||
'Can\'t read file' => 'Can\'t read file',
|
|
||||||
'Can\'t write Config directory' => 'Can\'t write Config directory',
|
|
||||||
'Can\'t write IciRelais/Config/exportdat.json. Please change the rights on the file and/or the directory.' => 'Can\'t write IciRelais/Config/exportdat.json. Please change the rights on the file and/or the directory.',
|
|
||||||
'Can\'t write file' => 'Can\'t write file',
|
|
||||||
'Change order status to' => 'Change order status to',
|
|
||||||
'Do not change' => 'Do not change',
|
|
||||||
'Got invalid data : %err' => 'Got invalid data : %err',
|
|
||||||
'IciRelais Sender\'s code' => 'IciRelais Sender\'s code',
|
|
||||||
'Sender\'s address1' => 'Sender\'s address1',
|
|
||||||
'Sender\'s address2' => 'Sender\'s address2',
|
|
||||||
'Sender\'s city' => 'Sender\'s city',
|
|
||||||
'Sender\'s email' => 'Sender\'s email',
|
|
||||||
'Sender\'s mobile phone' => 'Sender\'s cellular phone',
|
|
||||||
'Sender\'s name' => 'Sender\'s name',
|
|
||||||
'Sender\'s phone' => 'Sender\'s phone',
|
|
||||||
'Sender\'s zipcode' => 'Sender\'s zipcode',
|
|
||||||
'Set orders status as processing' => 'Set orders status as processing',
|
|
||||||
'Set orders status as sent' => 'Set orders status as sent',
|
|
||||||
'The file IciRelais/Config/exportdat.json is not valid. Please correct it.' => 'The file IciRelais/Config/exportdat.json is not valid. Please correct it.',
|
|
||||||
);
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return array(
|
|
||||||
'Activate free shipping: ' => 'Livraison offerte: ',
|
|
||||||
'Can\'t read Config directory' => 'Le dossier Config ne peut être lu',
|
|
||||||
'Can\'t read IciRelais/Config/exportdat.json. Did you save the export information ?' => 'Le fichier IciRelais/Config/exportdat.json ne peut être lu. Avez vous enregistré les informations d\'export ?',
|
|
||||||
'Can\'t read file' => 'Le fichier suivant ne peut être lu',
|
|
||||||
'Can\'t write Config directory' => 'Le dossier Config ne peut être écrit',
|
|
||||||
'Can\'t write IciRelais/Config/exportdat.json. Please change the rights on the file and/or the directory.' => 'Le fichier IciRelais/Config/exportdat.json ne peut être écrit. Veuillez changer les droits d\'accès sur le fichier et/ou dossier',
|
|
||||||
'Can\'t write file' => 'Le fichier suivant ne peut être écrit',
|
|
||||||
'Change order status to' => 'Modifier le statut des commandes après l\'export',
|
|
||||||
'Do not change' => 'Ne pas changer',
|
|
||||||
'Got invalid data : %err' => 'Données invalides reçues : %err',
|
|
||||||
'IciRelais Sender\'s code' => 'Code IciRelais de l\'expéditeur',
|
|
||||||
'Sender\'s address1' => 'Adresse de l\'expéditeur',
|
|
||||||
'Sender\'s address2' => 'Adresse 2 de l\'expéditeur',
|
|
||||||
'Sender\'s city' => 'Ville de l\'expéditeur',
|
|
||||||
'Sender\'s email' => 'Email de de l\'expéditeur',
|
|
||||||
'Sender\'s mobile phone' => 'Téléphone mobile de l\'expéditeur',
|
|
||||||
'Sender\'s name' => 'Nom de l\'expéditeur',
|
|
||||||
'Sender\'s phone' => 'Téléphone de l\'expéditeur',
|
|
||||||
'Sender\'s zipcode' => 'Code postal de l\'expéditeur',
|
|
||||||
'Set orders status as processing' => 'Traitement',
|
|
||||||
'Set orders status as sent' => 'Envoyée',
|
|
||||||
'The file IciRelais/Config/exportdat.json is not valid. Please correct it.' => 'Le fichier IciRelais/Config/exportdat.json n\'est pas valide. Veuillez le corriger.',
|
|
||||||
);
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return array(
|
|
||||||
'Please choose a pick-up & Go store' => 'Veuillez choisir un point IciRelais',
|
|
||||||
'Actual address can\'t be geolocated' => 'Cette adresse ne peut être géolocalisée',
|
|
||||||
'Please enter a city and a zipcode' => 'Veuillez entrer une ville et son code postal',
|
|
||||||
'Please enter a valid zipcode' => 'Veuillez entrer un code postal valide',
|
|
||||||
'Search relay in a city' => 'Chercher un point IciRelais dans une autre ville',
|
|
||||||
'city' => 'Ville',
|
|
||||||
'zipcode' => 'Code postal',
|
|
||||||
'Search' => 'Rechercher',
|
|
||||||
'Edit' => 'Modifier',
|
|
||||||
'Cancel' => 'Annuler',
|
|
||||||
'Export EXAPRINT file' => 'Exporter le fichier EXAPRINT',
|
|
||||||
'name' => 'Nom',
|
|
||||||
'addr' => 'Adresse',
|
|
||||||
'addr2' => 'Adresse 2',
|
|
||||||
'tel' => 'Téléphone',
|
|
||||||
'mobile' => 'Téléphone mobile',
|
|
||||||
'mail' => 'Email',
|
|
||||||
'assur' => 'Assurer le colis',
|
|
||||||
'Save changes' => 'Enregistrer les changements',
|
|
||||||
'Export' => 'Exporter',
|
|
||||||
'Price slices' => 'Tranches de prix',
|
|
||||||
'Ici Relais Module allows you to send your products in France.' => 'Le module IciRelais vous permet d\'envoyer des colis en France.',
|
|
||||||
'Create a price slice' => 'Créer une tranche de prix',
|
|
||||||
'Weight up to ... (kg)' => 'Poids ... (kg)',
|
|
||||||
'Price (€)' => 'Prix (€)',
|
|
||||||
'Create' => 'Créer',
|
|
||||||
'Area : ' => 'Zone de livraison : ',
|
|
||||||
'Create a new price slice' => 'Créer une nouvelle tranche de prix',
|
|
||||||
'Actions' => 'Actions',
|
|
||||||
'Edit a price slice' => 'Modifier une tranche de prix',
|
|
||||||
'Delete a price slice' => 'Supprimer une tranche de prix',
|
|
||||||
'Do you really want to delete this slice ?' => 'Voulez-vous réellement supprimer cette tranche de prix ?',
|
|
||||||
'Delete' => 'Supprimer',
|
|
||||||
'Edit this price slice' => 'Editer cette tranche de prix',
|
|
||||||
'Delete this price slice' => 'Supprimer cette tranche de prix',
|
|
||||||
'Sender\'s name' => 'Nom de l\'expéditeur',
|
|
||||||
'Sender\'s address1' => 'Adresse de l\'expéditeur',
|
|
||||||
'Sender\'s address2' => 'Adresse 2 de l\'expéditeur',
|
|
||||||
'Sender\'s zipcode' => 'Code postal de l\'expéditeur',
|
|
||||||
'Sender\'s city' => 'Ville de l\'expéditeur',
|
|
||||||
'Sender\'s phone' => 'Téléphone de l\'expéditeur',
|
|
||||||
'Sender\'s mobile phone' => 'Téléphone mobile de l\'expéditeur',
|
|
||||||
'Sender\'s email' => 'Email de de l\'expéditeur',
|
|
||||||
'Package warranty' => 'Garantie du colis',
|
|
||||||
'Can\'t read file' => 'Le fichier suivant ne peut être lu',
|
|
||||||
'Can\'t write file' => 'Le fichier suivant ne peut être écrit',
|
|
||||||
'Can\'t read Config directory' => 'Le dossier Config ne peut être lu',
|
|
||||||
'Please change the access rights' => 'Veuillez changer les droits d\'accès',
|
|
||||||
'Can\'t write IciRelais/Config/exportdat.json. Please change the rights on the file and/or the directory.' => 'Le fichier IciRelais/Config/exportdat.json ne peut être écrit. Veuillez changer les droits d\'accès sur le fichier et/ou dossier',
|
|
||||||
'The file IciRelais/Config/exportdat.json is not valid. Please correct it.'=>'Le fichier IciRelais/Config/exportdat.json n\'est pas valide. Veuillez le corriger.',
|
|
||||||
'Can\'t read IciRelais/Config/exportdat.json. Did you save the export information ?'=>'Le fichier IciRelais/Config/exportdat.json ne peut être lu. Avez vous enregistré les informations d\'export ?',
|
|
||||||
'Configure EXAPRINT file'=>'Configuration du fichier EXAPRINT',
|
|
||||||
'REF'=>'Référence',
|
|
||||||
'Date'=>'Date',
|
|
||||||
'Total taxed amount'=>'Montant T.T.C.',
|
|
||||||
'Form sent with bad arguments'=>'Le formulaire a été envoyé avec de mauvais arguments',
|
|
||||||
'Check all'=>'Tout cocher',
|
|
||||||
'Uncheck all'=>'Tout décocher',
|
|
||||||
'Reverse selection'=>'Inverser la sélection',
|
|
||||||
'operations'=>'Opérations',
|
|
||||||
'Can\'t write Config directory'=>'Le dossier Config ne peut être écrit',
|
|
||||||
'Export EXAPRINT file of this order'=>'Exporter le fichier EXAPRINT de cette commande',
|
|
||||||
'Change orders status after export'=>'Modifier le statut des commandes après l\'export',
|
|
||||||
'Do not change'=>'Ne pas changer',
|
|
||||||
'Processing'=>'Traitement',
|
|
||||||
'Sent'=>'Envoyée',
|
|
||||||
'*If you choose this option, the exported orders would not be available on this page anymore'=>'*En choisissant cette option, les commandes exportées ne seront plus disponible sur cette page',
|
|
||||||
'IciRelais Sender\'s code'=>'Code IciRelais de l\'expéditeur',
|
|
||||||
'Activate free shipping: '=>'Livraison offerte: ',
|
|
||||||
);
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return array(
|
|
||||||
'Please choose a pick-up & Go store' => 'Veuillez choisir un point IciRelais',
|
|
||||||
'Actual address can\'t be geolocated' => 'Cette adresse ne peut être géolocalisée',
|
|
||||||
'Please enter a city and a zipcode' => 'Veuillez entrer une ville et son code postal',
|
|
||||||
'Please enter a valid zipcode' => 'Veuillez entrer un code postal valide',
|
|
||||||
'Search relay in a city' => 'Chercher un point IciRelais dans une autre ville',
|
|
||||||
'city' => 'Ville',
|
|
||||||
'zipcode' => 'Code postal',
|
|
||||||
'<strong>Sorry!</strong> We are not able to give you a delivery method for your order.' => '<strong>Sorry!</strong> We are not able to give you a delivery method for your order.',
|
|
||||||
'Add a new address' => 'Add a new address',
|
|
||||||
'Address %nb' => 'Address %nb',
|
|
||||||
'Available' => 'Available',
|
|
||||||
'Back' => 'Back',
|
|
||||||
'Billing address' => 'Billing address',
|
|
||||||
'Billing and delivery' => 'Billing and delivery',
|
|
||||||
'Cancel' => 'Cancel',
|
|
||||||
'Cart' => 'Cart',
|
|
||||||
'Change address' => 'Change address',
|
|
||||||
'Choose your delivery address' => 'Choose your delivery address',
|
|
||||||
'Choose your delivery method' => 'Choose your delivery method',
|
|
||||||
'Choose your payment method' => 'Choose your payment method',
|
|
||||||
'Code :' => 'Code :',
|
|
||||||
'Coupon code' => 'Coupon code',
|
|
||||||
'Delivery address' => 'Delivery address',
|
|
||||||
'Discount' => 'Discount',
|
|
||||||
'Do you really want to delete this address ?' => 'Do you really want to delete this address ?',
|
|
||||||
'Edit' => 'Edit',
|
|
||||||
'Edit this address' => 'Edit this address',
|
|
||||||
'In Stock' => 'In Stock',
|
|
||||||
'My order' => 'My order',
|
|
||||||
'Name' => 'Name',
|
|
||||||
'Next Step' => 'Next Step',
|
|
||||||
'No.' => 'No.',
|
|
||||||
'Ok' => 'Ok',
|
|
||||||
'Out of Stock' => 'Out of stock',
|
|
||||||
'Price' => 'Price',
|
|
||||||
'Product Name' => 'Product Name',
|
|
||||||
'Qty' => 'Qty',
|
|
||||||
'Quantity' => 'Quantity',
|
|
||||||
'Remove this address' => 'Remove this address',
|
|
||||||
'Search' => 'Search',
|
|
||||||
'Shipping Tax' => 'Shipping Tax',
|
|
||||||
'Total' => 'Total',
|
|
||||||
'Unit Price' => 'Unit Price',
|
|
||||||
'You may have a coupon ?' => 'You may have a coupon ?',
|
|
||||||
'Your Cart' => 'Your Cart',
|
|
||||||
'instead of' => 'instead of',
|
|
||||||
);
|
|
||||||
@@ -1,164 +0,0 @@
|
|||||||
<?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 IciRelais;
|
|
||||||
|
|
||||||
use IciRelais\Model\IcirelaisFreeshippingQuery;
|
|
||||||
use Propel\Runtime\Connection\ConnectionInterface;
|
|
||||||
use Thelia\Exception\OrderException;
|
|
||||||
use Thelia\Install\Database;
|
|
||||||
use Thelia\Model\Country;
|
|
||||||
use Thelia\Module\AbstractDeliveryModule;
|
|
||||||
|
|
||||||
class IciRelais extends AbstractDeliveryModule
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* You may now override BaseModuleInterface methods, such as:
|
|
||||||
* install, destroy, preActivation, postActivation, preDeactivation, postDeactivation
|
|
||||||
*
|
|
||||||
* Have fun !
|
|
||||||
*/
|
|
||||||
|
|
||||||
const DOMAIN = 'icirelais';
|
|
||||||
|
|
||||||
protected $request;
|
|
||||||
protected $dispatcher;
|
|
||||||
|
|
||||||
private static $prices = null;
|
|
||||||
|
|
||||||
const JSON_PRICE_RESOURCE = "/Config/prices.json";
|
|
||||||
|
|
||||||
public function postActivation(ConnectionInterface $con = null)
|
|
||||||
{
|
|
||||||
$database = new Database($con->getWrappedConnection());
|
|
||||||
|
|
||||||
$database->insertSql(null, array(__DIR__ . '/Config/thelia.sql'));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getPrices()
|
|
||||||
{
|
|
||||||
if (null === self::$prices) {
|
|
||||||
if (is_readable(sprintf('%s/%s', __DIR__, self::JSON_PRICE_RESOURCE))) {
|
|
||||||
self::$prices = json_decode(
|
|
||||||
file_get_contents(sprintf('%s/%s', __DIR__, self::JSON_PRICE_RESOURCE)),
|
|
||||||
true
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
self::$prices = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return self::$prices;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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)
|
|
||||||
{
|
|
||||||
$cartWeight = $this->getRequest()->getSession()->getCart()->getWeight();
|
|
||||||
|
|
||||||
$areaId = $country->getAreaId();
|
|
||||||
|
|
||||||
$prices = self::getPrices();
|
|
||||||
|
|
||||||
/* check if Ici Relais delivers the asked area */
|
|
||||||
if (isset($prices[$areaId]) && isset($prices[$areaId]["slices"])) {
|
|
||||||
$areaPrices = $prices[$areaId]["slices"];
|
|
||||||
ksort($areaPrices);
|
|
||||||
|
|
||||||
/* check this weight is not too much */
|
|
||||||
end($areaPrices);
|
|
||||||
|
|
||||||
$maxWeight = key($areaPrices);
|
|
||||||
if ($cartWeight <= $maxWeight) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getPostageAmount($areaId, $weight)
|
|
||||||
{
|
|
||||||
$freeshipping = IcirelaisFreeshippingQuery::create()->getLast();
|
|
||||||
$postage=0;
|
|
||||||
if (!$freeshipping) {
|
|
||||||
$prices = self::getPrices();
|
|
||||||
|
|
||||||
/* check if IciRelais delivers the asked area */
|
|
||||||
if (!isset($prices[$areaId]) || !isset($prices[$areaId]["slices"])) {
|
|
||||||
throw new OrderException(
|
|
||||||
"Ici Relais delivery unavailable for the chosen delivery country",
|
|
||||||
OrderException::DELIVERY_MODULE_UNAVAILABLE
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$areaPrices = $prices[$areaId]["slices"];
|
|
||||||
ksort($areaPrices);
|
|
||||||
|
|
||||||
/* check this weight is not too much */
|
|
||||||
end($areaPrices);
|
|
||||||
$maxWeight = key($areaPrices);
|
|
||||||
if ($weight > $maxWeight) {
|
|
||||||
throw new OrderException(
|
|
||||||
sprintf("Ici Relais delivery unavailable for this cart weight (%s kg)", $weight),
|
|
||||||
OrderException::DELIVERY_MODULE_UNAVAILABLE
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$postage = current($areaPrices);
|
|
||||||
|
|
||||||
while (prev($areaPrices)) {
|
|
||||||
if ($weight > key($areaPrices)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$postage = current($areaPrices);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $postage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPostage(Country $country)
|
|
||||||
{
|
|
||||||
$cartWeight = $this->getRequest()->getSession()->getCart()->getWeight();
|
|
||||||
|
|
||||||
$postage = self::getPostageAmount(
|
|
||||||
$country->getAreaId(),
|
|
||||||
$cartWeight
|
|
||||||
);
|
|
||||||
|
|
||||||
return $postage;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,674 +0,0 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 29 June 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The GNU General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
|
||||||
the GNU General Public License is intended to guarantee your freedom to
|
|
||||||
share and change all versions of a program--to make sure it remains free
|
|
||||||
software for all its users. We, the Free Software Foundation, use the
|
|
||||||
GNU General Public License for most of our software; it applies also to
|
|
||||||
any other work released this way by its authors. You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
them if you wish), that you receive source code or can get it if you
|
|
||||||
want it, that you can change the software or use pieces of it in new
|
|
||||||
free programs, and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to prevent others from denying you
|
|
||||||
these rights or asking you to surrender the rights. Therefore, you have
|
|
||||||
certain responsibilities if you distribute copies of the software, or if
|
|
||||||
you modify it: responsibilities to respect the freedom of others.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must pass on to the recipients the same
|
|
||||||
freedoms that you received. You must make sure that they, too, receive
|
|
||||||
or can get the source code. And you must show them these terms so they
|
|
||||||
know their rights.
|
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps:
|
|
||||||
(1) assert copyright on the software, and (2) offer you this License
|
|
||||||
giving you legal permission to copy, distribute and/or modify it.
|
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains
|
|
||||||
that there is no warranty for this free software. For both users' and
|
|
||||||
authors' sake, the GPL requires that modified versions be marked as
|
|
||||||
changed, so that their problems will not be attributed erroneously to
|
|
||||||
authors of previous versions.
|
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run
|
|
||||||
modified versions of the software inside them, although the manufacturer
|
|
||||||
can do so. This is fundamentally incompatible with the aim of
|
|
||||||
protecting users' freedom to change the software. The systematic
|
|
||||||
pattern of such abuse occurs in the area of products for individuals to
|
|
||||||
use, which is precisely where it is most unacceptable. Therefore, we
|
|
||||||
have designed this version of the GPL to prohibit the practice for those
|
|
||||||
products. If such problems arise substantially in other domains, we
|
|
||||||
stand ready to extend this provision to those domains in future versions
|
|
||||||
of the GPL, as needed to protect the freedom of users.
|
|
||||||
|
|
||||||
Finally, every program is threatened constantly by software patents.
|
|
||||||
States should not allow patents to restrict development and use of
|
|
||||||
software on general-purpose computers, but in those that do, we wish to
|
|
||||||
avoid the special danger that patents applied to a free program could
|
|
||||||
make it effectively proprietary. To prevent this, the GPL assures that
|
|
||||||
patents cannot be used to render the program non-free.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Use with the GNU Affero General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU Affero General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the special requirements of the GNU Affero General Public License,
|
|
||||||
section 13, concerning interaction through a network will apply to the
|
|
||||||
combination as such.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU General Public License from time to time. Such new versions will
|
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short
|
|
||||||
notice like this when it starts in an interactive mode:
|
|
||||||
|
|
||||||
<program> Copyright (C) <year> <name of author>
|
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, your program's commands
|
|
||||||
might be different; for a GUI interface, you would use an "about box".
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU GPL, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
|
||||||
may consider it more useful to permit linking proprietary applications with
|
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License. But first, please read
|
|
||||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
||||||
@@ -1,139 +0,0 @@
|
|||||||
<?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 IciRelais\Listener;
|
|
||||||
|
|
||||||
use IciRelais\IciRelais;
|
|
||||||
use IciRelais\Loop\IciRelaisOrders;
|
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|
||||||
use Thelia\Action\BaseAction;
|
|
||||||
use Thelia\Core\Event\Order\OrderEvent;
|
|
||||||
use Thelia\Core\Event\TheliaEvents;
|
|
||||||
use Thelia\Mailer\MailerFactory;
|
|
||||||
use Thelia\Core\Template\ParserInterface;
|
|
||||||
use Thelia\Model\ConfigQuery;
|
|
||||||
use Thelia\Model\MessageQuery;
|
|
||||||
/**
|
|
||||||
* Class SendEMail
|
|
||||||
* @package IciRelais\Listener
|
|
||||||
* @author Thelia <info@thelia.net>
|
|
||||||
*/
|
|
||||||
class SendEMail 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \Thelia\Mailer\MailerFactory
|
|
||||||
*/
|
|
||||||
public function getMailer()
|
|
||||||
{
|
|
||||||
return $this->mailer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @params OrderEvent $order
|
|
||||||
* Checks if order delivery module is icirelais and if order new status is sent, send an email to the customer.
|
|
||||||
*/
|
|
||||||
public function update_status(OrderEvent $event)
|
|
||||||
{
|
|
||||||
if ($event->getOrder()->getDeliveryModuleId() === IciRelais::getModuleId()) {
|
|
||||||
|
|
||||||
if ($event->getOrder()->getStatusId() === IciRelaisOrders::STATUS_SENT ) {
|
|
||||||
$contact_email = ConfigQuery::read('store_email');
|
|
||||||
|
|
||||||
if ($contact_email) {
|
|
||||||
$message = MessageQuery::create()
|
|
||||||
->filterByName('order_confirmation_icirelais')
|
|
||||||
->findOne();
|
|
||||||
|
|
||||||
if (false === $message) {
|
|
||||||
throw new \Exception("Failed to load message 'order_confirmation_icirelais'.");
|
|
||||||
}
|
|
||||||
|
|
||||||
$order = $event->getOrder();
|
|
||||||
$customer = $order->getCustomer();
|
|
||||||
|
|
||||||
$this->parser->assign('order_id', $order->getId());
|
|
||||||
$this->parser->assign('order_ref', $order->getRef());
|
|
||||||
|
|
||||||
$message
|
|
||||||
->setLocale($order->getLang()->getLocale());
|
|
||||||
|
|
||||||
$instance = \Swift_Message::newInstance()
|
|
||||||
->addTo($customer->getEmail(), $customer->getFirstname()." ".$customer->getLastname())
|
|
||||||
->addFrom($contact_email, ConfigQuery::read('store_name'))
|
|
||||||
;
|
|
||||||
|
|
||||||
// Build subject and body
|
|
||||||
$message->buildMessage($this->parser, $instance);
|
|
||||||
|
|
||||||
$this->getMailer()->send($instance);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an array of event names this subscriber wants to listen to.
|
|
||||||
*
|
|
||||||
* The array keys are event names and the value can be:
|
|
||||||
*
|
|
||||||
* * The method name to call (priority defaults to 0)
|
|
||||||
* * An array composed of the method name to call and the priority
|
|
||||||
* * An array of arrays composed of the method names to call and respective
|
|
||||||
* priorities, or 0 if unset
|
|
||||||
*
|
|
||||||
* For instance:
|
|
||||||
*
|
|
||||||
* * array('eventName' => 'methodName')
|
|
||||||
* * array('eventName' => array('methodName', $priority))
|
|
||||||
* * array('eventName' => array(array('methodName1', $priority), array('methodName2'))
|
|
||||||
*
|
|
||||||
* @return array The event names to listen to
|
|
||||||
*
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
public static function getSubscribedEvents()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
TheliaEvents::ORDER_UPDATE_STATUS => array("update_status", 128)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,171 +0,0 @@
|
|||||||
<?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 IciRelais\Listener;
|
|
||||||
|
|
||||||
use IciRelais\IciRelais;
|
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|
||||||
use Thelia\Core\Event\Order\OrderEvent;
|
|
||||||
use Thelia\Core\Event\TheliaEvents;
|
|
||||||
|
|
||||||
use IciRelais\Model\OrderAddressIcirelais;
|
|
||||||
use Thelia\Core\HttpFoundation\Request;
|
|
||||||
use Thelia\Model\OrderAddressQuery;
|
|
||||||
use IciRelais\Model\AddressIcirelais;
|
|
||||||
use IciRelais\Model\AddressIcirelaisQuery;
|
|
||||||
use Thelia\Model\AddressQuery;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class SetDeliveryModule
|
|
||||||
* @package IciRelais\Listener
|
|
||||||
* @author Thelia <info@thelia.net>
|
|
||||||
*/
|
|
||||||
|
|
||||||
class SetDeliveryModule implements EventSubscriberInterface
|
|
||||||
{
|
|
||||||
protected $request;
|
|
||||||
public function __construct(Request $request)
|
|
||||||
{
|
|
||||||
$this->request = $request;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \Thelia\Core\HttpFoundation\Request
|
|
||||||
*/
|
|
||||||
public function getRequest()
|
|
||||||
{
|
|
||||||
return $this->request;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function check_module($id)
|
|
||||||
{
|
|
||||||
return $id == IciRelais::getModuleId();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isModuleIciRelais(OrderEvent $event)
|
|
||||||
{
|
|
||||||
$address = AddressIcirelaisQuery::create()
|
|
||||||
->findPk($event->getDeliveryAddress());
|
|
||||||
|
|
||||||
if ($this->check_module($event->getDeliveryModule())) {
|
|
||||||
//tmp solution
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$pr_code = $request->request->get('pr_code');
|
|
||||||
if (!empty($pr_code)) {
|
|
||||||
// Get details w/ SOAP
|
|
||||||
$con = new \SoapClient(__DIR__."/../Config/exapaq.wsdl", array('soap_version'=>SOAP_1_2));
|
|
||||||
$response = $con->GetPudoDetails(array("pudo_id"=>$pr_code));
|
|
||||||
$xml = new \SimpleXMLElement($response->GetPudoDetailsResult->any);
|
|
||||||
if (isset($xml->ERROR)) {
|
|
||||||
throw new \ErrorException("Error while choosing pick-up & go store: ".$xml->ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
$customer_name = AddressQuery::create()
|
|
||||||
->findPk($event->getDeliveryAddress());
|
|
||||||
|
|
||||||
|
|
||||||
$request->getSession()->set('IciRelaisDeliveryId', $event->getDeliveryAddress());
|
|
||||||
if ($address === null) {
|
|
||||||
$address = new AddressIcirelais();
|
|
||||||
$address->setId($event->getDeliveryAddress());
|
|
||||||
}
|
|
||||||
|
|
||||||
// France Métropolitaine
|
|
||||||
$address->setCode($pr_code)
|
|
||||||
->setCompany((string) $xml->PUDO_ITEMS->PUDO_ITEM->NAME)
|
|
||||||
->setAddress1((string) $xml->PUDO_ITEMS->PUDO_ITEM->ADDRESS1)
|
|
||||||
->setAddress2((string) $xml->PUDO_ITEMS->PUDO_ITEM->ADDRESS2)
|
|
||||||
->setAddress3((string) $xml->PUDO_ITEMS->PUDO_ITEM->ADDRESS3)
|
|
||||||
->setZipcode((string) $xml->PUDO_ITEMS->PUDO_ITEM->ZIPCODE)
|
|
||||||
->setCity((string) $xml->PUDO_ITEMS->PUDO_ITEM->CITY)
|
|
||||||
->setFirstname($customer_name->getFirstname())
|
|
||||||
->setLastname($customer_name->getLastname())
|
|
||||||
->setTitleId($customer_name->getTitleId())
|
|
||||||
->setCountryId($customer_name->getCountryId())
|
|
||||||
->save();
|
|
||||||
} else {
|
|
||||||
throw new \ErrorException("No pick-up & go store chosen for IciRelais delivery module");
|
|
||||||
}
|
|
||||||
} elseif (null !== $address) {
|
|
||||||
$address->delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function updateDeliveryAddress(OrderEvent $event)
|
|
||||||
{
|
|
||||||
if ($this->check_module($event->getOrder()->getDeliveryModuleId())) {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$tmp_address = AddressIcirelaisQuery::create()
|
|
||||||
->findPk($request->getSession()->get('IciRelaisDeliveryId'));
|
|
||||||
|
|
||||||
if ($tmp_address === null) {
|
|
||||||
throw new \ErrorException("Got an error with IciRelais module. Please try again to checkout.");
|
|
||||||
}
|
|
||||||
|
|
||||||
$savecode = new OrderAddressIcirelais();
|
|
||||||
$savecode->setId($event->getOrder()->getDeliveryOrderAddressId())
|
|
||||||
->setCode($tmp_address->getCode())
|
|
||||||
->save();
|
|
||||||
|
|
||||||
$update = OrderAddressQuery::create()
|
|
||||||
->findPK($event->getOrder()->getDeliveryOrderAddressId())
|
|
||||||
->setCompany($tmp_address->getCompany())
|
|
||||||
->setAddress1($tmp_address->getAddress1())
|
|
||||||
->setAddress2($tmp_address->getAddress2())
|
|
||||||
->setAddress3($tmp_address->getAddress3())
|
|
||||||
->setZipcode($tmp_address->getZipcode())
|
|
||||||
->setCity($tmp_address->getCity())
|
|
||||||
->save();
|
|
||||||
|
|
||||||
$tmp_address->delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an array of event names this subscriber wants to listen to.
|
|
||||||
*
|
|
||||||
* The array keys are event names and the value can be:
|
|
||||||
*
|
|
||||||
* * The method name to call (priority defaults to 0)
|
|
||||||
* * An array composed of the method name to call and the priority
|
|
||||||
* * An array of arrays composed of the method names to call and respective
|
|
||||||
* priorities, or 0 if unset
|
|
||||||
*
|
|
||||||
* For instance:
|
|
||||||
*
|
|
||||||
* * array('eventName' => 'methodName')
|
|
||||||
* * array('eventName' => array('methodName', $priority))
|
|
||||||
* * array('eventName' => array(array('methodName1', $priority), array('methodName2'))
|
|
||||||
*
|
|
||||||
* @return array The event names to listen to
|
|
||||||
*
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
public static function getSubscribedEvents()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
TheliaEvents::ORDER_SET_DELIVERY_MODULE => array('isModuleIciRelais', 64),
|
|
||||||
TheliaEvents::ORDER_BEFORE_PAYMENT => array('updateDeliveryAddress', 256)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
<?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 IciRelais\Loop;
|
|
||||||
|
|
||||||
use IciRelais\IciRelais;
|
|
||||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
|
||||||
use Thelia\Core\Template\Element\BaseLoop;
|
|
||||||
use Thelia\Core\Template\Element\LoopResultRow;
|
|
||||||
use Thelia\Core\Template\Element\LoopResult;
|
|
||||||
use Thelia\Core\Template\Element\ArraySearchLoopInterface;
|
|
||||||
use Thelia\Core\Translation\Translator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class CheckRightsLoop
|
|
||||||
* @package IciRelais\Looop
|
|
||||||
* @author Thelia <info@thelia.net>
|
|
||||||
*/
|
|
||||||
|
|
||||||
class CheckRightsLoop extends BaseLoop implements ArraySearchLoopInterface
|
|
||||||
{
|
|
||||||
protected function getArgDefinitions()
|
|
||||||
{
|
|
||||||
return new ArgumentCollection();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildArray()
|
|
||||||
{
|
|
||||||
$ret = array();
|
|
||||||
$dir = __DIR__."/../Config/";
|
|
||||||
if (!is_readable($dir)) {
|
|
||||||
$ret[] = array("ERRMES"=>Translator::getInstance()->trans(
|
|
||||||
"Can't read Config directory",
|
|
||||||
[],
|
|
||||||
IciRelais::DOMAIN
|
|
||||||
), "ERRFILE"=>"");
|
|
||||||
}
|
|
||||||
if (!is_writable($dir)) {
|
|
||||||
$ret[] = array("ERRMES"=>Translator::getInstance()->trans(
|
|
||||||
"Can't write Config directory",
|
|
||||||
[],
|
|
||||||
IciRelais::DOMAIN
|
|
||||||
), "ERRFILE"=>"");
|
|
||||||
}
|
|
||||||
if ($handle = opendir($dir)) {
|
|
||||||
while (false !== ($file = readdir($handle))) {
|
|
||||||
if (strlen($file) > 5 && substr($file, -5) === ".json") {
|
|
||||||
if (!is_readable($dir.$file)) {
|
|
||||||
$ret[] = array("ERRMES"=>Translator::getInstance()->trans(
|
|
||||||
"Can't read file",
|
|
||||||
[],
|
|
||||||
IciRelais::DOMAIN
|
|
||||||
), "ERRFILE"=>"Icirelais/Config/".$file);
|
|
||||||
}
|
|
||||||
if (!is_writable($dir.$file)) {
|
|
||||||
$ret[] = array("ERRMES"=>Translator::getInstance()->trans(
|
|
||||||
"Can't write file",
|
|
||||||
[],
|
|
||||||
IciRelais::DOMAIN
|
|
||||||
), "ERRFILE"=>"Icirelais/Config/".$file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
public function parseResults(LoopResult $loopResult)
|
|
||||||
{
|
|
||||||
foreach ($loopResult->getResultDataCollection() as $arr) {
|
|
||||||
$loopResultRow = new LoopResultRow();
|
|
||||||
$loopResultRow->set("ERRMES", $arr["ERRMES"])
|
|
||||||
->set("ERRFILE", $arr["ERRFILE"]);
|
|
||||||
$loopResult->addRow($loopResultRow);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $loopResult;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
<?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 IciRelais\Loop;
|
|
||||||
|
|
||||||
use IciRelais\Model\AddressIcirelaisQuery;
|
|
||||||
use Thelia\Core\Template\Loop\Address;
|
|
||||||
use Thelia\Core\Template\Element\LoopResult;
|
|
||||||
use Thelia\Core\Template\Element\LoopResultRow;
|
|
||||||
use IciRelais\IciRelais;
|
|
||||||
/**
|
|
||||||
* Class IciRelaisDelivery
|
|
||||||
* @package IciRelais\Loop
|
|
||||||
* @author Thelia <info@thelia.net>
|
|
||||||
*/
|
|
||||||
class IciRelaisAddress extends Address
|
|
||||||
{
|
|
||||||
protected $exists = false;
|
|
||||||
protected $timestampable = false;
|
|
||||||
|
|
||||||
protected function setExists($id)
|
|
||||||
{
|
|
||||||
$this->exists = AddressIcirelaisQuery::create()->findPK($id) !== null;
|
|
||||||
}
|
|
||||||
public function buildModelCriteria()
|
|
||||||
{
|
|
||||||
$id = $this->getId();
|
|
||||||
$this->setExists($id[0]);
|
|
||||||
|
|
||||||
return $this->exists ?
|
|
||||||
AddressIcirelaisQuery::create()->filterById($id[0]) :
|
|
||||||
parent::buildModelCriteria();
|
|
||||||
}
|
|
||||||
public function parseResults(LoopResult $loopResult)
|
|
||||||
{
|
|
||||||
if (!$this->exists) {
|
|
||||||
return parent::parseResults($loopResult);
|
|
||||||
} else {
|
|
||||||
foreach ($loopResult->getResultDataCollection() as $address) {
|
|
||||||
$loopResultRow = new LoopResultRow();
|
|
||||||
$loopResultRow->set("TITLE", $address->getTitleId())
|
|
||||||
->set("COMPANY", $address->getCompany())
|
|
||||||
->set("FIRSTNAME", $address->getFirstname())
|
|
||||||
->set("LASTNAME", $address->getLastname())
|
|
||||||
->set("ADDRESS1", $address->getAddress1())
|
|
||||||
->set("ADDRESS2", $address->getAddress2())
|
|
||||||
->set("ADDRESS3", $address->getAddress3())
|
|
||||||
->set("ZIPCODE", $address->getZipcode())
|
|
||||||
->set("CITY", $address->getCity())
|
|
||||||
->set("COUNTRY", $address->getCountryId())
|
|
||||||
; $loopResult->addRow($loopResultRow);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $loopResult;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,154 +0,0 @@
|
|||||||
<?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 IciRelais\Loop;
|
|
||||||
|
|
||||||
use Thelia\Log\Tlog;
|
|
||||||
use Thelia\Model\AddressQuery;
|
|
||||||
use Thelia\Core\Template\Loop\Address;
|
|
||||||
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
|
|
||||||
use Thelia\Core\Template\Element\BaseLoop;
|
|
||||||
use Thelia\Core\Template\Element\LoopResult;
|
|
||||||
use Thelia\Core\Template\Element\LoopResultRow;
|
|
||||||
|
|
||||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
|
||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
|
||||||
/**
|
|
||||||
* Class IciRelaisAround
|
|
||||||
* @package IciRelais\Loop
|
|
||||||
* @author Thelia <info@thelia.net>
|
|
||||||
*/
|
|
||||||
class IciRelaisAround extends BaseLoop implements PropelSearchLoopInterface
|
|
||||||
{
|
|
||||||
private $addressflag=true;
|
|
||||||
private $zipcode="";
|
|
||||||
private $city="";
|
|
||||||
/**
|
|
||||||
* @return ArgumentCollection
|
|
||||||
*/
|
|
||||||
protected function getArgDefinitions()
|
|
||||||
{
|
|
||||||
return new ArgumentCollection(
|
|
||||||
Argument::createAnyTypeArgument("zipcode", ""),
|
|
||||||
Argument::createAnyTypeArgument("city","")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildModelCriteria()
|
|
||||||
{
|
|
||||||
$zipcode = $this->getZipcode();
|
|
||||||
$city = $this->getCity();
|
|
||||||
if (!empty($zipcode) and !empty($city)) {
|
|
||||||
$this->zipcode = $zipcode;
|
|
||||||
$this->city = $city;
|
|
||||||
$this->addressflag = false;
|
|
||||||
} else {
|
|
||||||
$search = AddressQuery::create();
|
|
||||||
|
|
||||||
$customer=$this->securityContext->getCustomerUser();
|
|
||||||
if ($customer !== null) {
|
|
||||||
$search->filterByCustomerId($customer->getId());
|
|
||||||
$search->filterByIsDefault("1");
|
|
||||||
} else {
|
|
||||||
throw new \ErrorException("Customer not connected.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return $search;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function parseResults(LoopResult $loopResult)
|
|
||||||
{
|
|
||||||
$date = date('d/m/Y');
|
|
||||||
try {
|
|
||||||
$getPudoSoap = new \SoapClient(__DIR__ . "/../Config/exapaq.wsdl", array('soap_version' => SOAP_1_2));
|
|
||||||
|
|
||||||
if ($this->addressflag) {
|
|
||||||
foreach ($loopResult->getResultDataCollection() as $address) {
|
|
||||||
$response = $getPudoSoap->GetPudoList(
|
|
||||||
array(
|
|
||||||
"address" => str_replace(" ", "%", $address->getAddress1()),
|
|
||||||
"zipCode" => $address->getZipcode(),
|
|
||||||
"city" => str_replace(" ", "%", $address->getCity()),
|
|
||||||
"request_id" => "1234",
|
|
||||||
"date_from" => $date
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$response = $getPudoSoap->GetPudoList(
|
|
||||||
array(
|
|
||||||
"zipCode" => $this->zipcode,
|
|
||||||
"city" => str_replace(" ", "%", $this->city),
|
|
||||||
"request_id" => "1234",
|
|
||||||
"date_from" => $date
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} catch (\SoapFault $e) {
|
|
||||||
Tlog::getInstance()->error(
|
|
||||||
sprintf(
|
|
||||||
"[%s %s - SOAP Error %d]: %s",
|
|
||||||
$date,
|
|
||||||
date("H:i:s"),
|
|
||||||
(int) $e->getCode(),
|
|
||||||
(string) $e->getMessage()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
|
|
||||||
$xml = new \SimpleXMLElement($response->GetPudoListResult->any);
|
|
||||||
if (isset($xml->ERROR)) {
|
|
||||||
throw new \ErrorException("Error while choosing pick-up & go store: " . $xml->ERROR);
|
|
||||||
}
|
|
||||||
foreach ($xml->PUDO_ITEMS->PUDO_ITEM as $item) {
|
|
||||||
$loopResultRow = new LoopResultRow();
|
|
||||||
// Write distance in m / km
|
|
||||||
$distance = $item->DISTANCE;
|
|
||||||
if (strlen($distance) < 4) {
|
|
||||||
$distance .= " m";
|
|
||||||
} else {
|
|
||||||
$distance = (string) floatval($distance) / 1000;
|
|
||||||
while (substr($distance, strlen($distance) - 1, 1) == "0") {
|
|
||||||
$distance = substr($distance, 0, strlen($distance) - 1);
|
|
||||||
}
|
|
||||||
$distance = str_replace(".", ",", $distance) . " km";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then define all the variables
|
|
||||||
$loopResultRow->set("NAME", $item->NAME)
|
|
||||||
->set("LONGITUDE", str_replace(",", ".", $item->LONGITUDE))
|
|
||||||
->set("LATITUDE", str_replace(",", ".", $item->LATITUDE))
|
|
||||||
->set("CODE", $item->PUDO_ID)
|
|
||||||
->set("ADDRESS", $item->ADDRESS1)
|
|
||||||
->set("ZIPCODE", $item->ZIPCODE)
|
|
||||||
->set("CITY", $item->CITY)
|
|
||||||
->set("DISTANCE", $distance);
|
|
||||||
$loopResult->addRow($loopResultRow);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $loopResult;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
<?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 IciRelais\Loop;
|
|
||||||
|
|
||||||
use Thelia\Core\Template\Loop\Delivery;
|
|
||||||
use Thelia\Core\Template\Element\LoopResult;
|
|
||||||
|
|
||||||
use IciRelais\IciRelais;
|
|
||||||
/**
|
|
||||||
* Class IciRelaisDelivery
|
|
||||||
* @package IciRelais\Loop
|
|
||||||
* @author Thelia <info@thelia.net>
|
|
||||||
*/
|
|
||||||
class IciRelaisDelivery extends Delivery
|
|
||||||
{
|
|
||||||
public function parseResults(LoopResult $loopResult)
|
|
||||||
{
|
|
||||||
$icirelaiskey = IciRelais::getModuleId();
|
|
||||||
|
|
||||||
$loopResult = parent::parseResults($loopResult);
|
|
||||||
for ($loopResult->rewind(); $loopResult->valid(); $loopResult->next()) {
|
|
||||||
$loopResult->current()->set("ICI_RELAIS_MODULE", $icirelaiskey);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $loopResult;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
<?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 IciRelais\Loop;
|
|
||||||
use Thelia\Core\Template\Loop\Order;
|
|
||||||
use IciRelais\IciRelais;
|
|
||||||
use Thelia\Model\OrderQuery;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class IciRelaisOrders
|
|
||||||
* @package IciRelais\Loop
|
|
||||||
* @author Thelia <info@thelia.net>
|
|
||||||
*/
|
|
||||||
class IciRelaisOrders extends Order
|
|
||||||
{
|
|
||||||
const STATUS_PAID = 2;
|
|
||||||
const STATUS_PROCESSING = 3;
|
|
||||||
const STATUS_SENT = 4;
|
|
||||||
public function buildModelCriteria()
|
|
||||||
{
|
|
||||||
return OrderQuery::create()
|
|
||||||
->filterByDeliveryModuleId(IciRelais::getModuleId())
|
|
||||||
->filterByStatusId(array(self::STATUS_PAID,self::STATUS_PROCESSING));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
<?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 IciRelais\Loop;
|
|
||||||
|
|
||||||
use IciRelais\IciRelais;
|
|
||||||
use Thelia\Core\Template\Element\ArraySearchLoopInterface;
|
|
||||||
use Thelia\Core\Template\Element\BaseLoop;
|
|
||||||
use Thelia\Core\Template\Element\LoopResult;
|
|
||||||
use Thelia\Core\Template\Element\LoopResultRow;
|
|
||||||
|
|
||||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
|
||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class IciRelaisPrice
|
|
||||||
* @package IciRelais\Loop
|
|
||||||
* @author Thelia <info@thelia.net>
|
|
||||||
* @original_author Etienne Roudeix <eroudeix@openstudio.fr>
|
|
||||||
*/
|
|
||||||
class IciRelaisPrice extends BaseLoop implements ArraySearchLoopInterface
|
|
||||||
{
|
|
||||||
/* set countable to false since we need to preserve keys */
|
|
||||||
protected $countable = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return ArgumentCollection
|
|
||||||
*/
|
|
||||||
protected function getArgDefinitions()
|
|
||||||
{
|
|
||||||
return new ArgumentCollection(
|
|
||||||
Argument::createIntTypeArgument('area', null, true)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildArray()
|
|
||||||
{
|
|
||||||
$area = $this->getArea();
|
|
||||||
|
|
||||||
$prices = IciRelais::getPrices();
|
|
||||||
|
|
||||||
if (!isset($prices[$area]) || !isset($prices[$area]["slices"])) {
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
|
|
||||||
$areaPrices = $prices[$area]["slices"];
|
|
||||||
ksort($areaPrices);
|
|
||||||
|
|
||||||
return $areaPrices;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function parseResults(LoopResult $loopResult)
|
|
||||||
{
|
|
||||||
foreach ($loopResult->getResultDataCollection() as $maxWeight => $price) {
|
|
||||||
$loopResultRow = new LoopResultRow();
|
|
||||||
$loopResultRow->set("MAX_WEIGHT", $maxWeight)
|
|
||||||
->set("PRICE", $price);
|
|
||||||
|
|
||||||
$loopResult->addRow($loopResultRow);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $loopResult;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
<?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 IciRelais\Loop;
|
|
||||||
|
|
||||||
use IciRelais\Controller\ExportExaprint;
|
|
||||||
use IciRelais\IciRelais;
|
|
||||||
use Thelia\Core\Template\Element\ArraySearchLoopInterface;
|
|
||||||
use Thelia\Core\Template\Element\BaseLoop;
|
|
||||||
use Thelia\Core\Template\Element\LoopResult;
|
|
||||||
use Thelia\Core\Template\Element\LoopResultRow;
|
|
||||||
|
|
||||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
|
||||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
|
||||||
use Thelia\Model\OrderQuery;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class IciRelaisUrlTracking
|
|
||||||
* @package IciRelais\Loop
|
|
||||||
* @author Thelia <info@thelia.net>
|
|
||||||
*/
|
|
||||||
class IciRelaisUrlTracking extends BaseLoop implements ArraySearchLoopInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @return ArgumentCollection
|
|
||||||
*/
|
|
||||||
const BASE_URL="http://e-trace.ils-consult.fr/ici-webtrace/webclients.aspx?verknr=%s&versdat=&kundenr=%s&cmd=VERKNR_SEARCH";
|
|
||||||
protected function getArgDefinitions()
|
|
||||||
{
|
|
||||||
return new ArgumentCollection(
|
|
||||||
Argument::createAnyTypeArgument('ref', null, true)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildArray()
|
|
||||||
{
|
|
||||||
$path=ExportExaprint::getJSONpath();
|
|
||||||
if(is_readable($path) && ($order=OrderQuery::create()->findOneByRef($this->getRef())) !== null
|
|
||||||
&& $order->getDeliveryModuleId() === IciRelais::getModuleId()) {
|
|
||||||
$json=json_decode(file_get_contents($path),true);
|
|
||||||
|
|
||||||
return array($this->getRef()=>$json['expcode']);
|
|
||||||
} else {
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function parseResults(LoopResult $loopResult)
|
|
||||||
{
|
|
||||||
foreach ($loopResult->getResultDataCollection() as $ref => $code) {
|
|
||||||
$loopResultRow = new LoopResultRow();
|
|
||||||
$loopResultRow->set("URL", sprintf(self::BASE_URL,$ref,$code));
|
|
||||||
|
|
||||||
$loopResult->addRow($loopResultRow);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $loopResult;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace IciRelais\Model;
|
|
||||||
|
|
||||||
use IciRelais\Model\Base\AddressIcirelais as BaseAddressIcirelais;
|
|
||||||
|
|
||||||
class AddressIcirelais extends BaseAddressIcirelais
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,895 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace IciRelais\Model\Base;
|
|
||||||
|
|
||||||
use \Exception;
|
|
||||||
use \PDO;
|
|
||||||
use IciRelais\Model\AddressIcirelais as ChildAddressIcirelais;
|
|
||||||
use IciRelais\Model\AddressIcirelaisQuery as ChildAddressIcirelaisQuery;
|
|
||||||
use IciRelais\Model\Map\AddressIcirelaisTableMap;
|
|
||||||
use IciRelais\Model\Thelia\Model\Country;
|
|
||||||
use IciRelais\Model\Thelia\Model\CustomerTitle;
|
|
||||||
use Propel\Runtime\Propel;
|
|
||||||
use Propel\Runtime\ActiveQuery\Criteria;
|
|
||||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
|
||||||
use Propel\Runtime\ActiveQuery\ModelJoin;
|
|
||||||
use Propel\Runtime\Collection\Collection;
|
|
||||||
use Propel\Runtime\Collection\ObjectCollection;
|
|
||||||
use Propel\Runtime\Connection\ConnectionInterface;
|
|
||||||
use Propel\Runtime\Exception\PropelException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base class that represents a query for the 'address_icirelais' table.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @method ChildAddressIcirelaisQuery orderById($order = Criteria::ASC) Order by the id column
|
|
||||||
* @method ChildAddressIcirelaisQuery orderByTitleId($order = Criteria::ASC) Order by the title_id column
|
|
||||||
* @method ChildAddressIcirelaisQuery orderByCompany($order = Criteria::ASC) Order by the company column
|
|
||||||
* @method ChildAddressIcirelaisQuery orderByFirstname($order = Criteria::ASC) Order by the firstname column
|
|
||||||
* @method ChildAddressIcirelaisQuery orderByLastname($order = Criteria::ASC) Order by the lastname column
|
|
||||||
* @method ChildAddressIcirelaisQuery orderByAddress1($order = Criteria::ASC) Order by the address1 column
|
|
||||||
* @method ChildAddressIcirelaisQuery orderByAddress2($order = Criteria::ASC) Order by the address2 column
|
|
||||||
* @method ChildAddressIcirelaisQuery orderByAddress3($order = Criteria::ASC) Order by the address3 column
|
|
||||||
* @method ChildAddressIcirelaisQuery orderByZipcode($order = Criteria::ASC) Order by the zipcode column
|
|
||||||
* @method ChildAddressIcirelaisQuery orderByCity($order = Criteria::ASC) Order by the city column
|
|
||||||
* @method ChildAddressIcirelaisQuery orderByCountryId($order = Criteria::ASC) Order by the country_id column
|
|
||||||
* @method ChildAddressIcirelaisQuery orderByCode($order = Criteria::ASC) Order by the code column
|
|
||||||
*
|
|
||||||
* @method ChildAddressIcirelaisQuery groupById() Group by the id column
|
|
||||||
* @method ChildAddressIcirelaisQuery groupByTitleId() Group by the title_id column
|
|
||||||
* @method ChildAddressIcirelaisQuery groupByCompany() Group by the company column
|
|
||||||
* @method ChildAddressIcirelaisQuery groupByFirstname() Group by the firstname column
|
|
||||||
* @method ChildAddressIcirelaisQuery groupByLastname() Group by the lastname column
|
|
||||||
* @method ChildAddressIcirelaisQuery groupByAddress1() Group by the address1 column
|
|
||||||
* @method ChildAddressIcirelaisQuery groupByAddress2() Group by the address2 column
|
|
||||||
* @method ChildAddressIcirelaisQuery groupByAddress3() Group by the address3 column
|
|
||||||
* @method ChildAddressIcirelaisQuery groupByZipcode() Group by the zipcode column
|
|
||||||
* @method ChildAddressIcirelaisQuery groupByCity() Group by the city column
|
|
||||||
* @method ChildAddressIcirelaisQuery groupByCountryId() Group by the country_id column
|
|
||||||
* @method ChildAddressIcirelaisQuery groupByCode() Group by the code column
|
|
||||||
*
|
|
||||||
* @method ChildAddressIcirelaisQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
|
||||||
* @method ChildAddressIcirelaisQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
|
||||||
* @method ChildAddressIcirelaisQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
|
||||||
*
|
|
||||||
* @method ChildAddressIcirelaisQuery leftJoinCustomerTitle($relationAlias = null) Adds a LEFT JOIN clause to the query using the CustomerTitle relation
|
|
||||||
* @method ChildAddressIcirelaisQuery rightJoinCustomerTitle($relationAlias = null) Adds a RIGHT JOIN clause to the query using the CustomerTitle relation
|
|
||||||
* @method ChildAddressIcirelaisQuery innerJoinCustomerTitle($relationAlias = null) Adds a INNER JOIN clause to the query using the CustomerTitle relation
|
|
||||||
*
|
|
||||||
* @method ChildAddressIcirelaisQuery leftJoinCountry($relationAlias = null) Adds a LEFT JOIN clause to the query using the Country relation
|
|
||||||
* @method ChildAddressIcirelaisQuery rightJoinCountry($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Country relation
|
|
||||||
* @method ChildAddressIcirelaisQuery innerJoinCountry($relationAlias = null) Adds a INNER JOIN clause to the query using the Country relation
|
|
||||||
*
|
|
||||||
* @method ChildAddressIcirelais findOne(ConnectionInterface $con = null) Return the first ChildAddressIcirelais matching the query
|
|
||||||
* @method ChildAddressIcirelais findOneOrCreate(ConnectionInterface $con = null) Return the first ChildAddressIcirelais matching the query, or a new ChildAddressIcirelais object populated from the query conditions when no match is found
|
|
||||||
*
|
|
||||||
* @method ChildAddressIcirelais findOneById(int $id) Return the first ChildAddressIcirelais filtered by the id column
|
|
||||||
* @method ChildAddressIcirelais findOneByTitleId(int $title_id) Return the first ChildAddressIcirelais filtered by the title_id column
|
|
||||||
* @method ChildAddressIcirelais findOneByCompany(string $company) Return the first ChildAddressIcirelais filtered by the company column
|
|
||||||
* @method ChildAddressIcirelais findOneByFirstname(string $firstname) Return the first ChildAddressIcirelais filtered by the firstname column
|
|
||||||
* @method ChildAddressIcirelais findOneByLastname(string $lastname) Return the first ChildAddressIcirelais filtered by the lastname column
|
|
||||||
* @method ChildAddressIcirelais findOneByAddress1(string $address1) Return the first ChildAddressIcirelais filtered by the address1 column
|
|
||||||
* @method ChildAddressIcirelais findOneByAddress2(string $address2) Return the first ChildAddressIcirelais filtered by the address2 column
|
|
||||||
* @method ChildAddressIcirelais findOneByAddress3(string $address3) Return the first ChildAddressIcirelais filtered by the address3 column
|
|
||||||
* @method ChildAddressIcirelais findOneByZipcode(string $zipcode) Return the first ChildAddressIcirelais filtered by the zipcode column
|
|
||||||
* @method ChildAddressIcirelais findOneByCity(string $city) Return the first ChildAddressIcirelais filtered by the city column
|
|
||||||
* @method ChildAddressIcirelais findOneByCountryId(int $country_id) Return the first ChildAddressIcirelais filtered by the country_id column
|
|
||||||
* @method ChildAddressIcirelais findOneByCode(string $code) Return the first ChildAddressIcirelais filtered by the code column
|
|
||||||
*
|
|
||||||
* @method array findById(int $id) Return ChildAddressIcirelais objects filtered by the id column
|
|
||||||
* @method array findByTitleId(int $title_id) Return ChildAddressIcirelais objects filtered by the title_id column
|
|
||||||
* @method array findByCompany(string $company) Return ChildAddressIcirelais objects filtered by the company column
|
|
||||||
* @method array findByFirstname(string $firstname) Return ChildAddressIcirelais objects filtered by the firstname column
|
|
||||||
* @method array findByLastname(string $lastname) Return ChildAddressIcirelais objects filtered by the lastname column
|
|
||||||
* @method array findByAddress1(string $address1) Return ChildAddressIcirelais objects filtered by the address1 column
|
|
||||||
* @method array findByAddress2(string $address2) Return ChildAddressIcirelais objects filtered by the address2 column
|
|
||||||
* @method array findByAddress3(string $address3) Return ChildAddressIcirelais objects filtered by the address3 column
|
|
||||||
* @method array findByZipcode(string $zipcode) Return ChildAddressIcirelais objects filtered by the zipcode column
|
|
||||||
* @method array findByCity(string $city) Return ChildAddressIcirelais objects filtered by the city column
|
|
||||||
* @method array findByCountryId(int $country_id) Return ChildAddressIcirelais objects filtered by the country_id column
|
|
||||||
* @method array findByCode(string $code) Return ChildAddressIcirelais objects filtered by the code column
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
abstract class AddressIcirelaisQuery extends ModelCriteria
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes internal state of \IciRelais\Model\Base\AddressIcirelaisQuery 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 = '\\IciRelais\\Model\\AddressIcirelais', $modelAlias = null)
|
|
||||||
{
|
|
||||||
parent::__construct($dbName, $modelName, $modelAlias);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new ChildAddressIcirelaisQuery object.
|
|
||||||
*
|
|
||||||
* @param string $modelAlias The alias of a model in the query
|
|
||||||
* @param Criteria $criteria Optional Criteria to build the query from
|
|
||||||
*
|
|
||||||
* @return ChildAddressIcirelaisQuery
|
|
||||||
*/
|
|
||||||
public static function create($modelAlias = null, $criteria = null)
|
|
||||||
{
|
|
||||||
if ($criteria instanceof \IciRelais\Model\AddressIcirelaisQuery) {
|
|
||||||
return $criteria;
|
|
||||||
}
|
|
||||||
$query = new \IciRelais\Model\AddressIcirelaisQuery();
|
|
||||||
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 ChildAddressIcirelais|array|mixed the result, formatted by the current formatter
|
|
||||||
*/
|
|
||||||
public function findPk($key, $con = null)
|
|
||||||
{
|
|
||||||
if ($key === null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if ((null !== ($obj = AddressIcirelaisTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
|
||||||
// the object is already in the instance pool
|
|
||||||
return $obj;
|
|
||||||
}
|
|
||||||
if ($con === null) {
|
|
||||||
$con = Propel::getServiceContainer()->getReadConnection(AddressIcirelaisTableMap::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 ChildAddressIcirelais A model object, or null if the key is not found
|
|
||||||
*/
|
|
||||||
protected function findPkSimple($key, $con)
|
|
||||||
{
|
|
||||||
$sql = 'SELECT ID, TITLE_ID, COMPANY, FIRSTNAME, LASTNAME, ADDRESS1, ADDRESS2, ADDRESS3, ZIPCODE, CITY, COUNTRY_ID, CODE FROM address_icirelais 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 ChildAddressIcirelais();
|
|
||||||
$obj->hydrate($row);
|
|
||||||
AddressIcirelaisTableMap::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 ChildAddressIcirelais|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 ChildAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByPrimaryKey($key)
|
|
||||||
{
|
|
||||||
return $this->addUsingAlias(AddressIcirelaisTableMap::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 ChildAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByPrimaryKeys($keys)
|
|
||||||
{
|
|
||||||
return $this->addUsingAlias(AddressIcirelaisTableMap::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 ChildAddressIcirelaisQuery 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(AddressIcirelaisTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
|
||||||
$useMinMax = true;
|
|
||||||
}
|
|
||||||
if (isset($id['max'])) {
|
|
||||||
$this->addUsingAlias(AddressIcirelaisTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
|
||||||
$useMinMax = true;
|
|
||||||
}
|
|
||||||
if ($useMinMax) {
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
if (null === $comparison) {
|
|
||||||
$comparison = Criteria::IN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->addUsingAlias(AddressIcirelaisTableMap::ID, $id, $comparison);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter the query on the title_id column
|
|
||||||
*
|
|
||||||
* Example usage:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByTitleId(1234); // WHERE title_id = 1234
|
|
||||||
* $query->filterByTitleId(array(12, 34)); // WHERE title_id IN (12, 34)
|
|
||||||
* $query->filterByTitleId(array('min' => 12)); // WHERE title_id > 12
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @see filterByCustomerTitle()
|
|
||||||
*
|
|
||||||
* @param mixed $titleId The value to use as filter.
|
|
||||||
* Use scalar values for equality.
|
|
||||||
* Use array values for in_array() equivalent.
|
|
||||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
|
||||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
|
||||||
*
|
|
||||||
* @return ChildAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByTitleId($titleId = null, $comparison = null)
|
|
||||||
{
|
|
||||||
if (is_array($titleId)) {
|
|
||||||
$useMinMax = false;
|
|
||||||
if (isset($titleId['min'])) {
|
|
||||||
$this->addUsingAlias(AddressIcirelaisTableMap::TITLE_ID, $titleId['min'], Criteria::GREATER_EQUAL);
|
|
||||||
$useMinMax = true;
|
|
||||||
}
|
|
||||||
if (isset($titleId['max'])) {
|
|
||||||
$this->addUsingAlias(AddressIcirelaisTableMap::TITLE_ID, $titleId['max'], Criteria::LESS_EQUAL);
|
|
||||||
$useMinMax = true;
|
|
||||||
}
|
|
||||||
if ($useMinMax) {
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
if (null === $comparison) {
|
|
||||||
$comparison = Criteria::IN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->addUsingAlias(AddressIcirelaisTableMap::TITLE_ID, $titleId, $comparison);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter the query on the company column
|
|
||||||
*
|
|
||||||
* Example usage:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByCompany('fooValue'); // WHERE company = 'fooValue'
|
|
||||||
* $query->filterByCompany('%fooValue%'); // WHERE company LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @param string $company The value to use as filter.
|
|
||||||
* Accepts wildcards (* and % trigger a LIKE)
|
|
||||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
|
||||||
*
|
|
||||||
* @return ChildAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByCompany($company = null, $comparison = null)
|
|
||||||
{
|
|
||||||
if (null === $comparison) {
|
|
||||||
if (is_array($company)) {
|
|
||||||
$comparison = Criteria::IN;
|
|
||||||
} elseif (preg_match('/[\%\*]/', $company)) {
|
|
||||||
$company = str_replace('*', '%', $company);
|
|
||||||
$comparison = Criteria::LIKE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->addUsingAlias(AddressIcirelaisTableMap::COMPANY, $company, $comparison);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter the query on the firstname column
|
|
||||||
*
|
|
||||||
* Example usage:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByFirstname('fooValue'); // WHERE firstname = 'fooValue'
|
|
||||||
* $query->filterByFirstname('%fooValue%'); // WHERE firstname LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @param string $firstname The value to use as filter.
|
|
||||||
* Accepts wildcards (* and % trigger a LIKE)
|
|
||||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
|
||||||
*
|
|
||||||
* @return ChildAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByFirstname($firstname = null, $comparison = null)
|
|
||||||
{
|
|
||||||
if (null === $comparison) {
|
|
||||||
if (is_array($firstname)) {
|
|
||||||
$comparison = Criteria::IN;
|
|
||||||
} elseif (preg_match('/[\%\*]/', $firstname)) {
|
|
||||||
$firstname = str_replace('*', '%', $firstname);
|
|
||||||
$comparison = Criteria::LIKE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->addUsingAlias(AddressIcirelaisTableMap::FIRSTNAME, $firstname, $comparison);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter the query on the lastname column
|
|
||||||
*
|
|
||||||
* Example usage:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByLastname('fooValue'); // WHERE lastname = 'fooValue'
|
|
||||||
* $query->filterByLastname('%fooValue%'); // WHERE lastname LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @param string $lastname The value to use as filter.
|
|
||||||
* Accepts wildcards (* and % trigger a LIKE)
|
|
||||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
|
||||||
*
|
|
||||||
* @return ChildAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByLastname($lastname = null, $comparison = null)
|
|
||||||
{
|
|
||||||
if (null === $comparison) {
|
|
||||||
if (is_array($lastname)) {
|
|
||||||
$comparison = Criteria::IN;
|
|
||||||
} elseif (preg_match('/[\%\*]/', $lastname)) {
|
|
||||||
$lastname = str_replace('*', '%', $lastname);
|
|
||||||
$comparison = Criteria::LIKE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->addUsingAlias(AddressIcirelaisTableMap::LASTNAME, $lastname, $comparison);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter the query on the address1 column
|
|
||||||
*
|
|
||||||
* Example usage:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByAddress1('fooValue'); // WHERE address1 = 'fooValue'
|
|
||||||
* $query->filterByAddress1('%fooValue%'); // WHERE address1 LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @param string $address1 The value to use as filter.
|
|
||||||
* Accepts wildcards (* and % trigger a LIKE)
|
|
||||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
|
||||||
*
|
|
||||||
* @return ChildAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByAddress1($address1 = null, $comparison = null)
|
|
||||||
{
|
|
||||||
if (null === $comparison) {
|
|
||||||
if (is_array($address1)) {
|
|
||||||
$comparison = Criteria::IN;
|
|
||||||
} elseif (preg_match('/[\%\*]/', $address1)) {
|
|
||||||
$address1 = str_replace('*', '%', $address1);
|
|
||||||
$comparison = Criteria::LIKE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->addUsingAlias(AddressIcirelaisTableMap::ADDRESS1, $address1, $comparison);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter the query on the address2 column
|
|
||||||
*
|
|
||||||
* Example usage:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByAddress2('fooValue'); // WHERE address2 = 'fooValue'
|
|
||||||
* $query->filterByAddress2('%fooValue%'); // WHERE address2 LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @param string $address2 The value to use as filter.
|
|
||||||
* Accepts wildcards (* and % trigger a LIKE)
|
|
||||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
|
||||||
*
|
|
||||||
* @return ChildAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByAddress2($address2 = null, $comparison = null)
|
|
||||||
{
|
|
||||||
if (null === $comparison) {
|
|
||||||
if (is_array($address2)) {
|
|
||||||
$comparison = Criteria::IN;
|
|
||||||
} elseif (preg_match('/[\%\*]/', $address2)) {
|
|
||||||
$address2 = str_replace('*', '%', $address2);
|
|
||||||
$comparison = Criteria::LIKE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->addUsingAlias(AddressIcirelaisTableMap::ADDRESS2, $address2, $comparison);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter the query on the address3 column
|
|
||||||
*
|
|
||||||
* Example usage:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByAddress3('fooValue'); // WHERE address3 = 'fooValue'
|
|
||||||
* $query->filterByAddress3('%fooValue%'); // WHERE address3 LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @param string $address3 The value to use as filter.
|
|
||||||
* Accepts wildcards (* and % trigger a LIKE)
|
|
||||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
|
||||||
*
|
|
||||||
* @return ChildAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByAddress3($address3 = null, $comparison = null)
|
|
||||||
{
|
|
||||||
if (null === $comparison) {
|
|
||||||
if (is_array($address3)) {
|
|
||||||
$comparison = Criteria::IN;
|
|
||||||
} elseif (preg_match('/[\%\*]/', $address3)) {
|
|
||||||
$address3 = str_replace('*', '%', $address3);
|
|
||||||
$comparison = Criteria::LIKE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->addUsingAlias(AddressIcirelaisTableMap::ADDRESS3, $address3, $comparison);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter the query on the zipcode column
|
|
||||||
*
|
|
||||||
* Example usage:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByZipcode('fooValue'); // WHERE zipcode = 'fooValue'
|
|
||||||
* $query->filterByZipcode('%fooValue%'); // WHERE zipcode LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @param string $zipcode The value to use as filter.
|
|
||||||
* Accepts wildcards (* and % trigger a LIKE)
|
|
||||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
|
||||||
*
|
|
||||||
* @return ChildAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByZipcode($zipcode = null, $comparison = null)
|
|
||||||
{
|
|
||||||
if (null === $comparison) {
|
|
||||||
if (is_array($zipcode)) {
|
|
||||||
$comparison = Criteria::IN;
|
|
||||||
} elseif (preg_match('/[\%\*]/', $zipcode)) {
|
|
||||||
$zipcode = str_replace('*', '%', $zipcode);
|
|
||||||
$comparison = Criteria::LIKE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->addUsingAlias(AddressIcirelaisTableMap::ZIPCODE, $zipcode, $comparison);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter the query on the city column
|
|
||||||
*
|
|
||||||
* Example usage:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByCity('fooValue'); // WHERE city = 'fooValue'
|
|
||||||
* $query->filterByCity('%fooValue%'); // WHERE city LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @param string $city The value to use as filter.
|
|
||||||
* Accepts wildcards (* and % trigger a LIKE)
|
|
||||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
|
||||||
*
|
|
||||||
* @return ChildAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByCity($city = null, $comparison = null)
|
|
||||||
{
|
|
||||||
if (null === $comparison) {
|
|
||||||
if (is_array($city)) {
|
|
||||||
$comparison = Criteria::IN;
|
|
||||||
} elseif (preg_match('/[\%\*]/', $city)) {
|
|
||||||
$city = str_replace('*', '%', $city);
|
|
||||||
$comparison = Criteria::LIKE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->addUsingAlias(AddressIcirelaisTableMap::CITY, $city, $comparison);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter the query on the country_id column
|
|
||||||
*
|
|
||||||
* Example usage:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByCountryId(1234); // WHERE country_id = 1234
|
|
||||||
* $query->filterByCountryId(array(12, 34)); // WHERE country_id IN (12, 34)
|
|
||||||
* $query->filterByCountryId(array('min' => 12)); // WHERE country_id > 12
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @see filterByCountry()
|
|
||||||
*
|
|
||||||
* @param mixed $countryId The value to use as filter.
|
|
||||||
* Use scalar values for equality.
|
|
||||||
* Use array values for in_array() equivalent.
|
|
||||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
|
||||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
|
||||||
*
|
|
||||||
* @return ChildAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByCountryId($countryId = null, $comparison = null)
|
|
||||||
{
|
|
||||||
if (is_array($countryId)) {
|
|
||||||
$useMinMax = false;
|
|
||||||
if (isset($countryId['min'])) {
|
|
||||||
$this->addUsingAlias(AddressIcirelaisTableMap::COUNTRY_ID, $countryId['min'], Criteria::GREATER_EQUAL);
|
|
||||||
$useMinMax = true;
|
|
||||||
}
|
|
||||||
if (isset($countryId['max'])) {
|
|
||||||
$this->addUsingAlias(AddressIcirelaisTableMap::COUNTRY_ID, $countryId['max'], Criteria::LESS_EQUAL);
|
|
||||||
$useMinMax = true;
|
|
||||||
}
|
|
||||||
if ($useMinMax) {
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
if (null === $comparison) {
|
|
||||||
$comparison = Criteria::IN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->addUsingAlias(AddressIcirelaisTableMap::COUNTRY_ID, $countryId, $comparison);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter the query on the code column
|
|
||||||
*
|
|
||||||
* Example usage:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByCode('fooValue'); // WHERE code = 'fooValue'
|
|
||||||
* $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @param string $code The value to use as filter.
|
|
||||||
* Accepts wildcards (* and % trigger a LIKE)
|
|
||||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
|
||||||
*
|
|
||||||
* @return ChildAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByCode($code = null, $comparison = null)
|
|
||||||
{
|
|
||||||
if (null === $comparison) {
|
|
||||||
if (is_array($code)) {
|
|
||||||
$comparison = Criteria::IN;
|
|
||||||
} elseif (preg_match('/[\%\*]/', $code)) {
|
|
||||||
$code = str_replace('*', '%', $code);
|
|
||||||
$comparison = Criteria::LIKE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->addUsingAlias(AddressIcirelaisTableMap::CODE, $code, $comparison);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter the query by a related \IciRelais\Model\Thelia\Model\CustomerTitle object
|
|
||||||
*
|
|
||||||
* @param \IciRelais\Model\Thelia\Model\CustomerTitle|ObjectCollection $customerTitle The related object(s) to use as filter
|
|
||||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
|
||||||
*
|
|
||||||
* @return ChildAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByCustomerTitle($customerTitle, $comparison = null)
|
|
||||||
{
|
|
||||||
if ($customerTitle instanceof \IciRelais\Model\Thelia\Model\CustomerTitle) {
|
|
||||||
return $this
|
|
||||||
->addUsingAlias(AddressIcirelaisTableMap::TITLE_ID, $customerTitle->getId(), $comparison);
|
|
||||||
} elseif ($customerTitle instanceof ObjectCollection) {
|
|
||||||
if (null === $comparison) {
|
|
||||||
$comparison = Criteria::IN;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this
|
|
||||||
->addUsingAlias(AddressIcirelaisTableMap::TITLE_ID, $customerTitle->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
|
||||||
} else {
|
|
||||||
throw new PropelException('filterByCustomerTitle() only accepts arguments of type \IciRelais\Model\Thelia\Model\CustomerTitle or Collection');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a JOIN clause to the query using the CustomerTitle relation
|
|
||||||
*
|
|
||||||
* @param string $relationAlias optional alias for the relation
|
|
||||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
|
||||||
*
|
|
||||||
* @return ChildAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function joinCustomerTitle($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
|
||||||
{
|
|
||||||
$tableMap = $this->getTableMap();
|
|
||||||
$relationMap = $tableMap->getRelation('CustomerTitle');
|
|
||||||
|
|
||||||
// create a ModelJoin object for this join
|
|
||||||
$join = new ModelJoin();
|
|
||||||
$join->setJoinType($joinType);
|
|
||||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
|
||||||
if ($previousJoin = $this->getPreviousJoin()) {
|
|
||||||
$join->setPreviousJoin($previousJoin);
|
|
||||||
}
|
|
||||||
|
|
||||||
// add the ModelJoin to the current object
|
|
||||||
if ($relationAlias) {
|
|
||||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
|
||||||
$this->addJoinObject($join, $relationAlias);
|
|
||||||
} else {
|
|
||||||
$this->addJoinObject($join, 'CustomerTitle');
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use the CustomerTitle relation CustomerTitle object
|
|
||||||
*
|
|
||||||
* @see useQuery()
|
|
||||||
*
|
|
||||||
* @param string $relationAlias optional alias for the relation,
|
|
||||||
* to be used as main alias in the secondary query
|
|
||||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
|
||||||
*
|
|
||||||
* @return \IciRelais\Model\Thelia\Model\CustomerTitleQuery A secondary query class using the current class as primary query
|
|
||||||
*/
|
|
||||||
public function useCustomerTitleQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
|
||||||
{
|
|
||||||
return $this
|
|
||||||
->joinCustomerTitle($relationAlias, $joinType)
|
|
||||||
->useQuery($relationAlias ? $relationAlias : 'CustomerTitle', '\IciRelais\Model\Thelia\Model\CustomerTitleQuery');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter the query by a related \IciRelais\Model\Thelia\Model\Country object
|
|
||||||
*
|
|
||||||
* @param \IciRelais\Model\Thelia\Model\Country|ObjectCollection $country The related object(s) to use as filter
|
|
||||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
|
||||||
*
|
|
||||||
* @return ChildAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByCountry($country, $comparison = null)
|
|
||||||
{
|
|
||||||
if ($country instanceof \IciRelais\Model\Thelia\Model\Country) {
|
|
||||||
return $this
|
|
||||||
->addUsingAlias(AddressIcirelaisTableMap::COUNTRY_ID, $country->getId(), $comparison);
|
|
||||||
} elseif ($country instanceof ObjectCollection) {
|
|
||||||
if (null === $comparison) {
|
|
||||||
$comparison = Criteria::IN;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this
|
|
||||||
->addUsingAlias(AddressIcirelaisTableMap::COUNTRY_ID, $country->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
|
||||||
} else {
|
|
||||||
throw new PropelException('filterByCountry() only accepts arguments of type \IciRelais\Model\Thelia\Model\Country or Collection');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a JOIN clause to the query using the Country relation
|
|
||||||
*
|
|
||||||
* @param string $relationAlias optional alias for the relation
|
|
||||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
|
||||||
*
|
|
||||||
* @return ChildAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function joinCountry($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
|
||||||
{
|
|
||||||
$tableMap = $this->getTableMap();
|
|
||||||
$relationMap = $tableMap->getRelation('Country');
|
|
||||||
|
|
||||||
// create a ModelJoin object for this join
|
|
||||||
$join = new ModelJoin();
|
|
||||||
$join->setJoinType($joinType);
|
|
||||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
|
||||||
if ($previousJoin = $this->getPreviousJoin()) {
|
|
||||||
$join->setPreviousJoin($previousJoin);
|
|
||||||
}
|
|
||||||
|
|
||||||
// add the ModelJoin to the current object
|
|
||||||
if ($relationAlias) {
|
|
||||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
|
||||||
$this->addJoinObject($join, $relationAlias);
|
|
||||||
} else {
|
|
||||||
$this->addJoinObject($join, 'Country');
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use the Country relation Country object
|
|
||||||
*
|
|
||||||
* @see useQuery()
|
|
||||||
*
|
|
||||||
* @param string $relationAlias optional alias for the relation,
|
|
||||||
* to be used as main alias in the secondary query
|
|
||||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
|
||||||
*
|
|
||||||
* @return \IciRelais\Model\Thelia\Model\CountryQuery A secondary query class using the current class as primary query
|
|
||||||
*/
|
|
||||||
public function useCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
|
||||||
{
|
|
||||||
return $this
|
|
||||||
->joinCountry($relationAlias, $joinType)
|
|
||||||
->useQuery($relationAlias ? $relationAlias : 'Country', '\IciRelais\Model\Thelia\Model\CountryQuery');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exclude object from result
|
|
||||||
*
|
|
||||||
* @param ChildAddressIcirelais $addressIcirelais Object to remove from the list of results
|
|
||||||
*
|
|
||||||
* @return ChildAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function prune($addressIcirelais = null)
|
|
||||||
{
|
|
||||||
if ($addressIcirelais) {
|
|
||||||
$this->addUsingAlias(AddressIcirelaisTableMap::ID, $addressIcirelais->getId(), Criteria::NOT_EQUAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deletes all rows from the address_icirelais 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(AddressIcirelaisTableMap::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).
|
|
||||||
AddressIcirelaisTableMap::clearInstancePool();
|
|
||||||
AddressIcirelaisTableMap::clearRelatedInstancePool();
|
|
||||||
|
|
||||||
$con->commit();
|
|
||||||
} catch (PropelException $e) {
|
|
||||||
$con->rollBack();
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $affectedRows;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Performs a DELETE on the database, given a ChildAddressIcirelais or Criteria object OR a primary key value.
|
|
||||||
*
|
|
||||||
* @param mixed $values Criteria or ChildAddressIcirelais 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(AddressIcirelaisTableMap::DATABASE_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
$criteria = $this;
|
|
||||||
|
|
||||||
// Set the correct dbName
|
|
||||||
$criteria->setDbName(AddressIcirelaisTableMap::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();
|
|
||||||
|
|
||||||
AddressIcirelaisTableMap::removeInstanceFromPool($criteria);
|
|
||||||
|
|
||||||
$affectedRows += ModelCriteria::delete($con);
|
|
||||||
AddressIcirelaisTableMap::clearRelatedInstancePool();
|
|
||||||
$con->commit();
|
|
||||||
|
|
||||||
return $affectedRows;
|
|
||||||
} catch (PropelException $e) {
|
|
||||||
$con->rollBack();
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // AddressIcirelaisQuery
|
|
||||||
@@ -1,532 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace IciRelais\Model\Base;
|
|
||||||
|
|
||||||
use \Exception;
|
|
||||||
use \PDO;
|
|
||||||
use IciRelais\Model\IcirelaisFreeshipping as ChildIcirelaisFreeshipping;
|
|
||||||
use IciRelais\Model\IcirelaisFreeshippingQuery as ChildIcirelaisFreeshippingQuery;
|
|
||||||
use IciRelais\Model\Map\IcirelaisFreeshippingTableMap;
|
|
||||||
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 'icirelais_freeshipping' table.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @method ChildIcirelaisFreeshippingQuery orderById($order = Criteria::ASC) Order by the id column
|
|
||||||
* @method ChildIcirelaisFreeshippingQuery orderByActive($order = Criteria::ASC) Order by the active column
|
|
||||||
* @method ChildIcirelaisFreeshippingQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
|
||||||
* @method ChildIcirelaisFreeshippingQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
|
||||||
*
|
|
||||||
* @method ChildIcirelaisFreeshippingQuery groupById() Group by the id column
|
|
||||||
* @method ChildIcirelaisFreeshippingQuery groupByActive() Group by the active column
|
|
||||||
* @method ChildIcirelaisFreeshippingQuery groupByCreatedAt() Group by the created_at column
|
|
||||||
* @method ChildIcirelaisFreeshippingQuery groupByUpdatedAt() Group by the updated_at column
|
|
||||||
*
|
|
||||||
* @method ChildIcirelaisFreeshippingQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
|
||||||
* @method ChildIcirelaisFreeshippingQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
|
||||||
* @method ChildIcirelaisFreeshippingQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
|
||||||
*
|
|
||||||
* @method ChildIcirelaisFreeshipping findOne(ConnectionInterface $con = null) Return the first ChildIcirelaisFreeshipping matching the query
|
|
||||||
* @method ChildIcirelaisFreeshipping findOneOrCreate(ConnectionInterface $con = null) Return the first ChildIcirelaisFreeshipping matching the query, or a new ChildIcirelaisFreeshipping object populated from the query conditions when no match is found
|
|
||||||
*
|
|
||||||
* @method ChildIcirelaisFreeshipping findOneById(int $id) Return the first ChildIcirelaisFreeshipping filtered by the id column
|
|
||||||
* @method ChildIcirelaisFreeshipping findOneByActive(boolean $active) Return the first ChildIcirelaisFreeshipping filtered by the active column
|
|
||||||
* @method ChildIcirelaisFreeshipping findOneByCreatedAt(string $created_at) Return the first ChildIcirelaisFreeshipping filtered by the created_at column
|
|
||||||
* @method ChildIcirelaisFreeshipping findOneByUpdatedAt(string $updated_at) Return the first ChildIcirelaisFreeshipping filtered by the updated_at column
|
|
||||||
*
|
|
||||||
* @method array findById(int $id) Return ChildIcirelaisFreeshipping objects filtered by the id column
|
|
||||||
* @method array findByActive(boolean $active) Return ChildIcirelaisFreeshipping objects filtered by the active column
|
|
||||||
* @method array findByCreatedAt(string $created_at) Return ChildIcirelaisFreeshipping objects filtered by the created_at column
|
|
||||||
* @method array findByUpdatedAt(string $updated_at) Return ChildIcirelaisFreeshipping objects filtered by the updated_at column
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
abstract class IcirelaisFreeshippingQuery extends ModelCriteria
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes internal state of \IciRelais\Model\Base\IcirelaisFreeshippingQuery 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 = '\\IciRelais\\Model\\IcirelaisFreeshipping', $modelAlias = null)
|
|
||||||
{
|
|
||||||
parent::__construct($dbName, $modelName, $modelAlias);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new ChildIcirelaisFreeshippingQuery object.
|
|
||||||
*
|
|
||||||
* @param string $modelAlias The alias of a model in the query
|
|
||||||
* @param Criteria $criteria Optional Criteria to build the query from
|
|
||||||
*
|
|
||||||
* @return ChildIcirelaisFreeshippingQuery
|
|
||||||
*/
|
|
||||||
public static function create($modelAlias = null, $criteria = null)
|
|
||||||
{
|
|
||||||
if ($criteria instanceof \IciRelais\Model\IcirelaisFreeshippingQuery) {
|
|
||||||
return $criteria;
|
|
||||||
}
|
|
||||||
$query = new \IciRelais\Model\IcirelaisFreeshippingQuery();
|
|
||||||
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 ChildIcirelaisFreeshipping|array|mixed the result, formatted by the current formatter
|
|
||||||
*/
|
|
||||||
public function findPk($key, $con = null)
|
|
||||||
{
|
|
||||||
if ($key === null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if ((null !== ($obj = IcirelaisFreeshippingTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
|
||||||
// the object is already in the instance pool
|
|
||||||
return $obj;
|
|
||||||
}
|
|
||||||
if ($con === null) {
|
|
||||||
$con = Propel::getServiceContainer()->getReadConnection(IcirelaisFreeshippingTableMap::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 ChildIcirelaisFreeshipping A model object, or null if the key is not found
|
|
||||||
*/
|
|
||||||
protected function findPkSimple($key, $con)
|
|
||||||
{
|
|
||||||
$sql = 'SELECT ID, ACTIVE, CREATED_AT, UPDATED_AT FROM icirelais_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 ChildIcirelaisFreeshipping();
|
|
||||||
$obj->hydrate($row);
|
|
||||||
IcirelaisFreeshippingTableMap::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 ChildIcirelaisFreeshipping|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 ChildIcirelaisFreeshippingQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByPrimaryKey($key)
|
|
||||||
{
|
|
||||||
return $this->addUsingAlias(IcirelaisFreeshippingTableMap::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 ChildIcirelaisFreeshippingQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByPrimaryKeys($keys)
|
|
||||||
{
|
|
||||||
return $this->addUsingAlias(IcirelaisFreeshippingTableMap::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 ChildIcirelaisFreeshippingQuery 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(IcirelaisFreeshippingTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
|
||||||
$useMinMax = true;
|
|
||||||
}
|
|
||||||
if (isset($id['max'])) {
|
|
||||||
$this->addUsingAlias(IcirelaisFreeshippingTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
|
||||||
$useMinMax = true;
|
|
||||||
}
|
|
||||||
if ($useMinMax) {
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
if (null === $comparison) {
|
|
||||||
$comparison = Criteria::IN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->addUsingAlias(IcirelaisFreeshippingTableMap::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 ChildIcirelaisFreeshippingQuery 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(IcirelaisFreeshippingTableMap::ACTIVE, $active, $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 ChildIcirelaisFreeshippingQuery 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(IcirelaisFreeshippingTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
|
|
||||||
$useMinMax = true;
|
|
||||||
}
|
|
||||||
if (isset($createdAt['max'])) {
|
|
||||||
$this->addUsingAlias(IcirelaisFreeshippingTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
|
|
||||||
$useMinMax = true;
|
|
||||||
}
|
|
||||||
if ($useMinMax) {
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
if (null === $comparison) {
|
|
||||||
$comparison = Criteria::IN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->addUsingAlias(IcirelaisFreeshippingTableMap::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 ChildIcirelaisFreeshippingQuery 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(IcirelaisFreeshippingTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
|
|
||||||
$useMinMax = true;
|
|
||||||
}
|
|
||||||
if (isset($updatedAt['max'])) {
|
|
||||||
$this->addUsingAlias(IcirelaisFreeshippingTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
|
|
||||||
$useMinMax = true;
|
|
||||||
}
|
|
||||||
if ($useMinMax) {
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
if (null === $comparison) {
|
|
||||||
$comparison = Criteria::IN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->addUsingAlias(IcirelaisFreeshippingTableMap::UPDATED_AT, $updatedAt, $comparison);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exclude object from result
|
|
||||||
*
|
|
||||||
* @param ChildIcirelaisFreeshipping $icirelaisFreeshipping Object to remove from the list of results
|
|
||||||
*
|
|
||||||
* @return ChildIcirelaisFreeshippingQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function prune($icirelaisFreeshipping = null)
|
|
||||||
{
|
|
||||||
if ($icirelaisFreeshipping) {
|
|
||||||
$this->addUsingAlias(IcirelaisFreeshippingTableMap::ID, $icirelaisFreeshipping->getId(), Criteria::NOT_EQUAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deletes all rows from the icirelais_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(IcirelaisFreeshippingTableMap::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).
|
|
||||||
IcirelaisFreeshippingTableMap::clearInstancePool();
|
|
||||||
IcirelaisFreeshippingTableMap::clearRelatedInstancePool();
|
|
||||||
|
|
||||||
$con->commit();
|
|
||||||
} catch (PropelException $e) {
|
|
||||||
$con->rollBack();
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $affectedRows;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Performs a DELETE on the database, given a ChildIcirelaisFreeshipping or Criteria object OR a primary key value.
|
|
||||||
*
|
|
||||||
* @param mixed $values Criteria or ChildIcirelaisFreeshipping 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(IcirelaisFreeshippingTableMap::DATABASE_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
$criteria = $this;
|
|
||||||
|
|
||||||
// Set the correct dbName
|
|
||||||
$criteria->setDbName(IcirelaisFreeshippingTableMap::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();
|
|
||||||
|
|
||||||
IcirelaisFreeshippingTableMap::removeInstanceFromPool($criteria);
|
|
||||||
|
|
||||||
$affectedRows += ModelCriteria::delete($con);
|
|
||||||
IcirelaisFreeshippingTableMap::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 ChildIcirelaisFreeshippingQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function recentlyUpdated($nbDays = 7)
|
|
||||||
{
|
|
||||||
return $this->addUsingAlias(IcirelaisFreeshippingTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter by the latest created
|
|
||||||
*
|
|
||||||
* @param int $nbDays Maximum age of in days
|
|
||||||
*
|
|
||||||
* @return ChildIcirelaisFreeshippingQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function recentlyCreated($nbDays = 7)
|
|
||||||
{
|
|
||||||
return $this->addUsingAlias(IcirelaisFreeshippingTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Order by update date desc
|
|
||||||
*
|
|
||||||
* @return ChildIcirelaisFreeshippingQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function lastUpdatedFirst()
|
|
||||||
{
|
|
||||||
return $this->addDescendingOrderByColumn(IcirelaisFreeshippingTableMap::UPDATED_AT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Order by update date asc
|
|
||||||
*
|
|
||||||
* @return ChildIcirelaisFreeshippingQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function firstUpdatedFirst()
|
|
||||||
{
|
|
||||||
return $this->addAscendingOrderByColumn(IcirelaisFreeshippingTableMap::UPDATED_AT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Order by create date desc
|
|
||||||
*
|
|
||||||
* @return ChildIcirelaisFreeshippingQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function lastCreatedFirst()
|
|
||||||
{
|
|
||||||
return $this->addDescendingOrderByColumn(IcirelaisFreeshippingTableMap::CREATED_AT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Order by create date asc
|
|
||||||
*
|
|
||||||
* @return ChildIcirelaisFreeshippingQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function firstCreatedFirst()
|
|
||||||
{
|
|
||||||
return $this->addAscendingOrderByColumn(IcirelaisFreeshippingTableMap::CREATED_AT);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // IcirelaisFreeshippingQuery
|
|
||||||
@@ -1,459 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace IciRelais\Model\Base;
|
|
||||||
|
|
||||||
use \Exception;
|
|
||||||
use \PDO;
|
|
||||||
use IciRelais\Model\OrderAddressIcirelais as ChildOrderAddressIcirelais;
|
|
||||||
use IciRelais\Model\OrderAddressIcirelaisQuery as ChildOrderAddressIcirelaisQuery;
|
|
||||||
use IciRelais\Model\Map\OrderAddressIcirelaisTableMap;
|
|
||||||
use IciRelais\Model\Thelia\Model\OrderAddress;
|
|
||||||
use Propel\Runtime\Propel;
|
|
||||||
use Propel\Runtime\ActiveQuery\Criteria;
|
|
||||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
|
||||||
use Propel\Runtime\ActiveQuery\ModelJoin;
|
|
||||||
use Propel\Runtime\Collection\Collection;
|
|
||||||
use Propel\Runtime\Collection\ObjectCollection;
|
|
||||||
use Propel\Runtime\Connection\ConnectionInterface;
|
|
||||||
use Propel\Runtime\Exception\PropelException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base class that represents a query for the 'order_address_icirelais' table.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @method ChildOrderAddressIcirelaisQuery orderById($order = Criteria::ASC) Order by the id column
|
|
||||||
* @method ChildOrderAddressIcirelaisQuery orderByCode($order = Criteria::ASC) Order by the code column
|
|
||||||
*
|
|
||||||
* @method ChildOrderAddressIcirelaisQuery groupById() Group by the id column
|
|
||||||
* @method ChildOrderAddressIcirelaisQuery groupByCode() Group by the code column
|
|
||||||
*
|
|
||||||
* @method ChildOrderAddressIcirelaisQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
|
||||||
* @method ChildOrderAddressIcirelaisQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
|
||||||
* @method ChildOrderAddressIcirelaisQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
|
||||||
*
|
|
||||||
* @method ChildOrderAddressIcirelaisQuery leftJoinOrderAddress($relationAlias = null) Adds a LEFT JOIN clause to the query using the OrderAddress relation
|
|
||||||
* @method ChildOrderAddressIcirelaisQuery rightJoinOrderAddress($relationAlias = null) Adds a RIGHT JOIN clause to the query using the OrderAddress relation
|
|
||||||
* @method ChildOrderAddressIcirelaisQuery innerJoinOrderAddress($relationAlias = null) Adds a INNER JOIN clause to the query using the OrderAddress relation
|
|
||||||
*
|
|
||||||
* @method ChildOrderAddressIcirelais findOne(ConnectionInterface $con = null) Return the first ChildOrderAddressIcirelais matching the query
|
|
||||||
* @method ChildOrderAddressIcirelais findOneOrCreate(ConnectionInterface $con = null) Return the first ChildOrderAddressIcirelais matching the query, or a new ChildOrderAddressIcirelais object populated from the query conditions when no match is found
|
|
||||||
*
|
|
||||||
* @method ChildOrderAddressIcirelais findOneById(int $id) Return the first ChildOrderAddressIcirelais filtered by the id column
|
|
||||||
* @method ChildOrderAddressIcirelais findOneByCode(string $code) Return the first ChildOrderAddressIcirelais filtered by the code column
|
|
||||||
*
|
|
||||||
* @method array findById(int $id) Return ChildOrderAddressIcirelais objects filtered by the id column
|
|
||||||
* @method array findByCode(string $code) Return ChildOrderAddressIcirelais objects filtered by the code column
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
abstract class OrderAddressIcirelaisQuery extends ModelCriteria
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes internal state of \IciRelais\Model\Base\OrderAddressIcirelaisQuery 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 = '\\IciRelais\\Model\\OrderAddressIcirelais', $modelAlias = null)
|
|
||||||
{
|
|
||||||
parent::__construct($dbName, $modelName, $modelAlias);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new ChildOrderAddressIcirelaisQuery object.
|
|
||||||
*
|
|
||||||
* @param string $modelAlias The alias of a model in the query
|
|
||||||
* @param Criteria $criteria Optional Criteria to build the query from
|
|
||||||
*
|
|
||||||
* @return ChildOrderAddressIcirelaisQuery
|
|
||||||
*/
|
|
||||||
public static function create($modelAlias = null, $criteria = null)
|
|
||||||
{
|
|
||||||
if ($criteria instanceof \IciRelais\Model\OrderAddressIcirelaisQuery) {
|
|
||||||
return $criteria;
|
|
||||||
}
|
|
||||||
$query = new \IciRelais\Model\OrderAddressIcirelaisQuery();
|
|
||||||
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 ChildOrderAddressIcirelais|array|mixed the result, formatted by the current formatter
|
|
||||||
*/
|
|
||||||
public function findPk($key, $con = null)
|
|
||||||
{
|
|
||||||
if ($key === null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if ((null !== ($obj = OrderAddressIcirelaisTableMap::getInstanceFromPool((string) $key))) && !$this->formatter) {
|
|
||||||
// the object is already in the instance pool
|
|
||||||
return $obj;
|
|
||||||
}
|
|
||||||
if ($con === null) {
|
|
||||||
$con = Propel::getServiceContainer()->getReadConnection(OrderAddressIcirelaisTableMap::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 ChildOrderAddressIcirelais A model object, or null if the key is not found
|
|
||||||
*/
|
|
||||||
protected function findPkSimple($key, $con)
|
|
||||||
{
|
|
||||||
$sql = 'SELECT ID, CODE FROM order_address_icirelais 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 ChildOrderAddressIcirelais();
|
|
||||||
$obj->hydrate($row);
|
|
||||||
OrderAddressIcirelaisTableMap::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 ChildOrderAddressIcirelais|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 ChildOrderAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByPrimaryKey($key)
|
|
||||||
{
|
|
||||||
return $this->addUsingAlias(OrderAddressIcirelaisTableMap::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 ChildOrderAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByPrimaryKeys($keys)
|
|
||||||
{
|
|
||||||
return $this->addUsingAlias(OrderAddressIcirelaisTableMap::ID, $keys, Criteria::IN);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter the query on the id column
|
|
||||||
*
|
|
||||||
* Example usage:
|
|
||||||
* <code>
|
|
||||||
* $query->filterById(1234); // WHERE id = 1234
|
|
||||||
* $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
|
|
||||||
* $query->filterById(array('min' => 12)); // WHERE id > 12
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @see filterByOrderAddress()
|
|
||||||
*
|
|
||||||
* @param mixed $id The value to use as filter.
|
|
||||||
* Use scalar values for equality.
|
|
||||||
* Use array values for in_array() equivalent.
|
|
||||||
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
|
|
||||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
|
||||||
*
|
|
||||||
* @return ChildOrderAddressIcirelaisQuery 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(OrderAddressIcirelaisTableMap::ID, $id['min'], Criteria::GREATER_EQUAL);
|
|
||||||
$useMinMax = true;
|
|
||||||
}
|
|
||||||
if (isset($id['max'])) {
|
|
||||||
$this->addUsingAlias(OrderAddressIcirelaisTableMap::ID, $id['max'], Criteria::LESS_EQUAL);
|
|
||||||
$useMinMax = true;
|
|
||||||
}
|
|
||||||
if ($useMinMax) {
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
if (null === $comparison) {
|
|
||||||
$comparison = Criteria::IN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->addUsingAlias(OrderAddressIcirelaisTableMap::ID, $id, $comparison);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter the query on the code column
|
|
||||||
*
|
|
||||||
* Example usage:
|
|
||||||
* <code>
|
|
||||||
* $query->filterByCode('fooValue'); // WHERE code = 'fooValue'
|
|
||||||
* $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%'
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* @param string $code The value to use as filter.
|
|
||||||
* Accepts wildcards (* and % trigger a LIKE)
|
|
||||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
|
||||||
*
|
|
||||||
* @return ChildOrderAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByCode($code = null, $comparison = null)
|
|
||||||
{
|
|
||||||
if (null === $comparison) {
|
|
||||||
if (is_array($code)) {
|
|
||||||
$comparison = Criteria::IN;
|
|
||||||
} elseif (preg_match('/[\%\*]/', $code)) {
|
|
||||||
$code = str_replace('*', '%', $code);
|
|
||||||
$comparison = Criteria::LIKE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->addUsingAlias(OrderAddressIcirelaisTableMap::CODE, $code, $comparison);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter the query by a related \IciRelais\Model\Thelia\Model\OrderAddress object
|
|
||||||
*
|
|
||||||
* @param \IciRelais\Model\Thelia\Model\OrderAddress|ObjectCollection $orderAddress The related object(s) to use as filter
|
|
||||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
|
||||||
*
|
|
||||||
* @return ChildOrderAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function filterByOrderAddress($orderAddress, $comparison = null)
|
|
||||||
{
|
|
||||||
if ($orderAddress instanceof \IciRelais\Model\Thelia\Model\OrderAddress) {
|
|
||||||
return $this
|
|
||||||
->addUsingAlias(OrderAddressIcirelaisTableMap::ID, $orderAddress->getId(), $comparison);
|
|
||||||
} elseif ($orderAddress instanceof ObjectCollection) {
|
|
||||||
if (null === $comparison) {
|
|
||||||
$comparison = Criteria::IN;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this
|
|
||||||
->addUsingAlias(OrderAddressIcirelaisTableMap::ID, $orderAddress->toKeyValue('PrimaryKey', 'Id'), $comparison);
|
|
||||||
} else {
|
|
||||||
throw new PropelException('filterByOrderAddress() only accepts arguments of type \IciRelais\Model\Thelia\Model\OrderAddress or Collection');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a JOIN clause to the query using the OrderAddress relation
|
|
||||||
*
|
|
||||||
* @param string $relationAlias optional alias for the relation
|
|
||||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
|
||||||
*
|
|
||||||
* @return ChildOrderAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function joinOrderAddress($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
|
||||||
{
|
|
||||||
$tableMap = $this->getTableMap();
|
|
||||||
$relationMap = $tableMap->getRelation('OrderAddress');
|
|
||||||
|
|
||||||
// create a ModelJoin object for this join
|
|
||||||
$join = new ModelJoin();
|
|
||||||
$join->setJoinType($joinType);
|
|
||||||
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
|
||||||
if ($previousJoin = $this->getPreviousJoin()) {
|
|
||||||
$join->setPreviousJoin($previousJoin);
|
|
||||||
}
|
|
||||||
|
|
||||||
// add the ModelJoin to the current object
|
|
||||||
if ($relationAlias) {
|
|
||||||
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
|
||||||
$this->addJoinObject($join, $relationAlias);
|
|
||||||
} else {
|
|
||||||
$this->addJoinObject($join, 'OrderAddress');
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use the OrderAddress relation OrderAddress object
|
|
||||||
*
|
|
||||||
* @see useQuery()
|
|
||||||
*
|
|
||||||
* @param string $relationAlias optional alias for the relation,
|
|
||||||
* to be used as main alias in the secondary query
|
|
||||||
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
|
||||||
*
|
|
||||||
* @return \IciRelais\Model\Thelia\Model\OrderAddressQuery A secondary query class using the current class as primary query
|
|
||||||
*/
|
|
||||||
public function useOrderAddressQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
|
||||||
{
|
|
||||||
return $this
|
|
||||||
->joinOrderAddress($relationAlias, $joinType)
|
|
||||||
->useQuery($relationAlias ? $relationAlias : 'OrderAddress', '\IciRelais\Model\Thelia\Model\OrderAddressQuery');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exclude object from result
|
|
||||||
*
|
|
||||||
* @param ChildOrderAddressIcirelais $orderAddressIcirelais Object to remove from the list of results
|
|
||||||
*
|
|
||||||
* @return ChildOrderAddressIcirelaisQuery The current query, for fluid interface
|
|
||||||
*/
|
|
||||||
public function prune($orderAddressIcirelais = null)
|
|
||||||
{
|
|
||||||
if ($orderAddressIcirelais) {
|
|
||||||
$this->addUsingAlias(OrderAddressIcirelaisTableMap::ID, $orderAddressIcirelais->getId(), Criteria::NOT_EQUAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deletes all rows from the order_address_icirelais 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(OrderAddressIcirelaisTableMap::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).
|
|
||||||
OrderAddressIcirelaisTableMap::clearInstancePool();
|
|
||||||
OrderAddressIcirelaisTableMap::clearRelatedInstancePool();
|
|
||||||
|
|
||||||
$con->commit();
|
|
||||||
} catch (PropelException $e) {
|
|
||||||
$con->rollBack();
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $affectedRows;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Performs a DELETE on the database, given a ChildOrderAddressIcirelais or Criteria object OR a primary key value.
|
|
||||||
*
|
|
||||||
* @param mixed $values Criteria or ChildOrderAddressIcirelais 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(OrderAddressIcirelaisTableMap::DATABASE_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
$criteria = $this;
|
|
||||||
|
|
||||||
// Set the correct dbName
|
|
||||||
$criteria->setDbName(OrderAddressIcirelaisTableMap::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();
|
|
||||||
|
|
||||||
OrderAddressIcirelaisTableMap::removeInstanceFromPool($criteria);
|
|
||||||
|
|
||||||
$affectedRows += ModelCriteria::delete($con);
|
|
||||||
OrderAddressIcirelaisTableMap::clearRelatedInstancePool();
|
|
||||||
$con->commit();
|
|
||||||
|
|
||||||
return $affectedRows;
|
|
||||||
} catch (PropelException $e) {
|
|
||||||
$con->rollBack();
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // OrderAddressIcirelaisQuery
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace IciRelais\Model;
|
|
||||||
|
|
||||||
use IciRelais\Model\Base\IcirelaisFreeshipping as BaseIcirelaisFreeshipping;
|
|
||||||
|
|
||||||
class IcirelaisFreeshipping extends BaseIcirelaisFreeshipping
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace IciRelais\Model;
|
|
||||||
|
|
||||||
use IciRelais\Model\Base\IcirelaisFreeshippingQuery as BaseIcirelaisFreeshippingQuery;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Skeleton subclass for performing query and update operations on the 'icirelais_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 IcirelaisFreeshippingQuery extends BaseIcirelaisFreeshippingQuery
|
|
||||||
{
|
|
||||||
public function getLast()
|
|
||||||
{
|
|
||||||
return $this->orderById('desc')->findOne()->getActive();
|
|
||||||
}
|
|
||||||
} // IcirelaisFreeshippingQuery
|
|
||||||
@@ -1,485 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace IciRelais\Model\Map;
|
|
||||||
|
|
||||||
use IciRelais\Model\AddressIcirelais;
|
|
||||||
use IciRelais\Model\AddressIcirelaisQuery;
|
|
||||||
use Propel\Runtime\Propel;
|
|
||||||
use Propel\Runtime\ActiveQuery\Criteria;
|
|
||||||
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
|
||||||
use Propel\Runtime\Connection\ConnectionInterface;
|
|
||||||
use Propel\Runtime\DataFetcher\DataFetcherInterface;
|
|
||||||
use Propel\Runtime\Exception\PropelException;
|
|
||||||
use Propel\Runtime\Map\RelationMap;
|
|
||||||
use Propel\Runtime\Map\TableMap;
|
|
||||||
use Propel\Runtime\Map\TableMapTrait;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class defines the structure of the 'address_icirelais' 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 AddressIcirelaisTableMap extends TableMap
|
|
||||||
{
|
|
||||||
use InstancePoolTrait;
|
|
||||||
use TableMapTrait;
|
|
||||||
/**
|
|
||||||
* The (dot-path) name of this class
|
|
||||||
*/
|
|
||||||
const CLASS_NAME = 'IciRelais.Model.Map.AddressIcirelaisTableMap';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default database name for this class
|
|
||||||
*/
|
|
||||||
const DATABASE_NAME = 'thelia';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The table name for this class
|
|
||||||
*/
|
|
||||||
const TABLE_NAME = 'address_icirelais';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The related Propel class for this table
|
|
||||||
*/
|
|
||||||
const OM_CLASS = '\\IciRelais\\Model\\AddressIcirelais';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A class that can be returned by this tableMap
|
|
||||||
*/
|
|
||||||
const CLASS_DEFAULT = 'IciRelais.Model.AddressIcirelais';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The total number of columns
|
|
||||||
*/
|
|
||||||
const NUM_COLUMNS = 12;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 = 12;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the column name for the ID field
|
|
||||||
*/
|
|
||||||
const ID = 'address_icirelais.ID';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the column name for the TITLE_ID field
|
|
||||||
*/
|
|
||||||
const TITLE_ID = 'address_icirelais.TITLE_ID';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the column name for the COMPANY field
|
|
||||||
*/
|
|
||||||
const COMPANY = 'address_icirelais.COMPANY';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the column name for the FIRSTNAME field
|
|
||||||
*/
|
|
||||||
const FIRSTNAME = 'address_icirelais.FIRSTNAME';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the column name for the LASTNAME field
|
|
||||||
*/
|
|
||||||
const LASTNAME = 'address_icirelais.LASTNAME';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the column name for the ADDRESS1 field
|
|
||||||
*/
|
|
||||||
const ADDRESS1 = 'address_icirelais.ADDRESS1';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the column name for the ADDRESS2 field
|
|
||||||
*/
|
|
||||||
const ADDRESS2 = 'address_icirelais.ADDRESS2';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the column name for the ADDRESS3 field
|
|
||||||
*/
|
|
||||||
const ADDRESS3 = 'address_icirelais.ADDRESS3';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the column name for the ZIPCODE field
|
|
||||||
*/
|
|
||||||
const ZIPCODE = 'address_icirelais.ZIPCODE';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the column name for the CITY field
|
|
||||||
*/
|
|
||||||
const CITY = 'address_icirelais.CITY';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the column name for the COUNTRY_ID field
|
|
||||||
*/
|
|
||||||
const COUNTRY_ID = 'address_icirelais.COUNTRY_ID';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the column name for the CODE field
|
|
||||||
*/
|
|
||||||
const CODE = 'address_icirelais.CODE';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default string format for model objects of the related table
|
|
||||||
*/
|
|
||||||
const DEFAULT_STRING_FORMAT = 'YAML';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* holds an array of fieldnames
|
|
||||||
*
|
|
||||||
* first dimension keys are the type constants
|
|
||||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
|
||||||
*/
|
|
||||||
protected static $fieldNames = array (
|
|
||||||
self::TYPE_PHPNAME => array('Id', 'TitleId', 'Company', 'Firstname', 'Lastname', 'Address1', 'Address2', 'Address3', 'Zipcode', 'City', 'CountryId', 'Code', ),
|
|
||||||
self::TYPE_STUDLYPHPNAME => array('id', 'titleId', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'countryId', 'code', ),
|
|
||||||
self::TYPE_COLNAME => array(AddressIcirelaisTableMap::ID, AddressIcirelaisTableMap::TITLE_ID, AddressIcirelaisTableMap::COMPANY, AddressIcirelaisTableMap::FIRSTNAME, AddressIcirelaisTableMap::LASTNAME, AddressIcirelaisTableMap::ADDRESS1, AddressIcirelaisTableMap::ADDRESS2, AddressIcirelaisTableMap::ADDRESS3, AddressIcirelaisTableMap::ZIPCODE, AddressIcirelaisTableMap::CITY, AddressIcirelaisTableMap::COUNTRY_ID, AddressIcirelaisTableMap::CODE, ),
|
|
||||||
self::TYPE_RAW_COLNAME => array('ID', 'TITLE_ID', 'COMPANY', 'FIRSTNAME', 'LASTNAME', 'ADDRESS1', 'ADDRESS2', 'ADDRESS3', 'ZIPCODE', 'CITY', 'COUNTRY_ID', 'CODE', ),
|
|
||||||
self::TYPE_FIELDNAME => array('id', 'title_id', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'country_id', 'code', ),
|
|
||||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* holds an array of keys for quick access to the fieldnames array
|
|
||||||
*
|
|
||||||
* first dimension keys are the type constants
|
|
||||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
|
||||||
*/
|
|
||||||
protected static $fieldKeys = array (
|
|
||||||
self::TYPE_PHPNAME => array('Id' => 0, 'TitleId' => 1, 'Company' => 2, 'Firstname' => 3, 'Lastname' => 4, 'Address1' => 5, 'Address2' => 6, 'Address3' => 7, 'Zipcode' => 8, 'City' => 9, 'CountryId' => 10, 'Code' => 11, ),
|
|
||||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'titleId' => 1, 'company' => 2, 'firstname' => 3, 'lastname' => 4, 'address1' => 5, 'address2' => 6, 'address3' => 7, 'zipcode' => 8, 'city' => 9, 'countryId' => 10, 'code' => 11, ),
|
|
||||||
self::TYPE_COLNAME => array(AddressIcirelaisTableMap::ID => 0, AddressIcirelaisTableMap::TITLE_ID => 1, AddressIcirelaisTableMap::COMPANY => 2, AddressIcirelaisTableMap::FIRSTNAME => 3, AddressIcirelaisTableMap::LASTNAME => 4, AddressIcirelaisTableMap::ADDRESS1 => 5, AddressIcirelaisTableMap::ADDRESS2 => 6, AddressIcirelaisTableMap::ADDRESS3 => 7, AddressIcirelaisTableMap::ZIPCODE => 8, AddressIcirelaisTableMap::CITY => 9, AddressIcirelaisTableMap::COUNTRY_ID => 10, AddressIcirelaisTableMap::CODE => 11, ),
|
|
||||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'TITLE_ID' => 1, 'COMPANY' => 2, 'FIRSTNAME' => 3, 'LASTNAME' => 4, 'ADDRESS1' => 5, 'ADDRESS2' => 6, 'ADDRESS3' => 7, 'ZIPCODE' => 8, 'CITY' => 9, 'COUNTRY_ID' => 10, 'CODE' => 11, ),
|
|
||||||
self::TYPE_FIELDNAME => array('id' => 0, 'title_id' => 1, 'company' => 2, 'firstname' => 3, 'lastname' => 4, 'address1' => 5, 'address2' => 6, 'address3' => 7, 'zipcode' => 8, 'city' => 9, 'country_id' => 10, 'code' => 11, ),
|
|
||||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the table attributes and columns
|
|
||||||
* Relations are not initialized by this method since they are lazy loaded
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws PropelException
|
|
||||||
*/
|
|
||||||
public function initialize()
|
|
||||||
{
|
|
||||||
// attributes
|
|
||||||
$this->setName('address_icirelais');
|
|
||||||
$this->setPhpName('AddressIcirelais');
|
|
||||||
$this->setClassName('\\IciRelais\\Model\\AddressIcirelais');
|
|
||||||
$this->setPackage('IciRelais.Model');
|
|
||||||
$this->setUseIdGenerator(false);
|
|
||||||
// columns
|
|
||||||
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
|
||||||
$this->addForeignKey('TITLE_ID', 'TitleId', 'INTEGER', 'customer_title', 'ID', true, null, null);
|
|
||||||
$this->addColumn('COMPANY', 'Company', 'VARCHAR', false, 255, null);
|
|
||||||
$this->addColumn('FIRSTNAME', 'Firstname', 'VARCHAR', true, 255, null);
|
|
||||||
$this->addColumn('LASTNAME', 'Lastname', 'VARCHAR', true, 255, null);
|
|
||||||
$this->addColumn('ADDRESS1', 'Address1', 'VARCHAR', true, 255, null);
|
|
||||||
$this->addColumn('ADDRESS2', 'Address2', 'VARCHAR', true, 255, null);
|
|
||||||
$this->addColumn('ADDRESS3', 'Address3', 'VARCHAR', true, 255, null);
|
|
||||||
$this->addColumn('ZIPCODE', 'Zipcode', 'VARCHAR', true, 10, null);
|
|
||||||
$this->addColumn('CITY', 'City', 'VARCHAR', true, 255, null);
|
|
||||||
$this->addForeignKey('COUNTRY_ID', 'CountryId', 'INTEGER', 'country', 'ID', true, null, null);
|
|
||||||
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 10, null);
|
|
||||||
} // initialize()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Build the RelationMap objects for this table relationships
|
|
||||||
*/
|
|
||||||
public function buildRelations()
|
|
||||||
{
|
|
||||||
$this->addRelation('CustomerTitle', '\\IciRelais\\Model\\Thelia\\Model\\CustomerTitle', RelationMap::MANY_TO_ONE, array('title_id' => 'id', ), 'RESTRICT', 'RESTRICT');
|
|
||||||
$this->addRelation('Country', '\\IciRelais\\Model\\Thelia\\Model\\Country', RelationMap::MANY_TO_ONE, array('country_id' => 'id', ), 'RESTRICT', 'RESTRICT');
|
|
||||||
} // buildRelations()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
|
||||||
*
|
|
||||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
|
||||||
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
|
||||||
*
|
|
||||||
* @param array $row resultset row.
|
|
||||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
|
||||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
|
||||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
|
||||||
*/
|
|
||||||
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
|
||||||
{
|
|
||||||
// If the PK cannot be derived from the row, return NULL.
|
|
||||||
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the primary key from the DB resultset row
|
|
||||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
|
||||||
* a multi-column primary key, an array of the primary key columns will be returned.
|
|
||||||
*
|
|
||||||
* @param array $row resultset row.
|
|
||||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
|
||||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
|
||||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
|
||||||
*
|
|
||||||
* @return mixed The primary key of the row
|
|
||||||
*/
|
|
||||||
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
|
||||||
{
|
|
||||||
return (int) $row[
|
|
||||||
$indexType == TableMap::TYPE_NUM
|
|
||||||
? 0 + $offset
|
|
||||||
: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The class that the tableMap will make instances of.
|
|
||||||
*
|
|
||||||
* If $withPrefix is true, the returned path
|
|
||||||
* uses a dot-path notation which is translated into a path
|
|
||||||
* relative to a location on the PHP include_path.
|
|
||||||
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
|
|
||||||
*
|
|
||||||
* @param boolean $withPrefix Whether or not to return the path with the class name
|
|
||||||
* @return string path.to.ClassName
|
|
||||||
*/
|
|
||||||
public static function getOMClass($withPrefix = true)
|
|
||||||
{
|
|
||||||
return $withPrefix ? AddressIcirelaisTableMap::CLASS_DEFAULT : AddressIcirelaisTableMap::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 (AddressIcirelais object, last column rank)
|
|
||||||
*/
|
|
||||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
|
||||||
{
|
|
||||||
$key = AddressIcirelaisTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
|
||||||
if (null !== ($obj = AddressIcirelaisTableMap::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 + AddressIcirelaisTableMap::NUM_HYDRATE_COLUMNS;
|
|
||||||
} else {
|
|
||||||
$cls = AddressIcirelaisTableMap::OM_CLASS;
|
|
||||||
$obj = new $cls();
|
|
||||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
|
||||||
AddressIcirelaisTableMap::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 = AddressIcirelaisTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
|
||||||
if (null !== ($obj = AddressIcirelaisTableMap::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;
|
|
||||||
AddressIcirelaisTableMap::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(AddressIcirelaisTableMap::ID);
|
|
||||||
$criteria->addSelectColumn(AddressIcirelaisTableMap::TITLE_ID);
|
|
||||||
$criteria->addSelectColumn(AddressIcirelaisTableMap::COMPANY);
|
|
||||||
$criteria->addSelectColumn(AddressIcirelaisTableMap::FIRSTNAME);
|
|
||||||
$criteria->addSelectColumn(AddressIcirelaisTableMap::LASTNAME);
|
|
||||||
$criteria->addSelectColumn(AddressIcirelaisTableMap::ADDRESS1);
|
|
||||||
$criteria->addSelectColumn(AddressIcirelaisTableMap::ADDRESS2);
|
|
||||||
$criteria->addSelectColumn(AddressIcirelaisTableMap::ADDRESS3);
|
|
||||||
$criteria->addSelectColumn(AddressIcirelaisTableMap::ZIPCODE);
|
|
||||||
$criteria->addSelectColumn(AddressIcirelaisTableMap::CITY);
|
|
||||||
$criteria->addSelectColumn(AddressIcirelaisTableMap::COUNTRY_ID);
|
|
||||||
$criteria->addSelectColumn(AddressIcirelaisTableMap::CODE);
|
|
||||||
} else {
|
|
||||||
$criteria->addSelectColumn($alias . '.ID');
|
|
||||||
$criteria->addSelectColumn($alias . '.TITLE_ID');
|
|
||||||
$criteria->addSelectColumn($alias . '.COMPANY');
|
|
||||||
$criteria->addSelectColumn($alias . '.FIRSTNAME');
|
|
||||||
$criteria->addSelectColumn($alias . '.LASTNAME');
|
|
||||||
$criteria->addSelectColumn($alias . '.ADDRESS1');
|
|
||||||
$criteria->addSelectColumn($alias . '.ADDRESS2');
|
|
||||||
$criteria->addSelectColumn($alias . '.ADDRESS3');
|
|
||||||
$criteria->addSelectColumn($alias . '.ZIPCODE');
|
|
||||||
$criteria->addSelectColumn($alias . '.CITY');
|
|
||||||
$criteria->addSelectColumn($alias . '.COUNTRY_ID');
|
|
||||||
$criteria->addSelectColumn($alias . '.CODE');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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(AddressIcirelaisTableMap::DATABASE_NAME)->getTable(AddressIcirelaisTableMap::TABLE_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a TableMap instance to the database for this tableMap class.
|
|
||||||
*/
|
|
||||||
public static function buildTableMap()
|
|
||||||
{
|
|
||||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(AddressIcirelaisTableMap::DATABASE_NAME);
|
|
||||||
if (!$dbMap->hasTable(AddressIcirelaisTableMap::TABLE_NAME)) {
|
|
||||||
$dbMap->addTableObject(new AddressIcirelaisTableMap());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Performs a DELETE on the database, given a AddressIcirelais or Criteria object OR a primary key value.
|
|
||||||
*
|
|
||||||
* @param mixed $values Criteria or AddressIcirelais 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(AddressIcirelaisTableMap::DATABASE_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($values instanceof Criteria) {
|
|
||||||
// rename for clarity
|
|
||||||
$criteria = $values;
|
|
||||||
} elseif ($values instanceof \IciRelais\Model\AddressIcirelais) { // 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(AddressIcirelaisTableMap::DATABASE_NAME);
|
|
||||||
$criteria->add(AddressIcirelaisTableMap::ID, (array) $values, Criteria::IN);
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = AddressIcirelaisQuery::create()->mergeWith($criteria);
|
|
||||||
|
|
||||||
if ($values instanceof Criteria) { AddressIcirelaisTableMap::clearInstancePool();
|
|
||||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
|
||||||
foreach ((array) $values as $singleval) { AddressIcirelaisTableMap::removeInstanceFromPool($singleval);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $query->delete($con);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deletes all rows from the address_icirelais 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 AddressIcirelaisQuery::create()->doDeleteAll($con);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Performs an INSERT on the database, given a AddressIcirelais or Criteria object.
|
|
||||||
*
|
|
||||||
* @param mixed $criteria Criteria or AddressIcirelais 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(AddressIcirelaisTableMap::DATABASE_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($criteria instanceof Criteria) {
|
|
||||||
$criteria = clone $criteria; // rename for clarity
|
|
||||||
} else {
|
|
||||||
$criteria = $criteria->buildCriteria(); // build Criteria from AddressIcirelais object
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the correct dbName
|
|
||||||
$query = AddressIcirelaisQuery::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;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // AddressIcirelaisTableMap
|
|
||||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
|
||||||
//
|
|
||||||
AddressIcirelaisTableMap::buildTableMap();
|
|
||||||
@@ -1,404 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace IciRelais\Model\Map;
|
|
||||||
|
|
||||||
use IciRelais\Model\OrderAddressIcirelais;
|
|
||||||
use IciRelais\Model\OrderAddressIcirelaisQuery;
|
|
||||||
use Propel\Runtime\Propel;
|
|
||||||
use Propel\Runtime\ActiveQuery\Criteria;
|
|
||||||
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
|
|
||||||
use Propel\Runtime\Connection\ConnectionInterface;
|
|
||||||
use Propel\Runtime\DataFetcher\DataFetcherInterface;
|
|
||||||
use Propel\Runtime\Exception\PropelException;
|
|
||||||
use Propel\Runtime\Map\RelationMap;
|
|
||||||
use Propel\Runtime\Map\TableMap;
|
|
||||||
use Propel\Runtime\Map\TableMapTrait;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class defines the structure of the 'order_address_icirelais' 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 OrderAddressIcirelaisTableMap extends TableMap
|
|
||||||
{
|
|
||||||
use InstancePoolTrait;
|
|
||||||
use TableMapTrait;
|
|
||||||
/**
|
|
||||||
* The (dot-path) name of this class
|
|
||||||
*/
|
|
||||||
const CLASS_NAME = 'IciRelais.Model.Map.OrderAddressIcirelaisTableMap';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default database name for this class
|
|
||||||
*/
|
|
||||||
const DATABASE_NAME = 'thelia';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The table name for this class
|
|
||||||
*/
|
|
||||||
const TABLE_NAME = 'order_address_icirelais';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The related Propel class for this table
|
|
||||||
*/
|
|
||||||
const OM_CLASS = '\\IciRelais\\Model\\OrderAddressIcirelais';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A class that can be returned by this tableMap
|
|
||||||
*/
|
|
||||||
const CLASS_DEFAULT = 'IciRelais.Model.OrderAddressIcirelais';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 = 'order_address_icirelais.ID';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* the column name for the CODE field
|
|
||||||
*/
|
|
||||||
const CODE = 'order_address_icirelais.CODE';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default string format for model objects of the related table
|
|
||||||
*/
|
|
||||||
const DEFAULT_STRING_FORMAT = 'YAML';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* holds an array of fieldnames
|
|
||||||
*
|
|
||||||
* first dimension keys are the type constants
|
|
||||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
|
||||||
*/
|
|
||||||
protected static $fieldNames = array (
|
|
||||||
self::TYPE_PHPNAME => array('Id', 'Code', ),
|
|
||||||
self::TYPE_STUDLYPHPNAME => array('id', 'code', ),
|
|
||||||
self::TYPE_COLNAME => array(OrderAddressIcirelaisTableMap::ID, OrderAddressIcirelaisTableMap::CODE, ),
|
|
||||||
self::TYPE_RAW_COLNAME => array('ID', 'CODE', ),
|
|
||||||
self::TYPE_FIELDNAME => array('id', 'code', ),
|
|
||||||
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, 'Code' => 1, ),
|
|
||||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'code' => 1, ),
|
|
||||||
self::TYPE_COLNAME => array(OrderAddressIcirelaisTableMap::ID => 0, OrderAddressIcirelaisTableMap::CODE => 1, ),
|
|
||||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'CODE' => 1, ),
|
|
||||||
self::TYPE_FIELDNAME => array('id' => 0, 'code' => 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('order_address_icirelais');
|
|
||||||
$this->setPhpName('OrderAddressIcirelais');
|
|
||||||
$this->setClassName('\\IciRelais\\Model\\OrderAddressIcirelais');
|
|
||||||
$this->setPackage('IciRelais.Model');
|
|
||||||
$this->setUseIdGenerator(false);
|
|
||||||
// columns
|
|
||||||
$this->addForeignPrimaryKey('ID', 'Id', 'INTEGER' , 'order_address', 'ID', true, null, null);
|
|
||||||
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 10, null);
|
|
||||||
} // initialize()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Build the RelationMap objects for this table relationships
|
|
||||||
*/
|
|
||||||
public function buildRelations()
|
|
||||||
{
|
|
||||||
$this->addRelation('OrderAddress', '\\IciRelais\\Model\\Thelia\\Model\\OrderAddress', RelationMap::MANY_TO_ONE, array('id' => 'id', ), 'CASCADE', 'CASCADE');
|
|
||||||
} // buildRelations()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
|
||||||
*
|
|
||||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
|
||||||
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
|
||||||
*
|
|
||||||
* @param array $row resultset row.
|
|
||||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
|
||||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
|
||||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
|
||||||
*/
|
|
||||||
public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
|
||||||
{
|
|
||||||
// If the PK cannot be derived from the row, return NULL.
|
|
||||||
if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the primary key from the DB resultset row
|
|
||||||
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
|
||||||
* a multi-column primary key, an array of the primary key columns will be returned.
|
|
||||||
*
|
|
||||||
* @param array $row resultset row.
|
|
||||||
* @param int $offset The 0-based offset for reading from the resultset row.
|
|
||||||
* @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_STUDLYPHPNAME
|
|
||||||
* TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
|
|
||||||
*
|
|
||||||
* @return mixed The primary key of the row
|
|
||||||
*/
|
|
||||||
public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
|
||||||
{
|
|
||||||
return (int) $row[
|
|
||||||
$indexType == TableMap::TYPE_NUM
|
|
||||||
? 0 + $offset
|
|
||||||
: self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The class that the tableMap will make instances of.
|
|
||||||
*
|
|
||||||
* If $withPrefix is true, the returned path
|
|
||||||
* uses a dot-path notation which is translated into a path
|
|
||||||
* relative to a location on the PHP include_path.
|
|
||||||
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
|
|
||||||
*
|
|
||||||
* @param boolean $withPrefix Whether or not to return the path with the class name
|
|
||||||
* @return string path.to.ClassName
|
|
||||||
*/
|
|
||||||
public static function getOMClass($withPrefix = true)
|
|
||||||
{
|
|
||||||
return $withPrefix ? OrderAddressIcirelaisTableMap::CLASS_DEFAULT : OrderAddressIcirelaisTableMap::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 (OrderAddressIcirelais object, last column rank)
|
|
||||||
*/
|
|
||||||
public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
|
|
||||||
{
|
|
||||||
$key = OrderAddressIcirelaisTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
|
|
||||||
if (null !== ($obj = OrderAddressIcirelaisTableMap::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 + OrderAddressIcirelaisTableMap::NUM_HYDRATE_COLUMNS;
|
|
||||||
} else {
|
|
||||||
$cls = OrderAddressIcirelaisTableMap::OM_CLASS;
|
|
||||||
$obj = new $cls();
|
|
||||||
$col = $obj->hydrate($row, $offset, false, $indexType);
|
|
||||||
OrderAddressIcirelaisTableMap::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 = OrderAddressIcirelaisTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
|
|
||||||
if (null !== ($obj = OrderAddressIcirelaisTableMap::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;
|
|
||||||
OrderAddressIcirelaisTableMap::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(OrderAddressIcirelaisTableMap::ID);
|
|
||||||
$criteria->addSelectColumn(OrderAddressIcirelaisTableMap::CODE);
|
|
||||||
} else {
|
|
||||||
$criteria->addSelectColumn($alias . '.ID');
|
|
||||||
$criteria->addSelectColumn($alias . '.CODE');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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(OrderAddressIcirelaisTableMap::DATABASE_NAME)->getTable(OrderAddressIcirelaisTableMap::TABLE_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a TableMap instance to the database for this tableMap class.
|
|
||||||
*/
|
|
||||||
public static function buildTableMap()
|
|
||||||
{
|
|
||||||
$dbMap = Propel::getServiceContainer()->getDatabaseMap(OrderAddressIcirelaisTableMap::DATABASE_NAME);
|
|
||||||
if (!$dbMap->hasTable(OrderAddressIcirelaisTableMap::TABLE_NAME)) {
|
|
||||||
$dbMap->addTableObject(new OrderAddressIcirelaisTableMap());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Performs a DELETE on the database, given a OrderAddressIcirelais or Criteria object OR a primary key value.
|
|
||||||
*
|
|
||||||
* @param mixed $values Criteria or OrderAddressIcirelais 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(OrderAddressIcirelaisTableMap::DATABASE_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($values instanceof Criteria) {
|
|
||||||
// rename for clarity
|
|
||||||
$criteria = $values;
|
|
||||||
} elseif ($values instanceof \IciRelais\Model\OrderAddressIcirelais) { // 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(OrderAddressIcirelaisTableMap::DATABASE_NAME);
|
|
||||||
$criteria->add(OrderAddressIcirelaisTableMap::ID, (array) $values, Criteria::IN);
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = OrderAddressIcirelaisQuery::create()->mergeWith($criteria);
|
|
||||||
|
|
||||||
if ($values instanceof Criteria) { OrderAddressIcirelaisTableMap::clearInstancePool();
|
|
||||||
} elseif (!is_object($values)) { // it's a primary key, or an array of pks
|
|
||||||
foreach ((array) $values as $singleval) { OrderAddressIcirelaisTableMap::removeInstanceFromPool($singleval);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $query->delete($con);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deletes all rows from the order_address_icirelais 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 OrderAddressIcirelaisQuery::create()->doDeleteAll($con);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Performs an INSERT on the database, given a OrderAddressIcirelais or Criteria object.
|
|
||||||
*
|
|
||||||
* @param mixed $criteria Criteria or OrderAddressIcirelais 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(OrderAddressIcirelaisTableMap::DATABASE_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($criteria instanceof Criteria) {
|
|
||||||
$criteria = clone $criteria; // rename for clarity
|
|
||||||
} else {
|
|
||||||
$criteria = $criteria->buildCriteria(); // build Criteria from OrderAddressIcirelais object
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the correct dbName
|
|
||||||
$query = OrderAddressIcirelaisQuery::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;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // OrderAddressIcirelaisTableMap
|
|
||||||
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
|
||||||
//
|
|
||||||
OrderAddressIcirelaisTableMap::buildTableMap();
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace IciRelais\Model;
|
|
||||||
|
|
||||||
use IciRelais\Model\Base\OrderAddressIcirelais as BaseOrderAddressIcirelais;
|
|
||||||
|
|
||||||
class OrderAddressIcirelais extends BaseOrderAddressIcirelais
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace IciRelais\Model;
|
|
||||||
|
|
||||||
use IciRelais\Model\Base\OrderAddressIcirelaisQuery as BaseOrderAddressIcirelaisQuery;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Skeleton subclass for performing query and update operations on the 'order_address_icirelais' 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 OrderAddressIcirelaisQuery extends BaseOrderAddressIcirelaisQuery
|
|
||||||
{
|
|
||||||
|
|
||||||
} // OrderAddressIcirelaisQuery
|
|
||||||
@@ -1,111 +0,0 @@
|
|||||||
#### This module is deprecated. Use [DdpPickup](https://github.com/thelia-modules/DpdPickup) now.
|
|
||||||
|
|
||||||
|
|
||||||
Ici Relais module v1.0
|
|
||||||
author: Thelia <info@thelia.net>
|
|
||||||
|
|
||||||
=== SUMMARY ===
|
|
||||||
|
|
||||||
fr_FR:
|
|
||||||
I) Installation
|
|
||||||
II) Utilisation
|
|
||||||
III) Intégration
|
|
||||||
|
|
||||||
en_US:
|
|
||||||
I) Install notes
|
|
||||||
II) How to use
|
|
||||||
III) Integration
|
|
||||||
|
|
||||||
|
|
||||||
=== fr_FR ===
|
|
||||||
|
|
||||||
I) Installation
|
|
||||||
---------------
|
|
||||||
L'installation du module IciRelais se fait de la même manière que les autres, vous pouvez soit importer directement le zip dans le back office,
|
|
||||||
soit le décompresser dans <dossier de Thélia2>/local/modules.
|
|
||||||
Un exemple d'intégration dans le thème par défault de Thelia est fourni dans le dossier templates, il vous suffit de copier les fichiers:
|
|
||||||
- <dossier du module>/templates/frontOffice/default/ajax/order-delivery-module-list.html
|
|
||||||
- <dossier du module>/templates/frontOffice/default/order-delivery.html
|
|
||||||
- <dossier du module>/templates/frontOffice/default/order-invoice.html
|
|
||||||
dans le dossier du template en suivant la même arborescence.
|
|
||||||
|
|
||||||
Il nous vous reste plus qu'à activer le module et à associer vos zones de livraison.
|
|
||||||
|
|
||||||
II) Utilisation
|
|
||||||
---------------
|
|
||||||
Une page de configuration est mise à votre disposition pour vous permettre d'effectuer deux tâches:
|
|
||||||
- exporter un fichier EXAPRINT (export.dat) contenant les informations sur les livraisons effectuées via IciRelais
|
|
||||||
- configurer les tranches de prix des livraisons par IciRelais
|
|
||||||
|
|
||||||
Pour vous y rendre, il vous suffit d'aller dans le back Office, onglet "Modules" et de cliquer sur "Configurer" sur la ligne du module IciRelais.
|
|
||||||
Pour exporter un fichier EXAPRINT, il faut renseigner tous les champs présents dans le formulaire.
|
|
||||||
|
|
||||||
III) Intégration
|
|
||||||
----------------
|
|
||||||
Pour l'exemple d'intégration, j'ai utilisé une google map, ceci n'est pas nécessaire mais préférable.
|
|
||||||
En effet, le module n'interagit pas avec pendant la commande.
|
|
||||||
Une fois le module activé, il devient néanmoins indispensable de transmettre une variable $_POST['pr_code'] dans le formulaire "thelia.order.delivery",
|
|
||||||
sinon, vous ne pourrez plus passer à l'étape 3 ( order-invoice ).
|
|
||||||
De plus, une boucle "delivery.ici" est disponible et doit remplacer la boucle "delivery" dans order-delivery-module-list.html,
|
|
||||||
les deux sont semblable, mais delivery.ici possède une variable en plus, qui permet de savoir si le module est ou non IciRelais ( ce qui permet une intégration spécifique
|
|
||||||
de la ligne IciRelais).
|
|
||||||
La variable "pr_code" doit contenir l'identifiant du point relais choisi par l'utilisateur.
|
|
||||||
Une boucle vous est fournie pour obtenir les 10 points relais les plus proches de l'adresse par défault de l'utilisateur: icirelais.relais.around
|
|
||||||
Sinon, une route est disponible pour obtenir 10 points relais dans une ville: /module/icirelais/{ville}/{code postal}
|
|
||||||
Cette route pointe vers le controlleur "SearchCityController" qui génère un fichier json, que vous pouvez utiliser, par exemple, avec jquery/ajax.
|
|
||||||
|
|
||||||
Pour afficher l'adresse du point relais en adresse de livraison sur la page order-invoice.html,
|
|
||||||
il vous suffit de replacer le type de la boucle nommée "delivery-address" en address.ici, à la place de "delivery"
|
|
||||||
|
|
||||||
Pour rajouter l'adresse de suivi du colis dans le mail de confirmation de la commande, une boucle est mise à votre disposition: "icirelais.urltracking"
|
|
||||||
elle prend un argument ref, qui est la référence de la commande, et une sortie $URL.
|
|
||||||
Si l'url ne peut être générée, elle ne renvoie rien.
|
|
||||||
On peut donc l'intégrer de la manière suivante:
|
|
||||||
{loop name="tracking" type="icirelais.urltracking" ref=$REF}
|
|
||||||
Vous pouvez suivre votre colis <a href="{$URL}">ici</a>
|
|
||||||
{/loop}
|
|
||||||
=== en_US ===
|
|
||||||
|
|
||||||
I) Install notes
|
|
||||||
---------------
|
|
||||||
The install process of IciRelais module is the same than the other modules, you can import it directly from the back office,
|
|
||||||
or unzip it in <path to thelia2>/local/modules.
|
|
||||||
An integration example in Thelia's default theme is provided in templates directory, you only have to copy those files:
|
|
||||||
- <module directory>/templates/frontOffice/default/ajax/order-delivery-module-list.html
|
|
||||||
- <module directory>/templates/frontOffice/default/order-delivery.html
|
|
||||||
- <module directory>/templates/frontOffice/default/order-invoice.html
|
|
||||||
respectively in the directory of the template.
|
|
||||||
|
|
||||||
Then you can activate IciRelais module and configure you shipping zones.
|
|
||||||
|
|
||||||
II) How to use
|
|
||||||
---------------
|
|
||||||
A configuration page is provided with the module, so you can:
|
|
||||||
- export an EXAPRINT file (export.dat), with informations on all deliveries done with IciRelais
|
|
||||||
- configure price slices for shipping zones.
|
|
||||||
|
|
||||||
You can use it in the back office by going to "Modules" tab, then "configure" button on IciRelais' line.
|
|
||||||
For exporting an EXAPRINT file, you must complete the entire form.
|
|
||||||
|
|
||||||
III) Integration
|
|
||||||
----------------
|
|
||||||
For the integration example, I used a google map, but it's not necessary.
|
|
||||||
In fact, the module doesn't interact with the map during the order.
|
|
||||||
Once the module is active, you must create an input named "pr_code" in your form "thelia.order.delivery",
|
|
||||||
whereas you won't be able to go to step 3 ( order-invoice ).
|
|
||||||
Moreover, the loop "delivery.ici" is available and must replace "delivery" in order-delivery-module-list.html,
|
|
||||||
they do the same thing, but delivery.ici has a new variable that allows you to know if the delivery module that's being looped is IciRelais.
|
|
||||||
The input "pr_code" must contain the ID of the pick-up & go store choosed by the user.
|
|
||||||
A loop is provided to get the 10 nearest pick-up & go stores of user's default address: icirelais.relais.around
|
|
||||||
There's also a route to get 10 pick-p & go stores in another city: /module/icirelais/{city}/{zipcode}
|
|
||||||
This route uses "SearchCityController" controller. It generate a json output, which you can use with, for example, jquery/ajax.
|
|
||||||
|
|
||||||
If you want to show the store's address as delivery address, you just have to replace the "delivery-address" loop type by address.ici
|
|
||||||
|
|
||||||
If you want to add the package tracking link to the order email, you can use the loop: "icirelais.urltracking"
|
|
||||||
It take only one argument ref, that is the order's reference, and it has one output $URL.
|
|
||||||
If the link can't be generated, there's no output.
|
|
||||||
You can, for exemple, integrate the link like that in the email:
|
|
||||||
{loop name="tracking" type="icirelais.urltracking" ref=$REF}
|
|
||||||
You can track your package <a href="{$URL}">here</a>
|
|
||||||
{/loop}
|
|
||||||
@@ -1,213 +0,0 @@
|
|||||||
{form name="thelia.order.delivery"}
|
|
||||||
|
|
||||||
|
|
||||||
{* Check if IciRelais webservice is up *}
|
|
||||||
{assign var="isIcirelaisUp" value=0}
|
|
||||||
{loop name="is.icirelais.up" type="icirelais.relais.around"}{/loop}
|
|
||||||
{ifloop rel="is.icirelais.up"}
|
|
||||||
{assign var="isIcirelaisUp" value=1}
|
|
||||||
{/ifloop}
|
|
||||||
|
|
||||||
{loop type="delivery.ici" name="deliveries" force_return="true" country=$country}
|
|
||||||
|
|
||||||
{if ($ID == $ICI_RELAIS_MODULE and $isIcirelaisUp) or $ID != $ICI_RELAIS_MODULE}
|
|
||||||
{assign var="isDeliveryMethodChecked" value="0"}
|
|
||||||
<div class="radio">
|
|
||||||
{form_field form=$form field='delivery-module'}
|
|
||||||
{if $isPost}
|
|
||||||
{if $value == $ID}
|
|
||||||
{assign var="isDeliveryMethodChecked" value="1"}
|
|
||||||
{/if}
|
|
||||||
{elseif $LOOP_COUNT == 1}
|
|
||||||
{assign var="isDeliveryMethodChecked" value="1"}
|
|
||||||
{/if}
|
|
||||||
<label for="delivery-method_{$ID}">
|
|
||||||
{if $ID eq $ICI_RELAIS_MODULE}
|
|
||||||
<input type="radio" name="{$name}" id="delivery-method_{$ID}"{if $isDeliveryMethodChecked} checked="checked"{/if} value="{$ID}" onchange="show_hide_ici_relais_map(true);">
|
|
||||||
{else}
|
|
||||||
<input type="radio" name="{$name}" id="delivery-method_{$ID}"{if $isDeliveryMethodChecked} checked="checked"{/if} value="{$ID}" onchange="show_hide_ici_relais_map(false);">
|
|
||||||
{/if}
|
|
||||||
<strong>{$TITLE}</strong> / {$POSTAGE} {currency attr="symbol"}
|
|
||||||
</label>
|
|
||||||
{/form_field}
|
|
||||||
{if $ID eq $ICI_RELAIS_MODULE}<br/><br/>
|
|
||||||
<div id="google-map-ici-relais" {if !$isDeliveryMethodChecked} style="display: none;" {/if}>
|
|
||||||
<script>
|
|
||||||
<!--
|
|
||||||
function loadScript() {
|
|
||||||
var script = document.createElement('script');
|
|
||||||
script.type = 'text/javascript';
|
|
||||||
script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&' +
|
|
||||||
'callback=initialize';
|
|
||||||
document.body.appendChild(script);
|
|
||||||
}
|
|
||||||
if(typeof(google) === 'undefined') {
|
|
||||||
loadScript();
|
|
||||||
}
|
|
||||||
|
|
||||||
function show_hide_ici_relais_map(flag) {
|
|
||||||
if(flag) {
|
|
||||||
document.getElementById('google-map-ici-relais').style.display = 'block';
|
|
||||||
} else {
|
|
||||||
document.getElementById('google-map-ici-relais').style.display = 'none';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function check_selection_relais()
|
|
||||||
{
|
|
||||||
if ($('input[name=choix]:checked').length == 0)
|
|
||||||
{
|
|
||||||
alert("{intl l="Please choose a pick-up & Go store"}.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
function show_relay(url)
|
|
||||||
{
|
|
||||||
window.open(url, "mondialrelay", 'width=772,height=570,status=0,menubar=0,location=0,titlebar=0');
|
|
||||||
}
|
|
||||||
function updatemap(url_site, adr_geoloc, locations) {
|
|
||||||
document.getElementById('relaymap').innerHTML = "";
|
|
||||||
// Define MAP
|
|
||||||
var mapOptions = {
|
|
||||||
zoom: 13,
|
|
||||||
mapTypeId: google.maps.MapTypeId.ROADMAP
|
|
||||||
}
|
|
||||||
// On va créer la map dans la div qui a l'id relaymap
|
|
||||||
var map = new google.maps.Map(document.getElementById('relaymap'), mapOptions);
|
|
||||||
// Then, display everything on the map
|
|
||||||
var geocoder = new google.maps.Geocoder();
|
|
||||||
// We get latitude and longitude for the customer's adress
|
|
||||||
var b = [];
|
|
||||||
b['address'] = adr_geoloc;
|
|
||||||
geocoder.geocode(b, function(results, status){
|
|
||||||
if(status == google.maps.GeocoderStatus.OK){
|
|
||||||
// Et on centre la map sur cette position
|
|
||||||
map.setCenter(results[0].geometry.location);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
// Sinon on met le centre de la map sur Clermont-Ferrand ;)
|
|
||||||
alert('{intl l="Actual address can't be geolocated"}');
|
|
||||||
var myLatLng = new google.maps.LatLng(45.7789, 3.0782);
|
|
||||||
map.setCenter(myLatLng);
|
|
||||||
map.setZoom(3);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var infowindow = new google.maps.InfoWindow();
|
|
||||||
|
|
||||||
var marker, i;
|
|
||||||
|
|
||||||
// Pour chaque point relais dans locations on crée un nouveau marker
|
|
||||||
// And Complete table-relais
|
|
||||||
var buf = "";
|
|
||||||
for(i = 0; i < Object.keys(locations).length; i++){
|
|
||||||
buf += '<tr><td style="padding: 5px;">'+locations[i][0]+', '+locations[i][4]+', '+locations[i][5]+' '+locations[i][6];
|
|
||||||
buf += '- '+locations[i][7];
|
|
||||||
buf += '</td><td><input type="radio" name="pr_code" id="pr'+locations[i][3]+'" value="'+locations[i][3]+'" ';
|
|
||||||
if(i == 0) buf += 'checked'
|
|
||||||
buf += '/></td></tr>';
|
|
||||||
marker = new google.maps.Marker({
|
|
||||||
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
|
|
||||||
// Icone d'un point relai
|
|
||||||
icon: new google.maps.MarkerImage("{image file="assets/logo_pr.png" source="IciRelais"}"),
|
|
||||||
map: map
|
|
||||||
});
|
|
||||||
|
|
||||||
// Lors du clic sur un point relai on affiche une bulle avec les informations
|
|
||||||
google.maps.event.addListener(marker, 'click', (function(marker, i) {
|
|
||||||
return function() {
|
|
||||||
infowindow.setContent(locations[i][0]+'<br/>'+locations[i][4]+'<br/>'+locations[i][5]+' '+locations[i][6]+'<br/>'+locations[i][7]);
|
|
||||||
infowindow.open(map, marker);
|
|
||||||
}
|
|
||||||
})(marker, i));
|
|
||||||
|
|
||||||
// Lors de la fermeture de la bulle d'information on déselectionne le bouton radio associé
|
|
||||||
google.maps.event.addListener(infowindow, 'closeclick', (function(marker, i) {
|
|
||||||
return function() {}
|
|
||||||
})(marker, i));
|
|
||||||
|
|
||||||
}
|
|
||||||
document.getElementById("table-relais").innerHTML =buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
function initialize() {
|
|
||||||
// Get site base url
|
|
||||||
var url_site = '{url path="/"}';
|
|
||||||
// Get customer address
|
|
||||||
|
|
||||||
{loop type="address" name="delivery-selection-icirelais" customer="current" default="true"}
|
|
||||||
var adr_geoloc = "{$ADDRESS1}, {$ZIPCODE} {$CITY}";
|
|
||||||
{/loop}
|
|
||||||
// Get every relay around customer's address
|
|
||||||
var locations = new Array();
|
|
||||||
|
|
||||||
{loop type="icirelais.relais.around" name="delivery-selection-icirelais"}
|
|
||||||
locations.push(['{$NAME}', {$LATITUDE}, {$LONGITUDE}, '{$CODE}', '{$ADDRESS}', '{$ZIPCODE}', '{$CITY}', '{$DISTANCE}']);
|
|
||||||
{/loop}
|
|
||||||
updatemap(url_site, adr_geoloc, locations);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function search_city_relais() {
|
|
||||||
var zipcode = document.getElementById("search-zipcode").value;
|
|
||||||
var city = document.getElementById("search-city").value;
|
|
||||||
if(zipcode == "" || city == "") {
|
|
||||||
alert("{intl l="Please enter a city and a zipcode"}");
|
|
||||||
{literal}
|
|
||||||
} else if(!(/\d{5}/.test(zipcode))) {
|
|
||||||
{/literal}
|
|
||||||
alert("{intl l="Please enter a valid zipcode"}");
|
|
||||||
} else {
|
|
||||||
// Get site base url
|
|
||||||
var url_site = '{url path="/"}';
|
|
||||||
// Get search address
|
|
||||||
var adr_geoloc = zipcode+" "+city;
|
|
||||||
// Get every relay around customer's address
|
|
||||||
var locations = new Array();
|
|
||||||
$.get(url_site+"module/icirelais/"+zipcode+"/"+city, function(data){
|
|
||||||
locations = JSON.parse(data);
|
|
||||||
updatemap(url_site, adr_geoloc, locations);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Search city pseudo-form
|
|
||||||
document.getElementById("search-city-submit").onclick = search_city_relais;
|
|
||||||
//-->
|
|
||||||
</script>
|
|
||||||
<!-- If delivery method is Ici Relais -->
|
|
||||||
<div id="relaymap" style="width: 450px; height: 420px; float: left;"></div>
|
|
||||||
<table id="table-relais" style="height: 311px;">
|
|
||||||
</table>
|
|
||||||
<!-- Search city -->
|
|
||||||
<div class="panel" style="width: 450px;">
|
|
||||||
<div class="panel-heading clearfix">
|
|
||||||
{intl l="Search relay in a city"}
|
|
||||||
</div>
|
|
||||||
<div class="panel-body" style="padding: 5px;">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="search-city" class="control-label">
|
|
||||||
{intl l="city"} :
|
|
||||||
</label>
|
|
||||||
<input type="text" id="search-city" placeholder="{intl l='city'}" class="form-control" style="width: 400px;" onPaste="" {literal}onkeydown="if (event.keyCode == 13) {search_city_relais();return false;}"{/literal}/>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="search-zipcode" class="control-label">
|
|
||||||
{intl l="zipcode"} :
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<input type="text" id="search-zipcode" placeholder="{intl l='zipcode'}" class="form-control" style="width: 400px;" onPaste="" {literal}onkeydown="if (event.keyCode == 13) {search_city_relais();return false;}"{/literal}/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<input type="button" id="search-city-submit" class="form-submit-button btn btn-sm btn-default" title="{intl l='Search'}" value="{intl l='Search'}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- --- -->
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
{/loop}
|
|
||||||
{elseloop rel="deliveries"}<div class="deliveries-warning">{intl l="<strong>Sorry!</strong> We are not able to give you a delivery method for your order."}</div>{/elseloop}
|
|
||||||
{/form}
|
|
||||||
|
Before Width: | Height: | Size: 5.1 KiB |
@@ -1 +0,0 @@
|
|||||||
{assign var="count" value="0"}{literal}{{/literal}{loop type="icirelais.relais.around" name="delivery-selection-icirelais" zipcode=$_zipcode_ city=$_city_}"{$count}":{literal}{{/literal}"0":"{$NAME}","1":{$LATITUDE},"2":{$LONGITUDE},"3":"{$CODE}","4":"{$ADDRESS}","5":"{$ZIPCODE}","6":"{$CITY}","7":"{$DISTANCE}"{literal}}{/literal}{if $count ne 9},{/if}{assign var="count" value=$count+"1"}{/loop}{literal}}{/literal}
|
|
||||||
@@ -1,158 +0,0 @@
|
|||||||
{extends file="layout.tpl"}
|
|
||||||
|
|
||||||
{* Security *}
|
|
||||||
{block name="no-return-functions" prepend}
|
|
||||||
{check_auth context="front" role="CUSTOMER" login_tpl="login"}
|
|
||||||
{check_cart_not_empty}
|
|
||||||
{/block}
|
|
||||||
|
|
||||||
{* Body Class *}
|
|
||||||
{block name="body-class"}page-order-delivery{/block}
|
|
||||||
|
|
||||||
{* Breadcrumb *}
|
|
||||||
{block name='no-return-functions' append}
|
|
||||||
{$breadcrumbs = [
|
|
||||||
['title' => {intl l="Cart"}, 'url'=>{url path="/cart"}],
|
|
||||||
['title' => {intl l="Billing and delivery"}, 'url'=>{url path="/order/delivery"}]
|
|
||||||
]}
|
|
||||||
{/block}
|
|
||||||
|
|
||||||
|
|
||||||
{block name="main-content"}
|
|
||||||
|
|
||||||
<div class="main">
|
|
||||||
<article id="cart" class="col-main" role="main" aria-labelledby="main-label">
|
|
||||||
|
|
||||||
<h1 id="main-label" class="page-header">{intl l="Your Cart"}</h1>
|
|
||||||
|
|
||||||
{include file="misc/checkout-progress.tpl" step="delivery"}
|
|
||||||
|
|
||||||
{form name="thelia.order.delivery"}
|
|
||||||
{assign var="isPost" value="{$smarty.post|count}"}
|
|
||||||
<form id="form-cart-delivery" action="{url path="/order/delivery"}" method="post" {form_enctype form=$form}>
|
|
||||||
|
|
||||||
{form_hidden_fields form=$form}
|
|
||||||
|
|
||||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
|
||||||
|
|
||||||
{form_field form=$form field='delivery-address'}
|
|
||||||
|
|
||||||
<div id="delivery-address" class="panel">
|
|
||||||
<div class="panel-heading clearfix">
|
|
||||||
<a href="{url path="/address/create"}" class="btn btn-add-address">{intl l="Add a new address"}</a>
|
|
||||||
{intl l="Choose your delivery address"}
|
|
||||||
{if $error}
|
|
||||||
<span class="help-block"><span class="icon-remove"></span> {$message}</span>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
<table class="table table-address" role="presentation" summary="Address Books">
|
|
||||||
<tbody>
|
|
||||||
{loop type="address" name="customer.addresses" customer="current"}
|
|
||||||
{assign var="isDeliveryAddressChecked" value="0"}
|
|
||||||
{if $isPost}
|
|
||||||
{if $value == $ID}
|
|
||||||
{assign var="isDeliveryAddressChecked" value="1"}
|
|
||||||
{/if}
|
|
||||||
{elseif $DEFAULT}
|
|
||||||
{assign var="isDeliveryAddressChecked" value="1"}
|
|
||||||
{/if}
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
<div class="radio">
|
|
||||||
<label for="delivery-address_{$ID}">
|
|
||||||
<input type="radio" class="js-change-delivery-address" data-country="{$COUNTRY}" name="{$name}" value="{$ID}"{if $isDeliveryAddressChecked} checked="checked"{/if} id="delivery-address_{$ID}">
|
|
||||||
{$LABEL|default:"{intl l='Address %nb' nb={$LOOP_COUNT}}"}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</th>
|
|
||||||
<td>
|
|
||||||
<ul class="list-address">
|
|
||||||
<li>
|
|
||||||
<span class="fn">{loop type="title" name="customer.title.info" id=$TITLE}{$SHORT}{/loop} {$LASTNAME|upper} {$FIRSTNAME|ucwords}</span>
|
|
||||||
<span class="org">{$COMPANY}</span>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<address class="adr">
|
|
||||||
<span class="street-address">{$ADDRESS1}</span>
|
|
||||||
{if $ADDRESS2 != ""}
|
|
||||||
<br><span class="street-address">{$ADDRESS2}</span>
|
|
||||||
{/if}
|
|
||||||
{if $ADDRESS3 != ""}
|
|
||||||
<br><span class="street-address">{$ADDRESS3}</span>
|
|
||||||
{/if}
|
|
||||||
<br><span class="postal-code">{$ZIPCODE}</span>
|
|
||||||
<span class="locality">{$CITY}, <span class="country-name">{loop type="country" name="customer.country.info" id=$COUNTRY}{$TITLE}{/loop}</span></span>
|
|
||||||
</address>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
{if $CELLPHONE != ""}
|
|
||||||
<span class="tel">{$CELLPHONE}</span>
|
|
||||||
{/if}
|
|
||||||
{if $PHONE != ""}
|
|
||||||
<br><span class="tel">{$PHONE}</span>
|
|
||||||
{/if}
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="group-btn">
|
|
||||||
<a href="{url path="/address/update/{$ID}"}" class="btn btn-edit-address" data-toggle="tooltip" title="{intl l="Edit this address"}"><i class="icon-pencil"></i> <span>{intl l="Edit"}</span></a>
|
|
||||||
{if $DEFAULT != 1}
|
|
||||||
<a href="{url path="/address/delete/{$ID}"}" class="btn btn-remove-address" data-confirm="{intl l="Do you really want to delete this address ?"}" data-confirm-callback="address.delete" title="{intl l="Remove this address"}" data-toggle="tooltip"><i class="icon-remove"></i> <span>{intl l="Cancel"}</span></a>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{/loop}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field='delivery-module'}
|
|
||||||
|
|
||||||
<div id="delivery-method" class="panel">
|
|
||||||
<div class="panel-heading">
|
|
||||||
{intl l="Choose your delivery method"}
|
|
||||||
{if $error}
|
|
||||||
<span class="help-block"><span class="icon-remove"></span> {$message}</span>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
<div class="panel-body" id="delivery-module-list-block"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
<a href="{url path="/cart"}" role="button" class="btn btn-back"><span>{intl l="Back"}</span></a>
|
|
||||||
<button type="submit" class="btn btn-checkout-next"><span>{intl l="Next Step"}</span></button>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
{/form}
|
|
||||||
|
|
||||||
</article>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
{/block}
|
|
||||||
|
|
||||||
{block name="javascript-initialization"}
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
jQuery(function($) {
|
|
||||||
$('#delivery-module-list-block').load('{url path="/order/deliveryModuleList"}');
|
|
||||||
|
|
||||||
$('.js-change-delivery-address').change(function(e) {
|
|
||||||
$('#delivery-module-list-block').load(
|
|
||||||
'{url path="/order/deliveryModuleList"}',
|
|
||||||
{literal}
|
|
||||||
{country_id: $(this).data('country')}
|
|
||||||
{/literal}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{/block}
|
|
||||||
@@ -1,327 +0,0 @@
|
|||||||
{extends file="layout.tpl"}
|
|
||||||
|
|
||||||
{* Security *}
|
|
||||||
{block name="no-return-functions" prepend}
|
|
||||||
{check_auth context="front" role="CUSTOMER" login_tpl="login"}
|
|
||||||
{check_cart_not_empty}
|
|
||||||
{check_valid_delivery}
|
|
||||||
{/block}
|
|
||||||
|
|
||||||
{* Body Class *}
|
|
||||||
{block name="body-class"}page-order-invoice{/block}
|
|
||||||
|
|
||||||
{* Breadcrumb *}
|
|
||||||
{block name='no-return-functions' append}
|
|
||||||
{$breadcrumbs = [
|
|
||||||
['title' => {intl l="Cart"}, 'url'=>{url path="/cart"}],
|
|
||||||
['title' => {intl l="My order"}, 'url'=>{url path="/order/invoice"}]
|
|
||||||
]}
|
|
||||||
{/block}
|
|
||||||
|
|
||||||
|
|
||||||
{block name="main-content"}
|
|
||||||
<div class="main">
|
|
||||||
<article class="col-main" role="main" aria-labelledby="main-label">
|
|
||||||
|
|
||||||
<h1 id="main-label" class="page-header">{intl l="Your Cart"}</h1>
|
|
||||||
|
|
||||||
{include file="misc/checkout-progress.tpl" step="invoice"}
|
|
||||||
|
|
||||||
{form name="thelia.order.coupon"}
|
|
||||||
|
|
||||||
<form id="form-coupon" action="{url path="/order/coupon"}" method="post" {form_enctype form=$form}>
|
|
||||||
|
|
||||||
{form_hidden_fields form=$form}
|
|
||||||
|
|
||||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
|
||||||
|
|
||||||
<table class="table table-cart">
|
|
||||||
<colgroup>
|
|
||||||
<col width="150">
|
|
||||||
<col>
|
|
||||||
<col width="200">
|
|
||||||
<col width="250">
|
|
||||||
</colgroup>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th class="image"> </th>
|
|
||||||
<th class="product">
|
|
||||||
<span class="hidden-xs">{intl l="Product Name"}</span>
|
|
||||||
<span class="visible-xs">{intl l="Name"}</span>
|
|
||||||
</th>
|
|
||||||
<th class="unitprice">
|
|
||||||
<span class="hidden-xs">{intl l="Unit Price"}</span>
|
|
||||||
<span class="visible-xs">{intl l="Price"}</span>
|
|
||||||
</th>
|
|
||||||
<th class="qty">
|
|
||||||
<span class="hidden-xs">{intl l="Quantity"}</span>
|
|
||||||
<span class="visible-xs">{intl l="Qty"}</span>
|
|
||||||
</th>
|
|
||||||
<th class="subprice">
|
|
||||||
<span class="hidden-xs">{intl l="Total"}</span>
|
|
||||||
<span class="visible-xs">{intl l="Total"}</span>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
|
|
||||||
{loop type="cart" name="cartloop"}
|
|
||||||
<tr>
|
|
||||||
<td class="image">
|
|
||||||
|
|
||||||
{assign "cart_count" $LOOP_COUNT}
|
|
||||||
{ifloop rel='product-image'}
|
|
||||||
{loop type="image" name="product-image" product=$PRODUCT_ID limit="1" width="118" height="85" force_return="true"}
|
|
||||||
<img src="{$IMAGE_URL}" alt="Product #{$cart_count}">
|
|
||||||
{/loop}
|
|
||||||
{/ifloop}
|
|
||||||
{elseloop rel="product-image"}
|
|
||||||
{images file='assets/img/product/1/118x85.png'}<img itemprop="image" src="{$asset_url}" alt="Product #{$cart_count}">{/images}
|
|
||||||
{/elseloop}
|
|
||||||
</td>
|
|
||||||
<td class="product" >
|
|
||||||
<h3 class="name">
|
|
||||||
{$TITLE}
|
|
||||||
</h3>
|
|
||||||
<div class="product-options">
|
|
||||||
<dl class="dl-horizontal">
|
|
||||||
<dt>{intl l="Available"} :</dt>
|
|
||||||
{if $STOCK > 0}
|
|
||||||
<dd>{intl l="In Stock"}</dd>
|
|
||||||
{else}
|
|
||||||
<dd>{intl l="Out of Stock"}</dd>
|
|
||||||
{/if}
|
|
||||||
<dt>{intl l="No."}</dt>
|
|
||||||
<dd>{$REF}</dd>
|
|
||||||
{loop type="attribute_combination" name="product_options" product_sale_elements="$PRODUCT_SALE_ELEMENTS_ID"}
|
|
||||||
<dt>{$ATTRIBUTE_TITLE}</dt>
|
|
||||||
<dd>{$ATTRIBUTE_AVAILABILITY_TITLE}</dd>
|
|
||||||
{/loop}
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td class="unitprice">
|
|
||||||
{if $IS_PROMO == 1}
|
|
||||||
{assign "real_price" $PROMO_TAXED_PRICE}
|
|
||||||
<div class="special-price"><span class="price">{$PROMO_TAXED_PRICE} {currency attr="symbol"}</span></div>
|
|
||||||
<small class="old-price">{intl l="instead of"} <span class="price">{$TAXED_PRICE} {currency attr="symbol"}</span></small>
|
|
||||||
{else}
|
|
||||||
{assign "real_price" $TAXED_PRICE}
|
|
||||||
<div class="special-price"><span class="price">{$TAXED_PRICE} {currency attr="symbol"} </span></div>
|
|
||||||
{/if}
|
|
||||||
</td>
|
|
||||||
<td class="qty">
|
|
||||||
<span class="price">{$QUANTITY}</span>
|
|
||||||
</td>
|
|
||||||
<td class="subprice">
|
|
||||||
<span class="price">{$real_price * $QUANTITY} {currency attr="symbol"}</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
{/loop}
|
|
||||||
|
|
||||||
</tbody>
|
|
||||||
<tfoot>
|
|
||||||
|
|
||||||
<tr >
|
|
||||||
<td rowspan="4" colspan="3" class="empty"> </td>
|
|
||||||
<th class="shipping">{intl l="Discount"}</th>
|
|
||||||
<td class="shipping">
|
|
||||||
<div class="shipping-price">
|
|
||||||
<span class="price">{order attr="discount"} {currency attr="symbol"}</span>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr >
|
|
||||||
<th class="shipping">{intl l="Shipping Tax"}</th>
|
|
||||||
<td class="shipping">
|
|
||||||
<div class="shipping-price">
|
|
||||||
<span class="price">{order attr="postage"} {currency attr="symbol"}</span>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr >
|
|
||||||
<th class="coupon"><label for="coupon">{intl l="You may have a coupon ?"}</label></th>
|
|
||||||
<td class="coupon">
|
|
||||||
{form_field form=$form field='success_url'}
|
|
||||||
<input type="hidden" name="{$name}" value="{url path="/order/invoice"}" />
|
|
||||||
{/form_field}
|
|
||||||
{form_field form=$form field='coupon-code'}
|
|
||||||
<div class="{if $error}has-error{/if}">
|
|
||||||
<div class="input-group">
|
|
||||||
<label class="control-label sr-only" for="code">{intl l='Code :'}</label>
|
|
||||||
<input id="coupon" class="form-control" type="text" name="{$name}" value="{$value}" placeholder="{intl l='Coupon code'}">
|
|
||||||
<span class="input-group-btn">
|
|
||||||
<button type="submit" class="btn btn-coupon">{intl l="Ok"}</button>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
{if $error}<span class="help-block">{$message}</span>{/if}
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
<!-- /input-group -->
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr >
|
|
||||||
<th class="total">{intl l="Total"}</th>
|
|
||||||
<td class="total">
|
|
||||||
<div class="total-price">
|
|
||||||
<span class="price">{{cart attr="total_taxed_price"} + {order attr="postage"}} {currency attr="symbol"}</span>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tfoot>
|
|
||||||
</table>
|
|
||||||
</form>
|
|
||||||
{/form}
|
|
||||||
{form name="thelia.order.payment"}
|
|
||||||
{assign var="isPost" value="{$smarty.post|count}"}
|
|
||||||
<form id="form-cart-payment" action="{url path="/order/invoice"}" method="post" {form_enctype form=$form}>
|
|
||||||
|
|
||||||
{form_hidden_fields form=$form}
|
|
||||||
|
|
||||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
|
||||||
<div id="cart-address">
|
|
||||||
<div class="panel">
|
|
||||||
{loop type="address.ici" name="delivery-address" id={order attr="delivery_address"}}
|
|
||||||
<div class="panel-heading">{intl l="Delivery address"}</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
<span class="fn">{loop type="title" name="customer.title.info" id=$TITLE}{$SHORT}{/loop} {$LASTNAME|upper} {$FIRSTNAME|ucwords}</span>
|
|
||||||
<div id="replace_icirelais">
|
|
||||||
<span class="org">{$COMPANY}</span>
|
|
||||||
<address class="adr">
|
|
||||||
<span class="street-address">{$ADDRESS1}</span><br>
|
|
||||||
{if $ADDRESS2 != ""}
|
|
||||||
<span class="street-address">{$ADDRESS2}</span><br>
|
|
||||||
{/if}
|
|
||||||
{if $ADDRESS3 != ""}
|
|
||||||
<span class="street-address">{$ADDRESS3}</span><br>
|
|
||||||
{/if}
|
|
||||||
<span class="postal-code">{$ZIPCODE}</span>
|
|
||||||
<span class="locality">{$CITY}, <span class="country-name">{loop type="country" name="customer.country.info" id=$COUNTRY}{$TITLE}{/loop}</span></span>
|
|
||||||
</address>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/loop}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{form_field form=$form field='invoice-address'}
|
|
||||||
<div class="panel">
|
|
||||||
<div class="panel-heading">{intl l="Billing address"}s</div>
|
|
||||||
|
|
||||||
{if $error}
|
|
||||||
<span class="help-block"><span class="icon-remove"></span> {$message}</span>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<div class="panel-body">
|
|
||||||
|
|
||||||
{loop type="address" name="invoice-address"}
|
|
||||||
{assign var="isInvoiceAddressChecked" value="0"}
|
|
||||||
{if $isPost}
|
|
||||||
{if $value == $ID}
|
|
||||||
{assign var="isInvoiceAddressChecked" value="1"}
|
|
||||||
{/if}
|
|
||||||
{elseif $DEFAULT}
|
|
||||||
{assign var="isInvoiceAddressChecked" value="1"}
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<div class="radio">
|
|
||||||
<label for="invoice-address_{$ID}">
|
|
||||||
<input type="radio" name="{$name}" id="invoice-address_{$ID}" value="{$ID}"{if $isInvoiceAddressChecked} checked="checked"{/if}>
|
|
||||||
<span class="fn">{loop type="title" name="customer.title.info" id=$TITLE}{$SHORT}{/loop} {$LASTNAME|upper} {$FIRSTNAME|ucwords}</span>
|
|
||||||
<span class="org">{$COMPANY}</span>
|
|
||||||
<address class="adr">
|
|
||||||
<span class="street-address">{$ADDRESS1}</span><br>
|
|
||||||
{if $ADDRESS2 != ""}
|
|
||||||
<span class="street-address">{$ADDRESS2}</span><br>
|
|
||||||
{/if}
|
|
||||||
{if $ADDRESS3 != ""}
|
|
||||||
<span class="street-address">{$ADDRESS3}</span><br>
|
|
||||||
{/if}
|
|
||||||
<span class="postal-code">{$ZIPCODE}</span>
|
|
||||||
<span class="locality">{$CITY}, <span class="country-name">{loop type="country" name="customer.country.info" id=$COUNTRY}{$TITLE}{/loop}</span></span>
|
|
||||||
</address>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
{/loop}
|
|
||||||
|
|
||||||
<a href="#" class="btn btn-change-address hidden">{intl l="Change address"}</a>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{form_field form=$form field='payment-module'}
|
|
||||||
|
|
||||||
<div id="payment-method" class="panel">
|
|
||||||
<div class="panel-heading">{intl l="Choose your payment method"}</div>
|
|
||||||
|
|
||||||
{if $error}
|
|
||||||
<span class="help-block"><span class="icon-remove"></span> {$message}</span>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<div class="panel-body">
|
|
||||||
<ul class="list-payment">
|
|
||||||
|
|
||||||
{loop type="payment" name="payments" force_return="true"}
|
|
||||||
|
|
||||||
{assign "paymentModuleId" $ID}
|
|
||||||
|
|
||||||
{loop type="image" name="paymentspicture" source="module" source_id=$ID force_return="true" width="100" height="72"}
|
|
||||||
|
|
||||||
<li>
|
|
||||||
<div class="radio">
|
|
||||||
<label for="payment_{$paymentModuleId}_{$ID}">
|
|
||||||
<input type="radio" name="{$name}" id="payment_{$paymentModuleId}_{$ID}" value="{$paymentModuleId}">
|
|
||||||
<img src="{$IMAGE_URL}">
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
{/loop}
|
|
||||||
|
|
||||||
{/loop}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
<a href="{url path="/order/delivery"}" role="button" class="btn btn-back"><span>{intl l="Back"}</span></a>
|
|
||||||
<button type="submit" class="btn btn-checkout-next"><span>{intl l="Next Step"}</span></button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
{/form}
|
|
||||||
|
|
||||||
|
|
||||||
</article>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
{/block}
|
|
||||||
|
|
||||||
{block name="javascript-initialization"}
|
|
||||||
<script type="text/javascript">
|
|
||||||
jQuery(function($) {
|
|
||||||
$('#cart-address').each(function(){
|
|
||||||
var $radio = $('.radio', this),
|
|
||||||
$btn = $('.btn-change-address');
|
|
||||||
|
|
||||||
// Hide other invoice address
|
|
||||||
$radio.filter( function(){ return !$(this).find(':radio').is(':checked'); }).hide();
|
|
||||||
$btn
|
|
||||||
.removeClass('hidden')
|
|
||||||
.bind('click.btn-change-address', function(){
|
|
||||||
$radio.show();
|
|
||||||
$(this).hide();
|
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{/block}
|
|
||||||
@@ -78,7 +78,7 @@ class LocalPickup extends AbstractDeliveryModule
|
|||||||
$myPostalCode = $deliveryAddress->getZipcode();
|
$myPostalCode = $deliveryAddress->getZipcode();
|
||||||
|
|
||||||
// On recherche si le CP de l'adresse de livraison est dans la table 'boutique_cp_retrait_sur_place', pour savoir si le retrait sur place est possible.
|
// On recherche si le CP de l'adresse de livraison est dans la table 'boutique_cp_retrait_sur_place', pour savoir si le retrait sur place est possible.
|
||||||
$postalCodes = explode(';', ConfigQuery::read('boutique_cp_autorises_retrait_sur_place', []));
|
$postalCodes = explode(';', ConfigQuery::read('thecoredev_cp_autorises_retrait_sur_place', []));
|
||||||
if (null !== $postalCodes) {
|
if (null !== $postalCodes) {
|
||||||
foreach($postalCodes as $currentPostalCode) {
|
foreach($postalCodes as $currentPostalCode) {
|
||||||
if ($myPostalCode === $currentPostalCode) {
|
if ($myPostalCode === $currentPostalCode) {
|
||||||
|
|||||||
13
local/modules/PrixDegressifs/Config/config.xml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?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">
|
||||||
|
|
||||||
|
<hooks>
|
||||||
|
<hook id="prixdegressifs.hook" class="PrixDegressifs\Hook\FrontHook">
|
||||||
|
<tag name="hook.event_listener" event="product.details-bottom" type="front" method="onProductDetailsBottom" />
|
||||||
|
</hook>
|
||||||
|
</hooks>
|
||||||
|
|
||||||
|
</config>
|
||||||
@@ -2,24 +2,22 @@
|
|||||||
<module xmlns="http://thelia.net/schema/dic/module"
|
<module xmlns="http://thelia.net/schema/dic/module"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
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">
|
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_2.xsd">
|
||||||
<fullnamespace>BetterPassword\BetterPassword</fullnamespace>
|
<fullnamespace>PrixDegressifs\PrixDegressifs</fullnamespace>
|
||||||
<descriptive locale="en_US">
|
<descriptive locale="en_US">
|
||||||
<title>Require your customers to use secure password</title>
|
<title>Diggressive price for a same product (same size)</title>
|
||||||
</descriptive>
|
</descriptive>
|
||||||
<descriptive locale="fr_FR">
|
<descriptive locale="fr_FR">
|
||||||
<title>Imposer des mots de passe sécurisés à vos clients</title>
|
<title>Applique des prix dégressifs en fonction de la quantité d'un même produit</title>
|
||||||
</descriptive>
|
</descriptive>
|
||||||
<languages>
|
<languages>
|
||||||
<language>en_US</language>
|
<language>en_US</language>
|
||||||
<language>fr_FR</language>
|
<language>fr_FR</language>
|
||||||
</languages>
|
</languages>
|
||||||
<version>1.0.0</version>
|
<version>1.0</version>
|
||||||
<authors>
|
<authors>
|
||||||
<author>
|
<author>
|
||||||
<name>Franck Allimant</name>
|
<name>Laurent LE CORRE</name>
|
||||||
<company>CQFDev</company>
|
<email>laurent@thecoredev.fr</email>
|
||||||
<email>thelia@cqfdev.fr</email>
|
|
||||||
<website>www.cqfdev.fr</website>
|
|
||||||
</author>
|
</author>
|
||||||
</authors>
|
</authors>
|
||||||
<type>classic</type>
|
<type>classic</type>
|
||||||
27
local/modules/PrixDegressifs/Hook/FrontHook.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace PrixDegressifs\Hook;
|
||||||
|
|
||||||
|
use Thelia\Core\Event\Hook\HookRenderBlockEvent;
|
||||||
|
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||||
|
use Thelia\Core\Hook\BaseHook;
|
||||||
|
use Thelia\Tools\URL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class FrontHook
|
||||||
|
* @package PrixDegressifs\Hook
|
||||||
|
* @author Laurent LE CORRE <laurent@thecoredev.fr>
|
||||||
|
*/
|
||||||
|
class FrontHook extends BaseHook
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param HookRenderBlockEvent $event
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function onProductDetailsBottom(HookRenderEvent $event)
|
||||||
|
{
|
||||||
|
$content = $this->render("gestion-stock.html");
|
||||||
|
|
||||||
|
$event->add($content);
|
||||||
|
}
|
||||||
|
}
|
||||||
4
local/modules/PrixDegressifs/I18n/en_US.php
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?php
|
||||||
|
return array(
|
||||||
|
// 'an english string' => 'The displayed english string',
|
||||||
|
);
|
||||||
5
local/modules/PrixDegressifs/I18n/fr_FR.php
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
return array(
|
||||||
|
// 'an english string' => 'La traduction française de la chaine',
|
||||||
|
'Limited stock' => 'Attention, stock limité !'
|
||||||
|
);
|
||||||
@@ -10,16 +10,16 @@
|
|||||||
/* file that was distributed with this source code. */
|
/* file that was distributed with this source code. */
|
||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
|
|
||||||
namespace BetterPassword;
|
namespace PrixDegressifs;
|
||||||
|
|
||||||
|
use Thelia\Model\ConfigQuery;
|
||||||
use Thelia\Module\BaseModule;
|
use Thelia\Module\BaseModule;
|
||||||
|
|
||||||
class BetterPassword extends BaseModule
|
class PrixDegressifs extends BaseModule
|
||||||
{
|
{
|
||||||
/** @var string */
|
/**
|
||||||
const DOMAIN_NAME = 'betterpassword';
|
* @return integer
|
||||||
|
*/
|
||||||
|
const DOMAIN_NAME = 'prixdegressifs';
|
||||||
|
|
||||||
const VAR_REGULAR_EXPRESSION = "password_expression";
|
|
||||||
|
|
||||||
const VAR_PASSWORD_REQUIREMENTS = "password_requirements";
|
|
||||||
}
|
}
|
||||||
55
local/modules/PrixDegressifs/Readme.md
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
# Prix Degressifs
|
||||||
|
|
||||||
|
Add a short description here. You can also add a screenshot if needed.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### Manually
|
||||||
|
|
||||||
|
* Copy the module into ```<thelia_root>/local/modules/``` directory and be sure that the name of the module is PrixDegressifs.
|
||||||
|
* Activate it in your thelia administration panel
|
||||||
|
|
||||||
|
### Composer
|
||||||
|
|
||||||
|
Add it in your main thelia composer.json file
|
||||||
|
|
||||||
|
```
|
||||||
|
composer require your-vendor/prix-degressifs-module:~1.0
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Explain here how to use your module, how to configure it, etc.
|
||||||
|
|
||||||
|
## Hook
|
||||||
|
|
||||||
|
If your module use one or more hook, fill this part. Explain which hooks are used.
|
||||||
|
|
||||||
|
|
||||||
|
## Loop
|
||||||
|
|
||||||
|
If your module declare one or more loop, describe them here like this :
|
||||||
|
|
||||||
|
[loop name]
|
||||||
|
|
||||||
|
### Input arguments
|
||||||
|
|
||||||
|
|Argument |Description |
|
||||||
|
|--- |--- |
|
||||||
|
|**arg1** | describe arg1 with an exemple. |
|
||||||
|
|**arg2** | describe arg2 with an exemple. |
|
||||||
|
|
||||||
|
### Output arguments
|
||||||
|
|
||||||
|
|Variable |Description |
|
||||||
|
|--- |--- |
|
||||||
|
|$VAR1 | describe $VAR1 variable |
|
||||||
|
|$VAR2 | describe $VAR2 variable |
|
||||||
|
|
||||||
|
### Exemple
|
||||||
|
|
||||||
|
Add a complete exemple of your loop
|
||||||
|
|
||||||
|
## Other ?
|
||||||
|
|
||||||
|
If you have other think to put, feel free to complete your readme as you want.
|
||||||
11
local/modules/PrixDegressifs/composer.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "your-vendor/prix-degressifs-module",
|
||||||
|
"license": "LGPL-3.0+",
|
||||||
|
"type": "thelia-module",
|
||||||
|
"require": {
|
||||||
|
"thelia/installer": "~1.1"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"installer-name": "PrixDegressifs"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<div>
|
||||||
|
Nos prix sont dégressifs : ...
|
||||||
|
</div>
|
||||||
31
local/modules/StockAlert/Config/config.xml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
||||||
|
<config xmlns="http://thelia.net/schema/dic/config"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||||
|
|
||||||
|
<forms>
|
||||||
|
<form name="stockalert.subscribe.form" class="StockAlert\Form\StockAlertSubscribe" />
|
||||||
|
<form name= "stockalert.configuration.form" class="StockAlert\Form\StockAlertConfig" />
|
||||||
|
</forms>
|
||||||
|
|
||||||
|
<loops>
|
||||||
|
<loop name="restocking-alert" class="StockAlert\Loop\RestockingAlertLoop" />
|
||||||
|
</loops>
|
||||||
|
|
||||||
|
<services>
|
||||||
|
<service id="stockalert.alert.manager" class="StockAlert\EventListeners\StockAlertManager" scope="request">
|
||||||
|
<argument type="service" id="mailer"/>
|
||||||
|
<tag name="kernel.event_subscriber"/>
|
||||||
|
</service>
|
||||||
|
</services>
|
||||||
|
|
||||||
|
<hooks>
|
||||||
|
<hook id="stockalert.hook" class="StockAlert\Hook\StockAlertHook" scope="request">
|
||||||
|
<tag name="hook.event_listener" event="product.stock-alert" type="front" method="onProductDetailsBottom" />
|
||||||
|
<tag name="hook.event_listener" event="product.details-bottom" type="front" method="onProductDetailsBottom" />
|
||||||
|
<tag name="hook.event_listener" event="product.javascript-initialization" type="front" />
|
||||||
|
<tag name="hook.event_listener" event="module.configuration" type="back" />
|
||||||
|
</hook>
|
||||||
|
</hooks>
|
||||||
|
</config>
|
||||||
2
local/modules/StockAlert/Config/destroy.sql
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
DROP TABLE IF EXISTS `restocking_alert`;
|
||||||
|
|
||||||
24
local/modules/StockAlert/Config/module.xml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module xmlns="http://thelia.net/schema/dic/module"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_1.xsd">
|
||||||
|
<fullnamespace>StockAlert\StockAlert</fullnamespace>
|
||||||
|
<descriptive locale="en_US">
|
||||||
|
<title>Stock Alerts</title>
|
||||||
|
</descriptive>
|
||||||
|
<descriptive locale="fr_FR">
|
||||||
|
<title>Alertes Stock</title>
|
||||||
|
</descriptive>
|
||||||
|
<languages>
|
||||||
|
<language>en_US</language>
|
||||||
|
<language>fr_FR</language>
|
||||||
|
</languages>
|
||||||
|
<version>1.2</version>
|
||||||
|
<author>
|
||||||
|
<name>Julien Chanséaume</name>
|
||||||
|
<email>julien@thelia.net</email>
|
||||||
|
</author>
|
||||||
|
<type>classic</type>
|
||||||
|
<thelia>2.1.0</thelia>
|
||||||
|
<stability>rc</stability>
|
||||||
|
</module>
|
||||||
15
local/modules/StockAlert/Config/routing.xml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?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="stockalert.front.subscribe" path="/module/stockalert/subscribe" methods="post">
|
||||||
|
<default key="_controller">StockAlert\Controller\StockAlertFrontOfficeController::subscribe</default>
|
||||||
|
</route>
|
||||||
|
|
||||||
|
<route id="stockalert.back.subscribe" path="/admin/module/stockalert/configuration" methods="post">
|
||||||
|
<default key="_controller">StockAlert\Controller\StockAlertBackOfficeController::configuration</default>
|
||||||
|
</route>
|
||||||
|
|
||||||
|
</routes>
|
||||||
22
local/modules/StockAlert/Config/schema.xml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<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="restocking_alert" namespace="StockAlert\Model">
|
||||||
|
|
||||||
|
<column name="id" primaryKey="true" autoIncrement="true" required="true" type="INTEGER" />
|
||||||
|
<column name="product_sale_elements_id" required="true" type="INTEGER" />
|
||||||
|
<column name="email" size="255" type="VARCHAR" />
|
||||||
|
<column name="locale" size="45" type="VARCHAR" />
|
||||||
|
|
||||||
|
<foreign-key foreignTable="product_sale_elements" name="fk_restocking_alert_product_sale_elements_id" onDelete="CASCADE" >
|
||||||
|
<reference foreign="id" local="product_sale_elements_id" />
|
||||||
|
</foreign-key>
|
||||||
|
|
||||||
|
<behavior name="timestampable" />
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<external-schema filename="local/config/schema.xml" referenceOnly="true" />
|
||||||
|
|
||||||
|
</database>
|
||||||
29
local/modules/StockAlert/Config/thelia.sql
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
# 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;
|
||||||
|
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
-- restocking_alert
|
||||||
|
-- ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `restocking_alert`;
|
||||||
|
|
||||||
|
CREATE TABLE `restocking_alert`
|
||||||
|
(
|
||||||
|
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||||
|
`product_sale_elements_id` INTEGER NOT NULL,
|
||||||
|
`email` VARCHAR(255),
|
||||||
|
`locale` VARCHAR(45),
|
||||||
|
`created_at` DATETIME,
|
||||||
|
`updated_at` DATETIME,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
INDEX `FI_restocking_alert_product_sale_elements_id` (`product_sale_elements_id`),
|
||||||
|
CONSTRAINT `fk_restocking_alert_product_sale_elements_id`
|
||||||
|
FOREIGN KEY (`product_sale_elements_id`)
|
||||||
|
REFERENCES `product_sale_elements` (`id`)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
# This restores the fkey checks, after having unset them earlier
|
||||||
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
<?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 StockAlert\Controller;
|
||||||
|
|
||||||
|
|
||||||
|
use StockAlert\StockAlert;
|
||||||
|
use Thelia\Controller\Admin\BaseAdminController;
|
||||||
|
use Thelia\Form\Exception\FormValidationException;
|
||||||
|
use Thelia\Model\ConfigQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class StockAlertBackOfficeController
|
||||||
|
* @package StockAlert\Controller
|
||||||
|
* @author Baixas Alban <abaixas@openstudio.fr>
|
||||||
|
* @author Julien Chanséaume <julien@thelia.net>
|
||||||
|
*/
|
||||||
|
class StockAlertBackOfficeController extends BaseAdminController
|
||||||
|
{
|
||||||
|
|
||||||
|
public function configuration()
|
||||||
|
{
|
||||||
|
$errorMessage = null;
|
||||||
|
|
||||||
|
$form = $this->createForm('stockalert.configuration.form', 'form');
|
||||||
|
|
||||||
|
try {
|
||||||
|
$configForm = $this->validateForm($form)->getData();
|
||||||
|
|
||||||
|
ConfigQuery::write(StockAlert::CONFIG_ENABLED, $configForm['enabled']);
|
||||||
|
ConfigQuery::write(StockAlert::CONFIG_THRESHOLD, $configForm['threshold']);
|
||||||
|
$emails = str_replace(' ', '', $configForm['emails']);
|
||||||
|
ConfigQuery::write(StockAlert::CONFIG_EMAILS, $emails);
|
||||||
|
|
||||||
|
return $this->generateSuccessRedirect($form);
|
||||||
|
} catch (FormValidationException $e) {
|
||||||
|
$errorMessage = $e->getMessage();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$errorMessage = $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
$form->setErrorMessage($errorMessage);
|
||||||
|
|
||||||
|
$this->getParserContext()
|
||||||
|
->addForm($form)
|
||||||
|
->setGeneralError($errorMessage);
|
||||||
|
|
||||||
|
return $this->render(
|
||||||
|
"module-configure",
|
||||||
|
[
|
||||||
|
"module_code" => StockAlert::getModuleCode()
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
<?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 StockAlert\Controller;
|
||||||
|
|
||||||
|
use StockAlert\Event\StockAlertEvent;
|
||||||
|
use StockAlert\Event\StockAlertEvents;
|
||||||
|
use StockAlert\StockAlert;
|
||||||
|
use Thelia\Controller\Front\BaseFrontController;
|
||||||
|
use Thelia\Form\Exception\FormValidationException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class RestockingAlertFrontOfficeController
|
||||||
|
* @package StockAlert\Controller
|
||||||
|
* @author Baixas Alban <abaixas@openstudio.fr>
|
||||||
|
* @author Julien Chanséaume <julien@thelia.net>
|
||||||
|
*/
|
||||||
|
class StockAlertFrontOfficeController extends BaseFrontController
|
||||||
|
{
|
||||||
|
|
||||||
|
public function subscribe()
|
||||||
|
{
|
||||||
|
$errorMessage = null;
|
||||||
|
|
||||||
|
$form = $this->createForm('stockalert.subscribe.form', 'form');
|
||||||
|
|
||||||
|
try {
|
||||||
|
$subscribeForm = $this->validateForm($form)->getData();
|
||||||
|
|
||||||
|
$subscriberEvent = new StockAlertEvent(
|
||||||
|
$subscribeForm['product_sale_elements_id'],
|
||||||
|
$subscribeForm['email'],
|
||||||
|
$this->getRequest()->getSession()->getLang()->getLocale()
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->dispatch(StockAlertEvents::STOCK_ALERT_SUBSCRIBE, $subscriberEvent);
|
||||||
|
|
||||||
|
return $this->jsonResponse(
|
||||||
|
json_encode(
|
||||||
|
[
|
||||||
|
"success" => true,
|
||||||
|
"message" => $this->getTranslator()->trans(
|
||||||
|
"Your request has been taken into account",
|
||||||
|
[],
|
||||||
|
StockAlert::MESSAGE_DOMAIN
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} catch (FormValidationException $e) {
|
||||||
|
$errorMessage = $e->getMessage();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$errorMessage = $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->jsonResponse(
|
||||||
|
json_encode(
|
||||||
|
[
|
||||||
|
"success" => false,
|
||||||
|
"message" => $errorMessage
|
||||||
|
]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
/*************************************************************************************/
|
||||||
|
/* This file is part of the Thelia package. */
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) OpenStudio */
|
||||||
|
/* email : dev@thelia.net */
|
||||||
|
/* web : http://www.thelia.net */
|
||||||
|
/* */
|
||||||
|
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||||
|
/* file that was distributed with this source code. */
|
||||||
|
/*************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
namespace StockAlert\Event;
|
||||||
|
|
||||||
|
use Thelia\Core\Event\ProductSaleElement\ProductSaleElementEvent;
|
||||||
|
use Thelia\Model\ProductSaleElements;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ProductSaleElementAvailabilityEvent
|
||||||
|
* @package StockAlert\Event
|
||||||
|
* @author Julien Chanséaume <julien@thelia.net>
|
||||||
|
*/
|
||||||
|
class ProductSaleElementAvailabilityEvent extends ProductSaleElementEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
|
protected $available = true;
|
||||||
|
|
||||||
|
|
||||||
|
public function __construct(ProductSaleElements $product_sale_element = null)
|
||||||
|
{
|
||||||
|
$this->product_sale_element = $product_sale_element;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isAvailable()
|
||||||
|
{
|
||||||
|
return $this->available;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param boolean $available
|
||||||
|
*/
|
||||||
|
public function setAvailable($available)
|
||||||
|
{
|
||||||
|
$this->available = $available;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
121
local/modules/StockAlert/Event/StockAlertEvent.php
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
<?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 StockAlert\Event;
|
||||||
|
|
||||||
|
use StockAlert\Model\Base\RestockingAlert;
|
||||||
|
use Thelia\Core\Event\ActionEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class StockAlertEvent
|
||||||
|
* @package StockAlert\Event
|
||||||
|
* @author Baixas Alban <abaixas@openstudio.fr>
|
||||||
|
* @author Julien Chanséaume <julien@thelia.net>
|
||||||
|
*/
|
||||||
|
class StockAlertEvent extends ActionEvent
|
||||||
|
{
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
|
private $productSaleElementsId;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
private $email;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
private $locale;
|
||||||
|
|
||||||
|
/** @var RestockingAlert */
|
||||||
|
private $restockingAlert;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $productSaleElementsId
|
||||||
|
* @param $email
|
||||||
|
*/
|
||||||
|
public function __construct($productSaleElementsId, $email, $locale)
|
||||||
|
{
|
||||||
|
$this->setEmail($email);
|
||||||
|
$this->setProductSaleElementsId($productSaleElementsId);
|
||||||
|
$this->setLocale($locale);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getEmail()
|
||||||
|
{
|
||||||
|
return $this->email;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $email
|
||||||
|
*/
|
||||||
|
public function setEmail($email)
|
||||||
|
{
|
||||||
|
$this->email = $email;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getProductSaleElementsId()
|
||||||
|
{
|
||||||
|
return $this->productSaleElementsId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $productSaleElementsId
|
||||||
|
*/
|
||||||
|
public function setProductSaleElementsId($productSaleElementsId)
|
||||||
|
{
|
||||||
|
$this->productSaleElementsId = $productSaleElementsId;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return RestockingAlert
|
||||||
|
*/
|
||||||
|
public function getRestockingAlert()
|
||||||
|
{
|
||||||
|
return $this->restockingAlert;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param RestockingAlert $restockingAlert
|
||||||
|
*/
|
||||||
|
public function setRestockingAlert($restockingAlert)
|
||||||
|
{
|
||||||
|
$this->restockingAlert = $restockingAlert;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLocale()
|
||||||
|
{
|
||||||
|
return $this->locale;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $locale
|
||||||
|
*/
|
||||||
|
public function setLocale($locale)
|
||||||
|
{
|
||||||
|
$this->locale = $locale;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
26
local/modules/StockAlert/Event/StockAlertEvents.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?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 StockAlert\Event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class StockAlertEvents
|
||||||
|
* @package RestockingAlert\Event
|
||||||
|
* @author Baixas Alban <abaixas@openstudio.fr>
|
||||||
|
* @author Julien Chanséaume <julien@thelia.net>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class StockAlertEvents
|
||||||
|
{
|
||||||
|
const STOCK_ALERT_SUBSCRIBE = "stockalert.subscribe";
|
||||||
|
const STOCK_ALERT_CHECK_AVAILABILITY = "stockalert.check.availability";
|
||||||
|
}
|
||||||
234
local/modules/StockAlert/EventListeners/StockAlertManager.php
Normal file
@@ -0,0 +1,234 @@
|
|||||||
|
<?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 StockAlert\EventListeners;
|
||||||
|
|
||||||
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
|
use StockAlert\Event\ProductSaleElementAvailabilityEvent;
|
||||||
|
use StockAlert\Event\StockAlertEvent;
|
||||||
|
use StockAlert\Event\StockAlertEvents;
|
||||||
|
use StockAlert\Model\RestockingAlert;
|
||||||
|
use StockAlert\Model\RestockingAlertQuery;
|
||||||
|
use StockAlert\StockAlert;
|
||||||
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
use Thelia\Core\Event\Order\OrderEvent;
|
||||||
|
use Thelia\Core\Event\ProductSaleElement\ProductSaleElementUpdateEvent;
|
||||||
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
|
use Thelia\Core\Translation\Translator;
|
||||||
|
use Thelia\Log\Tlog;
|
||||||
|
use Thelia\Mailer\MailerFactory;
|
||||||
|
use Thelia\Model\ConfigQuery;
|
||||||
|
use Thelia\Model\Lang;
|
||||||
|
use Thelia\Model\ProductQuery;
|
||||||
|
use Thelia\Model\ProductSaleElementsQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class StockAlertManager
|
||||||
|
* @package StockAlert\EventListeners
|
||||||
|
* @author Baixas Alban <abaixas@openstudio.fr>
|
||||||
|
* @author Julien Chanséaume <julien@thelia.net>
|
||||||
|
*/
|
||||||
|
class StockAlertManager implements EventSubscriberInterface
|
||||||
|
{
|
||||||
|
protected $mailer;
|
||||||
|
|
||||||
|
public function __construct(MailerFactory $mailer)
|
||||||
|
{
|
||||||
|
$this->mailer = $mailer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array of event names this subscriber wants to listen to.
|
||||||
|
* @return array The event names to listen to
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
public static function getSubscribedEvents()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
StockAlertEvents::STOCK_ALERT_SUBSCRIBE => ['subscribe', 128],
|
||||||
|
TheliaEvents::PRODUCT_UPDATE_PRODUCT_SALE_ELEMENT => ['checkStock', 120],
|
||||||
|
TheliaEvents::ORDER_UPDATE_STATUS => ['checkStockForAdmin', 128],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function subscribe(StockAlertEvent $event)
|
||||||
|
{
|
||||||
|
$productSaleElementsId = $event->getProductSaleElementsId();
|
||||||
|
$email = $event->getEmail();
|
||||||
|
|
||||||
|
if (!isset($productSaleElementsId)) {
|
||||||
|
throw new \Exception("missing param");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($email)) {
|
||||||
|
throw new \Exception("missing param");
|
||||||
|
}
|
||||||
|
|
||||||
|
// test if it already exists
|
||||||
|
$subscribe = RestockingAlertQuery::create()
|
||||||
|
->filterByEmail($email)
|
||||||
|
->filterByProductSaleElementsId($productSaleElementsId)
|
||||||
|
->findOne();
|
||||||
|
|
||||||
|
if (null === $subscribe) {
|
||||||
|
$subscribe = new RestockingAlert();
|
||||||
|
$subscribe
|
||||||
|
->setProductSaleElementsId($productSaleElementsId)
|
||||||
|
->setEmail($email)
|
||||||
|
->setLocale($event->getLocale())
|
||||||
|
->save();
|
||||||
|
} else {
|
||||||
|
throw new \Exception(
|
||||||
|
Translator::getInstance()->trans(
|
||||||
|
"You have already subscribed to this product",
|
||||||
|
[],
|
||||||
|
StockAlert::MESSAGE_DOMAIN
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$event->setRestockingAlert($subscribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function checkStock(ProductSaleElementUpdateEvent $productSaleElementUpdateEvent)
|
||||||
|
{
|
||||||
|
if ($productSaleElementUpdateEvent->getQuantity() > 0) {
|
||||||
|
// add extra checking
|
||||||
|
$pse = ProductSaleElementsQuery::create()->findPk(
|
||||||
|
$productSaleElementUpdateEvent->getProductSaleElementId()
|
||||||
|
);
|
||||||
|
$availabilityEvent = new ProductSaleElementAvailabilityEvent(
|
||||||
|
$pse
|
||||||
|
);
|
||||||
|
|
||||||
|
$productSaleElementUpdateEvent->getDispatcher()->dispatch(
|
||||||
|
StockAlertEvents::STOCK_ALERT_CHECK_AVAILABILITY,
|
||||||
|
$availabilityEvent
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($availabilityEvent->isAvailable()) {
|
||||||
|
$subscribers = RestockingAlertQuery::create()
|
||||||
|
->filterByProductSaleElementsId($productSaleElementUpdateEvent->getProductSaleElementId())
|
||||||
|
->find();
|
||||||
|
|
||||||
|
if (null !== $subscribers) {
|
||||||
|
foreach ($subscribers as $subscriber) {
|
||||||
|
try {
|
||||||
|
$this->sendEmail($subscriber);
|
||||||
|
$subscriber->delete();
|
||||||
|
} catch (\Exception $ex) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param RestockingAlert $subscriber
|
||||||
|
* @throws \Propel\Runtime\Exception\PropelException
|
||||||
|
*/
|
||||||
|
public function sendEmail(RestockingAlert $subscriber)
|
||||||
|
{
|
||||||
|
$contactEmail = ConfigQuery::read('store_email');
|
||||||
|
|
||||||
|
if ($contactEmail) {
|
||||||
|
$pse = ProductSaleElementsQuery::create()->findPk($subscriber->getProductSaleElementsId());
|
||||||
|
|
||||||
|
$this->mailer->sendEmailMessage(
|
||||||
|
'stockalert_customer',
|
||||||
|
[ $contactEmail => ConfigQuery::read('store_name') ],
|
||||||
|
[ $subscriber->getEmail() => ConfigQuery::read('store_name') ],
|
||||||
|
[
|
||||||
|
'locale' => $subscriber->getLocale(),
|
||||||
|
'pse_id' => $pse->getId(),
|
||||||
|
'product_id' => $pse->getProductId(),
|
||||||
|
'product_title' => $pse->getProduct()->setLocale($subscriber->getLocale())->getTitle()
|
||||||
|
],
|
||||||
|
$subscriber->getLocale()
|
||||||
|
);
|
||||||
|
|
||||||
|
Tlog::getInstance()->debug("Restocking Alert sent to customer " . $subscriber->getEmail());
|
||||||
|
} else {
|
||||||
|
Tlog::getInstance()->debug(
|
||||||
|
"Restocking Alert: no contact email is defined !"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function checkStockForAdmin(OrderEvent $event)
|
||||||
|
{
|
||||||
|
$order = $event->getOrder();
|
||||||
|
|
||||||
|
$config = StockAlert::getConfig();
|
||||||
|
|
||||||
|
$pseIds = [];
|
||||||
|
|
||||||
|
foreach ($order->getOrderProducts() as $orderProduct) {
|
||||||
|
$pseIds[] = $orderProduct->getProductSaleElementsId();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($config['enabled']) {
|
||||||
|
$threshold = $config['threshold'];
|
||||||
|
|
||||||
|
$productIds = ProductQuery::create()
|
||||||
|
->useProductSaleElementsQuery()
|
||||||
|
->filterById($pseIds, Criteria::IN)
|
||||||
|
->filterByQuantity($threshold, Criteria::LESS_EQUAL)
|
||||||
|
// exclude virtual product with weight at 0
|
||||||
|
->filterByWeight(0, Criteria::NOT_EQUAL)
|
||||||
|
->endUse()
|
||||||
|
->select('Id')
|
||||||
|
->find()
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
if (!empty($productIds)) {
|
||||||
|
$this->sendEmailForAdmin($config['emails'], $productIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sendEmailForAdmin($emails, $productIds)
|
||||||
|
{
|
||||||
|
$locale = Lang::getDefaultLanguage()->getLocale();
|
||||||
|
|
||||||
|
$contactEmail = ConfigQuery::read('store_email');
|
||||||
|
|
||||||
|
if ($contactEmail) {
|
||||||
|
$storeName = ConfigQuery::read('store_name');
|
||||||
|
|
||||||
|
$to = [];
|
||||||
|
|
||||||
|
foreach ($emails as $recipient) {
|
||||||
|
$to[$recipient] = $storeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->mailer->sendEmailMessage(
|
||||||
|
'stockalert_administrator',
|
||||||
|
[ $contactEmail => $storeName ],
|
||||||
|
$to,
|
||||||
|
[
|
||||||
|
'locale' => $locale,
|
||||||
|
'products_id' => $productIds
|
||||||
|
],
|
||||||
|
$locale
|
||||||
|
);
|
||||||
|
|
||||||
|
Tlog::getInstance()->debug("Stock Alert sent to administrator " . implode(', ', $emails));
|
||||||
|
} else {
|
||||||
|
Tlog::getInstance()->debug("Restocking Alert: no contact email is defined !");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
148
local/modules/StockAlert/Form/StockAlertConfig.php
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
<?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 StockAlert\Form;
|
||||||
|
|
||||||
|
use StockAlert\StockAlert;
|
||||||
|
use Symfony\Component\Validator\Constraints\Callback;
|
||||||
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
|
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||||
|
use Thelia\Core\Translation\Translator;
|
||||||
|
use Thelia\Form\BaseForm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class StockAlertConfig
|
||||||
|
* @package StockAlert\Form
|
||||||
|
* @author Baixas Alban <abaixas@openstudio.fr>
|
||||||
|
* @author Julien Chanséaume <julien@thelia.net>
|
||||||
|
*/
|
||||||
|
class StockAlertConfig extends BaseForm
|
||||||
|
{
|
||||||
|
/** @var Translator $translator */
|
||||||
|
protected $translator;
|
||||||
|
|
||||||
|
public function checkEmails($value, ExecutionContextInterface $context)
|
||||||
|
{
|
||||||
|
$data = $context->getRoot()->getData();
|
||||||
|
|
||||||
|
$value = trim($value);
|
||||||
|
|
||||||
|
if ("" === trim($value) && !empty($data["enabled"])) {
|
||||||
|
$context->addViolation(
|
||||||
|
$this->trans(
|
||||||
|
"The Emails can not be empty",
|
||||||
|
[
|
||||||
|
"%id" => $value,
|
||||||
|
]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$emails = explode(',', $value);
|
||||||
|
foreach ($emails as $email) {
|
||||||
|
if (false === filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
$context->addViolation(
|
||||||
|
$this->trans(
|
||||||
|
"'%email' is not a valid email address",
|
||||||
|
["%email" => $email]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function trans($id, $parameters = [])
|
||||||
|
{
|
||||||
|
if (null === $this->translator) {
|
||||||
|
$this->translator = Translator::getInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->translator->trans($id, $parameters, StockAlert::MESSAGE_DOMAIN);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string the name of you form. This name must be unique
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return 'stockalert_config_form';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function buildForm()
|
||||||
|
{
|
||||||
|
$config = StockAlert::getConfig();
|
||||||
|
|
||||||
|
$this->formBuilder
|
||||||
|
->add(
|
||||||
|
'enabled',
|
||||||
|
'checkbox',
|
||||||
|
[
|
||||||
|
"required" => false,
|
||||||
|
"data" => $config['enabled'],
|
||||||
|
"label" => Translator::getInstance()->trans("Enabled", [], StockAlert::MESSAGE_DOMAIN),
|
||||||
|
"label_attr" => [
|
||||||
|
"for" => "enabled"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
)
|
||||||
|
->add(
|
||||||
|
'threshold',
|
||||||
|
'integer',
|
||||||
|
[
|
||||||
|
"required" => true,
|
||||||
|
"constraints" => [
|
||||||
|
new NotBlank(),
|
||||||
|
],
|
||||||
|
"data" => $config['threshold'],
|
||||||
|
"label" => Translator::getInstance()->trans("Threshold", [], StockAlert::MESSAGE_DOMAIN),
|
||||||
|
"label_attr" => [
|
||||||
|
"for" => "email",
|
||||||
|
"help" => Translator::getInstance()->trans(
|
||||||
|
"You will recieve a notification when the quantity in stock is lower or equal to this value.",
|
||||||
|
[],
|
||||||
|
StockAlert::MESSAGE_DOMAIN
|
||||||
|
),
|
||||||
|
]
|
||||||
|
]
|
||||||
|
)
|
||||||
|
->add(
|
||||||
|
"emails",
|
||||||
|
"text",
|
||||||
|
[
|
||||||
|
"constraints" => [
|
||||||
|
new Callback(
|
||||||
|
[
|
||||||
|
"methods" => [
|
||||||
|
[$this, "checkEmails"]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
),
|
||||||
|
],
|
||||||
|
"required" => false,
|
||||||
|
"data" => implode(',', $config['emails']),
|
||||||
|
"label" => Translator::getInstance()->trans(
|
||||||
|
"Email Address",
|
||||||
|
[],
|
||||||
|
StockAlert::MESSAGE_DOMAIN
|
||||||
|
),
|
||||||
|
"label_attr" => [
|
||||||
|
"for" => "emails",
|
||||||
|
"help" => Translator::getInstance()->trans(
|
||||||
|
"A comma separated list of email that will recieve notifications",
|
||||||
|
[],
|
||||||
|
StockAlert::MESSAGE_DOMAIN
|
||||||
|
),
|
||||||
|
]
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
66
local/modules/StockAlert/Form/StockAlertSubscribe.php
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<?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 StockAlert\Form;
|
||||||
|
|
||||||
|
use StockAlert\StockAlert;
|
||||||
|
use Symfony\Component\Validator\Constraints\Email;
|
||||||
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
|
use Thelia\Core\Translation\Translator;
|
||||||
|
use Thelia\Form\BaseForm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class RestockingAlertSubscribe
|
||||||
|
* @package RestockingAlert\Form
|
||||||
|
* @author Baixas Alban <abaixas@openstudio.fr>
|
||||||
|
* @author Julien Chanséaume <julien@thelia.net>
|
||||||
|
*/
|
||||||
|
class StockAlertSubscribe extends BaseForm
|
||||||
|
{
|
||||||
|
protected function buildForm()
|
||||||
|
{
|
||||||
|
$this->formBuilder
|
||||||
|
->add(
|
||||||
|
'product_sale_elements_id',
|
||||||
|
'product_sale_elements_id',
|
||||||
|
[
|
||||||
|
'required' => true,
|
||||||
|
"label" => Translator::getInstance()->trans("Product", [], StockAlert::MESSAGE_DOMAIN),
|
||||||
|
"label_attr" => [
|
||||||
|
"for" => "product_sale_elements_id"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
)
|
||||||
|
->add(
|
||||||
|
"email",
|
||||||
|
"email",
|
||||||
|
[
|
||||||
|
"constraints" => [
|
||||||
|
new NotBlank(),
|
||||||
|
new Email()
|
||||||
|
],
|
||||||
|
"label" => Translator::getInstance()->trans("Email Address", [], StockAlert::MESSAGE_DOMAIN),
|
||||||
|
"label_attr" => [
|
||||||
|
"for" => "email"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string the name of you form. This name must be unique
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return 'stockalert_subscribe_form';
|
||||||
|
}
|
||||||
|
}
|
||||||
61
local/modules/StockAlert/Hook/StockAlertHook.php
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
<?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 StockAlert\Hook;
|
||||||
|
|
||||||
|
use StockAlert\StockAlert;
|
||||||
|
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||||
|
use Thelia\Core\Hook\BaseHook;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class StockAlertHook
|
||||||
|
* @package StockAlert\Hook
|
||||||
|
* @author Julien Chanséaume <julien@thelia.net>
|
||||||
|
*/
|
||||||
|
class StockAlertHook extends BaseHook
|
||||||
|
{
|
||||||
|
|
||||||
|
public function onProductDetailsBottom(HookRenderEvent $event)
|
||||||
|
{
|
||||||
|
$event->add(
|
||||||
|
$this->render(
|
||||||
|
"product-details-bottom.html"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function onProductJavascriptInitialization(HookRenderEvent $event)
|
||||||
|
{
|
||||||
|
$event->add(
|
||||||
|
$this->render(
|
||||||
|
"product.javascript-initialization.html"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function onModuleConfiguration(HookRenderEvent $event)
|
||||||
|
{
|
||||||
|
$moduleId = $this->getModule()->getModuleId();
|
||||||
|
$config = StockAlert::getConfig();
|
||||||
|
|
||||||
|
$event->add(
|
||||||
|
$this->render(
|
||||||
|
"configuration.html",
|
||||||
|
[
|
||||||
|
'module_id' => $moduleId,
|
||||||
|
'config' => $config
|
||||||
|
]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
13
local/modules/StockAlert/I18n/backOffice/default/en_US.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'Actions' => 'Actions',
|
||||||
|
'Configuration.' => 'Configuration.',
|
||||||
|
'Date' => 'Date',
|
||||||
|
'Email' => 'Email',
|
||||||
|
'List of current subscriptions.' => 'List of current subscriptions.',
|
||||||
|
'Product' => 'Product',
|
||||||
|
'Save' => 'Save',
|
||||||
|
'The stock is not not use on the site. Please set the config variable check-available-stock to 1.' => 'The stock is not not use on the site. Please set the config variable check-available-stock to 1.',
|
||||||
|
'There is no subscriptions.' => 'There is no subscriptions.',
|
||||||
|
);
|
||||||
13
local/modules/StockAlert/I18n/backOffice/default/fr_FR.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'Actions' => 'Actions',
|
||||||
|
'Configuration.' => 'Configuration',
|
||||||
|
'Date' => 'Date',
|
||||||
|
'Email' => 'Email',
|
||||||
|
'List of current subscriptions.' => 'Abonnements des clients',
|
||||||
|
'Product' => 'Produit',
|
||||||
|
'Save' => 'Enregistrer',
|
||||||
|
'The stock is not not use on the site. Please set the config variable check-available-stock to 1.' => 'Le stock n\'est pas utilisé sur le site. Veuillez mettre la variable check-available-stock à 1.',
|
||||||
|
'There is no subscriptions.' => 'Aucune alerte n\'a encore été créée.',
|
||||||
|
);
|
||||||