summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2009-11-17 22:06:59 +0000
committerivan <ivan>2009-11-17 22:06:59 +0000
commitfa08d042e5954b520bb9000c706748f8859502b0 (patch)
tree213cc2234affd0768ee108d90f814ea236743b84
parente9cefec48652035f9e7fe3b7de47c21a369c38d0 (diff)
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
-rw-r--r--FS/FS/cust_main.pm18
1 files changed, 11 insertions, 7 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 1d1df5e09..ae8506bd9 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -8684,17 +8684,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,
+ ),
} );
}