Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision bf2dd76f

Von Moritz Bunkus vor 11 Monaten hinzugefügt

  • ID bf2dd76f2b267a595d955645ad3c35cb5a5cf558
  • Vorgänger 23781add
  • Nachfolger d62a113d

MT940-Import: Ende-zu-Ende-ID extrahieren & in bank_transactions.end_to_end_id speichern

Unterschiede anzeigen:

SL/Controller/BankImport.pm
next if $transaction->{error} || $transaction->{duplicate};
SL::DB::BankTransaction->new(
map { ($_ => $transaction->{$_}) } qw(amount currency_id local_bank_account_id purpose remote_account_number remote_bank_code remote_name transaction_code transdate valutadate)
map { ($_ => $transaction->{$_}) } qw(amount currency_id local_bank_account_id purpose remote_account_number remote_bank_code remote_name transaction_code transdate valutadate end_to_end_id)
)->save;
$imported++;
SL/DB/MetaSetup/BankTransaction.pm
amount => { type => 'numeric', not_null => 1, precision => 15, scale => 5 },
cleared => { type => 'boolean', default => 'false', not_null => 1 },
currency_id => { type => 'integer', not_null => 1 },
end_to_end_id => { type => 'text' },
exchangerate => { type => 'numeric', precision => 15, scale => 5 },
id => { type => 'serial', not_null => 1 },
invoice_amount => { type => 'numeric', default => '0', precision => 15, scale => 5 },
SL/MT940.pm
($from..$to);
}
sub _extract_end_to_end_id {
my ($parts) = @_;
foreach my $value (values %{ $parts }) {
if ($value =~ m{^(?:endtoend:|eref\+) *(.+)}i) {
my $id = $1;
return $id =~ m{notprovided}i ? undef : $id;
}
}
return undef;
}
sub parse {
my ($class, $file_name, %params) = @_;
......
my ($separator, $rest) = ($1, $2);
my %parts = map { ((substr($_, 0, 2) // '0') * 1 => substr($_, 2)) } split quotemeta($separator), $rest;
$transaction{end_to_end_id} = _extract_end_to_end_id(\%parts);
$transaction{purpose} = join ' ', grep({ $_ ne '' } _join_entries(\%parts, 20, 29), _join_entries(\%parts, 60, 63));
$transaction{remote_name} = _join_entries(\%parts, 32, 33, '');
$transaction{remote_bank_code} = $parts{30};
locale/de/all
'Enabled modules' => 'Aktivierte Module',
'End' => 'Ende',
'End date' => 'Enddatum',
'End to end ID' => 'Ende-zu-Ende-ID',
'Enter longdescription' => 'Langtext eingeben',
'Enter the requested execution date or leave empty for the quickest possible execution:' => 'Geben Sie das jeweils gewünschte Ausführungsdatum an, oder lassen Sie das Feld leer für die schnellstmögliche Ausführung:',
'Entries for which automatic conversion failed:' => 'Einträge, für die die automatische Umstellung fehlschlug:',
locale/en/all
'Enabled modules' => '',
'End' => '',
'End date' => '',
'End to end ID' => '',
'Enter longdescription' => '',
'Enter the requested execution date or leave empty for the quickest possible execution:' => '',
'Entries for which automatic conversion failed:' => '',
sql/Pg-upgrade2/bank_transactions_add_end_to_end_id.sql
-- @tag: bank_transactions_add_end_to_end_id
-- @description: Kontoauszüge: Spalte für Ende-zu-Ende-ID ergänzen
-- @depends: release_3_9_0
ALTER TABLE bank_transactions ADD COLUMN end_to_end_id TEXT;
templates/design40_webpages/bank_import/import_mt940.html
<th>[% LxERP.t8("Amount") %]</th>
<th>[% LxERP.t8("Remote account") %]</th>
<th>[% LxERP.t8("Local account") %]</th>
<th>[% LxERP.t8("End to end ID") %]</th>
<th>[% LxERP.t8("Information") %]</th>
</tr>
</thead>
......
[% END %]
</td>
<td>[% HTML.escape(transaction.bank_account.name) %]</td>
<td>[% HTML.escape(transaction.end_to_end_id) %]</td>
<td>
[% IF transaction.error %]
[% HTML.escape(transaction.error) %]
templates/webpages/bank_import/import_mt940.html
<th>[% LxERP.t8("Amount") %]</th>
<th>[% LxERP.t8("Remote account") %]</th>
<th>[% LxERP.t8("Local account") %]</th>
<th>[% LxERP.t8("End to end ID") %]</th>
<th>[% LxERP.t8("Information") %]</th>
</tr>
</thead>
......
[% END %]
</td>
<td>[% HTML.escape(transaction.bank_account.name) %]</td>
<td>[% HTML.escape(transaction.end_to_end_id) %]</td>
<td>
[% IF transaction.error %]
[% HTML.escape(transaction.error) %]

Auch abrufbar als: Unified diff