X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Famtemplates.pl;h=f8c6972e66bdcc30371214fa7c598b04a718c6e6;hb=593a71851023f5b248fff933d6cc00ff4cfce90d;hp=9f21e22c7154cc605388df981215132771591ab1;hpb=075bd42af8885aee3c18fe055a2c82b8b43f4cea;p=kivitendo-erp.git diff --git a/bin/mozilla/amtemplates.pl b/bin/mozilla/amtemplates.pl index 9f21e22c7..f8c6972e6 100644 --- a/bin/mozilla/amtemplates.pl +++ b/bin/mozilla/amtemplates.pl @@ -33,6 +33,7 @@ use File::Find; +use SL::DB::Default; use SL::AM; use SL::Form; @@ -115,6 +116,9 @@ sub display_template_form { $main::auth->assert('admin'); + 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; + if ($form->{"formname"} =~ m|\.\.| || $form->{"formname"} =~ m|^/|) { $form->{"formname"} =~ s|.*/||; } @@ -205,13 +209,13 @@ sub display_template_form { my $fname = $File::Find::name; # remove template dir from name - $fname =~ s|^$myconfig{templates}/||; + $fname =~ s|^templates/[^/+]/||; # remove .tex from name $fname =~ s|.tex$||; push(@all_files, $fname); - }, $myconfig{templates}); + }, $defaults->templates); # filter all files already set up (i.e. not already in @values) my @other_files = grep { my $a=$_; not grep {$a eq $_->{value}} @values } @all_files; @@ -271,10 +275,7 @@ sub display_template_form { $options{"CAN_EDIT"} = $form->{"edit"}; - if ($form->{edit}) { - $::request->{layout}->focus("#edit_content"); - - } else { + if (!$form->{edit}) { $options{"content"} = "\n\n" if (!$options{"content"}); $options{"SHOW_SECOND_EDIT_BUTTON"} = $options{"lines"} > 25; }