summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2013-09-28 18:04:57 -0700
committerMark Wells <mark@freeside.biz>2013-09-28 18:04:57 -0700
commitb61064b3e9a58881a7ad1c4febff3244fc5a4bcc (patch)
treeb8766fb98b9ab52ba33e43afaf0e22c1e6a4932a /httemplate
parentc1285aad3e79b4fd9312002cd03c0bdc325acc25 (diff)
and make this work with pre-upgrade location info
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/search/phone_state.html8
1 files changed, 7 insertions, 1 deletions
diff --git a/httemplate/search/phone_state.html b/httemplate/search/phone_state.html
index 7b3acbbbf..67965b702 100644
--- a/httemplate/search/phone_state.html
+++ b/httemplate/search/phone_state.html
@@ -86,6 +86,10 @@ for(my $i = 0; $i < scalar(@tables); $i++) {
# join to the preceding table if there is one, and filter out
# deleted records
if ( $i > 0 ) {
+ # special case to make pre-3.x data work; remove this later
+ if ( $table eq 'cust_main' ) {
+ $last_table = 'h_cust_pkg';
+ }
$addl_from .= "
LEFT JOIN ( $h_table $inside ) AS $h_table
ON ($h_table.$pkey = $last_table.$pkey)";
@@ -109,7 +113,9 @@ push @where, $curuser->agentnums_sql(
);
my $where = " WHERE ".join(' AND ', map "($_)", @where);
-my $group_field = 'h_cust_location.state';
+# for pre-3.x data
+my $group_field = 'COALESCE(h_cust_location.state, h_cust_main.ship_state, h_cust_main.state)';
+
my @select = (
"$group_field AS state",
'count(DISTINCT h_svc_phone.svcnum) AS num_svcnums',