From 175dd1fb247e46407ebc773b8103fc773a806fdf Mon Sep 17 00:00:00 2001 From: Niclas Zimmermann Date: Tue, 18 Sep 2012 15:11:05 +0200 Subject: [PATCH] =?utf8?q?W=C3=A4hrung=20in=20Verkaufs-/Einkaufsrechnungj?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In der Verkaufsrechnung traten noch einige Fehler auf, wenn man ausländische Währungen angegeben hat. Wechselkurse wurden als Null angezeigt und es gab kein Eingabefeld, wenn der Wechselkurs an einem Datum noch nicht in der Datenbank vorhanden war. In Eingabefelder eingegebene Werte wurden ignoriert. In der Einkaufsrechnung traten ähnliche Fehler auf. Hier wurde nicht einmal ein Wechselkurs angezeigt, obwohl Standardwährung und in der Rechnung verwendete Währung nicht übereinstimmen. --- bin/mozilla/ir.pl | 3 ++- bin/mozilla/is.pl | 3 +++ templates/webpages/ir/_payments.html | 6 +++--- templates/webpages/is/_payments.html | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index 7d5c36ab6..f909d86f6 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -316,7 +316,8 @@ sub form_header { my @values = map { $_ } @{ $form->{ALL_CURRENCIES} }; my %labels = map { $_ => $_ } @{ $form->{ALL_CURRENCIES} }; $form->{currency} = $form->{defaultcurrency} unless $form->{currency}; - $TMPL_VAR{show_exchangerate} = $form->{currency} ne $form->{defaultcurrency}; + # show_exchangerate is also later needed in another template + $form->{show_exchangerate} = $form->{currency} ne $form->{defaultcurrency}; $TMPL_VAR{currencies} = NTI($cgi->popup_menu('-name' => 'currency', '-default' => $form->{"currency"}, '-values' => \@values, '-labels' => \%labels, '-onchange' => "document.getElementById('update_button').click();" diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 4716f60e3..56162d543 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -517,6 +517,9 @@ sub update { for my $i (1 .. $form->{paidaccounts}) { next unless $form->{"paid_$i"}; map { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } qw(paid exchangerate); + if (!$form->{"forex_$i"}) { #read exchangerate from input field (not hidden) + $form->{exchangerate} = $form->{"exchangerate_$i"}; + } $form->{"forex_$i"} = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'buy'); $form->{"exchangerate_$i"} = $form->{"forex_$i"} if $form->{"forex_$i"}; } diff --git a/templates/webpages/ir/_payments.html b/templates/webpages/ir/_payments.html index 1677219d4..6d7db5ea0 100644 --- a/templates/webpages/ir/_payments.html +++ b/templates/webpages/ir/_payments.html @@ -75,9 +75,9 @@ [% SET forex = 'forex_' _ i %] [% SET exchangerate = 'exchangerate_' _ i %] - [% IF forex %] + [% IF $forex %] - [% LxERP.format_amount(exchangerate, 2) %] + [% LxERP.format_amount($forex, 2) %] [% ELSE %] [% IF $changeable %] @@ -86,7 +86,7 @@ [% LxERP.format_amount($exchangerate, 2, 1) %] [% END %] [% END %] - ; + [% END %] diff --git a/templates/webpages/is/_payments.html b/templates/webpages/is/_payments.html index a87221502..41b018615 100644 --- a/templates/webpages/is/_payments.html +++ b/templates/webpages/is/_payments.html @@ -78,7 +78,7 @@ [% SET forex = 'forex_' _ i %] [% SET exchangerate = 'exchangerate_' _ i %] - [% IF forex %] + [% IF $forex %] [% LxERP.format_amount($forex, 2) %] [% ELSE %] -- 2.20.1