Bug 35169 - Make long overdue patron category options configurable in interface
Summary: Make long overdue patron category options configurable in interface
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Matthias Le Gac
QA Contact: Kyle M Hall (khall)
URL:
Keywords:
Depends on:
Blocks: 38053
  Show dependency treegraph
 
Reported: 2023-10-26 16:47 UTC by Lisette Scheer
Modified: 2024-10-01 19:50 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact: Caroline Cyr La Rose
Documentation submission: https://gitlab.com/koha-community/koha-manual/-/merge_requests/967
Text to go in the release notes:
This adds two new system preferences `DefaultLongOverduePatronCategories` and `DefaultLongOverdueSkipPatronCategories` that allow for additional configuration of the `longoverdue.pl` CLI script directly from the staff interface. The settings of the system preferences will be used when the script is called without the corresponding options.
Version(s) released in:
24.05.00
Circulation function:


Attachments
Bug 35169: Make long overdue borrower category options configurable in interface (15.42 KB, patch)
2024-02-22 17:24 UTC, Matthias Le Gac
Details | Diff | Splinter Review
Bug 35169: Make long overdue borrower category options configurable in interface (3.17 KB, patch)
2024-02-22 19:47 UTC, Matthias Le Gac
Details | Diff | Splinter Review
Bug 35169: add bug_35169.pl for DB (2.31 KB, patch)
2024-02-22 20:37 UTC, Matthias Le Gac
Details | Diff | Splinter Review
Bug 35169: update sysprefs.sql (3.38 KB, patch)
2024-02-29 17:12 UTC, Matthias Le Gac
Details | Diff | Splinter Review
Bug 35169: update DBupdate file (1.23 KB, patch)
2024-03-01 13:54 UTC, Matthias Le Gac
Details | Diff | Splinter Review
Bug 35169: Resolve the override situations (2.34 KB, patch)
2024-03-01 19:20 UTC, Matthias Le Gac
Details | Diff | Splinter Review
Bug 35169: (follow-up) perltidy (878 bytes, patch)
2024-03-09 17:54 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 35169: Make long overdue borrower category options configurable in interface (3.23 KB, patch)
2024-05-03 14:11 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 35169: add bug_35169.pl for DB (2.37 KB, patch)
2024-05-03 14:11 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 35169: update sysprefs.sql (3.43 KB, patch)
2024-05-03 14:11 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 35169: update DBupdate file (1.29 KB, patch)
2024-05-03 14:11 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 35169: Resolve the override situations (2.39 KB, patch)
2024-05-03 14:11 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 35169: (follow-up) perltidy (935 bytes, patch)
2024-05-03 14:11 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 35169: (QA follow-up) Fix up syspref language and group them together (2.86 KB, patch)
2024-05-03 14:11 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 35169: (QA follow-up) Fix spelling and preference name (9.36 KB, patch)
2024-05-07 10:53 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lisette Scheer 2023-10-26 16:47:25 UTC
Being able to set the borrower category options:

'category=s'        => $borrower_category,
'skip-category=s'   => $skip_borrower_category

Via the staff interface would be really helpful for users being able to update their longoverdue settings without needing to edit the command line.
Comment 1 Matthias Le Gac 2024-02-22 17:24:27 UTC
Created attachment 162340 [details] [review]
Bug 35169: Make long overdue borrower category options configurable in interface

Test Plan :

1 - Apply the patch
2 - Go to Koha administration > System preferences > Circulation > Checkout policy
3 - Set "DefaultLongOverdueLostValue" to "Lost" and "DefaultLongOverdueDays" to "2"
4 - Check out an item to a patron and set the date to more than two days.
5 - Remember the category of the patron

Test of DefaultLongOverdueBorrowerCategories option :
6 - Go to Koha administration > System preferences > Circulation > Checkout policy
7 - Set "DefaultLongOverdueBorrowerCategories" to the category of the patron
8 - Go to the terminal in the koha environment and execute the script "./misc/cronjobs/longoverdue.pl"
9 - Normaly you see in list the check out item set just before and the list it's only borrowers with the category

Test of DefaultLongOverdueSkipBorrowerCategories option :
10 - Go to Koha administration > System preferences > Circulation > Checkout policy
11 - Set "DefaultLongOverdueSkipBorrowerCategories" to the category of the patron
12 - Go to the terminal in the koha environment and execute the script "./misc/cronjobs/longoverdue.pl"
13 - Normaly you don't see in list the check out item set just before and the list it's only borrowers with others categories

Test of warning :
14 - Go to Koha administration > System preferences > Circulation > Checkout policy
15 - Set "DefaultLongOverdueBorrowerCategories" to the category of the patron and Set "DefaultLongOverdueSkipBorrowerCategories" to the category of the patron
16 - Go to the terminal in the koha environment and execute the script "./misc/cronjobs/longoverdue.pl"
17 - Normaly you don't see in list the check out item set just before because the "DefaultLongOverdueSkipBorrowerCategories" take advantage of "DefaultLongOverdueBorrowerCategories"
Comment 2 Matthias Le Gac 2024-02-22 19:47:07 UTC
Created attachment 162345 [details] [review]
Bug 35169: Make long overdue borrower category options configurable in interface
Comment 3 Matthias Le Gac 2024-02-22 20:37:27 UTC
Created attachment 162346 [details] [review]
Bug 35169: add bug_35169.pl for DB
Comment 4 Lucas Gass (lukeg) 2024-02-27 21:50:30 UTC
Matthias,

Can you update sysprefs.sql to include the new system preferences? You also need to use INSERT IGNORE INTO in your database update. 

Also, perltidy :)
Comment 5 Matthias Le Gac 2024-02-29 17:12:42 UTC
Created attachment 162611 [details] [review]
Bug 35169: update sysprefs.sql

Test Plan :

1 - Apply the patch
2 - Go to Koha administration > System preferences > Circulation > Checkout policy
3 - Set "DefaultLongOverdueLostValue" to "Lost" and "DefaultLongOverdueDays" to "2"
4 - Check out an item to a patron and set the date to more than two days.
5 - Remember the category of the patron

Test of DefaultLongOverdueBorrowerCategories option :
6 - Go to Koha administration > System preferences > Circulation > Checkout policy
7 - Set "DefaultLongOverdueBorrowerCategories" to the category of the patron
8 - Go to the terminal in the koha environment and execute the script "./misc/cronjobs/longoverdue.pl"
9 - Normaly you see in list the check out item set just before and the list it's only borrowers with the category

Test of DefaultLongOverdueSkipBorrowerCategories option :
10 - Go to Koha administration > System preferences > Circulation > Checkout policy
11 - Set "DefaultLongOverdueSkipBorrowerCategories" to the category of the patron
12 - Go to the terminal in the koha environment and execute the script "./misc/cronjobs/longoverdue.pl"
13 - Normaly you don't see in list the check out item set just before and the list it's only borrowers with others categories

Test of warning :
14 - Go to Koha administration > System preferences > Circulation > Checkout policy
15 - Set "DefaultLongOverdueBorrowerCategories" to the category of the patron and Set "DefaultLongOverdueSkipBorrowerCategories" to the category of the patron
16 - Go to the terminal in the koha environment and execute the script "./misc/cronjobs/longoverdue.pl"
17 - Normaly you don't see in list the check out item set just before because the "DefaultLongOverdueSkipBorrowerCategories" take advantage of "DefaultLongOverdueBorrowerCategories"
Comment 6 Matthias Le Gac 2024-02-29 17:17:11 UTC
Lucas, 

Tell me if the update of sysprefs.sql is good. It's the first time I am doing this.
Comment 7 Lucas Gass (lukeg) 2024-02-29 23:20:17 UTC
Matthias,

I tested this and it seems to work as intended, you sysprefs.sql update looks good to me.

However, your DBUpdate explanation and type should not be NULL. Sorry to be a pain!
Comment 8 Matthias Le Gac 2024-03-01 13:54:37 UTC
Created attachment 162667 [details] [review]
Bug 35169: update DBupdate file

Test Plan :

1 - Apply the patch
2 - Go to Koha administration > System preferences > Circulation > Checkout policy
3 - Set "DefaultLongOverdueLostValue" to "Lost" and "DefaultLongOverdueDays" to "2"
4 - Check out an item to a patron and set the date to more than two days.
5 - Remember the category of the patron

Test of DefaultLongOverdueBorrowerCategories option :
6 - Go to Koha administration > System preferences > Circulation > Checkout policy
7 - Set "DefaultLongOverdueBorrowerCategories" to the category of the patron
8 - Go to the terminal in the koha environment and execute the script "./misc/cronjobs/longoverdue.pl"
9 - Normaly you see in list the check out item set just before and the list it's only borrowers with the category

Test of DefaultLongOverdueSkipBorrowerCategories option :
10 - Go to Koha administration > System preferences > Circulation > Checkout policy
11 - Set "DefaultLongOverdueSkipBorrowerCategories" to the category of the patron
12 - Go to the terminal in the koha environment and execute the script "./misc/cronjobs/longoverdue.pl"
13 - Normaly you don't see in list the check out item set just before and the list it's only borrowers with others categories

Test of warning :
14 - Go to Koha administration > System preferences > Circulation > Checkout policy
15 - Set "DefaultLongOverdueBorrowerCategories" to the category of the patron and Set "DefaultLongOverdueSkipBorrowerCategories" to the category of the patron
16 - Go to the terminal in the koha environment and execute the script "./misc/cronjobs/longoverdue.pl"
17 - Normaly you don't see in list the check out item set just before because the "DefaultLongOverdueSkipBorrowerCategories" take advantage of "DefaultLongOverdueBorrowerCategories"
Comment 9 Matthias Le Gac 2024-03-01 13:56:32 UTC
(In reply to Lucas Gass from comment #7)
> Matthias,
> 
> I tested this and it seems to work as intended, you sysprefs.sql update
> looks good to me.
> 
> However, your DBUpdate explanation and type should not be NULL. Sorry to be
> a pain!

Thank you for your feedback. Normally it's good now.
Comment 10 Lucas Gass (lukeg) 2024-03-01 16:11:02 UTC
Matthias,

Looking closer here. If you add values to the new system preferences they override what is added at the cron level? Then you probably need to add a better description about what is happening in the POD?

Also, if you use the system preferences now you are unable to configure the cron differently and run it more than once. For example you might want to do something like this:

longoverdue.pl --skip-category PT --lost 14=2 --confirm
longoverdue.pl --skip-category PT2 --lost 21=2 --confirm

That seems like it could be a problem? 

I won't fail this again. I'll let someone else have a look and give opinions.
Comment 11 Lisette Scheer 2024-03-01 16:30:40 UTC
I agree with Lucas that it's a problem you can't set different options for different patron categories. 
Currently you can set not only to skip, but also to have different patron types go to lost at different times at the cron level (such as having staff go to lost at 365 when the default is 60.) 

The skip default is good, but this doesn't really address the other part where you can set different rules by category.
Comment 12 Matthias Le Gac 2024-03-01 16:49:42 UTC
(In reply to Lucas Gass from comment #10)
> Matthias,
> 
> Looking closer here. If you add values to the new system preferences they
> override what is added at the cron level? Then you probably need to add a
> better description about what is happening in the POD?
> 
> Also, if you use the system preferences now you are unable to configure the
> cron differently and run it more than once. For example you might want to do
> something like this:
> 
> longoverdue.pl --skip-category PT --lost 14=2 --confirm
> longoverdue.pl --skip-category PT2 --lost 21=2 --confirm
> 
> That seems like it could be a problem? 
> 
> I won't fail this again. I'll let someone else have a look and give opinions.

I'll look into that to implement the correct behavior.
Comment 13 Matthias Le Gac 2024-03-01 19:20:42 UTC
Created attachment 162688 [details] [review]
Bug 35169: Resolve the override situations

Test Plan :

1 - Apply the patch
2 - Go to Koha administration > System preferences > Circulation > Checkout policy
3 - Set "DefaultLongOverdueLostValue" to "Lost" and "DefaultLongOverdueDays" to "2"
4 - Check out an item to a patron and set the date to more than two days.
5 - Remember the category of the patron

Test of DefaultLongOverdueBorrowerCategories option :
6 - Go to Koha administration > System preferences > Circulation > Checkout policy
7 - Set "DefaultLongOverdueBorrowerCategories" to the category of the patron
8 - Go to the terminal in the koha environment and execute the script "./misc/cronjobs/longoverdue.pl"
9 - Normaly you see in list the check out item set just before and the list it's only borrowers with the category

Test of DefaultLongOverdueSkipBorrowerCategories option :
10 - Go to Koha administration > System preferences > Circulation > Checkout policy
11 - Set "DefaultLongOverdueSkipBorrowerCategories" to the category of the patron
12 - Go to the terminal in the koha environment and execute the script "./misc/cronjobs/longoverdue.pl"
13 - Normaly you don't see in list the check out item set just before and the list it's only borrowers with others categories

Test of warning :
14 - Go to Koha administration > System preferences > Circulation > Checkout policy
15 - Set "DefaultLongOverdueBorrowerCategories" to the category of the patron and Set "DefaultLongOverdueSkipBorrowerCategories" to the category of the patron
16 - Go to the terminal in the koha environment and execute the script "./misc/cronjobs/longoverdue.pl"
17 - Normaly you don't see in list the check out item set just before because the "DefaultLongOverdueSkipBorrowerCategories" take advantage of "DefaultLongOverdueBorrowerCategories"
Comment 14 Lisette Scheer 2024-03-07 23:37:33 UTC
Currently, you can set different lengths for different patrons, running the cron multiple times with different settings. Ideally a solution in the staff interface would also allow this. This + the option to add different settings at the patron category level with different settings would be ideal:

longoverdue.pl --skip-category PT --lost 14=2 --confirm
longoverdue.pl --skip-category PT2 --lost 21=2 --confirm
Comment 15 Matthias Le Gac 2024-03-08 16:07:45 UTC
(In reply to Lisette Scheer from comment #14)
> Currently, you can set different lengths for different patrons, running the
> cron multiple times with different settings. Ideally a solution in the staff
> interface would also allow this. This + the option to add different settings
> at the patron category level with different settings would be ideal:
> 
> longoverdue.pl --skip-category PT --lost 14=2 --confirm
> longoverdue.pl --skip-category PT2 --lost 21=2 --confirm

Currently, you can't set different values for DefaultLongOverdueLostValue and DefaultLongOverdueLostValue from the interface. So it's not possible to have two longoverdue.pl running at the same time if they're set from the interface. 
So I think it would be an improvement on all longoverdue.pl system preferences, not just on categories.
I'm not sure it's directly related to this bz.
Tell me what you think?


For presition longoverdue.pl doesn't allow DefaultLongOverdueBorrowerCategories and DefaultLongOverdueSkipBorrowerCategories to be used at the same time. If they are used at the same time, DefaultLongOverdueSkipBorrowerCategories will override DefaultLongOverdueBorrowerCategories.
Comment 16 Lucas Gass (lukeg) 2024-03-09 17:54:06 UTC
Created attachment 163008 [details] [review]
Bug 35169: (follow-up) perltidy

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 17 Kyle M Hall (khall) 2024-05-03 14:11:11 UTC
Created attachment 166121 [details] [review]
Bug 35169: Make long overdue borrower category options configurable in interface

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 18 Kyle M Hall (khall) 2024-05-03 14:11:17 UTC
Created attachment 166122 [details] [review]
Bug 35169: add bug_35169.pl for DB

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 19 Kyle M Hall (khall) 2024-05-03 14:11:20 UTC
Created attachment 166123 [details] [review]
Bug 35169: update sysprefs.sql

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 20 Kyle M Hall (khall) 2024-05-03 14:11:22 UTC
Created attachment 166124 [details] [review]
Bug 35169: update DBupdate file

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 21 Kyle M Hall (khall) 2024-05-03 14:11:24 UTC
Created attachment 166125 [details] [review]
Bug 35169: Resolve the override situations

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 22 Kyle M Hall (khall) 2024-05-03 14:11:27 UTC
Created attachment 166126 [details] [review]
Bug 35169: (follow-up) perltidy

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 23 Kyle M Hall (khall) 2024-05-03 14:11:29 UTC
Created attachment 166127 [details] [review]
Bug 35169: (QA follow-up) Fix up syspref language and group them together

The language used in the syspref preferences was a bit confusing.
Also, it makes sense to keep these two together on the page as they
are intrinsically linked.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 24 Katrin Fischer 2024-05-03 17:47:26 UTC
Small things, but please provide a follow-up:

1) Terminology:

DefaultLongOverdueSkipBorrowerCategories
DefaultLongOverdueSkipBorrowerCategories

I have checked, we have no other BorrowerCategories system preferences, but we have suggestionPatronCategoryExceptions. I think it's worthwhile to make these *PatronCategories.

Also in sysprefs.sql and the database update:
+('DefaultLongOverdueBorrowerCategories', '', NULL, "Set the borrower categories that will be listed when longoverdue cronjob is executed", 'choice'),

-> patron categories

2) Typo

Set the default patron categories to recieve overdues to
Set the default patron categories to recieve overdues to

-> receive

3) Sponsorship

Just asking as the new version of the QA script keeps asking me about it! :)
Comment 25 Martin Renvoize (ashimema) 2024-05-07 10:53:44 UTC
Created attachment 166256 [details] [review]
Bug 35169: (QA follow-up) Fix spelling and preference name

Update the preference name from 'Borrower' to 'Patron' and correct
spelling of receive.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 26 Katrin Fischer 2024-05-07 13:56:05 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 27 Fridolin Somers 2024-05-24 14:17:27 UTC
Not backported to 23.11.x