diff options
author | ivan <ivan> | 2011-09-22 00:38:38 +0000 |
---|---|---|
committer | ivan <ivan> | 2011-09-22 00:38:38 +0000 |
commit | 4067729dd523f424e317a707a4fa455230bf6b49 (patch) | |
tree | 820680dc1d75bc6f4f7917805c732d61d01ba526 /FS | |
parent | c782a491e6557f086d854d2843b80e82c7ebeab2 (diff) |
add datestamp to batch name derived from filename, remove temp files for all errors that abort processing, RT#14385
Diffstat (limited to 'FS')
-rwxr-xr-x | FS/bin/freeside-cdr-sftp_and_import | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/FS/bin/freeside-cdr-sftp_and_import b/FS/bin/freeside-cdr-sftp_and_import index 039941c..7f2693f 100755 --- a/FS/bin/freeside-cdr-sftp_and_import +++ b/FS/bin/freeside-cdr-sftp_and_import @@ -105,10 +105,12 @@ foreach my $filename ( @$ls ) { } } + my $file_timestamp = $filename.'-'.time2str('%Y-%m-%d', time); + my $import_options = { 'file' => "$cachedir/$ungziped", 'format' => $format, - 'batch_namevalue' => $filename.'-'.time2str('%Y-%m-%d', time), + 'batch_namevalue' => $file_timestamp, 'empty_ok' => 1, }; $import_options->{'cdrtypenum'} = $opt_c if $opt_c; @@ -123,7 +125,7 @@ foreach my $filename ( @$ls ) { if ( $opt_d ) { if($opt_m eq 'ftp') { my $ftp = ftp(); - $ftp->rename($filename, "$opt_d/$filename") + $ftp->rename($filename, "$opt_d/$file_timestamp") or do { unlink "$cachedir/$filename"; unlink "$cachedir/$ungziped" if $opt_g; @@ -132,7 +134,7 @@ foreach my $filename ( @$ls ) { } else { my $sftp = sftp(); - $sftp->rename($filename, "$opt_d/$filename") + $sftp->rename($filename, "$opt_d/$file_timestamp") or do { unlink "$cachedir/$filename"; unlink "$cachedir/$ungziped" if $opt_g; |