Bug 30924 - Fix recalls-related errors in transfers and cancelling actions
Summary: Fix recalls-related errors in transfers and cancelling actions
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Testopia
URL:
Keywords:
Depends on: 30907
Blocks: 29734
  Show dependency treegraph
 
Reported: 2022-06-07 23:26 UTC by David Nind
Modified: 2022-07-13 19:24 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00, 22.05.03


Attachments
Bug 30924: Fix transferstoreceive.pl explosion on recalls (1.62 KB, patch)
2022-06-09 14:18 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 30924: Add missing branchtransfers.reason value for recall cancellation (4.49 KB, patch)
2022-06-09 15:04 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 30924: DBIC update (1.71 KB, patch)
2022-06-09 15:04 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 30924: Fix transferstoreceive.pl explosion on recalls (1.67 KB, patch)
2022-06-10 16:07 UTC, David Nind
Details | Diff | Splinter Review
Bug 30924: Add missing branchtransfers.reason value for recall cancellation (4.53 KB, patch)
2022-06-10 16:07 UTC, David Nind
Details | Diff | Splinter Review
Bug 30924: DBIC update (1.76 KB, patch)
2022-06-10 16:07 UTC, David Nind
Details | Diff | Splinter Review
Bug 30924: Fix transferstoreceive.pl explosion on recalls (1.73 KB, patch)
2022-06-13 08:25 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 30924: Add missing branchtransfers.reason value for recall cancellation (4.60 KB, patch)
2022-06-13 08:25 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 30924: DBIC update (1.82 KB, patch)
2022-06-13 08:25 UTC, Martin Renvoize
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-07 23:26:17 UTC
I am getting several errors and issues when testing bug 30823 - BEFORE applying the patch.

I thought these were fixed with some of the recent recalls bugs that were pushed to master.

I'm not sure whether separate bugs are required, or just one to look at what is causing these. In the interim, I've created this bug.

Scenario/settings using koha-testing-docker (up-to-date with master):
- UseRecalls system preference: set to 'Use'.
- RecallsLog system preference: set to 'Log'.
- 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
- Patron B: Mary Burton (Midway)
- Patron A: Henry Acevedo (Midway)
- Record used to place recalls on: Programming Perl (biblionumber = 262, one item = 39999000011418, home library = Centerville)

TLDR:
- Log viewer: Error on log viewer for recalls once there is are logged recalls transactions
- Transfers for recalls: error on transfers to receive
- After check in and waiting for pickup: actions to cancel recall on several pages do not work

Error 1: Setup and place a recall - log viewer error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I get this error using the log viewer limited to the recalls module - recall placed, no other actions.

Template process failed: undef error - The method Koha::Recall->item_level_recall is not covered by tests!

Trace begun at /kohadevbox/koha/Koha/Object.pm line 875
Koha::Object::AUTOLOAD('Koha::Recall=HASH(0x55d076a68a48)') called at /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt line 379
eval {...} at /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt line 379
eval {...} at /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt line 409
eval {...} at /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt line 18
Template::Provider::__ANON__('Template::Context=HASH(0x55d074a2b5f0)') called at /usr/lib/x86_64-linux-gnu/perl5/5.32/Template/Document.pm line 163
eval {...} at /usr/lib/x86_64-linux-gnu/perl5/5.32/Template/Document.pm line 161
....

Error 2: Viewing the check out page > checkouts tab for Mary - after recall placed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

No checkouts are listed, sits on "Loading... you may continue scanning" in a floating box at the bottom of the page, with "Loading..." showing in the center of the table. Does not show other items checked out.

The details page > checkouts tab is the same.

Error 3: If a transfer is required
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Step 1: Check in the item (39999000011418) > Transfer to Midway required > Confirm recall and transfer.
- Mary: checkouts list is now displaying
- Henry: recalls tab showing "In transit to Midway"
- Circulation > Recalls > Recalls queue: showing "In transit to Midway"
- Circulation > Recalls > Recalls to pull: listed with button to "Cancel recall and return to: Centerville

Step 2: Transfer to Midway
- Change library to Midway
- Ciculation > Transfers > Transfers to receive: get this error:

Template process failed: undef error - The method Koha::Recall->borrowernumber is not covered by tests!

Trace begun at /kohadevbox/koha/Koha/Object.pm line 875
Koha::Object::AUTOLOAD('Koha::Recall=HASH(0x559d07b59d00)') called at /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt line 93
eval {...} at /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt line 93
eval {...} at /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt line 108
eval {...} at /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt line 112
eval {...} at /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt line 18
....

Step 3: Check in item (with library set to Midway)
- Modal window with "Recall at Midway + Confirm recall"
- Circulation > Recalls > Recalls awaiting pickup: listed
- Circulation > Transfers > Transfers to receive: no errors
- Record detail page in staff interface: showing as "Waiting at Midway since..."
- Henry: recalls tab on patron page for check out and details sections - shows as "Ready for pickup"
- Mary: nothing shown (as expected)

Step 4: Checkout item - works as expected, 

But wait, there's more!

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).
Comment 1 Fridolin Somers 2022-06-08 07:08:34 UTC
> Template process failed: undef error - The method Koha::Recall->item_level_recall is not covered by tests!
See Bug 30907
Comment 2 Tomás Cohen Arazi 2022-06-09 13:33:25 UTC
Error 1: Solved on bug 30907
Error 2: Solved on bug 30907
Comment 3 Tomás Cohen Arazi 2022-06-09 13:52:34 UTC
Working on Error 3.
Comment 4 Tomás Cohen Arazi 2022-06-09 14:18:47 UTC
Created attachment 135884 [details] [review]
Bug 30924: Fix transferstoreceive.pl explosion on recalls

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 5 Tomás Cohen Arazi 2022-06-09 15:04:42 UTC
Created attachment 135902 [details] [review]
Bug 30924: Add missing branchtransfers.reason value for recall cancellation

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 6 Tomás Cohen Arazi 2022-06-09 15:04:48 UTC
Created attachment 135903 [details] [review]
Bug 30924: DBIC update

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 7 Tomás Cohen Arazi 2022-06-09 15:06:40 UTC
David, you mention some workflow issues, besides explosions.

I dealt with explosions on the patches, please file specific bugs for the workflow issues you might encounter, and make sure Aleisha notices them, perhaps assign them to her.
Comment 8 David Nind 2022-06-10 16:07:10 UTC
Created attachment 135947 [details] [review]
Bug 30924: Fix transferstoreceive.pl explosion on recalls

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: David Nind <david@davidnind.com>
Comment 9 David Nind 2022-06-10 16:07:15 UTC
Created attachment 135948 [details] [review]
Bug 30924: Add missing branchtransfers.reason value for recall cancellation

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: David Nind <david@davidnind.com>
Comment 10 David Nind 2022-06-10 16:07:19 UTC
Created attachment 135949 [details] [review]
Bug 30924: DBIC update

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: David Nind <david@davidnind.com>
Comment 11 David Nind 2022-06-10 16:09:50 UTC
Testing notes (sing koha-testing-docker):

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.
6. Change library to Midway.
7. Go to Circulation > Transfers > Transfers to receive - error generated:

   Template process failed: undef error - The method Koha::Recall->borrowernumber is not covered by tests!
  
  Trace begun at /kohadevbox/koha/Koha/Object.pm line 875
  Koha::Object::AUTOLOAD('Koha::Recall=HASH(0x55da4737e158)') called at /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt line 93
  eval {...} at /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt line 93
  eval {...} at /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt line 108
  eval {...} at /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tt line 112
  ..

7. Apply patch, updatedatabase, dbic, flush_memcached, restart_all.
8. Refresh transfers to receive page - it should now display as expected without errors.
Comment 12 David Nind 2022-06-10 16:26:28 UTC
(In reply to Tomás Cohen Arazi from comment #7)
> David, you mention some workflow issues, besides explosions.
> 
> I dealt with explosions on the patches, please file specific bugs for the
> workflow issues you might encounter, and make sure Aleisha notices them,
> perhaps assign them to her.

Thanks Tomás!

I have created bug 30944 for the workflow issues - where the cancel action buttons don't appear to work.

David
Comment 13 Martin Renvoize 2022-06-13 08:25:45 UTC
Created attachment 135994 [details] [review]
Bug 30924: Fix transferstoreceive.pl explosion on recalls

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 14 Martin Renvoize 2022-06-13 08:25:49 UTC
Created attachment 135995 [details] [review]
Bug 30924: Add missing branchtransfers.reason value for recall cancellation

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 15 Martin Renvoize 2022-06-13 08:25:53 UTC
Created attachment 135996 [details] [review]
Bug 30924: DBIC update

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 16 Martin Renvoize 2022-06-13 08:27:09 UTC
Code all reads well, fix works and QA scripts are happy.

Passing QA

PS: Thanks for the test plan David, I was struggling to get it set up on my environment, your plan was very helpful.
Comment 17 Tomás Cohen Arazi 2022-06-13 13:38:44 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 18 Lucas Gass 2022-07-13 19:24:56 UTC
Backported to 22.05.x for 22.05.03