invoice_sections_with_taxes per-agent, RT#79636
[freeside.git] / httemplate / elements / coord-links.html
1 <& /elements/init_overlib.html &>
2
3 <& /elements/popup_link.html,
4      'action'      => $p. 'view/map.html?'. $query,
5      'label'       => mt('map'),
6      'actionlabel' => $js_name,
7      'width'       => 763,
8      'height'      => 575,
9      #'color'
10 &>
11
12 % if ( $origin ) {
13   <& /elements/popup_link.html,
14       'action'      => $p. "view/directions.html?origin=$origin;". $query,
15       'label'       => mt('directions'),
16       'actionlabel' => $js_name,
17       'width'       => 763,
18       'height'      => 575,
19   &>
20 % }
21
22 <A HREF="<%$p%>view/kml.cgi?<% $query %>"><% mt('earth') |h %></A>
23
24 <%init>
25
26 my %opt = ();
27 my ($latitude, $longitude, $name, $agentnum);
28 if ( ref($_[0]) ) {
29   %opt = %{ $_[0] };
30   $latitude  = $opt{latitude};
31   $longitude = $opt{longitude};
32   $name      = $opt{name};
33   $agentnum  = $opt{agentnum};
34 } else {
35   ($latitude, $longitude, $name, $agentnum) = @_;
36 }
37
38 my $query = 'name='. uri_escape_utf8($name).
39             ';lat='. $latitude.
40             ';lon='. $longitude;
41
42 my $js_name = $name;
43 $js_name =~ s/[<>"']/ /g;
44 $m->interp->apply_escapes($js_name, 'js_string');
45 $js_name =~ s/^'//;
46 $js_name =~ s/'$//;
47
48 my $conf = new FS::Conf;
49 my $apikey = $conf->config('google_maps_api_key');
50
51 #for directions link
52 my @origin = $opt{company_address}
53                ? @{ $opt{company_address} }
54                : ( $conf->config('company_physical_address', $agentnum) 
55                    ? $conf->config('company_physical_address', $agentnum)
56                    : $conf->config('company_address', $agentnum) );
57 my $origin = uri_escape(join(',', @origin));
58
59 </%init>