From 7b9e94114f83ddd4b63922aa3e3dfec72363eba4 Mon Sep 17 00:00:00 2001 From: Thierry Bugier Date: Tue, 10 Oct 2023 08:37:13 +0200 Subject: [PATCH] fix(requesttype): force english for comparisons --- inc/field/requesttypefield.class.php | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/inc/field/requesttypefield.class.php b/inc/field/requesttypefield.class.php index 7dcf66deb..7072c5554 100644 --- a/inc/field/requesttypefield.class.php +++ b/inc/field/requesttypefield.class.php @@ -173,7 +173,15 @@ public function isValidValue($value): bool { } public function equals($value): bool { + global $TRANSLATE; + + $oldLocale = $TRANSLATE->getLocale(); + $TRANSLATE->setLocale("en_GB"); + $_SESSION['glpilanguage'] = "en_GB"; $available = $this->getAvailableValues(); + $TRANSLATE->setLocale($oldLocale); + $_SESSION['glpilanguage'] = $oldLocale; + if (!isset($available[$this->value])) { return false; } @@ -181,7 +189,15 @@ public function equals($value): bool { } public function notEquals($value): bool { + global $TRANSLATE; + + $oldLocale = $TRANSLATE->getLocale(); + $TRANSLATE->setLocale("en_GB"); + $_SESSION['glpilanguage'] = "en_GB"; $available = $this->getAvailableValues(); + $TRANSLATE->setLocale($oldLocale); + $_SESSION['glpilanguage'] = $oldLocale; + if (!isset($available[$this->value])) { return false; } @@ -189,7 +205,15 @@ public function notEquals($value): bool { } public function greaterThan($value): bool { + global $TRANSLATE; + + $oldLocale = $TRANSLATE->getLocale(); + $TRANSLATE->setLocale("en_GB"); + $_SESSION['glpilanguage'] = "en_GB"; $available = $this->getAvailableValues(); + $TRANSLATE->setLocale($oldLocale); + $_SESSION['glpilanguage'] = $oldLocale; + if (!isset($available[$this->value])) { return false; } @@ -197,7 +221,15 @@ public function greaterThan($value): bool { } public function lessThan($value): bool { + global $TRANSLATE; + + $oldLocale = $TRANSLATE->getLocale(); + $TRANSLATE->setLocale("en_GB"); + $_SESSION['glpilanguage'] = "en_GB"; $available = $this->getAvailableValues(); + $TRANSLATE->setLocale($oldLocale); + $_SESSION['glpilanguage'] = $oldLocale; + if (!isset($available[$this->value])) { return false; }