Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a8758a6b

Von Moritz Bunkus vor etwa 2 Monaten hinzugefügt

  • ID a8758a6b7fd5c3f532d4ac1a05e53c1b1174a31f
  • Vorgänger bb71c315

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
1551 1551
  'Enabled modules'             => 'Aktivierte Module',
1552 1552
  'End'                         => 'Ende',
1553 1553
  'End date'                    => 'Enddatum',
1554
  'End to end ID'               => 'Ende-zu-Ende-ID',
1554 1555
  'Enter longdescription'       => 'Langtext eingeben',
1555 1556
  '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:',
1556 1557
  'Entries for which automatic conversion failed:' => 'Einträge, für die die automatische Umstellung fehlschlug:',
locale/en/all
1551 1551
  'Enabled modules'             => '',
1552 1552
  'End'                         => '',
1553 1553
  'End date'                    => '',
1554
  'End to end ID'               => '',
1554 1555
  'Enter longdescription'       => '',
1555 1556
  'Enter the requested execution date or leave empty for the quickest possible execution:' => '',
1556 1557
  '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