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

(-)a/C4/Reserves.pm (+6 lines)
Lines 426-431 sub CanBookBeReserved{ Link Here
426
        return 'tooManyReserves';
426
        return 'tooManyReserves';
427
    }
427
    }
428
428
429
    # Check for the age restriction
430
    my $biblioData = C4::Biblio::GetBiblioData( $biblionumber );
431
    my $borrower = C4::Members::GetMember(borrowernumber => $borrowernumber);
432
    my ($ageRestriction, $daysToAgeRestriction) = C4::Circulation::GetAgeRestriction( $biblioData->{agerestriction}, $borrower );
433
    return 'ageRestricted' if $daysToAgeRestriction && $daysToAgeRestriction > 0;
434
429
    my $items = GetItemnumbersForBiblio($biblionumber);
435
    my $items = GetItemnumbersForBiblio($biblionumber);
430
    #get items linked via host records
436
    #get items linked via host records
431
    my @hostitems = get_hostitemnumbers_of($biblionumber);
437
    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