Bug 30944 - Fix single cancel recall button in recalls tab in staff interface and correctly handle cancellations with branch transfers
Summary: Fix single cancel recall button in recalls tab in staff interface and correct...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low major (vote)
Assignee: Aleisha Amohia
QA Contact: Katrin Fischer
URL:
Keywords:
Depends on:
Blocks: 29734
  Show dependency treegraph
 
Reported: 2022-06-10 16:22 UTC by David Nind
Modified: 2023-12-28 20:42 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes the 'cancel' recall button in several places so that it now works as expected (including the recalls tab in a patron's details section, the recalls section for a record, and the circulation recalls queue and recalls to pull pages). It also ensures a correct cancellation reason is logged when cancelling a recall in transit.
Version(s) released in:
22.11.00, 22.05.08


Attachments
Bug 30944: Fix cancelling selected recalls from biblio recalls tab (1.14 KB, patch)
2022-08-11 05:31 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 30944: Fix cancel recalls actions (7.15 KB, patch)
2022-08-12 01:46 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 30944: Fix cancel recalls actions (7.16 KB, patch)
2022-09-11 19:54 UTC, David Nind
Details | Diff | Splinter Review
Bug 30944: Fix cancel recalls actions (7.22 KB, patch)
2022-10-02 10:52 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 30944: Undo change to ILS-DI documentation (2.02 KB, patch)
2022-10-02 10:52 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Nind 2022-06-10 16:22:25 UTC
Separated out from bug 30924 - cancel recalls action buttons don't seem to work:

1. Once a recall is made, and checked in: 
   a. On the staff interface item details page > recalls section - selecting from the Actions drop down list/button "Cancel recall and return to Centerville" does nothing. 
   b. However, selecting the tick box and selecting "Cancel selected recalls" works. 
   c. In addition, after you press "Cancel...":
     - the URL changes to http://127.0.0.1:8081/cgi-bin/koha/recalls/request.pl 
     - clicking on normal (or any other tab gives you the message "The record you requested does not exist ()." 
     - URL is http://127.0.0.1:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=
 
2. Once a recall is made, and checked in: 
   . From Circulation > Recalls > Recalls queue: same as 1a and 1b.

3. Once a recall is made, and checked in: 
   . From Circulation > Recalls > Recalls to pull: select "Cancel recall and return to: Centerville: generates this error:
   
   DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Data truncated for column 'reason' at row 1 at /kohadevbox/koha/Koha/Object.pm line 170
 at /usr/share/perl5/DBIx/Class/Exception.pm line 77
 .....

4. On the patron details > recalls tab page for Henry, selecting Actions > "Cancel recall and return to: Cenetrville" does nothing (same as 1a).

Setting up things to test/replicate:

1. Enable recalls: set UseRecalls system preference to 'Use'.
2. Setup rcalls circulation and fines rules:
  . Recalls allowed (total) = 5
  . Recalls per record (count) = 2
  . On shelf recalls allowed = 'If any unavailable'
  . Recall due date interval (day) = 3
  . Recall overdue fine amount = 5
  . Recall pickup period (day) = 2
3. Checkout an item to a patron:
   - Patron used: Mary Burton (Midway)
   - Record used: Programming Perl (biblionumber = 262, one item = 39999000011418, home library = Centerville)
4. Change username/password for a patron, login to the OPAC, and place a recall for the item in step 4.
   - Patron used: Henry Acevedo (Midway)
5. Check in item for recall with library set to Centerville - confirm recall and transfer.
Comment 1 Jonathan Druart 2022-06-16 09:13:22 UTC
(In reply to David Nind from comment #0)

>    c. In addition, after you press "Cancel...":
>      - the URL changes to
> http://127.0.0.1:8081/cgi-bin/koha/recalls/request.pl 
>      - clicking on normal (or any other tab gives you the message "The
> record you requested does not exist ()." 
>      - URL is
> http://127.0.0.1:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=

Can be fixed with:
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/request.tt
index 2f4a573cf8d..3fcc9d8ea9e 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/request.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/recalls/request.tt
@@ -29,6 +29,7 @@
         [% IF recalls.count %]
             <form method="post" action="/cgi-bin/koha/recalls/request.pl">
                 <input type="hidden" name="op" value="cancel_multiple_recalls">
+                <input type="hidden" name="biblionumber" value="[% biblio.biblionumber | html %]">
                 <input type="checkbox" id="select_all"> <span id="select_all_text">Select all</span>
                 [% INCLUDE 'recalls.inc' %]
                 <fieldset class="action">


> 3. Once a recall is made, and checked in: 
>    . From Circulation > Recalls > Recalls to pull: select "Cancel recall and
> return to: Centerville: generates this error:
>    
>    DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st
> execute failed: Data truncated for column 'reason' at row 1 at
> /kohadevbox/koha/Koha/Object.pm line 170
>  at /usr/share/perl5/DBIx/Class/Exception.pm line 77
>  .....

branchtransfers.cancellation_reason does not contain 'RecallCancellation' (but 'CancelRecall')
Comment 2 Jonathan Druart 2022-08-10 13:18:18 UTC
Aleisha, can you have a look at this bug please? See the previous comment.
Comment 3 Aleisha Amohia 2022-08-11 05:17:33 UTC
Taking a look now!
Comment 4 Aleisha Amohia 2022-08-11 05:31:39 UTC
Created attachment 139012 [details] [review]
Bug 30944: Fix cancelling selected recalls from biblio recalls tab

This is a WIP
Comment 5 Aleisha Amohia 2022-08-12 01:46:37 UTC
Created attachment 139034 [details] [review]
Bug 30944: Fix cancel recalls actions

This patch fixes the 'cancel selected recalls' button on the biblio
details Recalls page, and ensures a correct cancellation reason is
logged when cancelling a recall in transit.

To test:
1) Ensure UseRecalls is enabled and relevant recalls circulation rules
are set
2) Check out Item A to Patron B
3) Log into OPAC as Patron A
4) Search for Item A and place a recall
5) Go back to the staff interface and search for Item A. When viewing
the biblio record, go to the recalls tab.
6) Check the checkbox for your recall, and click the button to cancel
selected recalls.
7) Confirm your recall is successfully removed and you're redirected to
the correct recalls page for this biblio.
8) Go back to the OPAC and place a recall again. This time set the
pickup location to a different library, one that you're not logged in at
9) Back in the staff interface, check in Item A and confirm the recall
and transfer
10) Go to Circulation -> Recalls to pull. Your recall should show here.
Click the button to cancel the recall and revert the transfer
11) Confirm the recall has been cancelled
12) Go to Reports and create a new SQL report with the following SQL:
select * from branchtransfers b join items i on
b.itemnumber=i.itemnumber where i.barcode = <<barcode>>
13) Run the report and paste the barcode of Item A in the field
14) Confirm there are two rows returned - the transfer triggered when
the recall was confirmed, with a reason of 'Recall' and a cancellation
reason of 'RecallCancellation, and the transfer sending the item back
home when the recall was cancelled, with a reason of
'RecallCancellation'.

Sponsored-by: Catalyst IT
Comment 6 David Nind 2022-09-11 19:54:31 UTC
Created attachment 140411 [details] [review]
Bug 30944: Fix cancel recalls actions

This patch fixes the 'cancel selected recalls' button on the biblio
details Recalls page, and ensures a correct cancellation reason is
logged when cancelling a recall in transit.

To test:
1) Ensure UseRecalls is enabled and relevant recalls circulation rules
are set
2) Check out Item A to Patron B
3) Log into OPAC as Patron A
4) Search for Item A and place a recall
5) Go back to the staff interface and search for Item A. When viewing
the biblio record, go to the recalls tab.
6) Check the checkbox for your recall, and click the button to cancel
selected recalls.
7) Confirm your recall is successfully removed and you're redirected to
the correct recalls page for this biblio.
8) Go back to the OPAC and place a recall again. This time set the
pickup location to a different library, one that you're not logged in at
9) Back in the staff interface, check in Item A and confirm the recall
and transfer
10) Go to Circulation -> Recalls to pull. Your recall should show here.
Click the button to cancel the recall and revert the transfer
11) Confirm the recall has been cancelled
12) Go to Reports and create a new SQL report with the following SQL:
select * from branchtransfers b join items i on
b.itemnumber=i.itemnumber where i.barcode = <<barcode>>
13) Run the report and paste the barcode of Item A in the field
14) Confirm there are two rows returned - the transfer triggered when
the recall was confirmed, with a reason of 'Recall' and a cancellation
reason of 'RecallCancellation, and the transfer sending the item back
home when the recall was cancelled, with a reason of
'RecallCancellation'.

Sponsored-by: Catalyst IT

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 David Nind 2022-09-11 20:04:47 UTC
Testing notes (using koha-testing-docker):

- Setup recalls and replicate the issue as described in comment #1.

- Apply the patch and update the database (updatedatabase).

- Follow the test plan.
Comment 8 Katrin Fischer 2022-10-02 10:51:46 UTC
Ok, took a while to work through this, but now I think I got it:

* Bug 30924 added RecallCancellation to the branchtransfers.reason, but now we are also adding it to cancellation_reason. Makes sense.

* The changes to the ilsdi files are not correct. The listings refer to the service defined in the ILS-DI documentation. It is called CancelRecall and should remain like that. See: https://old.diglib.org/architectures/ilsdi/DLF_ILS_Discovery_1.0.pdf. I am providing a follow-up for this.

* I've run through the test plan without the change and didn't manage to create an entry to branchtransfers with CancelRecall so no more clean-up should be needed (it looked like the entries were not created properly at all)
Comment 9 Katrin Fischer 2022-10-02 10:52:52 UTC
Created attachment 141207 [details] [review]
Bug 30944: Fix cancel recalls actions

This patch fixes the 'cancel selected recalls' button on the biblio
details Recalls page, and ensures a correct cancellation reason is
logged when cancelling a recall in transit.

To test:
1) Ensure UseRecalls is enabled and relevant recalls circulation rules
are set
2) Check out Item A to Patron B
3) Log into OPAC as Patron A
4) Search for Item A and place a recall
5) Go back to the staff interface and search for Item A. When viewing
the biblio record, go to the recalls tab.
6) Check the checkbox for your recall, and click the button to cancel
selected recalls.
7) Confirm your recall is successfully removed and you're redirected to
the correct recalls page for this biblio.
8) Go back to the OPAC and place a recall again. This time set the
pickup location to a different library, one that you're not logged in at
9) Back in the staff interface, check in Item A and confirm the recall
and transfer
10) Go to Circulation -> Recalls to pull. Your recall should show here.
Click the button to cancel the recall and revert the transfer
11) Confirm the recall has been cancelled
12) Go to Reports and create a new SQL report with the following SQL:
select * from branchtransfers b join items i on
b.itemnumber=i.itemnumber where i.barcode = <<barcode>>
13) Run the report and paste the barcode of Item A in the field
14) Confirm there are two rows returned - the transfer triggered when
the recall was confirmed, with a reason of 'Recall' and a cancellation
reason of 'RecallCancellation, and the transfer sending the item back
home when the recall was cancelled, with a reason of
'RecallCancellation'.

Sponsored-by: Catalyst IT

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 10 Katrin Fischer 2022-10-02 10:52:56 UTC
Created attachment 141208 [details] [review]
Bug 30944: Undo change to ILS-DI documentation

The service not implemented by Koha is CancelRecall
as specified in:
https://old.diglib.org/architectures/ilsdi/DLF_ILS_Discovery_1.0.pdf

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 11 Tomás Cohen Arazi 2022-10-03 16:53:14 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 12 Lucas Gass 2022-12-05 16:34:26 UTC
Backported to 22.05.x for upcoming 22.05.08 release
Comment 13 Arthur Suzuki 2022-12-14 11:58:19 UTC
depends on recalls feature not present in 21.11. won't backport