TT#144300 accept Windows .csv file uploads

Change-Id: I2aae72cfc4ee418e6db8946152150f4fb400af31
mr10.3
Rene Krenn 4 years ago
parent 5e9066c4fb
commit 5445c72cc7

@ -8,6 +8,7 @@ use NGCP::Schema;
use NGCP::Panel::Utils::Preferences qw();
use NGCP::Panel::Utils::DateTime;
use DateTime::Format::Strptime qw();
use NGCP::Panel::Utils::Generic qw(trim);
use NGCP::Panel::Utils::IntervalTree::Simple;
@ -235,11 +236,13 @@ sub process_billing_fees{
my $linenum = 0;
my @fees = ();
my %zones = ();
local $/ = "/n";
open(my $fh, '<:encoding(utf8)', $data);
#to don't stop on first failed parse - don't use "while($csv->getline)"
while ( my $line = <$fh> ){
++$linenum;
next unless length $line;
$line = trim($line);
unless($csv->parse($line)) {
push @fails, $linenum;
next;

@ -166,11 +166,13 @@ sub upload_csv {
$c->model('DB')->txn_do(sub {
local $/ = "/n";
open(my $fh, '<:encoding(utf8)', $data);
while ( my $line = <$fh> ){
++$linenum;
next unless length $line;
$line = trim($line);
unless($csv->parse($line)) {
push @fails, $linenum;
next;

@ -28,6 +28,7 @@ use NGCP::Panel::Utils::ProfilePackages qw();
use NGCP::Panel::Utils::Subscriber qw();
use NGCP::Panel::Utils::Preferences qw();
use NGCP::Panel::Utils::Kamailio qw();
use NGCP::Panel::Utils::Generic qw(trim);
use JE::Destroyer qw();
use JE qw();
@ -316,10 +317,12 @@ sub process_csv {
c => $c,
purge => $purge,
);
local $/ = "/n";
open(my $fh, '<:encoding(utf8)', $data);
while ( my $line = <$fh> ){
++$linenum;
next unless length $line;
$line = trim($line);
unless($csv->parse($line)) {
push(@fails,{ linenum => $linenum, });
next;

Loading…
Cancel
Save