From: Bernd Bleßmann Date: Fri, 9 Jul 2021 10:01:24 +0000 (+0200) Subject: Kreditorenbuchung: Redirects nach Buchen aufgeräumt … X-Git-Tag: kivitendo-mebil_0.1-0~9^2~44 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=850ba82b521647752529615b3d5d4383ea77b2e6;p=kivitendo-erp.git Kreditorenbuchung: Redirects nach Buchen aufgeräumt … - kein redirect nach redirect_header. redirect schickt ruft auch redirect_header auf, prüft aber, ob schon ein header geschickt wurde und bricht dann ab. - Verbesserte Info-Ausgabe mit Rechnungsnummer. Hinweis: callback und redirect mit Fragment geht (noch) nicht, da bei redirect die callback-Parameter recht simple geparsed werden, um diese in der Session zu hinterlegen. Das berücksichtigt das Fragment nicht. --- diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index d6dd24ebe..dce921d3e 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -39,7 +39,7 @@ use List::UtilsBy qw(sort_by); use SL::AP; use SL::FU; use SL::GL; -use SL::Helper::Flash qw(flash); +use SL::Helper::Flash qw(flash flash_later); use SL::IR; use SL::IS; use SL::ReportGenerator; @@ -857,18 +857,31 @@ sub post { $form->{what_done} = "invoice"; $form->save_history; } - # no restore_from_session_id needed. we like to have a newly generated - # list of invoices for bank transactions - print $form->redirect_header($form->{callback}) if ($form->{callback} =~ /BankTransaction/); - # With version 3.5 we can add documents, but only after posting. there should be a flag in myconfig for the user - # $form->{callback} ||= 'ap.pl?action=edit&id=' . $form->{id} if $myconfig{no_reset_arap}; - # or a client config setting - if ($::instance_conf->get_ap_add_doc && $::instance_conf->get_doc_storage) { - my $add_doc_url = build_std_url("script=ap.pl", 'action=edit', 'id=' . E($form->{id}), 'fragment=ui-tabs-docs'); - print $form->redirect_header($add_doc_url); + + if (!$inline) { + my $msg = $locale->text("AP transaction '#1' posted (ID: #2)", $form->{invnumber}, $form->{id}); + if ($form->{callback} =~ /BankTransaction/) { + # no restore_from_session_id needed. we like to have a newly generated + # list of invoices for bank transactions + SL::Helper::Flash::flash_later('info', $msg); + print $form->redirect_header($form->{callback}); + $::dispatcher->end_request; + + } elsif ($::instance_conf->get_ap_add_doc && $::instance_conf->get_doc_storage) { + # Redirect with callback containing a fragment does not work (by now) + # because the callback info is stored in the session an parsing the + # callback parameters does not support fragments (see SL::Form::redirect). + # So use flash_later for the message and redirect_headers for redirecting. + my $add_doc_url = build_std_url("script=ap.pl", 'action=edit', 'id=' . E($form->{id}), 'fragment=ui-tabs-docs'); + SL::Helper::Flash::flash_later('info', $msg); + print $form->redirect_header($add_doc_url); + $::dispatcher->end_request; + + } else { + $form->redirect($msg); + } } - $form->redirect($locale->text('AP transaction posted.') . ' ' . $locale->text('ID') . ': ' . $form->{id}) unless $inline; } else { $form->error($locale->text('Cannot post transaction!')); } diff --git a/locale/de/all b/locale/de/all index 5dc036db0..74dfbda25 100755 --- a/locale/de/all +++ b/locale/de/all @@ -82,7 +82,7 @@ $self->{texts} = { 'AP Transaction with Storno (abbreviation)' => 'K(S)', 'AP Transactions' => 'Kreditorenbuchungen', 'AP template suggestions' => 'Vorschlag Kreditorenbuchung', - 'AP transaction posted.' => 'Kreditorenbuchung verbucht.', + 'AP transaction \'#1\' posted (ID: #2)' => 'Kreditorenbuchung \'#1\' verbucht (Buchungsnummer: #2)', 'AP transactions changeable' => 'Änderbarkeit von Kreditorenbuchungen', 'AP transactions with sales taxkeys and/or AR transactions with input taxkeys' => 'Kreditorenbuchungen mit Umsatzsteuer-Steuerschlüsseln und/oder Debitorenbuchungen mit Vorsteuer-Steuerschlüsseln', 'AP/AR Aging & Journal' => 'Offene Forderungen/Verbindlichkeiten & Buchungsjournal', diff --git a/locale/en/all b/locale/en/all index 194ceac4e..b0fe87bbb 100644 --- a/locale/en/all +++ b/locale/en/all @@ -82,7 +82,7 @@ $self->{texts} = { 'AP Transaction with Storno (abbreviation)' => '', 'AP Transactions' => 'Purchase Transactions', 'AP template suggestions' => '', - 'AP transaction posted.' => '', + 'AP transaction \'#1\' posted (ID: #2)' => '', 'AP transactions changeable' => '', 'AP transactions with sales taxkeys and/or AR transactions with input taxkeys' => '', 'AP/AR Aging & Journal' => '',