my $pdf_filename = $form->generate_attachment_filename();
my $pdf;
- my @errors = generate_pdf($self->order, \$pdf, { format => $format,
- formname => $formname,
- language => $self->order->language,
- printer_id => $printer_id,
- groupitems => $groupitems });
+ my @errors = $self->generate_pdf(\$pdf, { format => $format,
+ formname => $formname,
+ language => $self->order->language,
+ printer_id => $printer_id,
+ groupitems => $groupitems });
if (scalar @errors) {
return $self->js->flash('error', t8('Conversion to PDF failed: #1', $errors[0]))->render;
}
$self->js->flash('info', t8('The PDF has been printed'));
}
- my @warnings = store_pdf_to_webdav_and_filemanagement($self->order, $pdf, $pdf_filename);
+ my @warnings = $self->store_pdf_to_webdav_and_filemanagement($pdf, $pdf_filename);
if (scalar @warnings) {
$self->js->flash('warning', $_) for @warnings;
}
my $pdf_filename = $form->generate_attachment_filename();
my $pdf;
- my @errors = generate_pdf($self->order, \$pdf, { format => $format,
- formname => $formname,
- language => $self->order->language,
- });
+ my @errors = $self->generate_pdf(\$pdf, { format => $format,
+ formname => $formname,
+ language => $self->order->language,
+ });
if (scalar @errors) {
return $self->js->flash('error', t8('Conversion to PDF failed: #1', $errors[0]))->render;
}
if (($::form->{attachment_policy} // '') !~ m{^(?:old_file|no_file)$}) {
my $pdf;
- my @errors = generate_pdf($self->order, \$pdf, {media => $::form->{media},
- format => $::form->{print_options}->{format},
- formname => $::form->{print_options}->{formname},
- language => $self->order->language,
- printer_id => $::form->{print_options}->{printer_id},
- groupitems => $::form->{print_options}->{groupitems}});
+ my @errors = $self->generate_pdf(\$pdf, {media => $::form->{media},
+ format => $::form->{print_options}->{format},
+ formname => $::form->{print_options}->{formname},
+ language => $self->order->language,
+ printer_id => $::form->{print_options}->{printer_id},
+ groupitems => $::form->{print_options}->{groupitems}});
if (scalar @errors) {
return $self->js->flash('error', t8('Conversion to PDF failed: #1', $errors[0]))->render($self);
}
- my @warnings = store_pdf_to_webdav_and_filemanagement($self->order, $pdf, $::form->{attachment_filename});
+ my @warnings = $self->store_pdf_to_webdav_and_filemanagement($pdf, $::form->{attachment_filename});
if (scalar @warnings) {
flash_later('warning', $_) for @warnings;
}
}
sub generate_pdf {
- my ($order, $pdf_ref, $params) = @_;
+ my ($self, $pdf_ref, $params) = @_;
+ my $order = $self->order;
my @errors = ();
my $print_form = Form->new('');
}
sub store_pdf_to_webdav_and_filemanagement {
- my($order, $content, $filename) = @_;
+ my ($self, $content, $filename) = @_;
+ my $order = $self->order;
my @errors;
# copy file to webdav folder