Bug 13106 - Encapsulate Circulation::GetAgeRestriction() and modify it to check borro...
authorOlli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Fri, 17 Oct 2014 14:23:21 +0000 (17:23 +0300)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Tue, 11 Nov 2014 12:52:59 +0000 (09:52 -0300)
commitae7d5fd11b2ed75e2fae120ec0499e3abc966c78
treedf45f80717655632fe4371ec660ae1d8a28d5f5f
parentc0aa0f5529825724e654fa7ccaae2b3e98c95cd0
Bug 13106 - Encapsulate Circulation::GetAgeRestriction() and modify it to check borrowers age as well.

This patch moves the logic of deciding whether or not a borrower is old enough to access this material
to its own function GetAgeRestriction.

This makes it easier to use AgeRestriction elsewhere, like with placing holds.

This feature adds a new function C4::Members::SetAge() to make testing ages a lot easier.
A ton of Unit tests included.

C4::Circulate::CanBookBeIssued() fixed and issue with undefined $daysToAgeRestriction per Marc VĂ©ron's
suggestion.

Test plan:
(See comment #10 for screenshots about using age restriction)

1) Without patch

Configure Age Restricition (see Syspref AgeRestrictionMarker) and have a biblio record with e.g. PEGI 99 in age restriction field
Try to check out to a patron with age < 99
Check out should be blocked
Change entry in age restriction field to PEGI99
Check out schould now be blocked

2) With patch
Try checkouts again, behaviour should be th same.

Signed-off-by: Marc Veron <veron@veron.ch>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
C4/Circulation.pm
C4/Members.pm
t/Circulation/AgeRestrictionMarkers.t
t/db_dependent/Members.t