[Rt-commit] r5667 - in rtir/branches/2.1-EXPERIMENTAL: . html/RTIR/Elements html/RTIR/Incident html/RTIR/Incident/Elements lib/RT/Action

ruz at bestpractical.com ruz at bestpractical.com
Thu Jul 27 20:16:43 EDT 2006


Author: ruz
Date: Thu Jul 27 20:16:40 2006
New Revision: 5667

Modified:
   rtir/branches/2.1-EXPERIMENTAL/   (props changed)
   rtir/branches/2.1-EXPERIMENTAL/META.yml
   rtir/branches/2.1-EXPERIMENTAL/Makefile.PL
   rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Advanced.html
   rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Display.html
   rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Edit.html
   rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Elements/NewReports
   rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Incident/Display.html
   rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Incident/Edit.html
   rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Incident/Elements/ReplyForm
   rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Incident/ShowChildren.html
   rtir/branches/2.1-EXPERIMENTAL/lib/RT/Action/RTIR_SetIncidentResolution.pm
   rtir/branches/2.1-EXPERIMENTAL/releng.cnf

Log:
RTIR 2.0 -> 2.1 merge

 r1532 at cubic-pc (orig r5473):  ruz | 2006-06-27 21:46:46 +0400
 * merge latests changes from 1.9 branch
 
  r1466 at cubic-pc (orig r5362):  ruz | 2006-06-15 02:51:36 +0400
   r1461 at cubic-pc:  cubic | 2006-06-15 01:16:24 +0400
   * add resolution CF to edit page
  
  r1467 at cubic-pc (orig r5363):  ruz | 2006-06-15 02:51:47 +0400
   r1462 at cubic-pc:  cubic | 2006-06-15 02:31:48 +0400
   * drop resolution on re-open
  
  r1468 at cubic-pc (orig r5364):  ruz | 2006-06-15 02:51:57 +0400
   r1463 at cubic-pc:  cubic | 2006-06-15 02:32:13 +0400
   * allow edit resolution on any reply
  
  r1470 at cubic-pc (orig r5365):  ruz | 2006-06-15 03:10:43 +0400
   r1469 at cubic-pc:  cubic | 2006-06-15 03:19:03 +0400
   * don't allow to edit status from advanced page
  
  r1529 at cubic-pc (orig r5396):  ruz | 2006-06-16 20:49:29 +0400
  
  r1531 at cubic-pc (orig r5467):  ruz | 2006-06-26 18:10:59 +0400
   r1530 at cubic-pc:  cubic | 2006-06-26 18:18:01 +0400
   * use StrictLinkACL config option to get rid of taking or stealling
     tickets before linking
  
 
 r1533 at cubic-pc (orig r5475):  ruz | 2006-06-27 23:08:11 +0400
 * add check for RT version
 * update RTIR version


Modified: rtir/branches/2.1-EXPERIMENTAL/META.yml
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/META.yml	(original)
+++ rtir/branches/2.1-EXPERIMENTAL/META.yml	Thu Jul 27 20:16:40 2006
@@ -16,4 +16,4 @@
   DBIx::SearchBuilder: 1.4
   Net::Whois::RIPE: 0
   RT::FM: 0
-version: 1.9.HEAD
+version: 2.0.0

Modified: rtir/branches/2.1-EXPERIMENTAL/Makefile.PL
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/Makefile.PL	(original)
+++ rtir/branches/2.1-EXPERIMENTAL/Makefile.PL	Thu Jul 27 20:16:40 2006
@@ -3,7 +3,14 @@
 RTx('RT-IR');
 license('GPL Version 2');
 author('Best Practical Solutions <sales at bestpractical.com>');
-version('1.9.HEAD');
+version('2.0.0');
+
+{ # check RT version
+    my @v = split /\./, "$RT::VERSION";
+    unless ($v[0]>=3 && $v[1]>=7) {
+        die "RTIR 2.0 needs RT 3.7.0 at least, you have $RT::VERSION";
+    }
+}
 
 # XXX: This should be reported by M::I::RTx
 my ($lib_path) = $INC{'RT.pm'} =~ /^(.*)[\\\/]/;

Modified: rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Advanced.html
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Advanced.html	(original)
+++ rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Advanced.html	Thu Jul 27 20:16:40 2006
@@ -12,7 +12,47 @@
 <input type="hidden" name="id" value="<% $Ticket->Id %>" />
 
 <&| /Widgets/TitleBox, title => loc('Edit basics') &>
-<& /Ticket/Elements/EditBasics, TicketObj => $Ticket &>
+<table>
+  <tr>
+    <td class="label"><&|/l&>Subject</&>:</td>
+    <td class="value"><input name="Subject" value="<% $Ticket->Subject %>" size="50" /></td>
+  </tr>
+  <tr>
+    <td class="label"><&|/l&>Queue</&>:</td>
+    <td class="value"><& /Elements/SelectQueue, Name => 'Queue', Default => $Ticket->Queue &></td>
+  </tr>
+
+  <tr>
+    <td class="label"><&|/l&>Time Estimated</&>:</td>
+    <td class="value">
+      <input name="TimeEstimated" value="<% $Ticket->TimeEstimated %>" size="5" />
+      <& /Elements/SelectTimeUnits, Name =>'TimeEstimated' &>
+    </td>
+  </tr>
+  <tr>
+    <td class="label"><&|/l&>Time Worked</&>:</td>
+    <td class="value">
+      <input name="TimeWorked" value="<% $Ticket->TimeWorked %>" size="5" />
+      <& /Elements/SelectTimeUnits, Name =>'TimeWorked' &>
+    </td>
+  </tr>
+  <tr>
+    <td class="label"><&|/l&>Time Left</&>:</td>
+    <td class="value">
+      <input name="TimeLeft" value="<% $Ticket->TimeLeft %>" size="5" />
+      <& /Elements/SelectTimeUnits, Name =>'TimeLeft' &>
+    </td>
+  </tr>
+
+  <tr>
+    <td class="label"><&|/l&>Priority</&>:</td>
+    <td class="value"><input name="Priority" value="<% $Ticket->Priority %>" size="5" /></td>
+  </tr>
+  <tr>
+    <td class="label"><&|/l&>Final Priority</&>:</td>
+    <td class="value"><input name="FinalPriority" value="<% $Ticket->FinalPriority %>" size="5" /></td>
+  </tr>
+</table>
 </&>
 
 <&| /Widgets/TitleBox, title => loc('Edit Links') &>

Modified: rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Display.html
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Display.html	(original)
+++ rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Display.html	Thu Jul 27 20:16:40 2006
@@ -251,7 +251,11 @@
     $ARGS{UpdateAttachments} = delete $session{'Attachments'};
     push @results, ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef => \%ARGS );
     push @results, ProcessTicketBasics(  TicketObj => $Ticket, ARGSRef => \%ARGS );
+
+    my $strict_acl = RT->Config->Set( StrictLinkACL => 0 );
     push @results, ProcessTicketLinks(   TicketObj => $Ticket, ARGSRef => \%ARGS );
+    RT->Config->Set( StrictLinkACL => $strict_acl );
+
     push @results, ProcessTicketDates(   TicketObj => $Ticket, ARGSRef => \%ARGS );
 
     my $newstate = $Ticket->FirstCustomFieldValue('_RTIR_State');

Modified: rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Edit.html
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Edit.html	(original)
+++ rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Edit.html	Thu Jul 27 20:16:40 2006
@@ -236,7 +236,11 @@
 if ( $SaveChanges && !$OnlySearchForPeople ) {
     my $oldstate = RT::IR::Ticket::FirstCustomFieldValue( $Ticket, '_RTIR_State' );
     push @results, ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS );
+
+    my $strict_acl = RT->Config->Set( StrictLinkACL => 0 );
     push @results, ProcessTicketLinks(    TicketObj => $Ticket, ARGSRef => \%ARGS );
+    RT->Config->Set( StrictLinkACL => $strict_acl );
+
     push @results, ProcessTicketDates(    TicketObj => $Ticket, ARGSRef => \%ARGS );
 
     # XXX: edit page has no message box or attachments form

Modified: rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Elements/NewReports
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Elements/NewReports	(original)
+++ rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Elements/NewReports	Thu Jul 27 20:16:40 2006
@@ -22,7 +22,7 @@
 %# 
 %# 
 %# END LICENSE BLOCK
-<& /Widgets/TitleBoxStart, 
+<&| /Widgets/TitleBox, 
 	title_href  => RT->Config->Get('WebPath') ."/RTIR/Search/Results.html?$EscapedQueue\&$QueryString",
 	title_class => 'inverse',
 	title       => $title, 
@@ -43,8 +43,7 @@
 
 <a href="<% RT->Config->Get('WebPath') %>/RTIR/Report/BulkReject.html?<% $EscapedQueue %>&<% $QueryString %>">[<%loc("Bulk Reject")%>]</a>
 
-<& /Widgets/TitleBoxEnd &>
-
+</&>
 
 <%INIT>
 my $title = loc("New unlinked Incident Reports...");

Modified: rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Incident/Display.html
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Incident/Display.html	(original)
+++ rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Incident/Display.html	Thu Jul 27 20:16:40 2006
@@ -236,40 +236,49 @@
 }
 Abort('No incident specified') unless $id;
 
+my $take_or_steal = sub {
+    my $owner = $_[0]->Owner;
+    return () if $owner == $session{'CurrentUser'}->id;
+    my $action = 'Steal';
+    $action = 'Take' if $owner == $RT::Nobody->id;
+    my ($res, $msg) = $_[0]->$action();
+    return $msg || ();
+};
+
 my $deleted_links = 0;
 my $DoLinks = sub {
-    my $TicketObj = shift;
-    my $Target = shift;
+    my ($child, $parent) = @_;
 
     my %args = ();
 
     # Blocks or Incedent Reports can have multiple incidents
-    my ($Type) = $m->comp( "/RTIR/Elements/Type", TicketObj => $TicketObj );
+    my ($Type) = $m->comp( '/RTIR/Elements/Type', TicketObj => $child );
     unless( $Type eq 'Block' || $Type eq 'Report' ) {
-        # XXX: Can we ever get here?
-        my $query = "Queue = 'Incidents' AND HasMember = ". $TicketObj->Id ." AND id != ". $Target->id;
-        my $incidents = new RT::Tickets( $session{'CurrentUser'} );
+        my $query = "Queue = 'Incidents' AND HasMember = ". $child->Id ." AND id != ". $parent->id;
+        my $incidents = RT::Tickets->new( $session{'CurrentUser'} );
         $incidents->FromSQL( $query );
         while ( my $incident = $incidents->Next ) {
             $deleted_links = 1;
-            $args{'DeleteLink-'. $TicketObj->id .'-MemberOf-'. $incident->id } = '';
+            $args{'DeleteLink-'. $child->id .'-MemberOf-'. $incident->id } = '';
         }
     }
 
     my @results;
-    # If we own one end than take or steal other end of the link
-    for my $obj( $Target, $TicketObj ) {
-        next if $obj->Owner == $session{'CurrentUser'}->id;
-        my $action = 'Steal';
-        $action = 'Take' if $obj->Owner == $RT::Nobody->id;
-        my ($res, $msg) = $obj->$action();
-        push @results, $msg;
+
+    # if we don't own any of ends, take or steal parent
+    unless ( $parent->Owner == $session{'CurrentUser'}->id
+             || $child->Owner == $session{'CurrentUser'}->id )
+    {
+        push @results, $take_or_steal->( $parent );
     }
 
-    $args{ $TicketObj->Id .'-MemberOf' } = $Target->Id;
-    push @results, ProcessTicketLinks( TicketObj => $TicketObj, ARGSRef => \%args );
+    # turn off strict check localy
+    my $strict_acl = RT->Config->Set( StrictLinkACL => 0 );
+    $args{ $child->Id .'-MemberOf' } = $parent->Id;
+    push @results, ProcessTicketLinks( TicketObj => $child, ARGSRef => \%args );
+    RT->Config->Set( StrictLinkACL => $strict_acl );
 
-    return map { loc("Ticket [_1]: [_2]", $TicketObj->Id, $_) } @results;
+    return map { loc("Ticket [_1]: [_2]", $child->Id, $_) } @results;
 };
 
 my $TicketObj;

Modified: rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Incident/Edit.html
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Incident/Edit.html	(original)
+++ rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Incident/Edit.html	Thu Jul 27 20:16:40 2006
@@ -112,6 +112,15 @@
 	 Rows => 1 &>
     </td>
   </tr>
+  <tr>
+    <td class="label"><&|/l&>Resolution</&>:</td>
+    <td class="value">
+      <& /RTIR/Elements/EditRTIRField,
+         TicketObj => $Ticket,
+	     Name => 'Resolution',
+	     Rows => 1 &>
+    </td>
+  </tr>
 </table>
 
 <& /Widgets/TitleBoxEnd &>
@@ -154,7 +163,11 @@
     push @results, ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS);
     push @results, ProcessTicketCustomFieldUpdates(ARGSRef => \%ARGS);
     push @results, ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS);
+
+    my $strict_acl = RT->Config->Set( StrictLinkACL => 0 );
     push @results, ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
+    RT->Config->Set( StrictLinkACL => $strict_acl );
+
     $ARGS{UpdateAttachments} = $session{'Attachments'};
    	push @results, ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef=>\%ARGS );
 }

Modified: rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Incident/Elements/ReplyForm
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Incident/Elements/ReplyForm	(original)
+++ rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Incident/Elements/ReplyForm	Thu Jul 27 20:16:40 2006
@@ -15,7 +15,6 @@
 </select>
 </td></tr>
 
-% if ( $Status =~ /^(?:resolved|rejected)$/ ) {
 <tr><td class="label"><&|/l&>Resolution</&>:</td>
 <td class="value">
 <& /RTIR/Elements/EditRTIRField,
@@ -28,7 +27,6 @@
     ),
     Rows      => 1,
 &></td></tr>
-% }
 
 <tr><td class="label"><&|/l&>Owner</&>:</td><td>
 <& /Elements/SelectOwner,

Modified: rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Incident/ShowChildren.html
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Incident/ShowChildren.html	(original)
+++ rtir/branches/2.1-EXPERIMENTAL/html/RTIR/Incident/ShowChildren.html	Thu Jul 27 20:16:40 2006
@@ -63,7 +63,10 @@
 if( $ARGS{'Unlink'} ) {
     # translate the checkbox args to what ProcessTicketLinks expects
     $ARGS{'DeleteLink-'. $_ .'-MemberOf-'} = 1 for @SelectedTickets;
+
+    my $strict_acl = RT->Config->Set( StrictLinkACL => 0 );
     push @results, ProcessTicketLinks( TicketObj => $Incident, ARGSRef => \%ARGS );
+    RT->Config->Set( StrictLinkACL => $strict_acl );
 }
 
 unless ( $Incident->CurrentUserHasRight('ShowTicket') ) {

Modified: rtir/branches/2.1-EXPERIMENTAL/lib/RT/Action/RTIR_SetIncidentResolution.pm
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/lib/RT/Action/RTIR_SetIncidentResolution.pm	(original)
+++ rtir/branches/2.1-EXPERIMENTAL/lib/RT/Action/RTIR_SetIncidentResolution.pm	Thu Jul 27 20:16:40 2006
@@ -21,17 +21,26 @@
     my $self = shift;
 
     my $t = $self->TicketObj;
+    my $cf = RT::CustomField->new( $self->TransactionObj->CurrentUser );
+    $cf->LoadByNameAndQueue( Queue => $t->QueueObj->Id, Name => '_RTIR_Resolution' );
+    return 1 unless $cf->Id;
 
     my $status = $t->Status;
-    return 1 unless $t->QueueObj->IsInactiveStatus( $t->Status );
+    if ( $t->QueueObj->IsActiveStatus( $status ) ) {
+        # on re-open, drop resolution
+        my $txn = $self->TransactionObj; my $type = $txn->Type;
+        return 1 unless $type eq "Status" || ( $type eq "Set" && $txn->Field eq "Status" );
+        return 1 unless $t->QueueObj->IsInactiveStatus( $txn->OldValue );
+        return 1 unless my $value = $t->FirstCustomFieldValue( $cf->id );
+        $t->DeleteCustomFieldValue( Field => $cf->id, Value => $value );
+        return 1;
+    }
+
+    return 1 unless $t->QueueObj->IsInactiveStatus( $status );
 
     my $value = RT->Config->Get("_RTIR_Resolution_${status}_default");
     return 1 unless $value;
 
-    my $cf = RT::CustomField->new( $self->TransactionObj->CurrentUser );
-    $cf->LoadByNameAndQueue( Queue => $t->QueueObj->Id, Name => '_RTIR_Resolution' );
-    return 1 unless $cf->Id;
-
     return 1 if $t->FirstCustomFieldValue( $cf->id );
 
     my ($res, $msg) = $t->AddCustomFieldValue( Field => $cf->id, Value => $value );

Modified: rtir/branches/2.1-EXPERIMENTAL/releng.cnf
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/releng.cnf	(original)
+++ rtir/branches/2.1-EXPERIMENTAL/releng.cnf	Thu Jul 27 20:16:40 2006
@@ -1,7 +1,7 @@
 PRODUCT             = rtir
-TAG                 = 1.1.5
+TAG                 = 2.0.0
 CANONICAL_REPO      = svn+ssh://svn.bestpractical.com/svn/bps-public/rtir/
 TAGS                = tags/
-TRUNK               =  branches/1.1-TESTING
+TRUNK               = branches/2.0-TESTING
 TMP_DIR             = /tmp
 RELEASE_DIR         = /home/ftp/pub/rt/devel


More information about the Rt-commit mailing list