From: ivan Date: Tue, 17 Nov 2009 22:06:51 +0000 (+0000) Subject: do a case-insensive search on browser-remembered results, so starting to use USPS... X-Git-Tag: root_of_svc_elec_features~676 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=012d0eb8b78e68b1c3ea8da6af659ade6a976351 do a case-insensive search on browser-remembered results, so starting to use USPS verification (which UPPERCASES everything) doesn't invalidate everything your browser remembered in quick payment entry --- diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 5d4e47ee7..3c4eb4422 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -8810,17 +8810,21 @@ sub smart_search { # "Company (Last, First)" #this is probably something a browser remembered, - #so just do an exact (but case-insensitive) search + #so just do an exact search (but case-insensitive, so USPS standardization + #doesn't throw a wrench in the works) foreach my $prefix ( '', 'ship_' ) { push @cust_main, qsearch( { 'table' => 'cust_main', - 'hashref' => { $prefix.'first' => $first, - $prefix.'last' => $last, - $prefix.'company' => $company, - %options, - }, - 'extra_sql' => " AND $agentnums_sql", + 'hashref' => { %options }, + 'extra_sql' => + ( keys(%options) ? ' AND ' : ' WHERE ' ). + join(' AND ', + " LOWER(${prefix}first) = ". dbh->quote(lc($first)), + " LOWER(${prefix}last) = ". dbh->quote(lc($last)), + " LOWER(${prefix}company) = ". dbh->quote(lc($company)), + $agentnums_sql, + ), } ); }