[rt-users] Issue with scrip.
Kevin Falcone
falcone at bestpractical.com
Tue Sep 1 15:13:43 EDT 2009
On Tue, Sep 01, 2009 at 11:48:53AM -0700, William Graboyes wrote:
> Hi Kevin,
>
> Thanks for the Quick response. Is there any good documentation anywhere on the RT:Date
> functions? A quick search of the wiki resulted in nothing more or less, so for the time being,
> I believe the solution should be something along the lines of:
perldoc /opt/rt3/lib/RT/Date.pm
-kevin
> my $CF_Obj = RT::CustomField->new($self->CurrentUser);
> my $cf_name = 'Ticket_resolveDate';
> my ( $sec, $min, $hour, $day, $mon, $year ) = localtime( time );
> my $cf_value = sprintf( '%d-%02d-%02d %02d:%02d:%02d', $year + 1900, $mon + 1, $day, $hour,
> $min, $sec );
> $CF_Obj->LoadByName( Name => $cf_name,);
> $RT::Logger->debug( "Loaded \$CF_Obj->Name = ". $CF_Obj->Name() ."\n" );
>
> $CF_Obj->AddValueForObject( Object => $self->TicketObj,
> Content => $cf_value, );
> 1;
> Thanks,
> Bill G.
>
> On Tue, Sep 1, 2009 at 11:35 AM, Kevin Falcone <[1]falcone at bestpractical.com> wrote:
>
> On Tue, Sep 01, 2009 at 11:29:36AM -0700, William Graboyes wrote:
> > Hi all,
> >
> > I am having a strange issue with a script, I was wondering if those who are a bit more
> > proficient than myself can give me a couple of pointers.
> >
> > The issue is that sometimes, quite regularly actually, it is printing a date that is 1
> month
> > behind the current date. this has me very confused, there are a few that wrote the date
> > properly, (about 17 out of 330). So with out further complications, here is a copy of the
> > scrip.
>
> You may want to read
> $ perldoc -f localtime
>
> which explains that $mon is not 1-12
>
> Also, you may want one of the functions from RT::Date rather than
> doing it by hand.
>
> -kevin
> >
> > my $CF_Obj = RT::CustomField->new($self->CurrentUser);
> > my $cf_name = 'Ticket_resolveDate';
> > my ( $sec, $min, $hour, $day, $mon, $year ) = localtime( time );
> > my $cf_value = sprintf( '%d-%02d-%02d %02d:%02d:%02d', $year + 1900, $mon, $day, $hour,
> > $min, $sec );
> > $CF_Obj->LoadByName( Name => $cf_name,);
> > $RT::Logger->debug( "Loaded \$CF_Obj->Name = ". $CF_Obj->Name() ."\n" );
> >
> > $CF_Obj->AddValueForObject( Object => $self->TicketObj,
> > Content => $cf_value, );
> > 1;
> _______________________________________________
> [2]http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: [3]http://wiki.bestpractical.com
> Commercial support: [4]sales at bestpractical.com
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at [5]http://rtbook.bestpractical.com
>
> --
> Bill Graboyes
> On Assignment At:
> Toyota Motor Sales, USA, Inc.
> Consumer Portal Delivery
> Office: (310) 468-6754
> Cell: (714) 515-8312
>
> References
>
> Visible links
> 1. mailto:falcone at bestpractical.com
> 2. http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> 3. http://wiki.bestpractical.com/
> 4. mailto:sales at bestpractical.com
> 5. http://rtbook.bestpractical.com/
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
More information about the rt-users
mailing list