Bug 15451: Koha::CsvProfiles - Remove GetCsvProfilesLoop
[srvgit] / opac / opac-shelves.pl
index ef418e0..54d93a1 100755 (executable)
@@ -90,11 +90,11 @@ if ( $op eq 'add_form' ) {
             push @messages, { type => 'error', code => 'error_on_insert' };
         } else {
             push @messages, { type => 'message', code => 'success_on_insert' };
-            $op = $referer;
+            $op = 'view';
         }
     } else {
         push @messages, { type => 'error', code => 'unauthorized_on_insert' };
-        $op = $referer;
+        $op = 'list';
     }
 } elsif ( $op eq 'edit' ) {
     $shelfnumber = $query->param('shelfnumber');
@@ -188,7 +188,7 @@ if ( $op eq 'add_form' ) {
 } elsif ( $op eq 'remove_biblios' ) {
     $shelfnumber = $query->param('shelfnumber');
     $shelf = Koha::Virtualshelves->find($shelfnumber);
-    my @biblionumber = $query->param('biblionumber');
+    my @biblionumber = $query->multi_param('biblionumber');
     if ($shelf) {
         if ( $shelf->can_biblios_be_removed( $loggedinuser ) ) {
             my $number_of_biblios_removed = eval {
@@ -248,18 +248,24 @@ if ( $op eq 'view' ) {
 
             my $borrower = GetMember( borrowernumber => $loggedinuser );
 
+            # Lists display falls back to search results configuration
+            my $xslfile = C4::Context->preference('OPACXSLTListsDisplay');
+            my $lang   = $xslfile ? C4::Languages::getlanguage()  : undef;
+            my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef;
+
             my @items;
             while ( my $content = $contents->next ) {
-                my $this_item;
                 my $biblionumber = $content->biblionumber->biblionumber;
+                my $this_item    = GetBiblioData($biblionumber);
                 my $record       = GetMarcBiblio($biblionumber);
 
-                if ( C4::Context->preference("OPACXSLTResultsDisplay") ) {
-                    $this_item->{XSLTBloc} = XSLTParse4Display( $biblionumber, $record, "OPACXSLTResultsDisplay" );
+                if ( $xslfile ) {
+                    $this_item->{XSLTBloc} = XSLTParse4Display( $biblionumber, $record, "OPACXSLTListsDisplay",
+                                                                1, undef, $sysxml, $xslfile, $lang);
                 }
 
                 my $marcflavour = C4::Context->preference("marcflavour");
-                my $itemtypeinfo = getitemtypeinfo( $content->biblionumber->biblioitems->first->itemtype, 'intranet' );
+                my $itemtypeinfo = getitemtypeinfo( $content->biblionumber->biblioitems->first->itemtype, 'opac' );
                 $this_item->{imageurl}          = $itemtypeinfo->{imageurl};
                 $this_item->{description}       = $itemtypeinfo->{description};
                 $this_item->{notforloan}        = $itemtypeinfo->{notforloan};
@@ -355,7 +361,7 @@ $template->param(
     shelf    => $shelf,
     messages => \@messages,
     category => $category,
-    print    => $query->param('print') || 0,
+    print    => scalar $query->param('print') || 0,
     listsview => 1,
 );