Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Request Tracker: Devel

Button that Creates an Approval Ticket

 

 

Request Tracker devel RSS feed   Index | Next | Previous | View Threaded


gratz.1 at osu

Mar 9, 2009, 11:08 AM

Post #1 of 1 (782 views)
Permalink
Button that Creates an Approval Ticket

I'm newbie at RT and could use some help. I have created a button for
adding an approval to an existing ticket, but had to resort to some less
than desirable coding practices (hacks) to make it work. There must be a
better way to to do this. If anyone has a better plan please let me
know. I'm using RT3.8.2 on linux.

Thanks,

Conrad

Here is what I have written:

#### This code is at the end of a local copy of ShowTransaction, this
abuses the 'Comment' action.

%# Approval button from wiki.bestpractical.com/view/CreateChildTicket -
CPG 2/09
% if ( $Transaction->Type =~ /^(Create)$/
% && $ENV{'REQUEST_URI'} !~ /(\/Approvals\/)/
% && $Ticket->QueueObj->Name =~ /^(MyQueue)$/) {

<form action="<% $RT::WebPath %>/Ticket/Update.html" name="TicketUpdate">

<input type="hidden" name="Action" value="Comment">
<input type="hidden" name="DefaultStatus" value="">
<input type="hidden" name="UpdateType" value="private">
<input type="hidden" name="id" value="<%$Ticket->Id%>">
<input type="hidden" name="new-RefersTo" value="">
<input type="hidden" name="RefersTo-new" value="">
<input type="hidden" name="QuoteTransaction" value="<%$Transaction->Id%>">
<input type="hidden" name="Status" value="">
<input type="hidden" name="UpdateSubject" value="Approval Requested">
<input type="hidden" name="UpdateContent" value="Approval Requested">
<p align="right">
<input type="submit" name="SubmitTicket" value="Create Approval Ticket">
</p>
</form>

% }

##### Custom Condition for MyQueue scrip. This abuses 'Subject' to sort
out approval requests. Action is 'Create Tickets'.

my $result = 0;
if ($self->TransactionObj->Type eq "Comment"
&& $self->TransactionObj->Data =~ /(Approval Requested)$/) {
$result = 1;
}
return($result);

#### Template for the above. This is from the bestpractical wiki and
works fine.

===Create-Ticket: myapproval
Subject: Request Approval for {$Tickets{'TOP'}->Subject}
Depended-On-By: TOP
Queue: Ops_Approvals
Type: approval
Owner: gratz
AdminCC: {
my $group_name = 'Ops_Approvers';
my $groups = RT::Groups->new( $RT::SystemUser );

$groups->LimitToUserDefinedGroups();
$groups->Limit(
'FIELD' => 'Name',
'OPERATOR' => '=',
'VALUE' => $group_name );
$groups->First->Id;

}
Content: A ticket needs your attention. Please approve it so any work
requested may be completed.
ENDOFCONTENT

_______________________________________________
List info: http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel

Request Tracker devel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.