From d3e590465c4436fe6e90a456203be954cf0fb7ee Mon Sep 17 00:00:00 2001 From: Thierry Bugier Date: Tue, 9 Jun 2020 09:43:25 +0200 Subject: [PATCH] fix(formanswer): display of status shall show a label Signed-off-by: Thierry Bugier --- inc/formanswer.class.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/inc/formanswer.class.php b/inc/formanswer.class.php index 955882995..1d987053f 100644 --- a/inc/formanswer.class.php +++ b/inc/formanswer.class.php @@ -284,17 +284,20 @@ public function rawSearchOptions() { */ public static function getSpecificValueToDisplay($field, $values, array $options = []) { if (!is_array($values)) { - $language = $_SESSION["glpilanguage"]; - Session::loadLanguage('en_GB'); - $elements = self::getStatuses(); - Session::loadLanguage($language); - $values = [$field => $elements[$values]]; + $values = [$field => $values]; } switch ($field) { case 'status' : - $output = '' . __($values[$field], 'formcreator') . ' '; - return $output; + if (!isAPI()) { + $language = $_SESSION["glpilanguage"]; + Session::loadLanguage('en_GB'); + $elements = self::getStatuses(); + Session::loadLanguage($language); + $values = [$field => $elements[$values[$field]]]; + $output = '' . __($values[$field], 'formcreator') . ' '; + return $output; + } break; } return parent::getSpecificValueToDisplay($field, $values, $options);