[Rt-commit] r9303 - in rtir/branches/2.3-EXPERIMENTAL: html/RTIR t

ruz at bestpractical.com ruz at bestpractical.com
Sun Oct 14 16:17:30 EDT 2007


Author: ruz
Date: Sun Oct 14 16:17:29 2007
New Revision: 9303

Modified:
   rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Block/Elements/EditState
   rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Display.html
   rtir/branches/2.3-EXPERIMENTAL/t/008-workflow-blocks.t

Log:
* fix activation of Blocks after reply
* add covering tests

Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Block/Elements/EditState
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Block/Elements/EditState	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Block/Elements/EditState	Sun Oct 14 16:17:29 2007
@@ -14,3 +14,8 @@
 $TicketObj => undef
 $Default   => undef
 </%ARGS>
+<%INIT>
+if ( $Default eq 'open' ) {
+    $Default = 'new' unless $TicketObj->FirstCustomFieldValue('_RTIR_State') eq 'active';
+}
+</%INIT>

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	Sun Oct 14 16:17:29 2007
@@ -267,10 +267,16 @@
         }
     }
 
-
-
     $ARGS{UpdateAttachments} = delete $session{'Attachments'};
     push @results, ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef => \%ARGS );
+
+    if ( $Type eq 'Block' && ($ARGS{'Status'}||'') eq 'open' && $Ticket->Status eq 'open' ) {
+        my ($id, $msg) = $Ticket->AddCustomFieldValue(
+            Field => '_RTIR_State',
+            Value => 'active',
+        );
+        $RT::Logger->error("Couldn't set state: $msg");
+    }
     push @results, ProcessTicketBasics(  TicketObj => $Ticket, ARGSRef => \%ARGS );
 
     my $strict_acl = RT->Config->Set( StrictLinkACL => 0 );

Modified: rtir/branches/2.3-EXPERIMENTAL/t/008-workflow-blocks.t
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/t/008-workflow-blocks.t	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/t/008-workflow-blocks.t	Sun Oct 14 16:17:29 2007
@@ -2,7 +2,7 @@
 
 use strict;
 use warnings;
-use Test::More tests => 36;
+use Test::More tests => 62;
 
 require "t/rtir-test.pl";
 
@@ -67,6 +67,40 @@
 $agent->click('SubmitTicket');
 ticket_state_is($agent, $block_id, 'pending removal');
 
+diag "test activation after reply using 'Activate' link";
+{
+    my $block_id = create_block($agent, {Subject => "block", Incident => $inc_id});
+    ticket_state_is($agent, $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');
+
+    ticket_state_is($agent, $block_id, 'pending activation');
+
+    $agent->follow_link_ok({ text => 'Activate' }, "activate it");
+
+    ticket_state_is($agent, $block_id, 'active');
+}
+
+diag "test activation after reply using Edit page";
+{
+    my $block_id = create_block($agent, {Subject => "block", Incident => $inc_id});
+    ticket_state_is($agent, $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');
+
+    ticket_state_is($agent, $block_id, 'pending activation');
 
+    $agent->follow_link_ok({ text => "Edit" }, "Goto edit page");
+    $agent->form_number(3);
+    $agent->field(Status => 'open');
+    $agent->click('SaveChanges');
+
+    ticket_state_is($agent, $block_id, 'active');
+}
 


More information about the Rt-commit mailing list