UX: add status to package actions, redirect back to package tab
[freeside.git] / httemplate / misc / unsusp_pkg.cgi
index 5008729..ad7effc 100755 (executable)
@@ -1,4 +1,21 @@
-<%
+%if ( $error ) {
+%  errorpage($error);
+%} else {
+%  my $cookie = CGI::Cookie->new( -name    => 'freeside_status',
+%                                 -value   => mt('Package unsuspended'),
+%                                 -expires => '+5m',
+%                               );
+% #$r->headers_out->add( 'Set-Cookie' => $cookie->as_string );
+<% $cgi->redirect(
+     -uri => popurl(2). "view/cust_main.cgi?show=packages;custnum=".$cust_pkg->getfield('custnum'),
+     -cookie => $cookie
+  )
+%>
+%}
+<%init>
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Unsuspend customer package');
 
 #untaint pkgnum
 my ($query) = $cgi->keywords;
@@ -8,8 +25,5 @@ my $pkgnum = $1;
 my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
 
 my $error = $cust_pkg->unsuspend;
-&eidiot($error) if $error;
 
-print $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum'));
-
-%>
+</%init>