[freeside-commits] branch master updated. 3b50b841a272a5cd55497958d572dd73a3339e7b

Jonathan Prykop jonathan at 420.am
Tue May 10 18:11:47 PDT 2016


The branch, master has been updated
       via  3b50b841a272a5cd55497958d572dd73a3339e7b (commit)
      from  636a54504bc9cc24ca4b0c222ec469ec8425e5a0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3b50b841a272a5cd55497958d572dd73a3339e7b
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Tue May 10 20:11:02 2016 -0500

    RT#41394: Add advertising source to customer fields selection [new solution, for advanced customer report only]

diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index c8a084c..cc23f50 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -620,6 +620,10 @@ listref (list returned by FS::UI::Web::parse_lt_gt($cgi, 'current_balance'))
 
 bool
 
+=item select_referral
+
+bool, join to part_referral and select part_referral.referral
+
 =back
 
 =cut
@@ -1027,6 +1031,13 @@ sub search {
   my(@extra_headers) = ();
   my(@extra_fields)  = ();
 
+  if ($params->{'select_referral'}) {
+    $addl_from .= ' LEFT JOIN part_referral ON ( cust_main.refnum = part_referral.refnum ) ';
+    push @select, 'part_referral.referral';
+    push @extra_headers, 'Advertising Source';
+    push @extra_fields, 'referral';
+  }
+    
   if ($params->{'flattened_pkgs'}) {
 
     #my $pkg_join = '';
diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html
index 672c201..84eee1b 100755
--- a/httemplate/search/cust_main.html
+++ b/httemplate/search/cust_main.html
@@ -50,6 +50,7 @@ my @scalars = qw (
   all_tags
   all_pkg_classnums
   any_pkg_status
+  select_referral
 );
 
 for my $param ( @scalars ) {
diff --git a/httemplate/search/report_cust_main.html b/httemplate/search/report_cust_main.html
index ba7c99a..2e8f67b 100755
--- a/httemplate/search/report_cust_main.html
+++ b/httemplate/search/report_cust_main.html
@@ -278,6 +278,11 @@
     <& /elements/tr-select-cust-fields.html &>
 
     <TR>
+      <TD ALIGN="right" VALIGN="center"><% mt('Add advertising source column') |h %></TD>
+        <TD><INPUT TYPE="checkbox" NAME="select_referral"></TD>
+    </TR>
+
+    <TR>
       <TD ALIGN="right" VALIGN="center"><% mt('Add package columns') |h %></TD>
         <TD><INPUT TYPE="checkbox" NAME="flattened_pkgs"></TD>
     </TR>

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/cust_main/Search.pm               |   11 +++++++++++
 httemplate/search/cust_main.html        |    1 +
 httemplate/search/report_cust_main.html |    5 +++++
 3 files changed, 17 insertions(+)




More information about the freeside-commits mailing list