diff --git a/core/lib/Thelia/Controller/Admin/AttributeAvController.php b/core/lib/Thelia/Controller/Admin/AttributeAvController.php index 97b4cd5e6..4ddf439a2 100644 --- a/core/lib/Thelia/Controller/Admin/AttributeAvController.php +++ b/core/lib/Thelia/Controller/Admin/AttributeAvController.php @@ -137,9 +137,14 @@ class AttributeAvController extends AbstractCrudController protected function getExistingObject() { - return AttributeAvQuery::create() - ->joinWithI18n($this->getCurrentEditionLocale()) - ->findOneById($this->getRequest()->get('attributeav_id')); + $attributeAv = AttributeAvQuery::create() + ->findOneById($this->getRequest()->get('attributeav_id', 0)); + + if (null !== $attributeAv) { + $attribute->setLocale($this->getCurrentEditionLocale()); + } + + return $attributeAv; } protected function getObjectLabel($object) diff --git a/core/lib/Thelia/Controller/Admin/AttributeController.php b/core/lib/Thelia/Controller/Admin/AttributeController.php index b058f060d..52b70f0a2 100644 --- a/core/lib/Thelia/Controller/Admin/AttributeController.php +++ b/core/lib/Thelia/Controller/Admin/AttributeController.php @@ -167,9 +167,14 @@ class AttributeController extends AbstractCrudController protected function getExistingObject() { - return AttributeQuery::create() - ->joinWithI18n($this->getCurrentEditionLocale()) - ->findOneById($this->getRequest()->get('attribute_id')); + $attribute = AttributeQuery::create() + ->findOneById($this->getRequest()->get('attribute_id', 0)); + + if (null !== $attribute) { + $attribute->setLocale($this->getCurrentEditionLocale()); + } + + return $attribute; } protected function getObjectLabel($object) diff --git a/core/lib/Thelia/Controller/Admin/ConfigController.php b/core/lib/Thelia/Controller/Admin/ConfigController.php index fe18720b6..8e4e0d43c 100644 --- a/core/lib/Thelia/Controller/Admin/ConfigController.php +++ b/core/lib/Thelia/Controller/Admin/ConfigController.php @@ -140,9 +140,14 @@ class ConfigController extends AbstractCrudController protected function getExistingObject() { - return ConfigQuery::create() - ->joinWithI18n($this->getCurrentEditionLocale()) + $config = ConfigQuery::create() ->findOneById($this->getRequest()->get('variable_id')); + + if (null !== $config) { + $config->setLocale($this->getCurrentEditionLocale()); + } + + return $config; } protected function getObjectLabel($object) diff --git a/core/lib/Thelia/Controller/Admin/CountryController.php b/core/lib/Thelia/Controller/Admin/CountryController.php index d950cc487..43959b909 100644 --- a/core/lib/Thelia/Controller/Admin/CountryController.php +++ b/core/lib/Thelia/Controller/Admin/CountryController.php @@ -120,8 +120,6 @@ class CountryController extends AbstractCrudController $event ->setLocale($formData['locale']) ->setTitle($formData['title']) - ->setChapo($formData['chapo']) - ->setDescription($formData['description']) ->setIsocode($formData['isocode']) ->setIsoAlpha2($formData['isoalpha2']) ->setIsoAlpha3($formData['isoalpha3']) @@ -164,9 +162,14 @@ class CountryController extends AbstractCrudController */ protected function getExistingObject() { - return CountryQuery::create() - ->joinWithI18n($this->getCurrentEditionLocale()) + $country = CountryQuery::create() ->findPk($this->getRequest()->get('country_id', 0)); + + if (null !== $country) { + $country->setLocale($this->getCurrentEditionLocale()); + } + + return $country; } /** diff --git a/core/lib/Thelia/Controller/Admin/CurrencyController.php b/core/lib/Thelia/Controller/Admin/CurrencyController.php index be780a13b..a9212c0d4 100644 --- a/core/lib/Thelia/Controller/Admin/CurrencyController.php +++ b/core/lib/Thelia/Controller/Admin/CurrencyController.php @@ -141,9 +141,14 @@ class CurrencyController extends AbstractCrudController protected function getExistingObject() { - return CurrencyQuery::create() - ->joinWithI18n($this->getCurrentEditionLocale()) + $currency = CurrencyQuery::create() ->findOneById($this->getRequest()->get('currency_id')); + + if (null !== $currency) { + $currency->setLocale($this->getCurrentEditionLocale()); + } + + return $currency; } protected function getObjectLabel($object) diff --git a/core/lib/Thelia/Controller/Admin/FeatureAvController.php b/core/lib/Thelia/Controller/Admin/FeatureAvController.php index f1ac84f7b..9eea87b32 100644 --- a/core/lib/Thelia/Controller/Admin/FeatureAvController.php +++ b/core/lib/Thelia/Controller/Admin/FeatureAvController.php @@ -137,9 +137,14 @@ class FeatureAvController extends AbstractCrudController protected function getExistingObject() { - return FeatureAvQuery::create() - ->joinWithI18n($this->getCurrentEditionLocale()) - ->findOneById($this->getRequest()->get('featureav_id')); + $featureAv = FeatureAvQuery::create() + ->findOneById($this->getRequest()->get('featureav_id', 0)); + + if (null !== $featureAv) { + $featureAv->setLocale($this->getCurrentEditionLocale()); + } + + return $featureAv; } protected function getObjectLabel($object) diff --git a/core/lib/Thelia/Controller/Admin/FeatureController.php b/core/lib/Thelia/Controller/Admin/FeatureController.php index 5ae0aae7d..4cbbd8527 100644 --- a/core/lib/Thelia/Controller/Admin/FeatureController.php +++ b/core/lib/Thelia/Controller/Admin/FeatureController.php @@ -167,9 +167,14 @@ class FeatureController extends AbstractCrudController protected function getExistingObject() { - return FeatureQuery::create() - ->joinWithI18n($this->getCurrentEditionLocale()) - ->findOneById($this->getRequest()->get('feature_id')); + $feature = FeatureQuery::create() + ->findOneById($this->getRequest()->get('feature_id', 0)); + + if (null !== $feature) { + $feature->setLocale($this->getCurrentEditionLocale()); + } + + return $feature; } protected function getObjectLabel($object) diff --git a/core/lib/Thelia/Controller/Admin/MessageController.php b/core/lib/Thelia/Controller/Admin/MessageController.php index aebf29d04..e6b50c96d 100644 --- a/core/lib/Thelia/Controller/Admin/MessageController.php +++ b/core/lib/Thelia/Controller/Admin/MessageController.php @@ -143,9 +143,14 @@ class MessageController extends AbstractCrudController protected function getExistingObject() { - return MessageQuery::create() - ->joinWithI18n($this->getCurrentEditionLocale()) - ->findOneById($this->getRequest()->get('message_id')); + $message = MessageQuery::create() + ->findOneById($this->getRequest()->get('message_id', 0)); + + if (null !== $message) { + $message->setLocale($this->getCurrentEditionLocale()); + } + + return $message; } protected function getObjectLabel($object) diff --git a/core/lib/Thelia/Controller/Admin/ModuleController.php b/core/lib/Thelia/Controller/Admin/ModuleController.php index 4c7b6dbb2..e86014809 100644 --- a/core/lib/Thelia/Controller/Admin/ModuleController.php +++ b/core/lib/Thelia/Controller/Admin/ModuleController.php @@ -144,9 +144,14 @@ class ModuleController extends AbstractCrudController protected function getExistingObject() { - return ModuleQuery::create() - ->joinWithI18n($this->getCurrentEditionLocale()) - ->findOneById($this->getRequest()->get('module_id')); + $module = ModuleQuery::create() + ->findOneById($this->getRequest()->get('module_id', 0)); + + if (null !== $module) { + $module->setLocale($this->getCurrentEditionLocale()); + } + + return $module; } protected function getObjectLabel($object) diff --git a/core/lib/Thelia/Controller/Admin/ProfileController.php b/core/lib/Thelia/Controller/Admin/ProfileController.php index 9b83c30b7..22794789f 100644 --- a/core/lib/Thelia/Controller/Admin/ProfileController.php +++ b/core/lib/Thelia/Controller/Admin/ProfileController.php @@ -145,9 +145,14 @@ class ProfileController extends AbstractCrudController protected function getExistingObject() { - return ProfileQuery::create() - ->joinWithI18n($this->getCurrentEditionLocale()) - ->findOneById($this->getRequest()->get('profile_id')); + $profile = ProfileQuery::create() + ->findOneById($this->getRequest()->get('profile_id', 0)); + + if (null !== $profile) { + $profile->setLocale($this->getCurrentEditionLocale()); + } + + return $profile; } protected function getObjectLabel($object) diff --git a/core/lib/Thelia/Controller/Admin/TaxController.php b/core/lib/Thelia/Controller/Admin/TaxController.php index 96b6a4d5b..f5c20a1bd 100644 --- a/core/lib/Thelia/Controller/Admin/TaxController.php +++ b/core/lib/Thelia/Controller/Admin/TaxController.php @@ -121,9 +121,14 @@ class TaxController extends AbstractCrudController protected function getExistingObject() { - return TaxQuery::create() - ->joinWithI18n($this->getCurrentEditionLocale()) - ->findOneById($this->getRequest()->get('tax_id')); + $tax = TaxQuery::create() + ->findOneById($this->getRequest()->get('tax_id', 0)); + + if (null !== $tax) { + $tax->setLocale($this->getCurrentEditionLocale()); + } + + return $tax; } protected function getObjectLabel($object) diff --git a/core/lib/Thelia/Controller/Admin/TaxRuleController.php b/core/lib/Thelia/Controller/Admin/TaxRuleController.php index b85123505..0f64c3ccb 100644 --- a/core/lib/Thelia/Controller/Admin/TaxRuleController.php +++ b/core/lib/Thelia/Controller/Admin/TaxRuleController.php @@ -140,9 +140,14 @@ class TaxRuleController extends AbstractCrudController protected function getExistingObject() { - return TaxRuleQuery::create() - ->joinWithI18n($this->getCurrentEditionLocale()) + $taxRule = TaxRuleQuery::create() ->findOneById($this->getRequest()->get('tax_rule_id')); + + if (null !== $taxRule) { + $taxRule->setLocale($this->getCurrentEditionLocale()); + } + + return $taxRule; } protected function getObjectLabel($object) diff --git a/core/lib/Thelia/Controller/Admin/TemplateController.php b/core/lib/Thelia/Controller/Admin/TemplateController.php index 5e551679d..bd2d9bf9c 100644 --- a/core/lib/Thelia/Controller/Admin/TemplateController.php +++ b/core/lib/Thelia/Controller/Admin/TemplateController.php @@ -129,9 +129,14 @@ class TemplateController extends AbstractCrudController protected function getExistingObject() { - return TemplateQuery::create() - ->joinWithI18n($this->getCurrentEditionLocale()) - ->findOneById($this->getRequest()->get('template_id')); + $template = TemplateQuery::create() + ->findOneById($this->getRequest()->get('template_id', 0)); + + if (null !== $template) { + $template->setLocale($this->getCurrentEditionLocale()); + } + + return $template; } protected function getObjectLabel($object) diff --git a/templates/backOffice/default/configuration.html b/templates/backOffice/default/configuration.html index 12ee85cda..1560cd332 100755 --- a/templates/backOffice/default/configuration.html +++ b/templates/backOffice/default/configuration.html @@ -178,14 +178,6 @@