From 8af39a65f18765dc26b93a8b25bfdd21dad5812c Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 15 Nov 2012 13:46:54 +0100 Subject: [PATCH] =?utf8?q?Datenbankabfrage=20mit=20leerem=20Feld=20f=C3=BC?= =?utf8?q?r=20employee=5Fid=20vermeiden?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fixt #2055. --- bin/mozilla/oe.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 391ec1a00..a6050945c 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -341,8 +341,9 @@ sub form_header { "price_factors" => "ALL_PRICE_FACTORS"); # label subs - $TMPL_VAR{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ or => [ id => $::form->{employee_id}, deleted => 0 ] ]); - $TMPL_VAR{ALL_SALESMEN} = SL::DB::Manager::Employee->get_all(query => [ or => [ id => $::form->{salesman_id}, deleted => 0 ] ]); + my $employee_list_query_gen = sub { $::form->{$_[0]} ? [ or => [ id => $::form->{$_[0]}, deleted => 0 ] ] : [ deleted => 0 ] }; + $TMPL_VAR{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => $employee_list_query_gen->('employee_id')); + $TMPL_VAR{ALL_SALESMEN} = SL::DB::Manager::Employee->get_all(query => $employee_list_query_gen->('salesman_id')); $TMPL_VAR{ALL_SHIPTO} = SL::DB::Manager::Shipto->get_all(query => [ or => [ trans_id => $::form->{"$::form->{vc}_id"} * 1, and => [ shipto_id => $::form->{shipto_id} * 1, trans_id => undef ] ] ]); -- 2.20.1