@@ -, +, @@ + improve t/db_dependent/Reserves.t to make tests pass on UNIMARC --- C4/Reserves.pm | 6 ++++++ t/db_dependent/Reserves.t | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) --- a/C4/Reserves.pm +++ a/C4/Reserves.pm @@ -339,6 +339,12 @@ sub CanBookBeReserved{ return 'tooManyReserves'; } + # Check for the age restriction + my $biblioData = C4::Biblio::GetBiblioData( $biblionumber ); + my $borrower = C4::Members::GetMember(borrowernumber => $borrowernumber); + my ($ageRestriction, $daysToAgeRestriction) = C4::Circulation::GetAgeRestriction( $biblioData->{agerestriction}, $borrower ); + return 'ageRestricted' if $daysToAgeRestriction && $daysToAgeRestriction > 0; + my $items = GetItemnumbersForBiblio($biblionumber); #get items linked via host records my @hostitems = get_hostitemnumbers_of($biblionumber); --- a/t/db_dependent/Reserves.t +++ a/t/db_dependent/Reserves.t @@ -53,7 +53,11 @@ my $builder = t::lib::TestBuilder->new; my $frameworkcode = q||; # Somewhat arbitrary field chosen for age restriction unit tests. Must be added to db before the framework is cached -$dbh->do("update marc_subfield_structure set kohafield='biblioitems.agerestriction' where tagfield='521' and tagsubfield='a' and frameworkcode=?", undef, $frameworkcode); +$dbh->do(q| + INSERT INTO marc_subfield_structure (frameworkcode, tagfield, tagsubfield, kohafield) + VALUES ('', '521', 'a', 'biblioitems.agerestriction') + ON DUPLICATE KEY UPDATE kohafield = VALUES(kohafield) +|); my $cache = Koha::Caches->get_instance; $cache->clear_from_cache("MarcStructure-0-$frameworkcode"); $cache->clear_from_cache("MarcStructure-1-$frameworkcode"); --