[Rt-commit] rt branch, 4.0/ticket-status-when-approvals-passed, created. rt-4.0.6-126-g6640614

Ruslan Zakirov ruz at bestpractical.com
Sun Jun 10 07:40:51 EDT 2012


The branch, 4.0/ticket-status-when-approvals-passed has been created
        at  66406147c96b52f66d3cf605241ed40123f754a5 (commit)

- Log -----------------------------------------------------------------
commit 66406147c96b52f66d3cf605241ed40123f754a5
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Jun 7 21:48:36 2012 +0400

    change how we use Lifecycle->DefaultStatus('approved')
    
    It was always intention to use Lifecycle->DefaultStatus('approved')
    to set status on ticket when all approvals are approved, but code
    was wrongly placed. Fix this.
    
    Use FirstActiveStatus where 'approved' option was used.

diff --git a/lib/RT/Approval/Rule/Passed.pm b/lib/RT/Approval/Rule/Passed.pm
index f364bc9..000a8dc 100644
--- a/lib/RT/Approval/Rule/Passed.pm
+++ b/lib/RT/Approval/Rule/Passed.pm
@@ -80,10 +80,8 @@ sub Commit {
             }
 
         }
-        $obj->SetStatus(
-            Status => $obj->QueueObj->Lifecycle->DefaultStatus('approved') || 'open',
-            Force => 1,
-        );
+        $obj->SetStatus( Status => $obj->FirstActiveStatus, Force => 1 )
+            if $obj->FirstActiveStatus;
     }
 
     my $passed = !$top->HasUnresolvedDependencies( Type => 'approval' );
@@ -98,6 +96,11 @@ sub Commit {
     $top->Correspond( MIMEObj => $template->MIMEObj );
 
     if ($passed) {
+        my $new_status = $top->QueueObj->Lifecycle->DefaultStatus('approved') || 'open';
+        if ( $new_status ne $top->Status ) {
+            $top->SetStatus( $new_status );
+        }
+
         $self->RunScripAction('Notify Owner', 'Approval Ready for Owner',
                               TicketObj => $top);
     }

-----------------------------------------------------------------------


More information about the Rt-commit mailing list