From ca18e0478035f63cf5de535b09f48e2c28b36a4d Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 7 Jan 2014 14:11:35 +0100 Subject: [PATCH] =?utf8?q?SL::Form->get=5Flists=20f=C3=BCr=20employees:=20?= =?utf8?q?Gel=C3=B6schte=20nur=20auf=20Anfrage=20mitliefern?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Behebt #2116. --- SL/Form.pm | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/SL/Form.pm b/SL/Form.pm index f0500d3b5..e115f9706 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -2137,10 +2137,22 @@ sub _get_taxzones { sub _get_employees { $main::lxdebug->enter_sub(); - my ($self, $dbh, $default_key, $key) = @_; + my ($self, $dbh, $params) = @_; + + my $deleted = 0; + + my $key; + if (ref $params eq 'HASH') { + $key = $params->{key}; + $deleted = $params->{deleted}; + + } else { + $key = $params; + } - $key = $default_key unless ($key); - $self->{$key} = selectall_hashref_query($self, $dbh, qq|SELECT * FROM employee ORDER BY lower(name)|); + $key ||= "all_employees"; + my $filter = $deleted ? '' : 'WHERE NOT COALESCE(deleted, FALSE)'; + $self->{$key} = selectall_hashref_query($self, $dbh, qq|SELECT * FROM employee $filter ORDER BY lower(name)|); $main::lxdebug->leave_sub(); } @@ -2380,7 +2392,7 @@ sub get_lists { } if ($params{"employees"}) { - $self->_get_employees($dbh, "all_employees", $params{"employees"}); + $self->_get_employees($dbh, $params{"employees"}); } if ($params{"salesmen"}) { -- 2.20.1