|
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 521-527
t::lib::Mocks::mock_preference( 'AgeRestrictionMarker', 'FSK|PEGI|Age|K' );
Link Here
|
| 521 |
my $record = GetMarcBiblio( $bibnum ); |
529 |
my $record = GetMarcBiblio( $bibnum ); |
| 522 |
my ( $ageres_tagid, $ageres_subfieldid ) = GetMarcFromKohaField( "biblioitems.agerestriction" ); |
530 |
my ( $ageres_tagid, $ageres_subfieldid ) = GetMarcFromKohaField( "biblioitems.agerestriction" ); |
| 523 |
$record->append_fields( MARC::Field->new($ageres_tagid, '', '', $ageres_subfieldid => 'PEGI 16') ); |
531 |
$record->append_fields( MARC::Field->new($ageres_tagid, '', '', $ageres_subfieldid => 'PEGI 16') ); |
| 524 |
C4::Biblio::ModBiblio( $record, $bibnum, '' ); |
532 |
C4::Biblio::ModBiblio( $record, $bibnum, $frameworkcode ); |
| 525 |
|
533 |
|
| 526 |
is( C4::Reserves::CanBookBeReserved($borrowernumber, $biblionumber) , 'OK', "Reserving an ageRestricted Biblio without a borrower dateofbirth succeeds" ); |
534 |
is( C4::Reserves::CanBookBeReserved($borrowernumber, $biblionumber) , 'OK', "Reserving an ageRestricted Biblio without a borrower dateofbirth succeeds" ); |
| 527 |
|
535 |
|
|
Lines 698-703
MoveReserve( $itemnumber, $borrowernumber );
Link Here
|
| 698 |
is( $status, 'Reserved', 'MoveReserve did not fill future hold of 3 days'); |
706 |
is( $status, 'Reserved', 'MoveReserve did not fill future hold of 3 days'); |
| 699 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
707 |
$dbh->do('DELETE FROM reserves', undef, ($bibnum)); |
| 700 |
|
708 |
|
|
|
709 |
$cache->clear_from_cache("MarcStructure-0-$frameworkcode"); |
| 710 |
$cache->clear_from_cache("MarcStructure-1-$frameworkcode"); |
| 711 |
$cache->clear_from_cache("default_value_for_mod_marc-$frameworkcode"); |
| 712 |
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode"); |
| 713 |
|
| 701 |
# we reached the finish |
714 |
# we reached the finish |
| 702 |
$schema->storage->txn_rollback(); |
715 |
$schema->storage->txn_rollback(); |
| 703 |
|
716 |
|
| 704 |
- |
|
|