add latitude/longitude to prospects, customers and package locations, RT#15539
[freeside.git] / httemplate / view / cust_main / packages / location.html
1 <TD CLASS="inv" BGCOLOR="<% $bgcolor %>" WIDTH="20%">
2
3 % unless ( $cust_pkg->locationnum ) {
4   <I><FONT SIZE=-1>(<% mt('default service address') |h %>)</FONT><BR>
5 % }
6
7     <% $loc->location_label( 'join_string'     => '<BR>',
8                              'double_space'    => ' &nbsp; ',
9                              'escape_function' => \&encode_entities,
10                              'countrydefault'  => $countrydefault,
11                            )
12     %>
13
14 %   if ( $loc->latitude && $loc->longitude ) {
15         <BR>
16         <FONT SIZE=-1>
17         <% $loc->latitude %>, <% $loc->longitude %>
18         <& /elements/coord-links.html,
19              $loc->latitude,
20              $loc->longitude,
21              $opt{'cust_main'}->name_short. ': '. $opt{'part_pkg'}->pkg
22         &>
23         </FONT>
24 %   }
25
26 % unless ( $cust_pkg->locationnum ) {
27   </I>
28 % }
29
30 % if ( ! $cust_pkg->get('cancel')
31 %      && $FS::CurrentUser::CurrentUser->access_right('Change customer package')
32 %    )
33 % {
34   <BR>
35   <FONT SIZE=-1>
36     (&nbsp;<%pkg_change_location_link($cust_pkg)%>&nbsp;)
37 %   if ( $cust_pkg->locationnum ) {
38         (&nbsp;<%edit_location_link($cust_pkg->locationnum)%>&nbsp;)
39 %   }
40   </FONT>
41 % } 
42
43 </TD>
44 <%init>
45
46 my $conf = new FS::Conf;
47 my %opt = @_;
48
49 my $bgcolor        = $opt{'bgcolor'};
50 my $cust_pkg       = $opt{'cust_pkg'};
51 my $countrydefault = $opt{'countrydefault'} || 'US';
52 my $statedefault   = $opt{'statedefault'}
53                      || ($countrydefault eq 'US' ? 'CA' : '');
54
55 my $loc = $cust_pkg->cust_location_or_main;
56
57 sub pkg_change_location_link {
58   my $cust_pkg = shift;
59   my $pkgpart = $cust_pkg->pkgpart;
60   include( '/elements/popup_link-cust_pkg.html',
61     'action'      => $p. "misc/change_pkg.cgi?locationnum=-1;pkgpart=$pkgpart;".
62                      "address1=;address2=;city=;county=;state=$statedefault;".
63                      "zip=;country=$countrydefault",
64     'label'       => emt('Change location'),
65     'actionlabel' => emt('Change'),
66     'cust_pkg'    => $cust_pkg,
67   );
68 }
69
70 sub edit_location_link {
71   my $locationnum = shift;
72   include( '/elements/popup_link.html',
73     'action'      => $p. "edit/cust_location.cgi?locationnum=$locationnum",
74     'label'       => emt('Edit location'),
75     'actionlabel' => emt('Edit'),
76   );
77 }
78
79 </%init>