Lieferplan: Filter für Projektnummer und Kundentyp
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Mon, 25 Nov 2013 14:48:26 +0000 (15:48 +0100)
committerJan Büren <jan@kivitendo-premium.de>
Tue, 25 Nov 2014 14:51:57 +0000 (15:51 +0100)
Conflicts:

SL/Controller/DeliveryPlan.pm

SL/Controller/DeliveryPlan.pm
templates/webpages/delivery_plan/_filter.html

index c68cc4c..a07dc3e 100644 (file)
@@ -5,6 +5,7 @@ use parent qw(SL::Controller::Base);
 
 use Clone qw(clone);
 use SL::DB::OrderItem;
+use SL::DB::Business;
 use SL::Controller::Helper::GetModels;
 use SL::Controller::Helper::ReportGenerator;
 use SL::Locale::String;
@@ -39,8 +40,9 @@ sub action_list {
   $self->prepare_report;
 
   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
@@ -122,17 +124,20 @@ sub make_filter_summary {
   my $filter = $::form->{filter} || {};
   my @filter_strings;
 
+  my $business = SL::DB::Business->new(id => $filter->{order}{customer}{"business_id"})->load->description if $filter->{order}{customer}{"business_id"};
   my @filters = (
-    [ $filter->{order}{"ordnumber:substr::ilike"},                $::locale->text('Number')                                             ],
-    [ $filter->{part}{"partnumber:substr::ilike"},                $::locale->text('Part Number')                                        ],
-    [ $filter->{"description:substr::ilike"},                     $::locale->text('Part Description')                                   ],
-    [ $filter->{"reqdate:date::ge"},                              $::locale->text('Delivery Date') . " " . $::locale->text('From Date') ],
-    [ $filter->{"reqdate:date::le"},                              $::locale->text('Delivery Date') . " " . $::locale->text('To Date')   ],
-    [ $filter->{"qty:number"},                                    $::locale->text('Quantity')                                           ],
-    [ $filter->{order}{vendor}{"name:substr::ilike"},             $::locale->text('Vendor')                                             ],
-    [ $filter->{order}{vendor}{"vendornumber:substr::ilike"},     $::locale->text('Vendor Number')                                      ],
-    [ $filter->{order}{customer}{"name:substr::ilike"},           $::locale->text('Customer')                                           ],
-    [ $filter->{order}{customer}{"customernumber:substr::ilike"}, $::locale->text('Customer Number')                                    ],
+    [ $filter->{order}{"ordnumber:substr::ilike"},                    $::locale->text('Number')                                             ],
+    [ $filter->{order}{globalproject}{"projectnumber:substr::ilike"}, $::locale->text('Document Project Number')                            ],
+    [ $filter->{part}{"partnumber:substr::ilike"},                    $::locale->text('Part Number')                                        ],
+    [ $filter->{"description:substr::ilike"},                         $::locale->text('Part Description')                                   ],
+    [ $filter->{"reqdate:date::ge"},                                  $::locale->text('Delivery Date') . " " . $::locale->text('From Date') ],
+    [ $filter->{"reqdate:date::le"},                                  $::locale->text('Delivery Date') . " " . $::locale->text('To Date')   ],
+    [ $filter->{"qty:number"},                                        $::locale->text('Quantity')                                           ],
+    [ $filter->{order}{vendor}{"name:substr::ilike"},                 $::locale->text('Vendor')                                             ],
+    [ $filter->{order}{vendor}{"vendornumber:substr::ilike"},         $::locale->text('Vendor Number')                                      ],
+    [ $filter->{order}{customer}{"name:substr::ilike"},               $::locale->text('Customer')                                           ],
+    [ $filter->{order}{customer}{"customernumber:substr::ilike"},     $::locale->text('Customer Number')                                    ],
+    [ $business,                                                      $::locale->text('Customer type')                                      ],
   );
 
   my %flags = (
index fef7c31..1bd64f1 100644 (file)
    <th align="right">[% 'Number' | $T8 %]</th>
    <td>[% L.input_tag('filter.order.ordnumber:substr::ilike', filter.order.ordnumber_substr__ilike, size = 20) %]</td>
   </tr>
+  <tr>
+   <th align="right">[% 'Document Project Number' | $T8 %]</th>
+   <td>[% L.input_tag('filter.order.globalproject.projectnumber:substr::ilike', filter.order.globalproject.projectnumber_substr__ilike, size = 20) %]</td>
+  </tr>
   <tr>
    <th align="right">[% 'Part Number' | $T8 %]</th>
    <td>[% L.input_tag('filter.part.partnumber:substr::ilike', filter.part.partnumber_substr__ilike, size = 20) %]</td>
     <td>[% L.input_tag('filter.order.vendor.vendornumber:substr::ilike', filter.order.vendor.vendornumber_substr__ilike, size = 20) %]</td>
    </tr>
 [% END %]
+  <tr>
+   <th align="right">[% 'Customer type' | $T8 %]</th>
+   <td>
+     [% L.select_tag('filter.order.customer.business_id', SELF.all_businesses,
+                     default    => filter.order.customer.business_id,
+                     title_key  => 'description',
+                     value_key  => 'id',
+                     with_empty => 1,
+                     style      => 'width: 200px') %]
+   </td>
+  </tr>
   <tr>
    <th align="right">[% 'Type' | $T8 %]</th>
    <td>