From 8250bf0800dab32737229c7b6df220e6c36626ff Mon Sep 17 00:00:00 2001 From: Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> Date: Thu, 21 Oct 2021 18:42:20 +0200 Subject: [PATCH] fix sort option broken in https://develop.studip.de/trac/ticket/10221, fixes #353 --- lib/extern/views/ExternEditModule.class.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/extern/views/ExternEditModule.class.php b/lib/extern/views/ExternEditModule.class.php index 8ffd48c3d6b..7d71de1b38e 100644 --- a/lib/extern/views/ExternEditModule.class.php +++ b/lib/extern/views/ExternEditModule.class.php @@ -188,6 +188,9 @@ class ExternEditModule extends ExternEditHtml { if (!is_array($hide_fields)) { $hide_fields = []; } + if (!is_array($hide_fields["sort"])) { + $hide_fields["sort"] = []; + } $sort = $this->getValue("sort"); @@ -196,23 +199,21 @@ class ExternEditModule extends ExternEditHtml { $out .= "<td><b>" . _("Datenfeld") . "</b></td>\n"; $out .= "<td><b>" . _("Sortierung") . "</b></td>\n"; - if(!empty($field_names)) { + if ($field_names) { for ($i = 0; $i < count($field_names); $i++) { $out .= "<tr valign=\"middle\">\n"; $out .= "<td> {$field_names[$i]}</td>"; - if (!in_array($i, $hide_fields)) { + if (!in_array($i, $hide_fields["sort"])) { $out .= "<td><select name=\"{$this->element_name}_sort[$i]\" "; $out .= "size=\"1\">\n"; $out .= "<option value=\"0\"" . ($sort[$i] == 1 ? " selected" : "") . ">" . _("keine") . "</option>"; - if (!empty($hide_fields["sort"])) { - for ($j = 1; $j <= (count($field_names) - count($hide_fields["sort"])); $j++) { - if ($sort[$i] == $j) - $selected = " selected"; - else - $selected = ""; - $out .= "<option value=\"$j\"$selected>$j</option>"; - } + for ($j = 1; $j <= (count($field_names) - count($hide_fields["sort"])); $j++) { + if ($sort[$i] == $j) + $selected = " selected"; + else + $selected = ""; + $out .= "<option value=\"$j\"$selected>$j</option>"; } $out .= "\n</select>\n</td>\n"; } -- GitLab