'templates' nicht aus %::myconfig, sondern aus Defaults-Tabelle holen
[kivitendo-erp.git] / bin / mozilla / io.pl
index 99b61f3..69b70e8 100644 (file)
@@ -47,6 +47,7 @@ use SL::CT;
 use SL::IC;
 use SL::IO;
 
+use SL::DB::Default;
 use SL::DB::Language;
 use SL::DB::Printer;
 use SL::Helper::Flash;
@@ -1224,6 +1225,10 @@ sub print_form {
 
   _check_io_auth();
 
+  my $defaults = SL::DB::Default->get;
+  $form->error($::locale->text('No print templates have been created for this client yet. Please do so in the client configuration.')) if !$defaults->templates;
+  $form->{templates} = $defaults->templates;
+
   my ($old_form) = @_;
 
   my $inv       = "inv";
@@ -1447,8 +1452,6 @@ sub print_form {
 
   $form->{notes} =~ s/^\s+//g;
 
-  $form->{templates} = "$myconfig{templates}";
-
   delete $form->{printer_command};
 
   $form->{language} = $form->get_template_language(\%myconfig);
@@ -1528,7 +1531,7 @@ sub print_form {
   push @template_files, "$form->{formname}.$extension";
   push @template_files, "default.$extension";
   @template_files = uniq @template_files;
-  $form->{IN}     = first { -f "$myconfig{templates}/$_" } @template_files;
+  $form->{IN}     = first { -f ($defaults->templates . "/$_") } @template_files;
 
   if (!defined $form->{IN}) {
     $::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));