From: ivan Date: Thu, 9 Feb 2012 08:38:24 +0000 (+0000) Subject: add svc_status_hash to selfservice, RT#15987 X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=f1bf0c7fa7486b919f527d319afe276ff7f29aea;hp=1a5d9948188d5ebcb2bfb98b37936f5d6670b6ff;p=freeside.git add svc_status_hash to selfservice, RT#15987 --- diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index 563bf9cf3..30def4a7f 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -1543,6 +1543,39 @@ sub svc_status_html { } +sub svc_status_hash { + my $p = shift; + + my($context, $session, $custnum) = _custoragent_session_custnum($p); + return { 'error' => $session } if $context eq 'error'; + + #XXX only svc_acct for now + my $svc_x = _customer_svc_x( $custnum, $p->{'svcnum'}, 'svc_acct') + or return { 'error' => "Service not found" }; + + my ( $html, $hashref ) = $svc_x->export_getstatus; + return $hashref; + +} + +sub set_svc_status_hash { + my $p = shift; + + my($context, $session, $custnum) = _custoragent_session_custnum($p); + return { 'error' => $session } if $context eq 'error'; + + #XXX only svc_acct for now + my $svc_x = _customer_svc_x( $custnum, $p->{'svcnum'}, 'svc_acct') + or return { 'error' => "Service not found" }; + + my $error = $svc_x->export_setstatus($p); #$p? returns error? + return { 'error' => $error } if $error; + + return {}; #? { 'error' => '' } + +} + + sub acct_forward_info { my $p = shift; diff --git a/FS/FS/ClientAPI_XMLRPC.pm b/FS/FS/ClientAPI_XMLRPC.pm index f1988bff4..1e068f428 100644 --- a/FS/FS/ClientAPI_XMLRPC.pm +++ b/FS/FS/ClientAPI_XMLRPC.pm @@ -121,6 +121,8 @@ sub ss2clientapi { 'list_svcs' => 'MyAccount/list_svcs', #add to ss (added?) 'list_svc_usage' => 'MyAccount/list_svc_usage', 'svc_status_html' => 'MyAccount/svc_status_html', + 'svc_status_hash' => 'MyAccount/svc_status_hash', + 'set_svc_status_hash' => 'MyAccount/set_svc_status_hash', 'acct_forward_info' => 'MyAccount/acct_forward_info', 'process_acct_forward' => 'MyAccount/process_acct_forward', 'list_dsl_devices' => 'MyAccount/list_dsl_devices', diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm index 713326f97..0686c3d0f 100644 --- a/fs_selfservice/FS-SelfService/SelfService.pm +++ b/fs_selfservice/FS-SelfService/SelfService.pm @@ -53,6 +53,8 @@ $socket .= '.'.$tag if defined $tag && length($tag); 'list_svcs' => 'MyAccount/list_svcs', #add to ss (added?) 'list_svc_usage' => 'MyAccount/list_svc_usage', 'svc_status_html' => 'MyAccount/svc_status_html', + 'svc_status_hash' => 'MyAccount/svc_status_hash', + 'set_svc_status_hash' => 'MyAccount/set_svc_status_hash', 'acct_forward_info' => 'MyAccount/acct_forward_info', 'process_acct_forward' => 'MyAccount/process_acct_forward', 'list_dsl_devices' => 'MyAccount/list_dsl_devices',