[Rt-commit] r4818 - in rtir/branches/1.9-EXPERIMENTAL: html/RTIR/Elements lib/RT/Action

ruz at bestpractical.com ruz at bestpractical.com
Fri Mar 24 09:04:39 EST 2006


Author: ruz
Date: Fri Mar 24 09:04:38 2006
New Revision: 4818

Modified:
   rtir/branches/1.9-EXPERIMENTAL/   (props changed)
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/QueueTabs
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ShowIncidents
   rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetIncidentReportState.pm

Log:
 r1007 at cubic-pc:  cubic | 2006-03-24 17:00:09 +0300
 * when take active ticket open it
 * show [Steal] action on the IRs', Blocks' and Invs' pages.


Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/QueueTabs
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/QueueTabs	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/QueueTabs	Fri Mar 24 09:04:38 2006
@@ -216,10 +216,17 @@
 
     if ( $can{'OwnTicket'} ) {
         if ( $Ticket->Owner == $RT::Nobody->id ) {
-            $actions->{'D'} = {
-                path  => "RTIR/Display.html?Action=Take&id=$id",
-                title => loc('Take')
-            };
+            if ( $Ticket->QueueObj->IsActiveStatus( $Ticket->Status ) ) {
+                $actions->{'D'} = {
+                    path  => "RTIR/Display.html?Action=Take&id=$id&Status=open",
+                    title => loc('Take')
+                };
+            } else {
+                $actions->{'D'} = {
+                    path  => "RTIR/Display.html?Action=Take&id=$id",
+                    title => loc('Take')
+                };
+            }
         } elsif ( $Ticket->Owner != $session{CurrentUser}->id ) {
             $actions->{'E'} = {
                 path  => "RTIR/Display.html?Action=Steal&id=$id",

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ShowIncidents
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ShowIncidents	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ShowIncidents	Fri Mar 24 09:04:38 2006
@@ -34,11 +34,16 @@
 % }
 
 % if ($depth == 1) {
-%   if ($Ticket->Owner == $session{'CurrentUser'}->id) {
+%   if ( $Ticket->Owner == $session{'CurrentUser'}->id ) {
 <b><a href="<%RT->Config->Get('WebPath')%>/RTIR/Incident/LinkToIncident.html?id=<% $Ticket->Id %>">[Link]</a></b>
 <b><a href="<%RT->Config->Get('WebPath')%>/RTIR/Create.html?Child=<% $Ticket->Id %>&Queue=Incidents">[New]</a></b>
 %   } else {
-<a href="<% RT->Config->Get('WebPath') %>/RTIR/Display.html?Action=Take&id=<% $Ticket->Id %>">[<% loc('Take') %>]</a>
+%       my $Action = $Ticket->Owner == $RT::Nobody->Id? 'Take' : 'Steal';
+%       if ( $Ticket->QueueObj->IsActiveStatus( $Ticket->Status ) ) {
+<a href="<% RT->Config->Get('WebPath') %>/RTIR/Display.html?Action=<% $Action %>&id=<% $Ticket->Id %>&Status=open">[<% loc( $Action ) %>]</a>
+%       } else {
+<a href="<% RT->Config->Get('WebPath') %>/RTIR/Display.html?Action=<% $Action %>&id=<% $Ticket->Id %>">[<% loc( $Action ) %>]</a>
+%       }
 %   }
 % }
 

Modified: rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetIncidentReportState.pm
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetIncidentReportState.pm	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/lib/RT/Action/RTIR_SetIncidentReportState.pm	Fri Mar 24 09:04:38 2006
@@ -58,23 +58,23 @@
 sub GetState {
     my $self = shift;
 
-    my $state;
     my $status = $self->TicketObj->Status;
+    return $status if $status eq 'resolved' || $status eq 'rejected';
+
     if ( $status =~ /^(?:new|open|stalled)$/ ) {
-        $state = 'new';
+        # TODO: check how do we set (control) Status of the IR
+        # may be we don't need to check this conditions and
+        # just use status value as in other RTIR_Set*State actions
+        return 'open' if $self->TicketObj->Owner != $RT::Nobody->Id;
 
         my $parents = RT::Tickets->new( $self->TransactionObj->CurrentUser );
         $parents->LimitHasMember( $self->TicketObj->id );
         $parents->LimitQueue( VALUE => 'Incidents' );
-        if ( $parents->Count ) {
-            $state = 'open';
-        }
-    } elsif ( $status eq 'resolved' ) {
-        $state = 'resolved';
-    } elsif ( $status eq 'rejected' ) {
-        $state = 'rejected';
+        return 'open' if $parents->Count;
+        return 'new';
     }
-    return $state || '';
+
+    return '';
 }
 
 eval "require RT::Action::RTIR_SetIncidentReportState_Vendor";


More information about the Rt-commit mailing list