TT#58800 ama exporter: regex *varaints* for domestic/intl

Change-Id: I5d675824c2db2d693926eee5347b8d6eee3ef067
changes/09/29609/1
Rene Krenn 7 years ago
parent 536948bfb3
commit 7b3b986a94

@ -43,4 +43,7 @@ terminating_replacement =
terminating_open_digits_6001 = 4319558290
international_destination_pattern = ^(43|49)
#international_destination_pattern =
#domestic_destination_pattern =
#international_destination_not_pattern =
#domestic_destination_not_pattern =

@ -45,4 +45,7 @@ terminating_replacement =
terminating_open_digits_6001 = 4319558290
international_destination_pattern = ^(43|49)
#international_destination_pattern =
#domestic_destination_pattern =
#international_destination_not_pattern =
#domestic_destination_not_pattern =

@ -4,9 +4,11 @@ use strict;
## no critic
use NGCP::BulkProcessor::Projects::Export::Ama::Format::Settings qw(
$domestic_destination_pattern
$international_destination_pattern
$domestic_destination_not_pattern
$international_destination_not_pattern
);
#$domestic_destination_pattern
use NGCP::BulkProcessor::Projects::Export::Ama::Format::Field qw($TERMINATOR);
@ -62,10 +64,30 @@ sub get_hex {
sub get_number_domestic_international {
my $number = shift; #called number (destination)
if (defined $number) {
if (defined $international_destination_pattern and $number =~ $international_destination_pattern) {
return $INTERNATIONAL;
} else {
return $DOMESTIC;
if (defined $international_destination_pattern) {
if ($number =~ $international_destination_pattern) {
return $INTERNATIONAL;
} else {
return $DOMESTIC;
}
} elsif (defined $domestic_destination_pattern) {
if ($number =~ $domestic_destination_pattern) {
return $DOMESTIC;
} else {
return $INTERNATIONAL;
}
} elsif (defined $international_destination_not_pattern) {
if ($number !~ $international_destination_not_pattern) {
return $DOMESTIC;
} else {
return $INTERNATIONAL;
}
} elsif (defined $domestic_destination_not_pattern) {
if ($number !~ $domestic_destination_not_pattern) {
return $INTERNATIONAL;
} else {
return $DOMESTIC;
}
}
}
return $UNKNOWN;

@ -39,7 +39,10 @@ our @EXPORT_OK = qw(
$copy_output_path
$tempfile_path
$domestic_destination_pattern
$international_destination_pattern
$domestic_destination_not_pattern
$international_destination_not_pattern
$make_dir
$ama_filename_format
@ -58,8 +61,10 @@ our $tempfile_path = $working_path . 'temp/';
our $use_tempfiles = 0;
#our $domestic_destination_pattern = undef;
our $domestic_destination_pattern = undef;
our $international_destination_pattern = undef;
our $domestic_destination_not_pattern = undef;
our $international_destination_not_pattern = undef;
our $ama_max_blocks = 1000;
@ -86,12 +91,28 @@ sub update_settings {
$make_dir = $data->{make_dir} if exists $data->{make_dir};
my $regexp_result;
#$domestic_destination_pattern = $data->{domestic_destination_pattern} if exists $data->{domestic_destination_pattern};
#($regexp_result,$domestic_destination_pattern) = parse_regexp($domestic_destination_pattern,$configfile);
#$result &= $regexp_result;
$domestic_destination_pattern = $data->{domestic_destination_pattern} if exists $data->{domestic_destination_pattern};
($regexp_result,$domestic_destination_pattern) = parse_regexp($domestic_destination_pattern,$configfile);
$result &= $regexp_result;
$international_destination_pattern = $data->{international_destination_pattern} if exists $data->{international_destination_pattern};
($regexp_result,$international_destination_pattern) = parse_regexp($international_destination_pattern,$configfile);
$result &= $regexp_result;
$domestic_destination_not_pattern = $data->{domestic_destination_not_pattern} if exists $data->{domestic_destination_not_pattern};
($regexp_result,$domestic_destination_not_pattern) = parse_regexp($domestic_destination_not_pattern,$configfile);
$result &= $regexp_result;
$international_destination_not_pattern = $data->{international_destination_not_pattern} if exists $data->{international_destination_not_pattern};
($regexp_result,$international_destination_not_pattern) = parse_regexp($international_destination_not_pattern,$configfile);
$result &= $regexp_result;
my $domestic_intl_pattern_count = 0;
foreach ($domestic_destination_pattern,$international_destination_pattern,$domestic_destination_not_pattern,$international_destination_not_pattern) {
$domestic_intl_pattern_count += 1 if defined $_;
}
if ($domestic_intl_pattern_count != 1) {
configurationerror($configfile,'exactly 1 parameter out of domestic_destination_pattern, international_destination_pattern, domestic_destination_not_pattern, international_destination_not_pattern is required',getlogger(__PACKAGE__));
$result = 0;
}
$ama_filename_format = $data->{ama_filename_format} if exists $data->{ama_filename_format};

Loading…
Cancel
Save