X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FHelper%2FMT940.pm;h=63f637eed56b31ef213574253e5f8971dd19ee80;hb=14d905e5a6bdc95c13bf7575deb5f79f6e34fb2c;hp=5c8865d028bd202d3991c4b055e44abc6569b40b;hpb=d180d84e035a21291e2dc186b4430e3336998156;p=kivitendo-erp.git diff --git a/SL/Helper/MT940.pm b/SL/Helper/MT940.pm index 5c8865d02..63f637eed 100644 --- a/SL/Helper/MT940.pm +++ b/SL/Helper/MT940.pm @@ -1,6 +1,8 @@ package SL::Helper::MT940; use strict; +use File::Path qw(mkpath); +use File::Copy qw(copy); sub convert_mt940_data { my ($mt940_data) = @_; @@ -13,11 +15,18 @@ sub convert_mt940_data { $sfile->fh->print($mt940_data); $sfile->fh->close; + my $todir = $sfile->get_path . '/imexporters/csv/profiles'; + mkpath $todir; + File::Copy::copy('users/aqbanking.conf', $todir.'/kivi.conf'); + my $aqbin = $::lx_office_conf{applications}->{aqbanking}; die "Can't find aqbanking-cli, please check your configuration file.\n" unless -f $aqbin; - my $cmd = "$aqbin --cfgdir=\"" . $sfile->get_path . "\" import --importer=\"swift\" --profile=\"SWIFT-MT940\" -f " . $sfile->get_path . "/$import_filename | $aqbin --cfgdir=\"" . $sfile->get_path . "\" listtrans --exporter=\"csv\" --profile=\"AqMoney2\" "; + my $cmd = "$aqbin --cfgdir=\"" . $sfile->get_path . "\" import --importer=\"swift\" --profile=\"SWIFT-MT940\" -f " . + $sfile->get_path . "/$import_filename | $aqbin --cfgdir=\"" . $sfile->get_path . "\" listtrans --exporter=\"csv\" --profile=kivi 2> /dev/null "; - my $converted_data = '"empty";"local_bank_code";"local_account_number";"remote_bank_code";"remote_account_number";"transdate";"valutadate";"amount";"currency";"remote_name";"remote_name_1";"purpose";"purpose1";"purpose2";"purpose3";"purpose4";"purpose5";"purpose6";"purpose7";"purpose8";"purpose9";"purpose10";"purpose11"' . "\n"; + my $converted_data = '"empty";"local_bank_code";"local_account_number";"remote_bank_code";"remote_account_number";"transdate";"valutadate";"amount";'. + '"currency";"remote_name";"remote_name_1";"purpose";"purpose1";"purpose2";"purpose3";"purpose4";"purpose5";"purpose6";"purpose7";"purpose8";"purpose9";'. + '"purpose10";"purpose11";"transaction_key";"customer_reference";"bank_reference";"transaction_code";"transaction_text"'."\n"; open my $mt, "-|", "$cmd" || die "Problem with executing aqbanking\n"; my $headerline = <$mt>; # discard original aqbanking header line