summaryrefslogtreecommitdiff
path: root/FS/FS/cust_location.pm
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2012-05-31 01:30:24 -0700
committerIvan Kohler <ivan@freeside.biz>2012-05-31 01:30:24 -0700
commit4daa22e234bec170832b893cc8d038e9d2aca6ea (patch)
treebae315ecf2824b84bfcc2dfc1e631c3732f3c7c3 /FS/FS/cust_location.pm
parentc19528e2e137e19b0aa9649bd93d5f6eefa8760a (diff)
fix tax report under MySQL, RT#17856
Diffstat (limited to 'FS/FS/cust_location.pm')
-rw-r--r--FS/FS/cust_location.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/FS/FS/cust_location.pm b/FS/FS/cust_location.pm
index 1f07aa8..2810dc9 100644
--- a/FS/FS/cust_location.pm
+++ b/FS/FS/cust_location.pm
@@ -4,7 +4,7 @@ use base qw( FS::geocode_Mixin FS::Record );
use strict;
use vars qw( $import );
use Locale::Country;
-use FS::UID qw( dbh );
+use FS::UID qw( dbh driver_name );
use FS::Record qw( qsearch ); #qsearchs );
use FS::Conf;
use FS::prospect_main;
@@ -507,9 +507,11 @@ sub in_county_sql {
('state') x $x,
'country');
+ my $text = (driver_name =~ /^mysql/i) ? 'char' : 'text';
+
my @where = (
- "cust_location.district = ? OR ? = '' OR CAST(? AS text) IS NULL",
- "cust_location.city = ? OR ? = '' OR CAST(? AS text) IS NULL",
+ "cust_location.district = ? OR ? = '' OR CAST(? AS $text) IS NULL",
+ "cust_location.city = ? OR ? = '' OR CAST(? AS $text) IS NULL",
"cust_location.county = ? OR (? = '' AND cust_location.county IS NULL) $ornull",
"cust_location.state = ? OR (? = '' AND cust_location.state IS NULL ) $ornull",
"cust_location.country = ?"