From dfac2ec35ec476ac8617f4dd3332a84298555c16 Mon Sep 17 00:00:00 2001 From: Jacek Ablewicz Date: Sat, 14 Dec 2013 12:07:11 +0100 Subject: [PATCH] Bug 9948: Fix acqui/finishreceive.pl so it will update item data properly on partial receives Problem summary: when doing partial receives for the given order - 1) if AcqCreateItem is set to 'ordering', various item data (price, dateaccessioned, replacementprice, replacementpricedate) are getting erroneously updated on the wrong (yet to be received == not the ones being currently received) item records 2) if AcqCreateItem is set to 'receiving', newly received item records are being created without the aforementioned fields set to the proper values This (trivial) patch should deal with both cases, hopefully without breaking enything else. To test: - apply the patch, - create some orders with 2+ quantity - test partial & non-partial receives for those orders - ensure the received item records are getting modified (for AcqCreateItem set to 'ordering') and/or created (for AcqCreateItem set to 'receiving') correctly for both partial and non-partial receives - receiving orders with quantity = 1 / receiving orders in non-partial mode should be still working fine for 1) & 2) scenarios (i.e., AcqCreateItem set to 'ordering' / AcqCreateItem set to 'receiving') --- acqui/finishreceive.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl index ea9c9a2..aeb4394 100755 --- a/acqui/finishreceive.pl +++ b/acqui/finishreceive.pl @@ -56,6 +56,7 @@ my $rrp = $input->param('rrp'); my $note = $input->param("note"); my $bookfund = $input->param("bookfund"); my $order = GetOrder($ordernumber); +my $new_ordernumber = $ordernumber; #need old recievedate if we update the order, parcel.pl only shows the right parcel this way FIXME if ($quantityrec > $origquantityrec ) { @@ -97,7 +98,6 @@ if ($quantityrec > $origquantityrec ) { } } - my $new_ordernumber = $ordernumber; # save the quantity received. if ( $quantityrec > 0 ) { ($datereceived, $new_ordernumber) = ModReceiveOrder( @@ -163,6 +163,6 @@ ModItem( }, $biblionumber, $_ -) foreach GetItemnumbersFromOrder($ordernumber); +) foreach GetItemnumbersFromOrder($new_ordernumber); print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid"); -- 1.7.10.4