[Rt-commit] r17186 - in rt/3.8/branches/ruleset: lib/RT/Approval/Rule t/approval

clkao at bestpractical.com clkao at bestpractical.com
Fri Dec 12 07:06:08 EST 2008


Author: clkao
Date: Fri Dec 12 07:06:06 2008
New Revision: 17186

Modified:
   rt/3.8/branches/ruleset/etc/initialdata
   rt/3.8/branches/ruleset/lib/RT/Approval/Rule/Passed.pm
   rt/3.8/branches/ruleset/lib/RT/Approval/Rule/Rejected.pm
   rt/3.8/branches/ruleset/t/approval/basic.t

Log:
when all approvals are passed, also notify the owner that the request can now be acted on.

Modified: rt/3.8/branches/ruleset/etc/initialdata
==============================================================================
--- rt/3.8/branches/ruleset/etc/initialdata	(original)
+++ rt/3.8/branches/ruleset/etc/initialdata	Fri Dec 12 07:06:06 2008
@@ -319,7 +319,7 @@
     {  Queue       => '___Approvals',
        Name        => "RT Approval Passed",    # loc
        Description =>
-         "Notify Owner of their ticket has been approved by some approver", # loc
+         "Notify Requestor of their ticket has been approved by some approver", # loc
        Content => 'Subject: Ticket Approved: {$Ticket->Subject}
 
 Greetings,
@@ -333,7 +333,7 @@
     {  Queue       => '___Approvals',
        Name        => "RT All Approvals Passed",    # loc
        Description =>
-         "Notify Owner of their ticket has been approved by all approvers", # loc
+         "Notify Requestor of their ticket has been approved by all approvers", # loc
        Content => 'Subject: Ticket Approved: {$Ticket->Subject}
 
 Greetings,
@@ -357,6 +357,18 @@
 Approver\'s notes: { $Notes }
 '
     },
+    {  Queue       => '___Approvals',
+       Name        => "RT Approval Ready for Owner",    # loc
+       Description =>
+         "Notify Owner of their ticket has been approved and is ready to be acted on", # loc
+       Content => 'Subject: Ticket Approved: {$Ticket->Subject}
+
+Greetings,
+
+The ticket has been approved, you may now start to act on it.
+
+'
+    },
     {  Queue       => 0,
        Name        => "Forward",    # loc
        Description => "Heading of a forwarded message", # loc

Modified: rt/3.8/branches/ruleset/lib/RT/Approval/Rule/Passed.pm
==============================================================================
--- rt/3.8/branches/ruleset/lib/RT/Approval/Rule/Passed.pm	(original)
+++ rt/3.8/branches/ruleset/lib/RT/Approval/Rule/Passed.pm	Fri Dec 12 07:06:06 2008
@@ -41,6 +41,12 @@
     ) or die;
 
     $top->Correspond( MIMEObj => $template->MIMEObj );
+
+    if ($passed) {
+        $self->RunScripAction('Notify Owner', 'RT Approval Ready for Owner',
+                              TicketObj => $top);
+    }
+
     return;
 }
 

Modified: rt/3.8/branches/ruleset/lib/RT/Approval/Rule/Rejected.pm
==============================================================================
--- rt/3.8/branches/ruleset/lib/RT/Approval/Rule/Rejected.pm	(original)
+++ rt/3.8/branches/ruleset/lib/RT/Approval/Rule/Rejected.pm	Fri Dec 12 07:06:06 2008
@@ -20,9 +20,7 @@
         my $template = $self->GetTemplate('RT Approval Rejected',
                                           TicketObj => $rejected,
                                           Approval  => $self->TicketObj,
-                                          Notes     => '')
-;
-        warn "hate software " unless $template->Id;
+                                          Notes     => '');
 
         $rejected->Correspond( MIMEObj => $template->MIMEObj );
         $rejected->SetStatus(

Modified: rt/3.8/branches/ruleset/t/approval/basic.t
==============================================================================
--- rt/3.8/branches/ruleset/t/approval/basic.t	(original)
+++ rt/3.8/branches/ruleset/t/approval/basic.t	Fri Dec 12 07:06:06 2008
@@ -8,7 +8,7 @@
         or plan skip_all => 'require Email::Abstract and Test::Email';
 }
 
-plan tests => 37;
+plan tests => 38;
 
 use RT;
 use RT::Test;
@@ -172,9 +172,14 @@
 } { from => qr/RT System/,
     to => 'minion at company.com',
     subject => qr/Ticket Approved:/,
-    body => qr/approved by CEO.*Its Owner may now start to act on it.*notes: And consumed they will be/s
+    body => qr/approved by CEO.*Its Owner may now start to act on it.*notes: And consumed they will be/s,
+}, { from => qr'CEO via RT',
+     to => 'root at localhost',
+     subject => qr/Ticket Approved/,
+     body => qr/The ticket has been approved, you may now start to act on it/,
 };
 
+
 is_deeply([ $t->Status, $dependson_cfo->Status, $dependson_ceo->Status ],
           [ 'new', 'resolved', 'resolved'], 'ticket state after ceo approval');
 


More information about the Rt-commit mailing list