[Rt-commit] rtir branch, 2.9-trunk, updated. cfc81a0d908a9edcf0d7a701c9e3223b92af75ba

Ruslan Zakirov ruz at bestpractical.com
Fri Apr 1 10:17:39 EDT 2011


The branch, 2.9-trunk has been updated
       via  cfc81a0d908a9edcf0d7a701c9e3223b92af75ba (commit)
       via  ecfe7ca0a907f94c79874b30b4b27780fddc2e88 (commit)
       via  b5cb19241fa8cf5a4b542cb12d3f8e79333816d5 (commit)
       via  c1ed237f366a157d57a94c6999795536c1e5fba9 (commit)
       via  c3af0c8d847ce01ed8f12dfb656946180e24a8d8 (commit)
       via  6f25d4c3d1b004bac6bf5cbcb0869bd6d5621648 (commit)
       via  137a4797e7603aa2ea13d8660833d67e741cd111 (commit)
       via  0d7b8d5af9c63e8a8d803e26aa711a330fafd96a (commit)
       via  ff0e85327b065b281c559bc9964374d53b4aae47 (commit)
       via  4814482984c4986c1aad99293cf0ea741f79d717 (commit)
       via  2edbc73d774c0ca6cfa8bb1904cb2d363d4893ec (commit)
       via  42d526ae4e67f3b2737487bcc838d53fbedc5207 (commit)
       via  ce09e74573e2cdf1072c258a1ee2a9616b9157b3 (commit)
       via  70f3eb85fb60acb39c2961ae6885f5596c0a8012 (commit)
       via  ff9f78e59d407f0294c876855757c5ba99e4dd19 (commit)
       via  ad0c1490b878602d6e3a4dc09bf870b7d080dc00 (commit)
       via  6159a9c4271b3b089aad6e32a60b450e5d68a7b5 (commit)
       via  3104e1b2d3e6032fd84ad0b25ad831559b7240b3 (commit)
       via  bb73c0cd24920dce27638f9db49a92c527a36f57 (commit)
      from  d84b7d65dedfe2d8e89659f39d6571e60437bcf8 (commit)

Summary of changes:
 TODO.porting_over_RT4                              |    7 +
 etc/RTIR_Config.pm                                 |   39 +++-
 html/Callbacks/RTIR/Elements/Tabs/Privileged       |   30 +++-
 .../Ticket/Elements/ShowHistory/SkipTransaction    |   23 +--
 html/RTIR/Elements/ChildSummary                    |    2 +-
 html/RTIR/Elements/IncidentSummary                 |    2 +-
 html/RTIR/Elements/MergeWith                       |    2 +-
 html/RTIR/Merge/Refine.html                        |   14 ++
 html/RTIR/{Merge.html => Merge/index.html}         |   28 +--
 lib/RT/Action/RTIR_SetBlockState.pm                |   46 +---
 lib/RT/Condition/RTIR_RequireStateChange.pm        |    1 -
 lib/RT/IR.pm                                       |    6 +-
 lib/RT/IR/Test/Web.pm                              |    1 +
 t/005-resolve-investigations.t                     |    2 +-
 t/006-saved-searches.t                             |    4 +-
 t/008-workflow-blocks.t                            |  243 --------------------
 t/009-attachments-processing.t                     |   24 +--
 t/010-bulk-reject.t                                |    2 +-
 t/011-merge.t                                      |    2 +-
 t/016-date-due.t                                   |    6 +-
 t/block/pending-no-regexp.t                        |   57 +++++
 t/block/pending-regexp.t                           |   88 +++++++
 t/block/status-basics.t                            |  103 +++++++++
 23 files changed, 379 insertions(+), 353 deletions(-)
 create mode 100644 html/RTIR/Merge/Refine.html
 rename html/RTIR/{Merge.html => Merge/index.html} (87%)
 delete mode 100644 t/008-workflow-blocks.t
 create mode 100644 t/block/pending-no-regexp.t
 create mode 100644 t/block/pending-regexp.t
 create mode 100644 t/block/status-basics.t

- Log -----------------------------------------------------------------
commit bb73c0cd24920dce27638f9db49a92c527a36f57
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Apr 1 01:49:57 2011 +0400

    +two test files, adjust numbers

diff --git a/t/005-resolve-investigations.t b/t/005-resolve-investigations.t
index 1268072..34090a7 100644
--- a/t/005-resolve-investigations.t
+++ b/t/005-resolve-investigations.t
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use RT::IR::Test tests => 27;
+use RT::IR::Test tests => 24;
 
 RT::Test->started_ok;
 my $agent = default_agent();
diff --git a/t/006-saved-searches.t b/t/006-saved-searches.t
index 5f5e12b..1b0260a 100644
--- a/t/006-saved-searches.t
+++ b/t/006-saved-searches.t
@@ -3,13 +3,11 @@
 use strict;
 use warnings;
 
-use RT::IR::Test tests => 22;
+use RT::IR::Test tests => 20;
 
 RT::Test->started_ok;
 my $agent = default_agent();
 
-$agent->follow_link_ok({text => "RT"}, "went to main RT page");
-
 $agent->follow_link_ok({text => "Tickets"}, "went to query builder");
 
 $agent->form_name("BuildQuery");

commit 3104e1b2d3e6032fd84ad0b25ad831559b7240b3
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Apr 1 01:50:57 2011 +0400

    don't skip Status changes when history displayed

diff --git a/html/Callbacks/RTIR/Ticket/Elements/ShowHistory/SkipTransaction b/html/Callbacks/RTIR/Ticket/Elements/ShowHistory/SkipTransaction
index 083f3b6..a62557b 100644
--- a/html/Callbacks/RTIR/Ticket/Elements/ShowHistory/SkipTransaction
+++ b/html/Callbacks/RTIR/Ticket/Elements/ShowHistory/SkipTransaction
@@ -5,20 +5,9 @@ return if $$skip;
 # Set $skip to 1 if transaction matches criteria
 # $skip is passed by reference
 
-my $type = $Transaction->Type;
-
 # skip IP changes done by system user(scrips)
-if ( $Transaction->Creator == $RT::SystemUser->id && $type eq 'CustomField' ) {
-    my $cf = RT::IR::GetCustomField('IP')
-        or return;
-    return unless $cf->id == $Transaction->Field;
-    return $$skip = 1;
-}
-
-# get out of here asap
-unless ( $type =~ /^(?:Status|Set)$/ && $Transaction->Field  eq 'Status') {
-    return;
-}
+return unless $Transaction->Type eq 'CustomField'
+    && $Transaction->Creator == $RT::SystemUser->id;
 
 # check only ticket's transactions
 my $obj = $Transaction->Object;
@@ -26,7 +15,13 @@ return unless $obj && $obj->isa( 'RT::Ticket' );
 
 # only check if it's an RTIR queue
 my $Queue = $obj->QueueObj->Name;
-return $$skip = 1 if $Queue =~ /^(?:Incidents|Incident Reports|Investigations|Blocks)$/i;
+return unless RT::IR->OurQueue( $obj->QueueObj );
+
+my $cf = RT::IR::GetCustomField('IP')
+    or return;
+return unless $cf->id == $Transaction->Field;
+return $$skip = 1;
+
 </%INIT>
 
 <%ARGS>

commit 6159a9c4271b3b089aad6e32a60b450e5d68a7b5
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Apr 1 03:18:26 2011 +0400

    we don't sync status -> state, so don't need to fire action

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

commit ad0c1490b878602d6e3a4dc09bf870b7d080dc00
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Apr 1 03:19:29 2011 +0400

    we now only need to track replies and removed -> active

diff --git a/lib/RT/Action/RTIR_SetBlockState.pm b/lib/RT/Action/RTIR_SetBlockState.pm
index 5a510cb..2137ba4 100644
--- a/lib/RT/Action/RTIR_SetBlockState.pm
+++ b/lib/RT/Action/RTIR_SetBlockState.pm
@@ -57,50 +57,30 @@ Returns state of the C<Block>.
 
 sub GetState {
     my $self = shift;
-    my $t = $self->TicketObj;
+
     my $txn = $self->TransactionObj;
-    my $old_status = $t->Status;
+    return unless $txn->Type eq 'Correspond';
 
-    if ( $txn->Type eq 'Correspond' && $txn->IsInbound && $old_status eq 'pending activation' ) {
+    my $status = lc $self->TicketObj->Status;
+    if ( $status =~ /^pending / && $txn->IsInbound ) {
         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
-                )
-        ) {
+        if ( $status eq 'pending activation' ) {
+            # switch to active state if it is reply from requestor(s)
             return 'active';
+        } elsif ( $status eq 'pending removal' ) {
+            # switch to removed state when requestor(s) replies
+            return 'removed';
+        }
+        else {
+            return '';
         }
     }
 
-    # next code related to requestor's correspondents
-    return '' unless $txn->Type eq 'Correspond';
-    return '' unless $t->Requestors->HasMember( $txn->CreatorObj->PrincipalObj );
-
-    if ( my $re = RT->Config->Get('RTIR_BlockAproveActionRegexp') ) {
-        my $content = $txn->Content;
-        return '' if !$content || $content !~ /$re/;
-    }
-
-    if ( $old_status eq 'pending activation' ) {
-        # 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';
-    }
-
-    return '';
+    return 'active' if $status eq 'removed';
 }
 
 eval "require RT::Action::RTIR_SetBlockState_Vendor";

commit ff9f78e59d407f0294c876855757c5ba99e4dd19
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Apr 1 04:07:42 2011 +0400

    split t/008-workflow-blocks.t into three, no skip anymore

diff --git a/t/008-workflow-blocks.t b/t/008-workflow-blocks.t
deleted file mode 100644
index 9b989a2..0000000
--- a/t/008-workflow-blocks.t
+++ /dev/null
@@ -1,243 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use RT::IR::Test tests => 118;
-
-RT::Test->started_ok;
-my $agent = default_agent();
-
-my $inc_id   = $agent->create_incident( {Subject => "incident with block"});
-my $block_id = $agent->create_block( {Subject => "block", Incident => $inc_id});
-
-$agent->ticket_status_is( $block_id, 'pending activation');
-
-# XXX: Comment this tests as we don't allow to create blocks without an incident
-# XXX: we need test for this fact
-#$agent->follow_link_ok({ text => "[Link]" }, "Followed '[Link]' link");
-#$agent->form_number(3);
-#$agent->field('SelectedTicket', $inc_id);
-#$agent->click('LinkChild');
-#$agent->ok_and_content_like( qr{$block_id.*block.*?pending activation}, 'have child link');
-#
-#$agent->follow_link_ok({ text => $block_id }, "Followed link back to block");
-#$agent->ticket_status_is( $block_id, 'pending activation');
-
-$agent->has_tag('a', 'Remove', 'we have Remove action');
-$agent->has_tag('a', 'Quick Remove', 'we have Quick Remove action');
-
-foreach my $status( 'pending activation', 'active', 'pending removal', 'removed' ) {
-    $agent->follow_link_ok({ text => "Edit" }, "Goto edit page");
-    $agent->form_number(3);
-    $agent->field(Status => $status);
-    $agent->click('SaveChanges');
-    $agent->ticket_status_is( $block_id, $status);
-}
-
-diag "remove using edit";
-{
-    $agent->follow_link_ok({ text => "Edit" }, "Goto edit page");
-
-    # Tests to make sure the unwanted option 'Use system default()' does not appear as an
-    # option in the Status field (a reported M3 bug)
-    $agent->content_unlike(qr{<option (?:value=.*)?>Use system default\(\)</option>}, "The option 'Use system default()' does not exist.");
-
-    $agent->form_number(3);
-
-    $agent->field(Status => 'removed');
-    $agent->click('SaveChanges');
-    $agent->ticket_status_is( $block_id, 'removed');
-}
-
-diag "reactivate the block using the link";
-{
-    $agent->has_tag('a', 'Activate', 'we have Activate action');
-    $agent->follow_link_ok({ text => 'Activate' }, "Reactivate block");
-
-    $agent->form_number(3);
-    $agent->field( UpdateContent => 'activating block' );
-    $agent->click('SubmitTicket');
-    $agent->ticket_status_is( $block_id, 'active');
-}
-
-diag "prepare for removing using the link";
-{
-    $agent->has_tag('a', 'Pending Removal', 'we have Pending Removal action tab');
-    $agent->follow_link_ok({ text => 'Pending Removal' }, "Prepare block for remove");
-    $agent->form_number(3);
-    $agent->click('SubmitTicket');
-    $agent->ticket_status_is( $block_id, 'pending removal');
-}
-
-diag "test activation after reply using 'Activate' link";
-{
-    my $block_id = $agent->create_block( {Subject => "block", Incident => $inc_id});
-    $agent->ticket_status_is( $block_id, 'pending activation');
-
-    $agent->follow_link_ok({ text => 'Reply' }, "Go to reply page");
-    $agent->form_number(3);
-    $agent->field( UpdateContent => 'reply' );
-    $agent->click('SubmitTicket');
-
-    $agent->ticket_status_is( $block_id, 'pending activation');
-
-    $agent->follow_link_ok({ text => 'Activate' }, "activate it");
-
-    $agent->form_number(3);
-    $agent->field( UpdateContent => 'activating block' );
-    $agent->click('SubmitTicket');
-
-    $agent->ticket_status_is( $block_id, 'active');
-}
-
-diag "test activation after reply using Edit page";
-{
-    my $block_id = $agent->create_block( {Subject => "block", Incident => $inc_id});
-    $agent->ticket_status_is( $block_id, 'pending activation');
-
-    $agent->follow_link_ok({ text => 'Reply' }, "Go to reply page");
-    $agent->form_number(3);
-    $agent->field( UpdateContent => 'reply' );
-    $agent->click('SubmitTicket');
-
-    $agent->ticket_status_is( $block_id, 'pending activation');
-
-    $agent->follow_link_ok({ text => "Edit" }, "Goto edit page");
-    $agent->form_number(3);
-    $agent->field(Status => 'active');
-    $agent->click('SaveChanges');
-
-    $agent->ticket_status_is( $block_id, 'active');
-}
-
-my $re = RT->Config->Get('RTIR_BlockAproveActionRegexp');
-
-SKIP: {
-    skip "RTIR_BlockAproveActionRegexp is defined", 19 if $re;
-
-    my $rtname = RT->Config->Get('rtname');
-    my $block_id = $agent->create_block( {
-        Subject => "block",
-        Incident => $inc_id,
-        Requestors => 'rt-test at example.com',
-    } );
-    $agent->ticket_status_is( $block_id, 'pending activation');
-
-    {
-        my $text = <<EOF;
-From: rt-test\@example.com
-To: rt\@@{[RT->Config->Get('rtname')]}
-Subject: [$rtname #$block_id] This is a test
-
-test
-EOF
-        my ($status, $id) = RT::Test->send_via_mailgate($text, queue => 'Blocks');
-        is $status >> 8, 0, "The mail gateway exited ok";
-        is $id, $block_id, "replied to the ticket";
-        $agent->ticket_status_is( $block_id, 'active');
-    }
-
-    {
-        $agent->display_ticket( $block_id);
-        $agent->follow_link_ok({ text => 'Pending Removal' }, "-> pending removal");
-        $agent->form_number(3);
-        $agent->field( UpdateContent => 'going to remove' );
-        $agent->click('SubmitTicket');
-        $agent->ticket_status_is( $block_id, 'pending removal');
-    }
-
-    {
-        my $text = <<EOF;
-From: rt-test\@example.com
-To: rt\@@{[RT->Config->Get('rtname')]}
-Subject: [$rtname #$block_id] This is a test
-
-some text
-EOF
-        my ($status, $id) = RT::Test->send_via_mailgate($text, queue => 'Blocks');
-        is $status >> 8, 0, "The mail gateway exited ok";
-        is $id, $block_id, "replied to the ticket";
-        $agent->ticket_status_is( $block_id, 'removed');
-    }
-}
-
-SKIP: {
-    skip "'TestPendingBlock' doesn't match RTIR_BlockAproveActionRegexp", 27
-        unless $re && 'TestPendingBlock' =~ /$re/;
-    my $rtname = RT->Config->Get('rtname');
-    my $block_id = $agent->create_block( {
-        Subject => "block",
-        Incident => $inc_id,
-        Requestors => 'rt-test at example.com',
-    } );
-    $agent->ticket_status_is( $block_id, 'pending activation');
-
-    {
-        my $text = <<EOF;
-From: rt-test\@example.com
-To: rt\@@{[RT->Config->Get('rtname')]}
-Subject: [$rtname #$block_id] This is a test
-
-some text
-EOF
-        my ($status, $id) = RT::Test->send_via_mailgate($text, queue => 'Blocks');
-        is $status >> 8, 0, "The mail gateway exited ok";
-        is $id, $block_id, "replied to the ticket";
-        $agent->ticket_status_is( $block_id, 'pending activation');
-    }
-
-    {
-        my $text = <<EOF;
-From: rt-test\@example.com
-To: rt\@@{[RT->Config->Get('rtname')]}
-Subject: [$rtname #$block_id] This is a test
-
-TestPendingBlock
-
-EOF
-        my ($status, $id) = RT::Test->send_via_mailgate($text, queue => 'Blocks');
-        is $status >> 8, 0, "The mail gateway exited ok";
-        is $id, $block_id, "replied to the ticket";
-        $agent->ticket_status_is( $block_id, 'active');
-    }
-
-    {
-        $agent->display_ticket( $block_id);
-        $agent->follow_link_ok({ text => 'Pending Removal' }, "-> pending removal");
-        $agent->form_number(3);
-        $agent->field( UpdateContent => 'going to remove' );
-        $agent->click('SubmitTicket');
-        $agent->ticket_status_is( $block_id, 'pending removal');
-    }
-
-    {
-        my $text = <<EOF;
-From: rt-test\@example.com
-To: rt\@@{[RT->Config->Get('rtname')]}
-Subject: [$rtname #$block_id] This is a test
-
-some text
-EOF
-        my ($status, $id) = RT::Test->send_via_mailgate($text, queue => 'Blocks');
-        is $status >> 8, 0, "The mail gateway exited ok";
-        is $id, $block_id, "replied to the ticket";
-        $agent->ticket_status_is( $block_id, 'pending removal');
-    }
-
-    {
-        my $text = <<EOF;
-From: rt-test\@example.com
-To: rt\@@{[RT->Config->Get('rtname')]}
-Subject: [$rtname #$block_id] This is a test
-
-TestPendingBlock
-
-EOF
-        my ($status, $id) = RT::Test->send_via_mailgate($text, queue => 'Blocks');
-        is $status >> 8, 0, "The mail gateway exited ok";
-        is $id, $block_id, "replied to the ticket";
-        $agent->ticket_status_is( $block_id, 'removed');
-    }
-}
-
diff --git a/t/block/pending-no-regexp.t b/t/block/pending-no-regexp.t
new file mode 100644
index 0000000..332e007
--- /dev/null
+++ b/t/block/pending-no-regexp.t
@@ -0,0 +1,57 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use RT::IR::Test tests => 29;
+
+RT->Config->Set('RTIR_BlockAproveActionRegexp', undef);
+
+RT::Test->started_ok;
+my $agent = default_agent();
+
+my $inc_id   = $agent->create_incident( {Subject => "incident with block"});
+my $rtname = RT->Config->Get('rtname');
+my $block_id = $agent->create_block( {
+    Subject => "block",
+    Incident => $inc_id,
+    Requestors => 'rt-test at example.com',
+} );
+$agent->ticket_status_is( $block_id, 'pending activation');
+
+{
+    my $text = <<EOF;
+From: rt-test\@example.com
+To: rt\@@{[RT->Config->Get('rtname')]}
+Subject: [$rtname #$block_id] This is a test
+
+test
+EOF
+    my ($status, $id) = RT::Test->send_via_mailgate($text, queue => 'Blocks');
+    is $status >> 8, 0, "The mail gateway exited ok";
+    is $id, $block_id, "replied to the ticket";
+    $agent->ticket_status_is( $block_id, 'active');
+}
+
+{
+    $agent->display_ticket( $block_id);
+    $agent->follow_link_ok({ text => 'Pending Removal' }, "-> pending removal");
+    $agent->form_number(3);
+    $agent->field( UpdateContent => 'going to remove' );
+    $agent->click('SubmitTicket');
+    $agent->ticket_status_is( $block_id, 'pending removal');
+}
+
+{
+    my $text = <<EOF;
+From: rt-test\@example.com
+To: rt\@@{[RT->Config->Get('rtname')]}
+Subject: [$rtname #$block_id] This is a test
+
+some text
+EOF
+    my ($status, $id) = RT::Test->send_via_mailgate($text, queue => 'Blocks');
+    is $status >> 8, 0, "The mail gateway exited ok";
+    is $id, $block_id, "replied to the ticket";
+    $agent->ticket_status_is( $block_id, 'removed');
+}
diff --git a/t/block/pending-regexp.t b/t/block/pending-regexp.t
new file mode 100644
index 0000000..dbd790d
--- /dev/null
+++ b/t/block/pending-regexp.t
@@ -0,0 +1,88 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use RT::IR::Test tests => 37;
+
+RT->Config->Set('RTIR_BlockAproveActionRegexp', qr/TestPendingBlock/);
+
+RT::Test->started_ok;
+my $agent = default_agent();
+
+my $rtname = RT->Config->Get('rtname');
+
+my $inc_id   = $agent->create_incident( {Subject => "incident with block"});
+my $block_id = $agent->create_block( {
+    Subject => "block",
+    Incident => $inc_id,
+    Requestors => 'rt-test at example.com',
+} );
+$agent->ticket_status_is( $block_id, 'pending activation');
+
+{
+    my $text = <<EOF;
+From: rt-test\@example.com
+To: rt\@@{[RT->Config->Get('rtname')]}
+Subject: [$rtname #$block_id] This is a test
+
+some text
+EOF
+    my ($status, $id) = RT::Test->send_via_mailgate($text, queue => 'Blocks');
+    is $status >> 8, 0, "The mail gateway exited ok";
+    is $id, $block_id, "replied to the ticket";
+    $agent->ticket_status_is( $block_id, 'pending activation');
+}
+
+{
+    my $text = <<EOF;
+From: rt-test\@example.com
+To: rt\@@{[RT->Config->Get('rtname')]}
+Subject: [$rtname #$block_id] This is a test
+
+TestPendingBlock
+
+EOF
+    my ($status, $id) = RT::Test->send_via_mailgate($text, queue => 'Blocks');
+    is $status >> 8, 0, "The mail gateway exited ok";
+    is $id, $block_id, "replied to the ticket";
+    $agent->ticket_status_is( $block_id, 'active');
+}
+
+{
+    $agent->display_ticket( $block_id);
+    $agent->follow_link_ok({ text => 'Pending Removal' }, "-> pending removal");
+    $agent->form_number(3);
+    $agent->field( UpdateContent => 'going to remove' );
+    $agent->click('SubmitTicket');
+    $agent->ticket_status_is( $block_id, 'pending removal');
+}
+
+{
+    my $text = <<EOF;
+From: rt-test\@example.com
+To: rt\@@{[RT->Config->Get('rtname')]}
+Subject: [$rtname #$block_id] This is a test
+
+some text
+EOF
+    my ($status, $id) = RT::Test->send_via_mailgate($text, queue => 'Blocks');
+    is $status >> 8, 0, "The mail gateway exited ok";
+    is $id, $block_id, "replied to the ticket";
+    $agent->ticket_status_is( $block_id, 'pending removal');
+}
+
+{
+    my $text = <<EOF;
+From: rt-test\@example.com
+To: rt\@@{[RT->Config->Get('rtname')]}
+Subject: [$rtname #$block_id] This is a test
+
+TestPendingBlock
+
+EOF
+    my ($status, $id) = RT::Test->send_via_mailgate($text, queue => 'Blocks');
+    is $status >> 8, 0, "The mail gateway exited ok";
+    is $id, $block_id, "replied to the ticket";
+    $agent->ticket_status_is( $block_id, 'removed');
+}
diff --git a/t/block/status-basics.t b/t/block/status-basics.t
new file mode 100644
index 0000000..d688a1f
--- /dev/null
+++ b/t/block/status-basics.t
@@ -0,0 +1,103 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use RT::IR::Test tests => 67;
+
+RT::Test->started_ok;
+my $agent = default_agent();
+
+my $inc_id   = $agent->create_incident( {Subject => "incident with block"});
+my $block_id = $agent->create_block( {Subject => "block", Incident => $inc_id});
+
+$agent->ticket_status_is( $block_id, 'pending activation');
+
+$agent->has_tag('a', 'Remove', 'we have Remove action');
+$agent->has_tag('a', 'Quick Remove', 'we have Quick Remove action');
+
+diag "change status using edit page";
+foreach my $status( 'pending activation', 'active', 'pending removal', 'removed' ) {
+    $agent->follow_link_ok({ text => "Edit" }, "Goto edit page");
+    $agent->form_number(3);
+    $agent->field(Status => $status);
+    $agent->click('SaveChanges');
+    $agent->ticket_status_is( $block_id, $status);
+}
+
+diag "remove using edit";
+{
+    $agent->follow_link_ok({ text => "Edit" }, "Goto edit page");
+
+    # Tests to make sure the unwanted option 'Use system default()' does not appear as an
+    # option in the Status field (a reported M3 bug)
+    $agent->content_unlike(qr{<option (?:value=.*)?>Use system default\(\)</option>}, "The option 'Use system default()' does not exist.");
+
+    $agent->form_number(3);
+
+    $agent->field(Status => 'removed');
+    $agent->click('SaveChanges');
+    $agent->ticket_status_is( $block_id, 'removed');
+}
+
+diag "reactivate the block using the link";
+{
+    $agent->has_tag('a', 'Activate', 'we have Activate action');
+    $agent->follow_link_ok({ text => 'Activate' }, "Reactivate block");
+
+    $agent->form_number(3);
+    $agent->field( UpdateContent => 'activating block' );
+    $agent->click('SubmitTicket');
+    $agent->ticket_status_is( $block_id, 'active');
+}
+
+diag "prepare for removing using the link";
+{
+    $agent->has_tag('a', 'Pending Removal', 'we have Pending Removal action tab');
+    $agent->follow_link_ok({ text => 'Pending Removal' }, "Prepare block for remove");
+    $agent->form_number(3);
+    $agent->click('SubmitTicket');
+    $agent->ticket_status_is( $block_id, 'pending removal');
+}
+
+diag "test activation after reply using 'Activate' link";
+{
+    my $block_id = $agent->create_block( {Subject => "block", Incident => $inc_id});
+    $agent->ticket_status_is( $block_id, 'pending activation');
+
+    $agent->follow_link_ok({ text => 'Reply' }, "Go to reply page");
+    $agent->form_number(3);
+    $agent->field( UpdateContent => 'reply' );
+    $agent->click('SubmitTicket');
+
+    $agent->ticket_status_is( $block_id, 'pending activation');
+
+    $agent->follow_link_ok({ text => 'Activate' }, "activate it");
+
+    $agent->form_number(3);
+    $agent->field( UpdateContent => 'activating block' );
+    $agent->click('SubmitTicket');
+
+    $agent->ticket_status_is( $block_id, 'active');
+}
+
+diag "test activation after reply using Edit page";
+{
+    my $block_id = $agent->create_block( {Subject => "block", Incident => $inc_id});
+    $agent->ticket_status_is( $block_id, 'pending activation');
+
+    $agent->follow_link_ok({ text => 'Reply' }, "Go to reply page");
+    $agent->form_number(3);
+    $agent->field( UpdateContent => 'reply' );
+    $agent->click('SubmitTicket');
+
+    $agent->ticket_status_is( $block_id, 'pending activation');
+
+    $agent->follow_link_ok({ text => "Edit" }, "Goto edit page");
+    $agent->form_number(3);
+    $agent->field(Status => 'active');
+    $agent->click('SaveChanges');
+
+    $agent->ticket_status_is( $block_id, 'active');
+}
+

commit 70f3eb85fb60acb39c2961ae6885f5596c0a8012
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Apr 1 04:09:16 2011 +0400

    update todo

diff --git a/TODO.porting_over_RT4 b/TODO.porting_over_RT4
index ed83865..1093e44 100644
--- a/TODO.porting_over_RT4
+++ b/TODO.porting_over_RT4
@@ -20,3 +20,6 @@
 
 * Some pages with forms need new nice layouts like in RT, reply
   page comes first to mind
+
+* split SetState action and conditions for IRs and Blocks.
+  they just have different workflow now

commit ce09e74573e2cdf1072c258a1ee2a9616b9157b3
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Apr 1 04:17:02 2011 +0400

    no more 'New XXX' links, another test pass

diff --git a/t/009-attachments-processing.t b/t/009-attachments-processing.t
index f57317b..ee05259 100644
--- a/t/009-attachments-processing.t
+++ b/t/009-attachments-processing.t
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use RT::IR::Test tests => 57;
+use RT::IR::Test tests => 55;
 
 RT::Test->started_ok;
 my $agent = default_agent();
@@ -18,8 +18,7 @@ sub tempfile {
     return $filename;
 }
 
-$agent->follow_link_ok({text => 'Incident Reports'}, "go to 'Incident Reports'");
-$agent->follow_link_ok({text => 'New Report'}, "go to 'New Report'");
+$agent->goto_create_rtir_ticket('Incident Reports');
 
 # let's try to create new IR with one attachment
 {
@@ -46,8 +45,7 @@ $agent->follow_link_ok({text => 'New Report'}, "go to 'New Report'");
     unlink $filename or die "couldn't delete file '$filename': $!";
 }
 
-$agent->follow_link_ok({text => 'Incident Reports'}, "go to 'Incident Reports'");
-$agent->follow_link_ok({text => 'New Report'}, "go to 'New Report'");
+$agent->goto_create_rtir_ticket('Incident Reports');
 
 # let's try to create new IR with two different attachments
 {
@@ -83,8 +81,7 @@ $agent->follow_link_ok({text => 'New Report'}, "go to 'New Report'");
     unlink $fn2 or die "couldn't delete file '$fn2': $!";
 }
 
-$agent->follow_link_ok({text => 'Incident Reports'}, "go to 'Incident Reports'");
-$agent->follow_link_ok({text => 'New Report'}, "go to 'New Report'");
+$agent->goto_create_rtir_ticket('Incident Reports');
 
 # let's try to create new IR
 # and add then delete attachment to see that it works as expected
@@ -117,8 +114,7 @@ $agent->follow_link_ok({text => 'New Report'}, "go to 'New Report'");
     unlink $filename or die "couldn't delete file '$filename': $!";
 }
 
-$agent->follow_link_ok({text => 'Incidents'}, "go to 'Incidents'");
-$agent->follow_link_ok({text => 'New Incident'}, "go to 'New Incident'");
+$agent->goto_create_rtir_ticket('Incidents');
 
 # let's try add attachment on Inc create page
 {
@@ -134,8 +130,7 @@ $agent->follow_link_ok({text => 'New Incident'}, "go to 'New Incident'");
     unlink $filename or die "couldn't delete file '$filename': $!";
 }
 
-$agent->follow_link_ok({text => 'Investigations'}, "go to 'Investigations'");
-$agent->follow_link_ok({text => 'New Investigation'}, "go to 'New Investigation'");
+$agent->goto_create_rtir_ticket('Investigations');
 
 # let's try add attachment on Inv create page
 {
@@ -151,12 +146,9 @@ $agent->follow_link_ok({text => 'New Investigation'}, "go to 'New Investigation'
     unlink $filename or die "couldn't delete file '$filename': $!";
 }
 
-SKIP: {
-    skip "Blocks queue is disabled", 5 if RT->Config->Get('DisableBlocksQueue');
-
-    $agent->follow_link_ok({text => 'Blocks'}, "go to 'Blocks'");
-    $agent->follow_link_ok({text => 'New Block'}, "go to 'New Block'");
+$agent->goto_create_rtir_ticket('Blocks');
 
+{
     my $content = "this is test";
     my $filename = tempfile($content);
     $agent->form_number(3);

commit 42d526ae4e67f3b2737487bcc838d53fbedc5207
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Apr 1 05:58:34 2011 +0400

    move for refine tabs

diff --git a/html/RTIR/Merge.html b/html/RTIR/Merge/index.html
similarity index 100%
rename from html/RTIR/Merge.html
rename to html/RTIR/Merge/index.html

commit 2edbc73d774c0ca6cfa8bb1904cb2d363d4893ec
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Apr 1 06:00:16 2011 +0400

    get rid of old tabs in merge page

diff --git a/html/RTIR/Merge/index.html b/html/RTIR/Merge/index.html
index 9a3f200..2fef546 100644
--- a/html/RTIR/Merge/index.html
+++ b/html/RTIR/Merge/index.html
@@ -23,17 +23,7 @@
 %# 
 %# END LICENSE BLOCK
 <& /Elements/Header, Title => $title, Refresh => $session{'tickets_refresh_interval'} &>
-
-<& '/RTIR/Search/Elements/RefineTabs',
-    Title          => $title,
-    Ticket         => $Ticket,
-    Queue          => $Queue,
-    BaseQuery      => $BaseQuery,
-    QueryString    => $QueryString,
-
-    current_tab    => $current_tab,
-    current_subtab => 'RTIR/Search/Refine.html',
-&>
+<& /Elements/Tabs &>
 
 % $m->callback(CallbackName => 'BeforeActionList', Actions => \@results, ARGSRef => \%ARGS, Ticket => $Ticket);
 
@@ -77,7 +67,10 @@ my (@results);
 my $checks_failure = 0;
 if ( $MergeTicket ) {
     my @queues = sort map $_->Name, $Ticket->QueueObj, $MergeTicket->QueueObj;
-    unless ( $queues[0] eq $queues[1] or ($queues[0] eq "Incident Reports" and $queues[1] eq "Investigations") ) {
+    unless (
+        $queues[0] eq $queues[1]
+        or ($queues[0] eq "Incident Reports" and $queues[1] eq "Investigations")
+    ) {
         push @results, loc("Merge failed: Ticket #[_1] is not the right type", $MergeTicket->Id );
         $checks_failure = 1;
     }
@@ -159,10 +152,6 @@ if ( $Type ne 'Incident' ) {
     }
 }
 
-my $QueryString = $m->comp('/Elements/QueryString', Query => $Query, %defaults);
-
-my $current_tab = "RTIR/Merge.html?id=$id";
-
 </%INIT>
       
 <%ARGS>

commit 4814482984c4986c1aad99293cf0ea741f79d717
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Apr 1 06:02:30 2011 +0400

    new Merge tabs

diff --git a/html/Callbacks/RTIR/Elements/Tabs/Privileged b/html/Callbacks/RTIR/Elements/Tabs/Privileged
index bf65c83..d3eaa67 100644
--- a/html/Callbacks/RTIR/Elements/Tabs/Privileged
+++ b/html/Callbacks/RTIR/Elements/Tabs/Privileged
@@ -155,7 +155,7 @@ if ( $request_path =~ m{^/RTIR/(?:$re_rtir_types/)?(Display|Edit|Update)\.html$}
         PageMenu()->child( edit => title => loc('Edit'), path => "/RTIR/Edit.html?id=$id" );
         PageMenu()->child( split => title => loc('Split'), path => "/RTIR/Split.html?id=$id" );
         # XXX: we're missing query string here
-        PageMenu()->child( merge => title => loc('Merge'), path => "/RTIR/Merge.html?id=$id" );
+        PageMenu()->child( merge => title => loc('Merge'), path => "/RTIR/Merge/?id=$id" );
         PageMenu()->child( advanced => title => loc('Advanced'), path => "/RTIR/Advanced.html?id=$id" );
     }
 
@@ -319,6 +319,34 @@ if ( $request_path =~ m{^/RTIR/(?:$re_rtir_types/)?(Display|Edit|Update)\.html$}
         back => title => loc('Back to ticket #[_1]', $id),
         path => "/RTIR/Display.html?id=$id",
     );
+} elsif ( $request_path =~ m{^/RTIR/Merge/} ) {
+    my $ticket = RT::Ticket->new( $session{'CurrentUser'} );
+    $ticket->Load( $args->{'id'} );
+    my $id = $ticket->id;
+
+    my %args = (
+        $search_arguments->(),
+        id => $id,
+    );
+
+    PageMenu()->child(
+        link => title => loc('Merge'),
+        path => "/RTIR/Merge/?". $query_string->( %args ),
+    );
+    PageMenu()->child(
+        edit_search => title => loc('Edit Search'),
+        path => "/RTIR/Merge/Refine.html?". $query_string->( %args ),
+    );
+    PageMenu()->child(
+        new_search => title => loc('New Search'),
+        path => "/RTIR/Merge/Refine.html?". $query_string->(
+            NewQuery => 1, id => $id,
+        ),
+    );
+    PageMenu()->child(
+        back => title => loc('Back to ticket #[_1]', $id),
+        path => "/RTIR/Display.html?id=$id",
+    );
 } elsif ( $request_path =~ m{^/RTIR/(Search/|Incident/BulkAbandon\.html$)} ) {
     my $queue = $args->{'Queue'} || '';
     my $type = RT::IR::TicketType( Queue => $queue );

commit ff0e85327b065b281c559bc9964374d53b4aae47
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Apr 1 06:17:37 2011 +0400

    BaseQuery can not be an argument

diff --git a/html/RTIR/Merge/index.html b/html/RTIR/Merge/index.html
index 2fef546..fc670e4 100644
--- a/html/RTIR/Merge/index.html
+++ b/html/RTIR/Merge/index.html
@@ -121,8 +121,8 @@ my $Queue = $Ticket->QueueObj->Name;
 
 my $title = loc("Merge [_1] #[_2]: [_3]", $Type, $id, $Ticket->Subject);
 
-$Query     ||= RT::IR->NewQuery( Queue => $Queue);
-$BaseQuery ||= RT::IR->BaseQuery( Queue => $Queue, Exclude => $id, Constituency => $Ticket );
+$Query      ||= RT::IR->NewQuery( Queue => $Queue );
+my $BaseQuery = RT::IR->BaseQuery( Queue => $Queue, Exclude => $id, Constituency => $Ticket );
 
 my %defaults = (
     Format  => $Format,
@@ -157,7 +157,6 @@ if ( $Type ne 'Incident' ) {
 <%ARGS>
 $id             => undef
 
-$BaseQuery      => undef
 $Query          => undef
 $Format         => RT->Config->Get('RTIRSearchResultFormats')->{'Merge'} 
 $Rows           => 50

commit 0d7b8d5af9c63e8a8d803e26aa711a330fafd96a
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Apr 1 06:18:07 2011 +0400

    Refine page for Merge operation

diff --git a/html/RTIR/Merge/Refine.html b/html/RTIR/Merge/Refine.html
new file mode 100644
index 0000000..ac2cecd
--- /dev/null
+++ b/html/RTIR/Merge/Refine.html
@@ -0,0 +1,14 @@
+<%INIT>
+return $m->comp(
+    '/RTIR/Search/Elements/RefinePage',
+    %ARGS,
+    ResultPage => 'RTIR/Merge/?'. $m->comp('/Elements/QueryString',
+        id => $ARGS{'id'},
+    ),
+    BaseQuery => RT::IR->BaseQuery(
+        Queue        => $ARGS{'Queue'},
+        Exclude      => $ARGS{'id'},
+        Constituency => $ARGS{'id'},
+    ),
+);
+</%INIT>

commit 137a4797e7603aa2ea13d8660833d67e741cd111
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Apr 1 06:18:45 2011 +0400

    old Active statuses include initial as well

diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index 9ab6c75..2be2b75 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -207,8 +207,10 @@ sub States {
         my $queue = RT::Queue->new($RT::SystemUser);
         $queue->Load($name);
         if ( $queue->id ) {
-            push @states, $queue->Lifecycle->Active   if $arg{'Active'};
-            push @states, $queue->Lifecycle->Inactive if $arg{'Inactive'};
+            push @states, $queue->Lifecycle->Valid('initial', 'active')
+                if $arg{'Active'};
+            push @states, $queue->Lifecycle->Inactive
+                if $arg{'Inactive'};
         }
         else {
             $RT::Logger->error( "failed to load queue $name" );

commit 6f25d4c3d1b004bac6bf5cbcb0869bd6d5621648
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Apr 1 06:19:22 2011 +0400

    update TODO

diff --git a/TODO.porting_over_RT4 b/TODO.porting_over_RT4
index 1093e44..23360f7 100644
--- a/TODO.porting_over_RT4
+++ b/TODO.porting_over_RT4
@@ -23,3 +23,7 @@
 
 * split SetState action and conditions for IRs and Blocks.
   they just have different workflow now
+
+* migrate SetIncidentReportState over lifecycles
+
+* scan code for hardcoded statuses

commit c3af0c8d847ce01ed8f12dfb656946180e24a8d8
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Apr 1 06:34:41 2011 +0400

    report error in test file, not in lib

diff --git a/lib/RT/IR/Test/Web.pm b/lib/RT/IR/Test/Web.pm
index 9ecebff..0146a85 100644
--- a/lib/RT/IR/Test/Web.pm
+++ b/lib/RT/IR/Test/Web.pm
@@ -163,6 +163,7 @@ sub ok_and_content_like {
     my $re = shift;
     my $desc = shift || "looks good";
     
+    local $Test::Builder::Level = $Test::Builder::Level + 1;
     Test::More::is($self->status, 200, "request successful");
     #like($self->content, $re, $desc);
     $self->content_like($re, $desc);

commit c1ed237f366a157d57a94c6999795536c1e5fba9
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Apr 1 06:34:59 2011 +0400

    fix links to merge page

diff --git a/html/RTIR/Elements/ChildSummary b/html/RTIR/Elements/ChildSummary
index e4e63a9..d205a04 100644
--- a/html/RTIR/Elements/ChildSummary
+++ b/html/RTIR/Elements/ChildSummary
@@ -51,7 +51,7 @@
 <td align="right"><a href="<%RT->Config->Get('WebPath')%>/RTIR/Display.html?Child=<%$Ticket->Id%>&id=<%$ticket%>">[<%loc("Link")%>]</a></td>
 % } elsif ($Type eq $t) {
 % if ($ticket ne $Ticket->Id) {
-<td align="right"><a href="<%RT->Config->Get('WebPath')%>/RTIR/Merge.html?id=<%$ticket%>&SelectedTicket=<%$Ticket->Id%>">[<%loc("Merge")%>]</a></td>
+<td align="right"><a href="<%RT->Config->Get('WebPath')%>/RTIR/Merge/?id=<%$ticket%>&SelectedTicket=<%$Ticket->Id%>">[<%loc("Merge")%>]</a></td>
 % } else {
 <td>&nbsp;</td>
 % }
diff --git a/html/RTIR/Elements/IncidentSummary b/html/RTIR/Elements/IncidentSummary
index c1ba4bc..54af9f7 100644
--- a/html/RTIR/Elements/IncidentSummary
+++ b/html/RTIR/Elements/IncidentSummary
@@ -52,7 +52,7 @@
 <a href="<%RT->Config->Get('WebPath')%>/RTIR/Display.html?Child=<%$ticket%>&id=<%$Ticket->Id%>">[<%loc("Link")%>]</a>
 % } elsif ($ticket and $Type eq $t) {
 %   if ($ticket ne $Ticket->Id) {
-<a href="<%RT->Config->Get('WebPath')%>/RTIR/Merge.html?id=<%$ticket%>&SelectedTicket=<%$Ticket->Id%>">[<%loc("Merge")%>]</a>
+<a href="<%RT->Config->Get('WebPath')%>/RTIR/Merge/?id=<%$ticket%>&SelectedTicket=<%$Ticket->Id%>">[<%loc("Merge")%>]</a>
 %   }
 % }
 <a href="<%RT->Config->Get('WebPath')%>/RTIR/Create.html?Incident=<%$Ticket->Id%>&Queue=Investigations">[<%loc("Investigate")%>]</a>
diff --git a/html/RTIR/Elements/MergeWith b/html/RTIR/Elements/MergeWith
index 35fa6b4..a17ece8 100644
--- a/html/RTIR/Elements/MergeWith
+++ b/html/RTIR/Elements/MergeWith
@@ -9,7 +9,7 @@
     Page          => $Page,
     OrderBy       => $OrderBy,
     Order         => $Order,
-    BaseURL       => "RTIR/Merge.html?id=$id",
+    BaseURL       => "RTIR/Merge/?id=$id",
 &>
 
 <%INIT>
diff --git a/html/RTIR/Merge/index.html b/html/RTIR/Merge/index.html
index fc670e4..c0a090a 100644
--- a/html/RTIR/Merge/index.html
+++ b/html/RTIR/Merge/index.html
@@ -29,7 +29,7 @@
 
 <& /Elements/ListActions, actions => \@results &>
 
-<form action="<% RT->Config->Get('WebPath') %>/RTIR/Merge.html" method="post">
+<form action="<% RT->Config->Get('WebPath') %>/RTIR/Merge/" method="post">
 <input type="hidden" name="id" value="<% $id %>" />
 
 % if ( $siblings_query ) {

commit b5cb19241fa8cf5a4b542cb12d3f8e79333816d5
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Apr 1 06:35:14 2011 +0400

    +two test files, adjust number of tests

diff --git a/t/010-bulk-reject.t b/t/010-bulk-reject.t
index 76c8d50..92ad54a 100644
--- a/t/010-bulk-reject.t
+++ b/t/010-bulk-reject.t
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use RT::IR::Test tests => 50;
+use RT::IR::Test tests => 45;
 
 RT::Test->started_ok;
 my $agent = default_agent();
diff --git a/t/011-merge.t b/t/011-merge.t
index 90489ce..106f285 100644
--- a/t/011-merge.t
+++ b/t/011-merge.t
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use RT::IR::Test tests => 121;
+use RT::IR::Test tests => 108;
 
 RT::Test->started_ok;
 my $agent = default_agent();

commit ecfe7ca0a907f94c79874b30b4b27780fddc2e88
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Apr 1 17:39:55 2011 +0400

    bring lifecycle's config up to date

diff --git a/etc/RTIR_Config.pm b/etc/RTIR_Config.pm
index 9bf2794..763c6fc 100644
--- a/etc/RTIR_Config.pm
+++ b/etc/RTIR_Config.pm
@@ -291,6 +291,7 @@ Set(
 
         transitions => {
             # from   => [ to list ],
+            ''        => [qw(open)],
             open      => [qw(resolved abandoned)],
             resolved  => [qw(open)],
             abandoned => [qw(open)],
@@ -315,15 +316,20 @@ Set(
         ],
     },
     incident_reports => {
-        default_initial => 'new',
-        initial         => [ 'new', 'open' ],
-        active          => ['open'],
+        initial         => [ 'new' ],
+        active          => [ 'open' ],
         inactive        => [ 'resolved', 'rejected' ],
-        default_inactive => 'resolved',
 
-        transitions => {
+        defaults => {
+            on_create => 'new',
+            on_merge  => 'resolved',
+            approved  => 'open',
+            denied    => 'rejected',
+        },
 
+        transitions => {
             # from   => [ to list ],
+            ''       => [qw(new open resolved)],
             new      => [qw(open resolved rejected)],
             open     => [qw(resolved rejected)],
             resolved => [qw(open)],
@@ -341,15 +347,20 @@ Set(
         ],
     },
     investigations => {
-        default_initial => 'open',
-        initial         => ['open'],
+        initial         => [],
         active          => ['open'],
         inactive        => ['resolved'],
-        default_inactive  => 'resolved',
 
-        transitions => {
+        defaults => {
+            on_create => 'open',
+            on_merge  => 'resolved',
+            approved  => 'open',
+            denied    => 'resolved',
+        },
 
+        transitions => {
             # from   => [ to list ],
+            ''       => [qw(new resolved)],
             open     => [qw(resolved)],
             resolved => [qw(open)],
         },
@@ -361,13 +372,19 @@ Set(
         ],
     },
     blocks => {
-        default_initial => 'pending activation',
         initial         => ['pending activation'],
         active          => [ 'active', 'pending removal' ],
         inactive        => ['removed'],
-        default_inactive  => 'removed',
+
+        defaults => {
+            on_create => 'pending activation',
+            on_merge  => 'removed',
+            approved  => 'active',
+            denied    => 'removed',
+        },
 
         transitions => {
+            ''                   => [ 'pending activation', 'active' ],
             'pending activation' => [ 'active', 'removed' ],
             active               => [ 'pending removal', 'removed' ],
             'pending removal'    => [ 'removed', 'active' ],

commit cfc81a0d908a9edcf0d7a701c9e3223b92af75ba
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Apr 1 17:41:08 2011 +0400

    another test, adjust number

diff --git a/t/016-date-due.t b/t/016-date-due.t
index c1db7fa..74419c5 100644
--- a/t/016-date-due.t
+++ b/t/016-date-due.t
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use RT::IR::Test tests => 17;
+use RT::IR::Test tests => 14;
 
 my $duty_a = RT::Test->load_or_create_user(
     Name       => 'duty a',
@@ -24,12 +24,12 @@ my $customer = RT::Test->load_or_create_user(
 
 {
     my $ticket = RT::Ticket->new( $duty_a );
-    my ($id) = $ticket->Create(
+    my ($id, undef, $msg) = $ticket->Create(
         Queue => 'Incident Reports',
         Owner => $duty_a->id,
         Requestor => $customer->id,
     );
-    ok $id, 'created a ticket';
+    ok $id, 'created a ticket' or diag "error: $msg";
 
     $ticket->Load( $id );
     is $ticket->id, $id, 'loaded ticket';

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


More information about the Rt-commit mailing list