Speichern von Verkäufern bei Kundenstammdaten.
[kivitendo-erp.git] / bin / mozilla / ir.pl
index e088def..d72ca7e 100644 (file)
@@ -32,6 +32,7 @@
 #======================================================================
 
 use SL::IR;
+use SL::IS;
 use SL::PE;
 
 require "$form->{path}/io.pl";
@@ -785,12 +786,14 @@ sub form_footer {
   $closedto = $form->datetonum($form->{closedto}, \%myconfig);
 
   if ($form->{id}) {
+    my $show_storno = !$form->{storno} && !IS->has_storno(\%myconfig, $form, "ap");
+
     print qq|<input class=submit type=submit name=action value="|
       . $locale->text('Post Payment') . qq|">
 |;
     print qq|<input class=submit type=submit name=action value="|
       . $locale->text('Storno') . qq|">
-| unless ($form->{storno});
+| if ($show_storno);
     if ($form->{radier}) {
     print qq|
     <input class=submit type=submit name=action value="|
@@ -972,10 +975,14 @@ sub storno {
     $form->error($locale->text('Cannot storno storno invoice!'));
   }
 
-  if (IR->has_storno(\%myconfig, $form)) {
+  if (IS->has_storno(\%myconfig, $form, "ap")) {
     $form->error($locale->text("Invoice has already been storno'd!"));
   }
 
+  invoice_links();
+  prepare_invoice();
+  relink_accounts();
+
   $form->{storno_id} = $form->{id};
   $form->{storno} = 1;
   $form->{id} = "";