[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rt-commit
Subject:    [Rt-commit] [svn] r1580 - in rtir/branches/1.1-TESTING: html/RTIR
From:       leira () pallas ! eruditorum ! org
Date:       2004-09-29 8:30:17
Message-ID: 20040929083017.50BE884C040 () pallas ! eruditorum ! org
[Download RAW message or body]

Author: leira
Date: Wed Sep 29 04:30:16 2004
New Revision: 1580

Modified:
   rtir/branches/1.1-TESTING/html/RTIR/Create.html
   rtir/branches/1.1-TESTING/html/RTIR/Elements/IncidentSummary
   rtir/branches/1.1-TESTING/html/RTIR/Elements/ShowIncidents
   rtir/branches/1.1-TESTING/html/RTIR/Incident/Display.html
   rtir/branches/1.1-TESTING/html/RTIR/Reporting/Report.html
   rtir/branches/1.1-TESTING/html/RTIR/Split.html
   rtir/branches/1.1-TESTING/html/RTIR/Update.html
   rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_ChangeParentOwnership.pm
   rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_OpenParent.pm
   rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_ResolveChildren.pm
Log:
RT-Ticket: 6096
RT-Status: resolved
RT-Action: correspond
Replace calls to ->MemberOf with TicketSQL.


Modified: rtir/branches/1.1-TESTING/html/RTIR/Create.html
==============================================================================
--- rtir/branches/1.1-TESTING/html/RTIR/Create.html	(original)
+++ rtir/branches/1.1-TESTING/html/RTIR/Create.html	Wed Sep 29 04:30:16 2004
@@ -61,14 +61,11 @@
 % $parentvalue = $IncidentObj->Id;
 % } elsif ($TicketObj) {
 %   $parentvalue = $TicketObj->Id;
-%   my $count = 0;
-%   my $incidents = $TicketObj->MemberOf;
-%   while (my $link = $incidents->Next) {
-%     my $incident = $link->TargetObj;
-%     if ($incident->QueueObj->Name eq 'Incidents') {
-%       $count++;
-%       $parentvalue = $parentvalue." ".$incident->Id;
-%     }
+%   my $query = "Queue = 'Incidents' AND HasMember = " . $TicketObj->Id;
+%   my $incidents = new RT::Tickets($session{'CurrentUser'});
+%   $incidents->FromSQL($query);
+%   while (my $incident = $incidents->Next) {
+%     $parentvalue = $parentvalue." ".$incident->Id;
 %   }
 % }
 % if (defined $parentvalue) {

Modified: rtir/branches/1.1-TESTING/html/RTIR/Elements/IncidentSummary
==============================================================================
--- rtir/branches/1.1-TESTING/html/RTIR/Elements/IncidentSummary	(original)
+++ rtir/branches/1.1-TESTING/html/RTIR/Elements/IncidentSummary	Wed Sep 29 04:30:16 \
2004 @@ -75,13 +75,14 @@
   if ($Ticket->QueueObj->Name eq "Incidents") {
     $incidents->{$Ticket->Id} = { Ticket => $Ticket };
   } elsif ($Ticket->QueueObj->Name eq "Incident Reports") {
-    my $parents = $Ticket->MemberOf;
-    while (my $link = $parents->Next) {
-      my $parent = $link->TargetObj;
-      if ($parent->QueueObj->Name eq 'Incidents') {
-        $incidents->{$parent->Id} = { Ticket => $parent };
+      my $query = "Queue = 'Incidents' AND HasMember = " . $Ticket->Id;
+      my $parents = new RT::Tickets($session{'CurrentUser'});
+      $parents->FromSQL($query);
+      while (my $parent = $parents->Next) {
+	  if ($parent->QueueObj->Name eq 'Incidents') {
+	      $incidents->{$parent->Id} = { Ticket => $parent };
+	  }
       }
-    }
   }
 }
 

Modified: rtir/branches/1.1-TESTING/html/RTIR/Elements/ShowIncidents
==============================================================================
--- rtir/branches/1.1-TESTING/html/RTIR/Elements/ShowIncidents	(original)
+++ rtir/branches/1.1-TESTING/html/RTIR/Elements/ShowIncidents	Wed Sep 29 04:30:16 \
2004 @@ -22,9 +22,7 @@
 %# 
 %# 
 %# END LICENSE BLOCK
-% while (my $link = $incidents->Next) {
-% my $incident = $link->TargetObj;
-% if ($incident->QueueObj->Name eq 'Incidents') {
+%  while (my $incident = $incidents->Next) {
 %   $count++;
 % my $State = $m->scomp("/RTIR/Elements/ShowRTIRField", Ticket => $incident, Name => \
'State');  <a href="<%$RT::WebPath%>/RTIR/Display.html?id=<%$incident->Id%>"><%$incident->Id%>: \
<%$incident->Subject%></a> <i>(<%$State%>)</i> @@ -32,7 +30,6 @@
 <& /RTIR/Elements/ShowIncidents, Ticket => $incident, depth => ($depth+1) &> 
 % }
 % }
-% }
 % if ($depth == 1 and $count == 0) {
 <i>(no Incidents)</i>
 % }
@@ -47,7 +44,10 @@
 <%INIT>
 
 my $count = 0;
-my $incidents = $Ticket->MemberOf;
+
+my $query = "Queue = 'Incidents' AND HasMember = " . $Ticket->Id;
+my $incidents = new RT::Tickets($session{'CurrentUser'});
+$incidents->FromSQL($query);
 
 </%INIT>
 

Modified: rtir/branches/1.1-TESTING/html/RTIR/Incident/Display.html
==============================================================================
--- rtir/branches/1.1-TESTING/html/RTIR/Incident/Display.html	(original)
+++ rtir/branches/1.1-TESTING/html/RTIR/Incident/Display.html	Wed Sep 29 04:30:16 \
2004 @@ -229,14 +229,14 @@
   # Blocks can have multiple incidents
   my $unlinked;
   if ($Type ne 'Block') {
-    while (my $link = $Ticket->MemberOf->Next) {
-      my $member = $link->TargetObj;
-      if ($member->QueueObj->Name eq "Incidents") {
-        $RT::Logger->debug ("Deleting: ".$link->Target."\n");
-        $ARGS{'DeleteLink--'.$link->Type.'-'.$link->Target} = '';
-        $unlinked->{$link->Target} = $link->TargetObj;
+      my $query = "Queue = 'Incidents' AND HasMember = " . $Ticket->Id;
+      my $incidents = new RT::Tickets($session{'CurrentUser'});
+      $incidents->FromSQL($query);
+      while (my $member = $incidents->Next) {
+	  $RT::Logger->debug ("Deleting: ".$member->Id."\n");
+	  $ARGS{'DeleteLink--MemberOf-'.$member->Id} = '';
+	  $unlinked->{$member->Id} = $member;
       }
-    }
   }
 
  # If we don't own the thing we're linking to, change the owner

Modified: rtir/branches/1.1-TESTING/html/RTIR/Reporting/Report.html
==============================================================================
--- rtir/branches/1.1-TESTING/html/RTIR/Reporting/Report.html	(original)
+++ rtir/branches/1.1-TESTING/html/RTIR/Reporting/Report.html	Wed Sep 29 04:30:16 \
2004 @@ -272,16 +272,20 @@
   my $field = shift;
 
   # find the parent incident
-  my $incidents = $t->MemberOf;
+  my $query = "Queue = 'Incidents' AND HasMember = " . $t->Id;
+
+  my $incidents = new RT::Tickets($session{'CurrentUser'});
+  $incidents->FromSQL($query);
+
   my $parent;
   $incidents->GotoFirstItem();
-  while (my $link = $incidents->Next) {
-    my $incident = $link->TargetObj;
+  while (my $incident = $incidents->Next) {
     if ($incident->QueueObj->Name eq 'Incidents') {
       $parent = $incident;
       last;
     }
   }
+
   if ( $parent ) {
       return $parent->FirstCustomFieldValue($field);
   } else {

Modified: rtir/branches/1.1-TESTING/html/RTIR/Split.html
==============================================================================
--- rtir/branches/1.1-TESTING/html/RTIR/Split.html	(original)
+++ rtir/branches/1.1-TESTING/html/RTIR/Split.html	Wed Sep 29 04:30:16 2004
@@ -26,7 +26,7 @@
     Split => 1,
     Incident => $Incident,
     QuoteTransaction => $QuoteTransaction,
-    Queue => $Queue,
+    Queue => $TicketObj->QueueObj->Name,
     Subject => $TicketObj->Subject,
     Requestors => $TicketObj->RequestorAddresses,
     Cc => $TicketObj->CcAddresses,
@@ -44,31 +44,15 @@
 
 my $Incident;
 if ($Type ne 'Incident') {
-  my $incidents = $TicketObj->MemberOf;
-  while (my $link = $incidents->Next) {
-    my $inc = $link->TargetObj;
-    if ($inc->QueueObj->Name eq 'Incidents') {
-      $Incident = $inc->Id;
-    }
-  }
+    my $query = "Queue = 'Incidents' AND HasMember = " . $TicketObj->Id;
+    my $incidents = new RT::Tickets($session{'CurrentUser'});
+    $incidents->FromSQL($query);
+    $Incident = $incidents->First->Id;
 } else {
-  $m->comp("/RTIR/Incident/Split.html", %ARGS);
-  $m->abort;
+    $m->comp("/RTIR/Incident/Split.html", %ARGS);
+    $m->abort;
 }
 
-
-my $Queue;
-if ($Type eq "Incident") {
-  $Queue = "Incidents";
-} elsif ($Type eq "Report") {
-  $Queue = "Incident Reports";
-} elsif ($Type eq "Investigation") {
-  $Queue = "Investigations";
-} elsif ($Type eq "Block") {
-  $Queue = "Blocks";
-}
-
-
 </%INIT>
 <%ARGS>
 $MemberOf => undef

Modified: rtir/branches/1.1-TESTING/html/RTIR/Update.html
==============================================================================
--- rtir/branches/1.1-TESTING/html/RTIR/Update.html	(original)
+++ rtir/branches/1.1-TESTING/html/RTIR/Update.html	Wed Sep 29 04:30:16 2004
@@ -36,11 +36,11 @@
 <input type="hidden" name="Action" value="<% $ARGS{Action} %>">
 <input type="hidden" name="Type" value="<% $ARGS{Type} %>">
 % if ($Type eq 'Report' and $ARGS{'DefaultStatus'} eq 'rejected') {
-%   while (my $link = $Ticket->MemberOf->Next) {
-%     my $member = $link->TargetObj;
-%     if ($member->QueueObj->Name eq 'Incidents') {
-<input type="hidden" name="DeleteLink--<%$link->Type%>-<%$link->Target%>">
-%     }
+%   my $query = "Queue = 'Incidents' AND HasMember = " . $Ticket->Id;
+%   my $incidents = new RT::Tickets($session{'CurrentUser'});
+%   $incidents->FromSQL($query);
+%   while (my $member = $incidents->Next) {
+<input type="hidden" name="DeleteLink--MemberOf-<%$member->Id%>">
 %   }
 % }     
 <font size=-1>

Modified: rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_ChangeParentOwnership.pm
==============================================================================
--- rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_ChangeParentOwnership.pm	(original)
+++ rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_ChangeParentOwnership.pm	Wed Sep 29 \
04:30:16 2004 @@ -76,10 +76,12 @@
     my $self = shift;
 
     # change owner of parent Incident(s)
-    while (my $link = $self->TicketObj->MemberOf->Next) {
-	my $incident= $link->TargetObj;
-	if ( $incident->QueueObj->Name eq 'Incidents' &&
-	     $incident->OwnerObj->id != $self->TransactionObj->NewValue) {
+    my $query = "Queue = 'Incidents' AND MemberOf = " . $self->TicketObj->Id;
+
+    my $parents = new RT::Tickets($self->TransactionObj->CurrentUser);
+    $parents->FromSQL($query);
+    while (my $Incident = $parents->Next) {
+	if ( $incident->OwnerObj->id != $self->TransactionObj->NewValue) {
 	    my ($res, $msg); 
 	    my $user = new RT::CurrentUser($self->TransactionObj->CurrentUser);
 	    $user->Load($self->TransactionObj->Creator);

Modified: rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_OpenParent.pm
==============================================================================
--- rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_OpenParent.pm	(original)
+++ rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_OpenParent.pm	Wed Sep 29 04:30:16 \
2004 @@ -78,14 +78,14 @@
     # If the child becomes not-closed, make sure the Incident is re-opened
     if ($self->TransactionObj->NewValue ne 'rejected' &&
 	$self->TransactionObj->NewValue ne 'resolved') {
-	my $parents = $self->TicketObj->MemberOf;
-	while (my $link = $parents->Next) {
-	    my $member = $link->TargetObj;
-	    if ($member->QueueObj->Name eq 'Incidents') {
-		if ($member->Status eq 'rejected' ||
-		    $member->Status eq 'resolved') {
-		    $member->Open();
-		}
+	my $query = "Queue = 'Incidents' AND MemberOf = " . $self->TicketObj->Id;
+
+	my $parents = new RT::Tickets($self->TransactionObj->CurrentUser);
+	$parents->FromSQL($query);
+	while (my $member = $parents->Next) {
+	    if ($member->Status eq 'rejected' ||
+		$member->Status eq 'resolved') {
+		$member->Open();
 	    }
 	}
     }

Modified: rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_ResolveChildren.pm
==============================================================================
--- rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_ResolveChildren.pm	(original)
+++ rtir/branches/1.1-TESTING/lib/RT/Action/RTIR_ResolveChildren.pm	Wed Sep 29 \
04:30:16 2004 @@ -44,7 +44,7 @@
 # 
 # }}} END BPS TAGGED BLOCK
 #
-package RT::Action::RTIR_SetResolveChildren;
+package RT::Action::RTIR_ResolveChildren;
 require RT::Action::Generic;
 
 use strict;
@@ -85,7 +85,6 @@
     my $members = new RT::Tickets($self->TransactionObj->CurrentUser);
     $members->FromSQL($query);
 
-    my $members = $self->TicketObj->Members;
     while (my $member = $members->Next) {
 	$member->Resolve();
     }
@@ -94,9 +93,9 @@
 
 # }}}
 
-eval "require RT::Action::RTIR_SetResolveChildren_Vendor";
-die $@ if ($@ && $@ !~ qr{^Can't locate \
                RT/Action/RTIR_SetResolveChildren_Vendor.pm});
-eval "require RT::Action::RTIR_SetResolveChildren_Local";
-die $@ if ($@ && $@ !~ qr{^Can't locate \
RT/Action/RTIR_SetResolveChildren_Local.pm}); +eval "require \
RT::Action::RTIR_ResolveChildren_Vendor"; +die $@ if ($@ && $@ !~ qr{^Can't locate \
RT/Action/RTIR_ResolveChildren_Vendor.pm}); +eval "require \
RT::Action::RTIR_ResolveChildren_Local"; +die $@ if ($@ && $@ !~ qr{^Can't locate \
RT/Action/RTIR_ResolveChildren_Local.pm});  
 1;
_______________________________________________
Rt-commit mailing list
Rt-commit@lists.bestpractical.com
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic