[Rt-commit] [rtir] 07/24: Switch MapStatus to using lifecycles

Jesse Vincent jesse at bestpractical.com
Mon Feb 9 00:25:18 EST 2015


This is an automated email from the git hooks/post-receive script.

jesse pushed a commit to branch 3.4/remove_old_constituencies
in repository rtir.

commit b4423acad513721d086362afbf8c1ccf44205ace
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Fri Feb 6 16:11:35 2015 -0800

    Switch MapStatus to using lifecycles
---
 lib/RT/Action/RTIR_ResolveChildren.pm | 8 ++++----
 lib/RT/IR.pm                          | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/RT/Action/RTIR_ResolveChildren.pm b/lib/RT/Action/RTIR_ResolveChildren.pm
index 03e7817..9b7e247 100644
--- a/lib/RT/Action/RTIR_ResolveChildren.pm
+++ b/lib/RT/Action/RTIR_ResolveChildren.pm
@@ -76,11 +76,11 @@ sub Commit {
     my $incident = $self->TicketObj;
     my $id = $incident->Id;
 
-    foreach my $qname ( 'Incident Reports', 'Investigations', 'Blocks' ) {
-        next if $qname eq 'Blocks' && RT->Config->Get('RTIR_DisableBlocksQueue');
+    foreach my $lifecycle ( 'incident_reports', 'investigations', 'blocks' ) {
+        next if $lifecycle eq 'blocks' && RT->Config->Get('RTIR_DisableBlocksQueue');
 
         my $members = RT::IR->IncidentChildren(
-            $incident, Queue => $qname,
+            $incident, Lifecycle => $lifecycle,
             Initial => 1, Active => 1,
         );
         while ( my $member = $members->Next ) {
@@ -92,7 +92,7 @@ Linked Incident \#$id was resolved, but ticket still has unresolved linked Incid
 END
                 next;
             }
-            my $set_to = RT::IR->MapStatus( $incident->Status, $incident => $qname );
+            my $set_to = RT::IR->MapStatus( $incident->Status, $incident => $lifecycle );
             next unless $set_to;
             next if $member->Status eq $set_to;
 
diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index 8c21b37..e38c5db 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -472,6 +472,7 @@ sub MapStatus {
     my ($status, $from, $to) = @_;
     return unless $status;
 
+    # Validate that the from and to are legitimate
     foreach my $e ($from, $to) {
         if ( blessed $e ) {
             if ( $e->isa('RT::Queue') ) {
@@ -485,9 +486,8 @@ sub MapStatus {
             }
         }
         else {
-            my $queue = RT::Queue->new( RT->SystemUser );
-            $queue->Load( $e );
-            $e = $queue->LifecycleObj;
+            my $lifecycle = RT::Lifecycle->Load( Name => $e );
+            $e = $lifecycle;
         }
         return unless $e;
     }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the rt-commit mailing list