summaryrefslogtreecommitdiff
path: root/httemplate/view/prospect_main.html
blob: d6bcbe7ada315a87b7425f7e252b05901511e695 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<& /elements/header.html, $title &>

% if ( $curuser->access_right('Edit prospect') ) { 
  <A HREF="<% $p %>edit/prospect_main.html?<% $prospectnum %>">Edit this prospect</A>
% } 

<TABLE CLASS="fsinnerbox">

%unless ( ! $prospect_main->refnum ) { # || scalar(@part_referral) == 1 ) {
%  my $part_referral = qsearchs('part_referral',{ 'refnum' => $prospect_main->refnum } );
   <TR>
     <TH ALIGN="right">Advertising source</TD>
     <TD BGCOLOR="#ffffff"><% $part_referral->referral |h %></TD>
   </TR>
%}

% if ( $prospect_main->company ) { 
  <TR>
    <TH ALIGN="right">Company</TD>
    <TD BGCOLOR="#FFFFFF"><B><% $prospect_main->company |h %></B></TD>
  </TR>
% }

% foreach my $prospect_contact ( $prospect_main->prospect_contact ) {
%   my $contact = $prospect_contact->contact;
    <TR>
      <TH ALIGN="right" VALIGN="top"><% $prospect_contact->contact_classname |h %> Contact</TH>
      <TD BGCOLOR="#FFFFFF">
          <% $contact->line |h %><br>
          <table>
%         for my $row ( $contact->contact_email ) {
            <tr><th>E-Mail:</th><td><% $row->emailaddress |h %></td></tr>
%         }
%         for my $row ( $contact->contact_phone ) {
            <tr><th><% $row->phone_type->typename |h %>:</th><td><% $row->phonenum_pretty |h %></td></tr>
%         }
%         if ( $prospect_contact->comment ) {
            <tr><th>Comment:</th><td><% $prospect_contact->comment |h %></td></tr>
%         }
          </table>
      </TD>
    </TR>
%}

% my @cust_location =
%   qsearch('cust_location', { 'prospectnum' => $prospectnum } );
% #but only one, for now
% foreach my $cust_location (@cust_location) {
    <TR>
      <TH ALIGN="right">Address</TD>
      <TD BGCOLOR="#FFFFFF">
        <% $cust_location->location_label(
             'join_string'     => '<BR>',
             'double_space'    => ' &nbsp; ',
             'escape_function' => \&encode_entities,
           )
        %>
      </TD>
    </TR>
%   if ( $cust_location->latitude && $cust_location->longitude ) {
      <& /elements/tr-coords.html, $cust_location->latitude,
                                   $cust_location->longitude,
                                   $prospect_main->name,
      &>
%   }
% }
% if ( my $tax_status = $prospect_main->tax_status ) {
  <TR>
    <TH ALIGN="right">Tax status</TD>
    <TD BGCOLOR="#FFFFFF">
      <B><% $tax_status->taxstatus %>:</B> <% $tax_status->description %>
    </TD>
  </TR>
% }

</TABLE>

<BR>

<& /elements/quotations.html, prospect_main=>$prospect_main &>

% if ( $curuser->access_right('Qualify service') ) { 
<% include( '/elements/popup_link-prospect_main.html',
              'action'        => $p. 'misc/qual.html',
              'label'         => 'New Qualification',
              'actionlabel'   => 'New Qualification',
              'color'         => '#333399',
              'prospect_main' => $prospect_main,
              'closetext'     => 'Close',
              'width'         => 763,
              'height'        => 436,
          )
%>
  | <A HREF="<%$p%>search/qual.cgi?prospectnum=<% $prospect_main->prospectnum %>">View Qualifications</A>
    <BR><BR>
% }

%# XXX display prospect tickets

<%init>

my $curuser = $FS::CurrentUser::CurrentUser;

die "access denied"
  unless $curuser->access_right('View prospect');

my $prospectnum;
if ( $cgi->param('prospectnum') =~ /^(\d+)$/ ) {
  $prospectnum = $1;
} else {
  die "No prospect specified (bad URL)!" unless $cgi->keywords;
  my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
  $query =~ /^(\d+)$/;
  $prospectnum = $1;
}

my $prospect_main = qsearchs( {
  'table'     => 'prospect_main',
  'hashref'   => { 'prospectnum' => $prospectnum },
  'extra_sql' => ' AND '. $curuser->agentnums_sql,
});
die "Prospect not found!" unless $prospect_main;

my $title = mt("Prospect"). ': '. $prospect_main->name;
$title .= ' ('.mt('DISABLED').')'
  if $prospect_main->disabled;

my @agentnums = $curuser->agentnums;
if (scalar(@agentnums) > 1 ) {
  $title = encode_entities($prospect_main->agent->agent). " $title";
}

</%init>