From 3914f665ce62b6d04c5441b94f19820d05917c1e Mon Sep 17 00:00:00 2001
From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= <bernd@kivitendo-premium.de>
Date: Fri, 6 Nov 2015 12:22:29 +0100
Subject: [PATCH] Auftrags-Controller: Abteilungen

---
 SL/Controller/Order.pm                        | 1 +
 templates/webpages/order/tabs/basic_data.html | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm
index b795d14fc..6c71422ac 100644
--- a/SL/Controller/Order.pm
+++ b/SL/Controller/Order.pm
@@ -629,6 +629,7 @@ sub _pre_render {
   my ($self) = @_;
 
   $self->{all_taxzones}        = SL::DB::Manager::TaxZone->get_all_sorted();
+  $self->{all_departments}     = SL::DB::Manager::Department->get_all_sorted();
   $self->{all_employees}       = SL::DB::Manager::Employee->get_all(where => [ or => [ id => $self->order->employee_id,
                                                                                        deleted => 0 ] ],
                                                                     sort_by => 'name');
diff --git a/templates/webpages/order/tabs/basic_data.html b/templates/webpages/order/tabs/basic_data.html
index 32880cf6e..0fd301d2c 100644
--- a/templates/webpages/order/tabs/basic_data.html
+++ b/templates/webpages/order/tabs/basic_data.html
@@ -41,6 +41,15 @@
             <td>[% L.select_tag('order.taxzone_id', SELF.all_taxzones, default=SELF.order.taxzone_id, title_key='description', style='width: 300px', class='recalc') %]</td>
           </tr>
 
+[%- IF SELF.all_departments.size %]
+          <tr>
+            <th align="right">[% 'Department' | $T8 %]</th>
+            <td>
+              [% L.select_tag('order.department_id', SELF.all_departments, default=SELF.order.department_id, title_key='description', with_empty=1, style='width:300px') %]
+            </td>
+          </tr>
+[%- END %]
+
           <tr>
             <th align="right">[% 'Shipping Point' | $T8 %]</th>
             <td>[% L.input_tag('order.shippingpoint', SELF.order.shippingpoint, style='width: 300px') %]</td>
-- 
2.20.1