diff options
| author | mark <mark> | 2010-11-23 01:39:01 +0000 | 
|---|---|---|
| committer | mark <mark> | 2010-11-23 01:39:01 +0000 | 
| commit | d7eafc9c9aae2bf47ea19a56cc5bb1380c5874e4 (patch) | |
| tree | 43591f1bd88a86f09ae5f71c645f1ee2cb75aa2f /FS | |
| parent | 0873b7a148165c2022e64832c36481fd4f943732 (diff) | |
selfservice command to suspend packages, RT#9989
Diffstat (limited to 'FS')
| -rw-r--r-- | FS/FS/ClientAPI/MyAccount.pm | 31 | ||||
| -rw-r--r-- | FS/FS/ClientAPI_XMLRPC.pm | 1 | ||||
| -rw-r--r-- | FS/FS/Conf.pm | 26 | 
3 files changed, 57 insertions, 1 deletions
| diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index 1e1d1d3b1..29e374c93 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -266,6 +266,9 @@ sub access_info {      @{ $info->{cust_paybys} }    ]; +  $info->{'self_suspend_reason'} =  +      $conf->config('selfservice-self_suspend_reason', $cust_main->agentnum); +    return { %$info,             'custnum'       => $custnum,             'access_pkgnum' => $session->{'pkgnum'}, @@ -1453,6 +1456,32 @@ sub order_renew {  } +sub suspend_pkg { +  my $p = shift; +  my $session = _cache->get($p->{'session_id'}) +    or return { 'error' => "Can't resume session" }; #better error message + +  my $custnum = $session->{'custnum'}; + +  my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) +    or return { 'error' => "unknown custnum $custnum" }; + +  my $conf = new FS::Conf; +  my $reasonnum =  +    $conf->config('selfservice-self_suspend_reason', $cust_main->agentnum) +      or return { 'error' => 'Permission denied' }; + +  my $pkgnum = $p->{'pkgnum'}; + +  my $cust_pkg = qsearchs('cust_pkg', { 'custnum' => $custnum, +                                        'pkgnum'  => $pkgnum,   } ) +    or return { 'error' => "unknown pkgnum $pkgnum" }; + +  my $error = $cust_pkg->suspend(reason => $reasonnum); +  return { 'error' => $error }; + +} +  sub cancel_pkg {    my $p = shift;    my $session = _cache->get($p->{'session_id'}) @@ -1469,7 +1498,7 @@ sub cancel_pkg {                                          'pkgnum'  => $pkgnum,   } )      or return { 'error' => "unknown pkgnum $pkgnum" }; -  my $error = $cust_pkg->cancel( 'quiet'=>1 ); +  my $error = $cust_pkg->cancel('quiet' => 1);    return { 'error' => $error };  } diff --git a/FS/FS/ClientAPI_XMLRPC.pm b/FS/FS/ClientAPI_XMLRPC.pm index 32e96b8e2..48b94eba2 100644 --- a/FS/FS/ClientAPI_XMLRPC.pm +++ b/FS/FS/ClientAPI_XMLRPC.pm @@ -91,6 +91,7 @@ sub ss2clientapi {    'renew_info'                => 'MyAccount/renew_info',    'order_renew'               => 'MyAccount/order_renew',    'cancel_pkg'                => 'MyAccount/cancel_pkg',    #add to ss cgi! +  'suspend_pkg'               => 'MyAccount/suspend_pkg',   #add to ss cgi!    'charge'                    => 'MyAccount/charge',        #?    'part_svc_info'             => 'MyAccount/part_svc_info',    'provision_acct'            => 'MyAccount/provision_acct', diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 1d946a5e8..08bdedd6f 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -2294,6 +2294,32 @@ and customer address. Include units.',    },    { +    'key'         => 'selfservice-self_suspend_reason', +    'section'     => 'self-service', +    'description' => 'Suspend reason when customers suspend their own packages. Set to nothing to disallow self-suspension.', +    'type'        => 'select-sub', +    'options_sub' => sub { require FS::Record; +                           require FS::reason; +                           my $type = qsearchs('reason_type',  +                             { class => 'S' })  +                              or return (); +			   map { $_->reasonnum => $_->reason } +                               FS::Record::qsearch('reason',  +                                 { reason_type => $type->typenum }  +                               ); +			 }, +    'option_sub'  => sub { require FS::Record; +                           require FS::reason; +			   my $reason = FS::Record::qsearchs( +			     'reason', { 'reasonnum' => shift } +			   ); +                           $reason ? $reason->reason : ''; +			 }, + +    'per_agent'   => 1, +  }, + +  {      'key'         => 'card_refund-days',      'section'     => 'billing',      'description' => 'After a payment, the number of days a refund link will be available for that payment.  Defaults to 120.', | 
