X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/683dc060694a0bef44963a37577094de95f1278a..bf0271ab38dc2616ebdb7883e06d412d23db6612:/SL/Controller/Order.pm diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 9b5dee36d..78b3b096b 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -182,20 +182,10 @@ sub action_print { } elsif ($media eq 'printer') { # printer my $printer_id = $::form->{print_options}->{printer_id}; - my $printer; - $printer = SL::DB::Printer->new(id => $printer_id)->load if $printer_id; - if (!$printer) { - return $self->js->flash('error', t8('Printer not found.'))->render; - } - - my $command = SL::Template::create(type => 'ShellCommand', form => Form->new(''))->parse($printer->printer_command); - - for my $i (1 .. $copies) { - open my $out, '|-', $command or die $!; - binmode $out; - print $out $pdf; - close $out; - } + SL::DB::Printer->new(id => $printer_id)->load->print_document( + copies => $copies, + content => $pdf, + ); $self->js->flash('info', t8('The PDF has been printed')); } @@ -952,8 +942,6 @@ sub _create_pdf { $print_form->{language_id} = $params->{language}->id if $print_form->{language}; $order->flatten_to_form($print_form, format_amounts => 1); - # flatten_to_form sets payment_terms from customer/vendor - we do not want that here - delete $print_form->{payment_terms} if !$print_form->{payment_id}; # search for the template my ($template_file, @template_files) = SL::Helper::CreatePDF->find_template(