From cf3212cc7f443e539c9bdbfcc25d2537c83bd5b8 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 18 May 2017 08:41:34 -0700 Subject: [PATCH] Bug 18627 - Items created via MarcItemFieldsToOrder are not linked to orders If using MarcItemFieldsToOrder with AcqCreateItem = Create, the order and the items will be created, but they will not be linked via aqorders_items! Test Plan: 1) Enable creation of items when ordering 2) Set up MarcItemFieldsToOrder 3) Upload an order record that uses the fields in step 2 4) Create a basket and add the records from the file 5) Note the order and items are created, but no rows in aqorders_items are created 6) Apply this patch 7) Repeat steps 3-4 8) Note the rows in aqorders_items are created! Signed-off-by: Kyle M Hall Signed-off-by: Marci Chen Signed-off-by: Marcel de Rooy Signed-off-by: Kyle M Hall --- acqui/addorderiso2709.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl index 8fb4ead99f..5d3ee540af 100755 --- a/acqui/addorderiso2709.pl +++ b/acqui/addorderiso2709.pl @@ -217,6 +217,8 @@ if ($op eq ""){ my @replacementprices = $input->multi_param('replacementprice_' . $biblio_count); my @itemcallnumbers = $input->multi_param('itemcallnumber_' . $biblio_count); my $itemcreation = 0; + + my @itemnumbers; for (my $i = 0; $i < $count; $i++) { $itemcreation = 1; my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ @@ -234,6 +236,7 @@ if ($op eq ""){ replacementprice => $replacementprices[$i], itemcallnumber => $itemcallnumbers[$i], }, $biblionumber); + push( @itemnumbers, $itemnumber ); } if ($itemcreation == 1) { # Group orderlines from MarcItemFieldsToOrder @@ -302,6 +305,7 @@ if ($op eq ""){ }; my $order = Koha::Acquisition::Order->new( \%orderinfo )->insert; + $order->add_item( $_ ) for @itemnumbers; } } } else { -- 2.39.5