X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/40db40e8dab881065df1cfbe61bb2212de0ff6db..0dfd8e90aa330f6b4b53f89f0eadf6f1e018a662:/SL/Form.pm diff --git a/SL/Form.pm b/SL/Form.pm index db2cb4907..b6f62fb91 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -143,7 +143,6 @@ sub new { $self->{action} =~ s/( |-|,|#)/_/g; $self->{version} = "2.2.0"; - $self->{dbversion} = "2.2.0"; $main::lxdebug->leave_sub(); @@ -245,17 +244,7 @@ sub error { $msg =~ s/\n/
/g; $self->header; - - print qq| - - -

Error!

- -

$msg - - - - |; + $self->show_generic_error($msg); die "Error: $msg\n"; @@ -421,19 +410,34 @@ function fokus(){document.$self->{fokus}.focus();} $main::lxdebug->leave_sub(); } +use Data::Dumper; sub parse_html_template { $main::lxdebug->enter_sub(); - my ($self, $myconfig, $file) = @_; + my ($self, $file, $additional_params) = @_; - if (-f "templates/webpages/${file}_" . $myconfig->{"countrycode"} . + if (-f "templates/webpages/${file}_" . $main::myconfig{"countrycode"} . ".html") { - $file = "templates/webpages/${file}_" . $myconfig->{"countrycode"} . + if ((-f ".developer") && + (-f "templates/webpages/${file}_master.html") && + ((stat("templates/webpages/${file}_master.html"))[9] > + (stat("templates/webpages/${file}_" . $main::myconfig{"countrycode"} . + ".html"))[9])) { + my $info = "Developper information: templates/webpages/${file}_master.html is newer than the localized version.\n" . + "Please re-run 'locales.pl' in 'locale/" . $main::myconfig{"countrycode"} . "'."; + print(qq|

$info
|); + die($info); + } + + $file = "templates/webpages/${file}_" . $main::myconfig{"countrycode"} . ".html"; } elsif (-f "templates/webpages/${file}.html") { $file = "templates/webpages/${file}.html"; } else { - $self->error("Web page template '${file}' not found."); + my $info = "Web page template '${file}' not found.\n" . + "Please re-run 'locales.pl' in 'locale/" . $main::myconfig{"countrycode"} . "'."; + print(qq|
$info
|); + die($info); } my $template = HTML::Template->new("filename" => $file, @@ -442,15 +446,23 @@ sub parse_html_template { "case_sensitive" => 1, "loop_context_vars" => 1, "global_vars" => 1); - my @params = $template->param(); - if (grep("DEBUG", @params) && $self->{"DEBUG"}) { - $template->param("DEBUG" => "
DEBUG INFORMATION:
" .
-                     $self->{"DEBUG"} . "
"); + $additional_params = {} unless ($additional_params); + if ($self->{"DEBUG"}) { + $additional_params->{"DEBUG"} = $self->{"DEBUG"}; + } + + if ($additional_params->{"DEBUG"}) { + $additional_params->{"DEBUG"} = + "
DEBUG INFORMATION:
" . $additional_params->{"DEBUG"} . "
"; } - foreach my $key (keys(%{$self})) { - if (("DEBUG" ne $key) && grep(${key}, @params)) { + my @additional_param_names = keys(%{$additional_params}); + + foreach my $key ($template->param()) { + if (grep(/^${key}$/, @additional_param_names)) { + $template->param($key => $additional_params->{$key}); + } else { $template->param($key => $self->{$key}); } } @@ -463,12 +475,13 @@ sub parse_html_template { } sub show_generic_error { - my ($self, $myconfig, $error, $title) = @_; + my ($self, $error, $title) = @_; - $self->{"title"} = $title if ($title); + my $add_params = {}; + $add_params->{"title"} = $title if ($title); $self->{"label_error"} = $error; - print($self->parse_html_template($myconfig, "generic/error")); + print($self->parse_html_template("generic/error", $add_params)); } # write Trigger JavaScript-Code ($qty = quantity of Triggers)