Fix sysprefs_order check to sort like the database
The sysprefs_order check used a buggy comparator:
sort { $b =~ s/_/ZZZ/g; lc $a cmp lc $b } @sysprefs- s/// on $b modifies the list elements in place (hide_marc becomes hideZZZmarc in @sysprefs as well)
- only $b is transformed, never $a, so the comparison is inconsistent and the result depends on the order the comparisons are made in
- the premise is wrong: MySQL/MariaDB do not sort the underscore last
As a result the check reported a false positive on Koha main: Not blocker: Sysprefs hidelostitems is badly placed (see bug 10610) whereas hide_marc before hidelostitems is the correct order.
Since Koha bug 41834 (commit 10e1708456b), t/db_dependent/check_sysprefs.t no longer uses this comparator: it requires sysprefs.sql to be in the same order as "SELECT variable FROM systempreferences ORDER BY variable", i.e. sorted with the column collation (utf8mb4_unicode_ci).
Use Unicode::Collate (core module) with primary strength (case and accent insensitive) and non-ignorable variable weighting, which matches utf8mb4_unicode_ci. A plain "lc $a cmp lc $b" would not: it sorts by ASCII code, so the order of "-", "_" and digits differs from the DB.
Test plan:
- In KTD, on Koha main, modify installer/data/mysql/mandatory/sysprefs.sql
(e.g. change a value), commit and run
qa -c 1=> Without this patch: WARN sysprefs_order (hidelostitems is badly placed) => With this patch: PASS - Move a syspref line to a wrong position, commit and run
qa -c 1=> WARN sysprefs_order - prove t/ => All tests pass
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com