diff options
author | Ivan Kohler <ivan@freeside.biz> | 2012-06-12 01:13:09 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2012-06-12 01:13:09 -0700 |
commit | 6f2740efafc72c4a13d0670a76201eaa22784abe (patch) | |
tree | ba0ced692743351d9fabf9b12b2f23a79a328812 /FS/FS/cust_bill.pm | |
parent | 36a0eb23dee284237243225883f9e086376b05e8 (diff) |
slightly more efficient cust_bill->previous
Diffstat (limited to 'FS/FS/cust_bill.pm')
-rw-r--r-- | FS/FS/cust_bill.pm | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 7d7d3636e..a70f9756b 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -388,8 +388,10 @@ sub previous { my $self = shift; my $total = 0; my @cust_bill = sort { $a->_date <=> $b->_date } - grep { $_->owed != 0 && $_->_date < $self->_date } - qsearch( 'cust_bill', { 'custnum' => $self->custnum } ) + grep { $_->owed != 0 } + qsearch( 'cust_bill', { 'custnum' => $self->custnum, + '_date' => { op=>'<', value=>$self->_date }, + } ) ; foreach ( @cust_bill ) { $total += $_->owed; } $total, @cust_bill; |