From: Moritz Bunkus Date: Thu, 4 Mar 2010 11:08:15 +0000 (+0100) Subject: "Vertreter" sind Kunden mit Kundentyp mit Vertreter-Flag, nicht die Kundentypen selber X-Git-Tag: release-2.6.1beta1~33^2~8 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=9d60642b51924a3fc44a0108777f0611ae19fb30;p=kivitendo-erp.git "Vertreter" sind Kunden mit Kundentyp mit Vertreter-Flag, nicht die Kundentypen selber --- diff --git a/SL/Form.pm b/SL/Form.pm index 82f073ed7..956120568 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -2299,14 +2299,15 @@ $main::lxdebug->enter_sub(); sub _get_customers { $main::lxdebug->enter_sub(); - my ($self, $dbh, $key, $limit) = @_; - - $key = "all_customers" unless ($key); - my $limit_clause = "LIMIT $limit" if $limit; + my ($self, $dbh, $key) = @_; - my $query = qq|SELECT * FROM customer WHERE NOT obsolete ORDER BY name $limit_clause|; + my $options = ref $key eq 'HASH' ? $key : { key => $key }; + $options->{key} ||= "all_customers"; + my $limit_clause = "LIMIT $options->{limit}" if $options->{limit}; + my $where = $options->{business_is_salesman} ? qq| AND business_id IN (SELECT id FROM business WHERE salesman)| : ''; - $self->{$key} = selectall_hashref_query($self, $dbh, $query); + my $query = qq|SELECT * FROM customer WHERE NOT obsolete $where ORDER BY name $limit_clause|; + $self->{ $options->{key} } = selectall_hashref_query($self, $dbh, $query); $main::lxdebug->leave_sub(); } @@ -2473,11 +2474,7 @@ sub get_lists { } if($params{"customers"}) { - if (ref $params{"customers"} eq 'HASH') { - $self->_get_customers($dbh, $params{"customers"}{key}, $params{"customers"}{limit}); - } else { - $self->_get_customers($dbh, $params{"customers"}); - } + $self->_get_customers($dbh, $params{"customers"}); } if($params{"vendors"}) { diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index c2d3b9069..7fe6afa64 100644 --- a/bin/mozilla/ct.pl +++ b/bin/mozilla/ct.pl @@ -285,11 +285,12 @@ sub form_header { my %myconfig = %main::myconfig; my $locale = $main::locale; - $form->get_lists(employees => "ALL_EMPLOYEES", - taxzones => "ALL_TAXZONES", - business_types => { key => 'ALL_SALESMAN_BUSINESSES', salesman => 1 }); + $form->get_lists(employees => "ALL_EMPLOYEES", + taxzones => "ALL_TAXZONES"); $form->get_pricegroup(\%myconfig, { all => 1 }); + $form->get_lists(customers => { key => "ALL_SALESMAN_CUSTOMERS", business_is_salesman => 1 }) if $::vertreter; + $form->{ALL_SALESMEN} = $form->{ALL_EMPLOYEES}; $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : ""; $form->{is_admin} = $myconfig{role} eq 'admin'; diff --git a/templates/webpages/ct/form_header_de.html b/templates/webpages/ct/form_header_de.html index 4113f0d77..2cf95adc9 100644 --- a/templates/webpages/ct/form_header_de.html +++ b/templates/webpages/ct/form_header_de.html @@ -39,11 +39,10 @@ Vertreter [%- INCLUDE generic/multibox.html - name = 'salesman_id', - DATA = ALL_SALESMAN_BUSINESSES, - show_empty = 1, - id_key = 'id', - label_key = 'description', + name = 'salesman_id', + DATA = ALL_SALESMAN_CUSTOMERS, + id_key = 'id', + label_key = 'name', -%] @@ -245,7 +244,7 @@ label_key = 'description', -%] - [%- IF is_customer && !use_vertreter %] + [%- IF is_customer && !conf_vertreter %] Verkäufer/in [%- INCLUDE generic/multibox.html diff --git a/templates/webpages/ct/form_header_master.html b/templates/webpages/ct/form_header_master.html index 33ecfef27..4c2db99d3 100644 --- a/templates/webpages/ct/form_header_master.html +++ b/templates/webpages/ct/form_header_master.html @@ -39,11 +39,10 @@ Representative [%- INCLUDE generic/multibox.html - name = 'salesman_id', - DATA = ALL_SALESMAN_BUSINESSES, - show_empty = 1, - id_key = 'id', - label_key = 'description', + name = 'salesman_id', + DATA = ALL_SALESMAN_CUSTOMERS, + id_key = 'id', + label_key = 'name', -%] @@ -245,7 +244,7 @@ label_key = 'description', -%] - [%- IF is_customer && !use_vertreter %] + [%- IF is_customer && !conf_vertreter %] Salesman [%- INCLUDE generic/multibox.html