From c19528e2e137e19b0aa9649bd93d5f6eefa8760a Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Thu, 31 May 2012 01:24:55 -0700 Subject: [PATCH] fix tax report under MySQL, RT#17856 --- FS/FS/cust_pkg.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 6899fa4cb..de535aadc 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -10,7 +10,7 @@ use List::Util qw(max); use Tie::IxHash; use Time::Local qw( timelocal timelocal_nocheck ); use MIME::Entity; -use FS::UID qw( getotaker dbh ); +use FS::UID qw( getotaker dbh driver_name ); use FS::Misc qw( send_email ); use FS::Record qw( qsearch qsearchs fields ); use FS::CurrentUser; @@ -3741,10 +3741,12 @@ sub _location_sql_where { my $or_empty_county = " OR ( ? = '' AND $table.${prefix}county IS NULL )"; my $or_empty_state = " OR ( ? = '' AND $table.${prefix}state IS NULL )"; + my $text = (driver_name =~ /^mysql/i) ? 'char' : 'text'; + # ( $table.${prefix}city = ? $or_empty_city $ornull ) " - ( $table.district = ? OR ? = '' OR CAST(? AS text) IS NULL ) - AND ( $table.${prefix}city = ? OR ? = '' OR CAST(? AS text) IS NULL ) + ( $table.district = ? OR ? = '' OR CAST(? AS $text) IS NULL ) + AND ( $table.${prefix}city = ? OR ? = '' OR CAST(? AS $text) IS NULL ) AND ( $table.${prefix}county = ? $or_empty_county $ornull ) AND ( $table.${prefix}state = ? $or_empty_state $ornull ) AND $table.${prefix}country = ? -- 2.11.0