[Koha-bugs] [Bug 3116] ISBD parsing does not preserve subfield order

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Feb 24 00:50:52 CET 2016


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=3116

M. Tompsett <mtompset at hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
           Assignee|mtompset at hotmail.com        |gmcharlt at gmail.com

--- Comment #2 from M. Tompsett <mtompset at hotmail.com> ---
I don't remember what I was thinking, nor do I understand the problem.
Resetting back to defaults.

I don't think

diff --git a/C4/Biblio.pm b/C4/Biblio.pm
index 10faa83..9a5a372 100644
--- a/C4/Biblio.pm
+++ b/C4/Biblio.pm
@@ -958,11 +958,11 @@ sub GetISBDView {
                   if ( ( $template eq 'opac' )
                     && ( $tagslib->{$fieldvalue}->{$subfvalue}->{'hidden'} ||
0 ) > 0 );
                 foreach my $field (@fieldslist) {
+                    my $tag = $field->tag();
                     foreach my $subfield ( $field->subfield($subfvalue) ) {
-                        my $calculated = $analysestring;
-                        my $tag        = $field->tag();
                         if ( $tag < 10 ) {
                         } else {
+                            my $calculated = $analysestring;
                             my $subfieldvalue = GetAuthorisedValueDesc( $tag,
$subfvalue, $subfield, '', $tagslib );
                             my $tagsubf = $tag . $subfvalue;
                             $calculated =~
s/\{(.?.?.?.?)$tagsubf(.*?)\}/$1$subfieldvalue$2\{$1$tagsubf$2\}/g;
@@ -988,7 +988,16 @@ sub GetISBDView {
                     my $tag        = $field->tag();
                     if ( $tag < 10 ) {
                     } else {
-                        my @subf = $field->subfields;
+                        my @ordered_subfields;
+                        while ($calculated =~ /(\d\d\d)([0-9a-zA-Z])/g) {
+                            push @ordered_subfields,$2;
+                        }
+                        my @subf;
+                        foreach my $subtag (@ordered_subfields) {
+                            foreach my $subfield ($field->subfields) {
+                                push @subf,[@{$subfield}] if $subfield->[0] eq
$subtag;
+                            }
+                        }
                         for my $i ( 0 .. $#subf ) {
                             my $valuecode     = $subf[$i][1];
                             my $subfieldcode  = $subf[$i][0];

Was what people were wanting.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list