diff --git a/core/lib/Thelia/Core/HttpFoundation/Session/Session.php b/core/lib/Thelia/Core/HttpFoundation/Session/Session.php index dd6af30d2..f2eaadc4d 100755 --- a/core/lib/Thelia/Core/HttpFoundation/Session/Session.php +++ b/core/lib/Thelia/Core/HttpFoundation/Session/Session.php @@ -47,7 +47,12 @@ class Session extends BaseSession */ public function getLang($forceDefault = true) { - return $this->get("thelia.current.lang", $forceDefault ? Lang::getDefaultLanguage():null); + $lang = $this->get("thelia.current.lang"); + if(null === $lang && $forceDefault) + { + $lang = Lang::getDefaultLanguage(); + } + return $lang; } public function setLang(Lang $lang) @@ -59,7 +64,12 @@ class Session extends BaseSession public function getAdminEditionLang() { - return $this->get('thelia.admin.edition.lang', Lang::getDefaultLanguage()); + $lang = $this->get('thelia.admin.edition.lang'); + + if (null === $lang) { + $lang = Lang::getDefaultLanguage(); + } + return $lang; } public function setAdminEditionLang($langId) @@ -76,7 +86,13 @@ class Session extends BaseSession public function getCurrency($forceDefault = true) { - return $this->get("thelia.current.currency", $forceDefault ? Currency::getDefaultCurrency():null); + $currency = $this->get("thelia.current.currency"); + + if(null === $currency && $forceDefault) + { + $currency = Currency::getDefaultCurrency(); + } + return $currency; } // -- Customer user -------------------------------------------------------- diff --git a/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php b/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php index 5e5dae010..c7426ef71 100755 --- a/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php +++ b/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php @@ -110,7 +110,7 @@ class ModelCriteriaTools { // If a lang has been requested, find the related Lang object, and get the locale if ($requestedLangId !== null) { - $localeSearch = LangQuery::create()->findOneById($requestedLangId); + $localeSearch = LangQuery::create()->findPk($requestedLangId); if ($localeSearch === null) { throw new \InvalidArgumentException(sprintf('Incorrect lang argument given : lang ID %d not found', $requestedLangId));