commit c17d679a939585324f8690e04c4d32ff4a1f4053
Author: Geoffrey Richardson <information@kivitendo-premium.de>
Date:   Fri Jan 20 12:03:59 2017 +0100

    Verkaufsbericht - Abteilung korrekt behandeln
    
    und Umstellung auf select_tag

diff --git a/SL/VK.pm b/SL/VK.pm
index cb165ebef..3ec6e0870 100644
--- a/SL/VK.pm
+++ b/SL/VK.pm
@@ -148,10 +148,9 @@ sub invoice_transactions {
     $where .= " AND ar.transdate <= ?";
     push(@values, $form->{transdateto});
   }
-  if ($form->{department}) {
-    my ($null, $department_id) = split /--/, $form->{department};
+  if ($form->{department_id}) {
     $where .= " AND ar.department_id = ?";
-    push(@values, $department_id);
+    push @values, conv_i($form->{department_id});
   }
   if ($form->{employee_id}) {
     $where .= " AND ar.employee_id = ?";
diff --git a/bin/mozilla/vk.pl b/bin/mozilla/vk.pl
index 59ba7b420..c7a886feb 100644
--- a/bin/mozilla/vk.pl
+++ b/bin/mozilla/vk.pl
@@ -55,7 +55,7 @@ sub search_invoice {
   my %myconfig = %main::myconfig;
   my $locale   = $main::locale;
 
-  my ($customer, $department);
+  my ($customer);
 
   # setup customer selection
   $form->all_vc(\%myconfig, "customer", "AR");
@@ -154,7 +154,7 @@ sub invoice_transactions {
   # pass hidden variables for pdf/csv export
   # first with l_ to determine which columns to show
   # then with the options for headings (such as transdatefrom, partnumber, ...)
-  my @hidden_variables  = (qw(l_headers_mainsort l_headers_subsort l_subtotal_mainsort l_subtotal_subsort l_total l_parts l_customername l_customernumber transdatefrom transdateto decimalplaces customer customer_id department partnumber partsgroup country business description project_id customernumber salesman employee salesman_id employee_id business_id partsgroup_id mainsort subsort),
+  my @hidden_variables  = (qw(l_headers_mainsort l_headers_subsort l_subtotal_mainsort l_subtotal_subsort l_total l_parts l_customername l_customernumber transdatefrom transdateto decimalplaces customer customer_id department_id partnumber partsgroup country business description project_id customernumber salesman employee salesman_id employee_id business_id partsgroup_id mainsort subsort),
       "$form->{db}number",
       map({ "cvar_$_->{name}" } @searchable_custom_variables),
       map { "l_$_" } @columns
@@ -211,7 +211,7 @@ sub invoice_transactions {
   push @options, $locale->text('Customer')                . " : $form->{customer}"                                                          if $form->{customer};
   push @options, $locale->text('Customer Number')         . " : $form->{customernumber}"                                                    if $form->{customernumber};
   # TODO: only customer id is passed
-  push @options, $locale->text('Department')              . " : " . (split /--/, $form->{department})[0]                                    if $form->{department};
+  push @options, $locale->text('Department')              . " : " . SL::DB::Department->new(id => $form->{department_id})->load->description if $form->{department_id};
   push @options, $locale->text('Invoice Number')          . " : $form->{invnumber}"                                                         if $form->{invnumber};
   push @options, $locale->text('Invoice Date')            . " : $form->{invdate}"                                                           if $form->{invdate};
   push @options, $locale->text('Part Number')             . " : $form->{partnumber}"                                                        if $form->{partnumber};
diff --git a/templates/webpages/vk/search_invoice.html b/templates/webpages/vk/search_invoice.html
index ee1875279..f34794f25 100644
--- a/templates/webpages/vk/search_invoice.html
+++ b/templates/webpages/vk/search_invoice.html
@@ -88,15 +88,12 @@
     <tr>
       <th align=right nowrap>[% 'Department' | $T8 %]</th>
       <td>
-        [%- INCLUDE 'generic/multibox.html'
-          name          = 'department',
-          style         = 'width: 250px',
-          DATA          = ALL_DEPARTMENTS,
-          id_key        = 'id',
-          label_key     = 'description',
-          show_empty    = 1,
-          allow_textbox = 0,
-        -%]
+        [%- L.select_tag('department_id',
+                         ALL_DEPARTMENTS,
+                         title_key  = 'description',
+                         with_empty = 1,
+                         style      = 'width: 250px')
+      -%]
       </td>
 
       <th align="right">[% 'Project Number' | $T8 %]</th>
