Revision fc9829b3
Von Bernd Bleßmann vor fast 3 Jahren hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
|
||
$self->js_reset_order_and_item_ids_after_save;
|
||
|
||
my $redirect_url = $self->url_for(
|
||
action => 'edit',
|
||
type => $self->type,
|
||
id => $self->order->id,
|
||
);
|
||
|
||
my $format = $::form->{print_options}->{format};
|
||
my $media = $::form->{print_options}->{media};
|
||
my $formname = $::form->{print_options}->{formname};
|
||
... | ... | |
|
||
# only PDF, OpenDocument & HTML for now
|
||
if (none { $format eq $_ } qw(pdf opendocument opendocument_pdf html)) {
|
||
return $self->js->flash('error', t8('Format \'#1\' is not supported yet/anymore.', $format))->render;
|
||
flash_later('error', t8('Format \'#1\' is not supported yet/anymore.', $format));
|
||
return $self->js->redirect_to($redirect_url)->render;
|
||
}
|
||
|
||
# only screen or printer by now
|
||
if (none { $media eq $_ } qw(screen printer)) {
|
||
return $self->js->flash('error', t8('Media \'#1\' is not supported yet/anymore.', $media))->render;
|
||
flash_later('error', t8('Media \'#1\' is not supported yet/anymore.', $media));
|
||
return $self->js->redirect_to($redirect_url)->render;
|
||
}
|
||
|
||
# create a form for generate_attachment_filename
|
||
... | ... | |
printer_id => $printer_id,
|
||
groupitems => $groupitems });
|
||
if (scalar @errors) {
|
||
return $self->js->flash('error', t8('Generating the document failed: #1', $errors[0]))->render;
|
||
flash_later('error', t8('Generating the document failed: #1', $errors[0]));
|
||
return $self->js->redirect_to($redirect_url)->render;
|
||
}
|
||
|
||
if ($media eq 'screen') {
|
||
... | ... | |
|
||
$self->save_history('PRINTED');
|
||
|
||
my @redirect_params = (
|
||
action => 'edit',
|
||
type => $self->type,
|
||
id => $self->order->id,
|
||
);
|
||
$self->js->redirect_to($self->url_for(@redirect_params))->render;
|
||
$self->js->redirect_to($redirect_url)->render;
|
||
}
|
||
|
||
sub action_preview_pdf {
|
||
... | ... | |
|
||
$self->js_reset_order_and_item_ids_after_save;
|
||
|
||
my $redirect_url = $self->url_for(
|
||
action => 'edit',
|
||
type => $self->type,
|
||
id => $self->order->id,
|
||
);
|
||
|
||
my $format = 'pdf';
|
||
my $media = 'screen';
|
||
my $formname = $self->type;
|
||
... | ... | |
language => $self->order->language,
|
||
});
|
||
if (scalar @errors) {
|
||
return $self->js->flash('error', t8('Conversion to PDF failed: #1', $errors[0]))->render;
|
||
flash_later('error', t8('Conversion to PDF failed: #1', $errors[0]));
|
||
return $self->js->redirect_to($redirect_url)->render;
|
||
}
|
||
|
||
$self->save_history('PREVIEWED');
|
||
|
||
flash_later('info', t8('The PDF has been previewed'));
|
||
|
||
# screen/download
|
||
$self->send_file(
|
||
\$pdf,
|
||
... | ... | |
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;
|
||
$self->js->redirect_to($redirect_url)->render;
|
||
}
|
||
|
||
# open the email dialog
|
Auch abrufbar als: Unified diff
Auftrags-Controller: Beleg neu laden nach "Speichern und drucken" auch bei Fehler
Wenn nach dem Speichern ein Fehler auftritt, Beleg neu laden mit redirect.
Gleiche Problematik/Begründung wie in commit
1268bf670c06f5a66ad78a75e41ad6c15061d9bc