diff options
author | Ivan Kohler <ivan@freeside.biz> | 2018-02-04 17:47:48 -0800 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2018-02-04 17:47:48 -0800 |
commit | b4fa2aa2f73721c6f2c467c73b25e20f59cb04ea (patch) | |
tree | 07016147b588925bc5bc4ae6962b4da408f07bc4 /FS/FS/cust_bill.pm | |
parent | 4e7954f0f0703afc22b649ce38aea4e63db81daa (diff) |
option to reprocess CDRs when voiding an invoice, RT#79001
Diffstat (limited to 'FS/FS/cust_bill.pm')
-rw-r--r-- | FS/FS/cust_bill.pm | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 8b94dcc..bd1b8bb 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -215,7 +215,7 @@ sub insert { } -=item void [ REASON ] +=item void [ REASON [ , REPROCESS_CDRS ] ] Voids this invoice: deletes the invoice and adds a record of the voided invoice to the FS::cust_bill_void table (and related tables starting from @@ -226,6 +226,7 @@ FS::cust_bill_pkg_void). sub void { my $self = shift; my $reason = scalar(@_) ? shift : ''; + my $reprocess_cdrs = scalar(@_) ? shift : ''; unless (ref($reason) || !$reason) { $reason = FS::reason->new_or_existing( @@ -257,7 +258,7 @@ sub void { } foreach my $cust_bill_pkg ( $self->cust_bill_pkg ) { - my $error = $cust_bill_pkg->void($reason); + my $error = $cust_bill_pkg->void($reason, $reprocess_cdrs); if ( $error ) { $dbh->rollback if $oldAutoCommit; return $error; @@ -3541,6 +3542,23 @@ sub _items_aging_balances { return map{ sprintf('%.2f',$_) } @aging_balances; } +=item has_call_details + +Returns true if this invoice has call details. + +=cut + +sub has_call_details { + my $self = shift; + $self->scalar_sql(" + SELECT 1 FROM cust_bill_pkg_detail + LEFT JOIN cust_bill_pkg USING (billpkgnum) + WHERE cust_bill_pkg_detail.format = 'C' + AND cust_bill_pkg.invnum = ? + LIMIT 1 + ", $self->invnum); +} + =item call_details [ OPTION => VALUE ... ] Returns an array of CSV strings representing the call details for this invoice |