|
Lines 943-949
subtest 'get_volumes_query' => sub {
Link Here
|
| 943 |
}; |
943 |
}; |
| 944 |
|
944 |
|
| 945 |
subtest 'generate_marc_host_field' => sub { |
945 |
subtest 'generate_marc_host_field' => sub { |
| 946 |
plan tests => 22; |
946 |
plan tests => 24; |
| 947 |
|
947 |
|
| 948 |
$schema->storage->txn_begin; |
948 |
$schema->storage->txn_begin; |
| 949 |
|
949 |
|
|
Lines 955-961
subtest 'generate_marc_host_field' => sub {
Link Here
|
| 955 |
MARC::Field->new( '001', '1234' ), |
955 |
MARC::Field->new( '001', '1234' ), |
| 956 |
MARC::Field->new( '003', 'FIRST' ), |
956 |
MARC::Field->new( '003', 'FIRST' ), |
| 957 |
MARC::Field->new( '240', '', '', a => 'A uniform title' ), |
957 |
MARC::Field->new( '240', '', '', a => 'A uniform title' ), |
| 958 |
MARC::Field->new( '260', '', '', a => 'Publication' ), |
958 |
MARC::Field->new( '260', '', '', a => 'Publication 260' ), |
| 959 |
MARC::Field->new( '250', '', '', a => 'Edition a', b => 'Edition b' ), |
959 |
MARC::Field->new( '250', '', '', a => 'Edition a', b => 'Edition b' ), |
| 960 |
MARC::Field->new( '022', '', '', a => '0317-8471' ), |
960 |
MARC::Field->new( '022', '', '', a => '0317-8471' ), |
| 961 |
); |
961 |
); |
|
Lines 969-975
subtest 'generate_marc_host_field' => sub {
Link Here
|
| 969 |
is( $link->tag, '773', "MARC::Field->tag returns '773' when marcflavour is 'MARC21" ); |
969 |
is( $link->tag, '773', "MARC::Field->tag returns '773' when marcflavour is 'MARC21" ); |
| 970 |
is( $link->subfield('a'), 'Some boring author', 'MARC::Field->subfield(a) returns content from 100ab' ); |
970 |
is( $link->subfield('a'), 'Some boring author', 'MARC::Field->subfield(a) returns content from 100ab' ); |
| 971 |
is( $link->subfield('b'), 'Edition a Edition b', 'MARC::Field->subfield(b) returns content from 250ab' ); |
971 |
is( $link->subfield('b'), 'Edition a Edition b', 'MARC::Field->subfield(b) returns content from 250ab' ); |
| 972 |
is( $link->subfield('d'), 'Publication', 'MARC::Field->subfield(c) returns content from 260abc' ); |
972 |
is( $link->subfield('d'), 'Publication 260', 'MARC::Field->subfield(c) returns content from 260abc' ); |
| 973 |
is( $link->subfield('s'), 'A uniform title', 'MARC::Field->subfield(s) returns content from 240a' ); |
973 |
is( $link->subfield('s'), 'A uniform title', 'MARC::Field->subfield(s) returns content from 240a' ); |
| 974 |
is( $link->subfield('t'), 'Some boring read', 'MARC::Field->subfield(s) returns content from 245ab' ); |
974 |
is( $link->subfield('t'), 'Some boring read', 'MARC::Field->subfield(s) returns content from 245ab' ); |
| 975 |
is( $link->subfield('x'), '0317-8471', 'MARC::Field->subfield(s) returns content from 022a' ); |
975 |
is( $link->subfield('x'), '0317-8471', 'MARC::Field->subfield(s) returns content from 022a' ); |
|
Lines 983-988
subtest 'generate_marc_host_field' => sub {
Link Here
|
| 983 |
'MARC::Field->subfield(w) returns content from 003 and 001 when "UseControlNumber" is enabled' |
983 |
'MARC::Field->subfield(w) returns content from 003 and 001 when "UseControlNumber" is enabled' |
| 984 |
); |
984 |
); |
| 985 |
|
985 |
|
|
|
986 |
$record->append_fields( |
| 987 |
MARC::Field->new( '264', '', '', a => 'Publication 264' ), |
| 988 |
); |
| 989 |
C4::Biblio::ModBiblio( $record, $biblio->biblionumber ); |
| 990 |
$biblio = Koha::Biblios->find( $biblio->biblionumber ); |
| 991 |
|
| 992 |
$link = $biblio->generate_marc_host_field(); |
| 993 |
is( |
| 994 |
$link->subfield('d'), 'Publication 264', |
| 995 |
'MARC::Field->subfield(d) returns content from 264 in prefernce to 260' |
| 996 |
); |
| 997 |
|
| 998 |
$record->append_fields( |
| 999 |
MARC::Field->new( '264', '3', '', a => 'Publication 264', b => 'Preferred' ), |
| 1000 |
); |
| 1001 |
C4::Biblio::ModBiblio( $record, $biblio->biblionumber ); |
| 1002 |
$biblio = Koha::Biblios->find( $biblio->biblionumber ); |
| 1003 |
|
| 1004 |
$link = $biblio->generate_marc_host_field(); |
| 1005 |
is( |
| 1006 |
$link->subfield('d'), 'Publication 264 Preferred', |
| 1007 |
'MARC::Field->subfield(d) returns content from 264 with indicator 1 = 3 in prefernce to 264 without' |
| 1008 |
); |
| 1009 |
|
| 986 |
# UNIMARC tests |
1010 |
# UNIMARC tests |
| 987 |
t::lib::Mocks::mock_preference( 'marcflavour', 'UNIMARC' ); |
1011 |
t::lib::Mocks::mock_preference( 'marcflavour', 'UNIMARC' ); |
| 988 |
|
1012 |
|
| 989 |
- |
|
|