[freeside-commits] freeside/FS/FS/ClientAPI MyAccount.pm, 1.113, 1.114
Mark Wells
mark at wavetail.420.am
Mon Nov 22 17:39:03 PST 2010
Update of /home/cvs/cvsroot/freeside/FS/FS/ClientAPI
In directory wavetail.420.am:/tmp/cvs-serv9277/FS/FS/ClientAPI
Modified Files:
MyAccount.pm
Log Message:
selfservice command to suspend packages, RT#9989
Index: MyAccount.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/ClientAPI/MyAccount.pm,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -w -d -r1.113 -r1.114
--- MyAccount.pm 5 Oct 2010 01:53:55 -0000 1.113
+++ MyAccount.pm 23 Nov 2010 01:39:01 -0000 1.114
@@ -266,6 +266,9 @@
@{ $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 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'})
More information about the freeside-commits
mailing list