[Rt-commit] rtir branch, 2.9-trunk, updated. 2.6.1rc1-240-gbd9c9e2

Ruslan Zakirov ruz at bestpractical.com
Tue Aug 9 17:10:25 EDT 2011


The branch, 2.9-trunk has been updated
       via  bd9c9e2dfefe8de707ddc64b69b8f7eee9a19bb6 (commit)
       via  51aabed8cf290625a199cac68d6cd98e3ff92ef1 (commit)
       via  c84b688e472f8b98156d8d5f9c79b2fcb5d7b6ec (commit)
       via  18d172d4ca7e81a41415f717f6352864cb901a04 (commit)
       via  48ba18232cb9f93dfe15022d557243b07f2a56cf (commit)
       via  e6049d5a1a9a9bb996a2f6cfafd76c355076c83b (commit)
       via  be7de2e7dd1c00410fc6d1e828dcb9a70e832a6c (commit)
       via  0c5d9503588be4d24a6fe3096c5d30f5bc0d0d09 (commit)
       via  00a05e29d785b7cb976e81d16b63cbc26dec9399 (commit)
       via  13b5e204a4021fe6853a2df890c90f3bd498f4bc (commit)
       via  c55ef616e0ce809c518d30e31681b392255df9ec (commit)
       via  896e8f5959db1012a5f0eb7223f1b61ee2efd920 (commit)
       via  1aca81fc3232e772327a22c9e8b256fcda875880 (commit)
       via  17c44a5716706baaa524b965d1b13d64ca6dcb22 (commit)
       via  3ea504f34936956e0254b888c31650a46cac160b (commit)
       via  6bcfabfd5608e4229aac2bf8d0d1f46b9bd49a7e (commit)
      from  aac70d5de7a3634fa39815a7c35e0639e4e84a47 (commit)

Summary of changes:
 CHANGES                                          |   29 +++++++++
 META.yml                                         |    2 +-
 README                                           |   24 +++++++-
 TODO.porting_over_RT4                            |   21 +++++-
 TODO.switch_custom_fields_to_generic_RT_methods  |   72 ----------------------
 etc/initialdata                                  |   10 +++
 etc/upgrade/2.9.0/content                        |   23 +++++++
 html/RTIR/Search/Elements/ShowResults            |   54 ++++++++--------
 lib/RT/Condition/RTIR_RequireReportActivation.pm |   42 +++++++++++++
 lib/RT/IR.pm                                     |   16 +++--
 lib/RT/IR/Test.pm                                |    2 +-
 t/009-attachments-processing.t                   |   32 +++++-----
 12 files changed, 200 insertions(+), 127 deletions(-)
 delete mode 100644 TODO.switch_custom_fields_to_generic_RT_methods
 create mode 100644 lib/RT/Condition/RTIR_RequireReportActivation.pm

- Log -----------------------------------------------------------------
commit e6049d5a1a9a9bb996a2f6cfafd76c355076c83b
Merge: aac70d5 be7de2e
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Aug 9 15:34:43 2011 +0400

    Merge branch '2.6-trunk' into 2.9-trunk

diff --cc lib/RT/IR.pm
index b7b5f14,337926f..8b1bb8a
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@@ -44,13 -44,13 +44,13 @@@
  # 
  # }}} END BPS TAGGED BLOCK
  #
 -package RT::IR;
 -
  use 5.008003;
 -use warnings;
  use strict;
 +use warnings;
 +
 +package RT::IR;
  
- our $VERSION = '2.6.0';
+ our $VERSION = '2.6.1rc1';
  
  
  use Business::Hours;

commit 48ba18232cb9f93dfe15022d557243b07f2a56cf
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Aug 9 16:02:57 2011 +0400

    move todo items from TODO.switch_custom_fields_to_generic_RT_methods

diff --git a/TODO.porting_over_RT4 b/TODO.porting_over_RT4
index 0f6a772..f0ff1ae 100644
--- a/TODO.porting_over_RT4
+++ b/TODO.porting_over_RT4
@@ -70,6 +70,23 @@
 
 * we pass OnCreate inconsistently into EditCustomFields
 
+* Suspect that failed custom field validation check
+  or gnupg error that returns back to create page will
+  dropp fields to defaults
+
+* Rename some fields to variants with spaces
+
+* Custom fields in Incident display are very specific and mixed with
+  generic RT properties
+
+* Description CF in Incidents had Cols => 60 argument, check if we preserve behaviour
+(update: the answer is no. and seems there's no way to do this except hacking rt's
+/Elements/EditCustomField or /Elements/EditCustomFieldFreeform)
+
+* On edit State need special treating for Blocks
+* Constituency has special treating on edit depending on constituency propagation mode
+** These two custom fields are still massaged via callback and RTIR has special editor
+
 === TESTS
 
 Test Summary Report

commit 18d172d4ca7e81a41415f717f6352864cb901a04
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Aug 9 16:04:27 2011 +0400

    remove old TODO file

diff --git a/TODO.switch_custom_fields_to_generic_RT_methods b/TODO.switch_custom_fields_to_generic_RT_methods
deleted file mode 100644
index f578ae3..0000000
--- a/TODO.switch_custom_fields_to_generic_RT_methods
+++ /dev/null
@@ -1,72 +0,0 @@
-* Suspect that failed custom field validation check or gnupg error that returns back to
-  create page will dropp fields to defaults
-
-* Rename some fields to variants with spaces
-
-* Custom fields in Incident display are very specific and mixed with generic RT properties
-
-* Description CF in Incidents had Cols => 60 argument, check if we preserve behaviour
-(update: the answer is no. and seems there's no way to do this except hacking rt's
-/Elements/EditCustomField or /Elements/EditCustomFieldFreeform)
-
-* On edit State need special treating for Blocks
-* Constituency has special treating on edit depending on constituency propagation mode
-** These two custom fields are still massaged via callback and RTIR has special editor
-
-Implemented changes:
-
-* RTIR's custom fields are renamed, no more '_RTIR_' prefix. As well some CFs had two
-  word names, spaces have been added. Handled in upgrade script.
-
-* Autoreply and BlockRemoved templates in blocks queue need changes. Block that adds
-  CF values to the mail should be:
-
-    { my $output = "";
-      my @mailfields = ( 'IP', 'Netmask', 'Port', 'Where Blocked' );
-
-      my $CustomFields = $Ticket->QueueObj->TicketCustomFields;
-      while ( my $CustomField = $CustomFields->Next ) {
-        my $name = $CustomField->Name;
-        next unless grep lc $_ eq lc $name, @mailfields;
-
-        my $Values = $Ticket->CustomFieldValues( $CustomField->Id );
-        while ( my $Value = $Values->Next ) {
-          $output .= $name .": ". $Value->Content ."\n";
-        }
-      }
-      return $output;
-    }
-
-* Default values:
-** Reports/SLA/OnCreate: RT::IR::DefaultSLA()
-** Reports/How Reported/OnCreate: $ARGS{'HowReported-Value'} || RT->Config->Get('_RTIR_HowReported_default')
-** the same for 'reporter type'
-** Blocks/Port/OnCreate: $ARGS{'Port-Value'} || RT->Config->Get('_RTIR_Port_default')
-** Blocks/Where Blocked/OnCreate: $ARGS{'WhereBlocked-Value'} || RT->Config->Get('_RTIR_WhereBlocked_default')
-** similar applies to 'Net Mask'
-** Incident/OnCreate:
-*** Description, Classification, Function: RT->Config->Get('_RTIR_Description_default'),
-*** Resolution: no default
-** IP default on Create for children:
-my $ip_default = $ARGS{'IP-Value'};
-if ( !$ip_default && $IncidentObj ) {
-    $ip_default = join "\n", grep $_, map $_->Content,
-        @{ $IncidentObj->CustomFieldValues( 'IP' )->ItemsArrayRef };
-}
-$ip_default ||= RT->Config->Get('_RTIR_IP_default') || '';
-
-** IP for incidents:
-my $ip_default = $ARGS{'IP-Value'};
-if ( !$ip_default && $ChildObj ) {
-    $ip_default = join "\n", grep $_, map $_->Content,
-        @{ $ChildObj->CustomFieldValues( 'IP' )->ItemsArrayRef };
-}
-$ip_default ||= RT->Config->Get('_RTIR_IP_default') || '';
-
-* Names of custom fields were localized in RT, we should localize them in RTIR as well
-( this is automatically done since we use RT's cf edit component )
-
-* Stripping of _RTIR_ prefix results in changes of searches: Formats and Queries, write an upgrader for saved searches
-( the script is at etc/upgrade/2.5.1/update_saved_searches.pl, maybe put it somewhere
-better? )
-

commit c84b688e472f8b98156d8d5f9c79b2fcb5d7b6ec
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Aug 9 17:15:13 2011 +0400

    use old input names in attachments tests
    
    we switched to new RT's component

diff --git a/TODO.porting_over_RT4 b/TODO.porting_over_RT4
index f0ff1ae..25c947b 100644
--- a/TODO.porting_over_RT4
+++ b/TODO.porting_over_RT4
@@ -91,10 +91,6 @@
 
 Test Summary Report
 -------------------
-t/009-attachments-processing.t                (Wstat: 65280 Tests: 15 Failed: 2)
-  Failed tests:  12-13
-  Non-zero exit status: 255
-  Parse errors: Bad plan.  You planned 55 tests but ran 15.
 t/016-date-started.t                          (Wstat: 256 Tests: 68 Failed: 1)
   Failed test:  40
   Non-zero exit status: 1
diff --git a/t/009-attachments-processing.t b/t/009-attachments-processing.t
index ee05259..430f7ad 100644
--- a/t/009-attachments-processing.t
+++ b/t/009-attachments-processing.t
@@ -26,7 +26,7 @@ $agent->goto_create_rtir_ticket('Incident Reports');
     my $filename = tempfile($content);
     $agent->form_number(3);
     $agent->field('Subject', 'ticket with attachment');
-    $agent->field('Attachment', $filename);
+    $agent->field('Attach', $filename);
     $agent->click('Create');
     is($agent->status, 200, "request successful");
     $agent->content_like( qr/\Q$filename/, "has file name on the page");
@@ -57,13 +57,13 @@ $agent->goto_create_rtir_ticket('Incident Reports');
 
     $agent->form_number(3);
     $agent->field('Subject', 'ticket with attachments');
-    $agent->field('Attachment', $fn1);
-    $agent->click('AddAttachment');
+    $agent->field('Attach', $fn1);
+    $agent->click('AddMoreAttach');
     is($agent->status, 200, "request successful");
 
     $agent->form_number(3);
     is($agent->value('Subject'), 'ticket with attachments', "subject we put is there");
-    $agent->field('Attachment', $fn2);
+    $agent->field('Attach', $fn2);
     $agent->click('Create');
     is($agent->status, 200, "request successful");
 
@@ -90,14 +90,14 @@ $agent->goto_create_rtir_ticket('Incident Reports');
     my $filename = tempfile($content);
     $agent->form_number(3);
     $agent->field('Subject', 'ticket with attachment');
-    $agent->field('Attachment', $filename);
-    $agent->click('AddAttachment');
+    $agent->field('Attach', $filename);
+    $agent->click('AddMoreAttach');
     is($agent->status, 200, "request successful");
     $agent->content_like( qr/\Q$filename/, "has file name on the page");
 
     $agent->form_number(3);
-    $agent->field('DeleteAttachments', $filename);
-    $agent->click('AddAttachment');
+    $agent->tick('DeleteAttach-'. $filename, 1);
+    $agent->click('AddMoreAttach');
     is($agent->status, 200, "request successful");
 
     $agent->form_number(3);
@@ -121,8 +121,8 @@ $agent->goto_create_rtir_ticket('Incidents');
     my $content = "this is test";
     my $filename = tempfile($content);
     $agent->form_number(3);
-    $agent->field('Attachment', $filename);
-    $agent->click('AddAttachment');
+    $agent->field('Attach', $filename);
+    $agent->click('AddMoreAttach');
     is($agent->status, 200, "request successful");
     $agent->content_like( qr/\Q$filename/, "has file name on the page");
     $agent->form_number(3);
@@ -137,8 +137,8 @@ $agent->goto_create_rtir_ticket('Investigations');
     my $content = "this is test";
     my $filename = tempfile($content);
     $agent->form_number(3);
-    $agent->field('Attachment', $filename);
-    $agent->click('AddAttachment');
+    $agent->field('Attach', $filename);
+    $agent->click('AddMoreAttach');
     is($agent->status, 200, "request successful");
     $agent->content_like( qr/\Q$filename/, "has file name on the page");
     $agent->form_number(3);
@@ -152,8 +152,8 @@ $agent->goto_create_rtir_ticket('Blocks');
     my $content = "this is test";
     my $filename = tempfile($content);
     $agent->form_number(3);
-    $agent->field('Attachment', $filename);
-    $agent->click('AddAttachment');
+    $agent->field('Attach', $filename);
+    $agent->click('AddMoreAttach');
     is($agent->status, 200, "request successful");
     $agent->content_like( qr/\Q$filename/, "has file name on the page");
     $agent->form_number(3);
@@ -170,8 +170,8 @@ $agent->goto_create_rtir_ticket('Blocks');
     my $content = "this is test";
     my $filename = tempfile($content);
     $agent->form_number(3);
-    $agent->field('Attachment', $filename);
-    $agent->click('AddAttachment');
+    $agent->field('Attach', $filename);
+    $agent->click('AddMoreAttach');
     is($agent->status, 200, "request successful");
     $agent->content_like( qr/\Q$filename/, "has file name on the page");
 

commit 51aabed8cf290625a199cac68d6cd98e3ff92ef1
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Aug 10 01:06:05 2011 +0400

    custom AutoOpener for IRs
    
    IRs should stay new until they are linked to an Incident

diff --git a/etc/initialdata b/etc/initialdata
index 7df4b53..84a0df4 100644
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -307,6 +307,11 @@
        ApplicableTransTypes => 'AddLink',
        ExecModule => 'RTIR_Merge',
     },
+    {  Name                 => 'RTIR Require IRs Activation',               # loc
+       Description          => "Whenever it's time to activate report",                                        # loc
+       ApplicableTransTypes => 'Correspond',
+       ExecModule           => 'RTIR_RequireReportActivation',
+    },
 );
 
 @Scrips = (
@@ -394,6 +399,11 @@
        ScripCondition    => 'RTIR Linking To Incident',
        ScripAction       => 'RTIR Activate Ticket',
        Template          => 'Blank' },
+    {  Description       => "On Correspond (not every) Activate Report",
+       Queue             => 'Incident Reports',
+       ScripCondition    => 'RTIR Require IRs Activation',
+       ScripAction       => 'RTIR Activate Ticket',
+       Template          => 'Blank' },
 
 
 # XXX: description is duplication, but set Due of the incident
diff --git a/etc/upgrade/2.9.0/content b/etc/upgrade/2.9.0/content
index 4044223..9a7deac 100644
--- a/etc/upgrade/2.9.0/content
+++ b/etc/upgrade/2.9.0/content
@@ -11,6 +11,29 @@ our @Initial = (
     },
 );
 
+our @ScripConditions = (
+    {  Name                 => 'RTIR Require IRs Activation',               # loc
+       Description          => "Whenever it's time to activate report",                                        # loc
+       ApplicableTransTypes => 'Correspond',
+       ExecModule           => 'RTIR_RequireReportActivation',
+    },
+);
+
+our @ScripActions = (
+    {  Name        => 'RTIR Activate Ticket',    # loc
+       Description => 'Set status to first active possible',            # loc
+       ExecModule  => 'RTIR_Activate',
+    },
+);
+
+our @Scrips = (
+    {  Description       => "On Correspond (not every) Activate Report",
+       Queue             => 'Incident Reports',
+       ScripCondition    => 'RTIR Require IRs Activation',
+       ScripAction       => 'RTIR Activate Ticket',
+       Template          => 'Blank' },
+);
+
 sub remove_scrip_action {
     my $module = shift;
 
diff --git a/lib/RT/Condition/RTIR_RequireReportActivation.pm b/lib/RT/Condition/RTIR_RequireReportActivation.pm
new file mode 100644
index 0000000..d1b0451
--- /dev/null
+++ b/lib/RT/Condition/RTIR_RequireReportActivation.pm
@@ -0,0 +1,42 @@
+use strict;
+use warnings;
+
+package RT::Condition::RTIR_RequireReportActivation;
+use base 'RT::Condition::RTIR';
+
+=head2 IsApplicable
+
+This condition is very close to conditions in L<RT::Action::AutoOpen>.
+
+Main difference is that IRs are not activated until they are linked to an Incident.
+
+=cut
+
+sub IsApplicable {
+    my $self = shift;
+
+    my $ticket = $self->TicketObj;
+    my $next = $ticket->FirstActiveStatus;
+    return 0 unless defined $next;
+
+    my $txn = $self->TransactionObj;
+
+    my $cycle = $ticket->QueueObj->Lifecycle;
+    if ( $cycle->IsInitial( $ticket->Status ) ) {
+        # no change if the ticket in initial status and is not linked to parent
+        return 0 unless RT::IR->Incidents( $ticket )->Count;
+        # no change if the ticket is in initial status and the message is a mail
+        # from a requestor
+        return 0 if $txn->IsInbound;
+    }
+
+    if ( my $msg = $txn->Message->First ) { 
+        return 0 if ($msg->GetHeader('RT-Control') || '') =~ /\bno-autoopen\b/i;
+    }
+
+    return 1;
+}
+
+RT::Base->_ImportOverlays;
+
+1;

commit bd9c9e2dfefe8de707ddc64b69b8f7eee9a19bb6
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Aug 10 01:09:43 2011 +0400

    disable RT's AutoOpener for IRs as well

diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index 8b1bb8a..911caa9 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -577,8 +577,10 @@ require RT::Action::AutoOpen;
     my $prepare = RT::Action::AutoOpen->can('Prepare');
     *RT::Action::AutoOpen::Prepare = sub {
         my $self = shift;
-        return 1 if $self->TicketObj->QueueObj->Name eq 'Blocks';
-        $self->$prepare(@_);
+        my $ticket = $self->TicketObj;
+        my $type = RT::IR::TicketType( Ticket => $ticket );
+        return 1 if $type && ( $type eq 'Block' || $type eq 'Report' );
+        return $self->$prepare(@_);
     };
 }
 

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


More information about the Rt-commit mailing list