[Rt-commit] rtir branch, 2.9-trunk, updated. 2.6.1-451-g02e4fe4

Ruslan Zakirov ruz at bestpractical.com
Sat Oct 8 12:04:51 EDT 2011


The branch, 2.9-trunk has been updated
       via  02e4fe49f4d18648e7f20abe9328a1f8b19e65f1 (commit)
       via  44887bbd2d43ff9558ebafd0e55a8f30edc8b156 (commit)
       via  b8317a3668d070db64f06dcfdfbfa4a8deee059c (commit)
       via  7bbcc5d571bce8ce348e622355686d2c8467de48 (commit)
       via  2c93a2e2bb300f5d24d19f7d188a65e40df663f7 (commit)
       via  97f789a43bdfd1c221003354b5f63903e2360415 (commit)
      from  76d25648f7112ec5df97d5b4156f8eee5530c49c (commit)

Summary of changes:
 TODO.porting_over_RT4                    |    2 -
 etc/initialdata                          |   11 ++---
 etc/upgrade/2.9.0/content                |   24 ++++++++++
 lib/RT/Condition/RTIR.pm                 |   16 -------
 lib/RT/Condition/RTIR_BlockActivation.pm |   29 ------------
 lib/RT/Condition/RTIR_CloseTicket.pm     |   73 ------------------------------
 lib/RT/Condition/RTIR_ReopenTicket.pm    |   71 -----------------------------
 t/upgrade/2.6.0-to-2.9.0.t               |    9 +++-
 8 files changed, 34 insertions(+), 201 deletions(-)
 delete mode 100644 lib/RT/Condition/RTIR_BlockActivation.pm
 delete mode 100644 lib/RT/Condition/RTIR_CloseTicket.pm
 delete mode 100644 lib/RT/Condition/RTIR_ReopenTicket.pm

- Log -----------------------------------------------------------------
commit 97f789a43bdfd1c221003354b5f63903e2360415
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sat Oct 8 14:25:13 2011 +0400

    delete a condition we don't need

diff --git a/etc/initialdata b/etc/initialdata
index 720149d..e7eb4dc 100644
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -292,11 +292,6 @@
        ApplicableTransTypes => 'Any',
        ExecModule => 'RTIR_RequireConstituencyGroupChange',
     },
-    {  Name        => 'RTIR Block Activation',    # loc
-       Description => 'A block was activated or created in active state',                                            # loc
-       ApplicableTransTypes => 'Create,CustomField',
-       ExecModule => 'RTIR_BlockActivation',
-    },
     {  Name        => 'RTIR Linking To Incident',    # loc
        Description => 'Whenever ticket is linked to incident or created with link',                                 # loc
        ApplicableTransTypes => 'Create,AddLink',
diff --git a/etc/upgrade/2.9.0/content b/etc/upgrade/2.9.0/content
index 860d28b..d3f9fb7 100644
--- a/etc/upgrade/2.9.0/content
+++ b/etc/upgrade/2.9.0/content
@@ -323,6 +323,7 @@ our @Final = (
     sub {
         # started date is handled by lifecycles now
         remove_scrip_condition('RTIR_RequireStateChange');
+        remove_scrip_condition('RTIR_BlockActivation');
     },
 
     sub {
diff --git a/lib/RT/Condition/RTIR_BlockActivation.pm b/lib/RT/Condition/RTIR_BlockActivation.pm
deleted file mode 100644
index 902e387..0000000
--- a/lib/RT/Condition/RTIR_BlockActivation.pm
+++ /dev/null
@@ -1,29 +0,0 @@
-use strict;
-use warnings;
-
-package RT::Condition::RTIR_BlockActivation;
-use base 'RT::Condition::RTIR';
-
-=head2 IsApplicable
-
-When state of the block changes from C<pending activation> to C<active>
-or ticket created with C<active> state.
-
-=cut
-
-sub IsApplicable {
-    my $self = shift;
-
-    my $txn = $self->TransactionObj;
-    return 1 if $txn->Type eq 'Create' && $self->TicketObj->Status eq 'active';
-    return 1 if
-        $self->IsStatusChange
-        && $txn->OldValue eq 'pending activation'
-        && $txn->NewValue eq 'active';
-
-    return 0;
-}
-
-RT::Base->_ImportOverlays;
-
-1;

commit 2c93a2e2bb300f5d24d19f7d188a65e40df663f7
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sat Oct 8 14:52:02 2011 +0400

    close = !inactive -> inactive, not active -> inactive

diff --git a/lib/RT/Condition/RTIR_CloseTicket.pm b/lib/RT/Condition/RTIR_CloseTicket.pm
index a2c00ea..01ffaf1 100644
--- a/lib/RT/Condition/RTIR_CloseTicket.pm
+++ b/lib/RT/Condition/RTIR_CloseTicket.pm
@@ -62,7 +62,7 @@ sub IsApplicable {
     my $self = shift;
 
     return 0 unless $self->IsStatusChange;
-    return 0 unless $self->TicketObj->QueueObj->IsActiveStatus( $self->TransactionObj->OldValue );
+    return 0 if $self->TicketObj->QueueObj->IsInactiveStatus( $self->TransactionObj->OldValue );
     return 0 unless $self->TicketObj->QueueObj->IsInactiveStatus( $self->TransactionObj->NewValue );
 
     return 1;

commit 7bbcc5d571bce8ce348e622355686d2c8467de48
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sat Oct 8 19:54:46 2011 +0400

    make sure we print errors

diff --git a/t/upgrade/2.6.0-to-2.9.0.t b/t/upgrade/2.6.0-to-2.9.0.t
index 5ffb725..015d6eb 100644
--- a/t/upgrade/2.6.0-to-2.9.0.t
+++ b/t/upgrade/2.6.0-to-2.9.0.t
@@ -8,9 +8,12 @@ BEGIN { unless ( $ENV{RTIR_TEST_UPGRADE} ) {
     Test::More->import( skip_all => "Skipping upgrade tests, it's only for developers" );
 } }
 
-use RT::IR::Test tests => 16;
-RT::IR::Test->import_snapshot( 'rtir-2.6.after-rt-upgrade.sql' );
-RT::IR::Test->apply_upgrade( 'etc/upgrade/', '2.9.0' );
+use RT::IR::Test tests => 17;
+{
+    RT::IR::Test->import_snapshot( 'rtir-2.6.after-rt-upgrade.sql' );
+    my ($status, $msg) = RT::IR::Test->apply_upgrade( 'etc/upgrade/', '2.9.0' );
+    ok $status, "applied upgrade" or diag "error: $msg";
+}
 
 my @state_cf_ids;
 {

commit b8317a3668d070db64f06dcfdfbfa4a8deee059c
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sat Oct 8 19:58:00 2011 +0400

    replace RTIR's conditions with RT's StatusChange

diff --git a/etc/initialdata b/etc/initialdata
index e7eb4dc..b7f8aa0 100644
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -270,12 +270,14 @@
     {  Name        => 'RTIR Close Ticket',    # loc
        Description => 'A ticket is rejected or resolved' ,                                            # loc
        ApplicableTransTypes => 'Any',
-       ExecModule => 'RTIR_CloseTicket',
+       ExecModule  => 'StatusChange',
+       Argument    => 'old: initial, active; new: inactve',
     },
     {  Name        => 'RTIR Reopen Ticket',    # loc
        Description => 'A closed ticket is reopened' ,                                            # loc
        ApplicableTransTypes => 'Any',
-       ExecModule => 'RTIR_ReopenTicket',
+       ExecModule  => 'StatusChange',
+       Argument    => 'old: inactive; new: initial, active',
     },
     {  Name        => 'RTIR Require Due Change',    # loc
        Description => 'The due date of the parent incident must be changed',                                            # loc
diff --git a/etc/upgrade/2.9.0/content b/etc/upgrade/2.9.0/content
index d3f9fb7..709a710 100644
--- a/etc/upgrade/2.9.0/content
+++ b/etc/upgrade/2.9.0/content
@@ -326,6 +326,29 @@ our @Final = (
         remove_scrip_condition('RTIR_BlockActivation');
     },
 
+    # replace conditions with RT's StatusChange
+    sub {
+        my %map = (
+            RTIR_ReopenTicket => 'old: inactive; new: initial, active',
+            RTIR_CloseTicket => 'old: initial, active; new: inactve',
+        );
+        while ( my ($module, $argument) = each %map ) {
+            my $conditions = RT::ScripConditions->new( $RT::SystemUser );
+            $conditions->Limit( FIELD => 'ExecModule', VALUE => $module );
+            while ( my $condition = $conditions->Next ) {
+                my ($status, $msg) = $condition->SetExecModule('StatusChange');
+                RT->Logger->error("Couldn't change scrip condition: $msg")
+                    unless $status;
+                ($status, $msg) = $condition->SetApplicableTransTypes('Status,Set');
+                RT->Logger->error("Couldn't change scrip condition: $msg")
+                    unless $status;
+                ($status, $msg) = $condition->SetArgument( $argument );
+                RT->Logger->error("Couldn't change scrip condition: $msg")
+                    unless $status;
+            }
+        }
+    },
+
     sub {
         my ($d_portlets) = RT::System->new( RT->SystemUser )
             ->Attributes->Named('RTIR_HomepageSettings');
diff --git a/lib/RT/Condition/RTIR_CloseTicket.pm b/lib/RT/Condition/RTIR_CloseTicket.pm
deleted file mode 100644
index 01ffaf1..0000000
--- a/lib/RT/Condition/RTIR_CloseTicket.pm
+++ /dev/null
@@ -1,73 +0,0 @@
-# {{{ BEGIN BPS TAGGED BLOCK
-# 
-# COPYRIGHT:
-#  
-# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC 
-#                                          <jesse at bestpractical.com>
-# 
-# (Except where explicitly superseded by other copyright notices)
-# 
-# 
-# LICENSE:
-# 
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-# 
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-# 
-# 
-# CONTRIBUTION SUBMISSION POLICY:
-# 
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-# 
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-# 
-# }}} END BPS TAGGED BLOCK
-use strict;
-use warnings;
-
-package RT::Condition::RTIR_CloseTicket;
-use base 'RT::Condition::RTIR';
-
-
-=head2 IsApplicable
-
-If the ticket was closed, ie status was changed from any active status to
-an inactive. See F<RT_Config.pm> for C<ActiveStatuses> and C<InactiveStatuses>
-options.
-
-=cut
-
-sub IsApplicable {
-    my $self = shift;
-
-    return 0 unless $self->IsStatusChange;
-    return 0 if $self->TicketObj->QueueObj->IsInactiveStatus( $self->TransactionObj->OldValue );
-    return 0 unless $self->TicketObj->QueueObj->IsInactiveStatus( $self->TransactionObj->NewValue );
-
-    return 1;
-}
-
-RT::Base->_ImportOverlays;
-
-1;
diff --git a/lib/RT/Condition/RTIR_ReopenTicket.pm b/lib/RT/Condition/RTIR_ReopenTicket.pm
deleted file mode 100644
index 50603ff..0000000
--- a/lib/RT/Condition/RTIR_ReopenTicket.pm
+++ /dev/null
@@ -1,71 +0,0 @@
-# {{{ BEGIN BPS TAGGED BLOCK
-# 
-# COPYRIGHT:
-#  
-# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC 
-#                                          <jesse at bestpractical.com>
-# 
-# (Except where explicitly superseded by other copyright notices)
-# 
-# 
-# LICENSE:
-# 
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-# 
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-# 
-# 
-# CONTRIBUTION SUBMISSION POLICY:
-# 
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-# 
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-# 
-# }}} END BPS TAGGED BLOCK
-use strict;
-use warnings;
-
-package RT::Condition::RTIR_ReopenTicket;
-use base 'RT::Condition::RTIR';
-
-
-=head2 IsApplicable
-
-If the ticket was closed
-
-=cut
-
-sub IsApplicable {
-    my $self = shift;
-
-    return 0 unless $self->IsStatusChange;
-    return 0 unless $self->TicketObj->QueueObj->IsInactiveStatus( $self->TransactionObj->OldValue );
-    return 0 unless $self->TicketObj->QueueObj->IsActiveStatus( $self->TransactionObj->NewValue );
-
-    return 1;
-}
-
-RT::Base->_ImportOverlays;
-
-1;

commit 44887bbd2d43ff9558ebafd0e55a8f30edc8b156
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sat Oct 8 19:58:56 2011 +0400

    method is not used or required

diff --git a/lib/RT/Condition/RTIR.pm b/lib/RT/Condition/RTIR.pm
index 3dfb96a..83f55f5 100644
--- a/lib/RT/Condition/RTIR.pm
+++ b/lib/RT/Condition/RTIR.pm
@@ -10,22 +10,6 @@ RT::Condition::RTIR - generic checks
 
 =head1 METHODS
 
-=head2 IsStatusChange
-
-Returns true if it's status change of a ticket.
-
-=cut
-
-sub IsStatusChange {
-    my $self = shift;
-    my $type = $self->TransactionObj->Type;
-    return 1 if $type eq "Status" or
-        ( $type eq "Set" and
-          $self->TransactionObj->Field eq "Status" );
-
-    return 0;
-}
-
 =head2 IsStaff
 
 Returns true if creator of a transaction is a staff member. By staff member

commit 02e4fe49f4d18648e7f20abe9328a1f8b19e65f1
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sat Oct 8 20:00:53 2011 +0400

    have hardcoded statuses, but delete from todo
    
    it's hard to delete every status from code,
    for RTIR 3.0 we keep them

diff --git a/TODO.porting_over_RT4 b/TODO.porting_over_RT4
index 898da17..c19f3cc 100644
--- a/TODO.porting_over_RT4
+++ b/TODO.porting_over_RT4
@@ -17,8 +17,6 @@
 * Some pages with forms need new nice layouts like in RT, reply
   page comes first to mind
 
-* scan code for hardcoded statuses
-
 === CLEANUP && REFACTORING
 
 * stop abusing $session{'tickets'} so we can get working

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


More information about the Rt-commit mailing list