diff --git a/core/lib/Thelia/Controller/Admin/AbstractCrudController.php b/core/lib/Thelia/Controller/Admin/AbstractCrudController.php
index 170c35c4f..a1be6a15d 100644
--- a/core/lib/Thelia/Controller/Admin/AbstractCrudController.php
+++ b/core/lib/Thelia/Controller/Admin/AbstractCrudController.php
@@ -392,6 +392,8 @@ abstract class AbstractCrudController extends BaseAdminController
// Get the form field values
$data = $form->getData();
+ $dataType = $form->all();
+
$changeEvent = $this->getUpdateEvent($data);
$this->dispatch($this->updateEventIdentifier, $changeEvent);
diff --git a/core/lib/Thelia/Controller/Admin/TaxController.php b/core/lib/Thelia/Controller/Admin/TaxController.php
index 0c83aa4cb..bbaf075cb 100644
--- a/core/lib/Thelia/Controller/Admin/TaxController.php
+++ b/core/lib/Thelia/Controller/Admin/TaxController.php
@@ -76,6 +76,11 @@ class TaxController extends AbstractCrudController
{
$event = new TaxEvent();
+ /* check the requirements */
+ if(!$this->checkRequirements($formData)) {
+
+ }
+
$event->setLocale($formData['locale']);
$event->setId($formData['id']);
$event->setTitle($formData['title']);
@@ -195,4 +200,11 @@ class TaxController extends AbstractCrudController
"admin.configuration.taxes-rules.list"
);
}
+
+ protected function checkRequirements($formData)
+ {
+ $type = $formData['type'];
+
+
+ }
}
\ No newline at end of file
diff --git a/core/lib/Thelia/Core/Form/Type/TheliaType.php b/core/lib/Thelia/Core/Form/Type/TheliaType.php
index 4820f9b3b..19524ec85 100644
--- a/core/lib/Thelia/Core/Form/Type/TheliaType.php
+++ b/core/lib/Thelia/Core/Form/Type/TheliaType.php
@@ -12,12 +12,16 @@ class TheliaType extends AbstractType
{
$resolver->setDefaults(array(
'instance' => false,
- 'type' => false,
- 'options' => false,
+ 'type' => false,
+ 'options' => false,
));
$resolver->setAllowedTypes(array(
- 'instance' => array('Thelia\Type\TypeInterface'),
+ 'instance' => array('Thelia\Type\TypeInterface'),
+ ));
+
+ $resolver->setAllowedValues(array(
+ 'type' => array('text', 'choice'),
));
}
diff --git a/core/lib/Thelia/Core/Template/Loop/Tax.php b/core/lib/Thelia/Core/Template/Loop/Tax.php
index 0248e60d8..a927a0dbd 100644
--- a/core/lib/Thelia/Core/Template/Loop/Tax.php
+++ b/core/lib/Thelia/Core/Template/Loop/Tax.php
@@ -151,10 +151,12 @@ class Tax extends BaseI18nLoop
$loopResultRow = new LoopResultRow($loopResult, $tax, $this->versionable, $this->timestampable, $this->countable);
+ $requirements = json_decode( base64_decode( $tax->getSerializedRequirements() ), true );
+
$loopResultRow
->set("ID" , $tax->getId())
->set("TYPE" , $tax->getType())
- ->set("SERIALIZED_REQUIREMENTS" , $tax->getSerializedRequirements())
+ ->set("REQUIREMENTS" , $requirements)
->set("IS_TRANSLATED" , $tax->getVirtualColumn('IS_TRANSLATED'))
->set("LOCALE" , $locale)
->set("TITLE" , $tax->getVirtualColumn('i18n_TITLE'))
diff --git a/core/lib/Thelia/Form/TaxCreationForm.php b/core/lib/Thelia/Form/TaxCreationForm.php
index 5448d3367..901c459b3 100644
--- a/core/lib/Thelia/Form/TaxCreationForm.php
+++ b/core/lib/Thelia/Form/TaxCreationForm.php
@@ -24,6 +24,7 @@ namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\Constraints\NotBlank;
+use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Core\Form\Type\TheliaType;
use Thelia\Core\Translation\Translator;
use Thelia\TaxEngine\TaxEngine;
@@ -54,6 +55,13 @@ class TaxCreationForm extends BaseForm
"required" => true,
"constraints" => array(
new Constraints\NotBlank(),
+ new Constraints\Callback(
+ array(
+ "methods" => array(
+ array($this, "verifyRequirements"),
+ ),
+ )
+ ),
),
"label" => Translator::getInstance()->trans("Type"),
"label_attr" => array("for" => "type_field"),
@@ -66,8 +74,12 @@ class TaxCreationForm extends BaseForm
->add($type . '_' . $name, new TheliaType(), array(
"instance" => $requirementType,
"constraints" => array(
- "methods" => array(
- array($this, "verifyTaxId"),
+ new Constraints\Callback(
+ array(
+ "methods" => array(
+ array($this, "verifyRequirements"),
+ ),
+ )
),
),
"attr" => array(
@@ -91,4 +103,11 @@ class TaxCreationForm extends BaseForm
{
return "thelia_tax_creation";
}
+
+ public function verifyRequirements($value, ExecutionContextInterface $context)
+ {
+ $in = true;
+
+
+ }
}
diff --git a/templates/admin/default/tax-edit.html b/templates/admin/default/tax-edit.html
index 173246d76..07a18a111 100644
--- a/templates/admin/default/tax-edit.html
+++ b/templates/admin/default/tax-edit.html
@@ -93,12 +93,12 @@
{if $formType == 'choice'}
{/if}
{if $formType == 'text'}
-
+
{/if}
{/form_tagged_fields}