Nick Clemens
11c5abda48
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>
49 lines
1.6 KiB
Perl
Executable file
49 lines
1.6 KiB
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
# This file is part of Koha.
|
|
#
|
|
# Copyright 2015 Koha Development Team
|
|
# Copyright (C) 2015 Mark Tompsett (Time Zone Shifts)
|
|
#
|
|
# Koha is free software; you can redistribute it and/or modify it
|
|
# under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# Koha is distributed in the hope that it will be useful, but
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
|
|
|
use Modern::Perl;
|
|
|
|
use DateTime;
|
|
use Koha::DateUtils qw( dt_from_string );
|
|
use Test::More tests => 6;
|
|
use Test::Warn;
|
|
|
|
use t::lib::Mocks;
|
|
|
|
use C4::Circulation qw( GetAgeRestriction );
|
|
|
|
t::lib::Mocks::mock_preference( 'AgeRestrictionMarker', 'FSK|PEGI|Age|K' );
|
|
|
|
is ( C4::Circulation::GetAgeRestriction('FSK 16'), '16', 'FSK 16 returns 16' );
|
|
is ( C4::Circulation::GetAgeRestriction('PEGI 16'), '16', 'PEGI 16 returns 16' );
|
|
is ( C4::Circulation::GetAgeRestriction('PEGI16'), '16', 'PEGI16 returns 16' );
|
|
is ( C4::Circulation::GetAgeRestriction('Age 16'), '16', 'Age 16 returns 16' );
|
|
is ( C4::Circulation::GetAgeRestriction('K16'), '16', 'K16 returns 16' );
|
|
|
|
subtest 'No age restriction' => sub {
|
|
plan tests => 1;
|
|
|
|
warning_is {
|
|
C4::Circulation::GetAgeRestriction();
|
|
}
|
|
undef, "No warning if GetAgeRestriction is called without restriction";
|
|
|
|
};
|
|
|