Benutzerdefinierte Variablen: Indizes für Tabelle custom_variables_validity
[kivitendo-erp.git] / SL / USTVA.pm
index 1cec744..bf9ebbd 100644 (file)
@@ -1,5 +1,5 @@
 #=====================================================================
-# Lx-Office ERP
+# kivitendo ERP
 # Copyright (c) 2004 by Udo Spallek, Aachen
 #
 #  Author: Udo Spallek
@@ -113,8 +113,8 @@ sub report_variables {
   my $attribute  = $arg_ref->{attribute}; #
   my $dec_places = (defined $arg_ref->{dec_places}) ? $arg_ref->{dec_places}:undef;
 
-  my $where_type = "AND tax.report_headings.type = '$type'" if ( $type );
-  my $where_dcp  = "AND tax.report_variables.dec_places = '$dec_places'" if ( defined $dec_places );
+  my $where_type = $type ? "AND tax.report_headings.type = '$type'" : '';
+  my $where_dcp  = defined $dec_places ? "AND tax.report_variables.dec_places = '$dec_places'" : '';
 
   my $query = qq|
     SELECT $attribute
@@ -518,9 +518,7 @@ sub query_finanzamt {
   my $filename = "sql/$table.sql";
 
   my $tst = $dbh->prepare("SELECT * FROM $table");
-  $tst->execute;
-  if ($DBI::err) {
-
+  $tst->execute || do {
     #There is no table, read the table from sql/finanzamt.sql
     print qq|<p>Bitte warten, Tabelle $table wird einmalig in Datenbank:
     $myconfig->{dbname} als Benutzer: $myconfig->{dbuser} hinzugefügt...</p>|;
@@ -529,7 +527,7 @@ sub query_finanzamt {
     #execute second last call
     my $dbh = $form->dbconnect($myconfig) or $self->error(DBI->errstr);
     $dbh->disconnect();
-  }
+  };
   $tst->finish();
 
   #$dbh->disconnect();
@@ -808,7 +806,7 @@ sub get_accounts_ustva {
   my $arwhere  = "";
   my $item;
 
-    my $gltaxkey_where = "(tk.pos_ustva>=59 AND tk.pos_ustva<=66)";
+    my $gltaxkey_where = "((tk.pos_ustva>=59 AND tk.pos_ustva<=66) or (tk.pos_ustva>=89 AND tk.pos_ustva<=93))";
 
   if ($fromdate) {
     if ($form->{method} eq 'cash') {