[Koha-patches] [PATCH] (bug #3720) new options on opac search

Nahuel ANGELINETTI nahuel.angelinetti at biblibre.com
Tue Oct 20 17:29:42 CEST 2009


this patch add a syspref to show or not the "notes" in opac search result.
---
 installer/data/mysql/updatedatabase30.pl           |    8 ++++++++
 .../opac-tmpl/prog/en/modules/opac-results.tmpl    |    4 +++-
 opac/opac-search.pl                                |    1 +
 3 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/installer/data/mysql/updatedatabase30.pl b/installer/data/mysql/updatedatabase30.pl
index 00fa2e7..0348ccf 100644
--- a/installer/data/mysql/updatedatabase30.pl
+++ b/installer/data/mysql/updatedatabase30.pl
@@ -598,6 +598,14 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }  
 
+$DBversion = "3.00.04.019";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("
+	INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('OPACRecordNotes','1','','If yes record\'s notes are shown in search results','YesNo');
+	");
+    SetVersion ($DBversion);
+}
+
 =item DropAllForeignKeys($table)
 
   Drop all foreign keys of the table $table
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl
index d7aba2f..ba8b0a6 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl
@@ -391,7 +391,9 @@ $("span.addto").html(param1);
                         <!-- TMPL_IF name="place" --><!-- TMPL_VAR name="place" --> <!-- /TMPL_IF --><!-- TMPL_IF name="publishercode" --><!-- TMPL_VAR name="publishercode" --><!-- /TMPL_IF --><!-- TMPL_IF name="publicationyear" --> <!-- TMPL_VAR name="publicationyear" -->
                     <!-- TMPL_ELSE --><!-- TMPL_IF name="copyrightdate" --> <!-- TMPL_VAR name="copyrightdate" --><!-- /TMPL_IF --><!-- /TMPL_IF -->
                         <!-- TMPL_IF name="pages" -->. <!-- TMPL_VAR name="pages" --><!-- /TMPL_IF -->
-                        <!-- TMPL_IF name="notes" -->, <!-- TMPL_VAR name="notes" --><!-- /TMPL_IF -->
+                        <!-- TMPL_IF NAME="OPACRecordNotes" -->
+                        	<!-- TMPL_IF name="notes" -->, <!-- TMPL_VAR name="notes" --><!-- /TMPL_IF -->
+                        <!-- /TMPL_IF -->
                         <!-- TMPL_IF name="size" --> <!-- TMPL_VAR name="size" --><!-- /TMPL_IF -->
                         <!-- TMPL_IF name="timestamp" --> <i>(modified on <!-- TMPL_VAR name="timestamp" -->)</i><!-- /TMPL_IF -->
                 </span>
diff --git a/opac/opac-search.pl b/opac/opac-search.pl
index 74f8fe5..9f5e694 100755
--- a/opac/opac-search.pl
+++ b/opac/opac-search.pl
@@ -470,6 +470,7 @@ for (my $i=0;$i<=@servers;$i++) {
             }
             $template->param(stopwords_removed => "@$stopwords_removed") if $stopwords_removed;
             $template->param(results_per_page =>  $results_per_page);
+            $template->param(OPACRecordNotes =>  C4::Context->preference("OPACRecordNotes"));
             $template->param(SEARCH_RESULTS => \@newresults,
                                 OPACItemsResultsDisplay => (C4::Context->preference("OPACItemsResultsDisplay") eq "itemdetails"?1:0),
                             );
-- 
1.6.0.4




More information about the Koha-patches mailing list