stray closing /TABLE in the no-ticket case
[freeside.git] / FS / FS / API.pm
index 77ae03b..6ca2b55 100644 (file)
@@ -66,6 +66,10 @@ Amount paid
 
 Option date for payment
 
+=item order_number
+
+Optional order number
+
 =back
 
 Example:
@@ -78,6 +82,7 @@ Example:
 
     #optional
     '_date'   => 1397977200, #UNIX timestamp
+    'order_number' => '12345',
   );
 
   if ( $result->{'error'} ) {
@@ -568,6 +573,8 @@ secret
 
 locationnum - pass this, or the following keys (don't pass both)
 
+locationname
+
 address1
 
 address2
@@ -580,8 +587,22 @@ state
 
 zip
 
+addr_clean
+
 country
 
+censustract
+
+censusyear
+
+location_type
+
+location_number
+
+location_kind
+
+incorporated
+
 On error, returns a hashref with an 'error' key.
 On success, returns a hashref with 'pkgnum' and 'locationnum' keys,
 containing the new values.
@@ -589,7 +610,7 @@ containing the new values.
 =cut
 
 sub change_package_location {
-  my $self = shift;
+  my $class = shift;
   my %opt  = @_;
   return _shared_secret_error() unless _check_shared_secret($opt{'secret'});
 
@@ -597,13 +618,27 @@ sub change_package_location {
     or return { 'error' => 'Unknown pkgnum' };
 
   my %changeopt;
-  $changeopt{'pkgnum'} = $pkgnum;
 
-  my $cust_location = FS::cust_location->new({
-    'custnum' => $cust_pkg->custnum,
-    %location_hash,
-  });
-  $changeopt{'cust_location'} = $cust_location;
+  foreach my $field ( qw(
+    locationnum
+    locationname
+    address1
+    address2
+    city
+    county
+    state
+    zip
+    addr_clean
+    country
+    censustract
+    censusyear
+    location_type
+    location_number
+    location_kind
+    incorporated
+  )) {
+    $changeopt{$field} = $opt{$field} if $opt{$field};
+  }
 
   $cust_pkg->API_change(%changeopt);
 }