[Rt-commit] r8390 - in rtir/branches/2.3-EXPERIMENTAL: . html/RTIR
thayes at bestpractical.com
thayes at bestpractical.com
Fri Aug 3 15:19:37 EDT 2007
Author: thayes
Date: Fri Aug 3 15:19:36 2007
New Revision: 8390
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
rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Merge.html
Log:
r8578 at toth: toth | 2007-08-03 15:19:15 -0400
* Tidied up locking for RTIR
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 3 15:19:36 2007
@@ -47,7 +47,7 @@
&>
% }
-<& /Elements/ShowLock, Ticket => $TicketObj, Unlock => 0, Id => $ARGS{'Ticket'} &>
+<& /Elements/ShowLock, Ticket => $TicketObj, Unlock => 0, Id => $Id &>
<& /Elements/ListActions, actions => \@results &>
% if ( $Split && !$TicketObj->CurrentUserHasRight('ModifyTicket') ) {
@@ -328,6 +328,8 @@
my $QueueObj = new RT::Queue( $session{'CurrentUser'} );
$QueueObj->Load( $Queue ) || Abort( loc("Queue could not be loaded.") );
+my $Id;
+
my $Type = RT::IR::TicketType( Queue => $Queue );
if ($Type eq 'Block' && RT->Config->Get('RTIR_DisableBlocksQueue') ) {
Abort(loc("Blocks queue is disabled via config file"));
@@ -410,8 +412,13 @@
unless ( $checks_failure ) {
$ARGS{'new-MemberOf'} = $parentvalue if $parentvalue;
- $TicketObj->Unlock() if $TicketObj;
- return $m->comp( 'Display.html', %ARGS, SkipNotification => \@SkipNotification, results => \@results );
+ my $Duration;
+ if($TicketObj) {
+ my $lock = $TicketObj->Unlock();
+ $Duration = time() - $lock->Content->{'Timestamp'} if $lock;
+ $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 3 15:19:36 2007
@@ -31,7 +31,7 @@
Title => $Title &>
% $Duration ||= $ARGS{'Duration'};
-<& /Elements/ShowLock, Ticket => $Ticket, Duration => $Duration, Id => $ARGS{'Id'} &>
+<& /Elements/ShowLock, Ticket => $Ticket, Duration => $Duration, Id => $ARGS{'Id'}, Unlock => $Unlock &>
<& /Elements/ListActions, actions => \@results &>
<table border="0" cellpadding="0" cellspacing="2" width="100%">
<tr>
@@ -210,6 +210,7 @@
my ($name);
my $Ticket = new RT::Ticket( $session{'CurrentUser'} );
my $Duration;
+my $Unlock = 1;
my $QueueObj;
unless ( $id eq 'new' ) {
@@ -248,7 +249,8 @@
# If they succeeded in taking the ticket, they should also get a lock
if ($status && $action =~ /^(?:Take|Steal)$/) {
if($Type eq 'Report') {
- $Ticket->Lock('IR');
+ $Ticket->Lock('Take');
+ $Unlock = 0;
push @results, 'You have a lock on this report until you link it to an incident';
}
}
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 3 15:19:36 2007
@@ -221,7 +221,11 @@
$Id = $ARGS{'Child'};
}
-$Id = $ARGS{'Ticket'} if $Split;
+if($Split && ($ARGS{'CreateIncident'} || $ARGS {'CreateWithInvestigation'})) {
+ $Id = $ARGS{'Ticket'};
+ my $lock = $TicketObj->Unlock();
+ $Duration = time() - $lock->Content->{'Timestamp'} if $lock;
+}
my $QueueObj = RT::Queue->new( $session{'CurrentUser'} );
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 3 15:19:36 2007
@@ -30,7 +30,8 @@
Title => loc("Incident #[_1]: [_2]", $id, $TicketObj->Subject) &>
% $Duration ||= $ARGS{'Duration'};
-<& /Elements/ShowLock, Ticket => $TicketObj, Duration => $Duration, Id => $ARGS{'Id'} &>
+% my $Id = $ARGS{'Id'} || $ARGS{'Child'};
+<& /Elements/ShowLock, Ticket => $TicketObj, Duration => $Duration, Id => $Id &>
<& /Elements/ListActions, actions => \@results &>
<table border="0" cellpadding="0" cellspacing="2" width="100%"><tr><td valign="top" width="50%">
@@ -244,6 +245,8 @@
ForwardPath => RT->Config->Get('WebPath') ."/RTIR/Forward.html",
&>
<%INIT>
+my $Duration;
+
if ($SelectedTicket) {
$id = $SelectedTicket;
$ARGS{'Status'} = "open";
@@ -253,7 +256,8 @@
if($Child) {
my $ChildObj = RT::Ticket->new( $session{'CurrentUser'} );
$ChildObj->Load($Child);
- $ChildObj->Unlock('Take');
+ my $lock =$ChildObj->Unlock('Take');
+ $Duration = time() - $lock->Content->{'Timestamp'} if $lock;
}
@@ -267,7 +271,6 @@
return $msg || ();
};
-my $Duration;
my $deleted_links = 0;
my $DoLinks = sub {
my ($child, $parent) = @_;
Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Merge.html
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Merge.html (original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Merge.html Fri Aug 3 15:19:36 2007
@@ -67,14 +67,19 @@
<%INIT>
my $Ticket = LoadTicket($id);
-$Ticket->Lock() unless $Ticket->Locked();
+$Ticket->Lock();
$id = $ARGS{'id'} = $Ticket->id;
my (@results);
if ( $SelectedTicket ) {
- $Ticket->Unlock();
-
- my $MergeTicket = LoadTicket( $SelectedTicket );
+ my $MergeTicket = LoadTicket( $SelectedTicket );
+
+ if(my $lock = $Ticket->Locked()) {
+ my $lockType = $lock->Content->{'Type'};
+ $MergeTicket->Lock($lockType);
+ $Ticket->Unlock('Hard'); #We don't need any locks on the merged-from ticket, since it's now the merge-to ticket
+ $MergeTicket->Unlock(); #Remove if it's an auto lock
+ }
my @queues = sort map {$_->Name} $Ticket->QueueObj, $MergeTicket->QueueObj;
if ( $queues[0] eq $queues[1] or ($queues[0] eq "Incident Reports" and $queues[1] eq "Investigations")) {
More information about the Rt-commit
mailing list