Lines 32-37
use C4::Circulation;
Link Here
|
32 |
use C4::Items; |
32 |
use C4::Items; |
33 |
use C4::Members; |
33 |
use C4::Members; |
34 |
use C4::Reserves; |
34 |
use C4::Reserves; |
|
|
35 |
use Koha::Caches; |
35 |
use Koha::DateUtils; |
36 |
use Koha::DateUtils; |
36 |
use Koha::Holds; |
37 |
use Koha::Holds; |
37 |
use Koha::Libraries; |
38 |
use Koha::Libraries; |
Lines 49-56
my $dbh = C4::Context->dbh;
Link Here
|
49 |
|
50 |
|
50 |
my $builder = t::lib::TestBuilder->new; |
51 |
my $builder = t::lib::TestBuilder->new; |
51 |
|
52 |
|
|
|
53 |
my $frameworkcode = q||; |
54 |
|
52 |
# Somewhat arbitrary field chosen for age restriction unit tests. Must be added to db before the framework is cached |
55 |
# 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'"); |
56 |
$dbh->do("update marc_subfield_structure set kohafield='biblioitems.agerestriction' where tagfield='521' and tagsubfield='a' and frameworkcode=?", undef, $frameworkcode); |
|
|
57 |
my $cache = Koha::Caches->get_instance; |
58 |
$cache->clear_from_cache("MarcStructure-0-$frameworkcode"); |
59 |
$cache->clear_from_cache("MarcStructure-1-$frameworkcode"); |
60 |
$cache->clear_from_cache("default_value_for_mod_marc-$frameworkcode"); |
61 |
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode"); |
54 |
|
62 |
|
55 |
## Setup Test |
63 |
## Setup Test |
56 |
# Add branches |
64 |
# Add branches |
Lines 84-90
else {
Link Here
|
84 |
); |
92 |
); |
85 |
} |
93 |
} |
86 |
my ($bibnum, $bibitemnum); |
94 |
my ($bibnum, $bibitemnum); |
87 |
($bibnum, $title, $bibitemnum) = AddBiblio($bib, ''); |
95 |
($bibnum, $title, $bibitemnum) = AddBiblio($bib, $frameworkcode); |
88 |
|
96 |
|
89 |
# Create a helper item instance for testing |
97 |
# Create a helper item instance for testing |
90 |
my ( $item_bibnum, $item_bibitemnum, $itemnumber ) = AddItem( |
98 |
my ( $item_bibnum, $item_bibitemnum, $itemnumber ) = AddItem( |
Lines 225-231
$bib2->append_fields(
Link Here
|
225 |
); |
233 |
); |
226 |
|
234 |
|
227 |
# create one item belonging to FPL and one belonging to CPL |
235 |
# create one item belonging to FPL and one belonging to CPL |
228 |
my ($bibnum2, $bibitemnum2) = AddBiblio($bib, ''); |
236 |
my ($bibnum2, $bibitemnum2) = AddBiblio($bib, $frameworkcode); |
229 |
my ($itemnum_cpl, $itemnum_fpl); |
237 |
my ($itemnum_cpl, $itemnum_fpl); |
230 |
( undef, undef, $itemnum_cpl ) = AddItem( |
238 |
( undef, undef, $itemnum_cpl ) = AddItem( |
231 |
{ homebranch => $branch_1, |
239 |
{ homebranch => $branch_1, |
Lines 520-526
t::lib::Mocks::mock_preference( 'AgeRestrictionMarker', 'FSK|PEGI|Age|K' );
Link Here
|
520 |
my $record = GetMarcBiblio( $bibnum ); |
528 |
my $record = GetMarcBiblio( $bibnum ); |
521 |
my ( $ageres_tagid, $ageres_subfieldid ) = GetMarcFromKohaField( "biblioitems.agerestriction" ); |
529 |
my ( $ageres_tagid, $ageres_subfieldid ) = GetMarcFromKohaField( "biblioitems.agerestriction" ); |
522 |
$record->append_fields( MARC::Field->new($ageres_tagid, '', '', $ageres_subfieldid => 'PEGI 16') ); |
530 |
$record->append_fields( MARC::Field->new($ageres_tagid, '', '', $ageres_subfieldid => 'PEGI 16') ); |
523 |
C4::Biblio::ModBiblio( $record, $bibnum, '' ); |
531 |
C4::Biblio::ModBiblio( $record, $bibnum, $frameworkcode ); |
524 |
|
532 |
|
525 |
is( C4::Reserves::CanBookBeReserved($borrowernumber, $biblionumber) , 'OK', "Reserving an ageRestricted Biblio without a borrower dateofbirth succeeds" ); |
533 |
is( C4::Reserves::CanBookBeReserved($borrowernumber, $biblionumber) , 'OK', "Reserving an ageRestricted Biblio without a borrower dateofbirth succeeds" ); |
526 |
|
534 |
|
Lines 697-702
MoveReserve( $itemnumber, $borrowernumber );
Link Here
|
697 |
is( $status, 'Reserved', 'MoveReserve did not fill future hold of 3 days'); |
705 |
is( $status, 'Reserved', 'MoveReserve did not fill future hold of 3 days'); |
698 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
706 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
699 |
|
707 |
|
|
|
708 |
$cache->clear_from_cache("MarcStructure-0-$frameworkcode"); |
709 |
$cache->clear_from_cache("MarcStructure-1-$frameworkcode"); |
710 |
$cache->clear_from_cache("default_value_for_mod_marc-$frameworkcode"); |
711 |
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode"); |
712 |
|
700 |
# we reached the finish |
713 |
# we reached the finish |
701 |
$schema->storage->txn_rollback(); |
714 |
$schema->storage->txn_rollback(); |
702 |
|
715 |
|
703 |
- |
|
|