Bug 9224 - acqui/finishreceive.pl is not Plack-compatible
Summary: acqui/finishreceive.pl is not Plack-compatible
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Jacek Ablewicz
QA Contact:
URL:
Keywords:
Depends on:
Blocks: 9948
  Show dependency treegraph
 
Reported: 2012-12-06 13:45 UTC by Jared Camins-Esakov
Modified: 2015-06-04 23:24 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
[PATCH] Bug 9224: Make acqui/finishreceive.pl Plack-compatible (2.03 KB, patch)
2013-10-16 17:08 UTC, Jacek Ablewicz
Details | Diff | Splinter Review
Bug 9224: Make acqui/finishreceive.pl Plack-compatible (2.10 KB, patch)
2013-11-28 16:01 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 9224: Make acqui/finishreceive.pl Plack-compatible (2.21 KB, patch)
2013-12-13 18:13 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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!