X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FUI%2FWeb.pm;h=e07e682baac271267c3f4165528a9e574723871e;hb=bf09b9e785d014be69e06d001769e118e485a04d;hp=8f10011e5fedf7d7b11f5c222d779d35b0a0f89f;hpb=cc40b7d77271966a6922317774f63f8fa86d0871;p=freeside.git diff --git a/FS/FS/UI/Web.pm b/FS/FS/UI/Web.pm index 8f10011e5..e07e682ba 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_x.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 (select refnum, referral from part_referral) AS part_referral_x ON (cust_main.refnum = part_referral_x.refnum) '; + } + $sql; }