[Rt-commit] rtir branch, rt-3.9, updated. a719650fa1af9b1909fb379916d76461ae30e10c

? sunnavy sunnavy at bestpractical.com
Thu Oct 14 00:56:42 EDT 2010


The branch, rt-3.9 has been updated
       via  a719650fa1af9b1909fb379916d76461ae30e10c (commit)
       via  a4d0e7c4662d9529096390f425c24c78f4e022c2 (commit)
       via  23125355dffd81d08dbb1f08007e25645ab2fd26 (commit)
       via  6fb17515a7e8039547020c9d3cfa3e7860ac354c (commit)
       via  fb442fc2ce99f72d2c8853e9bfdfc0ef602a4e66 (commit)
       via  51685caf618e3a28f3da8382c8c8e8e5adbdf8ed (commit)
       via  e94fb2d6adf5fd029479ff1cbda3878aa7e3cf71 (commit)
       via  cccc6311bc623383e2d552281db87f584a8db85c (commit)
       via  5bb81c3e9ebb91be048a3d43fafc28a2ce86aa71 (commit)
       via  3e65a198173437afd27a4227ee4065eb9ed3e479 (commit)
      from  84d74119072c554e4bf4c8db04c6b0fa2a0d1f82 (commit)

Summary of changes:
 README                                      |   16 ++-----
 etc/initialdata                             |    5 --
 html/RTIR/Elements/AttachReports            |    2 +-
 html/RTIR/Elements/ChildSummary             |    2 +-
 html/RTIR/Elements/IncidentSummary          |    2 +-
 html/RTIR/Elements/ShowChildren             |    2 +-
 html/RTIR/Incident/Edit.html                |    9 +---
 html/RTIR/Update.html                       |    2 +-
 lib/RT/Action/RTIR_SetBlockState.pm         |   21 ++++++++
 lib/RT/Condition/RTIR_BlockActivation.pm    |   14 +++++-
 lib/RT/Condition/RTIR_RequireStateChange.pm |    2 +-
 lib/RT/IR/Test/Web.pm                       |   71 ---------------------------
 12 files changed, 44 insertions(+), 104 deletions(-)

- Log -----------------------------------------------------------------
commit 3e65a198173437afd27a4227ee4065eb9ed3e479
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Oct 14 10:39:29 2010 +0800

    clean comment

diff --git a/etc/initialdata b/etc/initialdata
index 1eac210..02da995 100644
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -31,11 +31,6 @@
     },
 );
 
-#use Regexp::Common qw(net);
-#use Regexp::Common::net::CIDR();
-#my $ip_pattern = qr{(?#IP/IP-IP/CIDR)^(?:|\s*$RE{net}{IPv4}(?:\s*-\s*$RE{net}{IPv4})?\s*|$RE{net}{CIDR}{IPv4})$};
-
-
 @CustomFields = (
     {
         Name        => 'Constituency',

commit 5bb81c3e9ebb91be048a3d43fafc28a2ce86aa71
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Oct 14 10:47:16 2010 +0800

    no need /TITLE:Status

diff --git a/html/RTIR/Elements/AttachReports b/html/RTIR/Elements/AttachReports
index 5604efc..a04b5b6 100644
--- a/html/RTIR/Elements/AttachReports
+++ b/html/RTIR/Elements/AttachReports
@@ -38,7 +38,7 @@ return unless $siblings->Count;
 my $Format = q{
     '<b><a HREF="__WebPath__/Ticket/Display.html?id=__id__">__id__</a></b>/TITLE:#',
     '<b><a href="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a></b>/TITLE:Subject',
-    '__Status__/TITLE:Status',
+    '__Status__',
     __LastUpdatedRelative__, __CreatedRelative__
 };
 </%INIT>

commit cccc6311bc623383e2d552281db87f584a8db85c
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Oct 14 10:52:30 2010 +0800

    word update

diff --git a/html/RTIR/Elements/ShowChildren b/html/RTIR/Elements/ShowChildren
index 7aa14c3..3796a72 100644
--- a/html/RTIR/Elements/ShowChildren
+++ b/html/RTIR/Elements/ShowChildren
@@ -28,7 +28,7 @@
 %       my $checked = (grep { $_ eq $s } @States)? 'checked': '';
 <input type="checkbox" name="States" value="<% $s %>" <% $checked %> />&nbsp;<% $s %>
 %   }
-<& /Elements/Submit, Name => 'RefineStatus', Label => loc('Filter states') &>
+<& /Elements/Submit, Name => 'RefineStatus', Label => loc('Filter status') &>
 % }
 
 % if ($Delete) {

commit e94fb2d6adf5fd029479ff1cbda3878aa7e3cf71
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Oct 14 10:55:16 2010 +0800

    loc

diff --git a/html/RTIR/Elements/ChildSummary b/html/RTIR/Elements/ChildSummary
index a44f3b1..e4e63a9 100644
--- a/html/RTIR/Elements/ChildSummary
+++ b/html/RTIR/Elements/ChildSummary
@@ -45,7 +45,7 @@
 <tr class="<% $i%2 ? 'oddline' : 'evenline'%>" >
 <td><b><a href="<%RT->Config->Get('WebPath')%>/RTIR/Display.html?id=<%$Ticket->Id%>"><%$Ticket->Id%></a></b></td>
 <td><b><a href="<%RT->Config->Get('WebPath')%>/RTIR/Display.html?id=<%$Ticket->Id%>"><%$Ticket->Subject%></a></b></td>
-<td><%$Ticket->Status%></td>
+<td><% loc( $Ticket->Status ) %></td>
 <td><%$Ticket->Priority%></td>
 % if ($Type eq 'Incident') {
 <td align="right"><a href="<%RT->Config->Get('WebPath')%>/RTIR/Display.html?Child=<%$Ticket->Id%>&id=<%$ticket%>">[<%loc("Link")%>]</a></td>
diff --git a/html/RTIR/Elements/IncidentSummary b/html/RTIR/Elements/IncidentSummary
index ee168de..c1ba4bc 100644
--- a/html/RTIR/Elements/IncidentSummary
+++ b/html/RTIR/Elements/IncidentSummary
@@ -44,7 +44,7 @@
 <tr class="<% $i%2 ? 'oddline' : 'evenline'%>" >
 <td><b><a href="<%RT->Config->Get('WebPath')%>/RTIR/Display.html?id=<%$Ticket->Id%>"><%$Ticket->Id%></a></b></td>
 <td><b><a href="<%RT->Config->Get('WebPath')%>/RTIR/Display.html?id=<%$Ticket->Id%>"><%$Ticket->Subject%></a></b></td>
-<td><%$Ticket->Status%></td>
+<td><% loc($Ticket->Status) %></td>
 </td>
 <td><%$Ticket->Priority%></td>
 <td align="right">
diff --git a/html/RTIR/Update.html b/html/RTIR/Update.html
index 5d069aa..7f0ccd2 100644
--- a/html/RTIR/Update.html
+++ b/html/RTIR/Update.html
@@ -65,7 +65,7 @@
 <table border="0">
 
 <tr><td align="right"><&|/l&>Status</&>:</td>
-<td><% $Ticket->Status %></td></tr>
+<td><% loc($Ticket->Status) %></td></tr>
 <tr><td align="right"><&|/l&>Update Type</&>:</td>
 <td><select name="UpdateType">
 % if ($CanComment) {

commit 51685caf618e3a28f3da8382c8c8e8e5adbdf8ed
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Oct 14 11:14:13 2010 +0800

    comment clean

diff --git a/lib/RT/Condition/RTIR_RequireStateChange.pm b/lib/RT/Condition/RTIR_RequireStateChange.pm
index ab1e46b..1bba907 100644
--- a/lib/RT/Condition/RTIR_RequireStateChange.pm
+++ b/lib/RT/Condition/RTIR_RequireStateChange.pm
@@ -65,7 +65,7 @@ sub IsApplicable {
     my $self = shift;
 
     my $type = $self->TransactionObj->Type;
-    return 1 if $type eq "Create";# or $type eq "CustomField";
+    return 1 if $type eq "Create";
     return 1 if $self->IsStatusChange;
 
     my $field = $self->TransactionObj->Field;

commit fb442fc2ce99f72d2c8853e9bfdfc0ef602a4e66
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Oct 14 12:09:12 2010 +0800

    forgot another situation

diff --git a/lib/RT/Condition/RTIR_BlockActivation.pm b/lib/RT/Condition/RTIR_BlockActivation.pm
index 957cfe6..f413d0f 100644
--- a/lib/RT/Condition/RTIR_BlockActivation.pm
+++ b/lib/RT/Condition/RTIR_BlockActivation.pm
@@ -4,11 +4,10 @@ use strict;
 use warnings;
 
 use base 'RT::Condition::RTIR';
-use RT::CustomField;
 
 =head2 IsApplicable
 
-When state of the block changes from C<pending active> to C<active>
+When state of the block changes from C<pending activation> to C<active>
 or ticket created with C<active> state.
 
 =cut
@@ -20,6 +19,17 @@ sub IsApplicable {
 
     my $type = $txn->Type;
     return 1 if $type eq 'Create' && $self->TicketObj->Status eq 'active';
+    if (
+        (
+            $txn->Type eq 'Status'
+            || ( $txn->Type eq 'Set' && $txn->Field eq 'Status' )
+        )
+        && $self->TicketObj->OldStatus eq 'pending activation'
+        && $self->TicketObj->NewStatus eq 'active'
+      )
+    {
+        return 1;
+    }
 
     return 0;
 }

commit 6fb17515a7e8039547020c9d3cfa3e7860ac354c
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Oct 14 12:14:11 2010 +0800

    show status instead of editing

diff --git a/html/RTIR/Incident/Edit.html b/html/RTIR/Incident/Edit.html
index 066fbe7..c84a7ad 100644
--- a/html/RTIR/Incident/Edit.html
+++ b/html/RTIR/Incident/Edit.html
@@ -49,14 +49,7 @@
 <table>
   <tr>
     <td class="label"><&|/l&>Status</&>:</td>
-    <td>
-      <& /Elements/SelectStatus,
-          Name => 'Status',
-          QueueObj => $Ticket->QueueObj,
-          DefaultValue => 0,
-          Default => $Ticket->Status,
-      &>
-    </td>
+    <td><% loc($Ticket->Status) %></td></tr>
   </tr>
   <tr>
     <td class="label"><&|/l&>Owner</&>:</td>

commit 23125355dffd81d08dbb1f08007e25645ab2fd26
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Oct 14 12:15:15 2010 +0800

    blocks have a complex situation

diff --git a/lib/RT/Action/RTIR_SetBlockState.pm b/lib/RT/Action/RTIR_SetBlockState.pm
index 2b07b3e..5a510cb 100644
--- a/lib/RT/Action/RTIR_SetBlockState.pm
+++ b/lib/RT/Action/RTIR_SetBlockState.pm
@@ -61,8 +61,28 @@ sub GetState {
     my $txn = $self->TransactionObj;
     my $old_status = $t->Status;
 
+    if ( $txn->Type eq 'Correspond' && $txn->IsInbound && $old_status eq 'pending activation' ) {
+        if ( my $re = RT->Config->Get('RTIR_BlockAproveActionRegexp') ) {
+            my $content = $txn->Content;
+            return '' if !$content || $content !~ /$re/;
+        }
+        return 'active';
+    }
+
     return 'active' if $old_status eq 'removed';
 
+    # if block was removed (resolved/rejected) we reactivate it
+    if ( $txn->Creator != $RT::SystemUser->id ) {
+        # if a duty team member changes Status directly then we want to activate
+        if ( ($txn->Type eq 'Status' || ($txn->Type eq 'Set' && $txn->Field eq 'Status')) &&
+                $self->CreatorCurrentUser->PrincipalObj->HasRight(
+                    Right => 'ModifyTicket', Object => $t
+                )
+        ) {
+            return 'active';
+        }
+    }
+
     # next code related to requestor's correspondents
     return '' unless $txn->Type eq 'Correspond';
     return '' unless $t->Requestors->HasMember( $txn->CreatorObj->PrincipalObj );
@@ -76,6 +96,7 @@ sub GetState {
         # switch to active state if it is reply from requestor(s)
         return 'active';
     } elsif ( $old_status eq 'pending removal' ) {
+        # switch to removed state when requestor(s) replies
         return 'removed';
     }
 

commit a4d0e7c4662d9529096390f425c24c78f4e022c2
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Oct 14 12:15:48 2010 +0800

    move general methods to rt

diff --git a/lib/RT/IR/Test/Web.pm b/lib/RT/IR/Test/Web.pm
index 839d827..c5fff42 100644
--- a/lib/RT/IR/Test/Web.pm
+++ b/lib/RT/IR/Test/Web.pm
@@ -91,20 +91,6 @@ sub create_rtir_ticket
     return $self->get_ticket_id;
 }
 
-sub get_ticket_id {
-    my $self = shift;
-    my $content = $self->content;
-    my $id = 0;
-    if ($content =~ /.*Ticket (\d+) created.*/g) {
-        $id = $1;
-    }
-    elsif ($content =~ /.*No permission to view newly created ticket #(\d+).*/g) {
-        Test::More::diag("\nNo permissions to view the ticket.\n") if($ENV{'TEST_VERBOSE'});
-        $id = $1;
-    }
-    return $id;
-}
-
 sub create_incident_for_ir {
     my $self = shift;
     my $ir_id = shift;
@@ -138,43 +124,6 @@ sub create_incident_for_ir {
     return $incident_id;
 }
 
-sub set_custom_field {
-    my $self   = shift;
-    my $queue   = shift;
-    my $cf_name = shift;
-    my $val     = shift;
-    
-    my $field_name = $self->custom_field_input( $queue, $cf_name )
-        or return 0;
-
-    $self->field($field_name, $val);
-    return 1;
-}
-
-sub custom_field_input {
-    my $self   = shift;
-    my $queue   = shift;
-    my $cf_name = shift;
-
-    my $cf_obj = RT::CustomField->new( $RT::SystemUser );
-    $cf_obj->LoadByName( Queue => $queue, Name => $cf_name );
-    unless ( $cf_obj->id ) {
-        Test::More::diag("Can not load custom field '$cf_name' in queue '$queue'");
-        return undef;
-    }
-    my $cf_id = $cf_obj->id;
-    
-    my ($res) =
-        grep /^Object-RT::Ticket-\d*-CustomField-$cf_id-Values?$/,
-        map $_->name,
-        $self->current_form->inputs;
-    unless ( $res ) {
-        Test::More::diag("Can not find input for custom field '$cf_name' #$cf_id");
-        return undef;
-    }
-    return $res;
-}
-
 sub display_ticket {
     my $self = shift;
     my $id = shift;
@@ -182,26 +131,6 @@ sub display_ticket {
     $self->get_ok("/RTIR/Display.html?id=$id", "Loaded Display page for Ticket #$id");
 }
 
-sub ticket_status {
-    my $self = shift;
-    my $id = shift;
-    
-    $self->display_ticket( $id);
-    my ($got) = ($self->content =~ qr{Status:\s*</td>\s*<td[^>]*?class="value"[^>]*?>\s*([\w ]+?)\s*</td>}ism);
-    unless ( $got ) {
-        Test::More::diag("Error: couldn't find status value on the page, may be regexp problem");
-    }
-    return $got;
-}
-
-sub ticket_status_is {
-    my $self = shift;
-    my $id = shift;
-    my $status = shift;
-    my $desc = shift || "Status of the ticket #$id is '$status'";
-    return Test::More::is($self->ticket_status( $id), $status, $desc);
-}
-
 sub ticket_is_linked_to_inc {
     my $self = shift;
     my $id = shift;

commit a719650fa1af9b1909fb379916d76461ae30e10c
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Oct 14 12:16:08 2010 +0800

    open -> new is not needed

diff --git a/README b/README
index c972092..b0694ee 100644
--- a/README
+++ b/README
@@ -128,7 +128,7 @@ Installation instructions:
 
                 # from   => [ to list ],
                 new      => [qw(open resolved rejected)],
-                open     => [qw(new resolved rejected)],
+                open     => [qw(resolved rejected)],
                 resolved => [qw(new open rejected)],
                 rejected => [qw(new open resolved)],
             },
@@ -143,8 +143,6 @@ Installation instructions:
 
                 'resolved -> open' => [ 'Re-open', 'Comment' ],
                 'rejected -> open' => [ 'Re-open', 'Comment' ],
-
-                'open -> new' => [ 'New', 'hide' ],
             },
         },
         investigations => {
@@ -177,11 +175,11 @@ Installation instructions:
                 'pending activation' =>
                   [ 'active', 'pending removal', 'removed' ],
                 active =>
-                  [ 'pending removal', 'removed', 'pending activation' ],
+                  [ 'pending removal', 'removed' ],
                 'pending removal' =>
-                  [ 'pending activation', 'removed', 'active' ],
+                  [ 'removed', 'active' ],
                 removed =>
-                  [ 'pending activation', 'active', 'pending removal' ],
+                  [ 'active', 'pending removal' ],
             },
             rights  => { '* -> *' => 'ModifyTicket', },
             actions => {
@@ -190,20 +188,14 @@ Installation instructions:
                   [ 'Pending to remove', 'Comment' ],
                 'pending activation -> removed' => [ 'Remove', 'Comment' ],
 
-                'active -> pending activation' =>
-                  [ 'Pending to activate', 'Comment' ],
                 'active -> pending removal' =>
                   [ 'Pending to remove', 'Comment' ],
                 'active -> removed' => [ 'Remove', 'Comment' ],
 
                 'pending removal -> removed' => [ 'Remove',   'Comment' ],
                 'pending removal -> active'  => [ 'Activate', 'Comment' ],
-                'pending removal -> pending activation' =>
-                  [ 'Pending to Activate', 'Comment' ],
 
                 'removed -> active' => [ 'Activate', 'Comment' ],
-                'removed -> pending activation' =>
-                  [ 'Pending to activate', 'Comment' ],
                 'removed -> pending removal' =>
                   [ 'Pending to remove', 'Comment' ],
             },

-----------------------------------------------------------------------


More information about the Rt-commit mailing list