diff options
author | Ivan Kohler <ivan@freeside.biz> | 2017-07-24 23:59:55 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2017-07-24 23:59:55 -0700 |
commit | dec15062e2df6f615e42d5f87193133a3e072826 (patch) | |
tree | d78752b21fe4de7f14e4cdf4ceaec240d0cb0349 /FS | |
parent | 33cf0327e669dc03e9a33273eb082dd821d43347 (diff) |
new backoffice API call customer_list_svcs
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/API.pm | 35 | ||||
-rw-r--r-- | FS/FS/cust_svc.pm | 2 |
2 files changed, 36 insertions, 1 deletions
diff --git a/FS/FS/API.pm b/FS/FS/API.pm index 4ff1a3ab5..39a959ade 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 1390f0750..e64862f9d 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 ), }; } |