|
Lines 668-674
subtest 'merge should not reorder too much' => sub {
Link Here
|
| 668 |
}; |
668 |
}; |
| 669 |
|
669 |
|
| 670 |
subtest 'Test how merge handles controlled indicators' => sub { |
670 |
subtest 'Test how merge handles controlled indicators' => sub { |
| 671 |
plan tests => 4; |
671 |
plan tests => 8; |
| 672 |
|
672 |
|
| 673 |
# Note: See more detailed tests in t/Koha/Authority/ControlledIndicators.t |
673 |
# Note: See more detailed tests in t/Koha/Authority/ControlledIndicators.t |
| 674 |
|
674 |
|
|
Lines 711-716
subtest 'Test how merge handles controlled indicators' => sub {
Link Here
|
| 711 |
); |
711 |
); |
| 712 |
$biblio2 = Koha::Biblios->find($biblionumber)->metadata->record; |
712 |
$biblio2 = Koha::Biblios->find($biblionumber)->metadata->record; |
| 713 |
is( $biblio2->subfield( '609', '2' ), undef, 'No subfield $2 left' ); |
713 |
is( $biblio2->subfield( '609', '2' ), undef, 'No subfield $2 left' ); |
|
|
714 |
isnt( $biblio2->subfield( '609', '2' ), '', 'Subfield $2 does not exist or exists and is not empty' ); |
| 715 |
|
| 716 |
# auth 040 / biblio 6XX $2 manipulation |
| 717 |
# Case 1: auth 040 $f modification |
| 718 |
my $auth_record = MARC::Record->new; |
| 719 |
$auth_record->append_fields( MARC::Field->new( '008', ' ' x 11 . 'z' . ' ' x 28 ) ); |
| 720 |
$auth_record->append_fields( MARC::Field->new( '040', ' ', ' ', a => 'OrgCode', f => 'special_thes' ) ); |
| 721 |
$auth_record->append_fields( MARC::Field->new( '109', '0', ' ', a => 'Name' ) ); |
| 722 |
my $authid = AddAuthority( $auth_record, undef, $authtype1 ); |
| 723 |
my $biblio_record = MARC::Record->new; |
| 724 |
$biblio_record->append_fields( |
| 725 |
MARC::Field->new( '609', '0', '7', a => 'Name', 2 => 'other_special', 9 => $authid ) ); |
| 726 |
($biblionumber) = AddBiblio( $biblio_record, '' ); |
| 727 |
merge( |
| 728 |
{ |
| 729 |
mergefrom => $authid, MARCfrom => $auth_record, mergeto => $authid, MARCto => $auth_record, |
| 730 |
biblionumbers => [$biblionumber], |
| 731 |
} |
| 732 |
); |
| 733 |
$biblio_record = Koha::Biblios->find($biblionumber)->metadata->record; |
| 734 |
is( $biblio_record->subfield( '609', '2' ), 'special_thes', 'Thesaurus correctly updated' ); |
| 735 |
|
| 736 |
# Case 2: auth 040 $f removal |
| 737 |
$auth_record->field('040')->delete_subfield( code => 'f' ); |
| 738 |
ModAuthority( $authid, $auth_record, $authtype1 ); |
| 739 |
merge( |
| 740 |
{ |
| 741 |
mergefrom => $authid, MARCfrom => $auth_record, mergeto => $authid, MARCto => $auth_record, |
| 742 |
biblionumbers => [$biblionumber], |
| 743 |
} |
| 744 |
); |
| 745 |
$biblio_record = Koha::Biblios->find($biblionumber)->metadata->record; |
| 746 |
isnt( $biblio_record->subfield( '609', '2' ), '', 'Subfield $2 does not exist or exists and is not empty' ); |
| 747 |
is( $biblio_record->subfield( '609', '2' ), 'special_thes', 'Subfield $2 contains didn\'t change' ); |
| 748 |
|
| 714 |
}; |
749 |
}; |
| 715 |
|
750 |
|
| 716 |
subtest "Test bibs not auto linked when merging" => sub { |
751 |
subtest "Test bibs not auto linked when merging" => sub { |
| 717 |
- |
|
|