Bug 27654: Sort module.keys hash when render columns_settings.tt
authorPetro Vashchuk <stalkernoid@gmail.com>
Mon, 8 Feb 2021 14:04:48 +0000 (16:04 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 12 Feb 2021 11:14:50 +0000 (12:14 +0100)
commitf58c271b4255e85b3b6ddf90a9e802249954cc13
tree10e44e3ab7a36eae59a0bc047009d79fc32c8572
parent4bb20fdb30202018f1519c6bd336e33fa6732d9e
Bug 27654: Sort module.keys hash when render columns_settings.tt

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 <barbara.johnson@bedfordtx.gov>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/intranet-tmpl/prog/en/modules/admin/columns_settings.tt