X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/7712480e4a082f84a2229f5b1a90d79a6c01255b..a751b16cead5e56b62e18ee616e04323919f5fe1:/SL/Form.pm diff --git a/SL/Form.pm b/SL/Form.pm index edf5de978..e1ea94174 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -959,7 +959,7 @@ sub datetonum { # Database routines used throughout sub dbconnect { - $main::lxdebug->enter_sub(); + $main::lxdebug->enter_sub(2); my ($self, $myconfig) = @_; @@ -974,7 +974,7 @@ sub dbconnect { $dbh->do($myconfig->{dboptions}) || $self->dberror($myconfig->{dboptions}); } - $main::lxdebug->leave_sub(); + $main::lxdebug->leave_sub(2); return $dbh; } @@ -1578,6 +1578,18 @@ sub _get_taxcharts { $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(); @@ -1616,6 +1628,10 @@ sub get_lists { $self->_get_taxcharts($dbh, $params{"taxcharts"}); } + if ($params{"employees"}) { + $self->_get_employees($dbh, $params{"employees"}); + } + $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 - 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); @@ -1937,43 +1954,17 @@ sub create_links { } # 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 - $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")) { - # 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}) {