From ea4d4e0aa5c054ae3ed0469279f5a82b1c847001 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 e77a9a2020..ff185c2980 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 @@ -78,7 +78,7 @@ [% INCLUDE 'item-status.inc' item=cr.item issue=cr.issue %] [% cr.issue.date_due | $KohaDates as_due_date => 1 | html %] [% IF ( cr.public_note ) %] - [% cr.public_note | html %] + [% cr.public_note | html %] [% ELSIF ( cr.item.itemnotes ) %] [% cr.item.itemnotes | html %] [% END %] diff --git a/opac/opac-course-details.pl b/opac/opac-course-details.pl index 3afa8a921a..bc611960a9 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.11.0