Koha-clms/installer/data/mysql
Martin Renvoize 32e8a3a2ba
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 20:18:26 +01:00
..
atomicupdate Bug 34000: Add autoMemberNumValue system preference 2026-04-22 20:18:26 +01:00
db_revs Increment version for 24.11.14 release 2026-03-30 12:50:38 +00:00
en Bug 40071: MARC21 Addition to relator terms in technical notice 2025-06-04 2025-10-10 14:46:15 +02:00
localization Bug 27490: (follow-up) Fix custom installer files 2024-09-13 13:54:26 +02:00
mandatory Bug 34000: Add autoMemberNumValue system preference 2026-04-22 20:18:26 +01:00
backfill_statistics.pl
…
fix_unclosed_nonaccruing_fines_bug17135.pl
…
kohastructure.sql Bug 40936: Add index for default patron sort order 2025-11-10 15:35:44 +01:00
labels_upgrade.pl
…
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
…
update22to30.pl
…
updatedatabase.pl Bug 38299: (follow-up) (discussion) Move failure into same level 2024-11-18 17:44:40 +01:00