[Rt-devel] How to fix custom fields on Users?
Jan Hudec
bulb at ucw.cz
Mon Aug 15 17:02:11 EDT 2005
Hello All,
I have just tried to create a custom field that applies to users -- and it
didn't work. That is, I created the field all right, was able to search users
based on it's value on Admin/Users/, but was not able to set that field.
I tracked the problem down to RT::User->CustomFields generating a query
joined with table ObjectCustomFields, but there is no matching row in there.
I found, that during custom field creation, a record is placed in that table,
but not for user and group custom fields.
So as a quick-fix, I placed this in lib/RT/User_Local.pm:
sub CustomFields {
my $self = shift;
my $cfs = RT::CustomFields->new( $self->CurrentUser );
$cfs->UnLimit;
# XXX handle multiple types properly
foreach my $lookup ($self->_LookupTypes) {
$cfs->LimitToLookupType($lookup);
}
return $cfs;
}
which is really just the method taken from RT::Record, with row reading
$cfs->LimitToGlobalOrObjectId($self->_LookupId($lookup));
removed. This fix seems to work.
Now I'd like to know whether the correct fix is to remove this limit for
RT::User and RT::Group, or to make LimitToGlobalOrObjectId work for them.
I also assume it would be better to remove this check from RT::Record and
override in RT::Ticket, rather than the other way around.
I'd be willing to produce a patch, but want to know which fix would be
considered better.
-------------------------------------------------------------------------------
Jan 'Bulb' Hudec <bulb at ucw.cz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.bestpractical.com/pipermail/rt-devel/attachments/20050815/c463736e/attachment.pgp
More information about the Rt-devel
mailing list