From: Jan Büren Date: Mon, 10 Jun 2013 12:58:15 +0000 (+0200) Subject: Implementiert Ticket 1897 Zukunftsbuchungen vermeiden X-Git-Tag: release-3.1.0beta1~345 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=a11d7a85a9b73798acb3a11b6ba4251ba331b19c;p=kivitendo-erp.git Implementiert Ticket 1897 Zukunftsbuchungen vermeiden Die Prüfungen für den Zeitraum in allen Belegmasken umgesetzt. Zusammen mit Commit f552f878c85828a408d7f32afbbc1e714270b85f wird das Ticket 1897 geschlossen --- diff --git a/SL/AM.pm b/SL/AM.pm index 4934d866c..5a9f2365b 100644 --- a/SL/AM.pm +++ b/SL/AM.pm @@ -1313,11 +1313,11 @@ sub closedto { my $dbh = $form->dbconnect($myconfig); - my $query = qq|SELECT closedto, revtrans FROM defaults|; + my $query = qq|SELECT closedto, max_future_booking_interval, revtrans FROM defaults|; my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); - ($form->{closedto}, $form->{revtrans}) = $sth->fetchrow_array; + ($form->{closedto}, $form->{max_future_booking_interval}, $form->{revtrans}) = $sth->fetchrow_array; $sth->finish; @@ -1339,8 +1339,8 @@ sub closebooks { $query = qq|UPDATE defaults SET closedto = NULL, revtrans = '1'|; } elsif ($form->{closedto}) { - $query = qq|UPDATE defaults SET closedto = ?, revtrans = '0'|; - @values = (conv_date($form->{closedto})); + $query = qq|UPDATE defaults SET closedto = ?, max_future_booking_interval = ?, revtrans = '0'|; + @values = (conv_date($form->{closedto}), conv_date($form->{max_future_booking_interval})); } else { $query = qq|UPDATE defaults SET closedto = NULL, revtrans = '0'|; diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index 923e14005..e566ea6f7 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -621,6 +621,9 @@ sub post { my $closedto = $form->datetonum($form->{closedto}, \%myconfig); my $transdate = $form->datetonum($form->{transdate}, \%myconfig); + + $form->error($locale->text('Cannot post transaction above the maximum future booking date!')) + if ($form->date_max_future($form->{"transdate"}, \%myconfig)); $form->error($locale->text('Cannot post transaction for a closed period!')) if ($form->date_closed($form->{"transdate"}, \%myconfig)); my $zero_amount_posting = 1; diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index f5ea6c429..e1b10f63c 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -669,6 +669,9 @@ sub post { my $closedto = $form->datetonum($form->{closedto}, \%myconfig); my $transdate = $form->datetonum($form->{transdate}, \%myconfig); + + $form->error($locale->text('Cannot post transaction above the maximum future booking date!')) + if ($form->date_max_future($transdate, \%myconfig)); $form->error($locale->text('Cannot post transaction for a closed period!')) if ($form->date_closed($form->{"transdate"}, \%myconfig)); $form->error($locale->text('Zero amount posting!')) diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index 4c97bd028..c508ff1f7 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -1115,6 +1115,9 @@ sub post_transaction { $form->{taxincluded} = 0 if !$taxtotal; # this is just for the wise guys + + $form->error($locale->text('Cannot post transaction above the maximum future booking date!')) + if ($form->date_max_future($form->{"transdate"}, \%myconfig)); $form->error($locale->text('Cannot post transaction for a closed period!')) if ($form->date_closed($form->{"transdate"}, \%myconfig)); if ($form->round_amount($debit, 2) != $form->round_amount($credit, 2)) { diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index 4209fdf6a..b226bb011 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -722,6 +722,8 @@ sub post { my $invdate = $form->datetonum($form->{invdate}, \%myconfig); my $max_datepaid = _max_datepaid(); + $form->error($locale->text('Cannot post transaction above the maximum future booking date!')) + if ($form->date_max_future($invdate, \%myconfig)); $form->error($locale->text('Cannot post invoice for a closed period!')) if $max_datepaid && $form->date_closed($max_datepaid, \%myconfig); $form->isblank("exchangerate", $locale->text('Exchangerate missing!')) diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index cbddde60d..220c993aa 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -716,6 +716,8 @@ sub post { my $closedto = $form->datetonum($form->{closedto}, \%myconfig); my $invdate = $form->datetonum($form->{invdate}, \%myconfig); + $form->error($locale->text('Cannot post transaction above the maximum future booking date!')) + if ($form->date_max_future($invdate, \%myconfig)); $form->error($locale->text('Cannot post invoice for a closed period!')) if ($invdate <= $closedto);