]> git.koha-community.org Git - koha.git/commit
Bug 37870: Fix sort order of class sources
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 10 Sep 2024 08:39:13 +0000 (10:39 +0200)
committerKatrin Fischer <katrin.fischer@bsz-bw.de>
Thu, 12 Sep 2024 11:52:35 +0000 (13:52 +0200)
commit405c2ac6b6135a4e54195a01420808815dd4e7e1
tree0da5391420dfefdd756d0d5a09904a8052383028
parent0472b56a6714205675697dd4efae308dff16c9d9
Bug 37870: Fix sort order of class sources

There are several things going on here.
The tests are failing randomly when some additional class sources are in the
DB. This should never happen on Jenkins, but it happened, see the third
patch of this patch set (spoiler: tests not run within a txn)

There were also a sorting problem: by default sort will show
uppercases first:
  A, B, C, a, b, c
However we want:
  a, A, b, B, c, C
which is what fc does (https://perldoc.perl.org/functions/fc)

Test plan:
0. Checkout the main branch, without patches from this patchset.
1. Run t/db_dependent/ClassSources.t several times
=> Notice that new entries in the DB table 'class_sources' are created
2. Run t/db_dependent/Koha/UI/Form/Builder/Biblio.t and
t/db_dependent/Koha/UI/Form/Builder/Item.t
=> They fail (if not, run t/db_dependent/ClassSources.t again)
3. Apply the patches
4. Run t/db_dependent/ClassSources.t
=> No more additional entries in DB, tests are correctly run within
transactions
5. Run t/db_dependent/Koha/UI/Form/Builder/Biblio.t and
   t/db_dependent/Koha/UI/Form/Builder/Item.t several times
=> They always pass

Note that the sort should actually be done on the description, not the
code. But that's for another bug...

Signed-off-by: CJ Lynce <cj.lynce@westlakelibrary.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Koha/UI/Form/Builder/Biblio.pm
Koha/UI/Form/Builder/Item.pm
t/db_dependent/Koha/UI/Form/Builder/Biblio.t
t/db_dependent/Koha/UI/Form/Builder/Item.t