use JSON rather than Storable for the OPAC search history cookie
[koha.git] / opac / opac-detail.pl
index bab4ff6..9d0851f 100755 (executable)
@@ -50,6 +50,7 @@ use List::MoreUtils qw/any none/;
 use C4::Images;
 use Koha::DateUtils;
 use C4::HTML5Media;
+use C4::CourseReserves qw(GetItemCourseReservesInfo);
 
 BEGIN {
        if (C4::Context->preference('BakerTaylorEnabled')) {
@@ -442,7 +443,10 @@ if ($hideitems) {
 }
 
 my $branches = GetBranches();
-my $branch = C4::Context->userenv->{branch};
+my $branch = '';
+if (C4::Context->userenv){
+    $branch = C4::Context->userenv->{branch};
+}
 if ( C4::Context->preference('HighlightOwnItemsOnOPAC') ) {
     if (
         ( ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'PatronBranch' ) && $branch )
@@ -1052,4 +1056,10 @@ if (C4::Context->preference('OpacHighlightedWords')) {
 }
 $template->{VARS}->{'trackclicks'} = C4::Context->preference('TrackClicks');
 
+if ( C4::Context->preference('UseCourseReserves') ) {
+    foreach my $i ( @items ) {
+        $i->{'course_reserves'} = GetItemCourseReservesInfo( itemnumber => $i->{'itemnumber'} );
+    }
+}
+
 output_html_with_http_headers $query, $cookie, $template->output;