39 |
39 |
use SL::AP;
|
40 |
40 |
use SL::FU;
|
41 |
41 |
use SL::GL;
|
42 |
|
use SL::Helper::Flash qw(flash);
|
|
42 |
use SL::Helper::Flash qw(flash flash_later);
|
43 |
43 |
use SL::IR;
|
44 |
44 |
use SL::IS;
|
45 |
45 |
use SL::ReportGenerator;
|
... | ... | |
857 |
857 |
$form->{what_done} = "invoice";
|
858 |
858 |
$form->save_history;
|
859 |
859 |
}
|
860 |
|
# no restore_from_session_id needed. we like to have a newly generated
|
861 |
|
# list of invoices for bank transactions
|
862 |
|
print $form->redirect_header($form->{callback}) if ($form->{callback} =~ /BankTransaction/);
|
863 |
|
# With version 3.5 we can add documents, but only after posting. there should be a flag in myconfig for the user
|
864 |
|
# $form->{callback} ||= 'ap.pl?action=edit&id=' . $form->{id} if $myconfig{no_reset_arap};
|
865 |
|
# or a client config setting
|
866 |
|
if ($::instance_conf->get_ap_add_doc && $::instance_conf->get_doc_storage) {
|
867 |
|
my $add_doc_url = build_std_url("script=ap.pl", 'action=edit', 'id=' . E($form->{id}), 'fragment=ui-tabs-docs');
|
868 |
|
print $form->redirect_header($add_doc_url);
|
|
860 |
|
|
861 |
if (!$inline) {
|
|
862 |
my $msg = $locale->text("AP transaction '#1' posted (ID: #2)", $form->{invnumber}, $form->{id});
|
|
863 |
if ($form->{callback} =~ /BankTransaction/) {
|
|
864 |
# no restore_from_session_id needed. we like to have a newly generated
|
|
865 |
# list of invoices for bank transactions
|
|
866 |
SL::Helper::Flash::flash_later('info', $msg);
|
|
867 |
print $form->redirect_header($form->{callback});
|
|
868 |
$::dispatcher->end_request;
|
|
869 |
|
|
870 |
} elsif ($::instance_conf->get_ap_add_doc && $::instance_conf->get_doc_storage) {
|
|
871 |
# Redirect with callback containing a fragment does not work (by now)
|
|
872 |
# because the callback info is stored in the session an parsing the
|
|
873 |
# callback parameters does not support fragments (see SL::Form::redirect).
|
|
874 |
# So use flash_later for the message and redirect_headers for redirecting.
|
|
875 |
my $add_doc_url = build_std_url("script=ap.pl", 'action=edit', 'id=' . E($form->{id}), 'fragment=ui-tabs-docs');
|
|
876 |
SL::Helper::Flash::flash_later('info', $msg);
|
|
877 |
print $form->redirect_header($add_doc_url);
|
|
878 |
$::dispatcher->end_request;
|
|
879 |
|
|
880 |
} else {
|
|
881 |
$form->redirect($msg);
|
|
882 |
}
|
869 |
883 |
}
|
870 |
884 |
|
871 |
|
$form->redirect($locale->text('AP transaction posted.') . ' ' . $locale->text('ID') . ': ' . $form->{id}) unless $inline;
|
872 |
885 |
} else {
|
873 |
886 |
$form->error($locale->text('Cannot post transaction!'));
|
874 |
887 |
}
|
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.