[rt-users] Updated: Editing A Custom Field on Resolve

Michael S. Liebman m-liebman at northwestern.edu
Mon Apr 19 16:01:09 EDT 2004


Attached is an updated patch for editing a custom field on
resolve. This is a patch against 3.0.10 that includes two
improvements. First, this one actually updates the CF, instead of just
displaying it. :) Secondly, some rights checking has been added.

My apologies for the hasty post of a less than well tested patch yesterday.

Michael
-- 
Michael S. Liebman                      m-liebman at northwestern.edu
                  http://msl521.freeshell.org/
"I have vision and the rest of the world wears bifocals."
        -Paul Newman in "Butch Cassidy & the Sundance Kid"
-------------- next part --------------
--- share/html/Ticket/Update.html	2003-11-25 22:32:12.000000000 -0500
+++ local/html/Ticket/Update.html	2004-04-19 15:56:37.000000000 -0400
@@ -62,6 +62,21 @@
 <&|/l&>Owner</&>:  
 <& /Elements/SelectOwner, Name=>"Owner", Default => ($ARGS{'Owner'} || $TicketObj->OwnerObj->Id()), QueueObj => $TicketObj->QueueObj, TicketObj => $TicketObj &>
 <&|/l&>Worked</&>: <input size=4 name="UpdateTimeWorked" value="<% $ARGS{UpdateTimeWorked}%>"> <&|/l&>minutes</&></td></tr>
+
+% # resolution CF if it belongs
+% if($DefaultStatus eq "resolved" and $CustomField->Id and $CanCF) {
+<tr>
+
+<td class="labeltop">
+      <%$CustomField->Name%><br>
+      <i><%$CustomField->FriendlyType%></i>
+</td>
+<td class="entry">
+<& Elements/EditCustomField, CustomField=>$CustomField, TicketObj=>$TicketObj, NamePrefix=>$NamePrefix &>
+</td>
+% }
+</tr>
+
 <tr><td align=right><&|/l&>Update Type</&>:</td>
 <td><select name="UpdateType">
 % if ($CanComment) {
@@ -121,10 +136,18 @@
 
 my $CanRespond = 0;
 my $CanComment = 0;
+my $CanCF      = 0;
 my $title;
 
+# Needed to display the resolution CF.
+my $NamePrefix;
+my $CustomFieldName = "Resolution";
+my $CustomField;
+
 my $TicketObj = LoadTicket($id);
 
+my @cf_results = ProcessTicketCustomFieldUpdates(TicketObj => $TicketObj, ARGSRef => \%ARGS);
+
 unless($DefaultStatus){
     $DefaultStatus=($ARGS{'Status'} ||$TicketObj->Status());
 }
@@ -156,6 +179,8 @@
 $CanComment = 1 if ( $TicketObj->CurrentUserHasRight('CommentOnTicket') or
                      $TicketObj->CurrentUserHasRight('ModifyTicket') ); 
 
+$CanCF      = 1 if ( $TicketObj->CurrentUserHasRight('ModifyTicket') );
+
 
 # {{{ deal with deleting uploaded attachments
 foreach my $key (keys %ARGS) {
@@ -196,6 +221,10 @@
     $m->comp('Display.html', TicketObj => $TicketObj, %ARGS);
     return;
 }
+
+# Needed to display the resolution CF.
+$NamePrefix = "Ticket-".$TicketObj->Id."-CustomField-";
+$CustomField = $TicketObj->QueueObj->CustomField($CustomFieldName);
 </%INIT>
 
 <%ARGS>


More information about the rt-users mailing list