View | Details | Raw Unified | Return to bug 11999
Collapse All | Expand All

(-)a/C4/Reserves.pm (+6 lines)
Lines 475-480 sub CanBookBeReserved{ Link Here
475
        return 'tooManyReserves';
475
        return 'tooManyReserves';
476
    }
476
    }
477
477
478
    # Check for the age restriction
479
    my $biblioData = C4::Biblio::GetBiblioData( $biblionumber );
480
    my $borrower = C4::Members::GetMember(borrowernumber => $borrowernumber);
481
    my ($ageRestriction, $daysToAgeRestriction) = C4::Circulation::GetAgeRestriction( $biblioData->{agerestriction}, $borrower );
482
    return 'ageRestricted' if $daysToAgeRestriction && $daysToAgeRestriction > 0;
483
478
    my $items = GetItemnumbersForBiblio($biblionumber);
484
    my $items = GetItemnumbersForBiblio($biblionumber);
479
    #get items linked via host records
485
    #get items linked via host records
480
    my @hostitems = get_hostitemnumbers_of($biblionumber);
486
    my @hostitems = get_hostitemnumbers_of($biblionumber);
(-)a/t/db_dependent/Reserves.t (-5 / +8 lines)
Lines 18-23 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 53;
20
use Test::More tests => 53;
21
use Test::MockModule;
21
22
22
use MARC::Record;
23
use MARC::Record;
23
use DateTime::Duration;
24
use DateTime::Duration;
Lines 37-45 BEGIN { Link Here
37
}
38
}
38
39
39
# a very minimal mack of userenv for use by the test of DelItemCheck
40
# a very minimal mack of userenv for use by the test of DelItemCheck
40
*C4::Context::userenv = sub {
41
my $c4_context = Test::MockModule->new('C4::Context');
41
    return {};
42
$c4_context->mock('userenv', sub { return { flags => 1 } });
42
};
43
43
44
my $dbh = C4::Context->dbh;
44
my $dbh = C4::Context->dbh;
45
45
Lines 48-54 $dbh->{AutoCommit} = 0; Link Here
48
$dbh->{RaiseError} = 1;
48
$dbh->{RaiseError} = 1;
49
49
50
# Somewhat arbitrary field chosen for age restriction unit tests. Must be added to db before the framework is cached
50
# Somewhat arbitrary field chosen for age restriction unit tests. Must be added to db before the framework is cached
51
$dbh->do("update marc_subfield_structure set kohafield='biblioitems.agerestriction' where tagfield='521' and tagsubfield='a'");
51
$dbh->do(q|
52
    INSERT INTO marc_subfield_structure (frameworkcode, tagfield, tagsubfield, kohafield)
53
    VALUES ('', '521', 'a', 'biblioitems.agerestriction')
54
    ON DUPLICATE KEY UPDATE kohafield = VALUES(kohafield)
55
|);
52
56
53
# Setup Test------------------------
57
# Setup Test------------------------
54
58
55
- 

Return to bug 11999