[freeside-commits] freeside/httemplate/edit cust_bill_pay.cgi, 1.15.2.3, 1.15.2.4 cust_credit_bill.cgi, 1.14.2.3, 1.14.2.4 cust_pay_refund.cgi, NONE, 1.1.2.2 cust_credit_refund.cgi, NONE, 1.1.2.2

Ivan,,, ivan at wavetail.420.am
Wed Jun 4 22:07:57 PDT 2008


Update of /home/cvs/cvsroot/freeside/httemplate/edit
In directory wavetail.420.am:/tmp/cvs-serv21780/httemplate/edit

Modified Files:
      Tag: FREESIDE_1_7_BRANCH
	cust_bill_pay.cgi cust_credit_bill.cgi 
Added Files:
      Tag: FREESIDE_1_7_BRANCH
	cust_pay_refund.cgi cust_credit_refund.cgi 
Log Message:
payment and credit applications have separate "apply to refund" choices now, and no auto-refund choice in the invoice dropdown.  RT#3545

Index: cust_bill_pay.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/cust_bill_pay.cgi,v
retrieving revision 1.15.2.3
retrieving revision 1.15.2.4
diff -u -d -r1.15.2.3 -r1.15.2.4
--- cust_bill_pay.cgi	13 Jan 2008 21:41:06 -0000	1.15.2.3
+++ cust_bill_pay.cgi	5 Jun 2008 05:07:55 -0000	1.15.2.4
@@ -1,87 +1,14 @@
-<% include('/elements/header-popup.html', 'Apply Payment') %>
-
-<% include('/elements/error.html') %>
-
-<FORM ACTION="<% $p1 %>process/cust_bill_pay.cgi" METHOD=POST>
-
-Payment #<B><% $paynum %></B>
-<INPUT TYPE="hidden" NAME="paynum" VALUE="<% $paynum %>">
-
-<BR>Date: <B><% time2str("%D", $cust_pay->_date) %></B>
-
-<BR>Amount: $<B><% $cust_pay->paid %></B>
-
-<BR>Unapplied amount: $<B><% $unapplied %></B>
-
-<SCRIPT TYPE="text/javascript">
-function changed(what) {
-  cust_bill = what.options[what.selectedIndex].value;
-
-% foreach my $cust_bill ( @cust_bill ) {
-
-    if ( cust_bill == <% $cust_bill->invnum %> ) {
-      what.form.amount.value = "<% min($cust_bill->owed, $unapplied) %>";
-    }
-
-% } 
-
-  if ( cust_bill == "Refund" ) {
-    what.form.amount.value = "<% $unapplied %>";
-  }
-}
-</SCRIPT>
-
-<BR>Invoice #<SELECT NAME="invnum" SIZE=1 onChange="changed(this)">
-<OPTION VALUE="">
-
-% 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 %>
-% } 
-
-<OPTION VALUE="Refund">Refund
-</SELECT>
-
-<BR>Amount $<INPUT TYPE="text" NAME="amount" VALUE="<% $amount %>" SIZE=8 MAXLENGTH=8>
-
-<BR>
-<CENTER><INPUT TYPE="submit" VALUE="Apply"></CENTER>
-
-</FORM>
-
-<% include('/elements/footer.html') %>
-
+<% include('elements/ApplicationCommon.html',
+     'form_action' => 'process/cust_bill_pay.cgi',
+     'src_table'   => 'cust_pay',
+     'src_thing'   => 'payment',
+     'dst_table'   => 'cust_bill',
+     'dst_thing'   => 'invoice',
+   )
+%>
 <%init>
 
 die "access denied"
-  unless $FS::CurrentUser::CurrentUser->access_right('Apply payment') #;
-      || $FS::CurrentUser::CurrentUser->access_right('Post payment'); #remove after 1.7.3
-
-my($paynum, $amount, $invnum);
-if ( $cgi->param('error') ) {
-  $paynum = $cgi->param('paynum');
-  $amount = $cgi->param('amount');
-  $invnum = $cgi->param('invnum');
-} else {
-  my($query) = $cgi->keywords;
-  $query =~ /^(\d+)$/;
-  $paynum = $1;
-  $amount = '';
-  $invnum = '';
-}
-
-my $otaker = getotaker;
-
-my $p1 = popurl(1);
-
-my $cust_pay = qsearchs('cust_pay', { 'paynum' => $paynum } );
-die "payment $paynum not found!" unless $cust_pay;
-
-my $unapplied = $cust_pay->unapplied;
-
-my @cust_bill = sort {    $a->_date  <=> $b->_date
-                       or $a->invnum <=> $b->invnum
-                     }
-                grep { $_->owed != 0 }
-                qsearch('cust_bill', { 'custnum' => $cust_pay->custnum } );
+  unless $FS::CurrentUser::CurrentUser->access_right('Apply payment');
 
 </%init>

--- NEW FILE: cust_pay_refund.cgi ---
<% include('elements/ApplicationCommon.html',
     'form_action' => 'process/cust_pay_refund.cgi',
     'src_table'   => 'cust_pay',
     'src_thing'   => 'payment',
     'dst_table'   => 'cust_refund',
     'dst_thing'   => 'refund',
   )
%>
<%init>

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Apply payment');

</%init>

--- NEW FILE: cust_credit_refund.cgi ---
<% include('elements/ApplicationCommon.html',
     'form_action' => 'process/cust_credit_refund.cgi',
     'src_table'   => 'cust_credit',
     'src_thing'   => 'credit',
     'dst_table'   => 'cust_refund',
     'dst_thing'   => 'refund',
   )
%>
<%init>

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Apply credit');

</%init>

Index: cust_credit_bill.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/cust_credit_bill.cgi,v
retrieving revision 1.14.2.3
retrieving revision 1.14.2.4
diff -u -d -r1.14.2.3 -r1.14.2.4
--- cust_credit_bill.cgi	13 Jan 2008 21:43:26 -0000	1.14.2.3
+++ cust_credit_bill.cgi	5 Jun 2008 05:07:55 -0000	1.14.2.4
@@ -1,94 +1,14 @@
-<% include('/elements/header-popup.html', 'Apply Credit') %>
-
-<% include('/elements/error.html') %>
-
-<FORM ACTION="<% $p1 %>process/cust_credit_bill.cgi" METHOD=POST>
-
-Credit #<B><% $crednum %></B>
-<INPUT TYPE="hidden" NAME="crednum" VALUE="<% $crednum %>">
-
-<BR>Date: <B><% time2str("%D", $cust_credit->_date) %></B>
-
-<BR>Amount: $<B><% $cust_credit->amount %></B>
-
-<BR>Unapplied amount: $<B><% $credited %></B>
-
-<BR>Reason: <B><% $cust_credit->reason %></B>
-
-<SCRIPT>
-function changed(what) {
-  cust_bill = what.options[what.selectedIndex].value;
-
-% foreach my $cust_bill ( @cust_bill ) {
-
-  if ( cust_bill == <% $cust_bill->invnum %> ) {
-    what.form.amount.value = "<% min($cust_bill->owed, $credited) %>";
-  }
-
-% } 
-
-  if ( cust_bill == "Refund" ) {
-    what.form.amount.value = "<% $credited %>";
-  }
-}
-</SCRIPT>
-
-<BR>Invoice #<SELECT NAME="invnum" SIZE=1 onChange="changed(this)">
-<OPTION VALUE="">
-
-% 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 %>
-% } 
-
-<OPTION VALUE="Refund">Refund
-</SELECT>
-
-<BR>Amount $<INPUT TYPE="text" NAME="amount" VALUE="<% $amount %>" SIZE=8 MAXLENGTH=8>
-
-<BR>
-<CENTER><INPUT TYPE="submit" VALUE="Apply"></CENTER>
-
-</FORM>
-</BODY>
-</HTML>
-
+<% include('elements/ApplicationCommon.html',
+     'form_action' => 'process/cust_credit_bill.cgi',
+     'src_table'   => 'cust_credit',
+     'src_thing'   => 'credit',
+     'dst_table'   => 'cust_bill',
+     'dst_thing'   => 'invoice',
+   )
+%>
 <%init>
 
 die "access denied"
-  unless $FS::CurrentUser::CurrentUser->access_right('Apply credit') #;
-      || $FS::CurrentUser::CurrentUser->access_right('Post credit'); #remove after 1.7.3
-
-my($crednum, $amount, $invnum);
-if ( $cgi->param('error') ) {
-  #$cust_credit_bill = new FS::cust_credit_bill ( {
-  #  map { $_, scalar($cgi->param($_)) } fields('cust_credit_bill')
-  #} );
-  $crednum = $cgi->param('crednum');
-  $amount = $cgi->param('amount');
-  #$refund = $cgi->param('refund');
-  $invnum = $cgi->param('invnum');
-} else {
-  my($query) = $cgi->keywords;
-  $query =~ /^(\d+)$/;
-  $crednum = $1;
-  $amount = '';
-  #$refund = 'yes';
-  $invnum = '';
-}
-
-my $otaker = getotaker;
-
-my $p1 = popurl(1);
-
-my $cust_credit = qsearchs('cust_credit', { 'crednum' => $crednum } );
-die "credit $crednum not found!" unless $cust_credit;
-
-my $credited = $cust_credit->credited;
-
-my @cust_bill = sort {    $a->_date  <=> $b->_date
-                       or $a->invnum <=> $b->invnum
-                     }
-                grep { $_->owed != 0 }
-                qsearch('cust_bill', { 'custnum' => $cust_credit->custnum } );
+  unless $FS::CurrentUser::CurrentUser->access_right('Apply credit');
 
 </%init>



More information about the freeside-commits mailing list