Bug 25958 - Allow LongOverdue cron to exclude specified lost values
Summary: Allow LongOverdue cron to exclude specified lost values
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Kyle M Hall
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 26968 26548
  Show dependency treegraph
 
Reported: 2020-07-08 18:32 UTC by Andrew Fuerste-Henry
Modified: 2021-06-14 21:31 UTC (History)
10 users (show)

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


Attachments
Bug 25958: Allow LongOverdue cron to exclude specified lost values (9.81 KB, patch)
2020-07-28 12:01 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 25958: Allow LongOverdue cron to exclude specified lost values (9.81 KB, patch)
2020-07-29 21:35 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 25958: Allow LongOverdue cron to exclude specified lost values (9.86 KB, patch)
2020-08-19 12:23 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 25958: Allow LongOverdue cron to exclude specified lost values (9.92 KB, patch)
2020-08-22 16:08 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 25958: (QA follow-up) Add some punctuation to new DefaultLongOverdueSkipLostStatuses (1.46 KB, patch)
2020-08-22 16:08 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 25958: (QA follow-up) Implement filter in database query instead of in loop (2.26 KB, patch)
2020-08-24 17:13 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 25958: (QA follow-up) Implement filter in database query instead of in loop (2.42 KB, patch)
2020-08-24 17:14 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 25958 - Allow LongOverdue cron to exclude specified lost values [20.05.x] (1.23 KB, patch)
2020-09-24 02:20 UTC, Mason James
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Fuerste-Henry 2020-07-08 18:32:23 UTC
When lost items are not marked as returned, they are still subject to the long overdue cron, so an item that has already been marked Lost may automatically roll to Long Overdue. In some cases, a library may not want that lost value to change. This becomes especially important with the introduction of Claims Returned, which uses a variety of lost.

I'd like to see two options added to the cron. The first to take a list of lost values that are subject to long overdue, the second to take a list of lost values that are not subject to long overdue.
Comment 1 Katrin Fischer 2020-07-09 06:02:14 UTC
Please keep in mind that there are also system preferences for the long overdue job, so we should use the same logic when adding new features!
Comment 2 Andrew Fuerste-Henry 2020-07-09 14:11:23 UTC
Yes, absolutely! We've already got several options in the cron that can only be set at the command line. It would be good to move toward making those options all configurable from the staff client so those sysprefs are an accurate representation of the cron's behavior.
Comment 3 Kyle M Hall 2020-07-28 12:01:58 UTC
Created attachment 107461 [details] [review]
Bug 25958: Allow LongOverdue cron to exclude specified lost values

When lost items are not marked as returned, they are still subject to
the long overdue cron, so an item that has already been marked Lost may
automatically roll to Long Overdue. In some cases, a library may not
want that lost value to change. This becomes especially important with
the introduction of Claims Returned, which uses a variety of lost.

Test Plan:
1) Set up a long overdue item that would be moved to lost by longoverdue.pl
2) Run the cronjob with the new --skip-lost-value option
3) Note the item is not altered
4) Include that value in the new system preference DefaultLongOverdueSkipLostStatuses
5) Run the cronjob *without* the new option
6) Note the item is not altered
7) Run the cronjob again with the new command line option, but set it to
a different value so the item will be affected
8) Note the item is altered as it would have been before this patch was
applied
Comment 4 Andrew Fuerste-Henry 2020-07-29 21:35:40 UTC
Created attachment 107538 [details] [review]
Bug 25958: Allow LongOverdue cron to exclude specified lost values

When lost items are not marked as returned, they are still subject to
the long overdue cron, so an item that has already been marked Lost may
automatically roll to Long Overdue. In some cases, a library may not
want that lost value to change. This becomes especially important with
the introduction of Claims Returned, which uses a variety of lost.

Test Plan:
1) Set up a long overdue item that would be moved to lost by longoverdue.pl
2) Run the cronjob with the new --skip-lost-value option
3) Note the item is not altered
4) Include that value in the new system preference DefaultLongOverdueSkipLostStatuses
5) Run the cronjob *without* the new option
6) Note the item is not altered
7) Run the cronjob again with the new command line option, but set it to
a different value so the item will be affected
8) Note the item is altered as it would have been before this patch was
applied

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 5 Andrew Fuerste-Henry 2020-08-19 12:23:07 UTC
Created attachment 108592 [details] [review]
Bug 25958: Allow LongOverdue cron to exclude specified lost values

When lost items are not marked as returned, they are still subject to
the long overdue cron, so an item that has already been marked Lost may
automatically roll to Long Overdue. In some cases, a library may not
want that lost value to change. This becomes especially important with
the introduction of Claims Returned, which uses a variety of lost.

Test Plan:
1) Set up a long overdue item that would be moved to lost by longoverdue.pl
2) Run the cronjob with the new --skip-lost-value option
3) Note the item is not altered
4) Include that value in the new system preference DefaultLongOverdueSkipLostStatuses
5) Run the cronjob *without* the new option
6) Note the item is not altered
7) Run the cronjob again with the new command line option, but set it to
a different value so the item will be affected
8) Note the item is altered as it would have been before this patch was
applied

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>

Signed-off-by: Rebecca Coert <rcoert@arlingtonva.us>
Comment 6 Katrin Fischer 2020-08-22 16:08:49 UTC
Created attachment 108933 [details] [review]
Bug 25958: Allow LongOverdue cron to exclude specified lost values

When lost items are not marked as returned, they are still subject to
the long overdue cron, so an item that has already been marked Lost may
automatically roll to Long Overdue. In some cases, a library may not
want that lost value to change. This becomes especially important with
the introduction of Claims Returned, which uses a variety of lost.

Test Plan:
1) Set up a long overdue item that would be moved to lost by longoverdue.pl
2) Run the cronjob with the new --skip-lost-value option
3) Note the item is not altered
4) Include that value in the new system preference DefaultLongOverdueSkipLostStatuses
5) Run the cronjob *without* the new option
6) Note the item is not altered
7) Run the cronjob again with the new command line option, but set it to
a different value so the item will be affected
8) Note the item is altered as it would have been before this patch was
applied

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>

Signed-off-by: Rebecca Coert <rcoert@arlingtonva.us>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 7 Katrin Fischer 2020-08-22 16:08:53 UTC
Created attachment 108934 [details] [review]
Bug 25958: (QA follow-up) Add some punctuation to new DefaultLongOverdueSkipLostStatuses

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Jonathan Druart 2020-08-24 08:44:49 UTC
Kyle, why don't you build the SQL query to not retrieve items with itemlost in @skip_lost_values?
Comment 9 Kyle M Hall 2020-08-24 17:13:35 UTC
Created attachment 109028 [details] [review]
Bug 25958: (QA follow-up) Implement filter in database query instead of in loop
Comment 10 Kyle M Hall 2020-08-24 17:14:50 UTC
Created attachment 109029 [details] [review]
Bug 25958: (QA follow-up) Implement filter in database query instead of in loop
Comment 11 Jonathan Druart 2020-08-25 13:16:25 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 12 Lucas Gass 2020-09-04 20:08:13 UTC
backported to 20.05.x for 20.05.04
Comment 13 Aleisha Amohia 2020-09-10 04:35:26 UTC
backported to 19.11.x for 19.11.10
Comment 14 Victor Grousset/tuxayo 2020-09-20 18:27:24 UTC
Not backported to oldoldstable (19.05.x). Feel free to ask if it's needed.
Comment 15 Pablo AB 2020-09-23 16:43:43 UTC
Today while upgrading a Koha on stable from 20.05.04-1 to 20.05.03-1 I got:

DBD::mysql::db do failed: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 [for Statement "
        INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
        ('DefaultLongOverdueSkipLostStatuses', '', NULL, 'Skip these lost statuses by default in longoverdue.pl', 'Free'),
    "] at /usr/share/koha/intranet/cgi-bin/installer/data/mysql/updatedatabase.pl line 22388.

Probably "fixed" running the query afterward:
sudo koha-mysql $INSTANCE -e "INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('DefaultLongOverdueSkipLostStatuses', '', NULL, 'Skip these lost statuses by default in longoverdue.pl', 'Free');"
Comment 16 Mason James 2020-09-24 02:20:36 UTC
Created attachment 110635 [details] [review]
Bug 25958 - Allow LongOverdue cron to exclude specified lost values [20.05.x]

fix sql typo, https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25958#c15