From dc1fca3a02314ad704d5f05654d2533904d02ea2 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 20 Jul 2017 10:23:49 +0000 Subject: [PATCH] [SIGNED OFF] Bug 18904 - QA Followup Use subfields in the order they are stored. This patch removes use of an intermediate hash for storing values. Order of subfields as obtained from authority is now preserved. Also removes useless code that was intended to set $2 subfields Signed-off-by: Katrin Fischer --- authorities/blinddetail-biblio-search.pl | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/authorities/blinddetail-biblio-search.pl b/authorities/blinddetail-biblio-search.pl index 33b7ef0..e96bd2b 100755 --- a/authorities/blinddetail-biblio-search.pl +++ b/authorities/blinddetail-biblio-search.pl @@ -81,20 +81,16 @@ if ($authid) { my $repet = ($query->param('repet') || 1) - 1; my $field = $fields[$repet]; - # Get all values for each distinct subfield - my %subfields; + # Get all values for each distinct subfield and add to subfield loop + my %done_subfields; for ( $field->subfields ) { next if $_->[0] eq '9'; # $9 will be set with authid value my $letter = $_->[0]; - next if defined $subfields{$letter}; + $letter ||= '@'; + next if defined $done_subfields{$letter}; my @values = $field->subfield($letter); - $subfields{$letter} = \@values; - } - - # Add all subfields to the subfield_loop - for( keys %subfields ) { - my $letter = $_ || '@'; - push( @subfield_loop, {marc_subfield => $letter, marc_values => $subfields{$_}} ); + push @subfield_loop, {marc_subfield => $letter, marc_values => @values }; + $done_subfields{$letter} = 1; } push( @subfield_loop, { marc_subfield => 'w', marc_values => $relationship } ) if ( $relationship ); @@ -120,13 +116,6 @@ if ($authid) { my $thes_008_11 = ''; $thes_008_11 = substr($record->field('008')->data(), 11, 1) if $record->field('008')->data(); $indicator2 = defined $thes_mapping{$thes_008_11} ? $thes_mapping{$thes_008_11} : $thes_008_11; - if ($indicator2 eq '7') { - if ($thes_008_11 eq 'r') { - $subfields{'2'} = ['aat']; - } elsif ($thes_008_11 eq 's') { - $subfields{'2'} = ['sears']; - } - } } if ($tag_from eq '130') { # unified title -- the special case if ($tag_to eq '830' || $tag_to eq '240') { -- 2.7.4