From a7df1f9f8eb9ed16246964d94dd8a69b756b6551 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 20 Jul 2017 10:23:49 +0000 Subject: [PATCH] Bug 18904: (follow-up) Retrieve subfield in the order they are stored 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 Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart --- authorities/blinddetail-biblio-search.pl | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/authorities/blinddetail-biblio-search.pl b/authorities/blinddetail-biblio-search.pl index 13f5dc65b9..0afeb96b8b 100755 --- a/authorities/blinddetail-biblio-search.pl +++ b/authorities/blinddetail-biblio-search.pl @@ -86,20 +86,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 ); -- 2.39.5