Lieferplan um Filter nach Abteilungen ergänzt
authorJan Büren <jan@kivitendo-premium.de>
Tue, 22 May 2018 06:55:32 +0000 (08:55 +0200)
committerJan Büren <jan@kivitendo-premium.de>
Tue, 22 May 2018 06:55:32 +0000 (08:55 +0200)
SL/Controller/DeliveryPlan.pm
doc/changelog
templates/webpages/delivery_plan/_filter.html

index 2332462..6e6eed4 100644 (file)
@@ -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) = @_;
 
index afb9a47..239ebba 100644 (file)
@@ -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
 
index 2f19588..65ed964 100644 (file)
                      style      => 'width: 200px') %]
    </td>
   </tr>
+  [%- IF SELF.all_departments.size %]
+    <tr>
+      <th align="right">[% 'Department' | $T8 %]</th>
+      <td>
+        [% L.select_tag('filter.order.department_id', SELF.all_departments, default=filter.order.department_id, title_key='description', with_empty=1, style='width:200px') %]
+      </td>
+    </tr>
+  [%- END %]
   <tr>
    <th align="right">[% 'Type' | $T8 %]</th>
    <td>