Lines 33-39
use Koha::MarcSubfieldStructures;
Link Here
|
33 |
use C4::Linker::Default qw( get_link ); |
33 |
use C4::Linker::Default qw( get_link ); |
34 |
|
34 |
|
35 |
BEGIN { |
35 |
BEGIN { |
36 |
use_ok('C4::Biblio', qw( AddBiblio GetMarcFromKohaField BiblioAutoLink GetMarcSubfieldStructure GetMarcSubfieldStructureFromKohaField LinkBibHeadingsToAuthorities GetBiblioData GetMarcBiblio ModBiblio GetMarcISSN GetMarcControlnumber GetMarcISBN GetMarcPrice GetFrameworkCode GetMarcUrls IsMarcStructureInternal GetMarcStructure GetXmlBiblio DelBiblio )); |
36 |
use_ok('C4::Biblio', qw( AddBiblio GetMarcFromKohaField BiblioAutoLink GetMarcSubfieldStructure GetMarcSubfieldStructureFromKohaField LinkBibHeadingsToAuthorities GetBiblioData ModBiblio GetMarcISSN GetMarcControlnumber GetMarcISBN GetMarcPrice GetFrameworkCode GetMarcUrls IsMarcStructureInternal GetMarcStructure GetXmlBiblio DelBiblio )); |
37 |
} |
37 |
} |
38 |
|
38 |
|
39 |
my $schema = Koha::Database->new->schema; |
39 |
my $schema = Koha::Database->new->schema; |
Lines 271-278
sub run_tests {
Link Here
|
271 |
is( $data->{ title }, undef, |
271 |
is( $data->{ title }, undef, |
272 |
'(GetBiblioData) Title field is empty in fresh biblio.'); |
272 |
'(GetBiblioData) Title field is empty in fresh biblio.'); |
273 |
|
273 |
|
|
|
274 |
my $biblio = Koha::Biblios->find($biblionumber); |
275 |
|
274 |
my ( $isbn_field, $isbn_subfield ) = get_isbn_field(); |
276 |
my ( $isbn_field, $isbn_subfield ) = get_isbn_field(); |
275 |
my $marc = GetMarcBiblio({ biblionumber => $biblionumber }); |
277 |
my $marc = $biblio->metadata->record; |
276 |
is( $marc->subfield( $isbn_field, $isbn_subfield ), $isbn, ); |
278 |
is( $marc->subfield( $isbn_field, $isbn_subfield ), $isbn, ); |
277 |
|
279 |
|
278 |
# Add title |
280 |
# Add title |
Lines 283-289
sub run_tests {
Link Here
|
283 |
is( $data->{ title }, $title, |
285 |
is( $data->{ title }, $title, |
284 |
'ModBiblio correctly added the title field, and GetBiblioData.'); |
286 |
'ModBiblio correctly added the title field, and GetBiblioData.'); |
285 |
is( $data->{ isbn }, $isbn, '(ModBiblio) ISBN is still there after ModBiblio.'); |
287 |
is( $data->{ isbn }, $isbn, '(ModBiblio) ISBN is still there after ModBiblio.'); |
286 |
$marc = GetMarcBiblio({ biblionumber => $biblionumber }); |
288 |
$marc = $biblio->metadata->record; |
287 |
my ( $title_field, $title_subfield ) = get_title_field(); |
289 |
my ( $title_field, $title_subfield ) = get_title_field(); |
288 |
is( $marc->subfield( $title_field, $title_subfield ), $title, ); |
290 |
is( $marc->subfield( $title_field, $title_subfield ), $title, ); |
289 |
|
291 |
|
Lines 420-428
sub run_tests {
Link Here
|
420 |
|
422 |
|
421 |
is( GetMarcPrice( $record_for_isbn, $marcflavour ), 100, |
423 |
is( GetMarcPrice( $record_for_isbn, $marcflavour ), 100, |
422 |
"GetMarcPrice returns the correct value"); |
424 |
"GetMarcPrice returns the correct value"); |
423 |
my $updatedrecord = GetMarcBiblio({ |
425 |
my $updatedrecord = $biblio->metadata->record; |
424 |
biblionumber => $biblionumber, |
|
|
425 |
embed_items => 0 }); |
426 |
my $frameworkcode = GetFrameworkCode($biblionumber); |
426 |
my $frameworkcode = GetFrameworkCode($biblionumber); |
427 |
my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.biblioitemnumber" ); |
427 |
my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.biblioitemnumber" ); |
428 |
die qq{No biblioitemnumber tag for framework "$frameworkcode"} unless $biblioitem_tag; |
428 |
die qq{No biblioitemnumber tag for framework "$frameworkcode"} unless $biblioitem_tag; |
Lines 699-705
subtest 'MarcFieldForCreatorAndModifier' => sub {
Link Here
|
699 |
my $record = MARC::Record->new(); |
699 |
my $record = MARC::Record->new(); |
700 |
my ($biblionumber) = C4::Biblio::AddBiblio($record, ''); |
700 |
my ($biblionumber) = C4::Biblio::AddBiblio($record, ''); |
701 |
|
701 |
|
702 |
$record = GetMarcBiblio({biblionumber => $biblionumber}); |
702 |
my $biblio = Koha::Biblios->find($biblionumber); |
|
|
703 |
$record = $biblio->metadata->record; |
703 |
is($record->subfield('998', 'a'), 123, '998$a = 123'); |
704 |
is($record->subfield('998', 'a'), 123, '998$a = 123'); |
704 |
is($record->subfield('998', 'b'), 'John Doe', '998$b = John Doe'); |
705 |
is($record->subfield('998', 'b'), 'John Doe', '998$b = John Doe'); |
705 |
is($record->subfield('998', 'c'), 123, '998$c = 123'); |
706 |
is($record->subfield('998', 'c'), 123, '998$c = 123'); |
Lines 708-714
subtest 'MarcFieldForCreatorAndModifier' => sub {
Link Here
|
708 |
$c4_context->mock('userenv', sub { return { number => 321, firstname => 'Jane', surname => 'Doe'}; }); |
709 |
$c4_context->mock('userenv', sub { return { number => 321, firstname => 'Jane', surname => 'Doe'}; }); |
709 |
C4::Biblio::ModBiblio($record, $biblionumber, ''); |
710 |
C4::Biblio::ModBiblio($record, $biblionumber, ''); |
710 |
|
711 |
|
711 |
$record = GetMarcBiblio({biblionumber => $biblionumber}); |
712 |
$record = $biblio->metadata->record; |
712 |
is($record->subfield('998', 'a'), 123, '998$a = 123'); |
713 |
is($record->subfield('998', 'a'), 123, '998$a = 123'); |
713 |
is($record->subfield('998', 'b'), 'John Doe', '998$b = John Doe'); |
714 |
is($record->subfield('998', 'b'), 'John Doe', '998$b = John Doe'); |
714 |
is($record->subfield('998', 'c'), 321, '998$c = 321'); |
715 |
is($record->subfield('998', 'c'), 321, '998$c = 321'); |