projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
view/set svc_phone forwardst and email from self-service, RT13622
[freeside.git]
/
FS
/
bin
/
freeside-cdr-sftp_and_import
diff --git
a/FS/bin/freeside-cdr-sftp_and_import
b/FS/bin/freeside-cdr-sftp_and_import
index
384f9e5
..
1d052ea
100755
(executable)
--- a/
FS/bin/freeside-cdr-sftp_and_import
+++ b/
FS/bin/freeside-cdr-sftp_and_import
@@
-11,8
+11,8
@@
use FS::cdr;
# parse command line
###
# parse command line
###
-use vars qw( $opt_m $opt_p $opt_r $opt_e $opt_d $opt_v $opt_P $opt_a $opt_c );
-getopts('c:m:p:r:e:d:v:P:a');
+use vars qw( $opt_m $opt_p $opt_r $opt_e $opt_d $opt_v $opt_P $opt_a $opt_c
$opt_g
);
+getopts('c:m:p:r:e:d:v:P:a
g
');
$opt_e ||= 'csv';
#$opt_e = ".$opt_e" unless $opt_e =~ /^\./;
$opt_e ||= 'csv';
#$opt_e = ".$opt_e" unless $opt_e =~ /^\./;
@@
-93,9
+93,19
@@
foreach my $filename ( @$ls ) {
}
warn "Processing $filename\n" if $opt_v;
}
warn "Processing $filename\n" if $opt_v;
+
+ my $ungziped = $filename;
+ $ungziped =~ s/\.gz$//;
+ if ( $opt_g ) {
+ if(system('gunzip', "$cachedir/$filename") != 0) {
+ warn "gunzip of '$cachedir/$filename' failed" if $opt_v;
+ unlink "$cachedir/$filename";
+ next;
+ }
+ }
my $import_options = {
my $import_options = {
- 'file' => "$cachedir/$
filename
",
+ 'file' => "$cachedir/$
ungziped
",
'format' => $format,
'batch_namevalue' => $filename,
'empty_ok' => 1,
'format' => $format,
'batch_namevalue' => $filename,
'empty_ok' => 1,
@@
-119,6
+129,7
@@
foreach my $filename ( @$ls ) {
}
unlink "$cachedir/$filename";
}
unlink "$cachedir/$filename";
+ unlink "$cachedir/$ungziped" if $opt_g;
}
}