[Rt-commit] r8405 - in rtir/branches/2.3-EXPERIMENTAL: . html/RTIR

thayes at bestpractical.com thayes at bestpractical.com
Mon Aug 6 12:42:27 EDT 2007


Author: thayes
Date: Mon Aug  6 12:42:26 2007
New Revision: 8405

Modified:
   rtir/branches/2.3-EXPERIMENTAL/   (props changed)
   rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Display.html
   rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Create.html
   rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/LinkToIncident.html

Log:
 r8602 at toth:  toth | 2007-08-06 12:42:10 -0400
 * Made Creation of an Incident linked to an IR place an auto lock instead of a Take lock
 * Added check to make sure that an IR is unlinked before adding a Take lock
 


Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Display.html
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Display.html	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Display.html	Mon Aug  6 12:42:26 2007
@@ -248,11 +248,11 @@
         push @results, $msg;
         # If they succeeded in taking the ticket, they should also get a lock
         if ($status && $action =~  /^(?:Take|Steal)$/) {
-        	if($Type eq 'Report') {
-        		$Ticket->Lock('Take');
-        		$Unlock = 0;
-        		push @results, 'You have a lock on this report until you link it to an incident';
-        	}
+            if($Type eq 'Report' && !RT::IR::Ticket::IsLinkedToActiveIncidents($Ticket)) {
+                $Ticket->Lock('Take');
+                $Unlock = 0;
+                push @results, 'You have a lock on this report until you link it to an incident';
+            }
         }
     }
 
@@ -280,7 +280,7 @@
                 push @results, loc('This ticket was not locked');
             } elsif ( $lock->Content->{'User'} == $session{'CurrentUser'}->id ) {
                 $Duration = time() - $lock->Content->{'Timestamp'};
-				$Ticket->Unlock('Hard');
+                $Ticket->Unlock('Hard');
                 push @results, loc('You have unlocked this ticket');
             } else {
                 push @results,

Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Create.html
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Create.html	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Create.html	Mon Aug  6 12:42:26 2007
@@ -204,18 +204,14 @@
 
 # if there isn't a subject, but there is a child, use that one
 my $ChildObj;
-my $Duration;
 my $Id;
 if ( $Child ) {
     $ChildObj = LoadTicket( $Child );
     $Child = $ARGS{'Child'} = $ChildObj->id;
     $ARGS{'Subject'} ||= $ChildObj->Subject;
-    if($ARGS{'CreateIncident'} || $ARGS{'CreateWithInvestigation'}) {
-        my $lock = $ChildObj->Unlock('Take');
-        $Duration = time() - $lock->Content->{'Timestamp'} if $lock;
-    }
-    else 
-    {
+    # We don't want to bother even trying to lock if the form has been submitted
+    # (it will have been locked upon first rendering of the creation page)
+    unless($ARGS{'CreateIncident'} || $ARGS{'CreateWithInvestigation'}) {
         $ChildObj->Lock();
     }
     $Id = $ARGS{'Child'};
@@ -292,6 +288,9 @@
     }
     if( $inc_obj ) {
         $Id = $ChildObj->id if $ChildObj;
+        my $lock = $ChildObj->Unlock('Take');
+        my $Duration
+        $Duration = time() - $lock->Content->{'Timestamp'} if $lock;
         return $m->comp('Display.html', id => $inc_obj->id, Duration => $Duration, Id => $Id, results => \@results );
     }
 }

Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/LinkToIncident.html
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/LinkToIncident.html	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/LinkToIncident.html	Mon Aug  6 12:42:26 2007
@@ -67,7 +67,7 @@
 
 <%INIT>
 my $ChildObj = LoadTicket($id);
-$ChildObj->Lock('Take');
+$ChildObj->Lock();
 $ARGS{'id'} = $id = $ChildObj->id;
 
 my $Type = RT::IR::TicketType( Ticket => $ChildObj );


More information about the Rt-commit mailing list