]> git.koha-community.org Git - koha.git/commit
Bug 37155: Refactor GetAgeRestrictions
authorNick Clemens <nick@bywatersolutions.com>
Fri, 21 Jun 2024 13:39:38 +0000 (13:39 +0000)
committerKatrin Fischer <katrin.fischer@bsz-bw.de>
Mon, 1 Jul 2024 16:55:50 +0000 (18:55 +0200)
commit11c5abda48bd758d8ecd1ae3ea2ba938199ee59f
treeea44622e0bcd079b29769fc8bac6cde360792319
parenta1cfe67d5e2b0aef31c2dfdd8a1c921ba50f9ddd
Bug 37155: Refactor GetAgeRestrictions

This routine currently takes the agerestriction value from biblioitems and an unblessed borrower object
and uses the date of birth to calculate whether the ptrons DOB is before or after the minimum value required
against the age restriction

We have a routine in the patron object to get the patron's age - we cna use this against the parsed agerestriction
value in a simple comparison and remove the need to unbless and pass the patron.

FIXME: We should move this to a biblioitems or biblio object method

To test:
0 - In Admin -> Koha to MARC mapping, set biblioitems.agerestriction to 521,a
1 - Set syspref AgeRestrictionMarker to 'Age'
2 - Edit a record and set 521$a to 'Age 14'
3 - Add an item or copy the barcode of the item on that record
4 - Attempt to checkout item to Lisa Charles in sample data, or a 15 year old patron
5 - It should checkout fine
6 - Check in item
7 - Edit patron  Joyce Gaines to set age to 13 DOB:06/20/2011, or create a 13 year old patron
8 - Attempt to checkout item
9 - Item is blocked
10 - Apply patch
11 - Repeat tests, confirm no change

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
C4/Circulation.pm
C4/Reserves.pm
t/Circulation/AgeRestrictionMarkers.t