[freeside-commits] branch FREESIDE_3_BRANCH updated. cdf63956b55ffad7e0762775e213d7c145392b50
Ivan Kohler
ivan at freeside.biz
Mon May 23 12:27:45 PDT 2022
The branch, FREESIDE_3_BRANCH has been updated
via cdf63956b55ffad7e0762775e213d7c145392b50 (commit)
from fedeb1838dd74628047812a6acd37d1bac5f983a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit cdf63956b55ffad7e0762775e213d7c145392b50
Author: Ivan Kohler <ivan at freeside.biz>
Date: Mon May 23 12:27:44 2022 -0700
add -i flag to set carrierid, RT#86028, RT#81941
diff --git a/FS/FS/cdr.pm b/FS/FS/cdr.pm
index 62db2e06a..db1cddf1d 100644
--- a/FS/FS/cdr.pm
+++ b/FS/FS/cdr.pm
@@ -1851,10 +1851,11 @@ sub batch_import {
my $iopt = _import_options;
$opt->{$_} = $iopt->{$_} foreach keys %$iopt;
- if ( defined $opt->{'cdrtypenum'} ) {
- $opt->{'preinsert_callback'} = sub {
- my($record,$param) = (shift,shift);
- $record->cdrtypenum($opt->{'cdrtypenum'});
+ if ( grep defined $opt->{$_}, qw(cdrtypenum carrierid) ) {
+ $opt->{preinsert_callback} = sub {
+ my($record, $param) = @_;
+ $record->$_($opt->{$_})
+ foreach grep defined $opt->{$_}, qw(cdrtypenum carrierid);
'';
};
}
diff --git a/FS/bin/freeside-cdr-sftp_and_import b/FS/bin/freeside-cdr-sftp_and_import
index 7208c9752..233125087 100755
--- a/FS/bin/freeside-cdr-sftp_and_import
+++ b/FS/bin/freeside-cdr-sftp_and_import
@@ -12,8 +12,8 @@ use FS::cdr;
# parse command line
###
-use vars qw( $opt_m $opt_p $opt_r $opt_e $opt_d $opt_v $opt_P $opt_a $opt_c $opt_g $opt_s $opt_b );
-getopts('c:m:p:r:e:d:v:P:agsb');
+use vars qw( $opt_m $opt_p $opt_r $opt_e $opt_d $opt_v $opt_P $opt_a $opt_c $opt_i $opt_g $opt_s $opt_b );
+getopts('c:i:m:p:r:e:d:v:P:agsb');
$opt_e ||= 'csv';
#$opt_e = ".$opt_e" unless $opt_e =~ /^\./;
@@ -22,6 +22,7 @@ $opt_e =~ s/^\.//;
$opt_p ||= '';
die "invalid cdrtypenum" if $opt_c && $opt_c !~ /^\d+$/;
+die "invalid carrierid" if $opt_i && $opt_i !~ /^\d+$/;
my %options = ();
@@ -114,6 +115,7 @@ foreach my $filename ( @$ls ) {
'empty_ok' => 1,
};
$import_options->{'cdrtypenum'} = $opt_c if $opt_c;
+ $import_options->{'carrierid'} = $opt_i if $opt_i;
my $error = FS::cdr::batch_import($import_options);
@@ -205,7 +207,8 @@ freeside-cdr-sftp_and_import - Download CDR files from a remote server via SFTP
cdr.sftp_and_import [ -m method ] [ -p prefix ] [ -e extension ]
[ -r remotefolder ] [ -d donefolder ] [ -v level ] [ -P port ]
- [ -a ] [ -g ] [ -s ] [ -c cdrtypenum ] user format [sftpuser@]servername
+ [ -a ] [ -g ] [ -s ] [ -c cdrtypenum ] [ -i carrierid]
+ user format [sftpuser@]servername
=head1 DESCRIPTION
@@ -233,6 +236,8 @@ or FTP and then import them into the database.
-c: cdrtypenum to set, defaults to none
+-i: carrierid to set, defaults to none
+
-g: File is gzipped
-s: Warn and skip files which could not be imported rather than abort
-----------------------------------------------------------------------
Summary of changes:
FS/FS/cdr.pm | 9 +++++----
FS/bin/freeside-cdr-sftp_and_import | 11 ++++++++---
2 files changed, 13 insertions(+), 7 deletions(-)
More information about the freeside-commits
mailing list