Verkäufer-/Bearbeiter-Drop-Downs in mehreren Masken sortiert anzeigen
authorMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 31 Jan 2014 14:31:21 +0000 (15:31 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 31 Jan 2014 14:31:21 +0000 (15:31 +0100)
SL/DB/Manager/Employee.pm
bin/mozilla/ar.pl
bin/mozilla/dn.pl
bin/mozilla/do.pl
bin/mozilla/fu.pl
bin/mozilla/gl.pl
bin/mozilla/ir.pl
bin/mozilla/is.pl
bin/mozilla/oe.pl

index 8acd7da..410a04a 100644 (file)
@@ -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});
index 5bb45bd..e0ed1e7 100644 (file)
@@ -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
index 9cac44e..52ed58b 100644 (file)
@@ -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);
 
index 2a9c442..400df9e 100644 (file)
@@ -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');
index 8dc5db6..e49c8ac 100644 (file)
@@ -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} };
 
index fb0de34..a4ee01d 100644 (file)
@@ -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', {
index 2be2776..db7b8e1 100644 (file)
@@ -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,
index 4418d83..aa6a4be 100644 (file)
@@ -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 ] ]
   ]);
index 355bc87..1bc88d3 100644 (file)
@@ -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}" };