X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_location.pm;h=2810dc95730876c3690b1e0a9cc4d4baa06cf0d2;hb=eb9148f0ab9aac5e4f89824b7fab6bb9d648e688;hp=1f07aa87c75c6268e5c7dc9edf66b9662702af3f;hpb=01629c3c934f1f6fd2ab9de5f7638f671fd59791;p=freeside.git diff --git a/FS/FS/cust_location.pm b/FS/FS/cust_location.pm index 1f07aa87c..2810dc957 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 = ?"