From: Moritz Bunkus Date: Mon, 11 Mar 2013 14:10:11 +0000 (+0100) Subject: select_tag(): Funktionalität von "with_empty" wiederherstellen X-Git-Tag: release-3.1.0beta1~529^2~3 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=0550e83;p=kivitendo-erp.git select_tag(): Funktionalität von "with_empty" wiederherstellen Behebt #2208. --- diff --git a/SL/Presenter/Tag.pm b/SL/Presenter/Tag.pm index 6fefd12be..29b57ad5d 100644 --- a/SL/Presenter/Tag.pm +++ b/SL/Presenter/Tag.pm @@ -108,10 +108,6 @@ sub select_tag { delete($attributes{default}); - - my @all_options; - push @all_options, [undef, $empty_title || ''] if $with_empty; - my $normalize_entry = sub { my ($type, $entry, $sub, $key) = @_; @@ -161,13 +157,14 @@ sub select_tag { return join '', map { $self->html_tag('option', $self->escape($_->[1]), value => $_->[0], selected => $_->[2]) } @options; }; - my $code; + my $code = ''; + $code .= $self->html_tag('option', $self->escape($empty_title || '')) if $with_empty; if (!$with_optgroups) { - $code = $list_to_code->($collection); + $code .= $list_to_code->($collection); } else { - $code = join '', map { + $code .= join '', map { my ($optgroup_title, $sub_collection) = @{ $_ }; $self->html_tag('optgroup', $list_to_code->($sub_collection), label => $optgroup_title) } @{ $collection };