diff --git a/.travis.yml b/.travis.yml
index 8516ac373..e70261a18 100755
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,7 +4,6 @@ php:
- 5.4
- 5.5
- 5.6
- - hhvm
env:
- DB_USER=root
@@ -23,5 +22,4 @@ before_script:
matrix:
allow_failures:
- - php: hhvm
- php: 5.6
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ad7250484..b178114ba 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,21 @@
- Fix bugs on customer change password form and module "order by title"
- Add the ability to place a firewall on forms. To use this in a module, extend Thelia\Form\FirewallForm instead of BaseForm
- Add Exports and Imports management
+- Default front office template:
+ - Display enhancement
+ - Optimization of the uses of Thelia loops to gain performances and consistency
+ - Optimization for SEO : meta description fallback, ti>>>>>>> Updated Changelog
+tle on category page, ...
+ - new PSE layout in product page, attributes are separated
+ - Support of 'check-available-stock' config variable
+ - Terms and conditions agreement is now in the order process
+- Default pdf template:
+ - Added list of amount by tax rule
+ - Display enhancement
+ - Added legal information about the store
+- Demo:
+ - Support for brand
+ - Added folders and contents data.
#2.0.2
- Coupon UI has been redesigned.
diff --git a/core/lib/Thelia/Action/Product.php b/core/lib/Thelia/Action/Product.php
index 9cef94218..e0d750905 100644
--- a/core/lib/Thelia/Action/Product.php
+++ b/core/lib/Thelia/Action/Product.php
@@ -92,7 +92,7 @@ class Product extends BaseAction implements EventSubscriberInterface
$product
->setDispatcher($event->getDispatcher())
-
+ ->setRef($event->getRef())
->setLocale($event->getLocale())
->setTitle($event->getTitle())
->setDescription($event->getDescription())
@@ -269,9 +269,9 @@ class Product extends BaseAction implements EventSubscriberInterface
$product = $event->getProduct();
// Delete all product feature relations
- if(null !== $featureProducts = FeatureProductQuery::create()->findByProductId($product->getId())){
+ if (null !== $featureProducts = FeatureProductQuery::create()->findByProductId($product->getId())) {
/** @var \Thelia\Model\FeatureProduct $featureProduct */
- foreach($featureProducts as $featureProduct){
+ foreach ($featureProducts as $featureProduct) {
$eventDelete = new FeatureProductDeleteEvent($product->getId(), $featureProduct->getFeatureId());
$event->getDispatcher()->dispatch(TheliaEvents::PRODUCT_FEATURE_DELETE_VALUE, $eventDelete);
diff --git a/core/lib/Thelia/Condition/Implementation/CartContainsCategories.php b/core/lib/Thelia/Condition/Implementation/CartContainsCategories.php
index 6a1208456..6dbceed88 100644
--- a/core/lib/Thelia/Condition/Implementation/CartContainsCategories.php
+++ b/core/lib/Thelia/Condition/Implementation/CartContainsCategories.php
@@ -121,8 +121,7 @@ class CartContainsCategories extends ConditionAbstract
{
return $this->translator->trans(
'Cart contains categories condition',
- [],
- 'condition'
+ []
);
}
@@ -133,8 +132,7 @@ class CartContainsCategories extends ConditionAbstract
{
$toolTip = $this->translator->trans(
'The coupon applies if the cart contains at least one product of the selected categories',
- [],
- 'condition'
+ []
);
return $toolTip;
@@ -167,7 +165,7 @@ class CartContainsCategories extends ConditionAbstract
'At least one of cart products categories is %op% %categories_list%', [
'%categories_list%' => $catStrList,
'%op%' => $i18nOperator
- ], 'condition'
+ ]
);
return $toolTip;
diff --git a/core/lib/Thelia/Condition/Implementation/CartContainsProducts.php b/core/lib/Thelia/Condition/Implementation/CartContainsProducts.php
index 2d0f25ce6..b5c47c22a 100644
--- a/core/lib/Thelia/Condition/Implementation/CartContainsProducts.php
+++ b/core/lib/Thelia/Condition/Implementation/CartContainsProducts.php
@@ -113,8 +113,7 @@ class CartContainsProducts extends ConditionAbstract
{
return $this->translator->trans(
'Cart contains specific products',
- [],
- 'condition'
+ []
);
}
@@ -125,8 +124,7 @@ class CartContainsProducts extends ConditionAbstract
{
$toolTip = $this->translator->trans(
'The coupon applies if the cart contains at least one product of the specified product list',
- [],
- 'condition'
+ []
);
return $toolTip;
@@ -159,7 +157,7 @@ class CartContainsProducts extends ConditionAbstract
'Cart contains at least a product %op% %products_list%', [
'%products_list%' => $prodStrList,
'%op%' => $i18nOperator
- ], 'condition'
+ ]
);
return $toolTip;
diff --git a/core/lib/Thelia/Condition/Implementation/ForSomeCustomers.php b/core/lib/Thelia/Condition/Implementation/ForSomeCustomers.php
index b7b66a3d6..9cc239776 100644
--- a/core/lib/Thelia/Condition/Implementation/ForSomeCustomers.php
+++ b/core/lib/Thelia/Condition/Implementation/ForSomeCustomers.php
@@ -104,8 +104,7 @@ class ForSomeCustomers extends ConditionAbstract
{
return $this->translator->trans(
'For one ore more customers',
- [],
- 'condition'
+ []
);
}
@@ -116,8 +115,7 @@ class ForSomeCustomers extends ConditionAbstract
{
$toolTip = $this->translator->trans(
'The coupon applies to some customers only',
- [],
- 'condition'
+ []
);
return $toolTip;
@@ -150,7 +148,7 @@ class ForSomeCustomers extends ConditionAbstract
'Customer is %op% %customer_list%', [
'%customer_list%' => $custStrList,
'%op%' => $i18nOperator
- ], 'condition'
+ ]
);
return $toolTip;
diff --git a/core/lib/Thelia/Condition/Implementation/MatchBillingCountries.php b/core/lib/Thelia/Condition/Implementation/MatchBillingCountries.php
index 6c5afa3e7..1421fa041 100644
--- a/core/lib/Thelia/Condition/Implementation/MatchBillingCountries.php
+++ b/core/lib/Thelia/Condition/Implementation/MatchBillingCountries.php
@@ -50,8 +50,7 @@ class MatchBillingCountries extends AbstractMatchCountries
{
return $this->translator->trans(
'Billing country',
- [],
- 'condition'
+ []
);
}
@@ -61,9 +60,8 @@ class MatchBillingCountries extends AbstractMatchCountries
public function getToolTip()
{
$toolTip = $this->translator->trans(
- 'The coupon applies to the selected delivery countries',
- [],
- 'condition'
+ 'The coupon applies to the selected billing countries',
+ []
);
return $toolTip;
@@ -75,14 +73,14 @@ class MatchBillingCountries extends AbstractMatchCountries
'Only if order billing country is %op% %countries_list%', [
'%countries_list%' => $cntryStrList,
'%op%' => $i18nOperator
- ], 'condition'
+ ]
);
}
protected function getFormLabel()
{
return $this->translator->trans(
- 'Billing coutry is', [], 'condition'
+ 'Billing country is', []
);
}
}
diff --git a/core/lib/Thelia/Condition/Implementation/MatchDeliveryCountries.php b/core/lib/Thelia/Condition/Implementation/MatchDeliveryCountries.php
index c10b531e7..0bc58795b 100644
--- a/core/lib/Thelia/Condition/Implementation/MatchDeliveryCountries.php
+++ b/core/lib/Thelia/Condition/Implementation/MatchDeliveryCountries.php
@@ -50,8 +50,7 @@ class MatchDeliveryCountries extends AbstractMatchCountries
{
return $this->translator->trans(
'Delivery country',
- [],
- 'condition'
+ []
);
}
@@ -62,8 +61,7 @@ class MatchDeliveryCountries extends AbstractMatchCountries
{
$toolTip = $this->translator->trans(
'The coupon applies to the selected delivery countries',
- [],
- 'condition'
+ []
);
return $toolTip;
@@ -75,14 +73,14 @@ class MatchDeliveryCountries extends AbstractMatchCountries
'Only if order shipping country is %op% %countries_list%', [
'%countries_list%' => $cntryStrList,
'%op%' => $i18nOperator
- ], 'condition'
+ ]
);
}
protected function getFormLabel()
{
return $this->translator->trans(
- 'Delivery coutry is', [], 'condition'
+ 'Delivery country is', []
);
}
}
diff --git a/core/lib/Thelia/Condition/Implementation/MatchForEveryone.php b/core/lib/Thelia/Condition/Implementation/MatchForEveryone.php
index f9ee59894..210dd7023 100644
--- a/core/lib/Thelia/Condition/Implementation/MatchForEveryone.php
+++ b/core/lib/Thelia/Condition/Implementation/MatchForEveryone.php
@@ -68,8 +68,7 @@ class MatchForEveryone extends ConditionAbstract
{
return $this->translator->trans(
'Unconditional usage',
- [],
- 'condition'
+ []
);
}
@@ -80,8 +79,7 @@ class MatchForEveryone extends ConditionAbstract
{
$toolTip = $this->translator->trans(
'This condition is always true',
- [],
- 'condition'
+ []
);
return $toolTip;
@@ -94,8 +92,7 @@ class MatchForEveryone extends ConditionAbstract
{
$toolTip = $this->translator->trans(
'Unconditionnal usage',
- [],
- 'condition'
+ []
);
return $toolTip;
diff --git a/core/lib/Thelia/Condition/Implementation/MatchForTotalAmount.php b/core/lib/Thelia/Condition/Implementation/MatchForTotalAmount.php
index d178b6298..ca7dd53c8 100644
--- a/core/lib/Thelia/Condition/Implementation/MatchForTotalAmount.php
+++ b/core/lib/Thelia/Condition/Implementation/MatchForTotalAmount.php
@@ -120,8 +120,7 @@ class MatchForTotalAmount extends ConditionAbstract
{
return $this->translator->trans(
'Cart total amount',
- [],
- 'condition'
+ []
);
}
@@ -132,8 +131,7 @@ class MatchForTotalAmount extends ConditionAbstract
{
$toolTip = $this->translator->trans(
'Check the total Cart amount in the given currency',
- [],
- 'condition'
+ []
);
return $toolTip;
@@ -155,8 +153,7 @@ class MatchForTotalAmount extends ConditionAbstract
'%operator%' => $i18nOperator,
'%amount%' => $this->values[self::CART_TOTAL],
'%currency%' => $this->values[self::CART_CURRENCY]
- ),
- 'condition'
+ )
);
return $toolTip;
@@ -199,7 +196,7 @@ class MatchForTotalAmount extends ConditionAbstract
{
$labelPrice = $this->facade
->getTranslator()
- ->trans('Cart total amount is', [], 'condition');
+ ->trans('Cart total amount is', []);
$html = $this->drawBackOfficeBaseInputsText($labelPrice, self::CART_TOTAL);
diff --git a/core/lib/Thelia/Condition/Implementation/MatchForXArticles.php b/core/lib/Thelia/Condition/Implementation/MatchForXArticles.php
index ed55c901d..29482e6fe 100644
--- a/core/lib/Thelia/Condition/Implementation/MatchForXArticles.php
+++ b/core/lib/Thelia/Condition/Implementation/MatchForXArticles.php
@@ -103,8 +103,7 @@ class MatchForXArticles extends ConditionAbstract
{
return $this->translator->trans(
'Cart item count',
- [],
- 'condition'
+ []
);
}
@@ -115,8 +114,7 @@ class MatchForXArticles extends ConditionAbstract
{
$toolTip = $this->translator->trans(
'The cart item count should match the condition',
- [],
- 'condition'
+ []
);
return $toolTip;
@@ -136,8 +134,7 @@ class MatchForXArticles extends ConditionAbstract
array(
'%operator%' => $i18nOperator,
'%quantity%' => $this->values[self::CART_QUANTITY]
- ),
- 'condition'
+ )
);
return $toolTip;
@@ -164,7 +161,7 @@ class MatchForXArticles extends ConditionAbstract
{
$labelQuantity = $this->facade
->getTranslator()
- ->trans('Cart item count is', [], 'condition');
+ ->trans('Cart item count is');
$html = $this->drawBackOfficeBaseInputsText($labelQuantity, self::CART_QUANTITY);
diff --git a/core/lib/Thelia/Condition/Implementation/StartDate.php b/core/lib/Thelia/Condition/Implementation/StartDate.php
index d086fb39a..d4bf35816 100644
--- a/core/lib/Thelia/Condition/Implementation/StartDate.php
+++ b/core/lib/Thelia/Condition/Implementation/StartDate.php
@@ -103,8 +103,7 @@ class StartDate extends ConditionAbstract
{
return $this->translator->trans(
'Start date',
- [],
- 'condition'
+ []
);
}
@@ -115,8 +114,7 @@ class StartDate extends ConditionAbstract
{
$toolTip = $this->translator->trans(
'The coupon is valid after a given date',
- [],
- 'condition'
+ []
);
return $toolTip;
diff --git a/core/lib/Thelia/Condition/Operators.php b/core/lib/Thelia/Condition/Operators.php
index 2daafdc3f..80796564a 100644
--- a/core/lib/Thelia/Condition/Operators.php
+++ b/core/lib/Thelia/Condition/Operators.php
@@ -55,57 +55,49 @@ abstract class Operators
case self::INFERIOR:
$ret = $translator->trans(
'Less than',
- [],
- 'condition'
+ []
);
break;
case self::INFERIOR_OR_EQUAL:
$ret = $translator->trans(
'Less than or equals',
- [],
- 'condition'
+ []
);
break;
case self::EQUAL:
$ret = $translator->trans(
'Equal to',
- [],
- 'condition'
+ []
);
break;
case self::SUPERIOR_OR_EQUAL:
$ret = $translator->trans(
'Greater than or equals',
- [],
- 'condition'
+ []
);
break;
case self::SUPERIOR:
$ret = $translator->trans(
'Greater than',
- [],
- 'condition'
+ []
);
break;
case self::DIFFERENT:
$ret = $translator->trans(
'Not equal to',
- [],
- 'condition'
+ []
);
break;
case self::IN:
$ret = $translator->trans(
'In',
- [],
- 'condition'
+ []
);
break;
case self::OUT:
$ret = $translator->trans(
'Not in',
- [],
- 'condition'
+ []
);
break;
default:
diff --git a/core/lib/Thelia/Config/I18n/en_US.php b/core/lib/Thelia/Config/I18n/en_US.php
index 0b6545f7e..c2e166df4 100644
--- a/core/lib/Thelia/Config/I18n/en_US.php
+++ b/core/lib/Thelia/Config/I18n/en_US.php
@@ -43,7 +43,7 @@ return array(
'Available shipping zones' => 'Available shipping zones',
'Bad tax list JSON' => 'Bad tax list JSON',
'Billing country' => 'Billing country',
- 'Billing coutry is' => 'Le pays de facturation est',
+ 'Billing country is' => 'Billing country is',
'Brand' => 'Brand',
'Brand / Supplier' => 'Brand / Supplier',
'Brand name' => 'Brand name',
@@ -87,7 +87,7 @@ return array(
'Default product sale element' => 'Default product sale element',
'Deleting %obj% for %id% with parent id %parentId%' => 'Deleting %obj% for %id% with parent id %parentId%',
'Delivery country' => 'Delivery country',
- 'Delivery coutry is' => 'Le pays de livraison est',
+ 'Delivery country is' => 'Delivery country is',
'Delivery module ID not found' => 'Delivery module ID not found',
'Detailed description' => 'Detailed description',
'Disabled' => 'Disabled',
@@ -169,6 +169,7 @@ return array(
'Missing \'rel\' parameter in page loop' => 'Missing \'rel\' parameter in page loop',
'Missing \'type\' parameter in loop arguments' => 'Missing \'type\' parameter in loop arguments',
'Missing \'type\' parameter in {count} loop arguments' => 'Missing \'type\' parameter in {count} loop arguments',
+ 'Missing or invalid data: %s' => 'Missing or invalid data: %s',
'Module ID not found' => 'Module ID not found',
'Name' => 'Name',
'Name *' => 'Name *',
@@ -302,12 +303,12 @@ return array(
'The coupon applies if the cart contains at least one product of the selected categories' => 'The coupon applies if the cart contains at least one product of the selected categories',
'The coupon applies if the cart contains at least one product of the specified product list' => 'The coupon applies if the cart contains at least one product of the specified product list',
'The coupon applies to some customers only' => 'The coupon applies to some customers only',
+ 'The coupon applies to the selected billing countries' => 'The coupon applies to the selected billing countries',
'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 detailed description.' => 'The detailed description.',
'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',
- 'The product sale elements reference %ref doesn\'t exist' => 'The product sale elements reference %ref doesn\'t exist',
'This brand is online' => 'This brand is online',
'This category is online.' => 'This category is online.',
'This condition is always true' => 'This condition is always true',
@@ -355,6 +356,7 @@ return array(
'Value *' => 'Value *',
'Warnings' => 'Warnings',
'Weight' => 'Weight',
+ 'Wrong form method, %s expected.' => 'Wrong form method, %s expected.',
'Yes, I have a password :' => 'Yes, I have a password :',
'You are already registered!' => 'You are already registered!',
'You don\'t need to use commas or other punctuations.' => 'You don\'t need to use commas or other punctuations.',
@@ -366,8 +368,10 @@ return array(
'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',
+ 'hour(s)' => 'hour(s)',
'language locale' => 'language locale',
'mailing system modification' => 'mailing system modification',
+ 'minute(s)' => 'minute(s)',
'password confirmation is not the same as password field' => 'password confirmation is not the same as password field',
'password must be composed of at least 4 characters' => 'password must be composed of at least 4 characters',
'payment module %s is not a Thelia\Module\PaymentModuleInterface' => 'payment module %s is not a Thelia\Module\PaymentModuleInterface',
@@ -376,6 +380,4 @@ return array(
'this product id does not exists : %d' => 'this product id does not exists : %d',
'thousands separator' => 'Séparateur de milliers',
'time format' => 'time format',
- 'hour(s)' => 'hour(s)',
- 'minute(s)' => 'minute(s)',
);
diff --git a/core/lib/Thelia/Config/I18n/fr_FR.php b/core/lib/Thelia/Config/I18n/fr_FR.php
index 488cc0107..12113b8c2 100644
--- a/core/lib/Thelia/Config/I18n/fr_FR.php
+++ b/core/lib/Thelia/Config/I18n/fr_FR.php
@@ -21,7 +21,7 @@ return array(
'A variable with name "%name" already exists.' => 'Une variable avec le nom "%name" existe déjà.',
'Activate logs only for these IP Addresses' => 'Activer les logs uniquement pour ces adresses IP',
'Activate logs only for these files' => 'Activer les logs uniquement pour ces fichiers',
- 'Add to all product templates' => 'Ajouter à tous les templates produit',
+ 'Add to all product templates' => 'Ajouter à tous les gabarits produit',
'Additional address' => 'Adresse complémentaire',
'Address ID not found' => 'ID de l\'adresse non trouvé',
'Address Line 2' => 'Adresse suite',
@@ -42,8 +42,8 @@ return array(
'Available quantity *' => 'Quantité disponible *',
'Available shipping zones' => 'Zones de livraison disponibles',
'Bad tax list JSON' => 'Mauvais JSON de la liste des taxes',
- 'Billing country' => 'Pays de livraison',
- 'Billing coutry is' => 'Pays de facturation',
+ 'Billing country' => 'Pays de facturation',
+ 'Billing country is' => 'Le pays de facturation est',
'Brand' => 'Marque',
'Brand / Supplier' => 'Marque / Fournisseur',
'Brand name' => 'Nom de la marque',
@@ -87,7 +87,7 @@ return array(
'Default product sale element' => 'Product Sale Element par défaut',
'Deleting %obj% for %id% with parent id %parentId%' => 'Suppresion de %obj%, ID %id%, ID parent %parentId%',
'Delivery country' => 'Pays de livraison',
- 'Delivery coutry is' => 'Le pays de livraison est',
+ 'Delivery country is' => 'Le pays de livraison est',
'Delivery module ID not found' => 'Id du module de livraison non trouvé',
'Detailed description' => 'Description détaillée',
'Disabled' => 'Désactivé',
@@ -169,6 +169,7 @@ return array(
'Missing \'rel\' parameter in page loop' => 'Le paramètre obligatoire \'rel\' est absent des paramètre de la boucle \'page\'',
'Missing \'type\' parameter in loop arguments' => 'Le paramètre obligatoire \'type\' est absent des paramètre de la boucle ',
'Missing \'type\' parameter in {count} loop arguments' => 'Le paramètre obligatoire \'type\' est absent des paramètre de la boucle {count}',
+ 'Missing or invalid data: %s' => 'Donnée manquante ou non valide : %s',
'Module ID not found' => 'Id du module non trouvé',
'Name' => 'Nom',
'Name *' => 'Nom *',
@@ -235,7 +236,7 @@ return array(
'Product price including taxes' => 'Prix du produit taxes incluses',
'Product reference *' => 'Référence du produit *',
'Product sale element ID *' => 'Product sale element ID *',
- 'Product template' => 'Template du produit',
+ 'Product template' => 'Gabarit du produit',
'Product title *' => 'Titre du produit *',
'ProductSaleElement modification' => 'Modification de ProductSaleElement.',
'Profile' => 'Profil',
@@ -257,8 +258,8 @@ return array(
'Replace current image by this file' => 'Remplacer l\'image courante par ce fichier',
'Rewriten URL' => 'URL re-écrite',
'Rotated Text File' => 'Rotation du fichier texte',
- 'Sale price excluding taxes' => 'Prix de vente Hors Taxes',
- 'Sale price including taxes' => 'Prix de vente Toutes Taxes Comprises',
+ 'Sale price excluding taxes' => 'Prix promo HT',
+ 'Sale price including taxes' => 'Prix promo TTC',
'Saving %obj% for %parentName% parent id %parentId%' => 'Enregistrement de %obj% pour %parentName% ID parent %parentId%',
'Select the brand logo' => 'Logo de la marque',
'Select the brand logo amongst the brand images' => 'Choisissez le logo de la marque parmis les images associées à cette marque',
@@ -291,7 +292,7 @@ return array(
'Tax list is not valid JSON' => 'Le JSON de la liste des taxes n\'est pas valide',
'Tax rule ID not found' => 'ID de la règle de taxe non trouvé',
'Tax rule for this product *' => 'Règle de taxe pour ce produit *',
- 'Template Name *' => 'Nom du template *',
+ 'Template Name *' => 'Nom du gabarit *',
'Template file %file cannot be found.' => 'Le fichier %file n\'a pas été trouvé dans le template. ',
'Text File' => 'Fichier texte',
'Text Message' => 'Message au format texte',
@@ -302,12 +303,12 @@ return array(
'The coupon applies if the cart contains at least one product of the selected categories' => 'Le code promo est valable si le panier contient/ne contient pas des produits appartenant aux catégories sélectionnées',
'The coupon applies if the cart contains at least one product of the specified product list' => 'Le code promo est valable si le panier contient/ne contient pas au moins un des produits selectionnés',
'The coupon applies to some customers only' => 'Ce code promo est valable pour les clients sélectionnés',
+ 'The coupon applies to the selected billing countries' => 'Ce code promo s\'applique pour les pays de facturation sélectionnés',
'The coupon applies to the selected delivery countries' => 'Ce code promo s\'applique pour les pays de livraison sélectionnés',
'The coupon is valid after a given date' => 'Le code promo est valide à partir de cette date',
'The detailed description.' => 'La description détaillée',
'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.' => 'L\'image qui remplace un drapeau de pays manquant (%file) n\'a pas été trouvée. Merci de vérifier la variable de configuration unknown-flag-path.',
'The loop name \'%name\' is already defined in %className class' => 'La boucle \'%name\' est déjà définir dans la classe %className',
- 'The product sale elements reference %ref doesn\'t exist' => 'La déclinaison de produit %ref n\'existe pas',
'This brand is online' => 'Cette marque est en ligne',
'This category is online.' => 'Cette catégorie est en ligne.',
'This condition is always true' => 'Cette condition est troujours vérifiée',
@@ -330,7 +331,7 @@ return array(
'This product is on sale' => 'Ce produit est en promo',
'This product is online' => 'Ce produit est en ligne',
'This product_sale_elements_id does not exists for this product : %d' => 'Le product_sale_elements_id n\'existe pas pour ce produit : %d',
- 'This template is in use in some of your products, and cannot be deleted. Delete it from all your products and try again.' => 'Ce template est utilisé par des produits, et ne peut être supprimé. Retirez-le de tous vos produits, et ré-essayez.',
+ 'This template is in use in some of your products, and cannot be deleted. Delete it from all your products and try again.' => 'Ce gabarit est utilisé par des produits, et ne peut être supprimé. Retirez-le de tous vos produits, et ré-essayez.',
'This value should not be blank.' => 'Cette valeur ne doit pas être vide.',
'Timeout' => 'Délai d\'attente expiré',
'Title' => 'Titre',
@@ -355,6 +356,7 @@ return array(
'Value *' => 'Valeur *',
'Warnings' => 'Avertissements',
'Weight' => 'Poids',
+ 'Wrong form method, %s expected.' => 'Méthode HTTP invalide : %s attendu.',
'Yes, I have a password :' => 'Oui, j\'ai un mot de passe :',
'You are already registered!' => 'Vous êtes déjà enregistré !',
'You don\'t need to use commas or other punctuations.' => 'Vous n\'avez pas besoin d\'utiliser de virgules ou d\'autres signes de ponctuation',
@@ -366,8 +368,10 @@ return array(
'date format' => 'Format de date',
'decimal separator' => 'Séparateur décimal',
'delivery module %s is not a Thelia\Module\DeliveryModuleInterface' => 'le module de livraison %s n\'est pas un Thelia\Module\DeliveryModuleInterface',
+ 'hour(s)' => 'heure(s)',
'language locale' => 'Langue locale',
'mailing system modification' => 'Modification du système d\'envoi de mail.',
+ 'minute(s)' => 'minute(s)',
'password confirmation is not the same as password field' => 'le mot de passe de confirmation n\'est pas le même que le champ mot de passe',
'password must be composed of at least 4 characters' => 'le mot de passe doit être composé d\'au moins 4 caractères',
'payment module %s is not a Thelia\Module\PaymentModuleInterface' => 'Le module de paiement %s n\'est pas une instance de Thelia\Module\PaymentModuleInterface ',
@@ -376,6 +380,4 @@ return array(
'this product id does not exists : %d' => 'l\'id du produit %d n\'existe pas',
'thousands separator' => 'Séparateur des milliers',
'time format' => 'Format d\'heure',
- 'hour(s)' => 'heure(s)',
- 'minute(s)' => 'minute(s)',
);
diff --git a/core/lib/Thelia/Controller/Admin/FileController.php b/core/lib/Thelia/Controller/Admin/FileController.php
index c4f9401aa..a5cc4e7e1 100644
--- a/core/lib/Thelia/Controller/Admin/FileController.php
+++ b/core/lib/Thelia/Controller/Admin/FileController.php
@@ -358,21 +358,22 @@ class FileController extends BaseAdminController
$file->setLocale($data['locale']);
- if (isset($data['title'])) {
+ if (array_key_exists('title', $data)) {
$file->setTitle($data['title']);
}
- if (isset($data['chapo'])) {
+ if (array_key_exists('chapo', $data)) {
$file->setChapo($data['chapo']);
}
- if (isset($data['description'])) {
+ if (array_key_exists('description', $data)) {
$file->setDescription($data['description']);
}
+ if (array_key_exists('postscriptum', $data)) {
+ $file->setPostscriptum($data['postscriptum']);
+ }
+
if (isset($data['file'])) {
$file->setFile($data['file']);
}
- if (isset($data['postscriptum'])) {
- $file->setPostscriptum($data['postscriptum']);
- }
$event->setModel($file);
$event->setOldModel($oldFile);
diff --git a/core/lib/Thelia/Controller/Admin/ProductController.php b/core/lib/Thelia/Controller/Admin/ProductController.php
index ba78c830e..afc5da7f8 100644
--- a/core/lib/Thelia/Controller/Admin/ProductController.php
+++ b/core/lib/Thelia/Controller/Admin/ProductController.php
@@ -158,6 +158,7 @@ class ProductController extends AbstractSeoCrudController
$changeEvent
->setLocale($formData['locale'])
+ ->setRef($formData['ref'])
->setTitle($formData['title'])
->setChapo($formData['chapo'])
->setDescription($formData['description'])
diff --git a/core/lib/Thelia/Controller/BaseController.php b/core/lib/Thelia/Controller/BaseController.php
index 424469876..b039887c6 100644
--- a/core/lib/Thelia/Controller/BaseController.php
+++ b/core/lib/Thelia/Controller/BaseController.php
@@ -218,13 +218,13 @@ abstract class BaseController extends ContainerAware
if ($form->get("error_message")->getData() != null) {
$errorMessage = $form->get("error_message")->getData();
} else {
- $errorMessage = sprintf("Missing or invalid data: %s", $this->getErrorMessages($form));
+ $errorMessage = sprintf($this->getTranslator()->trans("Missing or invalid data: %s"), $this->getErrorMessages($form));
}
throw new FormValidationException($errorMessage);
}
} else {
- throw new FormValidationException(sprintf("Wrong form method, %s expected.", $expectedMethod));
+ throw new FormValidationException(sprintf($this->getTranslator()->trans("Wrong form method, %s expected."), $expectedMethod));
}
}
diff --git a/core/lib/Thelia/Core/Template/Loop/Coupon.php b/core/lib/Thelia/Core/Template/Loop/Coupon.php
index 145202120..1f1738cf2 100644
--- a/core/lib/Thelia/Core/Template/Loop/Coupon.php
+++ b/core/lib/Thelia/Core/Template/Loop/Coupon.php
@@ -220,7 +220,6 @@ class Coupon extends BaseI18nLoop implements PropelSearchLoopInterface
// which adds a product to the cart.
$discount = $couponManager->isInUse() ? $couponManager->exec() : 0;
-
$loopResultRow
->set("ID", $coupon->getId())
->set("IS_TRANSLATED", $coupon->getVirtualColumn('IS_TRANSLATED'))
diff --git a/core/lib/Thelia/Core/Template/Loop/Product.php b/core/lib/Thelia/Core/Template/Loop/Product.php
index ac3bedd61..eac45582d 100644
--- a/core/lib/Thelia/Core/Template/Loop/Product.php
+++ b/core/lib/Thelia/Core/Template/Loop/Product.php
@@ -179,6 +179,8 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
$search->innerJoinProductSaleElements('pse');
$search->addJoinCondition('pse', '`pse`.IS_DEFAULT=1');
+ $search->innerJoinProductSaleElements('pse_count');
+
$priceJoin = new Join();
$priceJoin->addExplicitCondition(ProductSaleElementsTableMap::TABLE_NAME, 'ID', 'pse', ProductPriceTableMap::TABLE_NAME, 'PRODUCT_SALE_ELEMENTS_ID', 'price');
$priceJoin->setJoinType(Criteria::LEFT_JOIN);
@@ -396,6 +398,8 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
$search->withColumn('`pse`.WEIGHT', 'weight');
$search->withColumn('`pse`.EAN_CODE', 'ean_code');
+ $search->withColumn('COUNT(`pse_count`.ID)', 'pse_count');
+
$orders = $this->getOrder();
foreach ($orders as $order) {
@@ -518,6 +522,7 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
->set("TAXED_PROMO_PRICE" , $taxedPromoPrice)
->set("IS_PROMO" , $product->getVirtualColumn('is_promo'))
->set("IS_NEW" , $product->getVirtualColumn('is_new'))
+ ->set("PSE_COUNT" , $product->getVirtualColumn('pse_count'))
;
@@ -571,8 +576,10 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
$search->where(" CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`TITLE` ELSE `default_locale_i18n`.`TITLE` END ".Criteria::LIKE." ?", "%".$title."%", \PDO::PARAM_STR);
}
-
-
+ /* number of pse
+ $search->innerJoinProductSaleElements('pse_count');
+ $search->withColumn('COUNT(`pse_count`.ID)', 'pse_count');
+ */
$category = $this->getCategory();
$categoryDefault = $this->getCategoryDefault();
@@ -985,8 +992,8 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
->set("BEST_PRICE" , $price)
->set("BEST_PRICE_TAX" , $taxedPrice - $price)
->set("BEST_TAXED_PRICE" , $taxedPrice)
- ->set("IS_PROMO" , $product->getVirtualColumn('is_promo'))
- ->set("IS_NEW" , $product->getVirtualColumn('is_new'))
+ ->set("IS_PROMO" , $product->getVirtualColumn('is_promo'))
+ ->set("IS_NEW" , $product->getVirtualColumn('is_new'))
;
diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php
index 8c7023bcf..92f481a21 100644
--- a/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php
+++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php
@@ -20,6 +20,8 @@ use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
use Thelia\Core\Security\SecurityContext;
use Thelia\Core\Template\ParserContext;
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
+use Thelia\Model\Base\BrandQuery;
+use Thelia\Model\Brand;
use Thelia\Model\ConfigQuery;
use Thelia\Model\CategoryQuery;
use Thelia\Model\ContentQuery;
@@ -139,12 +141,12 @@ class DataAccessFunctions extends AbstractSmartyPlugin
public function brandDataAccess($params, &$smarty)
{
- $contentId = $this->request->get('brand_id');
+ $brandId = $this->request->get('brand_id');
- if ($contentId !== null) {
+ if ($brandId !== null) {
- $search = ContentQuery::create()
- ->filterById($contentId);
+ $search = BrandQuery::create()
+ ->filterById($brandId);
return $this->dataAccessWithI18n("Brand", $params, $search);
}
diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php
index e041b1d15..50852df55 100644
--- a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php
+++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php
@@ -217,8 +217,9 @@ class TheliaLoop extends AbstractSmartyPlugin
{
//Block the smarty interpretation in the elseloop
if ($content === null) {
- if ( ! $this->checkEmptyLoop($params)){
+ if ( ! $this->checkEmptyLoop($params)) {
$repeat = false;
+
return '';
}
}
diff --git a/core/lib/Thelia/Coupon/Type/CouponAbstract.php b/core/lib/Thelia/Coupon/Type/CouponAbstract.php
index a0bdf2db1..addc9a05e 100644
--- a/core/lib/Thelia/Coupon/Type/CouponAbstract.php
+++ b/core/lib/Thelia/Coupon/Type/CouponAbstract.php
@@ -182,7 +182,7 @@ abstract class CouponAbstract implements CouponInterface
}
/**
- * @param true $perCustomerUsageCount
+ * @param true $perCustomerUsageCount
* @return $this
*/
public function setPerCustomerUsageCount($perCustomerUsageCount)
@@ -428,8 +428,8 @@ abstract class CouponAbstract implements CouponInterface
*
* This method should be overriden to be useful.
*
- * @param string $fieldName
- * @param string $fieldValue
+ * @param string $fieldName
+ * @param string $fieldValue
* @return mixed
* @throws \InvalidArgumentException if the field value is not valid.
*/
@@ -509,7 +509,8 @@ abstract class CouponAbstract implements CouponInterface
// Does nothing. Override this function as needed.
}
- public function isInUse() {
+ public function isInUse()
+ {
return in_array(
$this->code,
$this->facade->getRequest()->getSession()->getConsumedCoupons()
diff --git a/core/lib/Thelia/Coupon/Type/FreeProduct.php b/core/lib/Thelia/Coupon/Type/FreeProduct.php
index 3032813a8..bf4f52d17 100644
--- a/core/lib/Thelia/Coupon/Type/FreeProduct.php
+++ b/core/lib/Thelia/Coupon/Type/FreeProduct.php
@@ -294,7 +294,7 @@ class FreeProduct extends AbstractRemoveOnProducts
{
return $this->facade
->getTranslator()
- ->trans('Free product when buying one or more selected products', array(), 'coupon');
+ ->trans('Free product when buying one or more selected products', array());
}
/**
@@ -306,8 +306,7 @@ class FreeProduct extends AbstractRemoveOnProducts
->getTranslator()
->trans(
'This coupon adds a free product to the cart if one of the selected products is in the cart.',
- array(),
- 'coupon'
+ array()
);
return $toolTip;
diff --git a/core/lib/Thelia/Coupon/Type/RemoveAmountOnAttributeValues.php b/core/lib/Thelia/Coupon/Type/RemoveAmountOnAttributeValues.php
index 625de5302..9b515e8b2 100644
--- a/core/lib/Thelia/Coupon/Type/RemoveAmountOnAttributeValues.php
+++ b/core/lib/Thelia/Coupon/Type/RemoveAmountOnAttributeValues.php
@@ -36,7 +36,7 @@ class RemoveAmountOnAttributeValues extends AbstractRemoveOnAttributeValues
{
return $this->facade
->getTranslator()
- ->trans('Fixed amount discount for selected attribute values', array(), 'coupon');
+ ->trans('Fixed amount discount for selected attribute values', array());
}
/**
@@ -48,8 +48,7 @@ class RemoveAmountOnAttributeValues extends AbstractRemoveOnAttributeValues
->getTranslator()
->trans(
'This coupon subtracts the specified amount from the order total for each product which uses the selected attribute values. If the discount is greater than the total order, the customer will only pay the shipping, or nothing if the coupon also provides free shipping.',
- array(),
- 'coupon'
+ array()
);
return $toolTip;
diff --git a/core/lib/Thelia/Coupon/Type/RemoveAmountOnCategories.php b/core/lib/Thelia/Coupon/Type/RemoveAmountOnCategories.php
index 54a0bcc17..a153aa05a 100644
--- a/core/lib/Thelia/Coupon/Type/RemoveAmountOnCategories.php
+++ b/core/lib/Thelia/Coupon/Type/RemoveAmountOnCategories.php
@@ -37,7 +37,7 @@ class RemoveAmountOnCategories extends AbstractRemoveOnCategories
{
return $this->facade
->getTranslator()
- ->trans('Fixed amount discount for selected categories', array(), 'coupon');
+ ->trans('Fixed amount discount for selected categories', array());
}
/**
@@ -49,8 +49,7 @@ class RemoveAmountOnCategories extends AbstractRemoveOnCategories
->getTranslator()
->trans(
'This coupon subtracts the specified amount from the order total for each product which belongs to the selected categories. If the discount is greater than the total order, the customer will only pay the shipping, or nothing if the coupon also provides free shipping.',
- array(),
- 'coupon'
+ array()
);
return $toolTip;
diff --git a/core/lib/Thelia/Coupon/Type/RemoveAmountOnProducts.php b/core/lib/Thelia/Coupon/Type/RemoveAmountOnProducts.php
index 867f959aa..544cb5e85 100644
--- a/core/lib/Thelia/Coupon/Type/RemoveAmountOnProducts.php
+++ b/core/lib/Thelia/Coupon/Type/RemoveAmountOnProducts.php
@@ -41,7 +41,7 @@ class RemoveAmountOnProducts extends AbstractRemoveOnProducts
{
return $this->facade
->getTranslator()
- ->trans('Fixed amount discount for selected products', array(), 'coupon');
+ ->trans('Fixed amount discount for selected products', array());
}
/**
@@ -53,8 +53,7 @@ class RemoveAmountOnProducts extends AbstractRemoveOnProducts
->getTranslator()
->trans(
'This coupon subtracts the specified amount from the order total for each selected product. If the discount is greater than the total order, the customer will only pay the shipping, or nothing if the coupon also provides free shipping.',
- array(),
- 'coupon'
+ array()
);
return $toolTip;
diff --git a/core/lib/Thelia/Coupon/Type/RemovePercentageOnAttributeValues.php b/core/lib/Thelia/Coupon/Type/RemovePercentageOnAttributeValues.php
index 6d2dafebf..40e216a68 100644
--- a/core/lib/Thelia/Coupon/Type/RemovePercentageOnAttributeValues.php
+++ b/core/lib/Thelia/Coupon/Type/RemovePercentageOnAttributeValues.php
@@ -42,7 +42,7 @@ class RemovePercentageOnAttributeValues extends AbstractRemoveOnAttributeValues
{
return $this->facade
->getTranslator()
- ->trans('Percentage discount for selected attribute values', array(), 'coupon');
+ ->trans('Percentage discount for selected attribute values', array());
}
/**
@@ -54,8 +54,7 @@ class RemovePercentageOnAttributeValues extends AbstractRemoveOnAttributeValues
->getTranslator()
->trans(
'This coupon subtracts from the order total the specified percentage of each product price which uses the selected attribute values. If the discount is greater than the total order, the customer will only pay the shipping, or nothing if the coupon also provides free shipping.',
- array(),
- 'coupon'
+ array()
);
return $toolTip;
diff --git a/core/lib/Thelia/Coupon/Type/RemovePercentageOnCategories.php b/core/lib/Thelia/Coupon/Type/RemovePercentageOnCategories.php
index e2db763d4..7216a3268 100644
--- a/core/lib/Thelia/Coupon/Type/RemovePercentageOnCategories.php
+++ b/core/lib/Thelia/Coupon/Type/RemovePercentageOnCategories.php
@@ -39,7 +39,7 @@ class RemovePercentageOnCategories extends AbstractRemoveOnCategories
{
return $this->facade
->getTranslator()
- ->trans('Percentage discount for selected categories', array(), 'coupon');
+ ->trans('Percentage discount for selected categories', array());
}
/**
@@ -51,8 +51,7 @@ class RemovePercentageOnCategories extends AbstractRemoveOnCategories
->getTranslator()
->trans(
'This coupon subtracts from the order total a percentage of the price of each product which belongs to the selected categories. If the discount is greater than the total order, the customer will only pay the shipping, or nothing if the coupon also provides free shipping.',
- array(),
- 'coupon'
+ array()
);
return $toolTip;
diff --git a/core/lib/Thelia/Coupon/Type/RemovePercentageOnProducts.php b/core/lib/Thelia/Coupon/Type/RemovePercentageOnProducts.php
index cab227442..d261b4456 100644
--- a/core/lib/Thelia/Coupon/Type/RemovePercentageOnProducts.php
+++ b/core/lib/Thelia/Coupon/Type/RemovePercentageOnProducts.php
@@ -46,7 +46,7 @@ class RemovePercentageOnProducts extends AbstractRemoveOnProducts
{
return $this->facade
->getTranslator()
- ->trans('Percentage discount for selected products', array(), 'coupon');
+ ->trans('Percentage discount for selected products', array());
}
/**
@@ -58,8 +58,7 @@ class RemovePercentageOnProducts extends AbstractRemoveOnProducts
->getTranslator()
->trans(
'This coupon subtracts from the order total the specified percentage of each selected product price. If the discount is greater than the total order, the customer will only pay the shipping, or nothing if the coupon also provides free shipping.',
- array(),
- 'coupon'
+ array()
);
return $toolTip;
diff --git a/core/lib/Thelia/Coupon/Type/RemoveXAmount.php b/core/lib/Thelia/Coupon/Type/RemoveXAmount.php
index c1ffb0675..0c9287b2c 100644
--- a/core/lib/Thelia/Coupon/Type/RemoveXAmount.php
+++ b/core/lib/Thelia/Coupon/Type/RemoveXAmount.php
@@ -38,7 +38,7 @@ class RemoveXAmount extends AbstractRemove
{
return $this->facade
->getTranslator()
- ->trans('Fixed Amount Discount', array(), 'coupon');
+ ->trans('Fixed Amount Discount', array());
}
/**
@@ -50,8 +50,7 @@ class RemoveXAmount extends AbstractRemove
->getTranslator()
->trans(
'This coupon will subtracts a set amount from the total cost of an order. If the discount is greater than the total order corst, the customer will only pay the shipping, or nothing if the coupon also provides free shipping.',
- array(),
- 'coupon'
+ array()
);
return $toolTip;
diff --git a/core/lib/Thelia/Coupon/Type/RemoveXPercent.php b/core/lib/Thelia/Coupon/Type/RemoveXPercent.php
index 623cb7078..4bbe668f2 100644
--- a/core/lib/Thelia/Coupon/Type/RemoveXPercent.php
+++ b/core/lib/Thelia/Coupon/Type/RemoveXPercent.php
@@ -41,7 +41,7 @@ class RemoveXPercent extends AbstractRemove
{
return $this->facade
->getTranslator()
- ->trans('Remove X percent to total cart', array(), 'coupon');
+ ->trans('Remove X percent to total cart', array());
}
/**
@@ -53,8 +53,7 @@ class RemoveXPercent extends AbstractRemove
->getTranslator()
->trans(
'This coupon will offert a flat percentage off a shopper\'s entire order (not applied to shipping costs or tax rates). If the discount is greater than the total order corst, the customer will only pay the shipping, or nothing if the coupon also provides free shipping.',
- array(),
- 'coupon'
+ array()
);
return $toolTip;
diff --git a/core/lib/Thelia/Form/CustomerCreateForm.php b/core/lib/Thelia/Form/CustomerCreateForm.php
index d0e915657..34159ea12 100644
--- a/core/lib/Thelia/Form/CustomerCreateForm.php
+++ b/core/lib/Thelia/Form/CustomerCreateForm.php
@@ -86,17 +86,8 @@ class CustomerCreateForm extends AddressCreateForm
"for" => "newsletter"
),
"required" => false
- ))
- // Add terms & conditions
- ->add("agreed", "checkbox", array(
- "constraints" => array(
- new Constraints\True(array("message" => Translator::getInstance()->trans("Please accept the Terms and conditions in order to register.")))
- ),
- "label"=>"Test",
- "label_attr" => array(
- "for" => "agreed"
- )
));
+
}
public function verifyPasswordField($value, ExecutionContextInterface $context)
diff --git a/core/lib/Thelia/Form/CustomerProfileUpdateForm.php b/core/lib/Thelia/Form/CustomerProfileUpdateForm.php
index 1d4d07b30..7c8748519 100644
--- a/core/lib/Thelia/Form/CustomerProfileUpdateForm.php
+++ b/core/lib/Thelia/Form/CustomerProfileUpdateForm.php
@@ -43,9 +43,7 @@ class CustomerProfileUpdateForm extends CustomerCreateForm
->remove("country")
// Remove Login Information
->remove("password")
- ->remove("password_confirm")
- // Remove Terms & conditions
- ->remove("agreed");
+ ->remove("password_confirm");
}
/**
diff --git a/core/lib/Thelia/Form/OrderPayment.php b/core/lib/Thelia/Form/OrderPayment.php
index 4ecabfe2e..83d795d29 100644
--- a/core/lib/Thelia/Form/OrderPayment.php
+++ b/core/lib/Thelia/Form/OrderPayment.php
@@ -50,6 +50,16 @@ class OrderPayment extends FirewallForm
)
))
)
+ ))
+ // Add terms & conditions
+ ->add("agreed", "checkbox", array(
+ "constraints" => array(
+ new Constraints\True(array("message" => Translator::getInstance()->trans("Please accept the Terms and conditions in order to register.")))
+ ),
+ "label"=>"Agreed",
+ "label_attr" => array(
+ "for" => "agreed"
+ )
));
}
diff --git a/core/lib/Thelia/Form/ProductCreationForm.php b/core/lib/Thelia/Form/ProductCreationForm.php
index d74529509..565a7dbf5 100644
--- a/core/lib/Thelia/Form/ProductCreationForm.php
+++ b/core/lib/Thelia/Form/ProductCreationForm.php
@@ -22,17 +22,15 @@ class ProductCreationForm extends BaseForm
{
protected function buildForm($change_mode = false)
{
- $ref_constraints = array(new NotBlank());
-
- if (! $change_mode) {
- $ref_constraints[] = new Callback(array(
- "methods" => array(array($this, "checkDuplicateRef"))
- ));
- }
$this->formBuilder
->add("ref", "text", array(
- "constraints" => $ref_constraints,
+ "constraints" => array(
+ new NotBlank(),
+ new Callback(array(
+ "methods" => array(array($this, "checkDuplicateRef"))
+ ))
+ ),
"label" => Translator::getInstance()->trans('Product reference *'),
"label_attr" => array("for" => "ref")
))
diff --git a/core/lib/Thelia/Form/ProductModificationForm.php b/core/lib/Thelia/Form/ProductModificationForm.php
index 894399d94..e580a28c2 100644
--- a/core/lib/Thelia/Form/ProductModificationForm.php
+++ b/core/lib/Thelia/Form/ProductModificationForm.php
@@ -12,9 +12,12 @@
namespace Thelia\Form;
+use Propel\Runtime\ActiveQuery\Criteria;
use Symfony\Component\Validator\Constraints\GreaterThan;
use Symfony\Component\Validator\Constraints\NotBlank;
+use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Translation\Translator;
+use Thelia\Model\ProductQuery;
class ProductModificationForm extends ProductCreationForm
{
@@ -49,6 +52,23 @@ class ProductModificationForm extends ProductCreationForm
$this->addStandardDescFields(array('title', 'locale'));
}
+ public function checkDuplicateRef($value, ExecutionContextInterface $context)
+ {
+ $data = $context->getRoot()->getData();
+
+ $count = ProductQuery::create()
+ ->filterById($data['id'], Criteria::NOT_EQUAL)
+ ->filterByRef($value)->count();
+
+ if ($count > 0) {
+ $context->addViolation(
+ Translator::getInstance()->trans(
+ "A product with reference %ref already exists. Please choose another reference.",
+ array('%ref' => $value)
+ ));
+ }
+ }
+
public function getName()
{
return "thelia_product_modification";
diff --git a/core/lib/Thelia/Model/Order.php b/core/lib/Thelia/Model/Order.php
index 85fa72e67..b20cc3742 100644
--- a/core/lib/Thelia/Model/Order.php
+++ b/core/lib/Thelia/Model/Order.php
@@ -89,7 +89,6 @@ class Order extends BaseOrder
return parent::preSave($con);
}
-
/**
* {@inheritDoc}
*/
diff --git a/setup/import.php b/setup/import.php
index 913801fb2..e8249f90d 100644
--- a/setup/import.php
+++ b/setup/import.php
@@ -20,6 +20,9 @@
/* along with this program. If not, see