Bug 7392: Add system preference to define export options in OPAC
[koha.git] / opac / opac-MARCdetail.pl
index f408cd2..519791c 100755 (executable)
@@ -270,13 +270,25 @@ if(C4::Context->preference("ISBD")) {
        $template->param(ISBD => 1);
 }
 
+#Export options
+my $OpacExportOptions=C4::Context->preference("OpacExportOptions");
+my @export_options = split(/\|/,$OpacExportOptions);
+$template->{VARS}->{'export_options'} = \@export_options;
+
 #Search for title in links
+my $marcflavour  = C4::Context->preference("marcflavour");
+my $dat = TransformMarcToKoha( $dbh, $record );
+my $isbn = GetNormalizedISBN(undef,$record,$marcflavour);
+my $marccontrolnumber   = GetMarcControlnumber   ($record, $marcflavour);
+
 if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
-    $biblio->{author} ? $search_for_title =~ s/{AUTHOR}/$biblio->{author}/g : $search_for_title =~ s/{AUTHOR}//g;
-    $biblio->{title} =~ s/\/+$//; # remove trailing slash
-    $biblio->{title} =~ s/\s+$//; # remove trailing space
-    $biblio->{title} ? $search_for_title =~ s/{TITLE}/$biblio->{title}/g : $search_for_title =~ s/{TITLE}//g;
-    $biblio->{isbn} ? $search_for_title =~ s/{ISBN}/$biblio->{isbn}/g : $search_for_title =~ s/{ISBN}//g;
+    $dat->{author} ? $search_for_title =~ s/{AUTHOR}/$dat->{author}/g : $search_for_title =~ s/{AUTHOR}//g;
+    $dat->{title} =~ s/\/+$//; # remove trailing slash
+    $dat->{title} =~ s/\s+$//; # remove trailing space
+    $dat->{title} ? $search_for_title =~ s/{TITLE}/$dat->{title}/g : $search_for_title =~ s/{TITLE}//g;
+    $isbn ? $search_for_title =~ s/{ISBN}/$isbn/g : $search_for_title =~ s/{ISBN}//g;
+    $marccontrolnumber ? $search_for_title =~ s/{CONTROLNUMBER}/$marccontrolnumber/g : $search_for_title =~ s/{CONTROLNUMBER}//g;
+    $search_for_title =~ s/{BIBLIONUMBER}/$biblionumber/g;
  $template->param('OPACSearchForTitleIn' => $search_for_title);
 }