If a record reaches X number of reserves, the library may convert reserves to recalls to prompt patrons to return them sooner. This can be automated with a script.
Created attachment 139440 [details] [review] Issue 1: First pass at script to automate converting to recall (cherry picked from commit d97c04e398b857e39aed4c10406dd9805d419d31)
Created attachment 139441 [details] [review] Issue 1: Scheduling cron to convert recalls to reserves (cherry picked from commit 5af81d5a5adcce07adb93915bf94e76b3066d88c)
This is a work in progress and is not ready for testing.
Created attachment 139646 [details] [review] Bug 31415: Script to automate converting reserves to recalls This is a work in progress and not ready for testing.
Created attachment 139737 [details] [review] Bug 31415: Script to automate converting reserves to recalls This patch adds a script which can be used to automatically convert the oldest reserve on a record to a recall, if there are a specified minimum number of reserves on the record. To test: 1) Enable UseRecalls and configure circulation rules relevant to recalls. Keep the 'on shelf recalls allowed' setting to 'any' for the sake of testing ('all' would require all items to be checked out for the reserve to be converted to a recall) 2) Check out items from multiple records (at least 2 different records) to Patron A. 3) Place multiple reserves on each record (at least 2 reserves). 4) Place multiple reserves on another record which has no items checked out. 5) We now have multiple records where the oldest reserve is eligible for recall, plus a record where the oldest reserve is NOT eligible for recall (because no items are checked out). 6) In your terminal, get into the shell and run the script. -v means verbose and will print the reserves that are converted into recalls. --min 1 means there must be more than 1 reserve on the record to be considered. sudo koha-shell INSTANCE perl misc/cronjobs/recalls/convert_reserves_to_recalls.pl -v --min 1 7) Confirm that, for the records where items are checked out and there are multiple reserves, the oldest reserve was converted into a recall 8) Confirm that, for the record where no items are checked out, the reserves all remain and not converted into a recall. 9) Confirm documentation for the script looks good perldoc misc/cronjobs/recalls/convert_reserves_to_recalls.pl Sponsored-by: Auckland University of Technology
Created attachment 145796 [details] [review] Bug 31415: Script to automate converting reserves to recalls This patch adds a script which can be used to automatically convert the oldest reserve on a record to a recall, if there are a specified minimum number of reserves on the record. To test: 1) Enable UseRecalls and configure circulation rules relevant to recalls. Keep the 'on shelf recalls allowed' setting to 'any' for the sake of testing ('all' would require all items to be checked out for the reserve to be converted to a recall) 2) Check out items from multiple records (at least 2 different records) to Patron A. 3) Place multiple reserves on each record (at least 2 reserves). 4) Place multiple reserves on another record which has no items checked out. 5) We now have multiple records where the oldest reserve is eligible for recall, plus a record where the oldest reserve is NOT eligible for recall (because no items are checked out). 6) In your terminal, get into the shell and run the script. -v means verbose and will print the reserves that are converted into recalls. --min 1 means there must be more than 1 reserve on the record to be considered. sudo koha-shell INSTANCE perl misc/cronjobs/recalls/convert_reserves_to_recalls.pl -v --min 1 7) Confirm that, for the records where items are checked out and there are multiple reserves, the oldest reserve was converted into a recall 8) Confirm that, for the record where no items are checked out, the reserves all remain and not converted into a recall. 9) Confirm documentation for the script looks good perldoc misc/cronjobs/recalls/convert_reserves_to_recalls.pl Sponsored-by: Auckland University of Technology Signed-off-by: David Nind <david@davidnind.com>
Easy to fix issue, can you please change usage of the word "reserve" to "hold" for consistency with Koha standard terminology: https://wiki.koha-community.org/wiki/Terminology#R
Created attachment 148112 [details] [review] Bug 31415: Script to automate converting holds to recalls This patch adds a script which can be used to automatically convert the oldest hold on a record to a recall, if there are a specified minimum number of holds on the record. To test: 1) Enable UseRecalls and configure circulation rules relevant to recalls. Keep the 'on shelf recalls allowed' setting to 'any' for the sake of testing ('all' would require all items to be checked out for the hold to be converted to a recall) 2) Check out items from multiple records (at least 2 different records) to Patron A. 3) Place multiple holds on each record (at least 2 holds). 4) Place multiple holds on another record which has no items checked out. 5) We now have multiple records where the oldest hold is eligible for recall, plus a record where the oldest hold is NOT eligible for recall (because no items are checked out). 6) In your terminal, get into the shell and run the script. -v means verbose and will print the holds that are converted into recalls. --min 1 means there must be more than 1 hold on the record to be considered. sudo koha-shell INSTANCE perl misc/cronjobs/recalls/convert_holds_to_recalls.pl -v --min 1 7) Confirm that, for the records where items are checked out and there are multiple holds, the oldest hold was converted into a recall 8) Confirm that, for the record where no items are checked out, the holds all remain and not converted into a recall. 9) Confirm documentation for the script looks good perldoc misc/cronjobs/recalls/convert_holds_to_recalls.pl Sponsored-by: Auckland University of Technology Signed-off-by: David Nind <david@davidnind.com>
I'm getting this error when running the script: perl misc/cronjobs/recalls/convert_holds_to_recalls.pl -v --min 1 DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Unknown column 'holddate' in 'order clause' at /kohadevbox/koha/Koha/Objects.pm line 394
Created attachment 157002 [details] [review] Bug 31415: Script to automate converting holds to recalls This patch adds a script which can be used to automatically convert the oldest hold on a record to a recall, if there are a specified minimum number of holds on the record. To test: 1) Enable UseRecalls and configure circulation rules relevant to recalls. Keep the 'on shelf recalls allowed' setting to 'any' for the sake of testing ('all' would require all items to be checked out for the hold to be converted to a recall) 2) Check out items from multiple records (at least 2 different records) to Patron A. 3) Place multiple holds on each record (at least 2 holds). 4) Place multiple holds on another record which has no items checked out. 5) We now have multiple records where the oldest hold is eligible for recall, plus a record where the oldest hold is NOT eligible for recall (because no items are checked out). 6) In your terminal, get into the shell and run the script. -v means verbose and will print the holds that are converted into recalls. --min 1 means there must be more than 1 hold on the record to be considered. sudo koha-shell INSTANCE perl misc/cronjobs/recalls/convert_holds_to_recalls.pl -v --min 1 7) Confirm that, for the records where items are checked out and there are multiple holds, the oldest hold was converted into a recall 8) Confirm that, for the record where no items are checked out, the holds all remain and not converted into a recall. 9) Confirm documentation for the script looks good perldoc misc/cronjobs/recalls/convert_holds_to_recalls.pl Sponsored-by: Auckland University of Technology Signed-off-by: David Nind <david@davidnind.com>
I got this error message when testing again: perl misc/cronjobs/recalls/convert_holds_to_recalls.pl -v --min 1 No reserves HOLD_CANCELLATION letter transported by email at /kohadevbox/koha/C4/Letters.pm line 588. The method Koha::Hold->hold_id is not covered by tests! Trace begun at /kohadevbox/koha/Koha/Object.pm line 931 Koha::Object::AUTOLOAD('Koha::Hold=HASH(0x55b1c879dd50)') called at misc/cronjobs/recalls/convert_holds_to_recalls.pl line 129 Do I need to make sure email is set up and that each of the patrons have an email address? The records and patrons I used were from different libraries, not sure whether that should make a difference. Setup: 1. Recalls: . Recalls allowed (total): 5 . Recalls per record (count): 5 . On shelf recalls allowed: If any unavailable1 . Recall due date interval (day): 5 . Recall overdue fine amount: 5.00 . Recall pickup period (day): 5 2. Checked out 3 items to Mary Burton (Effective Perl (139 - item 296), Perl template toolkit (255 - item 564), Programming Perl (262 - item 578)) 3. Placed holds on these records: - Effective Perl (139): Bobbie Middleton, Henry Acevedo, Lisa Charles - Perl template toolkit (255): Henry Acevedo, Lisa Charles, Bobbie Middleton - Programming Perl (262): Henry Acevedo, Lisa Charles, Bobbie Middleton - The complete novels / Jane Austen (19): Mary Burton, Lisa Charles 4. After running the script, got the error above. One recall was made for: - Effective Perl: requested by Bobbie Middleton
Created attachment 159010 [details] [review] Bug 31415: Exclude found holds and fix hold ID call
Created attachment 159016 [details] [review] Bug 31415: Script to automate converting holds to recalls This patch adds a script which can be used to automatically convert the oldest hold on a record to a recall, if there are a specified minimum number of holds on the record. To test: 1) Enable UseRecalls and configure circulation rules relevant to recalls. Keep the 'on shelf recalls allowed' setting to 'any' for the sake of testing ('all' would require all items to be checked out for the hold to be converted to a recall) 2) Check out items from multiple records (at least 2 different records) to Patron A. 3) Place multiple holds on each record (at least 2 holds). 4) Place multiple holds on another record which has no items checked out. 5) We now have multiple records where the oldest hold is eligible for recall, plus a record where the oldest hold is NOT eligible for recall (because no items are checked out). 6) In your terminal, get into the shell and run the script. -v means verbose and will print the holds that are converted into recalls. --min 1 means there must be more than 1 hold on the record to be considered. sudo koha-shell INSTANCE perl misc/cronjobs/recalls/convert_holds_to_recalls.pl -v --min 1 7) Confirm that, for the records where items are checked out and there are multiple holds, the oldest hold was converted into a recall 8) Confirm that, for the record where no items are checked out, the holds all remain and not converted into a recall. 9) Confirm documentation for the script looks good perldoc misc/cronjobs/recalls/convert_holds_to_recalls.pl Sponsored-by: Auckland University of Technology Signed-off-by: David Nind <david@davidnind.com>
Created attachment 159017 [details] [review] Bug 31415: Exclude found holds and fix hold ID call Signed-off-by: David Nind <david@davidnind.com>
All looks good and now working as expected. The documentation looks fine to me.
Can this be moved to signed off now?