Bug 9596 - Allow longoverdue.pl to be configured per library on the command line
Summary: Allow longoverdue.pl to be configured per library on the command line
Status: Needs documenting
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Michael Hafen
QA Contact: Kyle M Hall (khall)
URL:
Keywords: Academy
: 37613 (view as bug list)
Depends on:
Blocks: 18064 38893 38894 39802
  Show dependency treegraph
 
Reported: 2013-02-12 14:13 UTC by Nicole C. Engard
Modified: 2025-05-01 16:01 UTC (History)
18 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
This patch adds --library and --skip-library options to the misc/cronjob/longoverdue.pl script. This enables setting the rules differently for each library when running the script on the command line and as a cron job.
Version(s) released in:
24.11.00
Circulation function:


Attachments
Add branch and skip-branch options to cronjobs/longoverdue.pl (5.87 KB, patch)
2024-02-13 00:23 UTC, Michael Hafen
Details | Diff | Splinter Review
Bug 9596: Add branch and skip-branch options to cronjobs/longoverdue.pl (6.16 KB, patch)
2024-02-16 22:34 UTC, Michael Hafen
Details | Diff | Splinter Review
Bug 9596: Add branch and skip-branch options to cronjobs/longoverdue.pl (6.31 KB, patch)
2024-06-03 11:45 UTC, HKS3 Tadeusz Sośnierz
Details | Diff | Splinter Review
Bug 9596: Add branch and skip-branch options to cronjobs/longoverdue.pl (6.37 KB, patch)
2024-07-23 10:36 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 9596: (QA follow-up) Add some clarifying comments (1.56 KB, patch)
2024-07-23 10:36 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 9596: (QA follow-up) Only find a given patron once (2.20 KB, patch)
2024-07-23 10:39 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 9596: Add library and skip-library options to cronjobs/longoverdue.pl (7.58 KB, patch)
2024-08-09 18:26 UTC, Michael Hafen
Details | Diff | Splinter Review
Bug 9596: Follow-up to change the option and documentation to match Terminology Guidelines (4.36 KB, patch)
2024-08-09 21:00 UTC, Michael Hafen
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nicole C. Engard 2013-02-12 14:13:58 UTC
It would be nice if the longoverdue script took a list of branch codes as a value so that each library could have different settings for long overdue.  Or nicer still if it was just built in to Koha's staff GUI.
Comment 1 Andrew Fuerste-Henry 2020-08-28 16:25:07 UTC
+1 -- But would that be limiting based on the patron branch, the item branch, the issuing branch? The branch specified by circcontrol?
Comment 2 mdanko 2021-10-25 17:11:07 UTC
I would love to have the longoverdue script be granular to the issuing branch.  It makes sense to me if a patron borrows materials from our branch, they need to follow our loan rules...including if an item is longoverdue and will get billed.  This would be a great place to start I think.
Comment 3 Todd Goatley 2022-08-08 16:45:44 UTC
It would be great if this is added to circ & fine. Consortium's with a number  of defined items could set this up per library making life easier on the individual libraries. This would be fantastic for stand alone libraries as well. Please, please, please someone take this on! :~D
Comment 4 Andrew Fuerste-Henry 2023-11-17 15:31:06 UTC
Bug 31157 created a system preference to determine which library's rules to follow when generating overdue notices and restrictions. I think it'd make sense to create a comparable system preference for long overdue notices. It wouldn't be *wrong* to make long overdues just follow the syspref for overdues, but it does feel like someone's going to come up with a compelling need for the distinction sooner or later.
Comment 5 Michael Hafen 2024-02-13 00:23:58 UTC
Created attachment 162070 [details] [review]
Add branch and skip-branch options to cronjobs/longoverdue.pl

Test plan:
1. apply patch
2. identify two books at different branches the same number of days overdue.
3. run the longoverdue.pl script specifying one of the branches in the
     --branch command line parameter.
4. observe that the book at the specified branch has been or would be affected
     by the script while the other book is not.
Comment 6 Lucas Gass (lukeg) 2024-02-15 22:00:57 UTC
Michael, great to see a patch here! Is this ready for testing?
Comment 7 Michael Hafen 2024-02-15 22:03:25 UTC
Yes.  Sorry, I forgot to change the status to Needs Signoff.  I'll set that now.
Comment 8 Lucas Gass (lukeg) 2024-02-16 14:53:25 UTC
Thanks Michael, this looks good and works as described. You just need to fix your commit message and perltidy.
Comment 9 Michael Hafen 2024-02-16 22:34:52 UTC
Created attachment 162250 [details] [review]
Bug 9596: Add branch and skip-branch options to cronjobs/longoverdue.pl

[ Tidied and commit message fixed ]

This script doesn't seem to be included in cron files by default.
This change is to allow script parameters to effect only certain branches.
This allows the script to be added multiple times to a cron file with
  different settings for different branches.

Test plan:
1. apply patch
2. identify two books at different branches the same number of days overdue.
3. run the longoverdue.pl script specifying one of the branches in the
     --branch command line parameter.
     i.e. koha-shell -c 'misc/cronjobs/longoverdue.pl --branch branch_code --lost 60=2 --maxdays=61 --confirm' instance_name
4. observe that the book at the specified branch has been or would be affected
     by the script while the other book is not.
Comment 10 Lisette Scheer 2024-05-22 17:08:15 UTC
I believe this is back to needs signoff with the updated patch, though I wouldn't be surprised if it needs a rebase.
Comment 11 Michael Hafen 2024-05-24 20:35:52 UTC
Yes, please sign off.
I tried applying to main as of 2024-05-23, and it applies cleanly.
Comment 12 HKS3 Tadeusz Sośnierz 2024-06-03 11:45:09 UTC
Created attachment 167343 [details] [review]
Bug 9596: Add branch and skip-branch options to cronjobs/longoverdue.pl

This script doesn't seem to be included in cron files by default.
This change is to allow script parameters to effect only certain branches.
This allows the script to be added multiple times to a cron file with
  different settings for different branches.

Test plan:
1. apply patch
2. identify two books at different branches the same number of days overdue.
3. run the longoverdue.pl script specifying one of the branches in the
     --branch command line parameter.
     i.e. koha-shell -c 'misc/cronjobs/longoverdue.pl --branch branch_code --lost 60=2 --maxdays=61 --confirm' instance_name
4. observe that the book at the specified branch has been or would be affected
     by the script while the other book is not.

Signed-off-by: Tadeusz „tadzik” Sośnierz <tadeusz@sosnierz.com>
Comment 13 Kyle M Hall (khall) 2024-07-23 10:36:04 UTC
Created attachment 169405 [details] [review]
Bug 9596: Add branch and skip-branch options to cronjobs/longoverdue.pl

This script doesn't seem to be included in cron files by default.
This change is to allow script parameters to effect only certain branches.
This allows the script to be added multiple times to a cron file with
  different settings for different branches.

Test plan:
1. apply patch
2. identify two books at different branches the same number of days overdue.
3. run the longoverdue.pl script specifying one of the branches in the
     --branch command line parameter.
     i.e. koha-shell -c 'misc/cronjobs/longoverdue.pl --branch branch_code --lost 60=2 --maxdays=61 --confirm' instance_name
4. observe that the book at the specified branch has been or would be affected
     by the script while the other book is not.

Signed-off-by: Tadeusz „tadzik” Sośnierz <tadeusz@sosnierz.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 14 Kyle M Hall (khall) 2024-07-23 10:36:11 UTC
Created attachment 169406 [details] [review]
Bug 9596: (QA follow-up) Add some clarifying comments

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 15 Kyle M Hall (khall) 2024-07-23 10:39:27 UTC
Created attachment 169407 [details] [review]
Bug 9596: (QA follow-up) Only find a given patron once
Comment 16 Katrin Fischer 2024-08-09 16:40:54 UTC
Can we please switch from branch to library for the new options and in documentation, etc. please? We are trying to match the language in the GUI whenever possible to create more consistency.

See: https://wiki.koha-community.org/wiki/Terminology

I know it feels nit-picky, but if we don't do it now, it will cause much more trouble if we wanted to do it later once libraries are using these parameters.
Comment 17 Michael Hafen 2024-08-09 18:26:52 UTC
Created attachment 170213 [details] [review]
Bug 9596: Add library and skip-library options to cronjobs/longoverdue.pl

[rebase to 2024-08-05 and change cli option from --branch to --library for QA]
[  I hope it's ok that I squashed it  ]


This script doesn't seem to be included in cron files by default.
This change is to allow script parameters to effect only certain libraries.
This allows the script to be added multiple times to a cron file with
  different settings for different libraries.

Test plan:
1. apply patch
2. identify two books at different libraries the same number of days overdue.
3. run the longoverdue.pl script specifying one of the libraries in the
     --library command line parameter.
     i.e. koha-shell -c 'misc/cronjobs/longoverdue.pl --library branch_code --lost 60=2 --maxdays=61 --confirm' instance_name
4. observe that the book at the specified library has been or would be affected
     by the script while the other book is not.

Bug 9596: (QA follow-up) Add some clarifying comments

Bug 9596: (QA follow-up) Only find a given patron once
Comment 18 Katrin Fischer 2024-08-09 18:39:54 UTC
A note for Monday... I forgot to remove the patches from my branch before pushing and now we can either revert/push this or we could do a follow-up with the renaming.
Comment 19 Michael Hafen 2024-08-09 18:45:38 UTC
I'm inclined to say, since BugZilla has been changed, it might be better to revert/push.  I don't see a way to un-obsolete patches here.
Comment 20 Katrin Fischer 2024-08-09 18:48:30 UTC
(In reply to Michael Hafen from comment #19)
> I'm inclined to say, since BugZilla has been changed, it might be better to
> revert/push.  I don't see a way to un-obsolete patches here.

un-obsoleting can be done from the GUI, just not with git bz - do you want me to do it so you can take a look? But both options are fine for me, we just need to resolve.
Comment 21 Michael Hafen 2024-08-09 18:51:53 UTC
Let's go with which ever is easier for you.  I expect revert/push would be easier than un-obsoleting the three patches that were pushed, but probably only a little easier.
Comment 22 Katrin Fischer 2024-08-09 18:58:14 UTC
I can't do the revert before Monday, but will do it once I get into work.
Comment 23 Michael Hafen 2024-08-09 19:08:26 UTC
Finally found how to un-obsolete a patch.
I've changed my mind.  I can un-obsolete the patches, and provide one with the option name change.  That would be easier for you.

Should the follow-up patch be on a new bug?
Comment 24 Michael Hafen 2024-08-09 19:37:25 UTC
I figure this bug is effective pushed, so I made another bug with the follow up patch.
I think I accidentally set the status to 'RESOLVED' too.  I'm not sure what it's supposed to be though, so I'll leave that for you to change if you don't mind.
Comment 25 Katrin Fischer 2024-08-09 20:46:24 UTC
(In reply to Michael Hafen from comment #24)
> I figure this bug is effective pushed, so I made another bug with the follow
> up patch.
> I think I accidentally set the status to 'RESOLVED' too.  I'm not sure what
> it's supposed to be though, so I'll leave that for you to change if you
> don't mind.

Sorry, I was too slow. A follow-up on this bug would be great. Using the same bug number makes it easier to track and it hasn't been released yet (we always need a new bug after release).
Comment 26 Michael Hafen 2024-08-09 21:00:46 UTC
Created attachment 170222 [details] [review]
Bug 9596: Follow-up to change the option and documentation to  match Terminology Guidelines

Change the --branch and --skip-branch options to --library and --skip-library to meet the Terminology Guidelines.
Comment 27 Michael Hafen 2024-08-09 21:01:46 UTC
*** Bug 37613 has been marked as a duplicate of this bug. ***
Comment 28 Katrin Fischer 2024-08-12 11:40:01 UTC
Picking the follow-up for main. Please note that I updated the commit message a bit.
Comment 29 Katrin Fischer 2024-08-19 15:25:20 UTC
Hm, we missed the wrong bug number on the commit message:

Subject: [PATCH] Bug 37613: Follow-up to bug 9596 to change the option and
 documentation to match Terminology Guidelines
Content-Type: text/plain; charset="utf-8"

Need to keep that in mind for manually editing release notes later.

Michael: it looks like you are not using git bz?
Comment 30 Lucas Gass (lukeg) 2024-09-11 16:24:35 UTC
Enhancement will not be backported to 24.05.x
Comment 31 Aude Charillon 2025-02-06 15:16:21 UTC
New script parameters already documented by Caroline Cyr La Rose (https://gitlab.com/koha-community/koha-manual/-/merge_requests/967) Just needs to add version notes.