HOWTO Date Custom Fields

I need to have two or three Custom Fields holding dates (for birthdays
and other date-dependent information unrelated to the ticket start or
due dates). I’ve managed to add a regex for structural validation of the
custom field, but would appreciate any pointers allowing me to:

  • Have the Date Selection picker available for the custom field, in the
    same way it is available for entering reminder dates, start date, due
    date, etc.
  • Making sure the value entered is a valid date.

I’m using RT 3.6.1 as packaged by Debian Etch.
Ernesto Hernández-Novich - Linux 2.6.18 i686 - Unix: Live free or die!
Geek by nature, Linux by choice, Debian of course.
If you can’t aptitude it, it isn’t useful or doesn’t exist.
GPG Key Fingerprint = 438C 49A2 A8C7 E7D7 1500 C507 96D6 A3D6 2F4C 85E3

I need to have two or three Custom Fields holding dates (for birthdays
and other date-dependent information unrelated to the ticket start or
due dates). I’ve managed to add a regex for structural validation of the
custom field, but would appreciate any pointers allowing me to:

  • Have the Date Selection picker available for the custom field, in the
    same way it is available for entering reminder dates, start date, due
    date, etc.

I think you’re going to have to use a custom (local) page. A callback might
work for adding
in the picker widget, but if you look you need to do some initialization as
well, which is
presently done via onLoad for the existing date fields. But I wasn’t paying
too close attention,
just replacing the easy to miss “Date” text link with a calendar icon.

  • Making sure the value entered is a valid date.

I think the picker validates.
Cambridge Energy Alliance: Save money & the planet

We have a nearly complete patch for Date Custom Fields from Emmanuel
Lacour.

It’s in Ticket 8721 on http://rt3.fsck.com

It came in just after the freeze for RT 3.8.0 and I really want it to
get a bit more testing before we package it up as a part of RT.

So. feedback is appreciated.On Aug 31, 2008, at 10:07 AM, Ernesto Hernandez-Novich wrote:

I need to have two or three Custom Fields holding dates (for birthdays
and other date-dependent information unrelated to the ticket start or
due dates). I’ve managed to add a regex for structural validation of
the
custom field, but would appreciate any pointers allowing me to:

  • Have the Date Selection picker available for the custom field, in
    the
    same way it is available for entering reminder dates, start date, due
    date, etc.
  • Making sure the value entered is a valid date.

I’m using RT 3.6.1 as packaged by Debian Etch.

Ernesto Hernández-Novich - Linux 2.6.18 i686 - Unix: Live free or die!
Geek by nature, Linux by choice, Debian of course.
If you can’t aptitude it, it isn’t useful or doesn’t exist.
GPG Key Fingerprint = 438C 49A2 A8C7 E7D7 1500 C507 96D6 A3D6 2F4C
85E3


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

We have a nearly complete patch for Date Custom Fields from Emmanuel
Lacour.

It’s in Ticket 8721 on http://rt3.fsck.com

It came in just after the freeze for RT 3.8.0 and I really want it to
get a bit more testing before we package it up as a part of RT.

So. feedback is appreciated.

I took that patch and backported it to RT 3.6.1 running on Debian Etch.
I did several changes, some to actually make it work and some at our
customers’ request.

Basically, they wanted “date only” values, meaning an ISO date without
time (2008-09-24) so that’s what’s being stored in the database instead
of a fully fledged ISO value as the original patch does; I believe the
latter is the right approach to the problem, but to keep things simple I
just used $DateObj->Date instead of $DateObj->ISO and used 'unknown’
while creating the RT::Date objects. I also added a regexp for those
cases when the field has to be mandatory.

I also changed the way the CF{} string is handled while building the
search form. The search form was breaking because the original patch
rips the quotes around it (maybe that works in newer versions of RT, but
it doesn’t in 3.6.1) so I put that back in place.

As far as my testing goes, it works fine; the customer will put it in
production early next week. If anyone is interested, just ask for the
patch via private e-mail.

Thanks for your help.
Ernesto Hernández-Novich - Linux 2.6.18 i686 - Unix: Live free or die!
Geek by nature, Linux by choice, Debian of course.
If you can’t aptitude it, it isn’t useful or doesn’t exist.
GPG Key Fingerprint = 438C 49A2 A8C7 E7D7 1500 C507 96D6 A3D6 2F4C 85E3