[Rt-commit] rt branch, 4.0/fix-numeric-eq-warning-in-select-class, created. rt-4.0.2-190-g13890a1

? sunnavy sunnavy at bestpractical.com
Wed Oct 19 05:37:47 EDT 2011


The branch, 4.0/fix-numeric-eq-warning-in-select-class has been created
        at  13890a1850392193b331a66397cee2b27afc0b27 (commit)

- Log -----------------------------------------------------------------
commit 13890a1850392193b331a66397cee2b27afc0b27
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Oct 19 17:29:24 2011 +0800

    fix a warning "isn't numeric in numeric eq (==)"
    
    items in @Default could be the class name instead of id.
    e.g. this situation occurs in /Articles/Elements/QuickSearch
    this warning can be reproduced by accessing links in "Quick search" box
    of /Articles/index.html

diff --git a/share/html/Articles/Elements/SelectClass b/share/html/Articles/Elements/SelectClass
index 2e0ce47..f0e339b 100644
--- a/share/html/Articles/Elements/SelectClass
+++ b/share/html/Articles/Elements/SelectClass
@@ -62,7 +62,7 @@ SIZE=<%$Size%>
 % while (my $Class=$Classes->Next) {
 % next unless ($Class->Name); # if they can't see it, don't list it
 % if ($ShowAllClasses || $Class->CurrentUserHasRight('CreateArticle')) {
-<option VALUE="<%$Class->Id%>" <%(grep { $_ && ( $Class->Id == $_ || $Class->Name eq $_ )} @Default) ? 'SELECTED' : '' %>><%$Class->Name%>
+<option VALUE="<%$Class->Id%>" <%(grep { $_ && ( ( /^\d+$/ && $Class->Id == $_ ) || $Class->Name eq $_ )} @Default) ? 'SELECTED' : '' %>><%$Class->Name%>
 %   if (($Verbose) and ($Class->Description) ){
 (<%$Class->Description%>)
 %  }

-----------------------------------------------------------------------


More information about the Rt-commit mailing list