ffzg/recall_notices.pl: added --interval and --dedup
[koha.git] / opac / opac-downloadshelf.pl
index 51769c4..ac6e910 100755 (executable)
@@ -50,6 +50,13 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user (
     }
 );
 
+my $borcat = q{};
+if ( C4::Context->preference('OpacHiddenItemsExceptions') ) {
+    # we need to fetch the borrower info here, so we can pass the category
+    my $borrower = Koha::Patrons->find( { borrowernumber => $borrowernumber } );
+    $borcat = $borrower ? $borrower->categorycode : $borcat;
+}
+
 my $shelfnumber = $query->param('shelfnumber');
 my $format  = $query->param('format');
 my $context = $query->param('context');
@@ -81,7 +88,11 @@ if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) {
             while ( my $content = $contents->next ) {
                 my $biblionumber = $content->biblionumber;
 
-                my $record = GetMarcBiblio($biblionumber, 1);
+                my $record = GetMarcBiblio({
+                    biblionumber => $biblionumber,
+                    embed_items  => 1,
+                    opac         => 1,
+                    borcat       => $borcat });
                 my $framework = &GetFrameworkCode( $biblionumber );
                 $record_processor->options({
                     interface => 'opac',
@@ -129,7 +140,7 @@ if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) {
         } else {
             $template->param(fullpage => 1);
         }
-        $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]);
+        $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]);
         $template->param( shelf => $shelf );
         output_html_with_http_headers $query, $cookie, $template->output;
     }