use MARC::Record;
use C4::Biblio;
-use C4::Branch;
use Koha::Database;
+use Koha::Library;
use t::lib::Mocks;
use t::lib::TestBuilder;
-use Test::More tests => 9;
+use Test::More tests => 12;
use Test::Warn;
subtest 'General Add, Get and Del tests' => sub {
- plan tests => 14;
+ plan tests => 16;
$schema->storage->txn_begin;
my $library = $builder->build({
source => 'Branch',
});
+ my $itemtype = $builder->build({
+ source => 'Itemtype',
+ });
# Create a biblio instance for testing
- C4::Context->set_preference('marcflavour', 'MARC21');
+ t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
my ($bibnum, $bibitemnum) = get_biblio();
# Add an item.
- my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $library->{branchcode}, holdingbranch => $library->{branchcode}, location => $location } , $bibnum);
+ my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $library->{branchcode}, holdingbranch => $library->{branchcode}, location => $location, itype => $itemtype->{itemtype} } , $bibnum);
cmp_ok($item_bibnum, '==', $bibnum, "New item is linked to correct biblionumber.");
cmp_ok($item_bibitemnum, '==', $bibitemnum, "New item is linked to correct biblioitemnumber.");
my $getdeleted = GetItem($itemnumber);
is($getdeleted->{'itemnumber'}, undef, "Item deleted as expected.");
- ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $library->{branchcode}, holdingbranch => $library->{branchcode}, location => $location, permanent_location => 'my permanent location' } , $bibnum);
+ ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $library->{branchcode}, holdingbranch => $library->{branchcode}, location => $location, permanent_location => 'my permanent location', itype => $itemtype->{itemtype} } , $bibnum);
$getitem = GetItem($itemnumber);
is( $getitem->{location}, $location, "The location should not have been modified" );
is( $getitem->{permanent_location}, 'my permanent location', "The permanent_location should not have modified" );
is( $getitem->{location}, 'CART', "The location should have been set to CART" );
is( $getitem->{permanent_location}, $location, "The permanent_location should not have been set to CART" );
+ t::lib::Mocks::mock_preference('item-level_itypes', '1');
+ $getitem = GetItem($itemnumber);
+ is( $getitem->{itype}, $itemtype->{itemtype}, "Itemtype set correctly when using item_level-itypes" );
+ t::lib::Mocks::mock_preference('item-level_itypes', '0');
+ $getitem = GetItem($itemnumber);
+ is( $getitem->{itype}, undef, "Itemtype set correctly when not using item_level-itypes" );
+
$schema->storage->txn_rollback;
};
my $library2 = $builder->build({
source => 'Branch',
});
+ my $itemtype = $builder->build({
+ source => 'Itemtype',
+ });
# Create a new biblio
- C4::Context->set_preference('marcflavour', 'MARC21');
+ t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
my ($biblionumber, $biblioitemnumber) = get_biblio();
# Add two items
- my ($item1_bibnum, $item1_bibitemnum, $item1_itemnumber) = AddItem(
- { homebranch => $library1->{branchcode},
- holdingbranch => $library1->{branchcode},
- withdrawn => 1 },
- $biblionumber
+ my ( $item1_bibnum, $item1_bibitemnum, $item1_itemnumber ) = AddItem(
+ {
+ homebranch => $library1->{branchcode},
+ holdingbranch => $library1->{branchcode},
+ withdrawn => 1,
+ itype => $itemtype->{itemtype},
+ },
+ $biblionumber
);
- my ($item2_bibnum, $item2_bibitemnum, $item2_itemnumber) = AddItem(
- { homebranch => $library2->{branchcode},
- holdingbranch => $library2->{branchcode},
- withdrawn => 0 },
- $biblionumber
+ my ( $item2_bibnum, $item2_bibitemnum, $item2_itemnumber ) = AddItem(
+ {
+ homebranch => $library2->{branchcode},
+ holdingbranch => $library2->{branchcode},
+ withdrawn => 0,
+ itype => $itemtype->{itemtype},
+ },
+ $biblionumber
);
my $opachiddenitems;
push @items, GetItem( $item2_itemnumber );
# Empty OpacHiddenItems
- C4::Context->set_preference('OpacHiddenItems','');
+ t::lib::Mocks::mock_preference('OpacHiddenItems','');
ok( !defined( GetHiddenItemnumbers( @items ) ),
"Hidden items list undef if OpacHiddenItems empty");
# Blank spaces
- C4::Context->set_preference('OpacHiddenItems',' ');
+ t::lib::Mocks::mock_preference('OpacHiddenItems',' ');
ok( scalar GetHiddenItemnumbers( @items ) == 0,
"Hidden items list empty if OpacHiddenItems only contains blanks");
# One variable / value
$opachiddenitems = "
withdrawn: [1]";
- C4::Context->set_preference( 'OpacHiddenItems', $opachiddenitems );
+ t::lib::Mocks::mock_preference( 'OpacHiddenItems', $opachiddenitems );
@hidden = GetHiddenItemnumbers( @items );
ok( scalar @hidden == 1, "Only one hidden item");
is( $hidden[0], $item1_itemnumber, "withdrawn=1 is hidden");
# One variable, two values
$opachiddenitems = "
withdrawn: [1,0]";
- C4::Context->set_preference( 'OpacHiddenItems', $opachiddenitems );
+ t::lib::Mocks::mock_preference( 'OpacHiddenItems', $opachiddenitems );
@hidden = GetHiddenItemnumbers( @items );
ok( scalar @hidden == 2, "Two items hidden");
is_deeply( \@hidden, \@itemnumbers, "withdrawn=1 and withdrawn=0 hidden");
withdrawn: [1]
homebranch: [$library2->{branchcode}]
";
- C4::Context->set_preference( 'OpacHiddenItems', $opachiddenitems );
+ t::lib::Mocks::mock_preference( 'OpacHiddenItems', $opachiddenitems );
@hidden = GetHiddenItemnumbers( @items );
ok( scalar @hidden == 2, "Two items hidden");
is_deeply( \@hidden, \@itemnumbers, "withdrawn=1 and homebranch library2 hidden");
my $library2 = $builder->build({
source => 'Branch',
});
+ my $itemtype = $builder->build({
+ source => 'Itemtype',
+ });
# Add a biblio
my ($biblionumber, $biblioitemnumber) = get_biblio();
# Add an item
- my ($item_bibnum, $item_bibitemnum, $itemnumber)
- = AddItem({
- homebranch => $library1->{branchcode},
- holdingbranch => $library2->{branchcode},
- }, $biblionumber );
+ my ( $item_bibnum, $item_bibitemnum, $itemnumber ) = AddItem(
+ {
+ homebranch => $library1->{branchcode},
+ holdingbranch => $library2->{branchcode},
+ itype => $itemtype->{itemtype},
+ },
+ $biblionumber
+ );
- my $library = Koha::Libraries->find( $library1->{branchcode} )->unblessed;
- $library->{ opac_info }= "homebranch OPAC info";
- ModBranch($library);
+ my $library = Koha::Libraries->find( $library1->{branchcode} );
+ $library->opac_info("homebranch OPAC info");
+ $library->store;
- $library = Koha::Libraries->find( $library2->{branchcode} )->unblessed;
- $library->{ opac_info } = "holdingbranch OPAC info";
- ModBranch($library);
+ $library = Koha::Libraries->find( $library2->{branchcode} );
+ $library->opac_info("holdingbranch OPAC info");
+ $library->store;
my @results = GetItemsInfo( $biblionumber );
ok( @results, 'GetItemsInfo returns results');
$schema->storage->txn_begin;
- my $biblio =
- $schema->resultset('Biblio')->create(
- {
- title => "Test title",
- biblioitems => [
- {
- itemtype => 'BIB_LEVEL',
- items => [ { itype => "ITEM_LEVEL" } ]
- }
- ]
- }
- );
-
- my @bi = $biblio->biblioitems();
- my ( $item ) = $bi[0]->items();
+ my $biblio = $schema->resultset('Biblio')->create({
+ title => "Test title",
+ biblioitems => [ { itemtype => 'BIB_LEVEL' } ],
+ });
+ my $biblioitem = $biblio->biblioitems->first;
+ my $item = $schema->resultset('Item')->create({
+ biblioitemnumber => $biblioitem->biblioitemnumber,
+ biblionumber => $biblio->biblionumber,
+ itype => "ITEM_LEVEL",
+ });
- C4::Context->set_preference( 'item-level_itypes', 0 );
- ok( $item->effective_itemtype() eq 'BIB_LEVEL', '$item->itemtype() returns biblioitem.itemtype when item-level_itypes is disabled' );
+ t::lib::Mocks::mock_preference( 'item-level_itypes', 0 );
+ is( $item->effective_itemtype(), 'BIB_LEVEL', '$item->itemtype() returns biblioitem.itemtype when item-level_itypes is disabled' );
- C4::Context->set_preference( 'item-level_itypes', 1 );
- ok( $item->effective_itemtype() eq 'ITEM_LEVEL', '$item->itemtype() returns items.itype when item-level_itypes is enabled' );
+ t::lib::Mocks::mock_preference( 'item-level_itypes', 1 );
+ is( $item->effective_itemtype(), 'ITEM_LEVEL', '$item->itemtype() returns items.itype when item-level_itypes is enabled' );
# If itemtype is not defined and item-level_level item types are set
# fallback to biblio-level itemtype (Bug 14651) and warn
$item->update();
my $effective_itemtype;
warning_is { $effective_itemtype = $item->effective_itemtype() }
- "item-level_itypes set but no itemtype set for item ($item->itemnumber)",
+ "item-level_itypes set but no itemtype set for item (".$item->itemnumber.")",
'->effective_itemtype() raises a warning when falling back to bib-level';
ok( defined $effective_itemtype &&
my $library2 = $builder->build({
source => 'Branch',
});
+ my $itemtype = $builder->build({
+ source => 'Itemtype',
+ });
- C4::Context->set_preference('marcflavour', 'MARC21');
+ t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
my $cpl_items_before = SearchItemsByField( 'homebranch', $library1->{branchcode});
my ($biblionumber) = get_biblio();
my (undef, undef, $item1_itemnumber) = AddItem({
homebranch => $library1->{branchcode},
holdingbranch => $library1->{branchcode},
+ itype => $itemtype->{itemtype},
}, $biblionumber);
my (undef, undef, $item2_itemnumber) = AddItem({
homebranch => $library2->{branchcode},
holdingbranch => $library2->{branchcode},
+ itype => $itemtype->{itemtype},
}, $biblionumber);
my ($items, $total_results);
}
ok($found, "item1 found");
- my ($itemfield) = GetMarcFromKohaField('items.itemnumber', '');
+ my $frameworkcode = q||;
+ my ($itemfield) = GetMarcFromKohaField('items.itemnumber', $frameworkcode);
# Create item subfield 'z' without link
- $dbh->do('DELETE FROM marc_subfield_structure WHERE tagfield=? AND tagsubfield="z" AND frameworkcode=""', undef, $itemfield);
- $dbh->do('INSERT INTO marc_subfield_structure (tagfield, tagsubfield, frameworkcode) VALUES (?, "z", "")', undef, $itemfield);
+ $dbh->do('DELETE FROM marc_subfield_structure WHERE tagfield=? AND tagsubfield="z" AND frameworkcode=?', undef, $itemfield, $frameworkcode);
+ $dbh->do('INSERT INTO marc_subfield_structure (tagfield, tagsubfield, frameworkcode) VALUES (?, "z", ?)', undef, $itemfield, $frameworkcode);
# Clear cache
- $C4::Context::context->{marcfromkohafield} = undef;
- $C4::Biblio::inverted_field_map = undef;
+ my $cache = Koha::Caches->get_instance();
+ $cache->clear_from_cache("MarcStructure-0-$frameworkcode");
+ $cache->clear_from_cache("MarcStructure-1-$frameworkcode");
+ $cache->clear_from_cache("default_value_for_mod_marc-$frameworkcode");
+ $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
my $item3_record = new MARC::Record;
$item3_record->append_fields(
- new MARC::Field($itemfield, '', '', 'z' => 'foobar')
+ new MARC::Field(
+ $itemfield, '', '',
+ 'z' => 'foobar',
+ 'y' => $itemtype->{itemtype}
+ )
);
my (undef, undef, $item3_itemnumber) = AddItemFromMarc($item3_record,
$biblionumber);
# Link $z to items.itemnotes (and make sure there is no other subfields
# linked to it)
- $dbh->do('DELETE FROM marc_subfield_structure WHERE kohafield="items.itemnotes" AND frameworkcode=""', undef, $itemfield);
- $dbh->do('UPDATE marc_subfield_structure SET kohafield="items.itemnotes" WHERE tagfield=? AND tagsubfield="z" AND frameworkcode=""', undef, $itemfield);
+ $dbh->do('DELETE FROM marc_subfield_structure WHERE kohafield="items.itemnotes" AND frameworkcode=?', undef, $itemfield, $frameworkcode);
+ $dbh->do('UPDATE marc_subfield_structure SET kohafield="items.itemnotes" WHERE tagfield=? AND tagsubfield="z" AND frameworkcode=?', undef, $itemfield, $frameworkcode);
# Clear cache
- $C4::Context::context->{marcfromkohafield} = undef;
- $C4::Biblio::inverted_field_map = undef;
+ $cache->clear_from_cache("MarcStructure-0-$frameworkcode");
+ $cache->clear_from_cache("MarcStructure-1-$frameworkcode");
+ $cache->clear_from_cache("default_value_for_mod_marc-$frameworkcode");
+ $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
ModItemFromMarc($item3_record, $biblionumber, $item3_itemnumber);
my $library2 = $builder->build({
source => 'Branch',
});
+ my $itemtype = $builder->build({
+ source => 'Itemtype',
+ });
# Create a biblio and item for testing
- C4::Context->set_preference('marcflavour', 'MARC21');
+ t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
my ($bibnum, $bibitemnum) = get_biblio();
- my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $library1->{branchcode}, holdingbranch => $library2->{branchcode} } , $bibnum);
+ my ( $item_bibnum, $item_bibitemnum, $itemnumber ) = AddItem(
+ {
+ homebranch => $library1->{branchcode},
+ holdingbranch => $library2->{branchcode},
+ itype => $itemtype->{itemtype},
+ },
+ $bibnum
+ );
# Get item.
my $item = Koha::Items->find( $itemnumber );
my $library2 = $builder->build({
source => 'Branch',
});
+ my $itemtype = $builder->build({
+ source => 'Itemtype',
+ });
my ( $biblionumber, $biblioitemnumber ) = get_biblio();
my $item_infos = [
my ( undef, undef, $itemnumber ) = AddItem(
{
homebranch => $item_info->{homebranch},
- holdingbranch => $item_info->{holdingbanch}
+ holdingbranch => $item_info->{holdingbanch},
+ itype => $itemtype->{itemtype},
},
$biblionumber
);
my ($itemfield) =
C4::Biblio::GetMarcFromKohaField( 'items.itemnumber', '' );
- my $record = C4::Biblio::GetMarcBiblio($biblionumber);
+ my $record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
warning_is { C4::Biblio::EmbedItemsInMarcBiblio() }
{ carped => 'EmbedItemsInMarcBiblio: No MARC record passed' },
'Should crap is no record passed.';
@items = $record->field($itemfield);
is( scalar @items,
$number_of_items,
- 'Even with OpacHiddenItems set, all items should have been embeded' );
+ 'Even with OpacHiddenItems set, all items should have been embedded' );
C4::Biblio::EmbedItemsInMarcBiblio( $record, $biblionumber, undef, 1 );
@items = $record->field($itemfield);
is(
scalar @items,
$number_of_items - $number_of_items_with_homebranch_is_CPL,
-'For OPAC, the pref OpacHiddenItems should have been take into account. Only items with homebranch ne CPL should have been embeded'
+'For OPAC, the pref OpacHiddenItems should have been take into account. Only items with homebranch ne CPL should have been embedded'
);
$opachiddenitems = "
is(
scalar @items,
0,
-'For OPAC, If all items are hidden, no item should have been embeded'
+'For OPAC, If all items are hidden, no item should have been embedded'
+ );
+
+ $schema->storage->txn_rollback;
+};
+
+
+subtest 'C4::Items::_build_default_values_for_mod_marc' => sub {
+ plan tests => 4;
+
+ $schema->storage->txn_begin();
+
+ my $builder = t::lib::TestBuilder->new;
+ my $framework = $builder->build({
+ source => 'BiblioFramework',
+ });
+ # Link biblio.biblionumber and biblioitems.biblioitemnumber to avoid _koha_marc_update_bib_ids to fail with 'no biblio[item]number tag for framework"
+ $builder->build({
+ source => 'MarcSubfieldStructure',
+ value => {
+ frameworkcode => $framework->{frameworkcode},
+ kohafield => 'biblio.biblionumber',
+ tagfield => '999',
+ tagsubfield => 'c',
+ }
+ });
+ $builder->build({
+ source => 'MarcSubfieldStructure',
+ value => {
+ frameworkcode => $framework->{frameworkcode},
+ kohafield => 'biblioitems.biblioitemnumber',
+ tagfield => '999',
+ tagsubfield => 'd',
+ }
+ });
+ my $mss_itemnumber = $builder->build({
+ source => 'MarcSubfieldStructure',
+ value => {
+ frameworkcode => $framework->{frameworkcode},
+ kohafield => 'items.itemnumber',
+ tagfield => '952',
+ tagsubfield => '9',
+ }
+ });
+
+ my $mss_barcode = $builder->build({
+ source => 'MarcSubfieldStructure',
+ value => {
+ frameworkcode => $framework->{frameworkcode},
+ kohafield => 'items.barcode',
+ tagfield => '952',
+ tagsubfield => 'p',
+ }
+ });
+
+ my $mss_itemtype = $builder->build({
+ source => 'MarcSubfieldStructure',
+ value => {
+ frameworkcode => $framework->{frameworkcode},
+ kohafield => 'items.itype',
+ tagfield => '952',
+ tagsubfield => 'y',
+ }
+ });
+
+ my $itemtype = $builder->build({ source => 'Itemtype' })->{itemtype};
+
+ # Create a record with a barcode
+ my ($biblionumber) = get_biblio( $framework->{frameworkcode} );
+ my $item_record = new MARC::Record;
+ my $a_barcode = 'a barcode';
+ my $barcode_field = MARC::Field->new(
+ '952', ' ', ' ',
+ p => $a_barcode,
+ y => $itemtype
);
+ my $itemtype_field = MARC::Field->new(
+ '952', ' ', ' ',
+ y => $itemtype
+ );
+ $item_record->append_fields( $barcode_field );
+ my (undef, undef, $item_itemnumber) = AddItemFromMarc($item_record, $biblionumber);
+
+ # Make sure everything has been set up
+ my $item = GetItem($item_itemnumber);
+ is( $item->{barcode}, $a_barcode, 'Everything has been set up correctly, the barcode is defined as expected' );
+
+ # Delete the barcode field and save the record
+ $item_record->delete_fields( $barcode_field );
+ $item_record->append_fields( $itemtype_field ); # itemtype is mandatory
+ ModItemFromMarc($item_record, $biblionumber, $item_itemnumber);
+ $item = GetItem($item_itemnumber);
+ is( $item->{barcode}, undef, 'The default value should have been set to the barcode, the field is mapped to a kohafield' );
+
+ # Re-add the barcode field and save the record
+ $item_record->append_fields( $barcode_field );
+ ModItemFromMarc($item_record, $biblionumber, $item_itemnumber);
+ $item = GetItem($item_itemnumber);
+ is( $item->{barcode}, $a_barcode, 'Everything has been set up correctly, the barcode is defined as expected' );
+
+ # Remove the mapping
+ my $dbh = C4::Context->dbh;
+ $dbh->do(q|
+ DELETE FROM marc_subfield_structure
+ WHERE kohafield = 'items.barcode'
+ AND frameworkcode = ?
+ |, undef, $framework->{frameworkcode} );
+
+ # And make sure the caches are cleared
+ my $cache = Koha::Caches->get_instance();
+ $cache->clear_from_cache("MarcStructure-0-" . $framework->{frameworkcode});
+ $cache->clear_from_cache("MarcStructure-1-" . $framework->{frameworkcode});
+ $cache->clear_from_cache("default_value_for_mod_marc-" . $framework->{frameworkcode});
+ $cache->clear_from_cache("MarcSubfieldStructure-" . $framework->{frameworkcode});
+
+ # Update the MARC field with another value
+ $item_record->delete_fields( $barcode_field );
+ my $another_barcode = 'another_barcode';
+ my $another_barcode_field = MARC::Field->new(
+ '952', ' ', ' ',
+ p => $another_barcode,
+ );
+ $item_record->append_fields( $another_barcode_field );
+ # The DB value should not have been updated
+ ModItemFromMarc($item_record, $biblionumber, $item_itemnumber);
+ $item = GetItem($item_itemnumber);
+ is ( $item->{barcode}, $a_barcode, 'items.barcode is not mapped anymore, so the DB column has not been updated' );
$schema->storage->txn_rollback;
};
+subtest '_mod_item_dates' => sub {
+ plan tests => 11;
+
+ is( C4::Items::_mod_item_dates(), undef, 'Call without parameters' );
+ is( C4::Items::_mod_item_dates(1), undef, 'Call without hashref' );
+
+ my $orgitem;
+ my $item = {
+ itemcallnumber => 'V II 149 1963',
+ barcode => '109304',
+ };
+ $orgitem = { %$item };
+ C4::Items::_mod_item_dates($item);
+ is_deeply( $item, $orgitem, 'No dates passed to _mod_item_dates' );
+
+ # add two correct dates
+ t::lib::Mocks::mock_preference('dateformat', 'us');
+ $item->{dateaccessioned} = '01/31/2016';
+ $item->{onloan} = $item->{dateaccessioned};
+ $orgitem = { %$item };
+ C4::Items::_mod_item_dates($item);
+ is( $item->{dateaccessioned}, '2016-01-31', 'dateaccessioned is fine' );
+ is( $item->{onloan}, '2016-01-31', 'onloan is fine too' );
+
+
+ # add some invalid dates
+ $item->{notexistingcolumndate} = '13/1/2015'; # wrong format
+ $item->{anotherdate} = 'tralala'; # even worse
+ $item->{myzerodate} = '0000-00-00'; # wrong too
+ C4::Items::_mod_item_dates($item);
+ is( $item->{notexistingcolumndate}, undef, 'Invalid date became NULL' );
+ is( $item->{anotherdate}, undef, 'Second invalid date became NULL too' );
+ is( $item->{myzerodate}, undef, '0000-00-00 became NULL too' );
+
+ # check if itemlost_on was not touched
+ $item->{itemlost_on} = '12345678';
+ $item->{withdrawn_on} = '12/31/2015 23:59:00';
+ $orgitem = { %$item };
+ C4::Items::_mod_item_dates($item);
+ is_deeply( $item, $orgitem, 'Colums with _on are not touched' );
+
+ t::lib::Mocks::mock_preference('dateformat', 'metric');
+ $item->{dateaccessioned} = '01/31/2016'; #wrong
+ $item->{yetanotherdatetime} = '20/01/2016 13:58:00'; #okay
+ C4::Items::_mod_item_dates($item);
+ is( $item->{dateaccessioned}, undef, 'dateaccessioned wrong format' );
+ is( $item->{yetanotherdatetime}, '2016-01-20 13:58:00',
+ 'yetanotherdatetime is ok' );
+};
+
+subtest 'get_hostitemnumbers_of' => sub {
+ plan tests => 1;
+
+ my $bib = MARC::Record->new();
+ $bib->append_fields(
+ MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'),
+ MARC::Field->new('245', ' ', ' ', a => 'Silence in the library'),
+ MARC::Field->new('773', ' ', ' ', b => 'b without 0 or 9'),
+ );
+ my ($biblionumber, $bibitemnum) = AddBiblio($bib, '');
+
+ my @itemnumbers = C4::Items::get_hostitemnumbers_of( $biblionumber );
+ is( @itemnumbers, 0, );
+};
+
# Helper method to set up a Biblio.
sub get_biblio {
+ my ( $frameworkcode ) = @_;
+ $frameworkcode //= '';
my $bib = MARC::Record->new();
$bib->append_fields(
MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'),
MARC::Field->new('245', ' ', ' ', a => 'Silence in the library'),
);
- my ($bibnum, $bibitemnum) = AddBiblio($bib, '');
+ my ($bibnum, $bibitemnum) = AddBiblio($bib, $frameworkcode);
return ($bibnum, $bibitemnum);
}