[freeside-commits] branch FREESIDE_3_BRANCH updated. dec15062e2df6f615e42d5f87193133a3e072826

Ivan ivan at 420.am
Mon Jul 24 23:59:57 PDT 2017


The branch, FREESIDE_3_BRANCH has been updated
       via  dec15062e2df6f615e42d5f87193133a3e072826 (commit)
       via  33cf0327e669dc03e9a33273eb082dd821d43347 (commit)
      from  2e9cc46750e02ecf9dfabe04283d98d8afa86c26 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit dec15062e2df6f615e42d5f87193133a3e072826
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon Jul 24 23:59:55 2017 -0700

    new backoffice API call customer_list_svcs

diff --git a/FS/FS/API.pm b/FS/FS/API.pm
index 4ff1a3a..39a959a 100644
--- a/FS/FS/API.pm
+++ b/FS/FS/API.pm
@@ -724,6 +724,41 @@ sub customer_info {
 }
 
 
+=item customer_list_svcs OPTION => VALUE, ...
+
+Returns customer service information.  Takes a list of keys and values as
+parameters with the following keys: custnum, secret
+
+=cut
+
+sub customer_list_svcs {
+  my( $class, %opt ) = @_;
+  return _shared_secret_error() unless _check_shared_secret($opt{secret});
+
+  my $cust_main = qsearchs('cust_main', { 'custnum' => $opt{custnum} })
+    or return { 'error' => 'Unknown custnum' };
+
+  #$cust_main->API_list_svcs;
+
+  #false laziness w/ClientAPI/list_svcs
+
+  my @cust_svc = ();
+  #my @cust_pkg_usage = ();
+  #foreach my $cust_pkg ( $p->{'ncancelled'} 
+  #                       ? $cust_main->ncancelled_pkgs
+  #                       : $cust_main->unsuspended_pkgs ) {
+  foreach my $cust_pkg ( $cust_main->all_pkgs ) {
+    #next if $pkgnum && $cust_pkg->pkgnum != $pkgnum;
+    push @cust_svc, @{[ $cust_pkg->cust_svc ]}; #@{[ ]} to force array context
+    #push @cust_pkg_usage, $cust_pkg->cust_pkg_usage;
+  }
+
+  return {
+    'cust_svc' => [ map $_->API_getinfo, @cust_svc ],
+  };
+
+}
+
 =item location_info
 
 Returns location specific information for the customer. Takes a list of keys
diff --git a/FS/FS/cust_svc.pm b/FS/FS/cust_svc.pm
index 1390f07..e64862f 100644
--- a/FS/FS/cust_svc.pm
+++ b/FS/FS/cust_svc.pm
@@ -1083,7 +1083,7 @@ sub API_getinfo {
   my $self = shift;
   my $svc_x = $self->svc_x;
  +{ ( map { $_=>$self->$_ } $self->fields ),
-    ( map { $svc_x=>$svc_x->$_ } $svc_x->fields ),
+    ( map { $_=>$svc_x->$_ } $svc_x->fields ),
   };
 }
 
diff --git a/bin/xmlrpc-customer_list_svcs b/bin/xmlrpc-customer_list_svcs
new file mode 100755
index 0000000..cdfb51e
--- /dev/null
+++ b/bin/xmlrpc-customer_list_svcs
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+use strict;
+use Frontier::Client;
+use Data::Dumper;
+
+my $uri = new URI 'http://localhost:8008/';
+
+my $server = new Frontier::Client ( 'url' => $uri );
+
+my $result = $server->call(
+  'FS.API.customer_list_svcs',
+    'secret'  => 'sharingiscaring',
+    'custnum' => 181318,
+);
+
+#die $result->{'error'} if $result->{'error'};
+
+#print Dumper($result);
+
+foreach my $cust_svc ( @{ $result->{'cust_svc'} } ) {
+  #print $cust_svc->{mac_addr}."\n" if exists $cust_svc->{mac_addr};
+  print $cust_svc->{circuit_id}."\n" if exists $cust_svc->{circuit_id};
+}
+
+1;

commit 33cf0327e669dc03e9a33273eb082dd821d43347
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon Jul 24 23:58:38 2017 -0700

    backport API_getinfo, RT#76831

diff --git a/FS/FS/cust_svc.pm b/FS/FS/cust_svc.pm
index 511fcf3..1390f07 100644
--- a/FS/FS/cust_svc.pm
+++ b/FS/FS/cust_svc.pm
@@ -1079,6 +1079,13 @@ sub tickets {
   (@tickets);
 }
 
+sub API_getinfo {
+  my $self = shift;
+  my $svc_x = $self->svc_x;
+ +{ ( map { $_=>$self->$_ } $self->fields ),
+    ( map { $svc_x=>$svc_x->$_ } $svc_x->fields ),
+  };
+}
 
 =back
 

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/API.pm                                       |   35 ++++++++++++++++++++
 FS/FS/cust_svc.pm                                  |    7 ++++
 ...pc-insert_payment => xmlrpc-customer_list_svcs} |   14 ++++----
 3 files changed, 49 insertions(+), 7 deletions(-)
 copy bin/{xmlrpc-insert_payment => xmlrpc-customer_list_svcs} (55%)




More information about the freeside-commits mailing list