use FS::cust_main;
use FS::contact;
use FS::qual;
+use FS::part_referral;
$DEBUG = 0;
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.
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
##
'header' => [ '#',
'Prospect',
'Contact(s)',
+ 'Advertising source',
],
'fields' => [ 'prospectnum',
'name',
}
$pm->contact
];
+ ''
+ },
+ sub {
+ my $pr = shift->part_referral;
+ $pr ? $pr->referral : '';
},
],
'links' => [ '',
$link,
'', #link to contact edit???
+ '',
],
'agent_virt' => 1,
'disableable' => 1,
#scalars
my @scalars = qw (
- agentnum
+ agentnum refnum
);
for my $param ( @scalars ) {
-<% include('/elements/header.html', 'Prospect Report' ) %>
+<& /elements/header.html, 'Prospect Report' &>
<FORM ACTION="prospect_main.html" METHOD="GET">
<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>
</FORM>
-<% include('/elements/footer.html') %>
+<& /elements/footer.html &>
<%init>
die "access denied"