[Rt-commit] rt branch, 4.0/customfield-lookuptype-consistency, created. rt-4.0.14rc1-2-gab82113

Alex Vandiver alexmv at bestpractical.com
Mon Jul 15 14:54:40 EDT 2013


The branch, 4.0/customfield-lookuptype-consistency has been created
        at  ab8211351559fc59aafdb8bb0f03f0f545661cf1 (commit)

- Log -----------------------------------------------------------------
commit 9d4533a91e7a7717309255c7f0f3bba88f32c8ac
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jul 15 14:49:23 2013 -0400

    Sort the list of lookuptypes such that it displays in consistent order
    
    The dropdown of LookupTypes displayed in the Custom field admin
    interface is simply pulled from RT::CustomField->LookupTypes, which was
    "keys %FRIENDLY_OBJECT_TYPES" Prior to perl 5.18, this meant that the
    ordering changed whenever a new lookuptype was added, which was rare;
    post-5.18, it changes on every page reload, which makes it completely
    unpredictable as a UI element.  This also effectively provided a
    different random default LookupType on every custom field created.
    
    Fix the LookupType to be sorted alphabetically.

diff --git a/lib/RT/CustomField.pm b/lib/RT/CustomField.pm
index 0211815..13eb7ef 100644
--- a/lib/RT/CustomField.pm
+++ b/lib/RT/CustomField.pm
@@ -1176,7 +1176,7 @@ Returns an array of LookupTypes available
 
 sub LookupTypes {
     my $self = shift;
-    return keys %FRIENDLY_OBJECT_TYPES;
+    return sort keys %FRIENDLY_OBJECT_TYPES;
 }
 
 my @FriendlyObjectTypes = (

commit ab8211351559fc59aafdb8bb0f03f0f545661cf1
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jul 15 14:53:16 2013 -0400

    Provide a default LookupType of Ticket when creating CustomFields
    
    This is likely the most common type of CF created, and thus the santest
    to default to.

diff --git a/share/html/Admin/CustomFields/Modify.html b/share/html/Admin/CustomFields/Modify.html
index 4281d17..cab4517 100644
--- a/share/html/Admin/CustomFields/Modify.html
+++ b/share/html/Admin/CustomFields/Modify.html
@@ -305,7 +305,7 @@ $m->callback(CallbackName => 'ValidationPatterns', Values => \@CFvalidations);
 <%ARGS>
 $id => undef
 $TypeComposite => undef
-$LookupType => undef
+$LookupType => RT::Ticket->CustomFieldLookupType
 $MaxValues => undef
 $SortOrder => undef
 $Description => undef

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


More information about the Rt-commit mailing list