This commit was generated by cvs2svn to compensate for changes in r6255,
[freeside.git] / httemplate / edit / cust_credit.cgi
index 13d062c..36109cf 100755 (executable)
@@ -1,11 +1,8 @@
 <% include('/elements/header-popup.html', 'Enter Credit') %>
 
-% if ( $cgi->param('error') ) { 
-  <FONT SIZE="+1" COLOR="#ff0000">Error: <% $cgi->param('error') %></FONT>
-  <BR><BR>
-% } 
+<% include('/elements/error.html') %>
 
-<FORM ACTION="<% $p1 %>process/cust_credit.cgi" METHOD=POST>
+<FORM NAME="credit_popup" ACTION="<% $p1 %>process/cust_credit.cgi" METHOD=POST>
 <INPUT TYPE="hidden" NAME="crednum" VALUE="">
 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
 <INPUT TYPE="hidden" NAME="paybatch" VALUE="">
@@ -30,10 +27,12 @@ Credit
 %#print qq! <INPUT TYPE="checkbox" NAME="refund" VALUE="$refund">Also post refund!;
 %
 
-  <TR>
-    <TD ALIGN="right">Reason</TD>
-    <TD BGCOLOR="#ffffff"><INPUT TYPE="text" NAME="reason" VALUE="<% $reason %>" SIZE=32></TD>
-  </TR>
+<% include('/elements/tr-select-reason.html',
+           'field'          => 'reasonnum',
+           'reason_class'   => 'R',
+           'control_button' => 'document.credit_popup.submit',
+          )
+%>
 
   <TR>
     <TD ALIGN="right">Auto-apply<BR>to invoices</TD>
@@ -49,12 +48,16 @@ Credit
 </FORM>
 </BODY>
 </HTML>
-
 <%once>
+
 my $conf = new FS::Conf;
-</%once>
 
+</%once>
 <%init>
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Post credit');
+
 my($custnum, $amount, $reason);
 if ( $cgi->param('error') ) {
   #$cust_credit = new FS::cust_credit ( {
@@ -77,4 +80,5 @@ my $_date = time;
 my $otaker = getotaker;
 
 my $p1 = popurl(1);
+
 </%init>