summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorlevinse <levinse>2011-06-21 22:16:00 +0000
committerlevinse <levinse>2011-06-21 22:16:00 +0000
commit814c41a844d49d066ca9002a0c7a02de499f3dc0 (patch)
tree7b18019345a98939153f068bcea60e4be6d6ee54 /FS
parent7b606c498c0353f6a77b72fd8c458f2d3b78fdac (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
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/cust_bill.pm15
1 files changed, 10 insertions, 5 deletions
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index f7041fda0..1e475450c 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -4054,7 +4054,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;
@@ -4087,10 +4087,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;