From 1268bf670c06f5a66ad78a75e41ad6c15061d9bc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Fri, 20 May 2022 10:19:27 +0200 Subject: [PATCH] Auftrags-Controller: Beleg neu laden nach "Speichern und drucken"/Druckvorschau. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Sonst wird die Belegnummer nicht angezeigt, falls die Änderbarkeit von Belegnummern abgeschaltet ist. Zudem wurde die Projektnummer nicht angezeigt, wenn das automatische anlegen von Projekten aktiv ist. Das Projekt exisitert dann aber schon und ein erneutes Speichern schlägt fehl. behebt #498 (redmine) --- SL/Controller/Order.pm | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index de1fad59f..97dc5c94d 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -330,7 +330,7 @@ sub action_print { if ($media eq 'screen') { # screen/download - $self->js->flash('info', t8('The document has been created.')); + flash_later('info', t8('The document has been created.')); $self->send_file( \$doc, type => SL::MIME->mime_type_from_ext($doc_filename), @@ -346,20 +346,24 @@ sub action_print { content => $doc, ); - $self->js->flash('info', t8('The document has been printed.')); + flash_later('info', t8('The document has been printed.')); } my @warnings = $self->store_doc_to_webdav_and_filemanagement($doc, $doc_filename, $formname); if (scalar @warnings) { - $self->js->flash('warning', $_) for @warnings; + flash_later('warning', $_) for @warnings; } $self->save_history('PRINTED'); - $self->js - ->run('kivi.ActionBar.setEnabled', '#save_and_email_action') - ->render; + my @redirect_params = ( + action => 'edit', + type => $self->type, + id => $self->order->id, + ); + $self->js->redirect_to($self->url_for(@redirect_params))->render; } + sub action_preview_pdf { my ($self) = @_; @@ -395,14 +399,21 @@ sub action_preview_pdf { return $self->js->flash('error', t8('Conversion to PDF failed: #1', $errors[0]))->render; } $self->save_history('PREVIEWED'); - $self->js->flash('info', t8('The PDF has been previewed')); + flash_later('info', t8('The PDF has been previewed')); # screen/download $self->send_file( \$pdf, type => SL::MIME->mime_type_from_ext($pdf_filename), name => $pdf_filename, - js_no_render => 0, + js_no_render => 1, + ); + + my @redirect_params = ( + action => 'edit', + type => $self->type, + id => $self->order->id, ); + $self->js->redirect_to($self->url_for(@redirect_params))->render; } # open the email dialog -- 2.20.1