diff --git a/NGCP/CDR/Export.pm b/NGCP/CDR/Export.pm index 8fa4411..4c182e8 100644 --- a/NGCP/CDR/Export.pm +++ b/NGCP/CDR/Export.pm @@ -81,9 +81,9 @@ sub get_reseller_name { sub get_missing_resellers { my ($dbh, $cids) = @_; - my $stmt = "select name, $reseller_id_col from billing.resellers"; + my $stmt = "select name, $reseller_id_col from billing.resellers where status != \"terminated\""; if(@{ $cids }) { - $stmt .= " where $reseller_id_col not in (" . join (',', map { '?' }(1 .. @{ $cids }) ) . ") and status != \"terminated\""; + $stmt .= " and $reseller_id_col not in (" . join (',', map { '?' }(1 .. @{ $cids }) ) . ")"; } my $sth = $dbh->prepare($stmt); $sth->execute(@{ $cids }); diff --git a/NGCP/CDR/Exporter.pm b/NGCP/CDR/Exporter.pm index d85c302..b60216a 100644 --- a/NGCP/CDR/Exporter.pm +++ b/NGCP/CDR/Exporter.pm @@ -758,10 +758,10 @@ sub write_wrap { } } } + close($fh); $mark{"lastseq".$reseller_contract_id} = $file_idx; NGCP::CDR::Export::set_mark($dbh, ($stream eq 'default' ? $exporter_type : ($exporter_type . '-' . $stream)), { "lastseq$reseller_contract_id" => $file_idx }); - close($fh); } sub finish {