From f3adaa3936392ebbdfacba970671beba23c8b97b Mon Sep 17 00:00:00 2001 From: Rene Krenn Date: Sun, 22 Dec 2019 01:11:27 +0100 Subject: [PATCH] TT#72753 fix writing empty .cdr for terminated resellers Change-Id: Ic7ae29c5da4b39112ef2a689bbfa006dcc40a685 --- NGCP/CDR/Export.pm | 4 ++-- NGCP/CDR/Exporter.pm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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 {