add svc_status_hash to selfservice, RT#15987
authorivan <ivan>
Thu, 9 Feb 2012 08:38:27 +0000 (08:38 +0000)
committerivan <ivan>
Thu, 9 Feb 2012 08:38:27 +0000 (08:38 +0000)
FS/FS/ClientAPI/MyAccount.pm
FS/FS/ClientAPI_XMLRPC.pm
fs_selfservice/FS-SelfService/SelfService.pm

index 563bf9c..30def4a 100644 (file)
@@ -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;
 
index f1988bf..1e068f4 100644 (file)
@@ -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',   
index 713326f..0686c3d 100644 (file)
@@ -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',