summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorjeff <jeff>2009-07-27 03:26:47 +0000
committerjeff <jeff>2009-07-27 03:26:47 +0000
commitf3717767d19f9da888e190f87a04dfa245d658b4 (patch)
tree198b6454ec80efd88096d5574feb5c83bf827a20 /FS
parent6a8c7c021a01b85ce172a230757b000fe2959a31 (diff)
FCC from 477 improvements #4912
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Conf.pm22
-rw-r--r--FS/FS/cust_main.pm20
-rw-r--r--FS/FS/cust_pkg.pm7
3 files changed, 47 insertions, 2 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 832322faf..37f55306a 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2605,6 +2605,28 @@ worry that config_items is freeside-specific and icky.
},
{
+ 'key' => 'census_year',
+ 'section' => 'UI',
+ 'description' => 'The year to use in census tract lookups',
+ 'type' => 'select',
+ 'select_enum' => [ qw( 2008 2007 2006 ) ],
+ },
+
+ {
+ 'key' => 'company_latitude',
+ 'section' => 'UI',
+ 'description' => 'Your company latitude (-90 through 90)',
+ 'type' => 'text',
+ },
+
+ {
+ 'key' => 'company_longitude',
+ 'section' => 'UI',
+ 'description' => 'Your company longitude (-180 thru 180)',
+ 'type' => 'text',
+ },
+
+ {
'key' => 'disable_acl_changes',
'section' => '',
'description' => 'Disable all ACL changes, for demos.',
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 9d41c4bdf..518ab4d98 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -1571,6 +1571,13 @@ sub check {
unless ! $self->referral_custnum
|| qsearchs( 'cust_main', { 'custnum' => $self->referral_custnum } );
+ if ( $self->censustract ne '' ) {
+ $self->censustract =~ /^\s*(\d{9})\.?(\d{2})\s*$/
+ or return "Illegal census tract: ". $self->censustract;
+
+ $self->censustract("$1.$2");
+ }
+
if ( $self->ss eq '' ) {
$self->ss('');
} else {
@@ -7371,6 +7378,19 @@ sub support_services {
}
+# Return a list of latitude/longitude for one of the services (if any)
+sub service_coordinates {
+ my $self = shift;
+
+ my @svc_X =
+ grep { $_->latitude && $_->longitude }
+ map { $_->svc_x }
+ map { $_->cust_svc }
+ $self->ncancelled_pkgs;
+
+ scalar(@svc_X) ? ( $svc_X[0]->latitude, $svc_X[0]->longitude ) : ()
+}
+
=back
=head1 CLASS METHODS
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 4d44692b3..00a030117 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -2377,8 +2377,11 @@ sub search_sql {
# parse censustract
###
- if ( $params->{'censustract'} =~ /^([.\d]+)$/ and $1 ) {
- push @where, "cust_main.censustract = '". $params->{censustract}. "'";
+ if ( exists($params->{'censustract'}) ) {
+ $params->{'censustract'} =~ /^([.\d]*)$/;
+ my $censustract = "cust_main.censustract = '$1'";
+ $censustract .= ' OR cust_main.censustract is NULL' unless $1;
+ push @where, "( $censustract )";
}
###