cust_location editing features, RT#10766
[freeside.git] / httemplate / view / cust_main / packages / package.html
index 3b58f9e..8cae5fd 100644 (file)
 %       }
 
       </TR>
+%     if ( $curuser->access_right('Change customer package') and 
+%           !$cust_pkg->get('cancel') and
+%           !$opt{'show_location'}) {
+      <TR>
+        <TD><FONT SIZE="-1">
+          (&nbsp;<% pkg_change_location_link($cust_pkg) %>&nbsp;)
+        </FONT></TD>
+      </TR>
+%     }
 %   }
-
   </TABLE>
 
 </TD>
@@ -184,6 +192,10 @@ my $part_pkg = $opt{'part_pkg'};
 
 my $curuser = $FS::CurrentUser::CurrentUser;
 
+my $countrydefault = $opt{'countrydefault'} || 'US';
+my $statedefault   = $opt{'statedefault'}
+                     || ($countrydefault eq 'US' ? 'CA' : '');
+
 #subroutines
 
 #false laziness w/status.html
@@ -204,6 +216,19 @@ sub pkg_change_link {
   );
 }
 
+sub pkg_change_location_link {
+  my $cust_pkg = shift;
+  my $pkgpart = $cust_pkg->pkgpart;
+  include( '/elements/popup_link-cust_pkg.html',
+    'action'      => $p. "misc/change_pkg.cgi?locationnum=-1;pkgpart=$pkgpart;".
+                     "address1=;address2=;city=;county=;state=$statedefault;".
+                     "zip=;country=$countrydefault",
+    'label'       => 'Change&nbsp;location',
+    'actionlabel' => 'Change',
+    'cust_pkg'    => $cust_pkg,
+  );
+}
+
 sub pkg_dates_link { pkg_link('edit/REAL_cust_pkg', 'Edit&nbsp;dates', @_ ); }
 
 sub pkg_discount_link {