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

--- Comment #1 from Maxime Beaulieu <[email protected]> ---
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.
_______________________________________________
Koha-bugs mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to