From e0f50c628c0ceedc31ff7a0816e4be2cdc676b00 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Sun, 8 Jul 2018 00:44:49 +0000 Subject: [PATCH] Bug 19532 - Recalls for Course Reserves. This ptach fixes the 'Template process error Koha::Item->avail_for_recall' which is thrown when loading a Course pgae in opac-course-details.pl with course reserves which are currently issued. It also allows recalls to be placed from Course reserves Sponsored-By: Catalyst IT --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt | 2 +- opac/opac-course-details.pl | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt index 8d085b5..47b015d 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt @@ -74,7 +74,7 @@ [% AuthorisedValues.GetByCode( 'CCODE', cr.item.ccode ) %] [% cr.item.itemcallnumber %] [% cr.item.copynumber %] - [% INCLUDE 'item-status.inc' item=cr.item issue=cr.issue %] + [% INCLUDE 'item-status.inc' item=cr.course_item issue=cr.issue %] [% cr.issue.date_due | $KohaDates as_due_date => 1 %] [% IF ( cr.public_note ) %] [% cr.public_note %] diff --git a/opac/opac-course-details.pl b/opac/opac-course-details.pl index 3afa8a9..bc61196 100755 --- a/opac/opac-course-details.pl +++ b/opac/opac-course-details.pl @@ -46,6 +46,14 @@ die("No course_id given") unless ($course_id); my $course = GetCourse($course_id); my $course_reserves = GetCourseReserves( course_id => $course_id, include_items => 1, include_count => 1 ); +foreach my $cr (@$course_reserves) { + if ($cr->{'issue'}->{date_due} && $cr->{'isue'}->{borrowernumber} && $borrowernumber != $cr->{'issue'}->{borrowernumber} && C4::Context->preference('UseRecalls')) { + $cr->{'course_item'}->{avail_for_recall} = 1; + } else { + $cr->{'course_item'}->{avail_for_recall} = 0; + } +} + $template->param( course => $course, course_reserves => $course_reserves, -- 2.1.4