Bug 9224

Summary: acqui/finishreceive.pl is not Plack-compatible
Product: Koha Reporter: Jared Camins-Esakov <jcamins>
Component: AcquisitionsAssignee: Jacek Ablewicz <abl>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P5 - low CC: abl, fridolin.somers, gitbot, gmcharlt, tomascohen
Version: master   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Change sponsored?: --- Patch complexity: Trivial patch
Bot Control: --- When did the bot last check this: 2013-10-30 00:00:00
Who signed the patch off: Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 9948    
Attachments: [PATCH] Bug 9224: Make acqui/finishreceive.pl Plack-compatible
Bug 9224: Make acqui/finishreceive.pl Plack-compatible
Bug 9224: Make acqui/finishreceive.pl Plack-compatible

Description Jared Camins-Esakov 2012-12-06 13:45:10 UTC
I get the following warnings in the log when receiving items under Plack:
Variable "$datereceived" is not available at /home/jcamins/kohaclone/acqui/finishreceive.pl line 154.
Variable "$unitprice" is not available at /home/jcamins/kohaclone/acqui/finishreceive.pl line 155.
Variable "$rrp" is not available at /home/jcamins/kohaclone/acqui/finishreceive.pl line 156.
Variable "$biblionumber" is not available at /home/jcamins/kohaclone/acqui/finishreceive.pl line 158.
Comment 1 Jacek Ablewicz 2013-10-16 17:08:46 UTC Comment hidden (obsolete)
Comment 2 Jacek Ablewicz 2013-10-16 17:10:43 UTC
Under Plack/mod_perl wrapping, sub update_item() will become a closure,
so after the 1st run it will retain it's 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.
Comment 3 I'm just a bot 2013-10-30 07:15:21 UTC
Patch applied cleanly, go forth and signoff
Comment 4 Jonathan Druart 2013-11-28 16:01:50 UTC Comment hidden (obsolete)
Comment 5 Kyle M Hall 2013-12-13 18:13:58 UTC
Created attachment 23533 [details] [review]
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 it's 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 <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passes koha-qa.pl, works as advertised, no regressions found.
Comment 6 Galen Charlton 2013-12-13 18:31:33 UTC
Pushed to master.  Thanks, Jacek!

This appears to be the first patch of yours accepted into Koha.  Congratulations!
Comment 7 Fridolin SOMERS 2013-12-24 12:56:40 UTC
Patch pushed to 3.14.x, will be in 3.14.2
Comment 8 Tomás Cohen Arazi 2014-01-15 17:16:42 UTC
This patch has been pushed to 3.12.x, will be in 3.12.9.

Thanks Jacek!