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

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

Return to bug 11999