X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Famtemplates.pl;h=f8c6972e66bdcc30371214fa7c598b04a718c6e6;hb=2da5d610ce0aeb43428de82e6b5e79acfb502628;hp=4bc6f017b7e09d28d4903b7c6cd2ef14ad2fb432;hpb=2b44867fc2d4e3c061c126890cc90fcaa84b6baa;p=kivitendo-erp.git diff --git a/bin/mozilla/amtemplates.pl b/bin/mozilla/amtemplates.pl index 4bc6f017b..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}) { - $form->{fokus} = "Form.content"; - - } else { + if (!$form->{edit}) { $options{"content"} = "\n\n" if (!$options{"content"}); $options{"SHOW_SECOND_EDIT_BUTTON"} = $options{"lines"} > 25; }