summaryrefslogtreecommitdiff
path: root/FS/FS/cust_bill.pm
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2012-06-12 01:13:09 -0700
committerIvan Kohler <ivan@freeside.biz>2012-06-12 01:13:09 -0700
commit6f2740efafc72c4a13d0670a76201eaa22784abe (patch)
treeba0ced692743351d9fabf9b12b2f23a79a328812 /FS/FS/cust_bill.pm
parent36a0eb23dee284237243225883f9e086376b05e8 (diff)
slightly more efficient cust_bill->previous
Diffstat (limited to 'FS/FS/cust_bill.pm')
-rw-r--r--FS/FS/cust_bill.pm6
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;