Bug 9596 added the ability to limit longoverdue by library. The determination of which library to use for a given checkout is made based on the CircControl system preference. One of the options for CircControl is "The library you're logged in at." If CircControl is set to "the library you're logged in at" and you run the longoverdue cron with the --library flag set, you get the error "Use of uninitialized value $lib in hash element at misc/cronjobs/longoverdue.pl line 484." because Koha doesn't know how to pick a branch -- no one is logged in. Setting this to normal as it seems like mostly a "don't configure it like this" issue. But maybe we should give the cron something to follow if the syspref is logged-in-branch?
Created attachment 176535 [details] [review] Bug 38893: Quit job with message when longoverdue run with --library and CircControl set to logged in library To test: 1: Set CircControl to "the item's library" and run longoverdue with the --library flag, it works 2: Set CircControl to "the library you are logged in at" and run longoverdue, it gives an error 3: Apply patch, restart all 4: run longoverdue, it quits and tells you "Use of --library flag not permitted when the CircControl system preference set to 'the library you are logged in at'"
Possible there's a better solution here, but this is an improvement.
I'm afraid I'm gonna need a more descriptive test plan. When checked out on main, I get this when running the script: kohadev-koha@kohadevbox:koha(main)$ ./misc/cronjobs/longoverdue.pl --confirm --library Option library requires an argument Weirdly, I get this if I flip the flags around: kohadev-koha@kohadevbox:koha(main)$ ./misc/cronjobs/longoverdue.pl --library --confirm ### TEST MODE -- NO ACTIONS TAKEN ### The library --confirm does not exist in the database Worth noting, this happens with `CircControl` set any which way. ... the script does seem wonky, but I can't add my sign-off line without reproducing the issue. Sorry Andrew, could you provide more information for me? Jake.
Created attachment 176889 [details] [review] Bug 38893: Quit job with message when longoverdue run with --library and CircControl set to logged in library To test: 1: Set CircControl to "the item's library" and run longoverdue with the --library flag, it works 2: Set CircControl to "the library you are logged in at" and run longoverdue, it gives an error 3: Apply patch, restart all 4: Run longoverdue, it quits and tells you "Use of --library flag not permitted when the CircControl system preference set to 'the library you are logged in at'" Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
I think this makes sense.. did wonder if we aught to just set $lib to the current library the loop is acting on.. i.e whatever was passed to the --library option of the script.. CircControl is a bit of a nonsense in this configuration here though I agree.
Not sure why we just test this sofar in the script. Feels like we should test it much earlier and bail out.