Bug 15742 - Unnecessary loop in j2a cronjob
Summary: Unnecessary loop in j2a cronjob
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 15758
  Show dependency treegraph
 
Reported: 2016-02-04 13:24 UTC by Jonathan Druart
Modified: 2017-06-14 22:11 UTC (History)
3 users (show)

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


Attachments
Bug 15742: Remove unnecessary loop in j2a cronjob (1.75 KB, patch)
2016-02-04 13:27 UTC, Jonathan Druart
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 15742: Remove unnecessary loop in j2a cronjob (1.81 KB, patch)
2016-02-04 22:37 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 15742: Remove unnecessary loop in j2a cronjob (1.85 KB, patch)
2016-02-05 11:43 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 15742 [QA Followup] - Tidy script (11.98 KB, patch)
2016-02-05 11:43 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 Jonathan Druart 2016-02-04 13:24:36 UTC
If no branchcode is given, all the libraries are retrieved and the same query (so without using the libraries loop) is executed for each library.
Comment 1 Jonathan Druart 2016-02-04 13:27:37 UTC Comment hidden (obsolete)
Comment 2 Mark Tompsett 2016-02-04 22:00:43 UTC
Comment on attachment 47642 [details] [review]
Bug 15742: Remove unnecessary loop in j2a cronjob

Review of attachment 47642 [details] [review]:
-----------------------------------------------------------------

YIKES! Good catch.
Comment 3 Mark Tompsett 2016-02-04 22:35:31 UTC
Comment on attachment 47642 [details] [review]
Bug 15742: Remove unnecessary loop in j2a cronjob

Review of attachment 47642 [details] [review]:
-----------------------------------------------------------------

::: misc/cronjobs/j2a.pl
@@ -178,4 @@
>  		} else { print "Updated $res patrons\n"; }
>  	} else { # branch was not supplied, processing all branches
>  		$verbose and print "Looking in all branches for patrons to update from $fromcat to $tocat that were born before $itsyourbirthday\n";
> -		foreach my $branchcode (@branches) {

What's scarier is I added: print "PROCESSING $branchcode\n";
"PROCESSING HASH(0x3645b50)"
Comment 4 Mark Tompsett 2016-02-04 22:37:24 UTC Comment hidden (obsolete)
Comment 5 Kyle M Hall 2016-02-05 11:43:36 UTC
Created attachment 47686 [details] [review]
Bug 15742: Remove unnecessary loop in j2a cronjob

If no branchcode is given, all the libraries are retrieved and the same
query (so without using the libraries loop) is executed for each
library.

Test plan:
Use the j2a.pl cronjob to change the category of a child patron
If a branchcode is passed to the script, only the children from this
branchcode should be updated.
But if it is not passed, all children of the DB should be updated.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Kyle M Hall 2016-02-05 11:43:45 UTC
Created attachment 47687 [details] [review]
Bug 15742 [QA Followup] - Tidy script

Script does not appear to have any other modifying patches at this
time based on bz splitter. This is a perfect time to clean up this
script!

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 7 Brendan Gallagher 2016-02-23 21:28:45 UTC
Pushed to Master - Should be in the May 2016 release - Thanks!
Comment 8 Julian Maurice 2016-02-26 14:34:16 UTC
Patches pushed to 3.22.x, will be in 3.22.4
Comment 9 Frédéric Demians 2016-03-01 16:53:37 UTC
This patch has been pushed to 3.20.x, will be in 3.20.9.