[Koha-patches] [PATCH] (bug #3004) fix the opac authority search

Nahuel ANGELINETTI nahuel.angelinetti at biblibre.com
Wed Mar 4 15:42:01 CET 2009


This patch modify the way to transfer the different args, don't use the form arrays.
And use a GET form instead of POST(we are getting datas, sending nothing).
---
 .../prog/en/modules/opac-authorities-home.tmpl     |   35 +++++++++----------
 opac/opac-authorities-home.pl                      |   24 ++++++-------
 2 files changed, 28 insertions(+), 31 deletions(-)

diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-authorities-home.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-authorities-home.tmpl
index 8107665..9484b66 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-authorities-home.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-authorities-home.tmpl
@@ -9,7 +9,7 @@
 	<div id="yui-main">
 	<div class="yui-b"><div class="yui-g">
 <div class="container">
-<form name="f" action="/cgi-bin/koha/opac-authorities-home.pl" method="post">
+<form name="f" action="/cgi-bin/koha/opac-authorities-home.pl" method="get">
         <input type="hidden" name="op" value="do_search" />
         <input type="hidden" name="type" value="opac" />
         <input type="hidden" name="nbstatements" value="<!-- TMPL_VAR NAME="nbstatements" -->" />
@@ -24,40 +24,39 @@
                 <!-- /TMPL_LOOP -->
                 </select></li>           <li>
                 <label for="operatora">Main entry ($a only): </label>
-                <select name="operator" id="operatora">
+                <select name="operatora" id="operatora">
                     <option value="contains">contains</option>
                     <option value="start">starts with</option>
                     <option value="is">is exactly</option>
                 </select>
-                <input type="text" name="value" id="mainentrya_value" value="<!-- TMPL_VAR NAME="value" -->" />
-                <input type="hidden" name="marclist" value="mainmainentry" />
-                <input type="hidden" name="and_or" value="and" />
-                <input type="hidden" name="excluding" value="" />
+                <input type="text" name="valuea" id="mainentrya_value" value="<!-- TMPL_VAR NAME="value" -->" />
+                <input type="hidden" name="marclista" value="mainmainentry" />
+                <input type="hidden" name="and_ora" value="and" />
+                <input type="hidden" name="excludinga" value="" />
             </li>
             <li>
-                <label for="operator">Main entry: </label>
-                <select name="operator" id="operator">
+                <label for="operatorb">Main entry: </label>
+                <select name="operatorb" id="operator">
                     <option value="contains">contains</option>
                     <option value="start">starts with</option>
                     <option value="is">is exactly</option>
                 </select>
-                <input type="text" name="value" id="mainentry_value" value="<!-- TMPL_VAR NAME="value" -->" />
-                <input type="hidden" name="marclist" value="mainentry" />
-                <input type="hidden" name="and_or" value="and" />
-                <input type="hidden" name="excluding" value="" />
+                <input type="text" name="valueb" id="mainentry_value" value="<!-- TMPL_VAR NAME="value" -->" />
+                <input type="hidden" name="marclistb" value="mainentry" />
+                <input type="hidden" name="and_orb" value="and" />
+                <input type="hidden" name="excludingb" value="" />
             </li>
             <li>
                 <label for="anywhere">Anywhere: </label>
-                <select name="operator" id="anywhere">
+                <select name="operatorc" id="anywhere">
                     <option value="contains">contains</option>
                     <option value="start">starts with</option>
                     <option value="is">is exactly</option>
-
                 </select>
-                <input type="text" name="value" id="anywhere_value" value="<!-- TMPL_VAR NAME="value" -->" />
-                <input type="hidden" name="marclist" value="" />
-                <input type="hidden" name="and_or" value="and" />
-                <input type="hidden" name="excluding" value="" />
+                <input type="text" name="valuec" id="anywhere_value" value="<!-- TMPL_VAR NAME="value" -->" />
+                <input type="hidden" name="marclistc" value="" />
+                <input type="hidden" name="and_orc" value="and" />
+                <input type="hidden" name="excludingc" value="" />
             </li>
             <li><label for="orderby">Order by: </label><select name="orderby" id="orderby">
                 <option value="">None</option>
diff --git a/opac/opac-authorities-home.pl b/opac/opac-authorities-home.pl
index 06ad711..764af2a 100755
--- a/opac/opac-authorities-home.pl
+++ b/opac/opac-authorities-home.pl
@@ -55,12 +55,12 @@ foreach my $thisauthtype ( sort { $authtypes->{$a}{'authtypetext'} cmp $authtype
 }
 
 if ( $op eq "do_search" ) {
-    my @marclist = $query->param('marclist');
-    my @and_or = $query->param('and_or');
-    my @excluding = $query->param('excluding');
-    my @operator = $query->param('operator');
+    my @marclist = ($query->param('marclista'),$query->param('marclistb'),$query->param('marclistc'));
+    my @and_or = ($query->param('and_ora'),$query->param('and_orb'),$query->param('and_orc'));
+    my @excluding = ($query->param('excludinga'),$query->param('excludingb'),$query->param('excludingc'),);
+    my @operator = ($query->param('operatora'),$query->param('operatorb'),$query->param('operatorc'));
     my $orderby = $query->param('orderby');
-    my @value = $query->param('value');
+    my @value = ($query->param('valuea'),$query->param('valueb'),$query->param('valuec'),);
 
     $resultsperpage = $query->param('resultsperpage');
     $resultsperpage = 20 if ( !defined $resultsperpage );
@@ -88,14 +88,12 @@ if ( $op eq "do_search" ) {
 
     my @field_data = ();
 
-# we must get parameters once again. Because if there is a mainentry, it has been replaced by something else during the search, thus the links next/previous would not work anymore
-    my @marclist_ini = $query->param('marclist');
-    for ( my $i = 0 ; $i <= $#marclist ; $i++ ) {
-        push @field_data, { term => "marclist",  val => $marclist_ini[$i] };
-        push @field_data, { term => "and_or",    val => $and_or[$i] };
-        push @field_data, { term => "excluding", val => $excluding[$i] };
-        push @field_data, { term => "operator",  val => $operator[$i] };
-        push @field_data, { term => "value",     val => $value[$i] };
+    foreach my $letter (qw/a b c/){
+        push @field_data, { term => "marclist$letter" , val => $query->param("marclist$letter")};
+        push @field_data, { term => "and_or$letter" , val => $query->param("and_or$letter")};
+        push @field_data, { term => "excluding$letter" , val => $query->param("excluding$letter")};
+        push @field_data, { term => "operator$letter" , val => $query->param("operator$letter")};
+        push @field_data, { term => "value$letter" , val => $query->param("value$letter")};
     }
 
     my @numbers = ();
-- 
1.5.6.3




More information about the Koha-patches mailing list