cust_location editing features, RT#10766
[freeside.git] / httemplate / view / cust_main / packages / location.html
1 <TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
2
3 % unless ( $cust_pkg->locationnum ) {
4   <I><FONT SIZE=-1>(default service address)</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 % unless ( $cust_pkg->locationnum ) {
15   </I>
16 % }
17
18 % if ( ! $cust_pkg->get('cancel')
19 %      && $FS::CurrentUser::CurrentUser->access_right('Change customer package')
20 %    )
21 % {
22   <FONT SIZE=-1>
23     (&nbsp;<%pkg_change_location_link($cust_pkg)%>&nbsp;)
24 %   if ( $cust_pkg->locationnum ) {
25 &nbsp;(&nbsp;<%edit_location_link($cust_pkg->locationnum)%>&nbsp;)
26 %   }
27   </FONT>
28 % } 
29
30 </TD>
31 <%init>
32
33 my $conf = new FS::Conf;
34 my %opt = @_;
35
36 my $bgcolor        = $opt{'bgcolor'};
37 my $cust_pkg       = $opt{'cust_pkg'};
38 my $countrydefault = $opt{'countrydefault'} || 'US';
39 my $statedefault   = $opt{'statedefault'}
40                      || ($countrydefault eq 'US' ? 'CA' : '');
41
42 my $loc = $cust_pkg->cust_location_or_main;
43
44 sub pkg_change_location_link {
45   my $cust_pkg = shift;
46   my $pkgpart = $cust_pkg->pkgpart;
47   include( '/elements/popup_link-cust_pkg.html',
48     'action'      => $p. "misc/change_pkg.cgi?locationnum=-1;pkgpart=$pkgpart;".
49                      "address1=;address2=;city=;county=;state=$statedefault;".
50                      "zip=;country=$countrydefault",
51     'label'       => 'Change&nbsp;location',
52     'actionlabel' => 'Change',
53     'cust_pkg'    => $cust_pkg,
54   );
55 }
56
57 sub edit_location_link {
58   my $locationnum = shift;
59   include( '/elements/popup_link.html',
60     'action'      => $p. "edit/cust_location.cgi?locationnum=$locationnum",
61     'label'       => 'Edit&nbsp;location',
62     'actionlabel' => 'Edit',
63   );
64 }
65
66 </%init>