Bug 17094: Make Koha::Virtualshelf methods return Koha::Objects-based objects
[koha.git] / opac / opac-downloadshelf.pl
index 9f98d91..51769c4 100755 (executable)
@@ -53,7 +53,6 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user (
 my $shelfnumber = $query->param('shelfnumber');
 my $format  = $query->param('format');
 my $context = $query->param('context');
-my $dbh     = C4::Context->dbh;
 
 my $shelf = Koha::Virtualshelves->find( $shelfnumber );
 if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) {
@@ -71,7 +70,7 @@ if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) {
         if ($format =~ /^\d+$/) {
             my @biblios;
             while ( my $content = $contents->next ) {
-                push @biblios, $content->biblionumber->biblionumber;
+                push @biblios, $content->biblionumber;
             }
             $output = marc2csv(\@biblios, $format);
         # Other formats
@@ -80,9 +79,14 @@ if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) {
                 filters => 'ViewPolicy'
             });
             while ( my $content = $contents->next ) {
-                my $biblionumber = $content->biblionumber->biblionumber;
+                my $biblionumber = $content->biblionumber;
 
                 my $record = GetMarcBiblio($biblionumber, 1);
+                my $framework = &GetFrameworkCode( $biblionumber );
+                $record_processor->options({
+                    interface => 'opac',
+                    frameworkcode => $framework
+                });
                 $record_processor->process($record);
                 next unless $record;
 
@@ -96,7 +100,6 @@ if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) {
                     $output .= marc2bibtex($record, $biblionumber);
                 }
                 elsif ( $format eq 'isbd' ) {
-                    my $framework = GetFrameworkCode( $biblionumber );
                     $output   .= GetISBDView({
                         'record'    => $record,
                         'template'  => 'opac',