<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">I am attempting use the following code to update the Resolved date in a ticket. Thanks for the help in advance.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">package RT::Action::CSRUpdateResolvedTest;<o:p></o:p></p>
<p class="MsoNormal">use base 'RT::Action';<o:p></o:p></p>
<p class="MsoNormal">use strict;<o:p></o:p></p>
<p class="MsoNormal">use warnings;<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">sub Prepare<o:p></o:p></p>
<p class="MsoNormal">{<o:p></o:p></p>
<p class="MsoNormal"> return 1;<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">sub Commit<o:p></o:p></p>
<p class="MsoNormal">{<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"> my %mon2num = qw(<o:p></o:p></p>
<p class="MsoNormal"> jan 1 feb 2 mar 3 apr 4 may 5 jun 6<o:p></o:p></p>
<p class="MsoNormal"> jul 7 aug 8 sep 9 oct 10 nov 11 dec 12<o:p></o:p></p>
<p class="MsoNormal"> );<o:p></o:p></p>
<p class="MsoNormal"> my $self = shift;<o:p></o:p></p>
<p class="MsoNormal"> my $ticket = $self->TicketObj;<o:p></o:p></p>
<p class="MsoNormal"> my $datecreated = $ticket->CreatedObj->Unix;<o:p></o:p></p>
<p class="MsoNormal" style="text-indent:.5in">my $dateupdated = $ticket->LastUpdatedObj->Unix;<o:p></o:p></p>
<p class="MsoNormal" style="text-indent:.5in">my $datecreatedstr = $ticket->CreatedObj->AsString;<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">my $dateupdatedstr = $ticket->LastUpdatedObj->AsString;<o:p></o:p></p>
<p class="MsoNormal"> my $dateresolved;<o:p></o:p></p>
<p class="MsoNormal"> my $dateresolvedstr;<o:p></o:p></p>
<p class="MsoNormal"> my @dateresolvedstr;<o:p></o:p></p>
<p class="MsoNormal"> my $transactions = $ticket->Transactions;<o:p></o:p></p>
<p class="MsoNormal"> $transactions->Limit( FIELD => 'Type', VALUE => 'Status', FIELD => 'NewValue', VALUE => 'closed');<o:p></o:p></p>
<p class="MsoNormal"> while (my $transaction = $transactions->Next)
<o:p></o:p></p>
<p class="MsoNormal"> {<o:p></o:p></p>
<p class="MsoNormal" style="text-indent:.5in"> $dateresolved = localtime($transaction->CreatedObj->Unix);<o:p></o:p></p>
<p class="MsoNormal"> @dateresolvedstr = split(" ",$dateresolved);<o:p></o:p></p>
<p class="MsoNormal"> $dateresolvedstr = $dateresolvedstr[4] . "-" . $mon2num{lc substr($dateresolvedstr[1], 0, 3)} . "-" . $dateresolvedstr[2] . " " . $dateresolvedstr[3];<o:p></o:p></p>
<p class="MsoNormal"> }<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> print $dateresolvedstr . " " . $dateresolved . "\n";<o:p></o:p></p>
<p class="MsoNormal"> $ticket->SetResolved($dateresolvedstr);<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> return 1;<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:black">Bryon Baker<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:black">Network Operations Manager<o:p></o:p></span></p>
<p class="MsoNormal"><b><i><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:red">Copesan</span></i></b><b><i><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:black"> - Specialists in Pest Solutions<o:p></o:p></span></i></b></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:black">800-267-3726 • 262-783-6261 ext. 2296<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif""><a href="mailto:cstephan@copesan.com"><span style="color:blue">bbaker@copesan.com</span></a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:black"><a href="http://www.copesan.com/"><span style="color:black">www.copesan.com</span></a><o:p></o:p></span></p>
<p class="MsoNormal"><b><i><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:red">"Servicing North America with Local Care"</span></i></b><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>