combine ticket notification scrips, #15353
[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 % if ( $prospect_main->company ) { 
27   <TR>
28     <TD ALIGN="right">Company</TD>
29     <TD BGCOLOR="#FFFFFF"><B><% $prospect_main->company |h %></B></TD>
30   </TR>
31 % }
32
33 % foreach my $contact ( $prospect_main->contact ) {
34     <TR>
35       <TD ALIGN="right">Contact</TD>
36       <TD BGCOLOR="#FFFFFF"><% $contact->line %></TD>
37     </TR>
38 %}
39
40 % my @cust_location =
41 %   qsearch('cust_location', { 'prospectnum' => $prospectnum } );
42 % #but only one, for now
43 % foreach my $cust_location (@cust_location) {
44     <TR>
45       <TD ALIGN="right">Address</TD>
46       <TD BGCOLOR="#FFFFFF">
47         <% $cust_location->location_label(
48              'join_string'     => '<BR>',
49              'double_space'    => ' &nbsp; ',
50              'escape_function' => \&encode_entities,
51            )
52         %>
53       </TD>
54   </TR>
55 % }
56
57 </TABLE>
58
59 <BR>
60
61 % if ( $curuser->access_right('Qualify service') ) { 
62 <% include( '/elements/popup_link-prospect_main.html',
63               'action'        => $p. 'misc/qual.html',
64               'label'         => 'New&nbsp;Qualification',
65               'actionlabel'   => 'New Qualification',
66               'color'         => '#333399',
67               'prospect_main' => $prospect_main,
68               'closetext'     => 'Close',
69               'width'         => 763,
70               'height'        => 436,
71           )
72 %>
73   | <A HREF="<%$p%>search/qual.cgi?prospectnum=<% $prospect_main->prospectnum %>">View Qualifications</A>
74     <BR><BR>
75 % }
76
77 <% ntable("#cccccc") %>
78
79 <TR>
80   <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Tickets</FONT></TH>
81 </TR>
82
83 </TABLE>
84
85 <%init>
86
87 my $curuser = $FS::CurrentUser::CurrentUser;
88
89 die "access denied"
90   unless $curuser->access_right('View prospect');
91
92 my $prospectnum;
93 if ( $cgi->param('prospectnum') =~ /^(\d+)$/ ) {
94   $prospectnum = $1;
95 } else {
96   die "No prospect specified (bad URL)!" unless $cgi->keywords;
97   my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
98   $query =~ /^(\d+)$/;
99   $prospectnum = $1;
100 }
101
102 my $prospect_main = qsearchs( {
103   'table'     => 'prospect_main',
104   'hashref'   => { 'prospectnum' => $prospectnum },
105   'extra_sql' => ' AND '. $curuser->agentnums_sql,
106 });
107 die "Prospect not found!" unless $prospect_main;
108
109 my @agentnums = $curuser->agentnums;
110
111 </%init>