[freeside-commits] freeside/FS/FS/ClientAPI MyAccount.pm, 1.113, 1.113.2.1
Mark Wells
mark at wavetail.420.am
Mon Nov 22 17:40:14 PST 2010
Update of /home/cvs/cvsroot/freeside/FS/FS/ClientAPI
In directory wavetail.420.am:/tmp/cvs-serv9505/FS/FS/ClientAPI
Modified Files:
Tag: FREESIDE_2_1_BRANCH
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.113.2.1
diff -u -w -d -r1.113 -r1.113.2.1
--- MyAccount.pm 5 Oct 2010 01:53:55 -0000 1.113
+++ MyAccount.pm 23 Nov 2010 01:40:12 -0000 1.113.2.1
@@ -266,6 +266,9 @@
@{ $info->{cust_paybys} }
];
+ $info->{'self_suspend_reason'} =
+ $conf->config('selfservice-self_suspend_reason');
+
return { %$info,
'custnum' => $custnum,
'access_pkgnum' => $session->{'pkgnum'},
@@ -1453,8 +1456,18 @@
}
-sub cancel_pkg {
+# these are basically the same
+sub cancel_pkg { alter_pkg(shift, 'cancel', 'quiet' => 1) }
+sub suspend_pkg {
+ my $conf = new FS::Conf;
+ my $reasonnum = $conf->config('selfservice-self_suspend_reason')
+ or return { 'error' => "Permission denied" };
+ alter_pkg(shift, 'suspend', 'reason' => $reasonnum)
+}
+
+sub alter_pkg {
my $p = shift;
+ my $method = shift;
my $session = _cache->get($p->{'session_id'})
or return { 'error' => "Can't resume session" }; #better error message
@@ -1469,7 +1482,7 @@
'pkgnum' => $pkgnum, } )
or return { 'error' => "unknown pkgnum $pkgnum" };
- my $error = $cust_pkg->cancel( 'quiet'=>1 );
+ my $error = $cust_pkg->$method(@_);
return { 'error' => $error };
}
More information about the freeside-commits
mailing list