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});
"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
$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);
"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 ] ]
]);
"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');
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} };
$::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', {
"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,
"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 ] ]
]);
# 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 ] ]
]);
"$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}" };