Lines 25-31
use C4::Context;
Link Here
|
25 |
use C4::Biblio qw( AddBiblio ModBiblio DelBiblio GetMarcBiblio ); |
25 |
use C4::Biblio qw( AddBiblio ModBiblio DelBiblio GetMarcBiblio ); |
26 |
use Koha::Database; |
26 |
use Koha::Database; |
27 |
|
27 |
|
28 |
use Test::More tests => 23; |
28 |
use Test::More tests => 24; |
29 |
use Test::MockModule; |
29 |
use Test::MockModule; |
30 |
|
30 |
|
31 |
use Koha::MarcOverlayRules; |
31 |
use Koha::MarcOverlayRules; |
Lines 570-575
subtest 'Record fields has been overwritten when add = 1, append = 1, remove = 1
Link Here
|
570 |
|
570 |
|
571 |
}; |
571 |
}; |
572 |
|
572 |
|
|
|
573 |
subtest 'subfields order' => sub { |
574 |
plan tests => 2; |
575 |
|
576 |
$rule->set( |
577 |
{ |
578 |
'add' => 0, |
579 |
'append' => 0, |
580 |
'remove' => 0, |
581 |
'delete' => 0, |
582 |
} |
583 |
)->store(); |
584 |
|
585 |
my $incoming_record = build_record( |
586 |
[ |
587 |
[ '250', 'a', '256 bottles of beer on the wall' ], |
588 |
[ '250', 'a', '250 bottles of beer on the wall' ], |
589 |
[ '500', 'a', 'One bottle of beer in the fridge' ], |
590 |
] |
591 |
); |
592 |
|
593 |
my $merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' }); |
594 |
|
595 |
is( |
596 |
$merged_record->as_formatted, |
597 |
$orig_record->as_formatted, |
598 |
'Original record not modified - order of subfields not modified' |
599 |
); |
600 |
|
601 |
$rule->set( |
602 |
{ |
603 |
'add' => 1, |
604 |
'append' => 1, |
605 |
'remove' => 1, |
606 |
'delete' => 1, |
607 |
} |
608 |
)->store(); |
609 |
|
610 |
$merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' }); |
611 |
|
612 |
is( |
613 |
$merged_record->as_formatted, |
614 |
$incoming_record->as_formatted, |
615 |
'Original record modified - order of subfields has been modified' |
616 |
); |
617 |
|
618 |
}; |
619 |
|
573 |
# Test rule tag specificity |
620 |
# Test rule tag specificity |
574 |
|
621 |
|
575 |
# Protect field 500 with more specific tag value |
622 |
# Protect field 500 with more specific tag value |
576 |
- |
|
|