Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 876169ef

Von Waldemar Toews vor fast 8 Jahren hinzugefügt

  • ID 876169ef006de79db2501c1cb48d8ae567af2d96
  • Vorgänger 9463aaaa
  • Nachfolger dda15351

SEPA + Stammdaten: Implementierung Kontoinhaber mit Formatierungsprüfung

- Das Eingabefeld 'Kontoinhaber' soll als Firmenname in SEPA-XML-Export übernommen werden.
- Bei der Eingabe der Kontoinhaben wird geprüft, ob Eingabe SEPA konform ist.
- Bei CSV-Import wird auch darauf geprüft.

Unterschiede anzeigen:

SL/CT.pm
382 382
  my @ids          = ref $params{id} eq 'ARRAY' ? @{ $params{id} } : ($params{id});
383 383
  my $placeholders = join ", ", ('?') x scalar @ids;
384 384
  my $c_mandate    = $params{vc} eq 'customer' ? ', mandator_id, mandate_date_of_signature' : '';
385
  my $query        = qq|SELECT id, name, account_number, bank, bank_code, iban, bic ${c_mandate}
385
  my $query        = qq|SELECT id, name, depositor, account_number, bank, bank_code, iban, bic ${c_mandate}
386 386
                        FROM ${table}
387 387
                        WHERE id IN (${placeholders})|;
388 388

  
SL/Controller/CsvImport/CustomerVendor.pm
8 8
use SL::DB::CustomVariable;
9 9
use SL::DB::CustomVariableConfig;
10 10
use SL::DB::PaymentTerm;
11
use SL::SEPA;
11 12
use SL::TransNumber;
12 13

  
13 14
use parent qw(SL::Controller::CsvImport::Base);
......
74 75
    my $object = $entry->{object};
75 76

  
76 77
    $self->check_name($entry);
78
    $self->check_depositor($entry);
77 79
    $self->check_language($entry);
78 80
    $self->check_business($entry);
79 81
    $self->check_payment($entry);
......
86 88
    next if @{ $entry->{errors} };
87 89

  
88 90
    my @cleaned_fields = $self->clean_fields(qr{[\r\n]}, $object, qw(name department_1 department_2 street zipcode city country gln contact phone fax homepage email cc bcc
89
                                                                     taxnumber account_number bank_code bank username greeting taxzone));
91
                                                                     taxnumber account_number bank_code bank username greeting taxzone depositor));
90 92

  
91 93
    push @{ $entry->{information} }, $::locale->text('Illegal characters have been removed from the following fields: #1', join(', ', @cleaned_fields))
92 94
      if @cleaned_fields;
......
144 146
  return 0;
145 147
}
146 148

  
149
sub check_depositor {
150
  my ($self, $entry) = @_;
151

  
152
  my $depositor = $entry->{object}->depositor;
153

  
154
  push @{ $entry->{errors} }, $::locale->text('Error: Depositor not SEPA conform') if !SL::SEPA->is_depositor_name_valid($depositor);
155
}
156

  
147 157
sub check_language {
148 158
  my ($self, $entry) = @_;
149 159

  
......
290 300
                                 { name => 'customernumber',    description => $::locale->text('Customer Number')                 },
291 301
                                 { name => 'department_1',      description => $::locale->text('Department 1')                    },
292 302
                                 { name => 'department_2',      description => $::locale->text('Department 2')                    },
303
                                 { name => 'depositor',         description => $::locale->text('Depositor')                       },
293 304
                                 { name => 'delivery_term_id',  description => $::locale->text('Delivery terms (database ID)')    },
294 305
                                 { name => 'delivery_term',     description => $::locale->text('Delivery terms (name)')           },
295 306
                                 { name => 'direct_debit',      description => $::locale->text('direct debit')                    },
SL/SEPA.pm
138 138
  my $q_insert =
139 139
    qq|INSERT INTO sepa_export_items (id,          sepa_export_id,           ${arap}_id,  chart_id,
140 140
                                      amount,      requested_execution_date, reference,   end_to_end_id,
141
                                      our_iban,    our_bic,                  vc_iban,     vc_bic,
141
                                      our_iban,    our_bic, our_depositor,   vc_iban,     vc_bic, vc_depositor,
142 142
                                      skonto_amount, payment_type ${c_mandate})
143 143
       VALUES                        (?,           ?,                        ?,           ?,
144
                                      ?,           ?,                        ?,           ?,
144
                                      ?,           ?,       ?,               ?,           ?,      ?,
145 145
                                      ?,           ?,                        ?,           ?,
146 146
                                      ?,           ? ${p_mandate})|;
147 147
  my $h_insert = prepare_query($form, $dbh, $q_insert);
......
188 188
                  conv_i($transfer->{"${arap}_id"}), conv_i($transfer->{chart_id}),
189 189
                  $transfer->{amount},               conv_date($transfer->{requested_execution_date}),
190 190
                  $transfer->{reference},            $end_to_end_id,
191
                  map { my $pfx = $_; map { $transfer->{"${pfx}_${_}"} } qw(iban bic) } qw(our vc));
191
                  map { my $pfx = $_; map { $transfer->{"${pfx}_${_}"} } qw(iban bic depositor) } qw(our vc));
192 192
    # save value of skonto_amount and payment_type
193 193
    if ( $transfer->{payment_type} eq 'without_skonto' ) {
194 194
      push(@values, 0);
......
532 532
  return 1;
533 533
}
534 534

  
535
sub is_depositor_name_valid {
536
  my ($class, $depositor) = @_;
537
  return $depositor =~ /[^A-Za-z0-9\/\?\:\(\)\.\,\'\+\- ]/ ? 0 : 1;
538
}
539

  
535 540
1;
bin/mozilla/sepa.pl
144 144
  my ($vc_bank_info);
145 145
  my $error_message;
146 146

  
147
  my @bank_columns    = qw(iban bic);
147
  my @bank_columns    = qw(iban bic depositor);
148 148
  push @bank_columns, qw(mandator_id mandate_date_of_signature) if $vc eq 'customer';
149 149

  
150 150
  if ($form->{confirmation}) {
......
155 155
        $error_message = $locale->text('The bank information must not be empty.');
156 156
        last;
157 157
      }
158
      if (!SL::SEPA->is_depositor_name_valid($info->{depositor})) { # Checking for Depositor formatting if SEPA conform
159
        $error_message = $locale->text('Incorrect depositor!');
160
        last;
161
      }
158 162
    }
159 163
  }
160 164

  
......
564 568
                                 'src_bic'        => $item->{our_bic},
565 569
                                 'dst_iban'       => $item->{vc_iban},
566 570
                                 'dst_bic'        => $item->{vc_bic},
567
                                 'company'        => $item->{vc_name},
571
                                 'company'        => $item->{vc_depositor},
568 572
                                 'company_number' => $item->{vc_number},
569 573
                                 'amount'         => $item->{amount},
570 574
                                 'reference'      => $item->{reference},
locale/de/all
936 936
  'Dependencies'                => 'Abhängigkeiten',
937 937
  'Dependency loop detected:'   => 'Schleife in den Abhängigkeiten entdeckt:',
938 938
  'Deposit'                     => 'Gutschrift',
939
  'Depositor'                   => 'Kontoinhaber',
939 940
  'Description'                 => 'Beschreibung',
940 941
  'Description (Click on Description for details)' => 'Beschreibung (Klick öffnet einzelne Kontendetails)',
941 942
  'Description (translation for #1)' => 'Beschreibung (Übersetzung für #1)',
......
1191 1192
  'Error: Customer/vendor missing' => 'Fehler: Kunde/Lieferant fehlt',
1192 1193
  'Error: Customer/vendor not found' => 'Fehler: Kunde/Lieferant nicht gefunden',
1193 1194
  'Error: Found local bank account number but local bank code doesn\'t match' => 'Fehler: Kontonummer wurde gefunden aber gespeicherte Bankleitzahl stimmt nicht überein',
1195
  'Error: Depositor not SEPA conform' => 'Fehler: Kontoinhaber ist nicht SEPA konform',
1194 1196
  'Error: Gender (cp_gender) missing or invalid' => 'Fehler: Geschlecht (cp_gender) fehlt oder ungültig',
1195 1197
  'Error: Invalid bin'          => 'Fehler: Ungültiger Lagerplatz',
1196 1198
  'Error: Invalid bin id'       => 'Ungültige Lagerplatz-ID',
......
1519 1521
  'Incoming Payments'           => 'Zahlungseingänge',
1520 1522
  'Incoming invoice number'     => 'Eingangsrechnungsnummer',
1521 1523
  'Inconsistency in database'   => 'Unstimmigkeiten in der Datenbank',
1524
  'Incorrect depositor!'        => 'Eingabe für Kontoinhaber ist nicht SEPA konform, Änderungen wurden nicht gespeichert!',
1522 1525
  'Incorrect password!'         => 'Ungültiges Passwort!',
1523 1526
  'Incorrect username or password or no access to selected client!' => 'Ungültiger Benutzername oder Passwort oder kein Zugriff auf den ausgewählten Mandanten!',
1524 1527
  'Increase'                    => 'Erhöhen',
sql/Pg-upgrade2/format_depositor_sepa_conform.sql
1
-- @tag: format_depositor_sepa_conform
2
-- @description: Formatiert die Datenbank-Daten für Kontoinhaber SEPA konform.
3
-- @depends: release_3_2_0
4

  
5
UPDATE customer SET depositor =
6
  replace(
7
    replace(
8
      replace(
9
        replace(
10
          replace(
11
            replace(
12
              replace(translate(depositor, 'àâáèéêóôùú&`', 'aaeeeoouu+'''),
13
                'ä', 'ae'),
14
              'ö', 'oe'),
15
            'ü', 'ue'),
16
          'Ä', 'Ae'),
17
        'Ö', 'Oe'),
18
      'Ü', 'Ue'),
19
    'ß', 'ss')
20
WHERE (depositor IS NOT NULL)
21
  AND (depositor <> '');
22

  
23
UPDATE vendor SET depositor =
24
  replace(
25
    replace(
26
      replace(
27
        replace(
28
          replace(
29
            replace(
30
              replace(translate(depositor, 'àâáèéêóôùú&`', 'aaeeeoouu+'''),
31
                'ä', 'ae'),
32
              'ö', 'oe'),
33
            'ü', 'ue'),
34
          'Ä', 'Ae'),
35
        'Ö', 'Oe'),
36
      'Ü', 'Ue'),
37
    'ß', 'ss')
38
WHERE (depositor IS NOT NULL)
39
  AND (depositor <> '');
templates/webpages/sepa/bank_transfer_create.html
45 45
   <table>
46 46
    <tr>
47 47
     <th class="listheading">[%- IF is_vendor %][% 'Vendor' | $T8 %][%- ELSE %][%- LxERP.t8('Customer') %][%- END %]</th>
48
     <th class="listheading">[% 'Depositor' | $T8 %]</th>
48 49
     <th class="listheading">[% 'IBAN' | $T8 %]</th>
49 50
     <th class="listheading">[% 'BIC' | $T8 %]</th>
50 51
     <th class="listheading">[% 'Bank' | $T8 %]</th>
......
61 62
      <input type="hidden" name="vc_bank_info[].name" value="[% HTML.escape(vbi.name) %]">
62 63
      [% HTML.escape(vbi.name) %]
63 64
     </td>
65
     <td><input name="vc_bank_info[].depositor" size="20" value="[% HTML.escape(vbi.depositor) %]"></td>
64 66
     <td><input name="vc_bank_info[].iban" size="34" value="[% HTML.escape(vbi.iban.substr(0, 34)) %]" maxlength="34"></td>
65 67
     <td><input name="vc_bank_info[].bic" size="20" value="[% HTML.escape(vbi.bic.substr(0, 20)) %]" maxlength="20"></td>
66 68
     <td><input name="vc_bank_info[].bank" size="30" value="[% HTML.escape(vbi.bank) %]"></td>
......
124 126
      </td>
125 127
      <td align="left" [%- IF bank_transfer.within_skonto_period %]style="background-color: LightGreen"[%- END %]>[%- IF bank_transfer.skonto_amount %] [% LxERP.format_amount(bank_transfer.percent_skonto, 2) %] % = [% LxERP.format_amount(bank_transfer.skonto_amount, 2) %] € [% 'until' | $T8 %] [% bank_transfer.skonto_date %] [% END %]</td>
126 128
      <td nowrap>
127
	[%- IF !is_vendor %]
129
        [%- IF !is_vendor %]
128 130
        [% L.date_tag('bank_transfers[].requested_execution_date', bank_transfer.requested_execution_date, readonly => 1) %]
129
	[%- ELSE %]
131
        [%- ELSE %]
130 132
        [% L.date_tag('bank_transfers[].requested_execution_date', bank_transfer.requested_execution_date) %]
131
	[%- END %]
133
        [%- END %]
132 134
      </td>
133 135
     </tr>
134 136
    [%- END %]
templates/webpages/sepa/bank_transfer_edit.html
24 24
     [%- END %]
25 25
     <th class="listheading">[% 'Invoice' | $T8 %]</th>
26 26
     <th class="listheading">[%- IF is_vendor %][% 'Vendor' | $T8 %][%- ELSE %][%- LxERP.t8('Customer') %][%- END %]</th>
27
     <th class="listheading">[% 'Depositor' | $T8 %]</th>
27 28
     [%- IF is_vendor %]
28 29
      <th class="listheading" colspan="2">[% 'Source bank account' | $T8 %]</th>
29 30
      <th class="listheading" colspan="2">[% 'Target bank account' | $T8 %]</th>
......
42 43
     <th class="listheading" align="right">[% 'Execution date' | $T8 %]</th>
43 44
    </tr>
44 45
    <tr>
45
     <th class="listheading" colspan="[% IF show_post_payments_button %]3[% ELSE %]2[% END %]">&nbsp;</th>
46
     <th class="listheading" colspan="[% IF show_post_payments_button %]4[% ELSE %]3[% END %]">&nbsp;</th>
46 47
     <th class="listheading">[% 'IBAN' | $T8 %]</th>
47 48
     <th class="listheading">[% 'BIC' | $T8 %]</th>
48 49
     <th class="listheading">[% 'IBAN' | $T8 %]</th>
......
72 73
       <a href="[% IF item.invoice %][% iris %][% ELSE %][% arap %][% END %].pl?action=edit&type=invoice&id=[% IF is_vendor %][% HTML.url(item.ap_id) %][% ELSE %][% HTML.url(item.ar_id) %][% END %]">[% HTML.escape(item.invnumber) %]</a>
73 74
      </td>
74 75
      <td>[% HTML.escape(item.vc_name) %]</td>
76
      <td>[% HTML.escape(item.vc_depositor) %]</td>
75 77
      <td>[% HTML.escape(item.our_iban) %]</td>
76 78
      <td>[% HTML.escape(item.our_bic) %]</td>
77 79
      <td>[% HTML.escape(item.vc_iban) %]</td>

Auch abrufbar als: Unified diff