communigate phase 3: archive messages, RT#7515
[freeside.git] / httemplate / view / prospect_main.html
1 <% include('/elements/header.html',
2              'Prospect View: '. $prospect_main->company
3           )
4 %>
5
6 % if ( $curuser->access_right('Edit prospect') ) { 
7   <A HREF="<% $p %>edit/prospect_main.html?<% $prospectnum %>">Edit this prospect</A>
8 % } 
9
10 <% ntable("#cccccc",2) %>
11
12 <TR>
13   <TD ALIGN="right">Prospect #</TD>
14   <TD BGCOLOR="#FFFFFF"><B><% $prospectnum %></B></TD>
15 </TR>
16
17 %unless ( scalar(@agentnums) == 1
18 %         && !$curuser->access_right('View customers of all agents') ) {
19 %  my $agent = qsearchs('agent',{ 'agentnum' => $prospect_main->agentnum } );
20    <TR>
21      <TD ALIGN="right">Agent</TD>
22      <TD BGCOLOR="#ffffff"><% $agent->agentnum %>: <% $agent->agent %></TD>
23    </TR>
24 %}
25
26 <TR>
27   <TD ALIGN="right">Company</TD>
28   <TD BGCOLOR="#FFFFFF"><B><% $prospect_main->company |h %></B></TD>
29 </TR>
30
31 % foreach my $contact ( $prospect_main->contact ) {
32     <TR>
33       <TD ALIGN="right">Contact</TD>
34       <TD BGCOLOR="#FFFFFF"><% $contact->line %></TD>
35     </TR>
36 %}
37
38 % my @cust_location =
39 %   qsearch('cust_location', { 'prospectnum' => $prospectnum } );
40 % #but only one, for now
41 % foreach my $cust_location (@cust_location) {
42     <TR>
43       <TD ALIGN="right">Address</TD>
44       <TD BGCOLOR="#FFFFFF">
45         <% $cust_location->location_label(
46              'join_string'     => '<BR>',
47              'double_space'    => ' &nbsp; ',
48              'escape_function' => \&encode_entities,
49            )
50         %>
51       </TD>
52   </TR>
53 % }
54
55 </TABLE>
56
57 <BR>
58
59 <% ntable("#cccccc") %>
60
61 <TR>
62   <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Tickets</FONT></TH>
63 </TR>
64
65 </TABLE>
66
67 <%init>
68
69 my $curuser = $FS::CurrentUser::CurrentUser;
70
71 die "access denied"
72   unless $curuser->access_right('View prospect');
73
74 my $prospectnum;
75 if ( $cgi->param('prospectnum') =~ /^(\d+)$/ ) {
76   $prospectnum = $1;
77 } else {
78   die "No prospect specified (bad URL)!" unless $cgi->keywords;
79   my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
80   $query =~ /^(\d+)$/;
81   $prospectnum = $1;
82 }
83
84 my $prospect_main = qsearchs( {
85   'table'     => 'prospect_main',
86   'hashref'   => { 'prospectnum' => $prospectnum },
87   'extra_sql' => ' AND '. $curuser->agentnums_sql,
88 });
89 die "Prospect not found!" unless $prospect_main;
90
91 my @agentnums = $curuser->agentnums;
92
93 </%init>