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

thayes at bestpractical.com thayes at bestpractical.com
Fri Aug 10 18:24:29 EDT 2007


Author: thayes
Date: Fri Aug 10 18:24:28 2007
New Revision: 8506

Modified:
   rtir/branches/2.3-EXPERIMENTAL/   (props changed)
   rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Create.html
   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/Display.html

Log:
 r8709 at toth:  toth | 2007-08-10 18:12:11 -0400
 * Changed to accomodate new Unlock method, which returns a tuple of length of the lock (or undef if not unlocked) and a message regarding the success or falure of the unlock operation
 


Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Create.html
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Create.html	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Create.html	Fri Aug 10 18:24:28 2007
@@ -393,7 +393,7 @@
 if ( $IncidentObj ) {
     $parentvalue = $IncidentObj->Id;
 } elsif ( $TicketObj ) {
-    my $incidents = RT::Ticketsi->new( $session{'CurrentUser'} );
+    my $incidents = RT::Tickets->new( $session{'CurrentUser'} );
     $incidents->FromSQL( "Queue = 'Incidents' AND HasMember = " . $TicketObj->Id );
     while ( my $incident = $incidents->Next ) {
         $parentvalue .= ' ' if $parentvalue;
@@ -426,10 +426,9 @@
         $ARGS{'new-MemberOf'} = $parentvalue if $parentvalue;
         my $Duration;
         if($TicketObj) {
-			my $lock = $TicketObj->Unlock();
-			$Duration = time() - $lock->Content->{'Timestamp'} if $lock;
-			$Id = $TicketObj->id;
-		}
+            ($Duration) = $TicketObj->Unlock();
+            $Id = $TicketObj->id;
+        }
         return $m->comp( 'Display.html', %ARGS, SkipNotification => \@SkipNotification, results => \@results, Duration => $Duration, Id => $Id );
     }
     unshift @results, loc("Creation failed:");

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	Fri Aug 10 18:24:28 2007
@@ -275,18 +275,9 @@
 
             }
         } elsif ( $ARGS{'Lock'} eq 'remove' ) {
-            my $lock = $Ticket->Locked();
-            unless($lock) {
-                push @results, loc('This ticket was not locked');
-            } elsif ( $lock->Content->{'User'} == $session{'CurrentUser'}->id ) {
-                $Duration = time() - $lock->Content->{'Timestamp'};
-                $Ticket->Unlock('Hard');
-                push @results, loc('You have unlocked this ticket');
-            } else {
-                push @results,
-                    loc("You can't unlock tickets that you did not lock");
-
-            }
+            my $msg;
+            ($Duration, $msg) = $Ticket->Unlock('Hard');
+            push @results, loc($msg);
 
         } elsif ( $ARGS{'Lock'} eq 'break' ) {
             $Ticket->BreakLock();

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	Fri Aug 10 18:24:28 2007
@@ -220,8 +220,7 @@
 
 if($Split && ($ARGS{'CreateIncident'} || $ARGS {'CreateWithInvestigation'})) {
     $Id = $ARGS{'Ticket'};
-    my $lock = $TicketObj->Unlock();
-    $Duration = time() - $lock->Content->{'Timestamp'} if $lock;
+    ($Duration) = $TicketObj->Unlock();
 }
 
 
@@ -299,8 +298,7 @@
     if( $inc_obj ) {
         if($ChildObj) {
             $Id = $ChildObj->id;
-            my $lock = $ChildObj->Unlock('Take');
-            $Duration = time() - $lock->Content->{'Timestamp'} if $lock;
+            ($Duration) = $ChildObj->Unlock('Take');
         }
         return $m->comp('Display.html', id => $inc_obj->id, Duration => $Duration, Id => $Id, results => \@results );
     }

Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Display.html
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Display.html	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Display.html	Fri Aug 10 18:24:28 2007
@@ -256,8 +256,7 @@
 if( $Child ) {
     my $ChildObj = RT::Ticket->new( $session{'CurrentUser'} );
     $ChildObj->Load($Child);
-    my $lock =$ChildObj->Unlock('Take');
-    $Duration = time() - $lock->Content->{'Timestamp'} if $lock;
+    ($Duration) = $ChildObj->Unlock('Take');
 }
 
 
@@ -358,7 +357,7 @@
                 push @results, loc('This ticket was not locked');
             } elsif ( $lock->Content->{'User'} == $session{'CurrentUser'}->id ) {
                 $Duration = time() - $lock->Content->{'Timestamp'};
-				$TicketObj->Unlock('Hard');
+                $TicketObj->Unlock('Hard');
                 push @results, loc('You have unlocked this ticket');
             } else {
                 push @results,


More information about the Rt-commit mailing list