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