Bug 15742

Summary: Unnecessary loop in j2a cronjob
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: brendan, f.demians, julian.maurice
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 15758    
Attachments: Bug 15742: Remove unnecessary loop in j2a cronjob
[SIGNED-OFF] Bug 15742: Remove unnecessary loop in j2a cronjob
Bug 15742: Remove unnecessary loop in j2a cronjob
Bug 15742 [QA Followup] - Tidy script

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.