From: Bernd Bleßmann Date: Mon, 18 Jan 2016 15:20:34 +0000 (+0100) Subject: Letter: Aussagekräftigere Fehlermeldung, wenn Vorlage nicht gefunden wird. X-Git-Tag: release-3.4.1~464 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=80f544165a03820e9de87c85052eab89729e0328;p=kivitendo-erp.git Letter: Aussagekräftigere Fehlermeldung, wenn Vorlage nicht gefunden wird. --- diff --git a/SL/Controller/Letter.pm b/SL/Controller/Letter.pm index f1109d72c..994b3c001 100644 --- a/SL/Controller/Letter.pm +++ b/SL/Controller/Letter.pm @@ -200,17 +200,24 @@ sub action_print_letter { $::form->get_employee_data('prefix' => 'employee', 'id' => $letter->{employee_id}); $::form->get_employee_data('prefix' => 'salesman', 'id' => $letter->{salesman_id}); + my ($template_file, @template_files) = SL::Helper::CreatePDF->find_template( + name => 'letter', + printer_id => $::form->{printer_id}, + language_id => $::form->{language_id}, + formname => 'letter', + format => 'pdf', + ); + + if (!defined $template_file) { + $::form->error($::locale->text('Cannot find matching template for this print request. Please contact your template maintainer. I tried these: #1.', join ', ', map { "'$_'"} @template_files)); + } + my %create_params = ( - template => scalar(SL::Helper::CreatePDF->find_template( - name => 'letter', - printer_id => $::form->{printer_id}, - language_id => $::form->{language_id}, - formname => 'letter', - format => 'pdf', - )), + template => $template_file, variables => $::form, return => 'file_name', ); + my $pdf_file_name; eval { $pdf_file_name = SL::Helper::CreatePDF->create_pdf(%create_params);