From d1dfa92834944079595def7f1ba2d62b2f30243b Mon Sep 17 00:00:00 2001 From: Mitch Jackson Date: Thu, 9 Aug 2018 14:55:44 -0400 Subject: RT# 78547 bill_and_collect() small optimization --- FS/FS/cust_main.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'FS/FS/cust_main.pm') diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 22d0dcc..64b002b 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -5694,6 +5694,16 @@ sub process_bill_and_collect { $cust_main->bill_and_collect( %$param ); } +=item pending_invoice_count + +Return number of cust_bill with pending=Y for this customer + +=cut + +sub pending_invoice_count { + FS::cust_bill->count( 'custnum = '.shift->custnum."AND pending = 'Y'" ); +} + #starting to take quite a while for big dbs # (JRNL: journaled so it only happens once per database) # - seq scan of h_cust_main (yuck), but not going to index paycvv, so -- cgit v1.1