Lieferplan / Lieferwertbericht um Filter Bearbeiter erweitert
authorJan Büren <jan@kivitendo-premium.de>
Tue, 25 Nov 2014 17:05:27 +0000 (18:05 +0100)
committerJan Büren <jan@kivitendo-premium.de>
Tue, 25 Nov 2014 17:05:27 +0000 (18:05 +0100)
SL/Controller/DeliveryPlan.pm
templates/webpages/delivery_plan/_filter.html

index a07dc3e..8d2417e 100644 (file)
@@ -13,7 +13,7 @@ use Carp;
 
 use Rose::Object::MakeMethods::Generic (
   scalar => [ qw(db_args flat_filter) ],
-  'scalar --get_set_init' => [ qw(models all_edit_right mode vc) ],
+  'scalar --get_set_init' => [ qw(models all_edit_right mode vc all_employees) ],
 );
 
 __PACKAGE__->run_before(sub { $::auth->assert('delivery_plan'); });
@@ -42,7 +42,7 @@ sub action_list {
   my $orderitems = $self->models->get;
   $self->{all_businesses} = SL::DB::Manager::Business->get_all_sorted;
 
-    $self->report_generator_list_objects(report => $self->{report}, objects => $orderitems);
+  $self->report_generator_list_objects(report => $self->{report}, objects => $orderitems);
 }
 
 # private functions
@@ -125,6 +125,8 @@ sub make_filter_summary {
   my @filter_strings;
 
   my $business = SL::DB::Business->new(id => $filter->{order}{customer}{"business_id"})->load->description if $filter->{order}{customer}{"business_id"};
+  my $employee = SL::DB::Employee->new(id => $filter->{order}{employee_id})->load->name if $filter->{order}{employee_id};
+
   my @filters = (
     [ $filter->{order}{"ordnumber:substr::ilike"},                    $::locale->text('Number')                                             ],
     [ $filter->{order}{globalproject}{"projectnumber:substr::ilike"}, $::locale->text('Document Project Number')                            ],
@@ -138,6 +140,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')                                      ],
+    [ $employee,                                                      $::locale->text('Employee')                                           ],
   );
 
   my %flags = (
@@ -300,6 +303,9 @@ sub init_mode {
   return $::form->{mode} if ($::form->{mode} eq 'delivery_value_report' || $::form->{mode} eq 'delivery_plan') || croak "self (DeliveryPlan) has no mode defined";
 }
 
+sub init_all_employees {
+  return SL::DB::Manager::Employee->get_all_sorted;
+}
 sub link_to {
   my ($self, $object, %params) = @_;
 
index 1bd64f1..244300e 100644 (file)
                      style      => 'width: 200px') %]
    </td>
   </tr>
+  <tr>
+   <th align="right">[% 'Employee' | $T8 %]</th>
+   <td>
+     [% L.select_tag('filter.order.employee_id', SELF.all_employees,
+                     default    => filter.order.employee_id,
+                     title_key  => 'name',
+                     value_key  => 'id',
+                     with_empty => 1,
+                     style      => 'width: 200px') %]
+   </td>
+  </tr>
   <tr>
    <th align="right">[% 'Type' | $T8 %]</th>
    <td>
@@ -83,7 +94,7 @@
 [% L.hidden_tag('page', FORM.page) %]
 [% L.hidden_tag('vc', SELF.vc) %]
 [% L.hidden_tag('mode', SELF.mode) %]
-  [% L.input_tag('action_list', LxERP.t8('Continue'), type = 'submit', class='submit')%]
+[% L.input_tag('action_list', LxERP.t8('Continue'), type = 'submit', class='submit')%]
 
 
 <a href='#' onClick='javascript:$("#filter_table input").val("");$("#filter_table input[type=checkbox]").prop("checked", 0);'>[% 'Reset' | $T8 %]</a>