[freeside-commits] branch FREESIDE_3_BRANCH updated. b4b4fac1ad93e05d3e2b6723f0ad011b38e06cbe

Ivan ivan at 420.am
Mon Nov 7 17:33:48 PST 2016


The branch, FREESIDE_3_BRANCH has been updated
       via  b4b4fac1ad93e05d3e2b6723f0ad011b38e06cbe (commit)
      from  025b95d966499c1b1c82d3410321fc2b0aaa1f79 (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 b4b4fac1ad93e05d3e2b6723f0ad011b38e06cbe
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon Nov 7 17:33:47 2016 -0800

    add advertising source selection and display to prospect report

diff --git a/FS/FS/prospect_main.pm b/FS/FS/prospect_main.pm
index 1c47a80..a6b593d 100644
--- a/FS/FS/prospect_main.pm
+++ b/FS/FS/prospect_main.pm
@@ -11,6 +11,7 @@ use FS::cust_location;
 use FS::cust_main;
 use FS::contact;
 use FS::qual;
+use FS::part_referral;
 
 $DEBUG = 0;
 
@@ -323,6 +324,17 @@ sub agent {
   qsearchs( 'agent', { 'agentnum' => $self->agentnum } );
 }
 
+=item part_referral
+
+Returns the advertising source (see L<FS::part_referral>) for this customer.
+
+=cut
+
+sub part_referral {
+  my $self = shift;
+  qsearchs( 'part_referral', { 'refnum' => $self->refnum } );
+}
+
 =item convert_cust_main
 
 Converts this prospect to a customer.
@@ -394,15 +406,18 @@ sub search {
   my @where = ();
   my $orderby;
 
-  ##
-  # parse agent
-  ##
-
+  #agent
   if ( $params->{'agentnum'} =~ /^(\d+)$/ and $1 ) {
     push @where,
       "prospect_main.agentnum = $1";
   }
 
+  #refnum
+  if ( $params->{'refnum'} =~ /^(\d+)$/ and $1 ) {
+    push @where,
+      "prospect_main.refnum = $1";
+  }
+
   ##
   # setup queries, subs, etc. for the search
   ##
diff --git a/httemplate/search/prospect_main.html b/httemplate/search/prospect_main.html
index 4798f58..feb1e11 100644
--- a/httemplate/search/prospect_main.html
+++ b/httemplate/search/prospect_main.html
@@ -6,6 +6,7 @@
              'header'        => [ '#',
                                   'Prospect',
                                   'Contact(s)',
+                                  'Advertising source',
                                 ],
              'fields'        => [ 'prospectnum',
                                   'name',
@@ -16,11 +17,17 @@
                                           }
                                           $pm->contact
                                     ];
+                                    ''
+                                  },
+                                  sub {
+                                    my $pr = shift->part_referral;
+                                    $pr ? $pr->referral : '';
                                   },
                                 ],
              'links'         => [ '',
                                   $link,
                                   '', #link to contact edit???
+                                  '',
                                 ],
              'agent_virt'    => 1,
              'disableable'   => 1,
@@ -37,7 +44,7 @@ my %search_hash = ();
 
 #scalars
 my @scalars = qw (
-  agentnum 
+  agentnum refnum
 );
 
 for my $param ( @scalars ) {
diff --git a/httemplate/search/report_prospect_main.html b/httemplate/search/report_prospect_main.html
index 4834c20..f2e617f 100644
--- a/httemplate/search/report_prospect_main.html
+++ b/httemplate/search/report_prospect_main.html
@@ -1,4 +1,4 @@
-<% include('/elements/header.html', 'Prospect Report' ) %>
+<& /elements/header.html, 'Prospect Report' &>
 
 <FORM ACTION="prospect_main.html" METHOD="GET">
 
@@ -8,11 +8,16 @@
       <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Search options</FONT></TH>
     </TR>
 
-    <% include( '/elements/tr-select-agent.html',
-                  'curr_value'    => scalar($cgi->param('agentnum')),
-                  'disable_empty' => 0,
-               )
-    %>
+    <& /elements/tr-select-agent.html,
+         'curr_value'    => scalar($cgi->param('agentnum')),
+         'disable_empty' => 0,
+    &>
+
+    <& /elements/tr-select-part_referral.html,
+         'curr_value'    => scalar($cgi->param('refnum')),
+         'empty_label'   => 'all',
+         'disable_empty' => 0,
+    &>
 
   </TABLE>
 
@@ -21,7 +26,7 @@
 
 </FORM>
 
-<% include('/elements/footer.html') %>
+<& /elements/footer.html &>
 <%init>
 
 die "access denied"

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

Summary of changes:
 FS/FS/prospect_main.pm                      |   23 +++++++++++++++++++----
 httemplate/search/prospect_main.html        |    9 ++++++++-
 httemplate/search/report_prospect_main.html |   19 ++++++++++++-------
 3 files changed, 39 insertions(+), 12 deletions(-)




More information about the freeside-commits mailing list