This commit was generated by cvs2svn to compensate for changes in r6255,
[freeside.git] / httemplate / edit / process / cust_credit_bill.cgi
index 3b75953..17f9fcb 100755 (executable)
@@ -1,4 +1,18 @@
-<%
+%if ( $error ) {
+%  $cgi->param('error', $error);
+<% $cgi->redirect(popurl(2). "cust_credit_bill.cgi?". $cgi->query_string ) %>
+%} else {
+<% header('Credit application sucessful') %>
+  <SCRIPT TYPE="text/javascript">
+    window.top.location.reload();
+  </SCRIPT>
+  </BODY>
+  </HTML>
+% } 
+<%init>
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Apply credit');
 
 $cgi->param('crednum') =~ /^(\d*)$/ or die "Illegal crednum!";
 my $crednum = $1;
@@ -33,20 +47,4 @@ if ($cgi->param('invnum') =~ /^Refund$/) {
 
 my $error = $new->insert;
 
-if ( $error ) {
-
-  $cgi->param('error', $error);
-  %><%= $cgi->redirect(popurl(2). "cust_credit_bill.cgi?". $cgi->query_string ) %><%
-
-} else {
-
-  #print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum");
-
-  %><%= header('Credit application sucessful') %>
-  <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
-  </SCRIPT>
-
-  </BODY></HTML>
-
-<% } %>
+</%init>