From eb8bed3f564c0c880cc8a467078c7fee579c4114 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 16 May 2007 08:13:37 +0000 Subject: [PATCH] =?utf8?q?Die=20=C3=9Cberpr=C3=BCfungen,=20ob=20eine=20Nul?= =?utf8?q?lbuchung=20vom=20Benutzer=20durchgef=C3=BChrt=20wurde,=20war=20f?= =?utf8?q?alsch=20--=20sie=20=C3=BCberpr=C3=BCfte=20falsche=20Variablen=20?= =?utf8?q?und=20auch=20falsche=20Umst=C3=A4nde.=20Au=C3=9Ferdem=20werden?= =?utf8?q?=20die=20einzelnen=20Zeilen=20der=20Zahlungsein-=20und=20-ausg?= =?utf8?q?=C3=A4nge=20eh=20schon=20vorher=20mit=20if()=20abgefragt.=20Fix?= =?utf8?q?=20f=C3=BCr=20Bug=20651.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bin/mozilla/ap.pl | 17 +++++++++++------ bin/mozilla/ar.pl | 17 +++++++++++------ locale/de/all | 2 +- locale/de/ap | 2 +- locale/de/ar | 2 +- locale/de/cp | 2 +- 6 files changed, 26 insertions(+), 16 deletions(-) diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index 83425da1a..9c71519c0 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -993,12 +993,11 @@ sub update { sub post_payment { $lxdebug->enter_sub(); for $i (1 .. $form->{paidaccounts}) { - if ($form->{"paid_$i"}) { + if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) { $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig); $form->isblank("datepaid_$i", $locale->text('Payment date missing!')); - $form->error($locale->text('Zero amount posting!')) if !$form->parse_amount(\%myconfig, $form->{"amount_$i"}); $form->error($locale->text('Cannot post payment for a closed period!')) if ($datepaid <= $closedto); @@ -1032,10 +1031,17 @@ sub post { $closedto = $form->datetonum($form->{closedto}, \%myconfig); $transdate = $form->datetonum($form->{transdate}, \%myconfig); + $form->error($locale->text('Cannot post transaction for a closed period!')) if ($transdate <= $closedto); + + my $zero_amount_posting = 1; + for $i (1 .. $form->{rowcount}) { + if ($form->parse_amount(\%myconfig, $form->{"amount_$i"})) { + $zero_amount_posting = 0; + last; + } + } - $form->error($locale->text('Zero amount posting!')) if !$form->parse_amount(\%myconfig, $form->{amount}); - $form->error($locale->text('Cannot post transaction for a closed period!')) - if ($transdate <= $closedto); + $form->error($locale->text('Zero amount posting!')) if $zero_amount_posting; $form->isblank("exchangerate", $locale->text('Exchangerate missing!')) if ($form->{currency} ne $form->{defaultcurrency}); @@ -1047,7 +1053,6 @@ sub post { $form->isblank("datepaid_$i", $locale->text('Payment date missing!')); - $form->error($locale->text('Zero amount posting!')) if !$form->parse_amount(\%myconfig, $form->{"amount_$i"}); $form->error($locale->text('Cannot post payment for a closed period!')) if ($datepaid <= $closedto); diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 146e421ef..d218ff6ab 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -1019,12 +1019,11 @@ sub update { sub post_payment { $lxdebug->enter_sub(); for $i (1 .. $form->{paidaccounts}) { - if ($form->{"paid_$i"}) { + if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) { $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig); $form->isblank("datepaid_$i", $locale->text('Payment date missing!')); - $form->error($locale->text('Zero amount posting!')) if !$form->parse_amount(\%myconfig, $form->{amount}); $form->error($locale->text('Cannot post payment for a closed period!')) if ($datepaid <= $closedto); @@ -1057,10 +1056,17 @@ sub post { $closedto = $form->datetonum($form->{closedto}, \%myconfig); $transdate = $form->datetonum($form->{transdate}, \%myconfig); + $form->error($locale->text('Cannot post transaction for a closed period!')) if ($transdate <= $closedto); + + my $zero_amount_posting = 1; + for $i (1 .. $form->{rowcount}) { + if ($form->parse_amount(\%myconfig, $form->{"amount_$i"})) { + $zero_amount_posting = 0; + last; + } + } - $form->error($locale->text('Zero amount posting!')) if !$form->parse_amount(\%myconfig, $form->{amount}); - $form->error($locale->text('Cannot post transaction for a closed period!')) - if ($transdate <= $closedto); + $form->error($locale->text('Zero amount posting!')) if $zero_amount_posting; $form->isblank("exchangerate", $locale->text('Exchangerate missing!')) if ($form->{currency} ne $form->{defaultcurrency}); @@ -1073,7 +1079,6 @@ sub post { $form->isblank("datepaid_$i", $locale->text('Payment date missing!')); - $form->error($locale->text('Zero amount posting!')) if !$form->parse_amount(\%myconfig, $form->{"amount_$i"}); $form->error($locale->text('Cannot post payment for a closed period!')) if ($datepaid <= $closedto); diff --git a/locale/de/all b/locale/de/all index 1b40162b4..f3e39a49c 100644 --- a/locale/de/all +++ b/locale/de/all @@ -1189,7 +1189,7 @@ gestartet', 'You\'ve already chosen the following limitations:' => 'Sie haben bereits die folgenden Einschränkungen vorgenommen:', 'Zeitpunkt' => 'Zeitpunkt', 'Zeitraum' => 'Zeitraum', - 'Zero amount posting!' => 'Nullbuchung!', + 'Zero amount posting!' => 'Buchung ohne Wert', 'Zip, City' => 'PLZ, Ort', 'Zipcode' => 'PLZ', 'Zusatz' => 'Zusatz', diff --git a/locale/de/ap b/locale/de/ap index 60c5fdbf1..55a9e1182 100644 --- a/locale/de/ap +++ b/locale/de/ap @@ -166,7 +166,7 @@ $self->{texts} = { 'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.', 'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!', 'Yes' => 'Ja', - 'Zero amount posting!' => 'Nullbuchung!', + 'Zero amount posting!' => 'Buchung ohne Wert', 'bin_list' => 'Lagerliste', 'button' => '?', 'history' => 'Historie', diff --git a/locale/de/ar b/locale/de/ar index 5ac518b68..cad57799f 100644 --- a/locale/de/ar +++ b/locale/de/ar @@ -173,7 +173,7 @@ $self->{texts} = { 'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.', 'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!', 'Yes' => 'Ja', - 'Zero amount posting!' => 'Nullbuchung!', + 'Zero amount posting!' => 'Buchung ohne Wert', 'bin_list' => 'Lagerliste', 'button' => '?', 'history' => 'Historie', diff --git a/locale/de/cp b/locale/de/cp index a2961dfe7..633440b90 100644 --- a/locale/de/cp +++ b/locale/de/cp @@ -107,7 +107,7 @@ $self->{texts} = { 'Vendor details' => 'Lieferantendetails', 'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.', 'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!', - 'Zero amount posting!' => 'Nullbuchung!', + 'Zero amount posting!' => 'Buchung ohne Wert', 'bin_list' => 'Lagerliste', 'button' => '?', 'invoice' => 'Rechnung', -- 2.20.1