Bug 32776 - Choose to convert oldest reserve or all possible reserves to recalls
Summary: Choose to convert oldest reserve or all possible reserves to recalls
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Aleisha Amohia
QA Contact: Testopia
URL:
Keywords:
Depends on: 31415
Blocks:
  Show dependency treegraph
 
Reported: 2023-02-01 01:57 UTC by Aleisha Amohia
Modified: 2023-11-20 03:48 UTC (History)
3 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Medium patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 32776: Add ConvertSelectedReservesToRecalls system preference (3.92 KB, patch)
2023-02-02 04:15 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 32776: Select reserves to convert using new syspref (10.40 KB, patch)
2023-02-02 04:15 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 32776: Add ConvertSelectedReservesToRecalls system preference (3.97 KB, patch)
2023-10-12 22:39 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 32776: Select reserves to convert using new syspref (10.13 KB, patch)
2023-10-12 22:39 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 32776: Terminology: Reserves to Holds (8.28 KB, patch)
2023-10-12 22:39 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 32776: Terminology: Reserves to Holds (8.28 KB, patch)
2023-10-12 22:40 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 32776: Terminology: Reserves to Holds (8.27 KB, patch)
2023-10-16 00:52 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 32776: Terminology: Reserves to Holds (8.67 KB, patch)
2023-10-27 01:03 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Screenshots - Before and after for step 23 (645.13 KB, application/pdf)
2023-10-28 21:48 UTC, David Nind
Details
Bug 32776: Select reserves to convert using new syspref (10.15 KB, patch)
2023-11-19 21:52 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 32776: Terminology: Reserves to Holds (8.68 KB, patch)
2023-11-19 21:52 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 32776: Stop recalled items from being recalled by other holds being converted on same record (1.55 KB, patch)
2023-11-19 21:52 UTC, Aleisha Amohia
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Aleisha Amohia 2023-02-01 01:57:09 UTC
Bug 31415 introduces a script to convert reserves to recalls.

By default, it will take the oldest reserve on a record and convert it to a recall.

We should be able to customise which reserve(s) are converted to recalls.

Options may include:
- oldest reserve
- one reserve for each issued item available to be recalled
Comment 1 Aleisha Amohia 2023-02-02 04:15:30 UTC
Created attachment 145987 [details] [review]
Bug 32776: Add ConvertSelectedReservesToRecalls system preference
Comment 2 Aleisha Amohia 2023-02-02 04:15:35 UTC
Created attachment 145988 [details] [review]
Bug 32776: Select reserves to convert using new syspref

This patchset enhances the convert_reserves_to_recalls.pl cronjob by
allowing libraries to be more specific about which reserves should be
converted to recalls.

The new ConvertSelectedReservesToRecalls adds the flexibility to choose:
- the oldest placed reserve to be converted to a recall
- each reserve will be converted, one by one, until all recallable items
are recalled

When reserves are converted to recalls, they will be allocated a
specific item and become an item-level recall. This is so recallable
items can be allocated one by one.

To test:

1. Apply Bug 31415 and configure recalls
2. Apply these patches and update database
3. Create a biblio with 3 items
4. Check out all 3 items to 3 different patrons
5. Place 4 biblio-level reserves for 4 different patrons
6. Set the ConvertSelectedReservesToRecalls system preference to
'oldest'
7. In your shell, run the script

misc/cronjobs/recalls/convert_reserves_to_recalls.pl -v --min 1

8. Confirm there is now 1 recall and 3 biblio-level reserves on the
record
9. Confirm the recall has been allocated to one item (there should be a
barcode next to the title in the recalls table)

10. In your shell, run the script

misc/cronjobs/recalls/convert_reserves_to_recalls.pl -v --min 1

11. Confirm there are now 2 recalls and 2 biblio-level reserves on the
record
12. Confirm the second recall was allocated to the second item. NOT the
same item as the first recall.

13. In your shell, run the script twice

misc/cronjobs/recalls/convert_reserves_to_recalls.pl -v --min 1
misc/cronjobs/recalls/convert_reserves_to_recalls.pl -v --min 1

14. Confirm there is still one reserve remaining that can't be converted
because all recallable items are already recalled.

15. Set the ConvertSelectedReservesToRecalls system preference to
'recallable'
16. Select all of the recalls on the record and delete them
17. Place 4 biblio-level reserves for 4 different patrons

18. In your shell, run the script

misc/cronjobs/recalls/convert_reserves_to_recalls.pl -v --min 1

19. Confirm all reserves have been converted to recalls and allocated an
item. The fourth reserve will have been allocated as a second recall to
the first item.

20. Select all of the recalls on the record and delete them.
21. Place 2 biblio-level recalls and 2 item-level recalls for 4
different patrons, in any order

22. In your shell, run the script

misc/cronjobs/recalls/convert_reserves_to_recalls.pl -v --min 1

23. Confirm all reserves have been converted to recalls and allocated an
item. The item-level reserves should have been allocated to their
intended item. The biblio-level reserves should have been allocated to
the other items.

Sponsored-by: Auckland University of Technology
Comment 3 Aleisha Amohia 2023-10-12 22:39:11 UTC
Created attachment 157004 [details] [review]
Bug 32776: Add ConvertSelectedReservesToRecalls system preference
Comment 4 Aleisha Amohia 2023-10-12 22:39:14 UTC
Created attachment 157005 [details] [review]
Bug 32776: Select reserves to convert using new syspref

This patchset enhances the convert_reserves_to_recalls.pl cronjob by
allowing libraries to be more specific about which reserves should be
converted to recalls.

The new ConvertSelectedReservesToRecalls adds the flexibility to choose:
- the oldest placed reserve to be converted to a recall
- each reserve will be converted, one by one, until all recallable items
are recalled

When reserves are converted to recalls, they will be allocated a
specific item and become an item-level recall. This is so recallable
items can be allocated one by one.

To test:

1. Apply Bug 31415 and configure recalls
2. Apply these patches and update database
3. Create a biblio with 3 items
4. Check out all 3 items to 3 different patrons
5. Place 4 biblio-level reserves for 4 different patrons
6. Set the ConvertSelectedReservesToRecalls system preference to
'oldest'
7. In your shell, run the script

misc/cronjobs/recalls/convert_reserves_to_recalls.pl -v --min 1

8. Confirm there is now 1 recall and 3 biblio-level reserves on the
record
9. Confirm the recall has been allocated to one item (there should be a
barcode next to the title in the recalls table)

10. In your shell, run the script

misc/cronjobs/recalls/convert_reserves_to_recalls.pl -v --min 1

11. Confirm there are now 2 recalls and 2 biblio-level reserves on the
record
12. Confirm the second recall was allocated to the second item. NOT the
same item as the first recall.

13. In your shell, run the script twice

misc/cronjobs/recalls/convert_reserves_to_recalls.pl -v --min 1
misc/cronjobs/recalls/convert_reserves_to_recalls.pl -v --min 1

14. Confirm there is still one reserve remaining that can't be converted
because all recallable items are already recalled.

15. Set the ConvertSelectedReservesToRecalls system preference to
'recallable'
16. Select all of the recalls on the record and delete them
17. Place 4 biblio-level reserves for 4 different patrons

18. In your shell, run the script

misc/cronjobs/recalls/convert_reserves_to_recalls.pl -v --min 1

19. Confirm all reserves have been converted to recalls and allocated an
item. The fourth reserve will have been allocated as a second recall to
the first item.

20. Select all of the recalls on the record and delete them.
21. Place 2 biblio-level recalls and 2 item-level recalls for 4
different patrons, in any order

22. In your shell, run the script

misc/cronjobs/recalls/convert_reserves_to_recalls.pl -v --min 1

23. Confirm all reserves have been converted to recalls and allocated an
item. The item-level reserves should have been allocated to their
intended item. The biblio-level reserves should have been allocated to
the other items.

Sponsored-by: Auckland University of Technology
Comment 5 Aleisha Amohia 2023-10-12 22:39:16 UTC
Created attachment 157006 [details] [review]
Bug 32776: Terminology: Reserves to Holds

The syspref is now called ConvertSelectedHoldsToRecalls

The script is now called misc/cronjobs/recalls/convert_holds_to_recalls.pl
Comment 6 Aleisha Amohia 2023-10-12 22:40:14 UTC
Created attachment 157007 [details] [review]
Bug 32776: Terminology: Reserves to Holds

The syspref is now called ConvertSelectedHoldsToRecalls

The script is now called misc/cronjobs/recalls/convert_holds_to_recalls.pl
Comment 7 Aleisha Amohia 2023-10-16 00:52:07 UTC
Created attachment 157178 [details] [review]
Bug 32776: Terminology: Reserves to Holds

The syspref is now called ConvertSelectedHoldsToRecalls

The script is now called misc/cronjobs/recalls/convert_holds_to_recalls.pl
Comment 8 Aleisha Amohia 2023-10-27 01:03:13 UTC
Created attachment 157966 [details] [review]
Bug 32776: Terminology: Reserves to Holds

The syspref is now called ConvertSelectedHoldsToRecalls

The script is now called misc/cronjobs/recalls/convert_holds_to_recalls.pl
Comment 9 David Nind 2023-10-28 21:48:16 UTC
Created attachment 158015 [details]
Screenshots - Before and after for step 23

I have tested (using koha-testing-docker).

For me, it looks like steps 19 and 23 in the test plan aren't working as expected.

For both steps, I had to run the script twice. The first time three holds were converted to recalls, and when run again the fourth hold was converted.

I'm also not sure how it works with having multiple recalls requested for the same item by different patrons. Who gets the recall when it is returned and checked in? What happens to the other recall?

Setup
~~~~~

Recall rules:
- Recalls allowed (total): 5
- Recalls per record (count): 5 
- On shelf recalls allowed: If any unavailable
- Recall due date interval (day): 5
- Recall overdue fine amount: 5.00
- Recall pickup period (day): 5

Record used, people used for checking out and recall requests:
- For Programming Perl (biblionumber=262) I added two more items, so that there are three in total
- I checked out the items to Lisa Charles, Henry Acevedo, and Mary Burton
- I placed record level holds for Edna Acosta, Bobbie Middleton, Jordan Alford, and Pamela Bennett

System preferences:
- ConvertedSelectedHoldsToRecalls =  one hold for each item available to be recalled
- RecallsInterface = both the OPAC and the staff interface
- RecallsMaxPickUpDelay = 7
- UseRecalls = Use
- RecallsLog = Log

Step 19
~~~~~~~

I got the same results as for step 14 - three recalls requested, one hold remaining

Output from running the script ONCE:

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.
1. Hold converted to recall (reserve_id: 8, biblionumber: 262).
No reserves HOLD_CANCELLATION letter transported by email at /kohadevbox/koha/C4/Letters.pm line 588.
2. Hold converted to recall (reserve_id: 9, biblionumber: 262).
No reserves HOLD_CANCELLATION letter transported by email at /kohadevbox/koha/C4/Letters.pm line 588.
3. Hold converted to recall (reserve_id: 10, biblionumber: 262).

Output from running the script again:

kohadev-koha@kohadevbox:koha(bz32776)$ 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.
1. Hold converted to recall (reserve_id: 11, biblionumber: 262).


Step 23
~~~~~~~

I've attached some screenshots with the before and after results.

Setup similar to step 19 - additional details:

- Items checked out:
  . 987654321 - Checked out to Lisa Charles, item level hold by Jordan Alfred
  . 123456789 - Checked out to Henry Acevedo, item level hold by Pamela Bennett
  . 39999000011418 - Checked out to Mary Burton

- Holds, in priority order:
  1. Next available - Edna Acosta
  2. Next available - Bobbie Middleton
  3. Item 987654321 - Jordan Alfred
  4. Item 123456789 - Pamela Bennet

Results from running the script ONCE - I don't think that is the expected result, but I'm not sure:
1. Holdings table - three holds converted to recalls: 
    . 987654321 - Checked out to Lisa Charles, recalled by Bobbie Middleton (recall on patron record)
    . 123456789 - Checked out to Henry Acevedo, item level hold (no recall on patron record for Henry)
    . 39999000011418 - Checked out to Mary Burton, recalled by Edna Acosta (recall on patron record)
2. Holds tab - forth hold still showing as a hold (item-level hold by Pamela Bennett for 123456789) 
3. Recalls tab:
   . Edna Acosta - recall requested for 39999000011418
   . Bobbie Middleton - recall requested for 987654321 (patron record shows recall due to be returned - same date as Jordan Alford)
   . Jordan Alford - recall requested for 987654321 (patron record shows recall due to be returned - same date as for Bobbie Middleton)

Results from running the script again:
1. Holdings table - three holds converted to recalls: 
    . 987654321 - Checked out to Lisa Charles, recalled by Bobbie Middleton (recall on patron record) (NO CHANGE)
    . 123456789 - Checked out to Henry Acevedo, recalled by Pamella Bennett (recall on patron record for Henry) (CHANGED FROM ITEM LEVEL HOLD TO A RECALL)
    . 39999000011418 - Checked out to Mary Burton, recalled by Edna Acosta (recall on patron record) (NO CHANGE)
2. Holds tab - no holds 
3. Recalls tab:
   . Edna Acosta - recall requested for 39999000011418 (NO CHANGE)
   . Bobbie Middleton - recall requested for 987654321 (patron record shows recall due to be returned) (NO CHANGE)
   . Jordan Alford - recall requested for 987654321 (patron record shows recall due to be returned) (NO CHANGE)
   . Pamela Bennett - recall requested for 123456789 (patron record shows recall due to be returned) (ADDITIONAL RECALL)
Comment 10 Aleisha Amohia 2023-11-19 21:52:11 UTC
Created attachment 159125 [details] [review]
Bug 32776: Select reserves to convert using new syspref

This patchset enhances the convert_reserves_to_recalls.pl cronjob by
allowing libraries to be more specific about which reserves should be
converted to recalls.

The new ConvertSelectedReservesToRecalls adds the flexibility to choose:
- the oldest placed reserve to be converted to a recall
- each reserve will be converted, one by one, until all recallable items
are recalled

When reserves are converted to recalls, they will be allocated a
specific item and become an item-level recall. This is so recallable
items can be allocated one by one.

To test:

1. Apply Bug 31415 and configure recalls
2. Apply these patches and update database
3. Create a biblio with 3 items
4. Check out all 3 items to 3 different patrons
5. Place 4 biblio-level reserves for 4 different patrons
6. Set the ConvertSelectedReservesToRecalls system preference to
'oldest'
7. In your shell, run the script

misc/cronjobs/recalls/convert_reserves_to_recalls.pl -v --min 1

8. Confirm there is now 1 recall and 3 biblio-level reserves on the
record
9. Confirm the recall has been allocated to one item (there should be a
barcode next to the title in the recalls table)

10. In your shell, run the script

misc/cronjobs/recalls/convert_reserves_to_recalls.pl -v --min 1

11. Confirm there are now 2 recalls and 2 biblio-level reserves on the
record
12. Confirm the second recall was allocated to the second item. NOT the
same item as the first recall.

13. In your shell, run the script twice

misc/cronjobs/recalls/convert_reserves_to_recalls.pl -v --min 1
misc/cronjobs/recalls/convert_reserves_to_recalls.pl -v --min 1

14. Confirm there is still one reserve remaining that can't be converted
because all recallable items are already recalled.

15. Set the ConvertSelectedReservesToRecalls system preference to
'recallable'
16. Select all of the recalls on the record and delete them
17. Place 4 biblio-level reserves for 4 different patrons

18. In your shell, run the script

misc/cronjobs/recalls/convert_reserves_to_recalls.pl -v --min 1

19. Confirm all reserves have been converted to recalls and allocated an
item. The fourth reserve will have been allocated as a second recall to
the first item.

20. Select all of the recalls on the record and delete them.
21. Place 2 biblio-level recalls and 2 item-level recalls for 4
different patrons, in any order

22. In your shell, run the script

misc/cronjobs/recalls/convert_reserves_to_recalls.pl -v --min 1

23. Confirm all reserves have been converted to recalls and allocated an
item. The item-level reserves should have been allocated to their
intended item. The biblio-level reserves should have been allocated to
the other items.

Sponsored-by: Auckland University of Technology
Comment 11 Aleisha Amohia 2023-11-19 21:52:17 UTC
Created attachment 159126 [details] [review]
Bug 32776: Terminology: Reserves to Holds

The syspref is now called ConvertSelectedHoldsToRecalls

The script is now called misc/cronjobs/recalls/convert_holds_to_recalls.pl
Comment 12 Aleisha Amohia 2023-11-19 21:52:22 UTC
Created attachment 159127 [details] [review]
Bug 32776: Stop recalled items from being recalled by other holds being converted on same record
Comment 13 David Nind 2023-11-20 01:59:56 UTC
Hi Aleisha.

Things aren't working as expected:

1. In the staff interface, the system preference is now called ConvertedSelectedHoldsToRecalls, even though in the database it is ConvertSelectedHoldsToRecalls (Convert.. instead of Converted...)

2. In the third patch (Terminology: Reserves to Holds) it refers to'ConvertedSelectedHoldsToRecalls'.

I was only up to step 7 in the test plan, and I got this (the first hold wasn't converted):

misc/cronjobs/recalls/convert_holds_to_recalls.pl -v --min 1
Use of uninitialized value in string eq at misc/cronjobs/recalls/convert_holds_to_recalls.pl line 102.
Use of uninitialized value in string eq at misc/cronjobs/recalls/convert_holds_to_recalls.pl line 112.

David
Comment 14 Aleisha Amohia 2023-11-20 03:48:46 UTC
Setting to Failed QA so I know to come back to this later