This commit was generated by cvs2svn to compensate for changes in r6252,
[freeside.git] / httemplate / edit / cust_credit_bill.cgi
index 26c1126..59a74b2 100755 (executable)
@@ -1,9 +1,6 @@
-<%  header("Apply Credit", '') %>
+<% include('/elements/header-popup.html', 'Apply 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_bill.cgi" METHOD=POST>
 
@@ -21,12 +18,6 @@ Credit #<B><% $crednum %></B>
 <SCRIPT>
 function changed(what) {
   cust_bill = what.options[what.selectedIndex].value;
-% foreach my $cust_bill ( @cust_bill ) {
-%  my $invnum = $cust_bill->invnum;
-%  my $changeto = $cust_bill->owed < $cust_credit->credited
-%                   ? $cust_bill->owed 
-%                   : $cust_credit->credited;
-%
 
 % foreach my $cust_bill ( @cust_bill ) {
 
@@ -44,7 +35,6 @@ function changed(what) {
 
 <BR>Invoice #<SELECT NAME="invnum" SIZE=1 onChange="changed(this)">
 <OPTION VALUE="">
-% foreach my $cust_bill ( @cust_bill ) { 
 
 % foreach my $cust_bill ( @cust_bill ) { 
   <OPTION<% $cust_bill->invnum eq $invnum ? ' SELECTED' : '' %> VALUE="<% $cust_bill->invnum %>"><% $cust_bill->invnum %> - <% time2str("%D",$cust_bill->_date) %> - $<% $cust_bill->owed %>
@@ -63,6 +53,10 @@ function changed(what) {
 </HTML>
 
 <%init>
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Apply credit');
+
 my($crednum, $amount, $invnum);
 if ( $cgi->param('error') ) {
   #$cust_credit_bill = new FS::cust_credit_bill ( {
@@ -95,6 +89,5 @@ my @cust_bill = sort {    $a->_date  <=> $b->_date
                      }
                 grep { $_->owed != 0 }
                 qsearch('cust_bill', { 'custnum' => $cust_credit->custnum } );
-</%init>
-
 
+</%init>