Re: missing ValidateValue method
Kevin Falcone <[email protected]>
| Newsgroups | gmane.comp.bug-tracking.request-tracker.devel |
|---|---|
| Message-ID | <[email protected]> |
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
signature.asc
(application/pgp-signature, 221 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: GPGTools - http://gpgtools.org iEYEARECAAYFAlRiZlIACgkQ0+gKWp5CJQrY7ACfYapgvk1ygjrgkCpzTc+yApe/ MnQAn1knaf+0bW4N5BPwy7V03SoBqm4F =J06C -----END PGP SIGNATURE-----