backoffice API: add location_info, RT#22830
[freeside.git] / FS / FS / API.pm
index 417f889..0bc0d08 100644 (file)
@@ -1,8 +1,9 @@
 package FS::API;
 
 use FS::Conf;
-use FS::Record qw( qsearchs );
+use FS::Record qw( qsearch qsearchs );
 use FS::cust_main;
+use FS::cust_location;
 
 =head1 NAME
 
@@ -40,7 +41,6 @@ Enter cash refund.
 
 #---
 
-#generally, the more useful data from the cust_main record the better.
 
 
 # "2 way syncing" ?  start with non-sync pulling info here, then if necessary
@@ -95,10 +95,14 @@ sub customer_info {
   $return{'postal_invoicing'} =
     0 < ( grep { $_ eq 'POST' } @invoicing_list );
 
+  #generally, the more useful data from the cust_main record the better.
+  # well, tell me what you want
+
   return \%return;
 
 }
 
+
 #I also monitor for changes to the additional locations that are applied to
 # packages, and would like for those to be exportable as well.  basically the
 # location data passed with the custnum.
@@ -112,7 +116,7 @@ sub location_info {
 
   my %return = (
     'error'           => '',
-    'locations'       => [ @cust_location ],
+    'locations'       => [ map $_->hashref, @cust_location ],
   );
 
   return \%return;