[rt-users] Almost there with Approvals
Kevin Squire
gentgeen at linuxmail.org
Tue Jun 5 17:25:33 EDT 2007
Today I present the "TimeOff" approval stuff to the HR department.
Things when well (thank you again RT developers and to the user list).
The did have one request that I can not seem to figure out (I really
need to get a perl book or two :-) )
Currently, my "OnApproval" sprip looks like this (I think it is the same
as the default, but I have made so many changes I am not sure now):
# ----OnApproval scrip------------------------------------------------ #
return(0) unless ($self->TicketObj->Type eq 'approval');
my $note;
my $t = $self->TicketObj->Transactions;
while (my $o = $t->Next) {
$note .= $o->Content . "\n" if $o->ContentObj
and $o->Content !~ /Default Approval/;
}
foreach my $obj ($self->TicketObj->AllDependedOnBy( Type => 'ticket' ))
{
$obj->Comment(
Content => $self->loc( "Your request has been approved by [_1].
Other approvals may still be pending.", # loc
$self->TransactionObj->CreatorObj->Name,
) . "\n" . $self->loc( "Approver's notes: ", # loc
$note
),
);
# so we can access it inside templates
$T::Approval = $self->TicketObj;
# we want the original id in the token line
$self->{TicketObj} = $obj;
}
# Now magically turn myself into a Requestor Notify object...
require RT::Action::Notify; bless($self, 'RT::Action::Notify');
$self->{Argument} = 'Requestor'; $self->Prepare;
return 1;
#-------------------------------------------------------------------#
The resulting comment in the original ticket shows up like:
#-------------------------------------------------------------------#
Tue Jun 05 11:58:16 2007 RT_System - Comments added [Reply]
[Comment]
Your request has been approved by scizmarik. Other approvals may still
be pending.
Approver's notes:
Tue Jun 05 11:53:09 2007: Request 2131 was acted upon.
Transaction: Ticket created by RT_System
Queue: TimeOff-Approval
Subject: Approval of Mike is a Dork
Owner: Nobody
Requestors:
Status: new
Ticket <URL:
http://gentgeen.homelinux.org:5556/rt/Ticket/Display.html?id=2131 >
Woo Hoo...it's approved by HR
<URL: http://gentgeen.homelinux.org:5556/rt/Ticket/Display.html?id=2131
>
Woo Hoo...it's approved by HR
#-------------------------------------------------------------------#
The would like to remove everything from "Approver's notes:" down to (at
least) the first "Woo Hoo... it's approved by HR". The Link can go, or
stay either way. (i.e. really only the last line is needed.)
problem is, I can not figure out what part of the scrip is causing that
to be put in. Any help would be appreciated (again)
Thanks,
Kevin
--
http://gentgeen.homelinux.org
#############################################################
Associate yourself with men of good quality if you esteem
your own reputation; for 'tis better to be alone then in bad
company. - George Washington, Rules of Civility
More information about the rt-users
mailing list