Bug 18579: Fix call to append_fields, fix tests

MARC::Record::append_fields takes a list of MARC::Field (not an arrayref)

Use $record->subfield() instead of $record->field()->subfield() to avoid errors
when field doesn't exist

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Julian Maurice 2017-05-12 09:25:23 +02:00 committed by Kyle M Hall
parent 542ac21b94
commit 61ca4deee3
2 changed files with 3 additions and 3 deletions

View File

@ -90,7 +90,7 @@ sub _processrecord {
else {
# no field, create one
$destination_field = MARC::Field->new( '999', '', '', x => $not_onloan_items );
$record->append_fields([$destination_field]);
$record->append_fields($destination_field);
}
return $record;

View File

@ -142,10 +142,10 @@ subtest 'EmbedItemsAvailability tests' => sub {
is( ref($processor), 'Koha::RecordProcessor', 'Created record processor' );
$record = GetMarcBiblio($biblionumber);
ok( !defined $record->field('999')->subfield('x'), q{The record doesn't originally contain 999$x} );
ok( !defined $record->subfield('999', 'x'), q{The record doesn't originally contain 999$x} );
# Apply filter
$processor->process($record);
is($record->field('999')->subfield('x'), 1, 'There is only one item with undef onloan');
is($record->subfield('999', 'x'), 1, 'There is only one item with undef onloan');
$schema->storage->txn_rollback();
};