[Koha-bugs] [Bug 13794] Input field values not translated

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Mar 4 23:10:58 CET 2015


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13794

--- Comment #1 from Maxime Beaulieu <maxime.beaulieu at inlibro.com> ---
Created attachment 36514
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=36514&action=edit
Fixed logical test in tmpl_process3.pl

The line:
next if $a eq 'value' && ($tag ne 'input' || (ref $attr->{'type'} &&
$attr->{'type'}->[1] =~ /^(?:checkbox|hidden|radio|text)$/)); # FIXME

This portion: (ref $attr->{'type'} && $attr->{'type'}->[1] =~
/^(?:checkbox|hidden|radio|text)$/) checks if the input type is valid.

We get the following (wrong) logic:
next IF
$a eq value
    AND
the tag is not an input OR the input type is valid

The test is true when : $a eq value, tag is an input, input type is valid
We skip the tag when it is valid, it is never translated.

I propose the following change:
  my $isValidType = ref $attr->{'type'} && $attr->{'type'}->[1] =~
/^(?:checkbox|hidden|radio|text)$/;
  next if $a eq 'value' && !($tag eq 'input' && $isValidType);

next IF
$a eq value
    AND
NOT ( tag is an input AND input type is valid )
in short: NOT (tag is a valid input tag)

[ Alternative ] ( Not included in patch )
next if $a eq 'value' && ($tag ne 'input' || (ref $attr->{'type'} &&
$attr->{'type'}->[1] !~ /^(?:checkbox|hidden|radio|text)$/));
No extra variable, at the cost of code readability.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list