implement package changes w/location change, RT#4499
[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->address1 |h %><BR>
8
9 % if ( $loc->address2 !~ /^\s*$/ ) {
10     <% $loc->address2 |h %><BR>
11 % }
12
13   <% $loc->city |h %><% $loc->county ? ' ('.$loc->county.' county)' : '' |h %>,
14   <% $loc->state |h %> &nbsp; <% $loc->zip |h %><BR>
15
16 % if ( $loc->country ne $countrydefault ) {
17   <% code2country( $loc->country ) %>
18 % }
19
20   </I>
21
22 % if ($FS::CurrentUser::CurrentUser->access_right('Change customer package')) {
23   <FONT SIZE=-1>
24     (&nbsp;<%pkg_change_location_link($cust_pkg)%>&nbsp;)
25   </FONT>
26 % } 
27
28 </TD>
29 <%init>
30
31 my %opt = @_;
32
33 my $conf = new FS::Conf;
34
35 my $bgcolor        = $opt{'bgcolor'};
36 my $cust_pkg       = $opt{'cust_pkg'};
37 my $part_pkg       = $opt{'part_pkg'};
38 my $conf           = new FS::Conf;
39 my $countrydefault = $conf->config('countrydefault') || 'US';
40 my $statedefault   = $conf->config('statedefault')
41                      || ($countrydefault eq 'US' ? 'CA' : '');
42
43 my $loc = $cust_pkg->cust_location_or_main;
44
45 sub pkg_change_location_link {
46   my $cust_pkg = shift;
47   my $pkgpart = $cust_pkg->pkgpart;
48   include( '/elements/popup_link-cust_pkg.html',
49     'action'      => $p. "misc/change_pkg.cgi?locationnum=-1;pkgpart=$pkgpart;".
50                      "address1=;address2=;city=;county=;state=$statedefault;".
51                      "zip=;country=$countrydefault",
52     'label'       => 'Change&nbsp;location',
53     'actionlabel' => 'Change',
54     'cust_pkg'    => $cust_pkg,
55   );
56 }
57
58 </%init>