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

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

Return to bug 11999