From: Moritz Bunkus Date: Fri, 31 Jan 2014 14:31:21 +0000 (+0100) Subject: Verkäufer-/Bearbeiter-Drop-Downs in mehreren Masken sortiert anzeigen X-Git-Tag: release-3.1.0rc1~37 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=d139dd31791627953f82749d02702bcb8308ebea;p=kivitendo-erp.git Verkäufer-/Bearbeiter-Drop-Downs in mehreren Masken sortiert anzeigen --- diff --git a/SL/DB/Manager/Employee.pm b/SL/DB/Manager/Employee.pm index 8acd7da04..410a04af3 100644 --- a/SL/DB/Manager/Employee.pm +++ b/SL/DB/Manager/Employee.pm @@ -3,12 +3,23 @@ package SL::DB::Manager::Employee; use strict; use SL::DB::Helper::Manager; +use SL::DB::Helper::Sorted; use base qw(SL::DB::Helper::Manager); sub object_class { 'SL::DB::Employee' } __PACKAGE__->make_manager_methods; +sub _sort_spec { + ( + default => [ 'name', 1 ], + columns => { + SIMPLE => 'ALL', + map { +($_ => "lower(employee.$_)") } qw(deleted_email deleted_fax deleted_signature deleted_tel login name) + }, + ); +} + sub current { return undef unless $::form && $::form->{login}; return shift->find_by(login => $::form->{login}); diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 5bb45bde8..e0ed1e793 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -847,7 +847,7 @@ sub search { "departments" => "ALL_DEPARTMENTS", "customers" => "ALL_VC", "business_types" => "ALL_BUSINESS_TYPES"); - $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]); + $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]); $form->{SHOW_BUSINESS_TYPES} = scalar @{ $form->{ALL_BUSINESS_TYPES} } > 0; # constants and subs for template diff --git a/bin/mozilla/dn.pl b/bin/mozilla/dn.pl index 9cac44e3a..52ed58b18 100644 --- a/bin/mozilla/dn.pl +++ b/bin/mozilla/dn.pl @@ -298,7 +298,7 @@ sub search { $form->get_lists("customers" => "ALL_CUSTOMERS", "departments" => "ALL_DEPARTMENTS"); - $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]); + $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]); DN->get_config(\%myconfig, \%$form); diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index 2a9c44272..400df9e50 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -271,8 +271,8 @@ sub form_header { "business_types" => "ALL_BUSINESS_TYPES", ); - $::form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ or => [ id => $::form->{employee_id}, deleted => 0 ] ]); - $::form->{ALL_SALESMEN} = SL::DB::Manager::Employee->get_all(query => [ or => [ id => $::form->{salesman_id}, deleted => 0 ] ]); + $::form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ or => [ id => $::form->{employee_id}, deleted => 0 ] ]); + $::form->{ALL_SALESMEN} = SL::DB::Manager::Employee->get_all_sorted(query => [ or => [ id => $::form->{salesman_id}, deleted => 0 ] ]); $::form->{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 ] ] ]); @@ -466,7 +466,7 @@ sub search { "all" => 1 }, "departments" => "ALL_DEPARTMENTS", "$form->{vc}s" => "ALL_VC"); - $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]); + $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]); $form->{SHOW_VC_DROP_DOWN} = $myconfig{vclimit} > scalar @{ $form->{ALL_VC} }; $form->{title} = $locale->text('Delivery Orders'); diff --git a/bin/mozilla/fu.pl b/bin/mozilla/fu.pl index 8dc5db6ea..e49c8ac3d 100644 --- a/bin/mozilla/fu.pl +++ b/bin/mozilla/fu.pl @@ -403,7 +403,7 @@ sub edit_access_rights { my $access = FU->retrieve_access_rights(); - $form->{EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]); + $form->{EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]); map { $_->{access} = $access->{$_->{id}} } @{ $form->{EMPLOYEES} }; diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index fb0de34e9..a4ee01d3e 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -218,7 +218,7 @@ sub search { $::form->get_lists( projects => { key => "ALL_PROJECTS", all => 1 }, ); - $::form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]); + $::form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]); $::form->header; print $::form->parse_html_template('gl/search', { diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index 2be277685..db7b8e178 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -269,7 +269,7 @@ sub form_header { "departments" => "all_departments", "price_factors" => "ALL_PRICE_FACTORS"); - $TMPL_VAR{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ or => [ id => $::form->{employee_id}, deleted => 0 ] ]); + $TMPL_VAR{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ or => [ id => $::form->{employee_id}, deleted => 0 ] ]); $TMPL_VAR{ALL_CONTACTS} = SL::DB::Manager::Contact->get_all(query => [ or => [ cp_cv_id => $::form->{"$::form->{vc}_id"} * 1, diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 4418d83d1..aa6a4bebe 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -317,8 +317,8 @@ sub form_header { "departments" => "all_departments", "price_factors" => "ALL_PRICE_FACTORS"); - $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 ] ]); + $TMPL_VAR{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ or => [ id => $::form->{employee_id}, deleted => 0 ] ]); + $TMPL_VAR{ALL_SALESMEN} = SL::DB::Manager::Employee->get_all_sorted(query => [ or => [ id => $::form->{salesman_id}, deleted => 0 ] ]); $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 ] ] ]); diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 355bc872c..1bc88d382 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -343,8 +343,8 @@ sub form_header { # label subs 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_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => $employee_list_query_gen->('employee_id')); + $TMPL_VAR{ALL_SALESMEN} = SL::DB::Manager::Employee->get_all_sorted(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 ] ] ]); @@ -728,7 +728,7 @@ sub search { "$form->{vc}s" => "ALL_VC", "taxzones" => "ALL_TAXZONES", "business_types" => "ALL_BUSINESS_TYPES",); - $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]); + $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]); # constants and subs for template $form->{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" };