From: Moritz Bunkus Date: Fri, 31 Jan 2014 14:48:41 +0000 (+0100) Subject: Lieferadressen-Drop-Downs in mehreren Masken sortiert anzeigen X-Git-Tag: release-3.1.0rc1~35 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=5b8e9fcb2f9c94d69519c927b8aa59184d93cea3;p=kivitendo-erp.git Lieferadressen-Drop-Downs in mehreren Masken sortiert anzeigen --- diff --git a/SL/DB/Manager/Shipto.pm b/SL/DB/Manager/Shipto.pm new file mode 100644 index 000000000..50947a37a --- /dev/null +++ b/SL/DB/Manager/Shipto.pm @@ -0,0 +1,24 @@ +package SL::DB::Manager::Shipto; + +use strict; + +use SL::DB::Helper::Manager; +use base qw(SL::DB::Helper::Manager); + +use SL::DB::Helper::Sorted; + +sub object_class { 'SL::DB::Shipto' } + +__PACKAGE__->make_manager_methods; + +sub _sort_spec { + return ( + default => [ 'full_address', 1 ], + columns => { + SIMPLE => 'ALL', + full_address => '( lower(shipto.shiptoname) || lower(shipto.shiptostreet) || lower(shipto.shiptocity) )', + map { ( $_ => "lower(shipto.shipto$_)" ) } qw(city contact country department_1 department_2 email fax name phone street zipcode) + }); +} + +1; diff --git a/SL/DB/Shipto.pm b/SL/DB/Shipto.pm index 1b174c011..b8868ab1e 100644 --- a/SL/DB/Shipto.pm +++ b/SL/DB/Shipto.pm @@ -3,6 +3,7 @@ package SL::DB::Shipto; use strict; use SL::DB::MetaSetup::Shipto; +use SL::DB::Manager::Shipto; use Rose::DB::Object::Helpers qw(clone_and_reset clone); our @SHIPTO_VARIABLES = qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact @@ -10,8 +11,6 @@ our @SHIPTO_VARIABLES = qw(shiptoname shiptostreet shiptozipcode shiptocity ship __PACKAGE__->meta->initialize; -__PACKAGE__->meta->make_manager_class; - sub displayable_id { my $self = shift; my $text = join('; ', grep { $_ } (map({ $self->$_ } qw(shiptoname shiptostreet)), diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index a804dee7a..e946e4e4b 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -273,7 +273,7 @@ sub form_header { $::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 => [ + $::form->{ALL_SHIPTO} = SL::DB::Manager::Shipto->get_all_sorted(query => [ or => [ trans_id => $::form->{"$::form->{vc}_id"} * 1, and => [ shipto_id => $::form->{shipto_id} * 1, trans_id => undef ] ] ]); $::form->{ALL_CONTACTS} = SL::DB::Manager::Contact->get_all_sorted(query => [ diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index b13de83de..a83897a45 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -319,7 +319,7 @@ sub form_header { $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 => [ + $TMPL_VAR{ALL_SHIPTO} = SL::DB::Manager::Shipto->get_all_sorted(query => [ or => [ trans_id => $::form->{"$::form->{vc}_id"} * 1, and => [ shipto_id => $::form->{shipto_id} * 1, trans_id => undef ] ] ]); $TMPL_VAR{ALL_CONTACTS} = SL::DB::Manager::Contact->get_all_sorted(query => [ diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 71748b36d..aba9c3eb8 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -345,7 +345,7 @@ sub form_header { 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_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 => [ + $TMPL_VAR{ALL_SHIPTO} = SL::DB::Manager::Shipto->get_all_sorted(query => [ or => [ trans_id => $::form->{"$::form->{vc}_id"} * 1, and => [ shipto_id => $::form->{shipto_id} * 1, trans_id => undef ] ] ]); $TMPL_VAR{ALL_CONTACTS} = SL::DB::Manager::Contact->get_all_sorted(query => [