Bug 29609: Centralized code to build the link to a biblio detail page
[srvgit] / opac / opac-basket.pl
index a379713..18737d7 100755 (executable)
@@ -21,9 +21,7 @@ use CGI qw ( -utf8 );
 
 use C4::Koha;
 use C4::Biblio qw(
-    GetBiblioData
     GetFrameworkCode
-    GetMarcAuthors
     GetMarcBiblio
     GetMarcSeries
     GetMarcSubjects
@@ -79,9 +77,8 @@ my $rules = C4::Context->yaml_preference('OpacHiddenItems');
 foreach my $biblionumber ( @bibs ) {
     $template->param( biblionumber => $biblionumber );
 
-    my $dat              = &GetBiblioData($biblionumber);
-    next unless $dat;
-    my $biblio           = Koha::Biblios->find( $biblionumber );
+    my $biblio           = Koha::Biblios->find( $biblionumber ) or next;
+    my $dat              = $biblio->unblessed;
 
     # No filtering on the item records needed for the record itself
     # since the only reason item information is grabbed is because of branchcodes.
@@ -94,7 +91,7 @@ foreach my $biblionumber ( @bibs ) {
     $record_processor->process($record);
     next unless $record;
     my $marcnotesarray   = $biblio->get_marc_notes({ marcflavour => $marcflavour, opac => 1 });
-    my $marcauthorsarray = $biblio->get_authors_from_MARC;
+    my $marcauthorsarray = $biblio->get_marc_authors;
     my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
     my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
     my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
@@ -162,15 +159,6 @@ foreach my $biblionumber ( @bibs ) {
     $dat->{MARCURLS}    = $marcurlsarray;
     $dat->{HASAUTHORS}  = $hasauthors;
 
-    if ( C4::Context->preference("BiblioDefaultView") eq "normal" ) {
-        $dat->{dest} = "opac-detail.pl";
-    }
-    elsif ( C4::Context->preference("BiblioDefaultView") eq "marc" ) {
-        $dat->{dest} = "opac-MARCdetail.pl";
-    }
-    else {
-        $dat->{dest} = "opac-ISBDdetail.pl";
-    }
     push( @results, $dat );
 }
 
@@ -179,11 +167,8 @@ my $resultsarray = \@results;
 # my $itemsarray=\@items;
 
 $template->param(
-    csv_profiles => [
-        Koha::CsvProfiles->search(
-            { type => 'marc', used_for => 'export_records', staff_only => 0 }
-        )
-    ],
+    csv_profiles => Koha::CsvProfiles->search(
+        { type => 'marc', used_for => 'export_records', staff_only => 0 } ),
     bib_list => $bib_list,
     BIBLIO_RESULTS => $resultsarray,
 );