Bug 19388

Summary: Error in course details on OPAC if an item is checked-out
Product: Koha Reporter: Marijana Glavica <mglavica>
Component: Course reservesAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: critical    
Priority: P5 - low CC: caroline.cyr-la-rose, fridolin.somers, jonathan.druart, m.de.rooy
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 18276    
Bug Blocks:    
Attachments: Bug 19388: FIX display item status if item is checked out
Bug 18856 - Cancel Waiting Hold in OPAC does not give useful message
Bug 19388: FIX display item status if item is checked out

Description Marijana Glavica 2017-09-29 12:07:58 UTC
In course reserves, if an item which was added to a course is checked out, it is not possible to show details for that course on OPAC. 
The error says: "Template process failed: undef error - The method onsite_checkout is not covered by tests! at /home/koha/src/C4/Templates.pm line 121."
Comment 1 Jonathan Druart 2017-09-29 14:52:53 UTC
Created attachment 67475 [details] [review]
Bug 19388: FIX display item status if item is checked out

In course reserves, if an item which was added to a course is checked
out, it is not possible to show details for that course on OPAC.
The error says: "Template process failed: undef error - The method
onsite_checkout is not covered by tests! at
/home/koha/src/C4/Templates.pm line 121."

onsite_checkout is an attribute of Koha::Checkout, not Koha::Item

Test plan:
Create a course with 2 items that are checked out (standard and on-site)
At the OPAC, add them to your cart and confirm the status of these 2
items is correct
Confirm that on the detail page of the bib record as well as the detail
of the course.
Comment 2 Jonathan Druart 2017-09-29 14:54:15 UTC
Looks like it has been caused by bug 18276.
Comment 3 Caroline Cyr La Rose 2017-09-29 17:51:49 UTC
I tested and it worked. I was able to see the course details.
Comment 4 Caroline Cyr La Rose 2017-09-29 19:14:31 UTC
Created attachment 67485 [details] [review]
Bug 18856 - Cancel Waiting Hold in OPAC does not give useful message

If a hold is 'waiting' for the patron to collect then the patron should be prevented from cancelling the hold via their account in the opac.
If a patron tries to cancel the hold, Koha will give an 'are you sure' alert and when you click Yes the page just refreshes and the hold remains.
Staff can cancel the hold from the staff interface but they can then action the waiting hold.
I think therefore that it is correct behaviour that a patron cannot cancel a hold when it reaches waiting state via the opac but it would be useful to either have a warning to prevent the cancellation or a useful message when they attempt to do so.

The template was using a method that tells Koha if *staff* can cancel a hold,
instead of patron.

Test Plan:
1) Set up a waiting hold
2) Try to cancel it from the opac
3) Note you cannot
4) Apply this patch
5) Reload the page
6) Note the cancel button has disappeared for found holds

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Comment 5 Jonathan Druart 2017-10-04 16:23:55 UTC
Lowering severity, it does not impact stable releases.
Comment 6 Marcel de Rooy 2017-10-06 07:13:18 UTC
Comment on attachment 67485 [details] [review]
Bug 18856 - Cancel Waiting Hold in OPAC does not give useful message

This patch does not belong here
Comment 7 Marcel de Rooy 2017-10-06 07:46:10 UTC
Created attachment 67676 [details] [review]
Bug 19388: FIX display item status if item is checked out

In course reserves, if an item which was added to a course is checked
out, it is not possible to show details for that course on OPAC.
The error says: "Template process failed: undef error - The method
onsite_checkout is not covered by tests! at
/home/koha/src/C4/Templates.pm line 121."

onsite_checkout is an attribute of Koha::Checkout, not Koha::Item

Test plan:
Create a course with 2 items that are checked out (standard and on-site)
At the OPAC, add them to your cart and confirm the status of these 2
items is correct
Confirm that on the detail page of the bib record as well as the detail
of the course.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 8 Jonathan Druart 2017-10-06 15:19:46 UTC
Pushed to master for 17.11, thanks to everybody involved!
Comment 9 Fridolin Somers 2017-10-17 07:29:38 UTC
Depends on Bug 18276 that is not in 17.05.x