Bug 31889: (follow-up) Correct item order
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Mon, 7 Nov 2022 09:42:21 +0000 (09:42 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Mon, 7 Nov 2022 10:53:34 +0000 (07:53 -0300)
MARC::Record::insert_fields_ordered reverses the order of fields
with the same tag. So we need to reverse the input order here.

This made Exporter/Record.t fail.

Test plan:
Run t/db_dependent/Koha/Biblio/Metadata.t
Run t/db_dependent/Exporter/Record.t (should pass now)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Koha/Biblio/Metadata.pm

index 09291b2..b6d532e 100644 (file)
@@ -172,7 +172,8 @@ sub _embed_items {
             my $item_marc = C4::Items::GetMarcItem( $biblionumber, $itemnumber );
             push @item_fields, $item_marc->field($itemtag);
         }
-        $record->insert_fields_ordered(@item_fields);
+        $record->insert_fields_ordered( reverse @item_fields );
+            # insert_fields_ordered with the reverse keeps 952s in right order
 
     }
     else {