From 122f91e7b6682ad3d6a403cad1be2d686df0db39 Mon Sep 17 00:00:00 2001
From: Moritz Bunkus <m.bunkus@linet-services.de>
Date: Fri, 20 Jan 2017 14:45:07 +0100
Subject: [PATCH] =?utf8?q?Kreditorenbuchungen:=20W=C3=A4hrungs-Drop-Down?=
 =?utf8?q?=20nicht=20als=20Hidden=20mitschleifen?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

---
 bin/mozilla/ap.pl                      | 7 +++----
 templates/webpages/ap/form_header.html | 3 +--
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl
index ca88e920c..5388714eb 100644
--- a/bin/mozilla/ap.pl
+++ b/bin/mozilla/ap.pl
@@ -42,6 +42,7 @@ use SL::GL;
 use SL::IR;
 use SL::IS;
 use SL::ReportGenerator;
+use SL::DB::Currency;
 use SL::DB::Default;
 use SL::DB::PurchaseInvoice;
 use SL::Webdav;
@@ -185,9 +186,6 @@ sub create_links {
   # currencies
   $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
 
-  $form->{selectcurrency} = "";
-  map { my $quoted = H($_); $form->{selectcurrency} .= "<option value=\"${quoted}\">${quoted}\n" } $form->get_all_currencies(\%myconfig);
-
   # vendors
   if (@{ $form->{all_vendor} || [] }) {
     $form->{vendor} = qq|$form->{vendor}--$form->{vendor_id}|;
@@ -248,7 +246,7 @@ sub form_header {
   # type=submit $locale->text('Edit Accounts Payables Transaction')
 
   # set option selected
-  foreach my $item (qw(vendor currency)) {
+  foreach my $item (qw(vendor)) {
     my $to_replace         =  H($form->{$item});
     $form->{"select$item"} =~ s/ selected//;
     $form->{"select$item"} =~ s/>\Q${to_replace}\E/ selected>${to_replace}/;
@@ -427,6 +425,7 @@ sub form_header {
 
   print $form->parse_html_template('ap/form_header', {
     today => DateTime->today,
+    currencies => SL::DB::Manager::Currency->get_all_sorted,
   });
 
   $main::lxdebug->leave_sub();
diff --git a/templates/webpages/ap/form_header.html b/templates/webpages/ap/form_header.html
index 9623a712b..9f4ee97d7 100644
--- a/templates/webpages/ap/form_header.html
+++ b/templates/webpages/ap/form_header.html
@@ -6,7 +6,6 @@
 <form method="post" action="[% script | html %]">
 
 <input type="hidden" name="selectvendor" value="[% selectvendor | html %]">
-<input type="hidden" name="selectcurrency" value="[% selectcurrency | html %]">
 
 <input type="hidden" name="oldvendor" value="[% oldvendor | html %]">
 <input type="hidden" name="vendor_id" value="[% vendor_id | html %]">
@@ -113,7 +112,7 @@
 
               <tr>
                 <th align="right" nowrap>[% 'Currency' | $T8 %]</th>
-                <td><select name="currency">[% selectcurrency %]</select></td>
+                <td>[% L.select_tag("currency", currencies, default=currency, value_key="name", title_key="name") %]</td>
 
                 [% IF ( defaultcurrency && (currency != defaultcurrency) ) %]
                   <th align=right>[% 'Exchangerate' | $T8 %]</th>
-- 
2.20.1