diff --git a/composer.phar b/composer.phar new file mode 100755 index 000000000..c076f78da Binary files /dev/null and b/composer.phar differ diff --git a/core/lib/Thelia/Action/Tax.php b/core/lib/Thelia/Action/Tax.php index 91e51b59f..c35d87bbe 100644 --- a/core/lib/Thelia/Action/Tax.php +++ b/core/lib/Thelia/Action/Tax.php @@ -41,11 +41,12 @@ class Tax extends BaseAction implements EventSubscriberInterface $tax ->setDispatcher($this->getDispatcher()) + ->setRequirements($event->getRequirements()) ->setType($event->getType()) ->setLocale($event->getLocale()) ->setTitle($event->getTitle()) ->setDescription($event->getDescription()) - ; + ; $tax->save(); @@ -61,14 +62,14 @@ class Tax extends BaseAction implements EventSubscriberInterface $tax ->setDispatcher($this->getDispatcher()) + ->setRequirements($event->getRequirements()) ->setType($event->getType()) ->setLocale($event->getLocale()) ->setTitle($event->getTitle()) ->setDescription($event->getDescription()) - ->save() ; - + $tax->save(); $event->setTax($tax); } @@ -98,7 +99,6 @@ class Tax extends BaseAction implements EventSubscriberInterface TheliaEvents::TAX_CREATE => array("create", 128), TheliaEvents::TAX_UPDATE => array("update", 128), TheliaEvents::TAX_DELETE => array("delete", 128), - ); } } diff --git a/core/lib/Thelia/Action/TaxRule.php b/core/lib/Thelia/Action/TaxRule.php index 4b24f8cb9..b3f1d23ae 100644 --- a/core/lib/Thelia/Action/TaxRule.php +++ b/core/lib/Thelia/Action/TaxRule.php @@ -27,6 +27,7 @@ use Propel\Runtime\ActiveQuery\Criteria; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Thelia\Core\Event\Tax\TaxRuleEvent; use Thelia\Core\Event\TheliaEvents; +use Thelia\Model\Map\TaxRuleTableMap; use Thelia\Model\TaxRuleCountry; use Thelia\Model\TaxRuleCountryQuery; use Thelia\Model\TaxRule as TaxRuleModel; @@ -134,6 +135,23 @@ class TaxRule extends BaseAction implements EventSubscriberInterface } } + /** + * @param TaxRuleEvent $event + */ + public function setDefault(TaxRuleEvent $event) + { + if (null !== $taxRule = TaxRuleQuery::create()->findPk($event->getId())) { + + TaxRuleQuery::create()->update(array( + "IsDefault" => 0 + )); + + $taxRule->setIsDefault(1)->save(); + + $event->setTaxRule($taxRule); + } + } + /** * {@inheritDoc} */ @@ -144,7 +162,7 @@ class TaxRule extends BaseAction implements EventSubscriberInterface TheliaEvents::TAX_RULE_UPDATE => array("update", 128), TheliaEvents::TAX_RULE_TAXES_UPDATE => array("updateTaxes", 128), TheliaEvents::TAX_RULE_DELETE => array("delete", 128), - + TheliaEvents::TAX_RULE_SET_DEFAULT => array("setDefault", 128), ); } } diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml index dc8b0038f..d7edf8984 100755 --- a/core/lib/Thelia/Config/Resources/config.xml +++ b/core/lib/Thelia/Config/Resources/config.xml @@ -55,6 +55,7 @@
+ @@ -131,6 +132,10 @@ + + + + diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index 72fa1cd15..7cc97a49e 100755 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -4,22 +4,22 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - +