EK-Rechnung: Bei Verbleib in der Maske nach Buchen Dokumenten-Tab laden
[kivitendo-erp.git] / bin / mozilla / ir.pl
index 0b9a4b2..069b9a7 100644 (file)
@@ -33,6 +33,7 @@
 #======================================================================
 
 use SL::FU;
+use SL::Helper::Flash qw(flash_later);
 use SL::IR;
 use SL::IS;
 use SL::DB::BankTransactionAccTrans;
@@ -935,17 +936,21 @@ sub post {
       $form->save_history;
     }
     # /saving the history
-    # I keep the old default / comment for refactorer, pls check instance_conf:
-    #if ($::instance_conf->get_ir_add_doc && $::instance_conf->get_doc_storage) {
-    #  my $add_doc_url = build_std_url("script=ir.pl", 'action=edit', 'id=' . E($form->{id}));
-    #  print $form->redirect_header($add_doc_url);
-    #}
-    $form->{callback} = 'ir.pl?action=edit&id=' . $form->{id};
-    $form->redirect(  $locale->text('Invoice')
-                  . " $form->{invnumber} "
-                  . ", " . $locale->text('ID')
-                  . ': ' . $form->{id} . ' '
-                  . $locale->text('posted!'));
+
+    my $redirect_url;
+    if ($::instance_conf->get_ir_add_doc && $::instance_conf->get_doc_storage) {
+      $redirect_url = build_std_url("script=ir.pl", 'action=edit', 'id=' . E($form->{id}), 'fragment=ui-tabs-docs');
+    } else {
+      $redirect_url = build_std_url("script=ir.pl", 'action=edit', 'id=' . E($form->{id}));
+    }
+    SL::Helper::Flash::flash_later('info',
+                                   $locale->text('Invoice')
+                                   . " $form->{invnumber} "
+                                   . ", " . $locale->text('ID')
+                                   . ': ' . $form->{id} . ' '
+                                   . $locale->text('posted!'));
+    print $form->redirect_header($redirect_url);
+    $::dispatcher->end_request;
   }
   $form->error($locale->text('Cannot post invoice!'));