Bug 17142 - Don't show library group selection in advanced search if groups are not...
[srvgit] / virtualshelves / shelves.pl
index 1278305..100af44 100755 (executable)
@@ -21,12 +21,13 @@ use Modern::Perl;
 use CGI qw ( -utf8 );
 use C4::Auth;
 use C4::Biblio;
-use C4::Csv;
 use C4::Koha;
 use C4::Items;
 use C4::Members;
 use C4::Output;
 use C4::XSLT;
+
+use Koha::CsvProfiles;
 use Koha::Virtualshelves;
 
 my $query = new CGI;
@@ -215,18 +216,24 @@ if ( $op eq 'view' ) {
 
             my $borrower = GetMember( borrowernumber => $loggedinuser );
 
+            my $xslfile = C4::Context->preference('XSLTListsDisplay');
+            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 $record       = GetMarcBiblio($biblionumber);
 
-                if ( C4::Context->preference("XSLTResultsDisplay") ) {
-                    $this_item->{XSLTBloc} = XSLTParse4Display( $biblionumber, $record, "XSLTResultsDisplay" );
+                if ( $xslfile ) {
+                    $this_item->{XSLTBloc} = XSLTParse4Display( $biblionumber, $record, "XSLTListsDisplay",
+                                                                1, undef, $sysxml, $xslfile, $lang);
                 }
 
                 my $marcflavour = C4::Context->preference("marcflavour");
                 my $itemtypeinfo = getitemtypeinfo( $content->biblionumber->biblioitems->first->itemtype, 'intranet' );
+                $this_item->{title}             = $content->biblionumber->title;
                 $this_item->{author}            = $content->biblionumber->author;
                 $this_item->{dateadded}         = $content->dateadded;
                 $this_item->{imageurl}          = $itemtypeinfo->{imageurl};
@@ -303,7 +310,7 @@ $template->param(
     messages => \@messages,
     category => $category,
     print    => scalar $query->param('print') || 0,
-    csv_profiles => GetCsvProfilesLoop('marc'),
+    csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ],
 );
 
 output_html_with_http_headers $query, $cookie, $template->output;