diff options
author | levinse <levinse> | 2011-06-21 22:15:58 +0000 |
---|---|---|
committer | levinse <levinse> | 2011-06-21 22:15:58 +0000 |
commit | 57adda68a7d445553c43eec5cdcb34490d68b522 (patch) | |
tree | cee7a72879a595b2380700b99e335d2843cf9421 | |
parent | 783eefa4a70dd88dd13ffd73c4e23361288628f0 (diff) |
cust_bill.pm: if DID summary is turned on, don't try to get CDRs in the unlikely case that the h_svc_phone record isn't found with the correct insert time, RT13361
-rw-r--r-- | FS/FS/cust_bill.pm | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 9d250eba3..3a543de57 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -4100,7 +4100,7 @@ sub _did_summary { my $inserted = $h_cust_svc->date_inserted; my $deleted = $h_cust_svc->date_deleted; - my $phone_inserted = $h_cust_svc->h_svc_x($inserted); + my $phone_inserted = $h_cust_svc->h_svc_x($inserted+5); my $phone_deleted; $phone_deleted = $h_cust_svc->h_svc_x($deleted) if $deleted; @@ -4133,10 +4133,15 @@ sub _did_summary { } # increment usage minutes - my @cdrs = $phone_inserted->get_cdrs('begin'=>$start,'end'=>$end); - foreach my $cdr ( @cdrs ) { - $minutes += $cdr->billsec/60; - } + if ( $phone_inserted ) { + my @cdrs = $phone_inserted->get_cdrs('begin'=>$start,'end'=>$end); + foreach my $cdr ( @cdrs ) { + $minutes += $cdr->billsec/60; + } + } + else { + warn "WARNING: no matching h_svc_phone insert record for insert time $inserted, svcnum " . $h_cust_svc->svcnum; + } # don't look at this service again push @seen, $h_cust_svc->svcnum; |