From 0bf218ffc697e15d375347e9ab5a4ece573f295b Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 28 Jul 2010 09:54:00 +0200 Subject: [PATCH] =?utf8?q?Im=20Vertretermodus=20auch=20ung=C3=BCltige=20Ve?= =?utf8?q?rtreter=20in=20Vertreterauswahl=20anzeigen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Form.pm | 8 ++++++-- bin/mozilla/ct.pl | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/SL/Form.pm b/SL/Form.pm index 4a5ff406b..22af6fb43 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -2373,9 +2373,13 @@ sub _get_customers { 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)| : ''; - my $query = qq|SELECT * FROM customer WHERE NOT obsolete $where ORDER BY name $limit_clause|; + my @where; + push @where, qq|business_id IN (SELECT id FROM business WHERE salesman)| if $options->{business_is_salesman}; + push @where, qq|NOT obsolete| if !$options->{with_obsolete}; + my $where_str = @where ? "WHERE " . join(" AND ", map { "($_)" } @where) : ''; + + my $query = qq|SELECT * FROM customer $where_str ORDER BY name $limit_clause|; $self->{ $options->{key} } = selectall_hashref_query($self, $dbh, $query); $main::lxdebug->leave_sub(); diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index 274ae4a6d..b6526b933 100644 --- a/bin/mozilla/ct.pl +++ b/bin/mozilla/ct.pl @@ -289,7 +289,7 @@ sub form_header { taxzones => "ALL_TAXZONES"); $form->get_pricegroup(\%myconfig, { all => 1 }); - $form->get_lists(customers => { key => "ALL_SALESMAN_CUSTOMERS", business_is_salesman => 1 }) if $::vertreter; + $form->get_lists(customers => { key => "ALL_SALESMAN_CUSTOMERS", business_is_salesman => 1, with_obsolete => 1 }) if $::vertreter; $form->{ALL_SALESMEN} = $form->{ALL_EMPLOYEES}; $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : ""; -- 2.20.1