Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 69b298a0

Von G. Richardson vor mehr als 7 Jahren hinzugefügt

  • ID 69b298a0f814b3e21d85d3958d198f15001ed6f1
  • Vorgänger a3a6ec06
  • Nachfolger d76eb69e

DATEV-Export: Personenkontenoption nur anzeigen wenn Konten passen

Die Option "als Personenkonten exportieren" wird nur angezeigt, wenn
alle Kunden- und Lieferantennummern in das DATEV-Kontonummerschema
passen. Anhaken muß man die Checkbox allerdings trotzdem noch.

Besser wäre eine zentrale Konfiguration "DATEV-Export mit Personenkonten
exportieren" die dann auch beim Speichern/Anlegen von Konten immer
prüft, ob das Kontenschema eingehalten wird.

Unterschiede anzeigen:

SL/DATEV.pm
1460 1460

  
1461 1461
  return { download_token => $self->download_token, filenames => $params{filename} };
1462 1462
}
1463

  
1464
sub check_vcnumbers_are_valid_pk_numbers {
1465
  my ($self) = @_;
1466

  
1467
  my $length_of_accounts = length(SL::DB::Manager::Chart->get_first(where => [charttype => 'A'])->accno) // 4;
1468
  my $pk_length = $length_of_accounts + 1;
1469
  my $query = <<"SQL";
1470
   SELECT customernumber AS vcnumber FROM customer WHERE customernumber !~ '^[[:digit:]]{$pk_length}\$'
1471
   UNION
1472
   SELECT vendornumber   AS vcnumber FROM vendor   WHERE vendornumber   !~ '^[[:digit:]]{$pk_length}\$'
1473
   LIMIT 1;
1474
SQL
1475
  my ($has_non_pk_accounts)  = selectrow_query($::form, SL::DB->client->dbh, $query);
1476
  return defined $has_non_pk_accounts ? 0 : 1;
1477
}
1478

  
1463 1479
sub DESTROY {
1464 1480
  clean_temporary_directories();
1465 1481
}
......
1685 1701

  
1686 1702
Usage: _csv_buchungsexport_to_file($self, data => $self->csv_buchungsexport);
1687 1703

  
1704
=item check_vcnumbers_are_valid_pk_numbers
1705

  
1706
Returns 1 if all vcnumbers are suitable for the DATEV export, 0 if not.
1707

  
1708
Finds the default length of charts (e.g. 4), adds 1 for the pk chart length
1709
(e.g. 5), and checks the database for any customers or vendors whose customer-
1710
or vendornumber doesn't consist of only numbers with exactly that length. E.g.
1711
for a chart length of four "10001" would be ok, but not "10001b" or "1000".
1712

  
1713
All vcnumbers are checked, obsolete customers or vendors aren't exempt.
1714

  
1715
There is also no check for the typical customer range 10000-69999 and the
1716
typical vendor range 70000-99999.
1688 1717

  
1689 1718
=back
1690 1719

  
bin/mozilla/datev.pl
78 78

  
79 79
  $::form->header;
80 80
  $::form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all_sorted;
81
  $::form->{show_pk_option}  = SL::DATEV->new->check_vcnumbers_are_valid_pk_numbers;
81 82
  print $::form->parse_html_template('datev/export_bewegungsdaten');
82 83

  
83 84
  $::lxdebug->leave_sub;
templates/webpages/datev/export_bewegungsdaten.html
88 88
  <td><hr size=3 noshade></td>
89 89
  </tr>
90 90
  [% END %]
91
  [% IF show_pk_option %]
91 92
   <tr>
92 93
     <td>
93 94
        <table>
......
102 103
   <tr>
103 104
  <td><hr size=3 noshade></td>
104 105
  </tr>
106
  [% END %]
105 107
</table>
106 108

  
107 109
<input type=hidden name=beraternr value="[% beraternr %]">

Auch abrufbar als: Unified diff