From 004b43a3e882c17eabb918c38ca51df3e2833121 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Tue, 22 May 2018 08:55:32 +0200 Subject: [PATCH] =?utf8?q?Lieferplan=20um=20Filter=20nach=20Abteilungen=20?= =?utf8?q?erg=C3=A4nzt?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/DeliveryPlan.pm | 9 +++++++-- doc/changelog | 2 +- templates/webpages/delivery_plan/_filter.html | 8 ++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/SL/Controller/DeliveryPlan.pm b/SL/Controller/DeliveryPlan.pm index 2332462ac..6e6eed403 100644 --- a/SL/Controller/DeliveryPlan.pm +++ b/SL/Controller/DeliveryPlan.pm @@ -16,7 +16,7 @@ use Carp; use Rose::Object::MakeMethods::Generic ( scalar => [ qw(db_args flat_filter) ], - 'scalar --get_set_init' => [ qw(models all_edit_right vc use_linked_items all_employees all_businesses) ], + 'scalar --get_set_init' => [ qw(models all_edit_right vc use_linked_items all_employees all_businesses all_departments) ], ); __PACKAGE__->run_before(sub { $::auth->assert('delivery_plan'); }); @@ -116,13 +116,14 @@ sub calc_qtys { sub make_filter_summary { my ($self) = @_; my $vc = $self->vc; - my ($business, $employee); + my ($business, $employee, $department); my $filter = $::form->{filter} || {}; my @filter_strings; $business = SL::DB::Business->new(id => $filter->{order}{customer}{"business_id"})->load->description if $filter->{order}{customer}{"business_id"}; $employee = SL::DB::Employee->new(id => $filter->{order}{employee_id})->load->name if $filter->{order}{employee_id}; + $department = SL::DB::Department->new(id => $filter->{order}{department_id})->load->description if $filter->{order}{department_id}; my @filters = ( [ $filter->{order}{"ordnumber:substr::ilike"}, $::locale->text('Number') ], @@ -137,6 +138,7 @@ sub make_filter_summary { [ $filter->{order}{customer}{"name:substr::ilike"}, $::locale->text('Customer') ], [ $filter->{order}{customer}{"customernumber:substr::ilike"}, $::locale->text('Customer Number') ], [ $business, $::locale->text('Customer type') ], + [ $department, $::locale->text('Department') ], [ $employee, $::locale->text('Employee') ], ); @@ -353,6 +355,9 @@ sub init_all_employees { sub init_all_businesses { return SL::DB::Manager::Business->get_all_sorted; } +sub init_all_departments { + return SL::DB::Manager::Department->get_all_sorted; +} sub link_to { my ($self, $object, %params) = @_; diff --git a/doc/changelog b/doc/changelog index afb9a4712..239ebba32 100644 --- a/doc/changelog +++ b/doc/changelog @@ -28,7 +28,7 @@ Mittelgroße neue Features: Kleinere neue Features und Detailverbesserungen: - Verknüpfte Belege um die Verknüpfung von Beleg nach E-Mail-Journal erweitert. - + - Filter nach Abteilungen für Lieferplan 2017-12-12 - Release 3.5.1 diff --git a/templates/webpages/delivery_plan/_filter.html b/templates/webpages/delivery_plan/_filter.html index 2f195885e..65ed96486 100644 --- a/templates/webpages/delivery_plan/_filter.html +++ b/templates/webpages/delivery_plan/_filter.html @@ -78,6 +78,14 @@ style => 'width: 200px') %] + [%- IF SELF.all_departments.size %] + + [% 'Department' | $T8 %] + + [% L.select_tag('filter.order.department_id', SELF.all_departments, default=filter.order.department_id, title_key='description', with_empty=1, style='width:200px') %] + + + [%- END %] [% 'Type' | $T8 %] -- 2.20.1