[rt-users] resolved time update

Craig Stevenson stevensc at nsuok.edu
Fri Jan 6 17:43:21 EST 2006


Hello RT-ers!

After labor, I finally solved my problem concerning setting the Closed 
timestamp manually when resolving a ticket.  I am inlining the diff's.  
My RT instance is 3-4-4.  It all came down to the right few lines of 
code.  I found using the RT::Logger (& Carp) utility invaluable in 
getting this done.  I had trouble with the perldebugger, it would hang 
on line 215 of the autohandler. 

Ya'll have a great weekend!

--------------------------------------------------------------------------
Craig Stevenson, stevensc at nsuok.edu
Notes on configuring RT so that a ResolvedDate field appears on the Ticket
Resolve page.
06Jan05
--------------------------------------------------------------------------

The task at hand is to create a field on the 'Resolved' page, where the user
can set the date/time of finishing the work.  If it is left blank it will
do the usual -set-to-now-, if the field is filled with something parsable
to ParseDate, it will use that value instead for the resolution timestamp.


There are several files that were altered to make this work:


Update.html
---------------------------------------------------------------
diff /usr/local/rt/share/html/Ticket/Update.html
/usr/local/rt/local/html/Ticket/Update.html
64a65,73
 >
 > <!-- stevensc: sending 'ResolvedDate' in ARGS, to manually set the 
date -->
 > % if ($CanSetResolvedDate) {
 > <tr><td align=right><&|/l&>Resolved Date</&>:</td><td> <input
 > name="ResolvedDate" value="<% $ARGS{ResolvedDate}  %>" size=16><br>
 > <i><font size=-2><&|/l&>
 > (Enter a date only if you do not want to use the current time stamp.)
 > </&></font></i></td></tr>
 > % }
 >
140a150,153
 >
 > #stevensc:
 > my $CanSetResolvedDate = 0;
 >
154a168,169
 >     #stevensc:
 >     $CanSetResolvedDate = 1;
---------------------------------------------------------------

Ticket_Overlay.pm
---------------------------------------------------------------
diff /usr/local/rt/lib/RT/Ticket_Overlay.pm
/usr/local/rt/local/lib/RT/Ticket_Overlay.pm
3214a3215,3225
 >
 >         #stevensc: we now take a resolved date from the Update page
 >         # we added an element, 'ResolvedDate', to %ARGS, and passed
 >         # it in to this function where it will be used in lieu of 'now'
 >         # if it is set.
 >
 >         my$date=$args{ARGSRef}->{'ResolvedDate'};
 >         if($date){
 >             $now->Set(Format => 'unknown', Value => $date);
 >         }
 >
---------------------------------------------------------------

Record.pm
---------------------------------------------------------------
diff /usr/local/rt/lib/RT/Record.pm /usr/local/rt/local/lib/RT/Record.pm
275a276,277
 > #stevensc: following loop is being commmented just to see if currentuser
 > #install will work, ok breaks elsewhere, Iwill put it back.
921c923,932
<         my ( $code, $msg ) = $self->$method($value);
---
 >
 >         #stevensc:
 >         my($code,$msg);
 >         unless ($ARGSRef->{'ResolvedDate'}) {
 >           ( $code, $msg ) = $self->$method($value);
 >         } else {
 >           ( $code, $msg ) = $self->$method(Status  => $value,
 >                                              ARGSRef => $ARGSRef);
 >         }
 >
---------------------------------------------------------------

Craig Stevenson wrote:

> I am still puzzled over how to set the Closed field when resolving a 
> ticket.  I want to add a form
> to the Resolve Ticket window (which I can do, I just cannot get the 
> form data into the DB).
> Should I be looking at scrips to get this done?  Or, is there another 
> tack?
>
> Thanks a lot for the help.
>
> Craig Stevenson wrote:
>
>> My users need to be able to manually set the Closed time of a 
>> ticket.  When the ticket is 'resolved'
>> the Closed field is set to the current time stamp.  This is not what 
>> I need.  In my case the work would actually be completed some time 
>> before the ticket is resolved in the RT system.
>> I have added a Closed field to the Tickets->#####->Dates screen.  If 
>> this form is used after the 'Resolved' action is taken.  My user can 
>> set the correct time of  resolution.
>>
>> I would like better than this.  I am thinking that adding a form to 
>> the 'Resolved' page would be best, but I cannot see my way through to 
>> that yet. ...  (Meaning I don't have working code to do that yet.)
>>
>> Do other people have a similar issue?  What is the best way to get at 
>> manual date resolution?
>>
>> Thank so much.
>
>
>
>


-- 
Craig Stevenson
|| stevensc at nsuok.edu | 918-456-5511x5955
|| Northeastern State University
|| 601 N. Grand | Tahlequah, Oklahoma 74464-2399





More information about the rt-users mailing list