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;
$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'|;
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;
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!'))
$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)) {
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!'))
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);