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;
|| $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' ] )
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
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 ) {
$prefix . $self->SUPER::location_label(%opt);
}
+=item county_state_county
+
+Returns a string consisting of just the county, state and country.
+
+=cut
+
+sub county_state_country {
+ my $self = shift;
+ my $label = $self->country;
+ $label = $self->state.", $label" if $self->state;
+ $label = $self->county." County, $label" if $self->county;
+ $label;
+}
+
=back
=head1 CLASS METHODS
('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 = ?"