Lines 213-219
subtest 'Test merge A1 to modified A1, test strict mode' => sub {
Link Here
|
213 |
subtest 'Test merge A1 to B1 (choosing language)' => sub { |
213 |
subtest 'Test merge A1 to B1 (choosing language)' => sub { |
214 |
plan tests => 4; |
214 |
plan tests => 4; |
215 |
|
215 |
|
216 |
t::lib::Mocks::mock_preference( 'LanguageToReportOnMerge', '' ); |
216 |
t::lib::Mocks::mock_preference( 'marcflavour', 'UNIMARC' ); |
|
|
217 |
t::lib::Mocks::mock_preference( 'LanguageToUseOnMerge', '' ); |
217 |
|
218 |
|
218 |
my $auth1 = MARC::Record->new; |
219 |
my $auth1 = MARC::Record->new; |
219 |
$auth1->append_fields( |
220 |
$auth1->append_fields( |
Lines 236-262
subtest 'Test merge A1 to B1 (choosing language)' => sub {
Link Here
|
236 |
|
237 |
|
237 |
is( |
238 |
is( |
238 |
$biblio->subfield( '609', 'a' ), 'language da', |
239 |
$biblio->subfield( '609', 'a' ), 'language da', |
239 |
'When LanguageToReportOnMerge is not set, the first authority field is used' |
240 |
'When LanguageToUseOnMerge is not set, the first authority field is used' |
240 |
); |
241 |
); |
241 |
|
242 |
|
242 |
t::lib::Mocks::mock_preference( 'LanguageToReportOnMerge', 'ba' ); |
243 |
t::lib::Mocks::mock_preference( 'LanguageToUseOnMerge', 'ba' ); |
243 |
C4::AuthoritiesMarc::merge( { mergefrom => $authid1, MARCfrom => $auth1, mergeto => $authid1, MARCto => $auth1 } ); |
244 |
C4::AuthoritiesMarc::merge( { mergefrom => $authid1, MARCfrom => $auth1, mergeto => $authid1, MARCto => $auth1 } ); |
244 |
$biblio = Koha::Biblios->find($biblionumber)->metadata->record; |
245 |
$biblio = Koha::Biblios->find($biblionumber)->metadata->record; |
245 |
is( |
246 |
is( |
246 |
$biblio->subfield( '609', 'a' ), 'language ba', |
247 |
$biblio->subfield( '609', 'a' ), 'language ba', |
247 |
'When LanguageToReportOnMerge is set, the field with the matching language is reported' |
248 |
'When LanguageToUseOnMerge is set, the field with the matching language is used' |
248 |
); |
249 |
); |
249 |
|
250 |
|
250 |
t::lib::Mocks::mock_preference( 'LanguageToReportOnMerge', 'xx' ); |
251 |
t::lib::Mocks::mock_preference( 'LanguageToUseOnMerge', 'xx' ); |
251 |
C4::AuthoritiesMarc::merge( { mergefrom => $authid1, MARCfrom => $auth1, mergeto => $authid1, MARCto => $auth1 } ); |
252 |
C4::AuthoritiesMarc::merge( { mergefrom => $authid1, MARCfrom => $auth1, mergeto => $authid1, MARCto => $auth1 } ); |
252 |
$biblio = Koha::Biblios->find($biblionumber)->metadata->record; |
253 |
$biblio = Koha::Biblios->find($biblionumber)->metadata->record; |
253 |
is( |
254 |
is( |
254 |
$biblio->subfield( '609', 'a' ), 'language da', |
255 |
$biblio->subfield( '609', 'a' ), 'language da', |
255 |
'When LanguageToReportOnMerge is set to a value that does not exist in the authority, the first authority field is used' |
256 |
'When LanguageToUseOnMerge is set to a value that does not exist in the authority, the first authority field is used' |
256 |
); |
257 |
); |
257 |
|
258 |
|
258 |
# Long form of lang code |
259 |
# Long form of lang code |
259 |
t::lib::Mocks::mock_preference( 'LanguageToReportOnMerge', 'ba' ); |
260 |
t::lib::Mocks::mock_preference( 'LanguageToUseOnMerge', 'ba' ); |
260 |
my $auth2 = MARC::Record->new; |
261 |
my $auth2 = MARC::Record->new; |
261 |
$auth2->append_fields( |
262 |
$auth2->append_fields( |
262 |
MARC::Field->new( '109', '0', '0', 'a' => 'language da (long form)', '7' => 'ba0yda0y' ), |
263 |
MARC::Field->new( '109', '0', '0', 'a' => 'language da (long form)', '7' => 'ba0yda0y' ), |
Lines 277-285
subtest 'Test merge A1 to B1 (choosing language)' => sub {
Link Here
|
277 |
my $biblio2 = Koha::Biblios->find($biblionumber2)->metadata->record; |
278 |
my $biblio2 = Koha::Biblios->find($biblionumber2)->metadata->record; |
278 |
is( |
279 |
is( |
279 |
$biblio2->subfield( '609', 'a' ), 'language ba (long form)', |
280 |
$biblio2->subfield( '609', 'a' ), 'language ba (long form)', |
280 |
'When LanguageToReportOnMerge is set, the field with the matching language in its long form is reported' |
281 |
'When LanguageToUseOnMerge is set, the field with the matching language in its long form is used' |
281 |
); |
282 |
); |
282 |
|
283 |
|
|
|
284 |
t::lib::Mocks::mock_preference( 'marcflavour', $marcflavour ) if $marcflavour; |
283 |
}; |
285 |
}; |
284 |
|
286 |
|
285 |
subtest 'Test merge A1 to B1 (changing authtype)' => sub { |
287 |
subtest 'Test merge A1 to B1 (changing authtype)' => sub { |
286 |
- |
|
|