From: Moritz Bunkus Date: Wed, 16 May 2007 08:13:37 +0000 (+0000) Subject: Die Überprüfungen, ob eine Nullbuchung vom Benutzer durchgeführt wurde, war falsch... X-Git-Tag: release-2.4.3^2~307 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=eb8bed3f564c0c880cc8a467078c7fee579c4114;p=kivitendo-erp.git Die Überprüfungen, ob eine Nullbuchung vom Benutzer durchgeführt wurde, war falsch -- sie überprüfte falsche Variablen und auch falsche Umstände. Außerdem werden die einzelnen Zeilen der Zahlungsein- und -ausgänge eh schon vorher mit if() abgefragt. Fix für Bug 651. --- 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',