summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorlevinse <levinse>2011-01-24 23:06:49 +0000
committerlevinse <levinse>2011-01-24 23:06:49 +0000
commitc6815d4041610785099c820df097326a70c8ce41 (patch)
tree1a8760273d5d6667dfcab3bbdeaee4ab1627a09a /FS
parent1f92d7423c25020073258be7453b046b30f88bc1 (diff)
CDR reprocess with termination, RT8763
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/cdr.pm44
1 files changed, 44 insertions, 0 deletions
diff --git a/FS/FS/cdr.pm b/FS/FS/cdr.pm
index f7402eead..478dcff6b 100644
--- a/FS/FS/cdr.pm
+++ b/FS/FS/cdr.pm
@@ -678,6 +678,50 @@ sub invoice_header {
$export_names{$format}->{'invoice_header'};
}
+=item clear_status
+
+Clears cdr and any associated cdr_termination statuses - used for
+CDR reprocessing.
+
+=cut
+
+sub clear_status {
+ my $self = shift;
+
+ local $SIG{HUP} = 'IGNORE';
+ local $SIG{INT} = 'IGNORE';
+ local $SIG{QUIT} = 'IGNORE';
+ local $SIG{TERM} = 'IGNORE';
+ local $SIG{TSTP} = 'IGNORE';
+ local $SIG{PIPE} = 'IGNORE';
+
+ my $oldAutoCommit = $FS::UID::AutoCommit;
+ local $FS::UID::AutoCommit = 0;
+ my $dbh = dbh;
+
+ $self->freesidestatus('');
+ my $error = $self->replace;
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return $error;
+ }
+
+ my @cdr_termination = qsearch('cdr_termination',
+ { 'acctid' => $self->acctid } );
+ foreach my $cdr_termination ( @cdr_termination ) {
+ $cdr_termination->status('');
+ $error = $cdr_termination->replace;
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return $error;
+ }
+ }
+
+ $dbh->commit or die $dbh->errstr if $oldAutoCommit;
+
+ '';
+}
+
=item import_formats
Returns an ordered list of key value pairs containing import format names