From fa597b5209a1d756c3a053fa2c93737172809c4a Mon Sep 17 00:00:00 2001 From: Petro Vashchuk Date: Mon, 8 Feb 2021 16:04:48 +0200 Subject: [PATCH] Bug 27654: Sort module.keys hash when render columns_settings.tt MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit On the "Administration -> Table settings" page, the order of "tables related to pages" sections is different with each page refresh. Cause of that is that Perl gives random order for hash keys where those elements are stored on template render. To avoid that we add a "sort" method where getting keys similarly how it was done previously to display tables always in the same order. To reproduce: 1) Head over to /cgi-bin/koha/admin/columns_settings.pl 2) Open any collapsed module settings, for example "Acquisition tables". Check the order of pages. 3) Reload the page. Check the order of the same elements again. They always come in random order, it's easily distinguishable. 4) Apply the patch. 5) Repeat steps 1-3 again and ensure that the order of pages stays the same no matter how many times you reload the page. Signed-off-by: Barbara Johnson Signed-off-by: Joonas Kylmälä Signed-off-by: Jonathan Druart (cherry picked from commit f58c271b4255e85b3b6ddf90a9e802249954cc13) Signed-off-by: Fridolin Somers --- .../intranet-tmpl/prog/en/modules/admin/columns_settings.tt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt index e2a5448706..80b20d790d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt @@ -6,7 +6,7 @@ [% BLOCK pagelist %] [% IF module.keys and module.keys.size > 0 %] Jump to: - [% FOR pagename IN module.keys %] + [% FOR pagename IN module.keys.sort %] [% pagename | html %] [% UNLESS loop.last %] | [% END %] [% END %] @@ -18,7 +18,7 @@ [% SET panel_id = panel_id + 1 %] [% IF module.keys and module.keys.size > 0 %] - [% FOR pagename IN module.keys %] + [% FOR pagename IN module.keys.sort %]

Page: [% pagename | html %]

[% SET tables = module %] [% IF tables.$pagename.keys and tables.$pagename.keys.size > 0 %] -- 2.39.5