Merge branch 'master' into frontend

Conflicts:
	templates/default/layout.tpl
This commit is contained in:
Manuel Raynaud
2013-10-25 14:51:34 +02:00
141 changed files with 3772 additions and 2614 deletions

View File

@@ -25,12 +25,9 @@ namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Security\AccessManager;
use Thelia\Core\Security\Resource\AdminResources;
use Thelia\Core\Translation\Translator;
use Thelia\Model\AdminQuery;
use Thelia\Model\ProfileQuery;
use Thelia\Model\ConfigQuery;
class AdministratorCreationForm extends BaseForm
{
@@ -110,7 +107,7 @@ class AdministratorCreationForm extends BaseForm
{
$data = $context->getRoot()->getData();
if($data["password"] === '' && $data["password_confirm"] === '') {
if ($data["password"] === '' && $data["password_confirm"] === '') {
$context->addViolation("password can't be empty");
}
@@ -118,7 +115,7 @@ class AdministratorCreationForm extends BaseForm
$context->addViolation("password confirmation is not the same as password field");
}
if(strlen($data["password"]) < 4) {
if (strlen($data["password"]) < 4) {
$context->addViolation("password must be composed of at least 4 characters");
}
}
@@ -135,4 +132,4 @@ class AdministratorCreationForm extends BaseForm
{
return "thelia_admin_administrator_creation";
}
}
}

View File

@@ -25,7 +25,6 @@ namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Translation\Translator;
use Thelia\Model\AdminQuery;
class AdministratorModificationForm extends AdministratorCreationForm
@@ -90,7 +89,7 @@ class AdministratorModificationForm extends AdministratorCreationForm
$context->addViolation("password confirmation is not the same as password field");
}
if($data["password"] !== '' && strlen($data["password"]) < 4) {
if ($data["password"] !== '' && strlen($data["password"]) < 4) {
$context->addViolation("password must be composed of at least 4 characters");
}
}

View File

@@ -27,7 +27,6 @@ use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
/**
* Class ContactForm
* @package Thelia\Form
@@ -107,4 +106,4 @@ class ContactForm extends BaseForm
{
return 'thelia_contact';
}
}
}

View File

@@ -23,8 +23,6 @@
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Thelia\Model\ModuleQuery;
use Thelia\Module\BaseModule;
/**
* Class CouponCode

View File

@@ -27,7 +27,6 @@ use Symfony\Component\Validator\Constraints\Date;
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\NotEqualTo;
use Symfony\Component\Validator\Constraints\Range;
/**
* Created by JetBrains PhpStorm.

View File

@@ -26,7 +26,6 @@ use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Model\ConfigQuery;
use Thelia\Core\Translation\Translator;
use Thelia\Model\CustomerQuery;
/**
* Class CustomerPasswordUpdateForm

View File

@@ -22,11 +22,8 @@
/*************************************************************************************/
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Model\CustomerQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Core\Translation\Translator;
/**
* Class CustomerProfilUpdateForm
@@ -69,7 +66,6 @@ class CustomerProfilUpdateForm extends CustomerCreateForm
));
}
/**
* @param $value
* @param ExecutionContextInterface $context

View File

@@ -26,7 +26,6 @@ use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Form\BaseForm;
use Thelia\Core\Translation\Translator;
/**
* Class LangCreateForm
* @package Thelia\Form\Lang
@@ -113,4 +112,4 @@ class LangCreateForm extends BaseForm
{
return 'thelia_language_create';
}
}
}

View File

@@ -24,11 +24,9 @@
namespace Thelia\Form\Lang;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Range;
use Thelia\Form\BaseForm;
use Thelia\Core\Translation\Translator;
/**
* Class LangDefaultBehaviorForm
* @package Thelia\Form\Lang
@@ -82,4 +80,4 @@ class LangDefaultBehaviorForm extends BaseForm
{
return 'thelia_lang_defaultBehavior';
}
}
}

View File

@@ -25,7 +25,6 @@ namespace Thelia\Form\Lang;
use Symfony\Component\Validator\Constraints\GreaterThan;
use Symfony\Component\Validator\Constraints\NotBlank;
/**
* Class LangUpdateForm
* @package Thelia\Form\Lang
@@ -51,4 +50,4 @@ class LangUpdateForm extends LangCreateForm
{
return 'thelia_lang_update';
}
}
}

View File

@@ -24,7 +24,6 @@
namespace Thelia\Form\Lang;
use Thelia\Core\Event\ActionEvent;
/**
* Class LangUrlEvent
* @package Thelia\Form\Lang
@@ -43,4 +42,4 @@ class LangUrlEvent extends ActionEvent
{
return $this->url;
}
}
}

View File

@@ -26,7 +26,6 @@ use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Form\BaseForm;
use Thelia\Model\LangQuery;
/**
* Class LangUrlForm
* @package Thelia\Form\Lang
@@ -84,4 +83,4 @@ class LangUrlForm extends BaseForm
{
return 'thelia_language_url';
}
}
}

View File

@@ -30,7 +30,6 @@ use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Translation\Translator;
use Thelia\Model\NewsletterQuery;
/**
* Class NewsletterForm
* @package Thelia\Form
@@ -95,4 +94,4 @@ class NewsletterForm extends BaseForm
{
return 'thelia_newsletter';
}
}
}

View File

@@ -22,8 +22,91 @@
/*************************************************************************************/
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\GreaterThan;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Model\Currency;
use Thelia\Core\Translation\Translator;
class ProductDefaultSaleElementUpdateForm extends ProductSaleElementUpdateForm
{
use StandardDescriptionFieldsTrait;
protected function buildForm()
{
$this->formBuilder
->add("product_id", "integer", array(
"label" => Translator::getInstance()->trans("Product ID *"),
"label_attr" => array("for" => "product_id_field"),
"constraints" => array(new GreaterThan(array('value' => 0)))
))
->add("product_sale_element_id", "integer", array(
"label" => Translator::getInstance()->trans("Product sale element ID *"),
"label_attr" => array("for" => "product_sale_element_id_field")
))
->add("reference", "text", array(
"label" => Translator::getInstance()->trans("Reference *"),
"label_attr" => array("for" => "reference_field")
))
->add("price", "number", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Product price excluding taxes *"),
"label_attr" => array("for" => "price_field")
))
->add("price_with_tax", "number", array(
"label" => Translator::getInstance()->trans("Product price including taxes"),
"label_attr" => array("for" => "price_with_tax_field")
))
->add("currency", "integer", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Price currency *"),
"label_attr" => array("for" => "currency_field")
))
->add("tax_rule", "integer", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Tax rule for this product *"),
"label_attr" => array("for" => "tax_rule_field")
))
->add("weight", "number", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Weight *"),
"label_attr" => array("for" => "weight_field")
))
->add("quantity", "number", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Available quantity *"),
"label_attr" => array("for" => "quantity_field")
))
->add("sale_price", "number", array(
"label" => Translator::getInstance()->trans("Sale price without taxes"),
"label_attr" => array("for" => "price_with_tax_field")
))
->add("sale_price_with_tax", "number", array(
"label" => Translator::getInstance()->trans("Sale price including taxes"),
"label_attr" => array("for" => "sale_price_with_tax_field")
))
->add("onsale", "integer", array(
"label" => Translator::getInstance()->trans("This product is on sale"),
"label_attr" => array("for" => "onsale_field")
))
->add("isnew", "integer", array(
"label" => Translator::getInstance()->trans("Advertise this product as new"),
"label_attr" => array("for" => "isnew_field")
))
->add("isdefault", "integer", array(
"label" => Translator::getInstance()->trans("Is it the default product sale element ?"),
"label_attr" => array("for" => "isdefault_field")
))
->add("ean_code", "text", array(
"label" => Translator::getInstance()->trans("EAN Code"),
"label_attr" => array("for" => "ean_code_field")
))
->add("use_exchange_rate", "integer", array(
"label" => Translator::getInstance()->trans("Apply exchange rates on price in %sym", array("%sym" => Currency::getDefaultCurrency()->getSymbol())),
"label_attr" => array("for" => "use_exchange_rate_field")
))
;
}
public function getName()
{
return "thelia_product_default_sale_element_update_form";

View File

@@ -23,9 +23,9 @@
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints\GreaterThan;
use Thelia\Core\Translation\Translator;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Model\Currency;
use Thelia\Core\Translation\Translator;
class ProductSaleElementUpdateForm extends BaseForm
{
@@ -34,68 +34,124 @@ class ProductSaleElementUpdateForm extends BaseForm
protected function buildForm()
{
$this->formBuilder
->add("tax_rule", "integer", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Tax rule for this product *"),
"label_attr" => array("for" => "tax_rule_field")
))
->add("product_id", "integer", array(
"label" => Translator::getInstance()->trans("Product ID *"),
"label_attr" => array("for" => "product_id_field"),
"constraints" => array(new GreaterThan(array('value' => 0)))
"label" => Translator::getInstance()->trans("Product ID *"),
"label_attr" => array("for" => "product_id_field"),
"constraints" => array(new GreaterThan(array('value' => 0)))
))
->add("product_sale_element_id", "integer", array(
"label" => Translator::getInstance()->trans("Product sale element ID *"),
"label_attr" => array("for" => "product_sale_element_id_field")
))
->add("reference", "text", array(
"label" => Translator::getInstance()->trans("Reference *"),
"label_attr" => array("for" => "reference_field")
))
->add("price", "number", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Product price excluding taxes *"),
"label_attr" => array("for" => "price_field")
->add("default_pse", "integer", array(
"label" => Translator::getInstance()->trans("Default product sale element"),
"label_attr" => array("for" => "default_pse_field"),
))
->add("currency", "integer", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Price currency *"),
"label_attr" => array("for" => "currency_field")
))
->add("tax_rule", "integer", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Tax rule for this product *"),
"label_attr" => array("for" => "tax_rule_field")
))
->add("weight", "number", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Weight *"),
"label_attr" => array("for" => "weight_field")
))
->add("quantity", "number", array(
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Available quantity *"),
"label_attr" => array("for" => "quantity_field")
))
->add("sale_price", "number", array(
"label" => Translator::getInstance()->trans("Sale price without taxes *"),
"label_attr" => array("for" => "price_with_tax_field")
))
->add("onsale", "integer", array(
"label" => Translator::getInstance()->trans("This product is on sale"),
"label_attr" => array("for" => "onsale_field")
))
->add("isnew", "integer", array(
"label" => Translator::getInstance()->trans("Advertise this product as new"),
"label_attr" => array("for" => "isnew_field")
))
->add("isdefault", "integer", array(
"label" => Translator::getInstance()->trans("Is it the default product sale element ?"),
"label_attr" => array("for" => "isdefault_field")
))
->add("ean_code", "integer", array(
"label" => Translator::getInstance()->trans("EAN Code"),
"label_attr" => array("for" => "ean_code_field")
"constraints" => array(new NotBlank()),
"label" => Translator::getInstance()->trans("Price currency *"),
"label_attr" => array("for" => "currency_field")
))
->add("use_exchange_rate", "integer", array(
"label" => Translator::getInstance()->trans("Apply exchange rates on price in %sym", array("%sym" => Currency::getDefaultCurrency()->getSymbol())),
"label_attr" => array("for" => "use_exchange_rate_field")
))
// -- Collections
->add('product_sale_element_id', 'collection', array(
'type' => 'integer',
'label' => Translator::getInstance()->trans('Product sale element ID *'),
'label_attr' => array('for' => 'product_sale_element_id_field'),
'allow_add' => true,
'allow_delete' => true,
))
->add('reference', 'collection', array(
'type' => 'text',
'label' => Translator::getInstance()->trans('Reference *'),
'label_attr' => array('for' => 'reference_field'),
'allow_add' => true,
'allow_delete' => true,
))
->add('price', 'collection', array(
'type' => 'number',
'label' => Translator::getInstance()->trans('Product price excluding taxes *'),
'label_attr' => array('for' => 'price_field'),
'allow_add' => true,
'allow_delete' => true,
'options' => array(
'constraints' => array(new NotBlank()),
)
))
->add('price_with_tax', 'collection', array(
'type' => 'number',
'label' => Translator::getInstance()->trans('Product price including taxes'),
'label_attr' => array('for' => 'price_with_tax_field'),
'allow_add' => true,
'allow_delete' => true,
))
->add('weight', 'collection', array(
'type' => 'number',
'label' => Translator::getInstance()->trans('Weight *'),
'label_attr' => array('for' => 'weight_field'),
'allow_add' => true,
'allow_delete' => true,
'options' => array(
'constraints' => array(new NotBlank()),
)
))
->add('quantity', 'collection', array(
'type' => 'number',
'label' => Translator::getInstance()->trans('Available quantity *'),
'label_attr' => array('for' => 'quantity_field'),
'allow_add' => true,
'allow_delete' => true,
'options' => array(
'constraints' => array(new NotBlank()),
)
))
->add('sale_price', 'collection', array(
'label' => Translator::getInstance()->trans('Sale price without taxes'),
'label_attr' => array('for' => 'price_with_tax_field'),
'allow_add' => true,
'allow_delete' => true,
))
->add('sale_price_with_tax', 'collection', array(
'type' => 'number',
'label' => Translator::getInstance()->trans('Sale price including taxes'),
'label_attr' => array('for' => 'sale_price_with_tax_field'),
'allow_add' => true,
'allow_delete' => true,
))
->add('onsale', 'collection', array(
'type' => 'integer',
'label' => Translator::getInstance()->trans('This product is on sale'),
'label_attr' => array('for' => 'onsale_field'),
'allow_add' => true,
'allow_delete' => true,
))
->add('isnew', 'collection', array(
'type' => 'integer',
'label' => Translator::getInstance()->trans('Advertise this product as new'),
'label_attr' => array('for' => 'isnew_field'),
'allow_add' => true,
'allow_delete' => true,
))
->add('isdefault', 'collection', array(
'type' => 'integer',
'label' => Translator::getInstance()->trans('Is it the default product sale element ?'),
'label_attr' => array('for' => 'isdefault_field'),
'allow_add' => true,
'allow_delete' => true,
))
->add('ean_code', 'collection', array(
'type' => 'text',
'label' => Translator::getInstance()->trans('EAN Code'),
'label_attr' => array('for' => 'ean_code_field'),
'allow_add' => true,
'allow_delete' => true,
))
;
}

View File

@@ -26,7 +26,6 @@ use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Security\AccessManager;
use Thelia\Core\Translation\Translator;
use Thelia\Model\ProfileQuery;
use Thelia\Model\ModuleQuery;
@@ -57,7 +56,7 @@ class ProfileUpdateModuleAccessForm extends BaseForm
))
;
foreach(ModuleQuery::create()->find() as $module) {
foreach (ModuleQuery::create()->find() as $module) {
$this->formBuilder->add(
self::MODULE_ACCESS_FIELD_PREFIX . ':' . str_replace(".", ":", $module->getCode()),
"choice",

View File

@@ -26,7 +26,6 @@ use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Security\AccessManager;
use Thelia\Core\Translation\Translator;
use Thelia\Model\ProfileQuery;
use Thelia\Model\ResourceQuery;
@@ -57,7 +56,7 @@ class ProfileUpdateResourceAccessForm extends BaseForm
))
;
foreach(ResourceQuery::create()->find() as $resource) {
foreach (ResourceQuery::create()->find() as $resource) {
$this->formBuilder->add(
self::RESOURCE_ACCESS_FIELD_PREFIX . ':' . str_replace(".", ":", $resource->getCode()),
"choice",

View File

@@ -43,7 +43,7 @@ class TaxCreationForm extends BaseForm
$types = TaxEngine::getInstance()->getTaxTypeList();
$typeList = array();
$requirementList = array();
foreach($types as $type) {
foreach ($types as $type) {
$classPath = "\\Thelia\\TaxEngine\\TaxType\\$type";
$instance = new $classPath();
$typeList[$type] = $instance->getTitle();
@@ -65,8 +65,8 @@ class TaxCreationForm extends BaseForm
))
;
foreach($requirementList as $type => $requirements) {
foreach($requirements as $name => $requirementType) {
foreach ($requirementList as $type => $requirements) {
foreach ($requirements as $name => $requirementType) {
$this->formBuilder
->add($type . ':' . $name, new TheliaType(), array(
//"instance" => $requirementType,