Koha-clms/installer/data/mysql
Martin Renvoize aa84e99db8
Bug 34000: Add autoMemberNumValue system preference
Introduces a new system preference, autoMemberNumValue, which tracks
the highest auto-generated cardnumber ever issued. It is seeded from
the MAX cardnumber across both borrowers and deletedborrowers so
pre-upgrade deletions do not free numbers for re-issuance.

This preference is managed internally by Koha::Patron::fixup_cardnumber
and has no UI (no YAML entry).

Test plan:
1. Apply the atomicupdate:
   perl installer/data/mysql/updatedatabase.pl
2. Verify the preference exists:
   SELECT * FROM systempreferences WHERE variable = 'autoMemberNumValue';
3. Confirm the seed value matches:
   SELECT GREATEST(
       COALESCE((SELECT MAX(CAST(cardnumber AS SIGNED)) FROM borrowers
                 WHERE cardnumber REGEXP '^-?[0-9]+\$'), 0),
       COALESCE((SELECT MAX(CAST(cardnumber AS SIGNED)) FROM deletedborrowers
                 WHERE cardnumber REGEXP '^-?[0-9]+\$'), 0)
   );
4. Re-run the atomicupdate and confirm the already-exists warning.
5. Drop the syspref, re-apply the atomicupdate, confirm it seeds
   correctly on fresh installs via mandatory/sysprefs.sql.

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-04-22 17:00:45 +01:00
..
atomicupdate Bug 34000: Add autoMemberNumValue system preference 2026-04-22 17:00:45 +01:00
db_revs DBRev 25.11.03.001 2026-04-13 08:52:35 +01:00
en Bug 39532: Use new FINES restriction type to avoid conflict with SUSPENSION 2025-11-21 08:41:51 -07:00
localization Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
mandatory Bug 34000: Add autoMemberNumValue system preference 2026-04-22 17:00:45 +01:00
backfill_statistics.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
fix_unclosed_nonaccruing_fines_bug17135.pl Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
kohastructure.sql Bug 41409: Add COMMENT to kohastructure 2026-04-13 14:04:54 +01:00
labels_upgrade.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
needs_update.pl Bug 34088: Move the 'needs update' test to a separate script 2024-09-17 10:48:39 +02:00
patroncards_upgrade.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
update22to30.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
updatedatabase.pl Bug 38384: (follow-up) move require Koha::Plugins to use 2026-04-10 14:18:50 +01:00