(bug #3398) fix unimarc 210c plugin
authorNahuel ANGELINETTI <nahuel.angelinetti@biblibre.com>
Wed, 15 Jul 2009 09:01:27 +0000 (11:01 +0200)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Wed, 16 Sep 2009 21:19:19 +0000 (23:19 +0200)
this add some args to SearchAuthority();
Fix the pagination, and fix javascript script.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Signed-off-by: Henri-Damien LAURENT <henridamien.laurent@biblibre.com>
cataloguing/value_builder/unimarc_field_210c.pl
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c.tmpl

index 27ced19..ffbf644 100755 (executable)
@@ -162,7 +162,8 @@ my ($input) = @_;
         my @excluding = $query->param('excluding');
         my @operator = $query->param('operator');
         my @value = $query->param('value');
-    
+        my $orderby   = $query->param('orderby');
+        
         $resultsperpage= $query->param('resultsperpage');
         $resultsperpage = 19 if(!defined $resultsperpage);
     
@@ -171,8 +172,8 @@ my ($input) = @_;
     
         my ($results,$total) = SearchAuthorities( \@tags,\@and_or,
                                             \@excluding, \@operator, \@value,
-                                            $startfrom*$resultsperpage, $resultsperpage,$authtypecode);# $orderby);
-    
+                                            $startfrom*$resultsperpage, $resultsperpage,$authtypecode, $orderby);
+                                            
         ($template, $loggedinuser, $cookie)
             = get_template_and_user({template_name => "cataloguing/value_builder/unimarc_field_210c.tmpl",
                     query => $query,
@@ -211,7 +212,7 @@ my ($input) = @_;
         } else {
             $to = (($startfrom+1)*$resultsperpage);
         }
-        my $link="../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_210c.pl&amp;authtypecode=EDITORS&and_or=and&operator=contains&".join("&",map {"value=".$_} @value)."&op=do_search&type=intranet&index=$index";
+        my $link="../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_210c.pl&amp;authtypecode=EDITORS&and_or=$and_or&amp;marclist=$marclist&amp;operator=$operator&amp;orderby=$orderby&amp;excluding=$excluding&amp;".join("&amp;",map {"value=".$_} @value)."&amp;op=do_search&amp;type=intranet&amp;index=$index";
         warn "$link ,".getnbpages($total, $resultsperpage);
         $template->param(result => $results) if $results;
         $template->param('index' => $query->param('index'));
index 4948ca3..8da1f39 100644 (file)
                     <input type="hidden" name="index" value="<!--TMPL_VAR Name="index"-->">
                     <input type="hidden" name="authtypecode" value="EDITORS">
                     <input type="hidden" name="q" value="<!-- TMPL_VAR NAME="index" -->">
+                    <input type="hidden" name="marclist" value="all" />
+                    <input type="hidden" name="and_or" value="and" />
+                    <input type="hidden" name="excluding" value="" />
+                                       <select name="orderby">
+                               <option value="">None</option>
+                               <option value="HeadingAsc" selected="selected">Heading A-Z</option>
+                               <option value="HeadingDsc">Heading Z-A</option>
+                               </select>
+                                       <select name="operator">
+                                   <option value="contains">contains</option>
+                                   <option value="start">starts with</option>
+                                   <option value="is">is exactly</option>
+                               </select>
+
                 </p>
                 <p>
                 <input type="submit" value="Start search" class="button authority">
@@ -53,7 +67,7 @@
                         <td><!-- TMPL_VAR NAME="summary" --></td>
                         <td><!-- TMPL_VAR NAME="used" --> times</td>
                         <td>
-                            <a href="javascript:report('<!-- TMPL_VAR NAME="index" -->','<!-- TMPL_VAR name="summary" ESCAPE=JS -->')"><img alt="choose" src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/arrow.gif" width="32" hspace="0" vspace="0" border="0"></a>
+                            <a href="javascript:report('<!-- TMPL_VAR name="summary" ESCAPE=JS -->')"><img alt="choose" src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/arrow.gif" width="32" hspace="0" vspace="0" border="0"></a>
                         </td>
                     </tr>
                 <!-- /TMPL_LOOP -->
 
 <script language="JavaScript" type="text/javascript">
 
-function report(index,summary)
+function report(summary)
 {    
-    var regexp= /(\d* -+ *)(.*)/;
+    var regexp= /--\s*(.*)/;
     var result=summary.match(regexp);
     var doc   = opener.document; 
-    var field = doc.getElementById(index);
+    var field = doc.getElementById('<!-- TMPL_VAR NAME="index" -->');
 
-    field.value = result[2];
+    field.value = result[1];
     self.close();
 }
 </script>