[rt-users] CustomField sort order with Global CustomFields

Jerrad Pierce jpierce at cambridgeenergyalliance.org
Fri Oct 23 16:45:16 EDT 2009


>We recently updated from RT 3.6.4 to RT 3.8.1. Our users have noticed
>that the order of CustomFields has changed on the Basics page. Prior to
>upgrading, Global CustomFields were listed first with queue specific
>ones listed next. It seems to be reversed now, with all the queue
>specific fields being listed first and global CustomFields being listed
>at the end.

>Everything sorts correctly inside of its own list (ie, queue specific
>fields sort correctly amongst themselves). I didn't see this after
>searching the archive and I'm lost as to where to start looking for a
>solution.

I just noticed the somewhat illogical placement myself*, it's specified
in &RT::CustomFields_Overlay::LimitToGlobalOrObjectId. Change the order

    $self->OrderByCols(
        { ALIAS => $self->_OCFAlias, FIELD => 'ObjectId', ORDER => 'DESC' },
        { ALIAS => $self->_OCFAlias, FIELD => 'SortOrder' },
    );

to

    $self->OrderByCols(
        { ALIAS => $self->_OCFAlias, FIELD => 'ObjectId', ORDER => 'ASC' },
        { ALIAS => $self->_OCFAlias, FIELD => 'SortOrder' },
    );

in an overlay.

While there, you might simplify the body to remove the unnecessary $global_only

 sub LimitToGlobalOrObjectId {
    my $self = shift;

    foreach my $id (@_ ? @_ : 0 ) {
        $self->Limit( ALIAS           => $self->_OCFAlias,
                    FIELD           => 'ObjectId',
                    OPERATOR        => '=',
                    VALUE           => $id || 0,
                    ENTRYAGGREGATOR => 'OR' );
    }


* After all, globals come first on the Queue Ticket Custom Fields page.
-- 
Cambridge Energy Alliance: Save money. Save the planet.



More information about the rt-users mailing list