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);