X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=SL%2FForm.pm;h=9ba3f43bcdd1acb316119c10ada8d239145f91a0;hb=a5d5620d468d74e593ee31ece1d7dc3612d14faa;hp=da224ab74bedb63a6c9e80f4c442cb767cc2bf8b;hpb=a0f1b42042cb4f7033d79244892647661803dadf;p=kivitendo-erp.git diff --git a/SL/Form.pm b/SL/Form.pm index da224ab74..9ba3f43bc 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1588,6 +1588,34 @@ sub _get_dunning_configs { $main::lxdebug->leave_sub(); } +sub _get_currencies { +$main::lxdebug->enter_sub(); + + my ($self, $dbh, $key) = @_; + + $key = "all_currencies" unless ($key); + + my $query = qq|SELECT curr AS currency FROM defaults|; + + $self->{$key} = [split(/\:/ , selectfirst_hashref_query($self, $dbh, $query)->{currency})]; + + $main::lxdebug->leave_sub(); +} + +sub _get_customers { + $main::lxdebug->enter_sub(); + + my ($self, $dbh, $key) = @_; + + $key = "all_customers" unless ($key); + + my $query = qq|SELECT * FROM customer LIMIT $main::myconfig{vclimit}|; + + $self->{$key} = selectall_hashref_query($self, $dbh, $query); + + $main::lxdebug->leave_sub(); +} + sub get_lists { $main::lxdebug->enter_sub(); @@ -1645,6 +1673,14 @@ sub get_lists { if ($params{"dunning_configs"}) { $self->_get_dunning_configs($dbh, $params{"dunning_configs"}); } + + if($params{"currencies"}) { + $self->_get_currencies($dbh, $params{"currencies"}); + } + + if($params{"customers"}) { + $self->_get_customers($dbh, $params{"customers"}); + } $dbh->disconnect(); @@ -1944,14 +1980,13 @@ 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 ? - AND ( tk.chart_id = c.id OR c.link LIKE '%_tax%') - AND (NOT tk.chart_id = c.id OR NOT c.link LIKE '%_tax%') - AND (tk.id = (SELECT id FROM taxkeys WHERE taxkeys.chart_id = c.id AND startdate <= $transdate ORDER BY startdate DESC LIMIT 1) - OR c.link LIKE '%_tax%') - ORDER BY c.accno|; + $query = qq|SELECT c.accno, c.description, c.link, c.taxkey_id, tk.tax_id + FROM chart c + LEFT JOIN taxkeys tk ON (tk.chart_id = c.id) + WHERE c.link LIKE ? + AND (tk.id = (SELECT id FROM taxkeys WHERE taxkeys.chart_id = c.id AND startdate <= $transdate ORDER BY startdate DESC LIMIT 1) + OR c.link LIKE '%_tax%') + ORDER BY c.accno|; $sth = $dbh->prepare($query); do_statement($self, $sth, $query, "%$module%");