[rt-users] Problem with date

Christian Loos cloos at netcologne.de
Thu Nov 20 02:52:27 EST 2014


Hi,

as far as I understand you script you try to set the ticket resolved
date to the transaction date when the ticket status is set to closed.

If you have configured you RT correct this is done automatically by RT.

So what is your intent with this script?

Chris

Am 19.11.2014 um 20:18 schrieb Bryon Baker:
> I am attempting use  the following code to update the Resolved date in a
> ticket.  Thanks for the help in advance.
> 
>  
> 
> package RT::Action::CSRUpdateResolvedTest;
> 
> use base 'RT::Action';
> 
> use strict;
> 
> use warnings;
> 
>  
> 
> sub Prepare
> 
> {
> 
>                 return 1;
> 
> }
> 
>  
> 
> sub Commit
> 
> {
> 
>                
> 
>                 my %mon2num = qw(
> 
>                                 jan 1  feb 2  mar 3  apr 4  may 5  jun 6
> 
>                                 jul 7  aug 8  sep 9  oct 10 nov 11 dec 12
> 
>                 );
> 
>                 my $self = shift;
> 
>                 my $ticket = $self->TicketObj;
> 
>                 my $datecreated = $ticket->CreatedObj->Unix;
> 
> my $dateupdated = $ticket->LastUpdatedObj->Unix;
> 
> my $datecreatedstr = $ticket->CreatedObj->AsString;
> 
> my $dateupdatedstr = $ticket->LastUpdatedObj->AsString;
> 
>                 my $dateresolved;
> 
>                 my $dateresolvedstr;
> 
>                 my @dateresolvedstr;
> 
>                 my $transactions = $ticket->Transactions;
> 
>                 $transactions->Limit( FIELD => 'Type', VALUE =>
> 'Status', FIELD => 'NewValue', VALUE => 'closed');
> 
>                 while (my $transaction = $transactions->Next)
> 
>                 {
> 
>             $dateresolved = localtime($transaction->CreatedObj->Unix);
> 
>                            @dateresolvedstr = split(" ",$dateresolved);
> 
>                            $dateresolvedstr = $dateresolvedstr[4] . "-"
> . $mon2num{lc substr($dateresolvedstr[1], 0, 3)} . "-" .
> $dateresolvedstr[2] . " " .  $dateresolvedstr[3];
> 
>                  }
> 
>  
> 
>                 print $dateresolvedstr . " " . $dateresolved . "\n";
> 
>                 $ticket->SetResolved($dateresolvedstr);
> 
>  
> 
>                 return 1;
> 
> }
> 
>  
> 
> The dates printed to the console are correct but when I view the ticket
> the resolved date is different than the dates printed to the console by
> 6 hours.  This seems to me to be the off set for the time zone.  What do
> I need to add for Request Tracker to take the date as is?
> 
>  
> 
> Thanks
> 
> Bryon Baker
> 
> Network Operations Manager
> 
> */Copesan/**/- Specialists in Pest Solutions/*
> 
> 800-267-3726  •  262-783-6261 ext. 2296
> 
> bbaker at copesan.com <mailto:cstephan at copesan.com>
> 
> www.copesan.com <http://www.copesan.com/>
> 
> */"Servicing North America with Local Care"/*
> 
>  
> 





More information about the rt-users mailing list