]> wagnertech.de Git - kivitendo-erp.git/blobdiff - SL/Form.pm
Speichern von Verkäufern bei Kundenstammdaten.
[kivitendo-erp.git] / SL / Form.pm
index c0dee294df263070ebfa32a2ae1bccc729f136d3..e1ea94174b1392c58180603c52635401e76f4f59 100644 (file)
@@ -1578,6 +1578,18 @@ sub _get_taxcharts {
   $main::lxdebug->leave_sub();
 }
 
   $main::lxdebug->leave_sub();
 }
 
+sub _get_employees {
+  $main::lxdebug->enter_sub();
+
+  my ($self, $dbh, $key) = @_;
+
+  $key = "all_employees" unless ($key);
+  $self->{$key} =
+    selectall_hashref_query($self, $dbh, qq|SELECT * FROM employee|);
+
+  $main::lxdebug->leave_sub();
+}
+
 sub get_lists {
   $main::lxdebug->enter_sub();
 
 sub get_lists {
   $main::lxdebug->enter_sub();
 
@@ -1616,6 +1628,10 @@ sub get_lists {
     $self->_get_taxcharts($dbh, $params{"taxcharts"});
   }
 
     $self->_get_taxcharts($dbh, $params{"taxcharts"});
   }
 
+  if ($params{"employees"}) {
+    $self->_get_employees($dbh, $params{"employees"});
+  }
+
   $dbh->disconnect();
 
   $main::lxdebug->leave_sub();
   $dbh->disconnect();
 
   $main::lxdebug->leave_sub();
@@ -1909,7 +1925,8 @@ sub create_links {
     # now get the account numbers
     $query = qq|SELECT c.accno, c.description, c.link, c.taxkey_id, tk.tax_id
                 FROM chart c, taxkeys tk
     # now get the account numbers
     $query = qq|SELECT c.accno, c.description, c.link, c.taxkey_id, tk.tax_id
                 FROM chart c, taxkeys tk
-                WHERE c.link LIKE '%$module%' AND c.id=tk.chart_id AND tk.id = (SELECT id from taxkeys where taxkeys.chart_id =c.id AND startdate<=$transdate ORDER BY startdate desc LIMIT 1)
+                WHERE c.link LIKE '%$module%' AND c.id=tk.chart_id AND tk.id = 
+                      (SELECT id FROM taxkeys where taxkeys.chart_id = c.id AND startdate <= $transdate ORDER BY startdate desc LIMIT 1)
                 ORDER BY c.accno|;
   
     $sth = $dbh->prepare($query);
                 ORDER BY c.accno|;
   
     $sth = $dbh->prepare($query);
@@ -1937,43 +1954,17 @@ sub create_links {
   }
 
   # get taxkeys and description
   }
 
   # get taxkeys and description
-  $query = qq|SELECT id, taxkey, taxdescription
-              FROM tax|;
-  $sth = $dbh->prepare($query);
-  $sth->execute || $self->dberror($query);
-
-  $ref = $sth->fetchrow_hashref(NAME_lc);
-
-  while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
-    push @{ $self->{TAXKEY} }, $ref;
-  }
-
-  $sth->finish;
-
+  $query = qq|SELECT id, taxkey, taxdescription FROM tax|;
+  $self->{TAXKEY} = selectall_hashref_query($form, $dbh, $query);
 
   # get tax zones
 
   # get tax zones
-  $query = qq|SELECT id, description
-              FROM tax_zones|;
-  $sth = $dbh->prepare($query);
-  $sth->execute || $self->dberror($query);
-
-
-  while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
-    push @{ $self->{TAXZONE} }, $ref;
-  }
-  $sth->finish;
+  $query = qq|SELECT id, description FROM tax_zones|;
+  $self->{TAXZONE} = selectall_hashref_query($form, $dbh, $query);
 
   if (($module eq "AP") || ($module eq "AR")) {
 
   if (($module eq "AP") || ($module eq "AR")) {
-
     # get tax rates and description
     $query = qq| SELECT * FROM tax t|;
     # get tax rates and description
     $query = qq| SELECT * FROM tax t|;
-    $sth   = $dbh->prepare($query);
-    $sth->execute || $self->dberror($query);
-    $self->{TAX} = ();
-    while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
-      push @{ $self->{TAX} }, $ref;
-    }
-    $sth->finish;
+    $self->{TAX} = selectall_hashref_query($form, $dbh, $query);
   }
 
   if ($self->{id}) {
   }
 
   if ($self->{id}) {