directions to customer address, #16585
[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              $opt{'cust_main'}->agentnum,
23         &>
24         </FONT>
25 %   }
26
27 % unless ( $cust_pkg->locationnum ) {
28   </I>
29 % }
30
31 % if ( ! $cust_pkg->get('cancel')
32 %      && $FS::CurrentUser::CurrentUser->access_right('Change customer package')
33 %    )
34 % {
35   <BR>
36   <FONT SIZE=-1>
37     (&nbsp;<%pkg_change_location_link($cust_pkg)%>&nbsp;)
38 %   if ( $cust_pkg->locationnum ) {
39         (&nbsp;<%edit_location_link($cust_pkg->locationnum)%>&nbsp;)
40 %   }
41   </FONT>
42 % } 
43
44 </TD>
45 <%init>
46
47 my $conf = new FS::Conf;
48 my %opt = @_;
49
50 my $bgcolor        = $opt{'bgcolor'};
51 my $cust_pkg       = $opt{'cust_pkg'};
52 my $countrydefault = $opt{'countrydefault'} || 'US';
53 my $statedefault   = $opt{'statedefault'}
54                      || ($countrydefault eq 'US' ? 'CA' : '');
55
56 my $loc = $cust_pkg->cust_location_or_main;
57
58 sub pkg_change_location_link {
59   my $cust_pkg = shift;
60   my $pkgpart = $cust_pkg->pkgpart;
61   include( '/elements/popup_link-cust_pkg.html',
62     'action'      => $p. "misc/change_pkg.cgi?locationnum=-1;pkgpart=$pkgpart;".
63                      "address1=;address2=;city=;county=;state=$statedefault;".
64                      "zip=;country=$countrydefault",
65     'label'       => emt('Change location'),
66     'actionlabel' => emt('Change'),
67     'cust_pkg'    => $cust_pkg,
68   );
69 }
70
71 sub edit_location_link {
72   my $locationnum = shift;
73   include( '/elements/popup_link.html',
74     'action'      => $p. "edit/cust_location.cgi?locationnum=$locationnum",
75     'label'       => emt('Edit location'),
76     'actionlabel' => emt('Edit'),
77   );
78 }
79
80 </%init>