push @template_files, "$form->{formname}.$extension";
push @template_files, "default.$extension";
@template_files = uniq @template_files;
-
- $form->{IN} = undef;
- for my $filename (@template_files) {
- if (-f "$myconfig{templates}/$filename") {
- $form->{IN} = $filename;
- last;
- }
- }
+ $form->{IN} = first { -f "$myconfig{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));