summaryrefslogtreecommitdiff
path: root/FS/FS
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2016-11-18 05:19:46 -0600
committerJonathan Prykop <jonathan@freeside.biz>2016-11-18 05:19:46 -0600
commit2a56c671635687bf2648eb3a7cf4bce228101af3 (patch)
tree7638e36c0d53de62cf51421e26e2acfc406bd7ab /FS/FS
parente41cafbe7616c4f046c6161999d4577f1c918311 (diff)
parenteafcf16ece06a179ef55848da0a2bfcc91e1f858 (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'FS/FS')
-rw-r--r--FS/FS/cust_location.pm2
-rw-r--r--FS/FS/cust_main/Search.pm21
-rw-r--r--FS/FS/cust_pkg.pm11
-rw-r--r--FS/FS/geocode_Mixin.pm1
-rw-r--r--FS/FS/svc_cable.pm9
-rw-r--r--FS/FS/svc_hardware.pm13
6 files changed, 51 insertions, 6 deletions
diff --git a/FS/FS/cust_location.pm b/FS/FS/cust_location.pm
index a9660d8..e1b8533 100644
--- a/FS/FS/cust_location.pm
+++ b/FS/FS/cust_location.pm
@@ -937,7 +937,7 @@ sub _upgrade_data {
next if $field eq 'disabled';
foreach my $location (qsearch({
table => 'cust_location',
- extra_sql => " WHERE $field LIKE ' %' OR $field LIKE '% '"
+ extra_sql => " WHERE disabled IS NULL AND ($field LIKE ' %' OR $field LIKE '% ')"
})) {
my $error = $location->replace;
die "$error (fixing whitespace in $field, locationnum ".$location->locationnum.')'
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index e021140..14dd4b4 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -695,6 +695,21 @@ sub search {
push @where, FS::cust_main->$method();
}
+ my $current = '';
+ unless ( $params->{location_history} ) {
+ $current = '
+ AND ( cust_location.locationnum IN ( cust_main.bill_locationnum,
+ cust_main.ship_locationnum
+ )
+ OR cust_location.locationnum IN (
+ SELECT locationnum FROM cust_pkg
+ WHERE cust_pkg.custnum = cust_main.custnum
+ AND locationnum IS NOT NULL
+ AND '. FS::cust_pkg->ncancelled_recurring_sql.'
+ )
+ )';
+ }
+
##
# address
##
@@ -714,6 +729,7 @@ sub search {
SELECT 1 FROM cust_location
WHERE cust_location.custnum = cust_main.custnum
AND (".join(' OR ',@orwhere).")
+ $current
)";
}
}
@@ -727,6 +743,7 @@ sub search {
SELECT 1 FROM cust_location
WHERE cust_location.custnum = cust_main.custnum
AND cust_location.city = $city
+ $current
)";
}
@@ -739,6 +756,7 @@ sub search {
SELECT 1 FROM cust_location
WHERE cust_location.custnum = cust_main.custnum
AND cust_location.county = $county
+ $current
)";
}
@@ -751,6 +769,7 @@ sub search {
SELECT 1 FROM cust_location
WHERE cust_location.custnum = cust_main.custnum
AND cust_location.state = $state
+ $current
)";
}
@@ -763,6 +782,7 @@ sub search {
SELECT 1 FROM cust_location
WHERE cust_location.custnum = cust_main.custnum
AND cust_location.zip LIKE $zip
+ $current
)";
}
@@ -775,6 +795,7 @@ sub search {
SELECT 1 FROM cust_location
WHERE cust_location.custnum = cust_main.custnum
AND cust_location.country = '$country'
+ $current
)";
}
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 714d292..4e9ede3 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -5072,6 +5072,17 @@ sub cancel_sql {
"cust_pkg.cancel IS NOT NULL AND cust_pkg.cancel != 0";
}
+=item ncancelled_recurring_sql
+
+Returns an SQL expression identifying un-cancelled, recurring packages.
+
+=cut
+
+sub ncancelled_recurring_sql {
+ $_[0]->recurring_sql().
+ " AND ( cust_pkg.cancel IS NULL OR cust_pkg.cancel = 0 ) ";
+}
+
=item status_sql
Returns an SQL expression to give the package status as a string.
diff --git a/FS/FS/geocode_Mixin.pm b/FS/FS/geocode_Mixin.pm
index ef16e74..b999be0 100644
--- a/FS/FS/geocode_Mixin.pm
+++ b/FS/FS/geocode_Mixin.pm
@@ -265,6 +265,7 @@ sub process_district_update {
my $method = $conf->config('tax_district_method')
or return; #nothing to do if null
my $self = $class->by_key($id) or die "object $id not found";
+ return if $self->disabled;
# dies on error, fine
my $tax_info = get_district({ $self->location_hash }, $method);
diff --git a/FS/FS/svc_cable.pm b/FS/FS/svc_cable.pm
index 01c5de7..9e818e1 100644
--- a/FS/FS/svc_cable.pm
+++ b/FS/FS/svc_cable.pm
@@ -122,11 +122,16 @@ Returns the MAC address and serial number.
sub label {
my $self = shift;
+ my $part_svc = $self->cust_svc->part_svc;
my @label = ();
push @label, 'MAC:'. $self->mac_addr_pretty
if $self->mac_addr;
- push @label, 'Serial#'. $self->serialnum
- if $self->serialnum;
+ if ( $self->serialnum ) {
+ my $serialnum_label = $part_svc->part_svc_column('serialnum');
+ push @label,
+ ($serialnum_label && $serialnum_label->columnlabel || 'Serial#').
+ $self->serialnum;
+ }
return join(', ', @label);
}
diff --git a/FS/FS/svc_hardware.pm b/FS/FS/svc_hardware.pm
index dbb8b68..4bff483 100644
--- a/FS/FS/svc_hardware.pm
+++ b/FS/FS/svc_hardware.pm
@@ -134,15 +134,22 @@ sub search_sql {
sub label {
my $self = shift;
+ my $part_svc = $self->cust_svc->part_svc;
my @label = ();
if (my $type = $self->hardware_type) {
- push @label, 'Type:' . $type->description;
+ my $typenum_label = $part_svc->part_svc_column('typenum');
+ push @label, ( $typenum_label && $typenum_label->columnlabel || 'Type:' ).
+ $type->description;
}
if (my $ser = $self->serial) {
- push @label, 'Serial#' . $ser;
+ my $serial_label = $part_svc->part_svc_column('serial');
+ push @label, ( $serial_label && $serial_label->columnlabel || 'Serial#' ).
+ $ser;
}
if (my $mac = $self->display_hw_addr) {
- push @label, 'MAC:'. $mac;
+ my $hw_addr_label = $part_svc->part_svc_column('hw_addr');
+ push @label, ( $hw_addr_label && $hw_addr_label->columnlabel || 'MAC:').
+ $mac;
}
return join(', ', @label);
}