Revision 14304a6a
Von Martin Helmling martin.helmling@octosoft.eu vor etwa 8 Jahren hinzugefügt
SL/Helper/MT940.pm | ||
---|---|---|
1 | 1 |
package SL::Helper::MT940; |
2 | 2 |
|
3 | 3 |
use strict; |
4 |
use File::Path qw(mkpath); |
|
5 |
use File::Copy qw(copy); |
|
4 | 6 |
|
5 | 7 |
sub convert_mt940_data { |
6 | 8 |
my ($mt940_data) = @_; |
... | ... | |
13 | 15 |
$sfile->fh->print($mt940_data); |
14 | 16 |
$sfile->fh->close; |
15 | 17 |
|
18 |
my $todir = $sfile->get_path . '/imexporters/csv/profiles'; |
|
19 |
mkpath $todir; |
|
20 |
File::Copy::copy('users/aqbanking.conf', $todir.'/kivi.conf'); |
|
21 |
|
|
16 | 22 |
my $aqbin = $::lx_office_conf{applications}->{aqbanking}; |
17 | 23 |
die "Can't find aqbanking-cli, please check your configuration file.\n" unless -f $aqbin; |
18 |
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\" "; |
|
24 |
my $cmd = "$aqbin --cfgdir=\"" . $sfile->get_path . "\" import --importer=\"swift\" --profile=\"SWIFT-MT940\" -f " . |
|
25 |
$sfile->get_path . "/$import_filename | $aqbin --cfgdir=\"" . $sfile->get_path . "\" listtrans --exporter=\"csv\" --profile=kivi 2> /dev/null "; |
|
19 | 26 |
|
20 |
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"; |
|
27 |
my $converted_data = '"empty";"local_bank_code";"local_account_number";"remote_bank_code";"remote_account_number";"transdate";"valutadate";"amount";'. |
|
28 |
'"currency";"remote_name";"remote_name_1";"purpose";"purpose1";"purpose2";"purpose3";"purpose4";"purpose5";"purpose6";"purpose7";"purpose8";"purpose9";'. |
|
29 |
'"purpose10";"purpose11";"transactionKey";"customerReference";"bankReference";"transactionCode";"transactionText"'."\n"; |
|
21 | 30 |
|
22 | 31 |
open my $mt, "-|", "$cmd" || die "Problem with executing aqbanking\n"; |
23 | 32 |
my $headerline = <$mt>; # discard original aqbanking header line |
Auch abrufbar als: Unified diff
MT940-Import: Transaktionstype mit in BankTransaction
Eine Erweiterung um z.B. Sammellastschriften zu erkennen
Dazu wurde ein eigenes Importprofil für aqbanking-cli erstellt
und die Tabelle bank_transactions erweitert.
Das Profile ist in users/aqbanking.conf