X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FForm.pm;h=5a2e73f87ebc32b0e0af39218c4dbc41cdfc7a49;hb=fd6900cca59ac4a35d5fa4c20db91165f9310ea3;hp=0718a83ff6c84923bd6ee9a253cf6ef7a9fa1a55;hpb=e7191bc2818007bf58cec5e2167e977904f0ac44;p=kivitendo-erp.git diff --git a/SL/Form.pm b/SL/Form.pm index 0718a83ff..5a2e73f87 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1574,6 +1574,62 @@ sub _get_languages { $main::lxdebug->leave_sub(); } +sub _get_dunning_configs { + $main::lxdebug->enter_sub(); + + my ($self, $dbh, $key) = @_; + + $key = "all_dunning_configs" unless ($key); + + my $query = qq|SELECT * FROM dunning_config ORDER BY dunning_level|; + + $self->{$key} = selectall_hashref_query($self, $dbh, $query); + + $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_vendors { + $main::lxdebug->enter_sub(); + + my ($self, $dbh, $key) = @_; + + $key = "all_vendors" unless ($key); + + my $query = qq|SELECT * FROM vendor|; # LIMIT $main::myconfig{vclimit}|; + + $self->{$key} = selectall_hashref_query($self, $dbh, $query); + + $main::lxdebug->leave_sub(); +} + sub get_lists { $main::lxdebug->enter_sub(); @@ -1628,6 +1684,22 @@ sub get_lists { $self->_get_business_types($dbh, $params{"business_types"}); } + 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"}); + } + + if($params{"vendors"}) { + $self->_get_vendors($dbh, $params{"vendors"}); + } + $dbh->disconnect(); $main::lxdebug->leave_sub(); @@ -1926,14 +1998,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%"); @@ -2280,6 +2351,7 @@ sub save_status { # $main::locale->text('PRINTED') # $main::locale->text('MAILED') # $main::locale->text('SCREENED') +# $main::locale->text('CANCELED') # $main::locale->text('invoice') # $main::locale->text('proforma') # $main::locale->text('sales_order')