Option to ignore old CDRs, RT#81480
[freeside.git] / httemplate / view / prospect_main.html
1 <& /elements/header.html, $title &>
2
3 % if ( $curuser->access_right('Edit prospect') ) { 
4   <A HREF="<% $p %>edit/prospect_main.html?<% $prospectnum %>">Edit this prospect</A>
5 % } 
6
7 <TABLE CLASS="fsinnerbox">
8
9 %unless ( ! $prospect_main->refnum ) { # || scalar(@part_referral) == 1 ) {
10 %  my $part_referral = qsearchs('part_referral',{ 'refnum' => $prospect_main->refnum } );
11    <TR>
12      <TH ALIGN="right">Advertising source</TD>
13      <TD BGCOLOR="#ffffff"><% $part_referral->referral |h %></TD>
14    </TR>
15 %}
16
17 % if ( $prospect_main->company ) { 
18   <TR>
19     <TH ALIGN="right">Company</TD>
20     <TD BGCOLOR="#FFFFFF"><B><% $prospect_main->company |h %></B></TD>
21   </TR>
22 % }
23
24 % foreach my $prospect_contact ( $prospect_main->prospect_contact ) {
25 %   my $contact = $prospect_contact->contact;
26     <TR>
27       <TH ALIGN="right" VALIGN="top"><% $prospect_contact->contact_classname |h %> Contact</TH>
28       <TD BGCOLOR="#FFFFFF">
29           <% $contact->line |h %><br>
30           <table>
31 %         for my $row ( $contact->contact_email ) {
32             <tr><th>E-Mail:</th><td><% $row->emailaddress |h %></td></tr>
33 %         }
34 %         for my $row ( $contact->contact_phone ) {
35             <tr><th><% $row->phone_type->typename |h %>:</th><td><% $row->phonenum_pretty |h %></td></tr>
36 %         }
37 %         if ( $prospect_contact->comment ) {
38             <tr><th>Comment:</th><td><% $prospect_contact->comment |h %></td></tr>
39 %         }
40           </table>
41       </TD>
42     </TR>
43 %}
44
45 % my @cust_location =
46 %   qsearch('cust_location', { 'prospectnum' => $prospectnum } );
47 % #but only one, for now
48 % foreach my $cust_location (@cust_location) {
49     <TR>
50       <TH ALIGN="right">Address</TD>
51       <TD BGCOLOR="#FFFFFF">
52         <% $cust_location->location_label(
53              'join_string'     => '<BR>',
54              'double_space'    => ' &nbsp; ',
55              'escape_function' => \&encode_entities,
56            )
57         %>
58       </TD>
59     </TR>
60 %   if ( $cust_location->latitude && $cust_location->longitude ) {
61       <& /elements/tr-coords.html, $cust_location->latitude,
62                                    $cust_location->longitude,
63                                    $prospect_main->name,
64       &>
65 %   }
66 % }
67 % if ( my $tax_status = $prospect_main->tax_status ) {
68   <TR>
69     <TH ALIGN="right">Tax status</TD>
70     <TD BGCOLOR="#FFFFFF">
71       <B><% $tax_status->taxstatus %>:</B> <% $tax_status->description %>
72     </TD>
73   </TR>
74 % }
75
76 </TABLE>
77
78 <BR>
79
80 <& /elements/quotations.html, prospect_main=>$prospect_main &>
81
82 % if ( $curuser->access_right('Qualify service') ) { 
83 <% include( '/elements/popup_link-prospect_main.html',
84               'action'        => $p. 'misc/qual.html',
85               'label'         => 'New Qualification',
86               'actionlabel'   => 'New Qualification',
87               'color'         => '#333399',
88               'prospect_main' => $prospect_main,
89               'closetext'     => 'Close',
90               'width'         => 763,
91               'height'        => 436,
92           )
93 %>
94   | <A HREF="<%$p%>search/qual.cgi?prospectnum=<% $prospect_main->prospectnum %>">View Qualifications</A>
95     <BR><BR>
96 % }
97
98 %# XXX display prospect tickets
99
100 <%init>
101
102 my $curuser = $FS::CurrentUser::CurrentUser;
103
104 die "access denied"
105   unless $curuser->access_right('View prospect');
106
107 my $prospectnum;
108 if ( $cgi->param('prospectnum') =~ /^(\d+)$/ ) {
109   $prospectnum = $1;
110 } else {
111   die "No prospect specified (bad URL)!" unless $cgi->keywords;
112   my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
113   $query =~ /^(\d+)$/;
114   $prospectnum = $1;
115 }
116
117 my $prospect_main = qsearchs( {
118   'table'     => 'prospect_main',
119   'hashref'   => { 'prospectnum' => $prospectnum },
120   'extra_sql' => ' AND '. $curuser->agentnums_sql,
121 });
122 die "Prospect not found!" unless $prospect_main;
123
124 my $title = mt("Prospect"). ': '. $prospect_main->name;
125 $title .= ' ('.mt('DISABLED').')'
126   if $prospect_main->disabled;
127
128 my @agentnums = $curuser->agentnums;
129 if (scalar(@agentnums) > 1 ) {
130   $title = encode_entities($prospect_main->agent->agent). " $title";
131 }
132
133 </%init>