[freeside-commits] freeside/FS/FS cdr.pm,1.66.2.1,1.66.2.2

Erik Levinson levinse at wavetail.420.am
Mon Jan 24 15:06:52 PST 2011


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv17309/FS/FS

Modified Files:
      Tag: FREESIDE_2_1_BRANCH
	cdr.pm 
Log Message:
CDR reprocess with termination, RT8763

Index: cdr.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cdr.pm,v
retrieving revision 1.66.2.1
retrieving revision 1.66.2.2
diff -u -w -d -r1.66.2.1 -r1.66.2.2
--- cdr.pm	25 Nov 2010 01:06:38 -0000	1.66.2.1
+++ cdr.pm	24 Jan 2011 23:06:50 -0000	1.66.2.2
@@ -678,6 +678,50 @@
   $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



More information about the freeside-commits mailing list