Merge pull request #400 from roadster31/coupons-return

Coupons return
This commit is contained in:
Manuel Raynaud
2014-05-13 08:54:39 +02:00
40 changed files with 1710 additions and 602 deletions

View File

@@ -1,3 +1,13 @@
#2.0.2
- New coupon conditions :
- Start date
- Billing country
- Shipping country
- Cart contains product
- Cart contains product from category
- For specific customers
#2.0.1
- possibility to apply a permanent discount on a customer
- display estimated shipping on cart page

View File

@@ -37,6 +37,7 @@ class ConditionEvaluator
foreach ($conditions as $condition) {
if (!$condition->isMatching()) {
$isMatching = false;
break;
}
}

View File

@@ -83,7 +83,8 @@ class ConditionFactory
$collection = new ConditionCollection();
if (!empty($unserializedConditions) && !empty($unserializedConditions)) {
if (!empty($unserializedConditions)) {
/** @var SerializableCondition $condition */
foreach ($unserializedConditions as $condition) {
if ($this->container->has($condition->conditionServiceId)) {

View File

@@ -0,0 +1,150 @@
<?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 Thelia\Condition\Implementation;
use Thelia\Condition\Operators;
use Thelia\Coupon\FacadeInterface;
use Thelia\Exception\InvalidConditionValueException;
use Thelia\Model\Base\CountryQuery;
/**
* Check a Checkout against its Product number
*
* @package Condition
* @author Franck Allimant <franck@cqfdev.fr>
*
*/
abstract class AbstractMatchCountries extends ConditionAbstract
{
/** Condition 1st parameter : quantity */
CONST COUNTRIES_LIST = 'countries';
/**
* @inheritdoc
*/
public function __construct(FacadeInterface $facade)
{
$this->availableOperators = [
self::COUNTRIES_LIST => [
Operators::IN,
Operators::OUT
]
];
parent::__construct($facade);
}
protected abstract function getSummaryLabel($cntryStrList, $i18nOperator);
protected abstract function getFormLabel();
/**
* @inheritdoc
*/
public function setValidatorsFromForm(array $operators, array $values)
{
$this->checkComparisonOperatorValue($operators, self::COUNTRIES_LIST);
// Use default values if data is not defined.
if (! isset($operators[self::COUNTRIES_LIST]) || ! isset($values[self::COUNTRIES_LIST])) {
$operators[self::COUNTRIES_LIST] = Operators::IN;
$values[self::COUNTRIES_LIST] = [];
}
// Be sure that the value is an array, make one if required
if (! is_array($values[self::COUNTRIES_LIST])) {
$values[self::COUNTRIES_LIST] = array($values[self::COUNTRIES_LIST]);
}
// Check that at least one category is selected
if (empty($values[self::COUNTRIES_LIST])) {
throw new InvalidConditionValueException(
get_class(), self::COUNTRIES_LIST
);
}
$this->operators = [ self::COUNTRIES_LIST => $operators[self::COUNTRIES_LIST] ];
$this->values = [ self::COUNTRIES_LIST => $values[self::COUNTRIES_LIST] ];
return $this;
}
/**
* @inheritdoc
*/
public function isMatching()
{
// The delivery address should match one of the selected countries.
/* TODO !!!! */
return $this->conditionValidator->variableOpComparison(
$this->facade->getNbArticlesInCart(),
$this->operators[self::COUNTRIES_LIST],
$this->values[self::COUNTRIES_LIST]
);
}
/**
* @inheritdoc
*/
public function getSummary()
{
$i18nOperator = Operators::getI18n(
$this->translator, $this->operators[self::COUNTRIES_LIST]
);
$cntryStrList = '';
$cntryIds = $this->values[self::COUNTRIES_LIST];
if (null !== $cntryList = CountryQuery::create()->findPks($cntryIds)) {
/** @var Category $cntry */
foreach($cntryList as $cntry) {
$cntryStrList .= $cntry->getTitle() . ', ';
}
$cntryStrList = rtrim($cntryStrList, ', ');
}
return $this->getSummaryLabel($cntryStrList, $i18nOperator);
}
/**
* @inheritdoc
*/
protected function generateInputs()
{
return array(
self::COUNTRIES_LIST => array(
'availableOperators' => $this->availableOperators[self::COUNTRIES_LIST],
'value' => '',
'selectedOperator' => Operators::IN
)
);
}
/**
* @inheritdoc
*/
public function drawBackOfficeInputs()
{
return $this->facade->getParser()->render('coupon/condition-fragments/countries-condition.html', [
'operatorSelectHtml' => $this->drawBackOfficeInputOperators(self::COUNTRIES_LIST),
'countries_field_name' => self::COUNTRIES_LIST,
'values' => isset($this->values[self::COUNTRIES_LIST]) ? $this->values[self::COUNTRIES_LIST] : array(),
'countryLabel' => $this->getFormLabel()
]
);
}
}

View File

@@ -0,0 +1,202 @@
<?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 Thelia\Condition\Implementation;
use Thelia\Condition\Operators;
use Thelia\Coupon\FacadeInterface;
use Thelia\Exception\InvalidConditionValueException;
use Thelia\Model\CartItem;
use Thelia\Model\Category;
use Thelia\Model\CategoryQuery;
/**
* Check a Checkout against its Product number
*
* @package Condition
* @author Franck Allimant <franck@cqfdev.fr>
*
*/
class CartContainsCategories extends ConditionAbstract
{
/** Condition 1st parameter : quantity */
CONST CATEGORIES_LIST = 'categories';
/**
* @inheritdoc
*/
public function __construct(FacadeInterface $facade)
{
$this->availableOperators = [
self::CATEGORIES_LIST => [
Operators::IN,
Operators::OUT
]
];
parent::__construct($facade);
}
/**
* @inheritdoc
*/
public function getServiceId()
{
return 'thelia.condition.cart_contains_categories';
}
/**
* @inheritdoc
*/
public function setValidatorsFromForm(array $operators, array $values)
{
$this->checkComparisonOperatorValue($operators, self::CATEGORIES_LIST);
// Use default values if data is not defined.
if (! isset($operators[self::CATEGORIES_LIST]) || ! isset($values[self::CATEGORIES_LIST])) {
$operators[self::CATEGORIES_LIST] = Operators::IN;
$values[self::CATEGORIES_LIST] = [];
}
// Be sure that the value is an array, make one if required
if (! is_array($values[self::CATEGORIES_LIST])) {
$values[self::CATEGORIES_LIST] = array($values[self::CATEGORIES_LIST]);
}
// Check that at least one category is selected
if (empty($values[self::CATEGORIES_LIST])) {
throw new InvalidConditionValueException(
get_class(), self::CATEGORIES_LIST
);
}
$this->operators = [ self::CATEGORIES_LIST => $operators[self::CATEGORIES_LIST] ];
$this->values = [ self::CATEGORIES_LIST => $values[self::CATEGORIES_LIST] ];
return $this;
}
/**
* @inheritdoc
*/
public function isMatching()
{
$cartItems = $this->facade->getCart()->getCartItems();
/** @var CartItem $cartItem */
foreach($cartItems as $cartItem) {
$categories = $cartItem->getProduct()->getCategories();
/** @var Category $category */
foreach($categories as $category) {
$catecoryInCart = $this->conditionValidator->variableOpComparison(
$category->getId(),
$this->operators[self::CATEGORIES_LIST],
$this->values[self::CATEGORIES_LIST]
);
if ($catecoryInCart) {
return true;
}
}
}
return false;
}
/**
* @inheritdoc
*/
public function getName()
{
return $this->translator->trans(
'Cart contains categories condition',
[],
'condition'
);
}
/**
* @inheritdoc
*/
public function getToolTip()
{
$toolTip = $this->translator->trans(
'The coupon applies if the cart contains at least one product of the selected categories',
[],
'condition'
);
return $toolTip;
}
/**
* @inheritdoc
*/
public function getSummary()
{
$i18nOperator = Operators::getI18n(
$this->translator, $this->operators[self::CATEGORIES_LIST]
);
$catStrList = '';
$catIds = $this->values[self::CATEGORIES_LIST];
if (null !== $catList = CategoryQuery::create()->findPks($catIds)) {
/** @var Category $cat */
foreach($catList as $cat) {
$catStrList .= $cat->getTitle() . ', ';
}
$catStrList = rtrim($catStrList, ', ');
}
$toolTip = $this->translator->trans(
'At least one of cart products categories is %op% <strong>%categories_list%</strong>', [
'%categories_list%' => $catStrList,
'%op%' => $i18nOperator
], 'condition'
);
return $toolTip;
}
/**
* @inheritdoc
*/
protected function generateInputs()
{
return array(
self::CATEGORIES_LIST => array(
'availableOperators' => $this->availableOperators[self::CATEGORIES_LIST],
'value' => '',
'selectedOperator' => Operators::IN
)
);
}
/**
* @inheritdoc
*/
public function drawBackOfficeInputs()
{
return $this->facade->getParser()->render('coupon/condition-fragments/cart-contains-categories-condition.html', [
'operatorSelectHtml' => $this->drawBackOfficeInputOperators(self::CATEGORIES_LIST),
'categories_field_name' => self::CATEGORIES_LIST,
'values' => isset($this->values[self::CATEGORIES_LIST]) ? $this->values[self::CATEGORIES_LIST] : array()
]
);
}
}

View File

@@ -0,0 +1,195 @@
<?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 Thelia\Condition\Implementation;
use Thelia\Condition\Operators;
use Thelia\Coupon\FacadeInterface;
use Thelia\Exception\InvalidConditionValueException;
use Thelia\Model\Base\ProductQuery;
use Thelia\Model\CartItem;
use Thelia\Model\Product;
/**
* Check a Checkout against its Product number
*
* @package Condition
* @author Franck Allimant <franck@cqfdev.fr>
*
*/
class CartContainsProducts extends ConditionAbstract
{
/** Condition 1st parameter : quantity */
const PRODUCTS_LIST = 'products';
/**
* @inheritdoc
*/
public function __construct(FacadeInterface $facade)
{
$this->availableOperators = [
self::PRODUCTS_LIST => [
Operators::IN,
Operators::OUT
]
];
parent::__construct($facade);
}
/**
* @inheritdoc
*/
public function getServiceId()
{
return 'thelia.condition.cart_contains_products';
}
/**
* @inheritdoc
*/
public function setValidatorsFromForm(array $operators, array $values)
{
$this->checkComparisonOperatorValue($operators, self::PRODUCTS_LIST);
// Use default values if data is not defined.
if (! isset($operators[self::PRODUCTS_LIST]) || ! isset($values[self::PRODUCTS_LIST])) {
$operators[self::PRODUCTS_LIST] = Operators::IN;
$values[self::PRODUCTS_LIST] = [];
}
// Be sure that the value is an array, make one if required
if (! is_array($values[self::PRODUCTS_LIST])) {
$values[self::PRODUCTS_LIST] = array($values[self::PRODUCTS_LIST]);
}
// Check that at least one product is selected
if (empty($values[self::PRODUCTS_LIST])) {
throw new InvalidConditionValueException(
get_class(), self::PRODUCTS_LIST
);
}
$this->operators = [ self::PRODUCTS_LIST => $operators[self::PRODUCTS_LIST] ];
$this->values = [ self::PRODUCTS_LIST => $values[self::PRODUCTS_LIST] ];
return $this;
}
/**
* @inheritdoc
*/
public function isMatching()
{
$cartItems = $this->facade->getCart()->getCartItems();
/** @var CartItem $cartItem */
foreach($cartItems as $cartItem) {
if ($this->conditionValidator->variableOpComparison(
$cartItem->getProduct()->getId(),
$this->operators[self::PRODUCTS_LIST],
$this->values[self::PRODUCTS_LIST])) {
return true;
}
}
return false;
}
/**
* @inheritdoc
*/
public function getName()
{
return $this->translator->trans(
'Cart contains specific products',
[],
'condition'
);
}
/**
* @inheritdoc
*/
public function getToolTip()
{
$toolTip = $this->translator->trans(
'The coupon applies if the cart contains at least one product of the specified product list',
[],
'condition'
);
return $toolTip;
}
/**
* @inheritdoc
*/
public function getSummary()
{
$i18nOperator = Operators::getI18n(
$this->translator, $this->operators[self::PRODUCTS_LIST]
);
$prodStrList = '';
$prodIds = $this->values[self::PRODUCTS_LIST];
if (null !== $prodList = ProductQuery::create()->findPks($prodIds)) {
/** @var Product $prod */
foreach($prodList as $prod) {
$prodStrList .= $prod->getTitle() . ', ';
}
$prodStrList = rtrim($prodStrList, ', ');
}
$toolTip = $this->translator->trans(
'Cart contains at least a product %op% <strong>%products_list%</strong>', [
'%products_list%' => $prodStrList,
'%op%' => $i18nOperator
], 'condition'
);
return $toolTip;
}
/**
* @inheritdoc
*/
protected function generateInputs()
{
return array(
self::PRODUCTS_LIST => array(
'availableOperators' => $this->availableOperators[self::PRODUCTS_LIST],
'value' => '',
'selectedOperator' => Operators::IN
)
);
}
/**
* @inheritdoc
*/
public function drawBackOfficeInputs()
{
return $this->facade->getParser()->render('coupon/condition-fragments/cart-contains-products-condition.html', [
'operatorSelectHtml' => $this->drawBackOfficeInputOperators(self::PRODUCTS_LIST),
'products_field_name' => self::PRODUCTS_LIST,
'values' => isset($this->values[self::PRODUCTS_LIST]) ? $this->values[self::PRODUCTS_LIST] : array()
]
);
}
}

View File

@@ -17,6 +17,7 @@ use Thelia\Condition\Operators;
use Thelia\Condition\SerializableCondition;
use Thelia\Core\Translation\Translator;
use Thelia\Coupon\FacadeInterface;
use Thelia\Exception\InvalidConditionOperatorException;
use Thelia\Exception\InvalidConditionValueException;
use Thelia\Model\Base\CurrencyQuery;
use Thelia\Model\Currency;
@@ -31,10 +32,6 @@ use Thelia\Type\FloatType;
*/
abstract class ConditionAbstract implements ConditionInterface
{
/** @var string Service Id from Resources/config.xml */
protected $serviceId = null;
/** @var array Available Operators (Operators::CONST) */
protected $availableOperators = [];
@@ -69,13 +66,27 @@ abstract class ConditionAbstract implements ConditionInterface
}
/**
* Return all available Operators for this Condition
* @param array $operatorList the list of comparison operator values, as entered in the condition parameter form
* @param string $parameterName the name of the parameter to check
*
* @return array Operators::CONST
* @return $this
*
* @throws \Thelia\Exception\InvalidConditionOperatorException if the operator value is not in the allowed value
*/
public function getAvailableOperators()
{
return $this->availableOperators;
protected function checkComparisonOperatorValue($operatorList, $parameterName) {
$isOperator1Legit = $this->isOperatorLegit(
$operatorList[$parameterName],
$this->availableOperators[$parameterName]
);
if (!$isOperator1Legit) {
throw new InvalidConditionOperatorException(
get_class(), $parameterName
);
}
return $this;
}
/**
@@ -88,8 +99,11 @@ abstract class ConditionAbstract implements ConditionInterface
$this->validators = $this->generateInputs();
$translatedInputs = [];
foreach ($this->validators as $key => $validator) {
$translatedOperators = [];
foreach ($validator['availableOperators'] as $availableOperators) {
$translatedOperators[$availableOperators] = Operators::getI18n(
$this->translator,
@@ -98,18 +112,23 @@ abstract class ConditionAbstract implements ConditionInterface
}
$validator['availableOperators'] = $translatedOperators;
$translatedInputs[$key] = $validator;
}
$validators = [];
$validators['inputs'] = $translatedInputs;
$validators['setOperators'] = $this->operators;
$validators['setValues'] = $this->values;
$validators = [
'inputs' => $translatedInputs,
'setOperators' => $this->operators,
'setValues' => $this->values
];
return $validators;
}
/**
* Generate inputs ready to be drawn
* Generate inputs ready to be drawn.
*
* TODO: what these "inputs ready to be drawn" is not clear.
*
* @throws \Thelia\Exception\NotImplementedException
* @return array
@@ -128,7 +147,9 @@ abstract class ConditionAbstract implements ConditionInterface
*/
public function getServiceId()
{
return $this->serviceId;
throw new \Thelia\Exception\NotImplementedException(
'The getServiceId method must be implemented in ' . get_class()
);
}
/**
@@ -152,7 +173,7 @@ abstract class ConditionAbstract implements ConditionInterface
public function getSerializableCondition()
{
$serializableCondition = new SerializableCondition();
$serializableCondition->conditionServiceId = $this->serviceId;
$serializableCondition->conditionServiceId = $this->getServiceId();
$serializableCondition->operators = $this->operators;
$serializableCondition->values = $this->values;

View File

@@ -14,6 +14,8 @@ namespace Thelia\Condition\Implementation;
use Thelia\Condition\SerializableCondition;
use Thelia\Coupon\FacadeInterface;
use Thelia\Exception\InvalidConditionOperatorException;
use Thelia\Exception\InvalidConditionValueException;
/**
* Manage how the application checks its state in order to check if it matches the implemented condition
@@ -41,10 +43,12 @@ interface ConditionInterface
/**
* Check validators relevancy and store them
*
* @param array $operators Operators the Admin set in BackOffice
* @param array $values Values the Admin set in BackOffice
* @param array $operators an array of operators (greater than, less than, etc.) entered in the condition parameter input form, one for each condition defined by the Condition
* @param array $values an array of values entered in in the condition parameter input form, one for each condition defined by the Condition
*
* @throws InvalidConditionOperatorException
* @throws InvalidConditionValueException
*
* @throws \InvalidArgumentException
* @return $this
*/
public function setValidatorsFromForm(array $operators, array $values);
@@ -56,13 +60,6 @@ interface ConditionInterface
*/
public function isMatching();
/**
* Return all available Operators for this condition
*
* @return array Operators::CONST
*/
public function getAvailableOperators();
/**
* Get I18n name
*
@@ -107,5 +104,4 @@ interface ConditionInterface
* @return string HTML string
*/
public function drawBackOfficeInputs();
}

View File

@@ -0,0 +1,185 @@
<?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 Thelia\Condition\Implementation;
use Thelia\Condition\Operators;
use Thelia\Coupon\FacadeInterface;
use Thelia\Exception\InvalidConditionValueException;
use Thelia\Model\Customer;
use Thelia\Model\CustomerQuery;
/**
* Check a Checkout against its Product number
*
* @package Condition
* @author Franck Allimant <franck@cqfdev.fr>
*
*/
class ForSomeCustomers extends ConditionAbstract
{
const CUSTOMERS_LIST = 'customers';
/**
* @inheritdoc
*/
public function __construct(FacadeInterface $facade)
{
$this->availableOperators = [
self::CUSTOMERS_LIST => [
Operators::IN,
Operators::OUT
]
];
parent::__construct($facade);
}
/**
* @inheritdoc
*/
public function getServiceId()
{
return 'thelia.condition.for_some_customers';
}
/**
* @inheritdoc
*/
public function setValidatorsFromForm(array $operators, array $values)
{
$this->checkComparisonOperatorValue($operators, self::CUSTOMERS_LIST);
// Use default values if data is not defined.
if (! isset($operators[self::CUSTOMERS_LIST]) || ! isset($values[self::CUSTOMERS_LIST])) {
$operators[self::CUSTOMERS_LIST] = Operators::IN;
$values[self::CUSTOMERS_LIST] = [];
}
// Be sure that the value is an array, make one if required
if (! is_array($values[self::CUSTOMERS_LIST])) {
$values[self::CUSTOMERS_LIST] = array($values[self::CUSTOMERS_LIST]);
}
// Check that at least one product is selected
if (empty($values[self::CUSTOMERS_LIST])) {
throw new InvalidConditionValueException(
get_class(), self::CUSTOMERS_LIST
);
}
$this->operators = [ self::CUSTOMERS_LIST => $operators[self::CUSTOMERS_LIST] ];
$this->values = [ self::CUSTOMERS_LIST => $values[self::CUSTOMERS_LIST] ];
return $this;
}
/**
* @inheritdoc
*/
public function isMatching()
{
$customer = $this->facade->getCustomer();
return $this->conditionValidator->variableOpComparison(
$customer->getId(),
$this->operators[self::CUSTOMERS_LIST],
$this->values[self::CUSTOMERS_LIST]
);
}
/**
* @inheritdoc
*/
public function getName()
{
return $this->translator->trans(
'For one ore more customers',
[],
'condition'
);
}
/**
* @inheritdoc
*/
public function getToolTip()
{
$toolTip = $this->translator->trans(
'The coupon applies to some customers only',
[],
'condition'
);
return $toolTip;
}
/**
* @inheritdoc
*/
public function getSummary()
{
$i18nOperator = Operators::getI18n(
$this->translator, $this->operators[self::CUSTOMERS_LIST]
);
$custStrList = '';
$custIds = $this->values[self::CUSTOMERS_LIST];
if (null !== $custList = CustomerQuery::create()->findPks($custIds)) {
/** @var Customer $cust */
foreach($custList as $cust) {
$custStrList .= $cust->getLastname() . ' ' . $cust->getFirstname() . ' ('.$cust->getRef().'), ';
}
$custStrList = rtrim($custStrList, ', ');
}
$toolTip = $this->translator->trans(
'Customer is %op% <strong>%customer_list%</strong>', [
'%customer_list%' => $custStrList,
'%op%' => $i18nOperator
], 'condition'
);
return $toolTip;
}
/**
* @inheritdoc
*/
protected function generateInputs()
{
return array(
self::CUSTOMERS_LIST => array(
'availableOperators' => $this->availableOperators[self::CUSTOMERS_LIST],
'value' => '',
'selectedOperator' => Operators::IN
)
);
}
/**
* @inheritdoc
*/
public function drawBackOfficeInputs()
{
return $this->facade->getParser()->render('coupon/condition-fragments/customers-condition.html', [
'operatorSelectHtml' => $this->drawBackOfficeInputOperators(self::CUSTOMERS_LIST),
'customers_field_name' => self::CUSTOMERS_LIST,
'values' => isset($this->values[self::CUSTOMERS_LIST]) ? $this->values[self::CUSTOMERS_LIST] : array()
]
);
}
}

View File

@@ -0,0 +1,87 @@
<?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 Thelia\Condition\Implementation;
/**
* Check a Checkout against its Product number
*
* @package Condition
* @author Franck Allimant <franck@cqfdev.fr>
*
*/
class MatchBillingCountries extends AbstractMatchCountries
{
/**
* @inheritdoc
*/
public function getServiceId()
{
return 'thelia.condition.match_billing_countries';
}
/**
* @inheritdoc
*/
public function isMatching()
{
$billingAddress = $this->facade->getCustomer()->getDefaultAddress();
return $this->conditionValidator->variableOpComparison(
$billingAddress->getCountryId(),
$this->operators[self::COUNTRIES_LIST],
$this->values[self::COUNTRIES_LIST]
);
}
/**
* @inheritdoc
*/
public function getName()
{
return $this->translator->trans(
'Billing country',
[],
'condition'
);
}
/**
* @inheritdoc
*/
public function getToolTip()
{
$toolTip = $this->translator->trans(
'The coupon applies to the selected delivery countries',
[],
'condition'
);
return $toolTip;
}
protected function getSummaryLabel($cntryStrList, $i18nOperator) {
return $this->translator->trans(
'Only if order billing country is %op% <strong>%countries_list%</strong>', [
'%countries_list%' => $cntryStrList,
'%op%' => $i18nOperator
], 'condition'
);
}
protected function getFormLabel() {
return $this->translator->trans(
'Billing coutry is', [], 'condition'
);
}
}

View File

@@ -0,0 +1,87 @@
<?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 Thelia\Condition\Implementation;
/**
* Check a Checkout against its Product number
*
* @package Condition
* @author Franck Allimant <franck@cqfdev.fr>
*
*/
class MatchDeliveryCountries extends AbstractMatchCountries
{
/**
* @inheritdoc
*/
public function getServiceId()
{
return 'thelia.condition.match_delivery_countries';
}
/**
* @inheritdoc
*/
public function isMatching()
{
$deliveryAddress = $this->facade->getDeliveryAddress();
return $this->conditionValidator->variableOpComparison(
$deliveryAddress->getCountryId(),
$this->operators[self::COUNTRIES_LIST],
$this->values[self::COUNTRIES_LIST]
);
}
/**
* @inheritdoc
*/
public function getName()
{
return $this->translator->trans(
'Delivery country',
[],
'condition'
);
}
/**
* @inheritdoc
*/
public function getToolTip()
{
$toolTip = $this->translator->trans(
'The coupon applies to the selected delivery countries',
[],
'condition'
);
return $toolTip;
}
protected function getSummaryLabel($cntryStrList, $i18nOperator) {
return $this->translator->trans(
'Only if order shipping country is %op% <strong>%countries_list%</strong>', [
'%countries_list%' => $cntryStrList,
'%op%' => $i18nOperator
], 'condition'
);
}
protected function getFormLabel() {
return $this->translator->trans(
'Delivery coutry is', [], 'condition'
);
}
}

View File

@@ -12,6 +12,8 @@
namespace Thelia\Condition\Implementation;
use Thelia\Coupon\FacadeInterface;
/**
* Allow every one, perform no check
*
@@ -21,35 +23,29 @@ namespace Thelia\Condition\Implementation;
*/
class MatchForEveryone extends ConditionAbstract
{
/** @var string Service Id from Resources/config.xml */
protected $serviceId = 'thelia.condition.match_for_everyone';
/** @var array Available Operators (Operators::CONST) */
protected $availableOperators = [];
/**
* Check validators relevancy and store them
*
* @param array $operators Operators the Admin set in BackOffice
* @param array $values Values the Admin set in BackOffice
*
* @throws \InvalidArgumentException
* @return $this
* @inheritdoc
*/
public function setValidatorsFromForm(array $operators, array $values)
{
$this->setValidators();
public function __construct(FacadeInterface $facade) {
return $this;
// Define the allowed comparison operators
$this->availableOperators = [];
parent::__construct($facade);
}
/**
* Check validators relevancy and store them
*
* @throws \InvalidArgumentException
* @return $this
* @inheritdoc
*/
protected function setValidators()
public function getServiceId()
{
return 'thelia.condition.match_for_everyone';
}
/**
* @inheritdoc
*/
public function setValidatorsFromForm(array $operators, array $values)
{
$this->operators = [];
$this->values = [];
@@ -58,9 +54,7 @@ class MatchForEveryone extends ConditionAbstract
}
/**
* Test if Customer meets conditions
*
* @return bool
* @inheritdoc
*/
public function isMatching()
{
@@ -68,9 +62,7 @@ class MatchForEveryone extends ConditionAbstract
}
/**
* Get I18n name
*
* @return string
* @inheritdoc
*/
public function getName()
{
@@ -82,10 +74,7 @@ class MatchForEveryone extends ConditionAbstract
}
/**
* Get I18n tooltip
* Explain in detail what the Condition checks
*
* @return string
* @inheritdoc
*/
public function getToolTip()
{
@@ -99,10 +88,7 @@ class MatchForEveryone extends ConditionAbstract
}
/**
* Get I18n summary
* Explain briefly the condition with given values
*
* @return string
* @inheritdoc
*/
public function getSummary()
{
@@ -116,20 +102,15 @@ class MatchForEveryone extends ConditionAbstract
}
/**
* Generate inputs ready to be drawn
*
* @return array
*/
* @inheritdoc
*/
protected function generateInputs()
{
return [];
}
/**
* Draw the input displayed in the BackOffice
* allowing Admin to set its Coupon Conditions
*
* @return string HTML string
* @inheritdoc
*/
public function drawBackOfficeInputs()
{

View File

@@ -13,7 +13,7 @@
namespace Thelia\Condition\Implementation;
use Thelia\Condition\Operators;
use Thelia\Exception\InvalidConditionOperatorException;
use Thelia\Coupon\FacadeInterface;
use Thelia\Model\Currency;
use Thelia\Model\CurrencyQuery;
@@ -22,99 +22,64 @@ use Thelia\Model\CurrencyQuery;
* Check if a Checkout total amount match criteria
*
* @package Condition
* @author Guillaume MOREL <gmorel@openstudio.fr>
* @author Guillaume MOREL <gmorel@openstudio.fr>, Franck Allimant <franck@cqfdev.fr>
*
*/
class MatchForTotalAmount extends ConditionAbstract
{
/** Condition 1st parameter : price */
CONST INPUT1 = 'price';
CONST CART_TOTAL = 'price';
/** Condition 1st parameter : currency */
CONST INPUT2 = 'currency';
CONST CART_CURRENCY = 'currency';
/** @var string Service Id from Resources/config.xml */
protected $serviceId = 'thelia.condition.match_for_total_amount';
/** @var array Available Operators (Operators::CONST) */
protected $availableOperators = array(
self::INPUT1 => array(
Operators::INFERIOR,
Operators::INFERIOR_OR_EQUAL,
Operators::EQUAL,
Operators::SUPERIOR_OR_EQUAL,
Operators::SUPERIOR
),
self::INPUT2 => array(
Operators::EQUAL,
)
);
/**
* Check validators relevancy and store them
*
* @param array $operators Operators the Admin set in BackOffice
* @param array $values Values the Admin set in BackOffice
*
* @throws \InvalidArgumentException
* @return $this
*/
public function setValidatorsFromForm(array $operators, array $values)
public function __construct(FacadeInterface $facade)
{
$this->setValidators(
$operators[self::INPUT1],
$values[self::INPUT1],
$operators[self::INPUT2],
$values[self::INPUT2]
);
// Define the allowed comparison operators
$this->availableOperators = [
self::CART_TOTAL => [
Operators::INFERIOR,
Operators::INFERIOR_OR_EQUAL,
Operators::EQUAL,
Operators::SUPERIOR_OR_EQUAL,
Operators::SUPERIOR
],
self::CART_CURRENCY => [
Operators::EQUAL,
]
];
return $this;
parent::__construct($facade);
}
/**
* Check validators relevancy and store them
*
* @param string $priceOperator Price Operator ex <
* @param float $priceValue Price set to meet condition
* @param string $currencyOperator Currency Operator ex =
* @param string $currencyValue Currency set to meet condition
*
* @throws \Thelia\Exception\InvalidConditionOperatorException
* @return $this
* @inheritdoc
*/
protected function setValidators($priceOperator, $priceValue, $currencyOperator, $currencyValue)
public function getServiceId()
{
$isOperator1Legit = $this->isOperatorLegit(
$priceOperator,
$this->availableOperators[self::INPUT1]
);
if (!$isOperator1Legit) {
throw new InvalidConditionOperatorException(
get_class(), 'price'
);
}
return 'thelia.condition.match_for_total_amount';
}
$isOperator1Legit = $this->isOperatorLegit(
$currencyOperator,
$this->availableOperators[self::INPUT2]
);
if (!$isOperator1Legit) {
throw new InvalidConditionOperatorException(
get_class(), 'price'
);
}
/**
* @inheritdoc
*/
public function setValidatorsFromForm(array $operators, array $values)
{
$this
->checkComparisonOperatorValue($operators, self::CART_TOTAL)
->checkComparisonOperatorValue($operators, self::CART_CURRENCY);
$this->isPriceValid($priceValue);
$this->isPriceValid($values[self::CART_TOTAL]);
$this->isCurrencyValid($currencyValue);
$this->isCurrencyValid($values[self::CART_CURRENCY]);
$this->operators = array(
self::INPUT1 => $priceOperator,
self::INPUT2 => $currencyOperator,
self::CART_TOTAL => $operators[self::CART_TOTAL],
self::CART_CURRENCY => $operators[self::CART_CURRENCY],
);
$this->values = array(
self::INPUT1 => $priceValue,
self::INPUT2 => $currencyValue,
self::CART_TOTAL => $values[self::CART_TOTAL],
self::CART_CURRENCY => $values[self::CART_CURRENCY],
);
return $this;
@@ -129,40 +94,39 @@ class MatchForTotalAmount extends ConditionAbstract
{
$condition1 = $this->conditionValidator->variableOpComparison(
$this->facade->getCartTotalPrice(),
$this->operators[self::INPUT1],
$this->values[self::INPUT1]
$this->operators[self::CART_TOTAL],
$this->values[self::CART_TOTAL]
);
$condition2 = $this->conditionValidator->variableOpComparison(
$this->facade->getCheckoutCurrency(),
$this->operators[self::INPUT2],
$this->values[self::INPUT2]
);
if ($condition1 && $condition2) {
return true;
if ($condition1) {
$condition2 = $this->conditionValidator->variableOpComparison(
$this->facade->getCheckoutCurrency(),
$this->operators[self::CART_CURRENCY],
$this->values[self::CART_CURRENCY]
);
if ($condition2) {
return true;
}
}
return false;
}
/**
* Get I18n name
*
* @return string
* @inheritdoc
*/
public function getName()
{
return $this->translator->trans(
'By cart total amount',
'Cart total amount',
[],
'condition'
);
}
/**
* Get I18n tooltip
* Explain in detail what the Condition checks
*
* @return string
* @inheritdoc
*/
public function getToolTip()
{
@@ -176,23 +140,21 @@ class MatchForTotalAmount extends ConditionAbstract
}
/**
* Get I18n summary
* Explain briefly the condition with given values
*
* @return string
* @inheritdoc
*/
public function getSummary()
{
$i18nOperator = Operators::getI18n(
$this->translator, $this->operators[self::INPUT1]
$this->translator,
$this->operators[self::CART_TOTAL]
);
$toolTip = $this->translator->trans(
'If cart total amount is <strong>%operator%</strong> %amount% %currency%',
array(
'%operator%' => $i18nOperator,
'%amount%' => $this->values[self::INPUT1],
'%currency%' => $this->values[self::INPUT2]
'%amount%' => $this->values[self::CART_TOTAL],
'%currency%' => $this->values[self::CART_CURRENCY]
),
'condition'
);
@@ -201,28 +163,28 @@ class MatchForTotalAmount extends ConditionAbstract
}
/**
* Generate inputs ready to be drawn
*
* @return array
* @inheritdoc
*/
protected function generateInputs()
{
$currencies = CurrencyQuery::create()->find();
$cleanedCurrencies = [];
/** @var Currency $currency */
foreach ($currencies as $currency) {
$cleanedCurrencies[$currency->getCode()] = $currency->getSymbol();
}
return array(
self::INPUT1 => array(
'availableOperators' => $this->availableOperators[self::INPUT1],
self::CART_TOTAL => array(
'availableOperators' => $this->availableOperators[self::CART_TOTAL],
'availableValues' => '',
'value' => '',
'selectedOperator' => ''
),
self::INPUT2 => array(
'availableOperators' => $this->availableOperators[self::INPUT2],
self::CART_CURRENCY => array(
'availableOperators' => $this->availableOperators[self::CART_CURRENCY],
'availableValues' => $cleanedCurrencies,
'value' => '',
'selectedOperator' => Operators::EQUAL
@@ -231,10 +193,7 @@ class MatchForTotalAmount extends ConditionAbstract
}
/**
* Draw the input displayed in the BackOffice
* allowing Admin to set its Coupon Conditions
*
* @return string HTML string
* @inheritdoc
*/
public function drawBackOfficeInputs()
{
@@ -242,32 +201,26 @@ class MatchForTotalAmount extends ConditionAbstract
->getTranslator()
->trans('Cart total amount is', [], 'condition');
$html = $this->drawBackOfficeBaseInputsText($labelPrice, self::INPUT1);
$html = $this->drawBackOfficeBaseInputsText($labelPrice, self::CART_TOTAL);
return $html;
}
/**
* Draw the base input displayed in the BackOffice
* allowing Admin to set its Coupon Conditions
*
* @param string $label I18n input label
* @param string $inputKey Input key (ex: self::INPUT1)
*
* @return string HTML string
* @inheritdoc
*/
protected function drawBackOfficeBaseInputsText($label, $inputKey)
{
return $this->facade->getParser()->render('coupon/condition-fragments/cart-total-amount-condition.html', [
'label' => $label,
'inputKey' => $inputKey,
'value' => isset($this->values[$inputKey]) ? $this->values[$inputKey] : '',
'field_1_name' => self::INPUT1,
'field_2_name' => self::INPUT2,
'operatorSelectHtml' => $this->drawBackOfficeInputOperators(self::INPUT1),
'currencySelectHtml' => $this->drawBackOfficeCurrencyInput(self::INPUT2),
return $this->facade->getParser()->render(
'coupon/condition-fragments/cart-total-amount-condition.html',
[
'label' => $label,
'inputKey' => $inputKey,
'value' => isset($this->values[$inputKey]) ? $this->values[$inputKey] : '',
'field_1_name' => self::CART_TOTAL,
'field_2_name' => self::CART_CURRENCY,
'operatorSelectHtml' => $this->drawBackOfficeInputOperators(self::CART_TOTAL),
'currencySelectHtml' => $this->drawBackOfficeCurrencyInput(self::CART_CURRENCY),
]
);
}

View File

@@ -13,6 +13,7 @@
namespace Thelia\Condition\Implementation;
use Thelia\Condition\Operators;
use Thelia\Coupon\FacadeInterface;
use Thelia\Exception\InvalidConditionOperatorException;
use Thelia\Exception\InvalidConditionValueException;
@@ -20,96 +21,73 @@ use Thelia\Exception\InvalidConditionValueException;
* Check a Checkout against its Product number
*
* @package Condition
* @author Guillaume MOREL <gmorel@openstudio.fr>
* @author Guillaume MOREL <gmorel@openstudio.fr>, Franck Allimant <franck@cqfdev.fr>
*
*/
class MatchForXArticles extends ConditionAbstract
{
/** Condition 1st parameter : quantity */
CONST INPUT1 = 'quantity';
/** @var string Service Id from Resources/config.xml */
protected $serviceId = 'thelia.condition.match_for_x_articles';
/** @var array Available Operators (Operators::CONST) */
protected $availableOperators = array(
self::INPUT1 => array(
Operators::INFERIOR,
Operators::INFERIOR_OR_EQUAL,
Operators::EQUAL,
Operators::SUPERIOR_OR_EQUAL,
Operators::SUPERIOR
)
);
CONST CART_QUANTITY = 'quantity';
/**
* Check validators relevancy and store them
*
* @param array $operators Operators the Admin set in BackOffice
* @param array $values Values the Admin set in BackOffice
*
* @throws \InvalidArgumentException
* @return $this
* @inheritdoc
*/
public function setValidatorsFromForm(array $operators, array $values)
public function __construct(FacadeInterface $facade)
{
$this->setValidators(
$operators[self::INPUT1],
$values[self::INPUT1]
$this->availableOperators = array(
self::CART_QUANTITY => array(
Operators::INFERIOR,
Operators::INFERIOR_OR_EQUAL,
Operators::EQUAL,
Operators::SUPERIOR_OR_EQUAL,
Operators::SUPERIOR
)
);
return $this;
parent::__construct($facade);
}
/**
* Check validators relevancy and store them
*
* @param string $quantityOperator Quantity Operator ex <
* @param int $quantityValue Quantity set to meet condition
*
* @throws \Thelia\Exception\InvalidConditionValueException
* @throws \Thelia\Exception\InvalidConditionOperatorException
* @return $this
* @inheritdoc
*/
protected function setValidators($quantityOperator, $quantityValue)
public function getServiceId()
{
$isOperator1Legit = $this->isOperatorLegit(
$quantityOperator,
$this->availableOperators[self::INPUT1]
);
if (!$isOperator1Legit) {
throw new InvalidConditionOperatorException(
get_class(), 'quantity'
);
}
return 'thelia.condition.match_for_x_articles';
}
if ((int) $quantityValue <= 0) {
/**
* @inheritdoc
*/
public function setValidatorsFromForm(array $operators, array $values)
{
$this->checkComparisonOperatorValue($operators, self::CART_QUANTITY);
if (intval($values[self::CART_QUANTITY]) <= 0) {
throw new InvalidConditionValueException(
get_class(), 'quantity'
);
}
$this->operators = array(
self::INPUT1 => $quantityOperator,
);
$this->values = array(
self::INPUT1 => $quantityValue,
);
$this->operators = [
self::CART_QUANTITY => $operators[self::CART_QUANTITY]
];
$this->values = [
self::CART_QUANTITY => $values[self::CART_QUANTITY]
];
return $this;
}
/**
* Test if Customer meets conditions
*
* @return bool
* @inheritdoc
*/
public function isMatching()
{
$condition1 = $this->conditionValidator->variableOpComparison(
$this->facade->getNbArticlesInCart(),
$this->operators[self::INPUT1],
$this->values[self::INPUT1]
$this->operators[self::CART_QUANTITY],
$this->values[self::CART_QUANTITY]
);
if ($condition1) {
@@ -120,24 +98,19 @@ class MatchForXArticles extends ConditionAbstract
}
/**
* Get I18n name
*
* @return string
* @inheritdoc
*/
public function getName()
{
return $this->translator->trans(
'Cart item count condition',
'Cart item count',
[],
'condition'
);
}
/**
* Get I18n tooltip
* Explain in detail what the Condition checks
*
* @return string
* @inheritdoc
*/
public function getToolTip()
{
@@ -151,22 +124,19 @@ class MatchForXArticles extends ConditionAbstract
}
/**
* Get I18n summary
* Explain briefly the condition with given values
*
* @return string
* @inheritdoc
*/
public function getSummary()
{
$i18nOperator = Operators::getI18n(
$this->translator, $this->operators[self::INPUT1]
$this->translator, $this->operators[self::CART_QUANTITY]
);
$toolTip = $this->translator->trans(
'If cart item count is <strong>%operator%</strong> %quantity%',
array(
'%operator%' => $i18nOperator,
'%quantity%' => $this->values[self::INPUT1]
'%quantity%' => $this->values[self::CART_QUANTITY]
),
'condition'
);
@@ -175,15 +145,13 @@ class MatchForXArticles extends ConditionAbstract
}
/**
* Generate inputs ready to be drawn
*
* @return array
* @inheritdoc
*/
protected function generateInputs()
{
return array(
self::INPUT1 => array(
'availableOperators' => $this->availableOperators[self::INPUT1],
self::CART_QUANTITY => array(
'availableOperators' => $this->availableOperators[self::CART_QUANTITY],
'value' => '',
'selectedOperator' => ''
)
@@ -191,10 +159,7 @@ class MatchForXArticles extends ConditionAbstract
}
/**
* Draw the input displayed in the BackOffice
* allowing Admin to set its Coupon Conditions
*
* @return string HTML string
* @inheritdoc
*/
public function drawBackOfficeInputs()
{
@@ -202,19 +167,13 @@ class MatchForXArticles extends ConditionAbstract
->getTranslator()
->trans('Cart item count is', [], 'condition');
$html = $this->drawBackOfficeBaseInputsText($labelQuantity, self::INPUT1);
$html = $this->drawBackOfficeBaseInputsText($labelQuantity, self::CART_QUANTITY);
return $html;
}
/**
* Draw the base input displayed in the BackOffice
* allowing Admin to set its Coupon Conditions
*
* @param string $label I18n input label
* @param string $inputKey Input key (ex: self::INPUT1)
*
* @return string HTML string
* @inheritdoc
*/
protected function drawBackOfficeBaseInputsText($label, $inputKey)
{

View File

@@ -0,0 +1,192 @@
<?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 Thelia\Condition\Implementation;
use Thelia\Condition\Operators;
use Thelia\Coupon\FacadeInterface;
use Thelia\Exception\InvalidConditionOperatorException;
use Thelia\Exception\InvalidConditionValueException;
use Thelia\Model\Category;
use Thelia\Model\CategoryImageQuery;
use Thelia\Model\CategoryQuery;
use Thelia\Tools\DateTimeFormat;
/**
* Check a Checkout against its Product number
*
* @package Condition
* @author Franck Allimant <franck@cqfdev.fr>
*
*/
class StartDate extends ConditionAbstract
{
const START_DATE = 'start_date';
/**
* @inheritdoc
*/
public function __construct(FacadeInterface $facade)
{
$this->availableOperators = [
self::START_DATE => [
Operators::SUPERIOR_OR_EQUAL
]
];
parent::__construct($facade);
}
/**
* @inheritdoc
*/
public function getServiceId()
{
return 'thelia.condition.start_date';
}
/**
* @inheritdoc
*/
public function setValidatorsFromForm(array $operators, array $values)
{
if (! isset($values[self::START_DATE])) {
$values[self::START_DATE] = time();
}
// Parse the entered date to get a timestamp, if we don't already have one
if (! is_int($values[self::START_DATE])) {
$date = \DateTime::createFromFormat($this->getDateFormat(), $values[self::START_DATE]);
// Check that the date is valid
if (false === $date) {
throw new InvalidConditionValueException(
get_class(), self::START_DATE
);
}
$timestamp = $date->getTimestamp();
}
else {
$timestamp = $values[self::START_DATE];
}
$this->operators = [ self::START_DATE => $operators[self::START_DATE] ];
$this->values = [ self::START_DATE => $timestamp ];
return $this;
}
/**
* @inheritdoc
*/
public function isMatching()
{
return $this->conditionValidator->variableOpComparison(
time(),
$this->operators[self::START_DATE],
$this->values[self::START_DATE]
);
}
/**
* @inheritdoc
*/
public function getName()
{
return $this->translator->trans(
'Start date',
[],
'condition'
);
}
/**
* @inheritdoc
*/
public function getToolTip()
{
$toolTip = $this->translator->trans(
'The coupon is valid after a given date',
[],
'condition'
);
return $toolTip;
}
/**
* @inheritdoc
*/
public function getSummary()
{
$i18nOperator = Operators::getI18n(
$this->translator, $this->operators[self::START_DATE]
);
$date = new \DateTime();
$date->setTimestamp($this->values[self::START_DATE]);
$strDate = $date->format($this->getDateFormat());
$toolTip = $this->translator->trans(
'Valid only from %date% to the coupon expiration date', [
'%date%' => $strDate,
], 'condition'
);
return $toolTip;
}
private function getDateFormat() {
return DateTimeFormat::getInstance($this->facade->getRequest())->getFormat("date");
}
/**
* @inheritdoc
*/
protected function generateInputs()
{
return array(
self::START_DATE => array(
'availableOperators' => $this->availableOperators[self::START_DATE],
'value' => '',
'selectedOperator' => Operators::SUPERIOR_OR_EQUAL
)
);
}
/**
* @inheritdoc
*/
public function drawBackOfficeInputs()
{
if (isset($this->values[self::START_DATE])) {
$date = new \DateTime();
$date->setTimestamp($this->values[self::START_DATE]);
$strDate = $date->format($this->getDateFormat());
}
else {
$strDate = '';
}
return $this->facade->getParser()->render('coupon/condition-fragments/start-date-condition.html', [
'fieldName' => self::START_DATE,
'criteria' => Operators::SUPERIOR_OR_EQUAL,
'dateFormat' => $this->getDateFormat(),
'currentValue' => $strDate
]);
}
}

View File

@@ -68,7 +68,7 @@ abstract class Operators
break;
case self::EQUAL:
$ret = $translator->trans(
'Equals',
'Equal to',
[],
'condition'
);
@@ -89,7 +89,7 @@ abstract class Operators
break;
case self::DIFFERENT:
$ret = $translator->trans(
'Not equals',
'Not equal to',
[],
'condition'
);

View File

@@ -34,6 +34,8 @@ return array(
'Available quantity *' => 'Available quantity *',
'Available shipping zones' => 'Available shipping zones',
'Bad tax list JSON' => 'Bad tax list JSON',
'Billing country condition' => 'Pays de facturation',
'Billing coutry is' => 'Le pays de facturation est',
'Business ID' => 'Business ID',
'By cart total amount' => 'By cart total amount',
'Cannot find a default country. Please define one.' => 'Cannot find a default country. Please define one.',
@@ -68,6 +70,8 @@ return array(
'Default product sale element' => 'Default product sale element',
'Deleting document for %id% with parent id %parentId%' => 'Deleting document for %id% with parent id %parentId%',
'Deleting image for %id% with parent id %parentId%' => 'Deleting image for %id% with parent id %parentId%',
'Delivery country condition' => 'Pays de livraison',
'Delivery coutry is' => 'Le pays de livraison est',
'Delivery module ID not found' => 'Delivery module ID not found',
'Description' => 'Description',
'Detailed description' => 'Detailed description',
@@ -81,7 +85,7 @@ return array(
'Emergency' => 'Emergency',
'Enable remote SMTP use' => 'Enable remote SMTP use',
'Encryption' => 'Encryption',
'Equals' => 'Equals',
'Equal to' => 'Egal à',
'Error during %action process : %error. Exception was %exc' => 'Error during %action process : %error. Exception was %exc',
'Error occured while processing order ref. %ref, ID %id: %err' => 'Error occured while processing order ref. %ref, ID %id: %err',
'Errors' => 'Errors',
@@ -157,10 +161,12 @@ return array(
'No module found for code \'%item\'' => 'No module found for code \'%item\'',
'No pagination currently defined for loop name \'%name\'' => 'No pagination currently defined for loop name \'%name\'',
'No, I am a new customer.' => 'No, I am a new customer.',
'Not equals' => 'Not equals',
'Not equal to' => 'Différent de',
'Not found' => 'Not found',
'Not in' => 'Not in',
'Notices' => 'Notices',
'Only if order billing country is %op% <strong>%countries_list%</strong>' => 'Le pays de facturation de la commande est %op% <strong>%countries_list%</strong> ',
'Only if order shipping country is %op% <strong>%countries_list%</strong>' => 'Le pays de livraison de la commande est %op% <strong>%countries_list%</strong> ',
'Order address ID not found' => 'Order address ID not found',
'Order ref. %ref is now unpaid.' => 'Order ref. %ref is now unpaid.',
'Order ref. %ref, ID %id has been successfully paid.' => 'Order ref. %ref, ID %id has been successfully paid.',
@@ -230,6 +236,7 @@ return array(
'Sorry, you are not allowed to perform this action.' => 'Sorry, you are not allowed to perform this action.',
'Sorry, you\'re not allowed to perform this action' => 'Sorry, you\'re not allowed to perform this action',
'Source IP' => 'Source IP',
'Start date' => 'Date de début de validité',
'Stats on %month/%year' => 'Stats on %month/%year',
'Store configuration failed.' => 'Store configuration failed.',
'Store email address' => 'Store email address',
@@ -253,6 +260,8 @@ return array(
'Text Message' => 'Text Message',
'The TaxEngine should be passed to this form before using it.' => 'The TaxEngine should be passed to this form before using it.',
'The cart item count should match the condition' => 'The cart item count should match the condition',
'The coupon applies to the selected delivery countries' => 'Ce code promo s\'applique seulement aux pays de facturation sélectionnés',
'The coupon is valid after a given date' => 'Le code promo est valide seulement à partir d\'une certaine date',
'The image which replaces an undefined country flag (%file) was not found. Please check unknown-flag-path configuration variable, and check that the image exists.' => 'The image which replaces an undefined country flag (%file) was not found. Please check unknown-flag-path configuration variable, and check that the image exists.',
'The loop name \'%name\' is already defined in %className class' => 'The loop name \'%name\' is already defined in %className class',
'This category is online.' => 'This category is online.',
@@ -287,6 +296,7 @@ return array(
'Unsupported magic method %name. only getArgname() is supported.' => 'Unsupported magic method %name. only getArgname() is supported.',
'Username' => 'Username',
'Username *' => 'Username *',
'Valid only from %date% to the coupon expiration date' => 'Valide à partir du %date% jusqu\'à la date d\'expiration',
'Value' => 'Value',
'Value *' => 'Value *',
'Warnings' => 'Warnings',
@@ -299,6 +309,7 @@ return array(
'Your current password does not match.' => 'Your current password does not match.',
'Zip code' => 'Zip code',
'date format' => 'date format',
'decimal separator' => 'Séparateur décimal',
'delivery module %s is not a Thelia\Module\DeliveryModuleInterface' => 'delivery module %s is not a Thelia\Module\DeliveryModuleInterface',
'language locale' => 'language locale',
'mailing system modification' => 'mailing system modification',
@@ -308,5 +319,6 @@ return array(
'permanent discount (in percent)' => 'permanent discount (in percent)',
'quantity value is not valid' => 'quantity value is not valid',
'this product id does not exists : %d' => 'this product id does not exists : %d',
'thousands separator' => 'Séparateur de milliers',
'time format' => 'time format',
);

View File

@@ -33,23 +33,54 @@
<service id="thelia.condition.factory" class="Thelia\Condition\ConditionFactory">
<argument type="service" id="service_container" />
</service>
<service id="thelia.condition.validator" class="Thelia\Condition\ConditionEvaluator">
</service>
<service id="thelia.condition.match_for_everyone" class="Thelia\Condition\Implementation\MatchForEveryone">
<argument type="service" id="thelia.facade" />
<tag name="thelia.coupon.addCondition"/>
</service>
<service id="thelia.condition.match_for_total_amount" class="Thelia\Condition\Implementation\MatchForTotalAmount">
<argument type="service" id="thelia.facade" />
<tag name="thelia.coupon.addCondition"/>
</service>
<service id="thelia.condition.match_for_x_articles" class="Thelia\Condition\Implementation\MatchForXArticles">
<argument type="service" id="thelia.facade" />
<tag name="thelia.coupon.addCondition"/>
</service>
<service id="thelia.condition.match_delivery_countries" class="Thelia\Condition\Implementation\MatchDeliveryCountries">
<argument type="service" id="thelia.facade" />
<tag name="thelia.coupon.addCondition"/>
</service>
<service id="thelia.condition.match_billing_countries" class="Thelia\Condition\Implementation\MatchBillingCountries">
<argument type="service" id="thelia.facade" />
<tag name="thelia.coupon.addCondition"/>
</service>
<service id="thelia.condition.start_date" class="Thelia\Condition\Implementation\StartDate">
<argument type="service" id="thelia.facade" />
<tag name="thelia.coupon.addCondition"/>
</service>
<service id="thelia.condition.cart_contains_categories" class="Thelia\Condition\Implementation\CartContainsCategories">
<argument type="service" id="thelia.facade" />
<tag name="thelia.coupon.addCondition"/>
</service>
<service id="thelia.condition.cart_contains_products" class="Thelia\Condition\Implementation\CartContainsProducts">
<argument type="service" id="thelia.facade" />
<tag name="thelia.coupon.addCondition"/>
</service>
<service id="thelia.condition.for_some_customers" class="Thelia\Condition\Implementation\ForSomeCustomers">
<argument type="service" id="thelia.facade" />
<tag name="thelia.coupon.addCondition"/>
</service>
</services>

View File

@@ -12,6 +12,7 @@
namespace Thelia\Core\Template\Smarty\Assets;
use Symfony\Component\Finder\Finder;
use Thelia\Log\Tlog;
use Thelia\Tools\URL;
use Thelia\Core\Template\Assets\AssetManagerInterface;
@@ -142,8 +143,14 @@ class SmartyAssetsManager
}
$url = "";
// test if file exists before running the process
if (file_exists($assetSource . DS . $file)) {
$finder = new Finder();
$files = $finder->files()->in($assetSource)->name($file);
if (! empty($files)) {
$url = $this->assetsManager->processAsset(
$assetSource . DS . $file,
$assetSource . DS . self::$assetsDirectory,
@@ -156,6 +163,9 @@ class SmartyAssetsManager
$debug
);
}
else {
Tlog::getInstance()->addError("Asset $assetSource".DS."$file was not found.");
}
return $url;
}

View File

@@ -20,6 +20,7 @@ use Thelia\Condition\ConditionEvaluator;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\Template\ParserInterface;
use Thelia\Core\Template\TemplateHelper;
use Thelia\Model\AddressQuery;
use Thelia\Model\Coupon;
use Thelia\Model\CouponQuery;
use Thelia\Cart\CartTrait;
@@ -75,7 +76,12 @@ class BaseFacade implements FacadeInterface
*/
public function getDeliveryAddress()
{
// @todo: Implement getDeliveryAddress() method.
try {
return AddressQuery::create()->findPk($this->getRequest()->getSession()->getOrder()->chosenDeliveryAddress);
}
catch(\Exception $ex) {
throw new \LogicException("Failed to get delivery address (" . $ex->getMessage() . ")");
}
}
/**

View File

@@ -111,7 +111,7 @@ class CouponManager
/** @var CouponInterface $coupon */
foreach ($coupons as $coupon) {
if (!$coupon->isExpired()) {
if ($coupon && !$coupon->isExpired()) {
if ($coupon->isCumulative()) {
if (isset($couponsKept[0])) {
/** @var CouponInterface $previousCoupon */

View File

@@ -101,12 +101,12 @@ class ConditionCollectionTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::EQUAL,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400,
MatchForTotalAmount::INPUT2 => 'EUR');
MatchForTotalAmount::CART_TOTAL => 400,
MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$collection = new ConditionCollection();
@@ -138,22 +138,22 @@ class ConditionCollectionTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators1 = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values1 = array(
MatchForTotalAmount::INPUT1 => 400,
MatchForTotalAmount::INPUT2 => 'EUR');
MatchForTotalAmount::CART_TOTAL => 400,
MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators1, $values1);
$condition2 = new MatchForTotalAmount($stubFacade);
$operators2 = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values2 = array(
MatchForTotalAmount::INPUT1 => 600,
MatchForTotalAmount::INPUT2 => 'EUR');
MatchForTotalAmount::CART_TOTAL => 600,
MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition2->setValidatorsFromForm($operators2, $values2);
$collection = new ConditionCollection();

View File

@@ -81,12 +81,12 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 40.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -145,12 +145,12 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 40.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -207,23 +207,23 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 40.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);
$condition2 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition2->setValidatorsFromForm($operators, $values);
@@ -286,12 +286,12 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue($stubContainer));
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 40.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -351,12 +351,12 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue($stubContainer));
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 40.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);

View File

@@ -94,12 +94,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::IN,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::IN,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => '400',
MatchForTotalAmount::INPUT2 => 'EUR');
MatchForTotalAmount::CART_TOTAL => '400',
MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -123,12 +123,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::INFERIOR
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::INFERIOR
);
$values = array(
MatchForTotalAmount::INPUT1 => '400',
MatchForTotalAmount::INPUT2 => 'EUR');
MatchForTotalAmount::CART_TOTAL => '400',
MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -152,12 +152,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 'X',
MatchForTotalAmount::INPUT2 => 'EUR');
MatchForTotalAmount::CART_TOTAL => 'X',
MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -181,12 +181,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400,
MatchForTotalAmount::INPUT2 => 'FLA');
MatchForTotalAmount::CART_TOTAL => 400,
MatchForTotalAmount::CART_CURRENCY => 'FLA');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -209,12 +209,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -237,12 +237,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -265,12 +265,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR_OR_EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR_OR_EQUAL,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -293,12 +293,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR_OR_EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR_OR_EQUAL,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -321,12 +321,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR_OR_EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR_OR_EQUAL,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -349,12 +349,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::EQUAL,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -377,12 +377,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::EQUAL,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -405,12 +405,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR_OR_EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR_OR_EQUAL,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -433,12 +433,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR_OR_EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR_OR_EQUAL,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -461,12 +461,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR_OR_EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR_OR_EQUAL,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -489,12 +489,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -517,12 +517,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -545,12 +545,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::EQUAL,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -573,12 +573,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::EQUAL,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'USD');
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'USD');
$condition1->setValidatorsFromForm($operators, $values);
$isValid = $condition1->isMatching();
@@ -621,12 +621,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::EQUAL,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'UNK');
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'UNK');
$condition1->setValidatorsFromForm($operators, $values);
$stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container')
@@ -686,12 +686,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::EQUAL,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 'notfloat',
MatchForTotalAmount::INPUT2 => 'EUR');
MatchForTotalAmount::CART_TOTAL => 'notfloat',
MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container')
@@ -751,12 +751,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::EQUAL,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 0.00,
MatchForTotalAmount::INPUT2 => 'EUR');
MatchForTotalAmount::CART_TOTAL => 0.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$stubContainer = $this->getMockBuilder('\Symfony\Component\DependencyInjection\Container')
@@ -863,12 +863,12 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::EQUAL,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$actual = $condition1->getToolTip();
@@ -889,19 +889,19 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::EQUAL,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::EQUAL,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR');
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR');
$condition1->setValidatorsFromForm($operators, $values);
$actual = $condition1->getValidators();
$validators = array(
'inputs' => array(
MatchForTotalAmount::INPUT1 => array(
MatchForTotalAmount::CART_TOTAL => array(
'availableOperators' => array(
'<' => 'Price',
'<=' => 'Price',
@@ -913,7 +913,7 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase
'value' => '',
'selectedOperator' => ''
),
MatchForTotalAmount::INPUT2 => array(
MatchForTotalAmount::CART_CURRENCY => array(
'availableOperators' => array('==' => 'Price'),
'availableValues' => array(
'EUR' => '€',

View File

@@ -59,10 +59,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticles::INPUT1 => Operators::IN
MatchForXArticles::CART_QUANTITY => Operators::IN
);
$values = array(
MatchForXArticles::INPUT1 => 5
MatchForXArticles::CART_QUANTITY => 5
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -95,10 +95,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticles::INPUT1 => Operators::SUPERIOR
MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR
);
$values = array(
MatchForXArticles::INPUT1 => 'X'
MatchForXArticles::CART_QUANTITY => 'X'
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -131,10 +131,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticles::INPUT1 => Operators::INFERIOR
MatchForXArticles::CART_QUANTITY => Operators::INFERIOR
);
$values = array(
MatchForXArticles::INPUT1 => 5
MatchForXArticles::CART_QUANTITY => 5
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -167,10 +167,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticles::INPUT1 => Operators::INFERIOR
MatchForXArticles::CART_QUANTITY => Operators::INFERIOR
);
$values = array(
MatchForXArticles::INPUT1 => 4,
MatchForXArticles::CART_QUANTITY => 4,
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -203,10 +203,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticles::INPUT1 => Operators::INFERIOR_OR_EQUAL,
MatchForXArticles::CART_QUANTITY => Operators::INFERIOR_OR_EQUAL,
);
$values = array(
MatchForXArticles::INPUT1 => 5,
MatchForXArticles::CART_QUANTITY => 5,
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -239,10 +239,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticles::INPUT1 => Operators::INFERIOR_OR_EQUAL
MatchForXArticles::CART_QUANTITY => Operators::INFERIOR_OR_EQUAL
);
$values = array(
MatchForXArticles::INPUT1 => 4
MatchForXArticles::CART_QUANTITY => 4
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -275,10 +275,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticles::INPUT1 => Operators::INFERIOR_OR_EQUAL
MatchForXArticles::CART_QUANTITY => Operators::INFERIOR_OR_EQUAL
);
$values = array(
MatchForXArticles::INPUT1 => 3
MatchForXArticles::CART_QUANTITY => 3
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -311,10 +311,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticles::INPUT1 => Operators::EQUAL
MatchForXArticles::CART_QUANTITY => Operators::EQUAL
);
$values = array(
MatchForXArticles::INPUT1 => 4
MatchForXArticles::CART_QUANTITY => 4
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -347,10 +347,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticles::INPUT1 => Operators::EQUAL
MatchForXArticles::CART_QUANTITY => Operators::EQUAL
);
$values = array(
MatchForXArticles::INPUT1 => 5
MatchForXArticles::CART_QUANTITY => 5
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -383,10 +383,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticles::INPUT1 => Operators::SUPERIOR_OR_EQUAL
MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR_OR_EQUAL
);
$values = array(
MatchForXArticles::INPUT1 => 4
MatchForXArticles::CART_QUANTITY => 4
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -419,10 +419,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticles::INPUT1 => Operators::SUPERIOR_OR_EQUAL
MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR_OR_EQUAL
);
$values = array(
MatchForXArticles::INPUT1 => 3
MatchForXArticles::CART_QUANTITY => 3
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -455,10 +455,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticles::INPUT1 => Operators::SUPERIOR_OR_EQUAL
MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR_OR_EQUAL
);
$values = array(
MatchForXArticles::INPUT1 => 5
MatchForXArticles::CART_QUANTITY => 5
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -491,10 +491,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticles::INPUT1 => Operators::SUPERIOR
MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR
);
$values = array(
MatchForXArticles::INPUT1 => 3
MatchForXArticles::CART_QUANTITY => 3
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -527,10 +527,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticles::INPUT1 => Operators::SUPERIOR
MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR
);
$values = array(
MatchForXArticles::INPUT1 => 4
MatchForXArticles::CART_QUANTITY => 4
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -557,10 +557,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticles::INPUT1 => Operators::SUPERIOR
MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR
);
$values = array(
MatchForXArticles::INPUT1 => 4
MatchForXArticles::CART_QUANTITY => 4
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -577,44 +577,6 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
}
public function testGetAvailableOperators()
{
/** @var FacadeInterface $stubFacade */
$stubFacade = $this->getMockBuilder('\Thelia\Coupon\BaseFacade')
->disableOriginalConstructor()
->getMock();
$stubFacade->expects($this->any())
->method('getNbArticlesInCart')
->will($this->returnValue(4));
$stubFacade->expects($this->any())
->method('getConditionEvaluator')
->will($this->returnValue(new ConditionEvaluator()));
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticles::INPUT1 => Operators::SUPERIOR
);
$values = array(
MatchForXArticles::INPUT1 => 4
);
$condition1->setValidatorsFromForm($operators, $values);
$expected = array(
MatchForXArticles::INPUT1 => array(
Operators::INFERIOR,
Operators::INFERIOR_OR_EQUAL,
Operators::EQUAL,
Operators::SUPERIOR_OR_EQUAL,
Operators::SUPERIOR
)
);
$actual = $condition1->getAvailableOperators();
$this->assertEquals($expected, $actual);
}
/**
* Generate adapter stub
*
@@ -687,10 +649,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticles::INPUT1 => Operators::SUPERIOR
MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR
);
$values = array(
MatchForXArticles::INPUT1 => 4
MatchForXArticles::CART_QUANTITY => 4
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -712,10 +674,10 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
/** @var FacadeInterface $stubFacade */
$condition1 = new MatchForXArticles($stubFacade);
$operators = array(
MatchForXArticles::INPUT1 => Operators::SUPERIOR
MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR
);
$values = array(
MatchForXArticles::INPUT1 => 4
MatchForXArticles::CART_QUANTITY => 4
);
$condition1->setValidatorsFromForm($operators, $values);
@@ -723,7 +685,7 @@ class MatchForXArticlesTest extends \PHPUnit_Framework_TestCase
$validators = array(
'inputs' => array(
MatchForXArticles::INPUT1 => array(
MatchForXArticles::CART_QUANTITY => array(
'availableOperators' => array(
'<' => 'Price',
'<=' => 'Price',

View File

@@ -52,7 +52,7 @@ class OperatorsTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expected, $actual);
$actual = Operators::getI18n($stubTranslator, Operators::EQUAL);
$expected = 'Equals';
$expected = 'Equal to';
$this->assertEquals($expected, $actual);
$actual = Operators::getI18n($stubTranslator, Operators::SUPERIOR_OR_EQUAL);
@@ -64,7 +64,7 @@ class OperatorsTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expected, $actual);
$actual = Operators::getI18n($stubTranslator, Operators::DIFFERENT);
$expected = 'Not equals';
$expected = 'Not equal to';
$this->assertEquals($expected, $actual);
$actual = Operators::getI18n($stubTranslator, Operators::IN);

View File

@@ -114,23 +114,23 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$condition1 = new MatchForTotalAmount($facade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 40.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);
$condition2 = new MatchForTotalAmount($facade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition2->setValidatorsFromForm($operators, $values);
@@ -176,23 +176,23 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 40.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);
$condition2 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition2->setValidatorsFromForm($operators, $values);
@@ -274,23 +274,23 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 40.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);
$condition2 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition2->setValidatorsFromForm($operators, $values);
@@ -337,23 +337,23 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 40.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);
$condition2 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition2->setValidatorsFromForm($operators, $values);
@@ -397,23 +397,23 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 40.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);
$condition2 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition2->setValidatorsFromForm($operators, $values);

View File

@@ -75,23 +75,23 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$condition1 = new MatchForTotalAmount($facade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 40.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);
$condition2 = new MatchForTotalAmount($facade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition2->setValidatorsFromForm($operators, $values);
@@ -339,23 +339,23 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 40.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);
$condition2 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition2->setValidatorsFromForm($operators, $values);
@@ -394,23 +394,23 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 40.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);
$condition2 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition2->setValidatorsFromForm($operators, $values);
@@ -459,23 +459,23 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 40.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);
$condition2 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition2->setValidatorsFromForm($operators, $values);

View File

@@ -118,23 +118,23 @@ class RemoveXAmountTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 40.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);
$condition2 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition2->setValidatorsFromForm($operators, $values);

View File

@@ -107,23 +107,23 @@ class RemoveXPercentTest extends \PHPUnit_Framework_TestCase
$condition1 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 40.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);
$condition2 = new MatchForTotalAmount($stubFacade);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition2->setValidatorsFromForm($operators, $values);

View File

@@ -694,23 +694,23 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$condition1 = new MatchForTotalAmount($adapter);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::SUPERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::SUPERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 40.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 40.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition1->setValidatorsFromForm($operators, $values);
$condition2 = new MatchForTotalAmount($adapter);
$operators = array(
MatchForTotalAmount::INPUT1 => Operators::INFERIOR,
MatchForTotalAmount::INPUT2 => Operators::EQUAL
MatchForTotalAmount::CART_TOTAL => Operators::INFERIOR,
MatchForTotalAmount::CART_CURRENCY => Operators::EQUAL
);
$values = array(
MatchForTotalAmount::INPUT1 => 400.00,
MatchForTotalAmount::INPUT2 => 'EUR'
MatchForTotalAmount::CART_TOTAL => 400.00,
MatchForTotalAmount::CART_CURRENCY => 'EUR'
);
$condition2->setValidatorsFromForm($operators, $values);
@@ -754,10 +754,10 @@ Sed facilisis pellentesque nisl, eu tincidunt erat scelerisque a. Nullam malesua
$condition1 = new MatchForXArticles($adapter);
$operators = array(
MatchForXArticles::INPUT1 => Operators::SUPERIOR,
MatchForXArticles::CART_QUANTITY => Operators::SUPERIOR,
);
$values = array(
MatchForXArticles::INPUT1 => 4,
MatchForXArticles::CART_QUANTITY => 4,
);
$condition1->setValidatorsFromForm($operators, $values);
$conditions = new ConditionCollection();

View File

@@ -490,6 +490,7 @@ return array(
'Folder title' => 'Folder title',
'Folders' => 'Folders',
'Folders in %fold' => 'Folders in %fold',
'Format: %fmt' => 'Format: %fmt ',
'Format: %fmt, e.g. %date' => 'Format: %fmt, e.g. %date',
'French 19.6% VAT is a tax which add a 19.6% tax to the product price.' => 'French 19.6% VAT is a tax which add a 19.6% tax to the product price.',
'French 19.6% VAT with ecotax is the applicance of the ecotax (on the product price) then the applicance of the 19.6% tax (on the product price + the ecotax amount).' => 'French 19.6% VAT with ecotax is the applicance of the ecotax (on the product price) then the applicance of the 19.6% tax (on the product price + the ecotax amount).',
@@ -633,6 +634,7 @@ return array(
'Period' => 'Period',
'Phone' => 'Phone',
'Phone number' => 'Phone number',
'Please enter the date using the %fmt format' => 'Merci d\'indiquer une date au format %fmt',
'Please retry' => 'Please retry',
'Please save this coupon first to define coupon conditions' => 'Please save this coupon first to define coupon conditions',
'Please select a condition' => 'Please select a condition',
@@ -773,6 +775,8 @@ return array(
'Short description :' => 'Short description :',
'Show logs' => 'Show logs',
'Some of your translations are not saved. Continue anyway ?' => 'Some of your translations are not saved. Continue anyway ?',
'Something goes wrong, please try again' => 'Une erreur est survenue, merci de ré-essayer',
'Something goes wrong, please try again.' => 'Une erreur est survenue, merci de ré-essayer.',
'Sorry, attribute ID=%id was not found.' => 'Sorry, attribute ID=%id was not found.',
'Sorry, country ID=%id was not found.' => 'Sorry, country ID=%id was not found.',
'Sorry, currency ID=%id was not found.' => 'Sorry, currency ID=%id was not found.',
@@ -822,6 +826,7 @@ return array(
'The mailing template in text-only format.' => 'The mailing template in text-only format.',
'The page you\'ve requested was not found. Please check the page address, and try again.' => 'The page you\'ve requested was not found. Please check the page address, and try again.',
'The rate from Euro (Price in Euro * rate = Price in this currency)' => 'The rate from Euro (Price in Euro * rate = Price in this currency)',
'The selected countries :' => 'Les pays sélectionnés :',
'The server returned a "404 Not Found"' => 'The server returned a "404 Not Found"',
'The symbol, such as &#36;, £, &euro;...' => 'The symbol, such as $, £, €...',
'The syntax used is identical to the PHP <a href="http://www.php.net/date" target="_other">date()</a> function' => 'The syntax used is identical to the PHP <a href="http://www.php.net/date" target="_other">date()</a> function',
@@ -836,7 +841,6 @@ return array(
'Thelia Shipping zones' => 'Thelia Shipping zones',
'Thelia System Variables' => 'Thelia System Variables',
'Thelia caches flushing' => 'Thelia caches flushing',
'Thelia configuration' => 'Thelia configuration',
'Thelia contributions' => 'Thelia contributions',
'Thelia core' => 'Thelia core',
'Thelia informations' => 'Thelia information',
@@ -846,7 +850,6 @@ return array(
'Thelia product templates' => 'Thelia product templates',
'Thelia support forum' => 'Thelia support forum',
'Thelia system variables' => 'Thelia system variables',
'Thelia tools' => 'Thelia tools',
'Thelia, the open source e-commerce solution' => 'Thelia, the open source e-commerce solution',
'There are no shipping zones attached to this module.' => 'There are no shipping zones attached to this module.',
'There is currently no active module here.' => 'There is currently no active module here.',
@@ -918,6 +921,7 @@ return array(
'Update this image' => 'Update this image',
'Usage count' => 'Usage count',
'Usages left' => 'Usages left',
'Use Ctrl+click to select (or deselect) more that one country' => 'Utiliser Ctrl+clic pour sélectionner (ou dé-sélectionner) plusieurs pays.',
'Use Ctrl+click to select more than one value. You can also <a href="#" class="clear_feature_value" data-id="%id">clear selected values</a>.' => 'Use Ctrl+click to select more than one value. You can also <a href="#" class="clear_feature_value" data-id="%id">clear selected values</a>.',
'Use HTML message defined below' => 'Use HTML message defined below',
'Use Text message defined below' => 'Use Text message defined below',
@@ -930,6 +934,7 @@ return array(
'Username :' => 'Username :',
'Using a domain or subdomain for each language' => 'Using a domain or subdomain for each language',
'Valid on special offers' => 'Valid on special offers',
'Validity start date' => 'Date de début de validité',
'Value' => 'Value',
'Variable created on %date_create. Last modification: %date_change' => 'Variable created on %date_create. Last modification: %date_change',
'Variable name' => 'Variable name',
@@ -971,7 +976,6 @@ return array(
'company' => 'company',
'customer ref' => 'customer ref',
'd-m-Y' => 'd-m-Y',
'date form' => 'date form',
'date in yyyy-mm-dd format' => 'date in yyyy-mm-dd format',
'deactivate' => 'deactivate',
'deactivation' => 'deactivation',
@@ -988,7 +992,6 @@ return array(
'short description' => 'short description',
'tax rules' => 'tax rules',
'taxes' => 'taxes',
'time form' => 'time form',
'title' => 'title',
'tracking reference' => 'tracking reference',
'uncheck all' => 'uncheck all',

View File

@@ -105,6 +105,7 @@ $(function($){
$.couponManager.intlPleaseRetry
);
}).always(function() {
$('#condition-save-btn').hide();
// Reload condition summaries ajax
$.couponManager.displayConditionsSummary();
});

View File

@@ -42,7 +42,7 @@
$(function($){
// Url alowing to get coupon inputs
$.couponManager.urlAjaxAdminCouponDrawInputs = "{$urlAjaxAdminCouponDrawInputs}";
$.couponManager.intlPleaseRetry = '{intl l='Please retry'}';
$.couponManager.intlPleaseRetry = '{intl l='Something goes wrong, please try again.'}';
$.couponManager.intlDoYouReallyWantToSetCouponAvailableForEveryOne = '{intl l='Do you really want to set this coupon available to everyone ?'}';
$.couponManager.intlDoYouReallyWantToDeleteThisCondition = '{intl l='Do you really want to delete this condition ?'}';
});

View File

@@ -49,7 +49,7 @@
$.couponManager.urlAjaxAdminCouponDrawInputs = '{$urlAjaxAdminCouponDrawInputs}';
$.couponManager.urlAjaxGetConditionInputFromServiceId = '{$urlAjaxGetConditionInputFromServiceId}';
$.couponManager.urlAjaxGetConditionInputFromConditionInterface = '{$urlAjaxGetConditionInputFromConditionInterface}';
$.couponManager.intlPleaseRetry = '{intl l='Please retry'}';
$.couponManager.intlPleaseRetry = '{intl l='Something goes wrong, please try again'}';
$.couponManager.intlPleaseSelectAnotherCondition = '{intl l='Please select another condition'}';
$.couponManager.intlDoYouReallyWantToSetCouponAvailableForEveryOne = '{intl l='Do you really want to set this coupon available to everyone ?'}';
$.couponManager.intlDoYouReallyWantToDeleteThisCondition = '{intl l='Do you really want to delete this condition ?'}';

View File

@@ -0,0 +1,14 @@
<div class="form-group">
<label for="operator">{intl l="Products are :"}</label>
{$operatorSelectHtml nofilter}
</div>
<div class="form-group">
<label for="{$categories_field_name}-value">{intl l="The selected categories :"}</label>
<select required multiple size="5" class="form-control" id="{$categories_field_name}-value" name="{$categories_field_name}[value][]">
{loop type="category-tree" category=0 name="list-of-categories"}
<option style="padding-left: {$LEVEL * 20}px" value="{$ID}" {if in_array($ID, $values)}selected="selected"{/if}>{$TITLE}</option>
{/loop}
</select>
<span class="label-help-block">{intl l='Use Ctrl+click to select (or deselect) more that one category'}</span>
</div>

View File

@@ -0,0 +1,14 @@
<div class="form-group">
<label for="operator">{intl l="Products are :"}</label>
{$operatorSelectHtml nofilter}
</div>
<div class="form-group">
<label for="{$products_field_name}-value">{intl l="The selected products :"}</label>
<select required multiple size="5" class="form-control" id="{$products_field_name}-value" name="{$products_field_name}[value][]">
{loop type="product" name="list-of-products" order="alpha"}
<option value="{$ID}" {if in_array($ID, $values)}selected="selected"{/if}>{$TITLE}</option>
{/loop}
</select>
<span class="label-help-block">{intl l='Use Ctrl+click to select (or deselect) more that one product'}</span>
</div>

View File

@@ -0,0 +1,14 @@
<div class="form-group">
<label for="operator">{$countryLabel}</label>
{$operatorSelectHtml nofilter}
</div>
<div class="form-group">
<label for="{$countries_field_name}-value">{intl l="The selected countries :"}</label>
<select required multiple size="5" class="form-control" id="{$countries_field_name}-value" name="{$countries_field_name}[value][]">
{loop type="country" name="list-of-countries" order="alpha"}
<option style="padding-left: {$LEVEL * 20}px" value="{$ID}" {if in_array($ID, $values)}selected="selected"{/if}>{$TITLE}</option>
{/loop}
</select>
<span class="label-help-block">{intl l='Use Ctrl+click to select (or deselect) more that one country'}</span>
</div>

View File

@@ -0,0 +1,14 @@
<div class="form-group">
<label for="operator">{intl l="Customer is"}</label>
{$operatorSelectHtml nofilter}
</div>
<div class="form-group">
<label for="{$customers_field_name}-value">{intl l="The selected customer :"}</label>
<select required multiple size="5" class="form-control" id="{$customers_field_name}-value" name="{$customers_field_name}[value][]">
{loop type="customer" name="list-of-customers" order="lastname,firstname" current="0" backend_context="1"}
<option value="{$ID}" {if in_array($ID, $values)}selected="selected"{/if}>{$LASTNAME} {$FIRSTNAME} {$REF}</option>
{/loop}
</select>
<span class="label-help-block">{intl l='Use Ctrl+click to select (or deselect) more that one country'}</span>
</div>

View File

@@ -0,0 +1,7 @@
<input type="hidden" name="{$fieldName}[operator]" value="{$criteria}" />
<div id="condition-add-operators-values" class="form-group">
<label for="operator">{intl l="Validity start date"} :</label>
<input type="text" class="form-control" id="{$fieldName}-value" name="{$fieldName}[value]" value="{$currentValue}" placeholder="{intl l="Format: %fmt" fmt=$dateFormat}">
<span class="label-help-block">{intl l='Please enter the date using the %fmt format' fmt=$dateFormat}</span>
</div>