Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f8779cd3

Von Moritz Bunkus vor mehr als 15 Jahren hinzugefügt

  • ID f8779cd3dec79719e2b4ef77ee70f44afabad8d8
  • Vorgänger df53c167
  • Nachfolger 33244697

Codecleanup UStVA & Bugfixes bei Verwendung von UTF-8

Das UStVA-Modul enthält hardgecodet die Namen der Bundesländer.
Diese enthalten Umlaute, die in ISO-8859-1 codiert sind. Wird hingegen
ein anderes Datenbank-Charset wie UTF-8 verwendet, so klappt die
UStVA-Konfiguration nicht. Das wurde behoben, indem die Ländernamen
nun zentral an einer Stelle verwaltet und in das Datenbankcharset
konvertiert werden, bevor sie benutzt werden.

Fix für Bug 952.

Unterschiede anzeigen:

SL/USTVA.pm
25 25

  
26 26
package USTVA;
27 27

  
28
use List::Util qw(first);
29

  
28 30
use SL::DBUtils;
29 31

  
32
my @tax_office_information = (
33
  { 'id' =>  8, 'name' => 'Baden W?rttemberg',      'taxbird_nr' => '0',  'elster_format' => 'FF/BBB/UUUUP',  },
34
  { 'id' =>  9, 'name' => 'Bayern',                 'taxbird_nr' => '1',  'elster_format' => 'FFF/BBB/UUUUP', },
35
  { 'id' => 11, 'name' => 'Berlin',                 'taxbird_nr' => '2',  'elster_format' => 'FF/BBB/UUUUP',  },
36
  { 'id' => 12, 'name' => 'Brandenburg',            'taxbird_nr' => '3',  'elster_format' => 'FFF/BBB/UUUUP', },
37
  { 'id' =>  4, 'name' => 'Bremen',                 'taxbird_nr' => '4',  'elster_format' => 'FF BBB UUUUP',  },
38
  { 'id' =>  2, 'name' => 'Hamburg',                'taxbird_nr' => '5',  'elster_format' => 'FF/BBB/UUUUP',  },
39
  { 'id' =>  6, 'name' => 'Hessen',                 'taxbird_nr' => '6',  'elster_format' => '0FF BBB UUUUP', },
40
  { 'id' => 13, 'name' => 'Mecklenburg Vorpommern', 'taxbird_nr' => '7',  'elster_format' => 'FFF/BBB/UUUUP', },
41
  { 'id' =>  3, 'name' => 'Niedersachsen',          'taxbird_nr' => '8',  'elster_format' => 'FF/BBB/UUUUP',  },
42
  { 'id' =>  5, 'name' => 'Nordrhein Westfalen',    'taxbird_nr' => '9',  'elster_format' => 'FFF/BBBB/UUUP', },
43
  { 'id' =>  7, 'name' => 'Rheinland Pfalz',        'taxbird_nr' => '10', 'elster_format' => 'FF/BBB/UUUU/P', },
44
  { 'id' => 10, 'name' => 'Saarland',               'taxbird_nr' => '11', 'elster_format' => 'FFF/BBB/UUUUP', },
45
  { 'id' => 14, 'name' => 'Sachsen',                'taxbird_nr' => '12', 'elster_format' => 'FFF/BBB/UUUUP', },
46
  { 'id' => 15, 'name' => 'Sachsen Anhalt',         'taxbird_nr' => '13', 'elster_format' => 'FFF/BBB/UUUUP', },
47
  { 'id' =>  1, 'name' => 'Schleswig Holstein',     'taxbird_nr' => '14', 'elster_format' => 'FF BBB UUUUP',  },
48
  { 'id' => 16, 'name' => 'Th?ringen',              'taxbird_nr' => '15', 'elster_format' => 'FFF/BBB/UUUUP', },
49
  );
50

  
51
sub new {
52
  my $type = shift;
53

  
54
  my $self = {};
55

  
56
  bless $self, $type;
57

  
58
  $self->_init(@_);
59

  
60
  return $self;
61
}
62

  
63
sub _init {
64
  my $self = shift;
65

  
66
  $self->{tax_office_information} = [];
67

  
68
  foreach (@tax_office_information) {
69
    my $entry      = \%{ $_ };
70
    $entry->{name} = $main::locale->{iconv_iso8859}->convert($entry->{name});
71
    push @{ $self->{tax_office_information} }, $entry;
72
  }
73
}
74

  
30 75
sub get_coa {
31 76

  
32 77
  my ( $self, $form, $myconfig) = @_;
......
148 193
  $stnr =~ s/\D+//g;
149 194

  
150 195
  #Pattern description Elstersteuernummer
151
  my %elster_STNRformat = (
152
      'Mecklenburg Vorpommern' => 'FFF/BBB/UUUUP',    # '/' 3
153
      'Hessen'                 => '0FF BBB UUUUP',    # ' ' 3
154
      'Nordrhein Westfalen'    => 'FFF/BBBB/UUUP',    # '/' 3
155
      'Schleswig Holstein'     => 'FF BBB UUUUP',     # ' ' 2
156
      'Berlin'                 => 'FF/BBB/UUUUP',     # '/' 3
157
      'Th?ringen'              => 'FFF/BBB/UUUUP',    # '/' 3
158
      'Sachsen'                => 'FFF/BBB/UUUUP',    # '/' 3
159
      'Hamburg'                => 'FF/BBB/UUUUP',     # '/' 3
160
      'Baden W?rttemberg'      => 'FF/BBB/UUUUP',     # '/' 2
161
      'Sachsen Anhalt'         => 'FFF/BBB/UUUUP',    # '/' 3
162
      'Saarland'               => 'FFF/BBB/UUUUP',    # '/' 3
163
      'Bremen'                 => 'FF BBB UUUUP',     # ' ' 3
164
      'Bayern'                 => 'FFF/BBB/UUUUP',    # '/' 3
165
      'Rheinland Pfalz'        => 'FF/BBB/UUUU/P',    # '/' 4
166
      'Niedersachsen'          => 'FF/BBB/UUUUP',     # '/' 3
167
      'Brandenburg'            => 'FFF/BBB/UUUUP',    # '/' 3
168
  );
169 196

  
170 197
  #split the pattern
171
  my $elster_pattern = $elster_STNRformat{$elster_land};
198
  my $tax_office     = first { $_->{name} eq $elster_land } @{ $self->{tax_office_information} };
199
  my $elster_pattern = $tax_office->{elster_format};
172 200
  my @elster_pattern = split(' ', $elster_pattern);
173 201
  my $delimiter      = ' ';
174 202
  my $patterncount   = @elster_pattern;
......
259 287
  my $checked  = '';
260 288
  $checked = 'checked' if ($elsterFFFF eq '' and $land eq '');
261 289

  
262
  #if ($ENV{HTTP_USER_AGENT} =~ /(mozilla|opera|w3m)/i){
263
  #$terminal='mozilla';
264
  #} elsif ($ENV{HTTP_USER_AGENT} =~ /(links|lynx)/i){
265
  #$terminal = 'lynx';
266
  #}
267

  
268
  #if ( $terminal eq 'mozilla' or $terminal eq 'js' ) {
269 290
  my $fa_auswahl = qq|
270 291
        <script language="Javascript">
271 292
        function update_auswahl()
......
538 559
  my $land      = '';
539 560
  foreach my $row (@$array_ref) {
540 561
    my $FA_finanzamt = $row;
541
    $land = 'Schleswig Holstein'     if (@$FA_finanzamt[0] eq '1');
542
    $land = 'Hamburg'                if (@$FA_finanzamt[0] eq '2');
543
    $land = 'Niedersachsen'          if (@$FA_finanzamt[0] eq '3');
544
    $land = 'Bremen'                 if (@$FA_finanzamt[0] eq '4');
545
    $land = 'Nordrhein Westfalen'    if (@$FA_finanzamt[0] eq '5');
546
    $land = 'Hessen'                 if (@$FA_finanzamt[0] eq '6');
547
    $land = 'Rheinland Pfalz'        if (@$FA_finanzamt[0] eq '7');
548
    $land = 'Baden W?rttemberg'      if (@$FA_finanzamt[0] eq '8');
549
    $land = 'Bayern'                 if (@$FA_finanzamt[0] eq '9');
550
    $land = 'Saarland'               if (@$FA_finanzamt[0] eq '10');
551
    $land = 'Berlin'                 if (@$FA_finanzamt[0] eq '11');
552
    $land = 'Brandenburg'            if (@$FA_finanzamt[0] eq '12');
553
    $land = 'Mecklenburg Vorpommern' if (@$FA_finanzamt[0] eq '13');
554
    $land = 'Sachsen'                if (@$FA_finanzamt[0] eq '14');
555
    $land = 'Sachsen Anhalt'         if (@$FA_finanzamt[0] eq '15');
556
    $land = 'Th?ringen'              if (@$FA_finanzamt[0] eq '16');
557

  
558
    $land = $main::locale->{iconv}->convert($land);
562
    my $tax_office   = first { $_->{id} == $FA_finanzamt->[0] } @{ $self->{tax_office_information} };
563
    $land            = $tax_office->{name};
564

  
565
    # $land = $main::locale->{iconv}->convert($land);
559 566

  
560 567
    my $ffff = @$FA_finanzamt[1];
561 568

  

Auch abrufbar als: Unified diff