diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index ecc8c53d42..4c61f8bedb 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -1015,8 +1015,7 @@ sub BuildSummary { use C4::Heading::MARC21; my $handler = C4::Heading::MARC21->new(); my $subfields_to_report; - my $subfields_to_subdivision = ""; - my $delimiter = C4::Context->preference('AuthoritySeparator'); + my $delimiter = C4::Context->preference('AuthoritySeparator'); foreach my $field ($record->field('1..')) { my $tag = $field->tag(); @@ -1095,7 +1094,8 @@ sub BuildSummary { push @notes, { note => $field->as_string(), field => $field->tag() }; } - foreach my $field ( $record->field('7..') ) { + foreach my $field ( $record->field('7..') ) { + my $subfields_to_subdivision; my $tag = $field->tag(); if ( $tag eq '700' ) { diff --git a/t/db_dependent/AuthoritiesMarc.t b/t/db_dependent/AuthoritiesMarc.t index 3823dd9d5c..e1b117fbc6 100755 --- a/t/db_dependent/AuthoritiesMarc.t +++ b/t/db_dependent/AuthoritiesMarc.t @@ -41,8 +41,10 @@ $module->mock('GetAuthority', sub { $record->add_fields( [ '001', '2' ], [ '151', ' ', ' ', a => 'New York (State)' ], - [ '551', ' ', ' ', a => 'United States', w => 'g', 9 => '1' ] - ); + [ '551', ' ', ' ', a => 'United States', w => 'g', 9 => '1' ], + [ '751', ' ', ' ', a => 'United States', w => 'g', 9 => '1' ], + [ '781', ' ', ' ', a => 'New York', x => 'General subdivision', 9 => '1' ] + ); } elsif ($authid eq '3') { $record->add_fields( [ '001', '3' ], @@ -151,14 +153,25 @@ my $expected_marc21_summary = { 'type' => 'broader' } ], - 'seefrom' => [], - 'label' => 'Geographic Name', - 'type' => 'Geographic Name', - 'equalterm' => [] + 'equalterm' => [ + { + 'field' => '751', + 'hemain' => 'United States', + 'heading' => 'United States' + }, + { + 'hemain' => undef, + 'field' => '781', + 'heading' => 'General subdivision' + } + ], + 'seefrom' => [], + 'label' => 'Geographic Name', + 'type' => 'Geographic Name', }; is_deeply( - BuildSummary(C4::AuthoritiesMarc::GetAuthority(2), 2, 'GEOGR_NAME'), + BuildSummary( C4::AuthoritiesMarc::GetAuthority(2), 2, 'GEOGR_NAME' ), $expected_marc21_summary, 'test BuildSummary for MARC21' );