This commit was generated by cvs2svn to compensate for changes in r10640,
[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 % if ( $curuser->access_right('Qualify service') ) { 
60 <% include( '/elements/popup_link-prospect_main.html',
61               'action'      => $p. 'misc/qual.html',
62               'label'       => 'New&nbsp;Qualification',
63               'actionlabel' => 'New Qualification',
64               'color'       => '#333399',
65               'prospect_main'   => $prospect_main,
66               'closetext'   => 'Close',
67               'width'       => 763,
68               'height'      => 436,
69           )
70 %>
71   | <A HREF="<%$p%>search/qual.cgi?prospectnum=<% $prospect_main->prospectnum %>">View Qualifications</A>
72     <BR><BR>
73 % }
74
75 <% ntable("#cccccc") %>
76
77 <TR>
78   <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Tickets</FONT></TH>
79 </TR>
80
81 </TABLE>
82
83 <%init>
84
85 my $curuser = $FS::CurrentUser::CurrentUser;
86
87 die "access denied"
88   unless $curuser->access_right('View prospect');
89
90 my $prospectnum;
91 if ( $cgi->param('prospectnum') =~ /^(\d+)$/ ) {
92   $prospectnum = $1;
93 } else {
94   die "No prospect specified (bad URL)!" unless $cgi->keywords;
95   my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
96   $query =~ /^(\d+)$/;
97   $prospectnum = $1;
98 }
99
100 my $prospect_main = qsearchs( {
101   'table'     => 'prospect_main',
102   'hashref'   => { 'prospectnum' => $prospectnum },
103   'extra_sql' => ' AND '. $curuser->agentnums_sql,
104 });
105 die "Prospect not found!" unless $prospect_main;
106
107 my @agentnums = $curuser->agentnums;
108
109 </%init>