summaryrefslogtreecommitdiff
path: root/FS/FS/UI/Web.pm
diff options
context:
space:
mode:
Diffstat (limited to 'FS/FS/UI/Web.pm')
-rw-r--r--FS/FS/UI/Web.pm8
1 files changed, 8 insertions, 0 deletions
diff --git a/FS/FS/UI/Web.pm b/FS/FS/UI/Web.pm
index 8f10011..f460904 100644
--- a/FS/FS/UI/Web.pm
+++ b/FS/FS/UI/Web.pm
@@ -346,6 +346,7 @@ sub cust_header {
'Payment Type' => 'cust_payby',
'Current Balance' => 'current_balance',
'Agent Cust#' => 'agent_custid',
+ 'Advertising Source' => 'referral',
);
$header2method{'Cust#'} = 'display_custnum'
if $conf->exists('cust_main-default_agent_custid');
@@ -455,6 +456,9 @@ sub cust_sql_fields {
push @extra_fields, FS::cust_main->balance_sql . " AS current_balance";
}
+ push @extra_fields, 'part_referral.referral AS referral'
+ if grep { $_ eq 'referral' } @cust_fields;
+
map("cust_main.$_", @fields), @location_fields, @extra_fields;
}
@@ -519,6 +523,10 @@ sub join_cust_main {
" ON (ship_location.locationnum = $location_table.$locationnum) ";
}
+ if ( !@cust_fields or grep { $_ eq 'referral' } @cust_fields ) {
+ $sql .= ' LEFT JOIN part_referral ON (cust_main.refnum = part_referral.refnum) ';
+ }
+
$sql;
}