Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 642565a3

Von Moritz Bunkus vor 7 Monaten hinzugefügt

  • ID 642565a34de3ad9f4fc1c78ce86851f377d982a0
  • Vorgänger 78061e54
  • Nachfolger 9c0429ad

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

Unterschiede anzeigen:

SL/Controller/BankImport.pm
137 137
      next if $transaction->{error} || $transaction->{duplicate};
138 138

  
139 139
      SL::DB::BankTransaction->new(
140
        map { ($_ => $transaction->{$_}) } qw(amount currency_id local_bank_account_id purpose remote_account_number remote_bank_code remote_name transaction_code transdate valutadate)
140
        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)
141 141
      )->save;
142 142

  
143 143
      $imported++;
SL/DB/MetaSetup/BankTransaction.pm
12 12
  amount                => { type => 'numeric', not_null => 1, precision => 15, scale => 5 },
13 13
  cleared               => { type => 'boolean', default => 'false', not_null => 1 },
14 14
  currency_id           => { type => 'integer', not_null => 1 },
15
  end_to_end_id         => { type => 'text' },
15 16
  exchangerate          => { type => 'numeric', precision => 15, scale => 5 },
16 17
  id                    => { type => 'serial', not_null => 1 },
17 18
  invoice_amount        => { type => 'numeric', default => '0', precision => 15, scale => 5 },
SL/MT940.pm
23 23
    ($from..$to);
24 24
}
25 25

  
26
sub _extract_end_to_end_id {
27
  my ($parts) = @_;
28

  
29
  foreach my $value (values %{ $parts }) {
30
    if ($value =~ m{^(?:endtoend:|eref\+) *(.+)}i) {
31
      my $id = $1;
32
      return $id =~ m{notprovided}i ? undef : $id;
33
    }
34
  }
35

  
36
  return undef;
37
}
38

  
26 39
sub parse {
27 40
  my ($class, $file_name, %params) = @_;
28 41

  
......
117 130
        my ($separator, $rest) = ($1, $2);
118 131
        my %parts              = map { ((substr($_, 0, 2) // '0') * 1 => substr($_, 2)) } split quotemeta($separator), $rest;
119 132

  
133
        $transaction{end_to_end_id}         = _extract_end_to_end_id(\%parts);
120 134
        $transaction{purpose}               = join ' ', grep({ $_ ne '' } _join_entries(\%parts, 20, 29), _join_entries(\%parts, 60, 63));
121 135
        $transaction{remote_name}           = _join_entries(\%parts, 32, 33, '');
122 136
        $transaction{remote_bank_code}      = $parts{30};
locale/de/all
1554 1554
  'Enabled modules'             => 'Aktivierte Module',
1555 1555
  'End'                         => 'Ende',
1556 1556
  'End date'                    => 'Enddatum',
1557
  'End to end ID'               => 'Ende-zu-Ende-ID',
1557 1558
  'Enter longdescription'       => 'Langtext eingeben',
1558 1559
  '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:',
1559 1560
  'Entries for which automatic conversion failed:' => 'Einträge, für die die automatische Umstellung fehlschlug:',
locale/en/all
1554 1554
  'Enabled modules'             => '',
1555 1555
  'End'                         => '',
1556 1556
  'End date'                    => '',
1557
  'End to end ID'               => '',
1557 1558
  'Enter longdescription'       => '',
1558 1559
  'Enter the requested execution date or leave empty for the quickest possible execution:' => '',
1559 1560
  'Entries for which automatic conversion failed:' => '',
sql/Pg-upgrade2/bank_transactions_add_end_to_end_id.sql
1
-- @tag: bank_transactions_add_end_to_end_id
2
-- @description: Kontoauszüge: Spalte für Ende-zu-Ende-ID ergänzen
3
-- @depends: release_3_9_0
4
ALTER TABLE bank_transactions ADD COLUMN end_to_end_id TEXT;
templates/webpages/bank_import/import_mt940.html
57 57
      <th>[% LxERP.t8("Amount") %]</th>
58 58
      <th>[% LxERP.t8("Remote account") %]</th>
59 59
      <th>[% LxERP.t8("Local account") %]</th>
60
      <th>[% LxERP.t8("End to end ID") %]</th>
60 61
      <th>[% LxERP.t8("Information") %]</th>
61 62
    </tr>
62 63
  </thead>
......
75 76
          [% END %]
76 77
        </td>
77 78
        <td>[% HTML.escape(transaction.bank_account.name) %]</td>
79
        <td>[% HTML.escape(transaction.end_to_end_id) %]</td>
78 80
        <td>
79 81
          [% IF transaction.error %]
80 82
            [% HTML.escape(transaction.error) %]

Auch abrufbar als: Unified diff