From: Jacek Ablewicz Date: Wed, 16 Oct 2013 15:31:04 +0000 (+0200) Subject: Bug 9224: Make acqui/finishreceive.pl Plack-compatible X-Git-Tag: v3.16.00-beta~1083 X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=commitdiff_plain;h=6dcc34c1b44f72a8602c4ee95540836e6cd1e7bd;p=koha_fer Bug 9224: Make acqui/finishreceive.pl Plack-compatible Under Plack/mod_perl wrapping, sub update_item() will become a closure, so after the 1st run it will retain its own private instances of the following variables: $booksellerid, $datereceived, $unitprice, $rrp, $biblionumber. I.e., in case update_item() gets invoked 2nd+ time (inside the same process, but for different-subsequent receives) it may incorrectly flag the (old, wrong) biblionumber for Zebra reindexing, and erronously modify the current item[s] with the previously used (wrong) values. This simple patch should make acqui/finishreceive.pl Plack-compatible. Test plan: Test patched acqui/finishreceive.pl script (create and receive some orders w/ items, etc.). Ensure items are gettting added and/or modified correctly during receiving process. Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall Passes koha-qa.pl, works as advertised, no regressions found. Signed-off-by: Galen Charlton --- diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl index 900733d402..ea9c9a23c4 100755 --- a/acqui/finishreceive.pl +++ b/acqui/finishreceive.pl @@ -153,20 +153,16 @@ if ($quantityrec > $origquantityrec ) { } } -update_item( $_ ) foreach GetItemnumbersFromOrder( $ordernumber ); - -print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid"); - -################################ End of script ################################ - -sub update_item { - my ( $itemnumber ) = @_; - - ModItem( { +ModItem( + { booksellerid => $booksellerid, dateaccessioned => $datereceived, price => $unitprice, replacementprice => $rrp, replacementpricedate => $datereceived, - }, $biblionumber, $itemnumber ); -} + }, + $biblionumber, + $_ +) foreach GetItemnumbersFromOrder($ordernumber); + +print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid");