freeside/FS/FS cust_main.pm,1.156,1.157
ivan
ivan at pouncequick.420.am
Thu Jul 1 06:49:40 PDT 2004
- Previous message: freeside/FS/FS/ClientAPI MyAccount.pm,1.24,1.25
- Next message: freeside/install/5.005/Net-Whois-Raw COPYRIGHT,1.1,NONE Changes,1.1,NONE MANIFEST,1.1,NONE META.yml,1.1,NONE Makefile.PL,1.1,NONE README,1.1,NONE pwhois,1.1,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory pouncequick:/tmp/cvs-serv27091/FS/FS
Modified Files:
cust_main.pm
Log Message:
credit out self-service
Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -d -r1.156 -r1.157
--- cust_main.pm 25 Jun 2004 18:28:04 -0000 1.156
+++ cust_main.pm 1 Jul 2004 13:49:32 -0000 1.157
@@ -1995,28 +1995,30 @@
sprintf( "%.2f", $total_bill );
}
-=item apply_credits
+=item apply_credits OPTION => VALUE ...
Applies (see L<FS::cust_credit_bill>) unapplied credits (see L<FS::cust_credit>)
-to outstanding invoice balances in chronological order and returns the value
-of any remaining unapplied credits available for refund
-(see L<FS::cust_refund>).
+to outstanding invoice balances in chronological order (or reverse
+chronological order if the I<order> option is set to B<newest>) and returns the
+value of any remaining unapplied credits available for refund (see
+L<FS::cust_refund>).
=cut
sub apply_credits {
my $self = shift;
+ my %opt = @_;
return 0 unless $self->total_credited;
my @credits = sort { $b->_date <=> $a->_date} (grep { $_->credited > 0 }
qsearch('cust_credit', { 'custnum' => $self->custnum } ) );
- my @invoices = sort { $a->_date <=> $b->_date} (grep { $_->owed > 0 }
- qsearch('cust_bill', { 'custnum' => $self->custnum } ) );
+ my @invoices = $self->open_cust_bill;
+ @invoices = sort { $b->_date <=> $a->_date } @invoices
+ if defined($opt{'order'}) && $opt{'order'} eq 'newest';
my $credit;
-
foreach my $cust_bill ( @invoices ) {
my $amount;
- Previous message: freeside/FS/FS/ClientAPI MyAccount.pm,1.24,1.25
- Next message: freeside/install/5.005/Net-Whois-Raw COPYRIGHT,1.1,NONE Changes,1.1,NONE MANIFEST,1.1,NONE META.yml,1.1,NONE Makefile.PL,1.1,NONE README,1.1,NONE pwhois,1.1,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list