]> wagnertech.de Git - mfinanz.git/blobdiff - bin/mozilla/is.pl
Stornos nicht erlauben wenn die Rechnung im abgeschlossenen Zeitraum liegt.
[mfinanz.git] / bin / mozilla / is.pl
index b8851ff6a3ec2a63fd3c44e790e9404987f2c9eb..d67aac59d1e8e48fa93ee9f9bdf41c9863ea446b 100644 (file)
@@ -36,6 +36,7 @@ use SL::IS;
 use SL::PE;
 use SL::OE;
 use Data::Dumper;
+use DateTime;
 use List::Util qw(max sum);
 
 use SL::DB::Default;
@@ -842,6 +843,9 @@ sub storno {
   if (IS->has_storno(\%myconfig, $form, "ar")) {
     $form->error($locale->text("Invoice has already been storno'd!"));
   }
+  if ($form->datetonum($form->{invdate},  \%myconfig) <= $form->datetonum($form->{closedto}, \%myconfig)) {
+    $form->error($locale->text('Cannot storno invoice for a closed period!'));
+  }
 
   map({ my $key = $_; delete($form->{$key}) unless (grep({ $key eq $_ } qw(id login password type))); } keys(%{ $form }));
 
@@ -857,6 +861,7 @@ sub storno {
   $form->{storno} = 1;
   $form->{id} = "";
   $form->{invnumber} = "Storno zu " . $form->{invnumber};
+  $form->{invdate}   = DateTime->today->to_lxoffice;
   $form->{rowcount}++;
 
   post();