Bug 9044: Provide item selection in record detail page (staff client)
[koha.git] / catalogue / detail.pl
index ab1df8a..60ac611 100755 (executable)
@@ -49,7 +49,7 @@ my $query = CGI->new();
 
 my $analyze = $query->param('analyze');
 
-my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
+my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user(
     {
     template_name   =>  'catalogue/detail.tmpl',
         query           => $query,
@@ -360,6 +360,7 @@ $template->param(
     subscriptions       => \@subs,
     subscriptionsnumber => $subscriptionsnumber,
     subscriptiontitle   => $dat->{title},
+    searchid            => $query->param('searchid'),
 );
 
 # $debug and $template->param(debug_display => 1);
@@ -410,5 +411,23 @@ if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->pref
 
 my ( $holdcount, $holds ) = C4::Reserves::GetReservesFromBiblionumber($biblionumber,1);
 $template->param( holdcount => $holdcount, holds => $holds );
+my $StaffDetailItemSelection = C4::Context->preference('StaffDetailItemSelection');
+if ($StaffDetailItemSelection) {
+    # Only enable item selection if user can execute at least one action
+    if (
+        $flags->{superlibrarian}
+        || (
+            ref $flags->{tools} eq 'HASH' && (
+                $flags->{tools}->{items_batchmod}       # Modify selected items
+                || $flags->{tools}->{items_batchdel}    # Delete selected items
+            )
+        )
+        || ( ref $flags->{tools} eq '' && $flags->{tools} )
+      )
+    {
+        $template->param(
+            StaffDetailItemSelection => $StaffDetailItemSelection );
+    }
+}
 
 output_html_with_http_headers $query, $cookie, $template->output;