X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FTemplate%2FPlugin%2FL.pm;h=2299a66b1c47cc4e4611222ec66d013dc01bbeb2;hb=27ffa16a85221662dee49da0f210312383341240;hp=9995722e10e0e1e8c9fe08322f7c2ab70465d21c;hpb=6a8787147ad643549eb26cb4f9a373b5b354b8b9;p=kivitendo-erp.git diff --git a/SL/Template/Plugin/L.pm b/SL/Template/Plugin/L.pm index 9995722e1..2299a66b1 100644 --- a/SL/Template/Plugin/L.pm +++ b/SL/Template/Plugin/L.pm @@ -207,7 +207,7 @@ sub options_for_select { my $value_title_sub = $options{value_title_sub}; - my %selected = map { ( $_ => 1 ) } @{ ref($options{default}) eq 'ARRAY' ? $options{default} : $options{default} ? [ $options{default} ] : [] }; + my %selected = map { ( $_ => 1 ) } @{ ref($options{default}) eq 'ARRAY' ? $options{default} : defined($options{default}) ? [ $options{default} ] : [] }; my $access = sub { my ($element, $index, $key, $sub) = @_; @@ -231,7 +231,7 @@ sub options_for_select { my $code = ''; foreach my $result (@elements) { my %attributes = ( value => $result->[0] ); - $attributes{selected} = 'selected' if $selected{ $result->[0] || '' }; + $attributes{selected} = 'selected' if $selected{ defined($result->[0]) ? $result->[0] : '' }; $code .= $self->html_tag('option', _H($result->[1]), %attributes); } @@ -396,6 +396,18 @@ EOCODE return $code; } +sub online_help_tag { + my ($self, $tag, @slurp) = @_; + my %params = _hashify(@slurp); + my $cc = $::myconfig{countrycode}; + my $file = "doc/online/$cc/$tag.html"; + my $text = $params{text} || $::locale->text('Help'); + + die 'malformed help tag' unless $tag =~ /^[a-zA-Z0-9_]+$/; + return unless -f $file; + return $self->html_tag('a', $text, href => $file, target => '_blank'); +} + sub dump { my $self = shift; require Data::Dumper;