prospecting: proper contact error handling when you add a prospect
[freeside.git] / httemplate / misc / cancel-unaudited.cgi
1 %if ( $error ) {
2 %  errorpage($error);
3 %} else {
4 <% $cgi->redirect(popurl(2)) %>
5 %}
6
7 <%init>
8
9 die "access denied"
10   unless $FS::CurrentUser::CurrentUser->access_right('Unprovision customer service')
11       && $FS::CurrentUser::CurrentUser->access_right('View/link unlinked services');
12
13 #untaint svcnum
14 my($query) = $cgi->keywords;
15 $query =~ /^(\d+)$/;
16 my $svcnum = $1;
17
18 #my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum});
19 #die "Unknown svcnum!" unless $svc_acct;
20
21 my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum});
22 die "Unknown svcnum!" unless $cust_svc;
23 my $cust_pkg = $cust_svc->cust_pkg;
24 if ( $cust_pkg ) {
25   errorpage( 'This account has already been audited.  Cancel the '.
26            qq!<A HREF="${p}view/cust_main.cgi?!. $cust_pkg->custnum.
27            '#cust_pkg'. $cust_pkg->pkgnum. '">'.
28            'package</A> instead.');
29 }
30
31 my $error = $cust_svc->cancel;
32
33 </%init>