Ref #16977 - Fix selected value for enum get values route

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2021-06-23 13:31:21 +02:00
parent 15dfab25ee
commit 1bd76fc474
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889
2 changed files with 5 additions and 2 deletions

View File

@ -269,9 +269,12 @@ class SqlController extends AbstractController
return;
}
// Converts characters of $curr_value to HTML entities.
$convertedCurrentValue = htmlentities($curr_value, ENT_COMPAT, 'UTF-8');
$dropdown = $this->template->render('sql/enum_column_dropdown', [
'values' => $values,
'selected_values' => [$curr_value],
'selected_values' => [$convertedCurrentValue],
]);
$this->response->addJSON('dropdown', $dropdown);

View File

@ -195,7 +195,7 @@ class SqlControllerTest extends AbstractTestCase
'dropdown' => '<select>' . "\n"
. ' <option value="">&nbsp;</option>' . "\n"
. ' <option value="a&amp;b">a&amp;b</option>' . "\n"
. ' <option value="b&amp;c">b&amp;c</option>' . "\n"
. ' <option value="b&amp;c" selected>b&amp;c</option>' . "\n"
. ' <option value="vrai&amp;amp">vrai&amp;amp</option>' . "\n"
. ' <option value=""></option>' . "\n"
. ' </select>' . "\n",