Merge branch 'master' into tax
This commit is contained in:
@@ -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 --------------------------------------------------------
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user