trim leading & trailing whitespace from service searches
[freeside.git] / httemplate / search / cust_svc.html
index 568b43b..127e7ab 100644 (file)
@@ -39,6 +39,7 @@ my $orderby = 'ORDER BY svcnum'; #has to be ordered by something
 if ( length( $cgi->param('search_svc') ) ) {
 
   my $string = $cgi->param('search_svc');
+  $string =~ s/(^\s+|\s+$)//; #trim leading & trailing whitespace
 
   # implement fuzzy searching in subclasses too at some point?
   # service searching maybe shouldn't be fuzzy...
@@ -106,5 +107,18 @@ my $link = sub {
     #'part_svc' => $cust_svc->part_svc,
     'svcdb'    => $cust_svc->svcdb, #we have it from the joined search
     #'svc'      => $cust_svc, #redundant
-    'query'     => 'svcnum=',
+    'query'     => '',
   );
+  [ $url, 'svcnum' ];
+};
+
+my $link_cust = sub {
+  my $cust_svc = shift;
+  if ( $cust_svc->custnum ) {
+    [ "${p}view/cust_main.cgi?", 'custnum' ];
+  } else {
+    '';
+  }
+};
+
+</%init>