- if ( $::form->{file} && $::form->{FILENAME} =~ /\.940$/ ) {
- my $mt940_file = SL::SessionFile->new($::form->{FILENAME}, mode => '>');
- $mt940_file->fh->print($::form->{file});
- $mt940_file->fh->close;
-
- 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=\"users\" import --importer=\"swift\" --profile=\"SWIFT-MT940\" -f " . $mt940_file->file_name . " | $aqbin --cfgdir=\"users\" listtrans --exporter=\"csv\" --profile=\"AqMoney2\" ";
- my $converted_mt940;
- open(MT, "$cmd |");
- $converted_mt940 .= '"transaction_id";"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 $headerline = <MT>; # discard original header line
- while (<MT>) {
- $converted_mt940 .= $_;
- };