[rt-devel] missing ValidateValue method
Kevin Falcone
falcone at bestpractical.com
Tue Nov 11 14:41:11 EST 2014
On Tue, Nov 11, 2014 at 12:54:01PM +0100, Christian Loos wrote:
> playing around with CustomFieldValues I noticed that you can add
> arbitrary values for CustomFields of type select.
>
> RT::Record->_AddCustomFieldValue calls ValidateValue [1] on a
> CustomField, but this method doesn't exist.
> Everything I can found is that this method was added with [2] in 2002
> and then removed with [3] in 2005.
>
> No one is missing this method except me since the last 9 years? ;-)
You're running into the fact that DBIx::SearchBuilder will bless
ValidateAnything into existence (you'll see a comment in the AUTOLOAD
code for it explaining that is used to use Accessible to do so, but
doesn't do that any more).
See for example
use RT -init;
my $ticket = RT::Ticket->new(RT->SystemUser);
print $ticket->ValidateAnything;
https://github.com/bestpractical/dbix-searchbuilder/blob/master/lib/DBIx/SearchBuilder/Record.pm#L476
Unfortunately, the commit message which removed ValidateValue is
essentially useless, so I have no idea why it was removed.
I'd certainly support a 4.4 change that brought back CustomField->ValidateValue,
but it would have to be clever about the same canonicalization used in
HasEntry and friends (think of "tomorrow" entered in date CFs).
-kevin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 221 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-devel/attachments/20141111/8c8b3d29/attachment.pgp>
More information about the rt-devel
mailing list