From: ivan Date: Thu, 13 Jun 2002 00:53:26 +0000 (+0000) Subject: search on customer number (Bug#422) X-Git-Tag: freeside_1_4_0_pre14~13 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=afe61aa1e4158a49ba67740d947a991e285d5fb1;ds=sidebyside search on customer number (Bug#422) --- diff --git a/httemplate/index.html b/httemplate/index.html index daa890728..8ce12569e 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -28,7 +28,8 @@
New Customer
-
Last name or all customers by last name
+
Customer # or all customers by customer number
+
Last name or all customers by last name
Company or all customers by company
Username or all accounts by username
Domain or all domains
diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index d9d4e657c..247cf8fd6 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -192,6 +192,8 @@ if ( $cgi->param('browse') @cust_main=(); $sortby = \*last_sort; + push @cust_main, @{&custnumsearch} + if $cgi->param('custnum_on') && $cgi->param('custnum_text'); push @cust_main, @{&cardsearch} if $cgi->param('card_on') && $cgi->param('card'); push @cust_main, @{&lastsearch} @@ -446,6 +448,16 @@ sub custnum_sort { $a->getfield('custnum') <=> $b->getfield('custnum'); } +sub custnumsearch { + + my $custnum = $cgi->param('custnum_text'); + $custnum =~ s/\D//g; + $custnum =~ /^(\d{1,23})$/ or eidiot "Illegal customer number\n"; + my $custnum = $1; + + [ qsearchs('cust_main', { 'custnum' => $custnum } ) ]; +} + sub cardsearch { my($card)=$cgi->param('card');