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 <kyle@bywatersolutions.com>
Signed-off-by: Marci Chen <mchen@mckinneytexas.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Kyle Hall 2017-05-18 08:41:34 -07:00
parent 2855107383
commit cf3212cc7f

View file

@ -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 {