X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_location.pm;h=b86529b3df1de46cf3e4317fee3376b0fd51e2d5;hb=e513d7cb331d7c7d99d1ea7b5f0a5f8e08e0d725;hp=1f07aa87c75c6268e5c7dc9edf66b9662702af3f;hpb=01629c3c934f1f6fd2ab9de5f7638f671fd59791;p=freeside.git diff --git a/FS/FS/cust_location.pm b/FS/FS/cust_location.pm index 1f07aa87c..b86529b3d 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; @@ -188,6 +188,7 @@ sub check { || $self->ut_coordn('latitude') || $self->ut_coordn('longitude') || $self->ut_enum('coord_auto', [ '', 'Y' ]) + || $self->ut_enum('addr_clean', [ '', 'Y' ]) || $self->ut_alphan('location_type') || $self->ut_textn('location_number') || $self->ut_enum('location_kind', [ '', 'R', 'B' ] ) @@ -208,9 +209,6 @@ sub check { return "Unit # is required"; } - $self->set_coord - unless $import || ($self->latitude && $self->longitude); - # tricky...we have to allow for the customer to not be inserted yet return "No prospect or customer!" unless $self->prospectnum || $self->custnum @@ -326,6 +324,9 @@ sub move_to { my $dbh = dbh; my $error = ''; + # prevent this from failing because of pkg_svc quantity limits + local( $FS::cust_svc::ignore_quantity ) = 1; + if ( !$new->locationnum ) { $error = $new->insert; if ( $error ) { @@ -507,9 +508,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 = ?"