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