|
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 273-280
sub run_tests {
Link Here
|
| 273 |
is( $data->{ title }, undef, |
273 |
is( $data->{ title }, undef, |
| 274 |
'(GetBiblioData) Title field is empty in fresh biblio.'); |
274 |
'(GetBiblioData) Title field is empty in fresh biblio.'); |
| 275 |
|
275 |
|
|
|
276 |
my $biblio = Koha::Biblios->find($biblionumber); |
| 277 |
|
| 276 |
my ( $isbn_field, $isbn_subfield ) = get_isbn_field(); |
278 |
my ( $isbn_field, $isbn_subfield ) = get_isbn_field(); |
| 277 |
my $marc = GetMarcBiblio({ biblionumber => $biblionumber }); |
279 |
my $marc = $biblio->metadata->record; |
| 278 |
is( $marc->subfield( $isbn_field, $isbn_subfield ), $isbn, ); |
280 |
is( $marc->subfield( $isbn_field, $isbn_subfield ), $isbn, ); |
| 279 |
|
281 |
|
| 280 |
# Add title |
282 |
# Add title |
|
Lines 285-291
sub run_tests {
Link Here
|
| 285 |
is( $data->{ title }, $title, |
287 |
is( $data->{ title }, $title, |
| 286 |
'ModBiblio correctly added the title field, and GetBiblioData.'); |
288 |
'ModBiblio correctly added the title field, and GetBiblioData.'); |
| 287 |
is( $data->{ isbn }, $isbn, '(ModBiblio) ISBN is still there after ModBiblio.'); |
289 |
is( $data->{ isbn }, $isbn, '(ModBiblio) ISBN is still there after ModBiblio.'); |
| 288 |
$marc = GetMarcBiblio({ biblionumber => $biblionumber }); |
290 |
$marc = $biblio->metadata->record; |
| 289 |
my ( $title_field, $title_subfield ) = get_title_field(); |
291 |
my ( $title_field, $title_subfield ) = get_title_field(); |
| 290 |
is( $marc->subfield( $title_field, $title_subfield ), $title, ); |
292 |
is( $marc->subfield( $title_field, $title_subfield ), $title, ); |
| 291 |
|
293 |
|
|
Lines 422-430
sub run_tests {
Link Here
|
| 422 |
|
424 |
|
| 423 |
is( GetMarcPrice( $record_for_isbn, $marcflavour ), 100, |
425 |
is( GetMarcPrice( $record_for_isbn, $marcflavour ), 100, |
| 424 |
"GetMarcPrice returns the correct value"); |
426 |
"GetMarcPrice returns the correct value"); |
| 425 |
my $updatedrecord = GetMarcBiblio({ |
427 |
my $updatedrecord = $biblio->metadata->record; |
| 426 |
biblionumber => $biblionumber, |
|
|
| 427 |
embed_items => 0 }); |
| 428 |
my $frameworkcode = GetFrameworkCode($biblionumber); |
428 |
my $frameworkcode = GetFrameworkCode($biblionumber); |
| 429 |
my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.biblioitemnumber" ); |
429 |
my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.biblioitemnumber" ); |
| 430 |
die qq{No biblioitemnumber tag for framework "$frameworkcode"} unless $biblioitem_tag; |
430 |
die qq{No biblioitemnumber tag for framework "$frameworkcode"} unless $biblioitem_tag; |
|
Lines 706-712
subtest 'MarcFieldForCreatorAndModifier' => sub {
Link Here
|
| 706 |
my $record = MARC::Record->new(); |
706 |
my $record = MARC::Record->new(); |
| 707 |
my ($biblionumber) = C4::Biblio::AddBiblio($record, ''); |
707 |
my ($biblionumber) = C4::Biblio::AddBiblio($record, ''); |
| 708 |
|
708 |
|
| 709 |
$record = GetMarcBiblio({biblionumber => $biblionumber}); |
709 |
my $biblio = Koha::Biblios->find($biblionumber); |
|
|
710 |
$record = $biblio->metadata->record; |
| 710 |
is($record->subfield('998', 'a'), 123, '998$a = 123'); |
711 |
is($record->subfield('998', 'a'), 123, '998$a = 123'); |
| 711 |
is($record->subfield('998', 'b'), 'John Doe', '998$b = John Doe'); |
712 |
is($record->subfield('998', 'b'), 'John Doe', '998$b = John Doe'); |
| 712 |
is($record->subfield('998', 'c'), 123, '998$c = 123'); |
713 |
is($record->subfield('998', 'c'), 123, '998$c = 123'); |
|
Lines 715-721
subtest 'MarcFieldForCreatorAndModifier' => sub {
Link Here
|
| 715 |
$c4_context->mock('userenv', sub { return { number => 321, firstname => 'Jane', surname => 'Doe'}; }); |
716 |
$c4_context->mock('userenv', sub { return { number => 321, firstname => 'Jane', surname => 'Doe'}; }); |
| 716 |
C4::Biblio::ModBiblio($record, $biblionumber, ''); |
717 |
C4::Biblio::ModBiblio($record, $biblionumber, ''); |
| 717 |
|
718 |
|
| 718 |
$record = GetMarcBiblio({biblionumber => $biblionumber}); |
719 |
$record = $biblio->metadata->record; |
| 719 |
is($record->subfield('998', 'a'), 123, '998$a = 123'); |
720 |
is($record->subfield('998', 'a'), 123, '998$a = 123'); |
| 720 |
is($record->subfield('998', 'b'), 'John Doe', '998$b = John Doe'); |
721 |
is($record->subfield('998', 'b'), 'John Doe', '998$b = John Doe'); |
| 721 |
is($record->subfield('998', 'c'), 321, '998$c = 321'); |
722 |
is($record->subfield('998', 'c'), 321, '998$c = 321'); |