|
Lines 1006-1012
subtest 'get_volumes_query' => sub {
Link Here
|
| 1006 |
}; |
1006 |
}; |
| 1007 |
|
1007 |
|
| 1008 |
subtest 'generate_marc_host_field' => sub { |
1008 |
subtest 'generate_marc_host_field' => sub { |
| 1009 |
plan tests => 22; |
1009 |
plan tests => 24; |
| 1010 |
|
1010 |
|
| 1011 |
$schema->storage->txn_begin; |
1011 |
$schema->storage->txn_begin; |
| 1012 |
|
1012 |
|
|
Lines 1018-1024
subtest 'generate_marc_host_field' => sub {
Link Here
|
| 1018 |
MARC::Field->new( '001', '1234' ), |
1018 |
MARC::Field->new( '001', '1234' ), |
| 1019 |
MARC::Field->new( '003', 'FIRST' ), |
1019 |
MARC::Field->new( '003', 'FIRST' ), |
| 1020 |
MARC::Field->new( '240', '', '', a => 'A uniform title' ), |
1020 |
MARC::Field->new( '240', '', '', a => 'A uniform title' ), |
| 1021 |
MARC::Field->new( '260', '', '', a => 'Publication' ), |
1021 |
MARC::Field->new( '260', '', '', a => 'Publication 260' ), |
| 1022 |
MARC::Field->new( '250', '', '', a => 'Edition a', b => 'Edition b' ), |
1022 |
MARC::Field->new( '250', '', '', a => 'Edition a', b => 'Edition b' ), |
| 1023 |
MARC::Field->new( '022', '', '', a => '0317-8471' ), |
1023 |
MARC::Field->new( '022', '', '', a => '0317-8471' ), |
| 1024 |
); |
1024 |
); |
|
Lines 1032-1038
subtest 'generate_marc_host_field' => sub {
Link Here
|
| 1032 |
is( $link->tag, '773', "MARC::Field->tag returns '773' when marcflavour is 'MARC21" ); |
1032 |
is( $link->tag, '773', "MARC::Field->tag returns '773' when marcflavour is 'MARC21" ); |
| 1033 |
is( $link->subfield('a'), 'Some boring author', 'MARC::Field->subfield(a) returns content from 100ab' ); |
1033 |
is( $link->subfield('a'), 'Some boring author', 'MARC::Field->subfield(a) returns content from 100ab' ); |
| 1034 |
is( $link->subfield('b'), 'Edition a Edition b', 'MARC::Field->subfield(b) returns content from 250ab' ); |
1034 |
is( $link->subfield('b'), 'Edition a Edition b', 'MARC::Field->subfield(b) returns content from 250ab' ); |
| 1035 |
is( $link->subfield('d'), 'Publication', 'MARC::Field->subfield(c) returns content from 260abc' ); |
1035 |
is( $link->subfield('d'), 'Publication 260', 'MARC::Field->subfield(c) returns content from 260abc' ); |
| 1036 |
is( $link->subfield('s'), 'A uniform title', 'MARC::Field->subfield(s) returns content from 240a' ); |
1036 |
is( $link->subfield('s'), 'A uniform title', 'MARC::Field->subfield(s) returns content from 240a' ); |
| 1037 |
is( $link->subfield('t'), 'Some boring read', 'MARC::Field->subfield(s) returns content from 245ab' ); |
1037 |
is( $link->subfield('t'), 'Some boring read', 'MARC::Field->subfield(s) returns content from 245ab' ); |
| 1038 |
is( $link->subfield('x'), '0317-8471', 'MARC::Field->subfield(s) returns content from 022a' ); |
1038 |
is( $link->subfield('x'), '0317-8471', 'MARC::Field->subfield(s) returns content from 022a' ); |
|
Lines 1046-1051
subtest 'generate_marc_host_field' => sub {
Link Here
|
| 1046 |
'MARC::Field->subfield(w) returns content from 003 and 001 when "UseControlNumber" is enabled' |
1046 |
'MARC::Field->subfield(w) returns content from 003 and 001 when "UseControlNumber" is enabled' |
| 1047 |
); |
1047 |
); |
| 1048 |
|
1048 |
|
|
|
1049 |
$record->append_fields( |
| 1050 |
MARC::Field->new( '264', '', '', a => 'Publication 264' ), |
| 1051 |
); |
| 1052 |
C4::Biblio::ModBiblio( $record, $biblio->biblionumber ); |
| 1053 |
$biblio = Koha::Biblios->find( $biblio->biblionumber ); |
| 1054 |
|
| 1055 |
$link = $biblio->generate_marc_host_field(); |
| 1056 |
is( |
| 1057 |
$link->subfield('d'), 'Publication 264', |
| 1058 |
'MARC::Field->subfield(d) returns content from 264 in preference to 260' |
| 1059 |
); |
| 1060 |
|
| 1061 |
$record->append_fields( |
| 1062 |
MARC::Field->new( '264', '3', '', a => 'Publication 264', b => 'Preferred' ), |
| 1063 |
); |
| 1064 |
C4::Biblio::ModBiblio( $record, $biblio->biblionumber ); |
| 1065 |
$biblio = Koha::Biblios->find( $biblio->biblionumber ); |
| 1066 |
|
| 1067 |
$link = $biblio->generate_marc_host_field(); |
| 1068 |
is( |
| 1069 |
$link->subfield('d'), 'Publication 264 Preferred', |
| 1070 |
'MARC::Field->subfield(d) returns content from 264 with indicator 1 = 3 in preference to 264 without' |
| 1071 |
); |
| 1072 |
|
| 1049 |
# UNIMARC tests |
1073 |
# UNIMARC tests |
| 1050 |
t::lib::Mocks::mock_preference( 'marcflavour', 'UNIMARC' ); |
1074 |
t::lib::Mocks::mock_preference( 'marcflavour', 'UNIMARC' ); |
| 1051 |
|
1075 |
|
| 1052 |
- |
|
|