[Rt-commit] rtir branch, 2.9-trunk, updated. 2.6.1-469-g495072c

Ruslan Zakirov ruz at bestpractical.com
Tue Oct 11 10:17:14 EDT 2011


The branch, 2.9-trunk has been updated
       via  495072c7fee7d0f97190402223386939461b8abe (commit)
       via  6ecb6c3b8a907880c8bd96f18740c50b795279ec (commit)
       via  a653698906b54a0e4082579723c1a2709e00bd9d (commit)
       via  f5d1f1973c43c35f98ae3024b255907176bf5d38 (commit)
       via  466d6e29ab155b7f887efb4c374ad7fc6e01a5ee (commit)
       via  39ae4776b828aee1eaf3f1648bd76665de1df442 (commit)
       via  e922dc67df649b1b1e55a717b29e1200111c2c5b (commit)
       via  8c106d7fb14aa8d92d4676f0202aa0334ea63d39 (commit)
       via  b195e16e254b9d64c746a18e38c9a6806e61a55c (commit)
       via  d419511f93f41f484005c8ded1dacecc9caa64d7 (commit)
       via  996ae27a1911641ded466a873eb62c75a66ed392 (commit)
       via  05955358b6c8b50cdffc29afe02716afb6fb1ef8 (commit)
       via  6a9ef037f7efad7db257de9e62dcb72b0734b974 (commit)
       via  0bfcf9b985921397fb1e63e04121b8f563f87f77 (commit)
       via  de09c9ebf22700422c24214994c55c69cb125b6e (commit)
       via  e194fe9058653a185b1ed107be841d8fd29bd4d4 (commit)
       via  56cb15a4a6b412952c2cd65636ecdd75edd48d02 (commit)
       via  45e3cdcaa06c242d3b9ca847b478c3423f6623a5 (commit)
      from  02e4fe49f4d18648e7f20abe9328a1f8b19e65f1 (commit)

Summary of changes:
 TODO.porting_over_RT4                        |   14 ++
 etc/RTIR_Config.pm                           |   65 ---------
 etc/initialdata                              |  109 ---------------
 etc/upgrade/2.9.0/content                    |   17 ++-
 html/Callbacks/RTIR/Elements/Tabs/Privileged |    4 +-
 html/RTIR/Elements/EditCustomFields          |    6 +-
 html/RTIR/Tools/Elements/SelectWhoisServer   |    1 +
 lib/RT/Action/RTIR_SetDueBySLA.pm            |   94 -------------
 lib/RT/Action/RTIR_SetDueCorrespond.pm       |   81 -----------
 lib/RT/Action/RTIR_SetDueIncident.pm         |   25 ++--
 lib/RT/Action/RTIR_SetDueReopen.pm           |   87 ------------
 lib/RT/Action/RTIR_SetDueToNow.pm            |   93 -------------
 lib/RT/Action/RTIR_SetStartsByBizHours.pm    |   91 ------------
 lib/RT/Action/RTIR_SetStartsToNow.pm         |   93 -------------
 lib/RT/Action/RTIR_UnsetDue.pm               |   71 ----------
 lib/RT/Condition/RTIR_RequireDueChange.pm    |   12 ++-
 lib/RT/IR.pm                                 |   59 --------
 lib/RT/IR/AdministrationTutorial.pod         |    2 +
 lib/RT/IR/DocIndex.pod                       |    2 +-
 t/016-date-due.t                             |   59 --------
 t/dates/due-incidents.t                      |  192 ++++++++++++++++++++++++++
 t/{016-date-started.t => dates/started.t}    |    0
 22 files changed, 253 insertions(+), 924 deletions(-)
 delete mode 100644 lib/RT/Action/RTIR_SetDueBySLA.pm
 delete mode 100644 lib/RT/Action/RTIR_SetDueCorrespond.pm
 delete mode 100644 lib/RT/Action/RTIR_SetDueReopen.pm
 delete mode 100644 lib/RT/Action/RTIR_SetDueToNow.pm
 delete mode 100644 lib/RT/Action/RTIR_SetStartsByBizHours.pm
 delete mode 100644 lib/RT/Action/RTIR_SetStartsToNow.pm
 delete mode 100644 lib/RT/Action/RTIR_UnsetDue.pm
 delete mode 100644 t/016-date-due.t
 create mode 100644 t/dates/due-incidents.t
 rename t/{016-date-started.t => dates/started.t} (100%)

- Log -----------------------------------------------------------------
commit 45e3cdcaa06c242d3b9ca847b478c3423f6623a5
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Mon Oct 10 15:14:03 2011 +0400

    get rid of a few uninit warnings

diff --git a/html/Callbacks/RTIR/Elements/Tabs/Privileged b/html/Callbacks/RTIR/Elements/Tabs/Privileged
index 7387d7e..429aa60 100644
--- a/html/Callbacks/RTIR/Elements/Tabs/Privileged
+++ b/html/Callbacks/RTIR/Elements/Tabs/Privileged
@@ -21,7 +21,7 @@ my $query_string = sub {
     my %args = @_;
     my $u    = URI->new();
     $u->query_form(%args);
-    return $u->query;
+    return $u->query || '';
 };
 
 my $root = Menu->child( rtir => title => loc('RTIR'), path => '/RTIR/' );
@@ -450,7 +450,7 @@ if ( $request_path =~ m{^/RTIR/(?:$re_rtir_types/)?(Display|Edit|Update)\.html$}
         my $RSSPath = join '/', map $m->interp->apply_escapes( $_, 'u' ),
             $session{'CurrentUser'}->UserObj->Name,
             $session{'CurrentUser'}->UserObj->GenerateAuthString(
-                join '', map $args{$_}, qw(Query Order OrderBy)
+                join '', map $args{$_}||'', qw(Query Order OrderBy)
             )
         ;
         $more->child(
diff --git a/html/RTIR/Tools/Elements/SelectWhoisServer b/html/RTIR/Tools/Elements/SelectWhoisServer
index 83488d8..e10cf5c 100644
--- a/html/RTIR/Tools/Elements/SelectWhoisServer
+++ b/html/RTIR/Tools/Elements/SelectWhoisServer
@@ -13,4 +13,5 @@ $Default => ''
 </%ARGS>
 <%INIT>
 my %servers = %{ RT->Config->Get('whois') || {} };
+$Default ||= '';
 </%INIT>

commit 56cb15a4a6b412952c2cd65636ecdd75edd48d02
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Mon Oct 10 15:14:44 2011 +0400

    apply limit on the alias

diff --git a/etc/upgrade/2.9.0/content b/etc/upgrade/2.9.0/content
index 709a710..af1b96f 100644
--- a/etc/upgrade/2.9.0/content
+++ b/etc/upgrade/2.9.0/content
@@ -379,7 +379,11 @@ our @Final = (
             TABLE2 => 'ScripActions',
             FIELD2 => 'id',
         );
-        $scrips->Limit( FIELD => 'ExecModule', VALUE => 'RTIR_SetDueIncident' );
+        $scrips->Limit(
+            ALIAS => $alias,
+            FIELD => 'ExecModule',
+            VALUE => 'RTIR_SetDueIncident',
+        );
         while ( my $scrip = $scrips->Next ) {
             my $value = 'Set Due Date On Incident';
             next if $scrip->Name eq $value;

commit e194fe9058653a185b1ed107be841d8fd29bd4d4
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Mon Oct 10 15:19:41 2011 +0400

    move date tests

diff --git a/t/016-date-due.t b/t/dates/due-basic.t
similarity index 100%
rename from t/016-date-due.t
rename to t/dates/due-basic.t
diff --git a/t/016-date-started.t b/t/dates/started.t
similarity index 100%
rename from t/016-date-started.t
rename to t/dates/started.t

commit de09c9ebf22700422c24214994c55c69cb125b6e
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Oct 11 14:24:40 2011 +0400

    change Due of Incident when a child is closed

diff --git a/lib/RT/Condition/RTIR_RequireDueChange.pm b/lib/RT/Condition/RTIR_RequireDueChange.pm
index 8618681..2dbe80e 100644
--- a/lib/RT/Condition/RTIR_RequireDueChange.pm
+++ b/lib/RT/Condition/RTIR_RequireDueChange.pm
@@ -59,9 +59,17 @@ If a child had a Due Date change or changes parents.
 sub IsApplicable {
     my $self = shift;
 
-    my $type = $self->TransactionObj->Type;
+    my $txn = $self->TransactionObj;
+    my $type = $txn->Type;
+    my $field = $txn->Field;
+
     return 1 if $type eq 'DeleteLink' || $type eq "AddLink";
-    return 1 if $type eq "Set" && $self->TransactionObj->Field eq "Due";
+    return 1 if $type eq "Set" && $field eq "Due";
+    if ( $type eq 'Status' || ($type eq 'Set' && $field eq 'Status') ) {
+        my $lifecycle = $self->TicketObj->QueueObj->Lifecycle;
+        return 1 if !$lifecycle->IsInactive( $txn->OldValue )
+            && $lifecycle->IsInactive( $txn->NewValue );
+    }
 
     return 0;
 }

commit 0bfcf9b985921397fb1e63e04121b8f563f87f77
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Oct 11 14:26:01 2011 +0400

    apply Due update on the current ticket if it's Inc

diff --git a/lib/RT/Action/RTIR_SetDueIncident.pm b/lib/RT/Action/RTIR_SetDueIncident.pm
index 23a1ea1..d239ebf 100644
--- a/lib/RT/Action/RTIR_SetDueIncident.pm
+++ b/lib/RT/Action/RTIR_SetDueIncident.pm
@@ -60,6 +60,10 @@ Set the Due date based on the most due child.
 sub Commit {
     my $self = shift;
 
+    if ( $self->TicketObj->QueueObj->Name eq 'Incidents' ) {
+        return $self->UpdateDue( $self->TicketObj );
+    }
+
     my $type = $self->TransactionObj->Type;
     if ( $type eq 'DeleteLink' ) {
         my $uri = RT::URI->new( $self->CurrentUser );

commit 6a9ef037f7efad7db257de9e62dcb72b0734b974
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Oct 11 14:27:23 2011 +0400

    use IncidentChildren

diff --git a/lib/RT/Action/RTIR_SetDueIncident.pm b/lib/RT/Action/RTIR_SetDueIncident.pm
index d239ebf..2900829 100644
--- a/lib/RT/Action/RTIR_SetDueIncident.pm
+++ b/lib/RT/Action/RTIR_SetDueIncident.pm
@@ -85,16 +85,10 @@ sub UpdateDue {
     return 1 unless $incident;
     return 1 unless $incident->QueueObj->Name eq 'Incidents';
 
-    my $query =  "(Queue = 'Incident Reports'"
-                ." OR Queue = 'Investigations'"
-                ." OR Queue = 'Blocks'"
-                .") AND MemberOf = " . $incident->Id
-                ." AND ("
-                . join( " OR ", map "Status = '$_'",
-                        RT::Queue->ActiveStatusArray )
-                .")";
-    my $children = RT::Tickets->new($self->CurrentUser);
-    $children->FromSQL( $query );
+    my $children = RT::IR->IncidentChildren(
+        $incident, Initial => 1, Active => 1,
+        And => "Due > '1970-01-02 00:00:00'",
+    );
     $children->OrderBy( FIELD => 'Due', ORDER => 'ASC' );
     $children->RowsPerPage(1);
     my $mostdue = $children->First;

commit 05955358b6c8b50cdffc29afe02716afb6fb1ef8
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Oct 11 14:29:20 2011 +0400

    compare old and new values before setting

diff --git a/lib/RT/Action/RTIR_SetDueIncident.pm b/lib/RT/Action/RTIR_SetDueIncident.pm
index 2900829..e26df0c 100644
--- a/lib/RT/Action/RTIR_SetDueIncident.pm
+++ b/lib/RT/Action/RTIR_SetDueIncident.pm
@@ -91,9 +91,13 @@ sub UpdateDue {
     );
     $children->OrderBy( FIELD => 'Due', ORDER => 'ASC' );
     $children->RowsPerPage(1);
+
     my $mostdue = $children->First;
+    my $new = $mostdue? $mostdue->DueObj->ISO: '1970-01-01 00:00:00';
+    my $old = $incident->DueObj->ISO;
+    return 1 if $new eq $old;
 
-    $incident->SetDue( $mostdue? $mostdue->DueObj->ISO: '1970-01-01 00:00:00' );
+    $incident->SetDue( $new );
 
     return 1;
 }

commit 996ae27a1911641ded466a873eb62c75a66ed392
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Oct 11 14:29:51 2011 +0400

    check errors and log results

diff --git a/lib/RT/Action/RTIR_SetDueIncident.pm b/lib/RT/Action/RTIR_SetDueIncident.pm
index e26df0c..c044ea8 100644
--- a/lib/RT/Action/RTIR_SetDueIncident.pm
+++ b/lib/RT/Action/RTIR_SetDueIncident.pm
@@ -97,7 +97,8 @@ sub UpdateDue {
     my $old = $incident->DueObj->ISO;
     return 1 if $new eq $old;
 
-    $incident->SetDue( $new );
+    my ($status, $msg) = $incident->SetDue( $new );
+    $RT::Logger->error( "Couldn't set due date: $msg" ) unless $status;
 
     return 1;
 }

commit d419511f93f41f484005c8ded1dacecc9caa64d7
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Oct 11 14:33:06 2011 +0400

    tiny POD fixes

diff --git a/lib/RT/IR/AdministrationTutorial.pod b/lib/RT/IR/AdministrationTutorial.pod
index a09c20c..cf7406f 100644
--- a/lib/RT/IR/AdministrationTutorial.pod
+++ b/lib/RT/IR/AdministrationTutorial.pod
@@ -386,3 +386,5 @@ notify a system administrator.
 A missing passphrase occurs when GPG Agent is unresponsive or the passphrase
 was mis-set in RTIR_SiteConfig.pm. Note that you can use either GPG Agent or
 set the passphrase in the site config, you need not do both.
+
+=cut
diff --git a/lib/RT/IR/DocIndex.pod b/lib/RT/IR/DocIndex.pod
index 9f5db65..5ff5011 100644
--- a/lib/RT/IR/DocIndex.pod
+++ b/lib/RT/IR/DocIndex.pod
@@ -18,7 +18,7 @@ Mailgate help: rt/bin/rt-mailgate --help
 
 =head3 Encrypting Mail with GnuPG
 
-See L<RT::Crypt::GnuPg> and L<AdministrationTutorial/GnuPG Encryption>
+See L<RT::Crypt::GnuPG> and L<AdministrationTutorial/GnuPG Encryption>
 
 =head3 Create new block via web-interface
 

commit b195e16e254b9d64c746a18e38c9a6806e61a55c
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Oct 11 14:44:28 2011 +0400

    drop actions that change Due on IRs, Invs and Blocks
    
    we keep code that syncs Inc's due with its children,
    but for other queues we swtich over SLA extension

diff --git a/etc/initialdata b/etc/initialdata
index b7f8aa0..a9d4eb4 100644
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -172,39 +172,10 @@
 );
 
 @ScripActions = (
-
-    {  Name        => 'RTIR Set Due to Now',    # loc
-       Description => 'Set the due date to the current time' ,                                            # loc
-       ExecModule => 'RTIR_SetDueToNow',
-    },
-    {  Name        => 'RTIR Set Starts to Now',    # loc
-       Description => 'Set the starts date to the current time' ,                                            # loc
-       ExecModule => 'RTIR_SetStartsToNow',
-    },
-    {  Name        => 'RTIR Set Due by SLA',    # loc
-       Description => 'Set the due date according to SLA' ,                                            # loc
-       ExecModule => 'RTIR_SetDueBySLA',
-    },
-    {  Name        => 'RTIR Set Due Correspond',    # loc
-       Description => 'Set the due date for correspondence' ,                                            # loc
-       ExecModule => 'RTIR_SetDueCorrespond',
-    },
-    {  Name        => 'RTIR Set Due Reopen',    # loc
-       Description => 'Set the due date for a reopened ticket' ,                                            # loc
-       ExecModule => 'RTIR_SetDueReopen',
-    },
     {  Name        => 'RTIR Set Incident Due',    # loc
        Description => 'Set the due date of parent Incident' ,                                            # loc
        ExecModule => 'RTIR_SetDueIncident',
     },
-    {  Name        => 'RTIR Unset Due',    # loc
-       Description => 'Unset the due date' ,                                            # loc
-       ExecModule => 'RTIR_UnsetDue',
-    },
-    {  Name        => 'RTIR Set Starts by Business Hours',    # loc
-       Description => 'Set the starts date according to Business Hours' ,                                            # loc
-       ExecModule => 'RTIR_SetStartsByBizHours',
-    },
     {  Name        => 'RTIR Set How Reported',    # loc
        Description => 'Set how the Incident Report was reported' ,                                            # loc
        ExecModule => 'RTIR_SetHowReported',
@@ -312,74 +283,6 @@
 );
 
 @Scrips = (
-    {  Description       => "DetectUserResponse",
-       Queue             => [ 'Incident Reports', 'Investigations', 'Blocks' ],
-       ScripCondition    => 'RTIR Customer Response',
-       ScripAction       => 'RTIR Set Due to Now',
-       Template          => 'Blank' },
-
-    {  Description       => "DetectStaffResponse",
-       Queue             => [ 'Incident Reports', 'Investigations', 'Blocks' ],
-       ScripCondition    => 'RTIR Staff Response',
-       ScripAction       => 'RTIR Set Due Correspond',
-       Template          => 'Blank' },
-
-    {  Description       => "SetStartsDate",
-       Queue             => 'Incidents',
-       ScripCondition    => 'On Create',
-       ScripAction       => 'RTIR Set Starts to Now',
-       Template          => 'Blank' },
-    {  Description       => "SetStarts",
-       Queue             => [ 'Incident Reports', 'Investigations', 'Blocks' ],
-       ScripCondition    => 'On Create',
-       ScripAction       => 'RTIR Set Starts by Business Hours',
-       Template          => 'Blank' },
-
-    {  Description       => "SetStartsDateOnQueueChange",
-       Queue             => 'Incidents',
-       ScripCondition    => 'On Queue Change',
-       ScripAction       => 'RTIR Set Starts to Now',
-       Template          => 'Blank' },
-    {  Description       => "SetStartsDateOnQueueChange",
-       Queue             => [ 'Incident Reports', 'Investigations', 'Blocks' ],
-       ScripCondition    => 'On Queue Change',
-       ScripAction       => 'RTIR Set Starts by Business Hours',
-       Template          => 'Blank' },
-
-    {  Description       => "SetDue",
-       Queue             => 'Incident Reports',
-       ScripCondition    => 'On Create',
-       ScripAction       => 'RTIR Set Due by SLA',
-       Template          => 'Blank' },
-    {  Description       => "SetDue",
-       Queue             => [ 'Investigations', 'Blocks' ],
-       ScripCondition    => 'On Create',
-       ScripAction       => 'RTIR Set Due Correspond',
-       Template          => 'Blank' },
-
-    {  Description       => "SetDueOnQueueChange",
-       Queue             => 'Incident Reports',
-       ScripCondition    => 'On Queue Change',
-       ScripAction       => 'RTIR Set Due by SLA',
-       Template          => 'Blank' },
-    {  Description       => "SetDueOnQueueChange",
-       Queue             => [ 'Investigations', 'Blocks' ],
-       ScripCondition    => 'On Queue Change',
-       ScripAction       => 'RTIR Set Due Correspond',
-       Template          => 'Blank' },
-
-    {  Description       => "UnsetDue",
-       Queue             => [ 'Incident Reports', 'Investigations', 'Blocks' ],
-       ScripCondition    => 'RTIR Close Ticket',
-       ScripAction       => 'RTIR Unset Due',
-       Template          => 'Blank' },
-
-    {  Description       => "SetDueReopen",
-       Queue             => [ 'Incident Reports', 'Investigations', 'Blocks' ],
-       ScripCondition    => 'RTIR Reopen Ticket',
-       ScripAction       => 'RTIR Set Due Reopen',
-       Template          => 'Blank' },
-
     {  Description       => "SetHowReported",
        Queue             => 'Incident Reports',
        ScripCondition    => 'On Create',
diff --git a/etc/upgrade/2.9.0/content b/etc/upgrade/2.9.0/content
index af1b96f..604b0ed 100644
--- a/etc/upgrade/2.9.0/content
+++ b/etc/upgrade/2.9.0/content
@@ -309,14 +309,23 @@ our @Final = (
     sub {
         # started date is handled by lifecycles now
         remove_scrip_action('RTIR_SetStartedToNow');
+
         # IRs and Blocks has some special status treatment, but
         # it is handled by other scrips
         remove_scrip_action('RTIR_SetIncidentReportState');
         remove_scrip_action('RTIR_SetBlockState');
+
         # Investigations and Incidents don't need special status
         # treatment, it was only sync with State CF
         remove_scrip_action('RTIR_SetInvestigationState');
         remove_scrip_action('RTIR_SetIncidentState');
+
+        # SLA extension has saner Due management
+        remove_scrip_action('RTIR_SetDueBySLA');
+        remove_scrip_action('RTIR_SetDueCorrespond');
+        remove_scrip_action('RTIR_SetDueReopen');
+        remove_scrip_action('RTIR_SetDueToNow');
+        remove_scrip_action('RTIR_UnsetDue');
     },
 
     # remove no longer needed scrip conditions and scrips based on them
diff --git a/lib/RT/Action/RTIR_SetDueBySLA.pm b/lib/RT/Action/RTIR_SetDueBySLA.pm
deleted file mode 100644
index cdbb854..0000000
--- a/lib/RT/Action/RTIR_SetDueBySLA.pm
+++ /dev/null
@@ -1,94 +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::Action::RTIR_SetDueBySLA;
-use base 'RT::Action::RTIR';
-
-
-=head2 Commit
-
-Look up the SLA and set the Due date accordingly.
-
-=cut
-
-sub Commit {
-    my $self = shift;
-    my $time = time;
-
-    # TODO: return if it isn't an Incident Report
-
-    # now that we know the SLA, set the value of the CF
-    unless ( $self->TicketObj->FirstCustomFieldValue('SLA') ) {
-        my $cf = RT::CustomField->new( $self->CurrentUser );
-        $cf->LoadByNameAndQueue( Queue => $self->TicketObj->Queue, Name => 'SLA' );
-        return unless $cf->id;
-
-        my $SLAObj = RT::IR::SLAInit();
-        my $sla = $SLAObj->SLA( $time );
-
-        $self->TicketObj->AddCustomFieldValue( Field => $cf->id, Value => $sla );
-
-    }
-
-    # set the due date
-    my $SLAObj = RT::IR::SLAInit();
-
-    # TODO: specify a start date, but default to now
-    my $due = $SLAObj->Due( $time, $SLAObj->SLA( $time ) );
-
-    my $date = RT::Date->new( RT->SystemUser );
-    $date->Set( Format => 'unix', Value => $due );
-    $self->TicketObj->SetDue( $date->ISO );
-
-    return 1;
-}
-
-RT::Base->_ImportOverlays;
-
-1;
diff --git a/lib/RT/Action/RTIR_SetDueCorrespond.pm b/lib/RT/Action/RTIR_SetDueCorrespond.pm
deleted file mode 100644
index 8337213..0000000
--- a/lib/RT/Action/RTIR_SetDueCorrespond.pm
+++ /dev/null
@@ -1,81 +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::Action::RTIR_SetDueCorrespond;
-use base 'RT::Action::RTIR';
-
-
-=head2 Commit
-
-Look up the SLA and set the Due date to the configured 
-(on the queue or global) Due date, defaulting to 7 business
-days from now.
-
-=cut
-
-sub Commit {
-    my $self = shift;
-
-    my $bizhours = RT::IR::BusinessHours();
-	
-    my $date = RT::Date->new( RT->SystemUser );
-    my $due = ( $self->TicketObj->QueueObj->DefaultDueIn || (RT->Config->Get('OverdueAfter')) || 7 ) ;
-    $date->SetToNow;
-    $date->AddDays( $due );
-
-    $due = $bizhours->first_after( $date->Unix );
-    $date->Set( Format => 'unix', Value => $due );
-    $self->TicketObj->SetDue( $date->ISO );
-
-    return 1;
-}
-
-RT::Base->_ImportOverlays;
-
-1;
diff --git a/lib/RT/Action/RTIR_SetDueReopen.pm b/lib/RT/Action/RTIR_SetDueReopen.pm
deleted file mode 100644
index 220b6ba..0000000
--- a/lib/RT/Action/RTIR_SetDueReopen.pm
+++ /dev/null
@@ -1,87 +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::Action::RTIR_SetDueReopen;
-use base 'RT::Action::RTIR';
-
-
-=head2 Commit
-
-Set the Due date based on the SLA_Reopen_(In|OutOf)Hours settings
-
-=cut
-
-sub Commit {
-    my $self = shift;
-
-    # create a new SLA object
-    my $SLAObj = RT::IR::SLAInit();
-
-    # Set the defaults from the RTIR_Config.pm file
-    $SLAObj->SetInHoursDefault( RT->Config->Get('SLA_Reopen_InHours') );
-    $SLAObj->SetOutOfHoursDefault( RT->Config->Get('SLA_Reopen_OutOfHours') );
-
-    # set the Business::Hours
-    my $bh = RT::IR::BusinessHours();
-    $SLAObj->SetBusinessHours( $bh );
-
-    # get the due date
-    my $time = time;
-    my $due = $SLAObj->Due( $time, $SLAObj->SLA( $time ) );
-
-    my $date = RT::Date->new( RT->SystemUser );
-    $date->Set( Format => 'unix', Value => $due );
-    $self->TicketObj->SetDue( $date->ISO );
-
-    return 1;
-}
-
-RT::Base->_ImportOverlays;
-
-1;
diff --git a/lib/RT/Action/RTIR_SetDueToNow.pm b/lib/RT/Action/RTIR_SetDueToNow.pm
deleted file mode 100644
index 53ad519..0000000
--- a/lib/RT/Action/RTIR_SetDueToNow.pm
+++ /dev/null
@@ -1,93 +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::Action::RTIR_SetDueToNow;
-use base 'RT::Action::RTIR';
-
-=head1 NAME
-
-RT::Action::RTIR_SetDueToNow - set due date to now
-
-=head1 DESCRIPTION
-
-Set Due date of a ticket to now.
-
-=head1 METHODS
-
-=head2 Commit
-
-Set the Due date based on your SLA_Response settings
-
-=cut
-
-sub Commit {
-    my $self = shift;
-
-    my $SLAObj = RT::IR::SLAInit();
-    $SLAObj->SetInHoursDefault(RT->Config->Get('SLA_Response_InHours'));
-    $SLAObj->SetOutOfHoursDefault(RT->Config->Get('SLA_Response_OutOfHours'));
-    $SLAObj->SetBusinessHours( RT::IR::BusinessHours() );
-
-    # get the due date
-    my $time = time;
-    my $due = $SLAObj->Due( $time, $SLAObj->SLA( $time ) );
-
-    my $date = RT::Date->new(RT->SystemUser);
-    $date->Set( Format => 'unix', Value => $due );
-    my ($status, $msg) = $self->TicketObj->SetDue( $date->ISO );
-    RT->Logger->error($msg) unless $status;
-
-    RT->Logger->debug( "Set Due to now: ". $date->ISO );
-
-    return 1;
-}
-
-RT::Base->_ImportOverlays;
-
-1;
diff --git a/lib/RT/Action/RTIR_UnsetDue.pm b/lib/RT/Action/RTIR_UnsetDue.pm
deleted file mode 100644
index 143ba74..0000000
--- a/lib/RT/Action/RTIR_UnsetDue.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::Action::RTIR_UnsetDue;
-use base 'RT::Action::RTIR';
-
-=head2 Commit
-
-Set the Due date accordingly.
-
-=cut
-
-sub Commit {
-    my $self = shift;
-
-    my $date = RT::Date->new(RT->SystemUser);
-    $date->Set(Format => 'unix', Value=> 0);
-    $self->TicketObj->SetDue( $date->ISO );
-
-    return 1;
-}
-
-RT::Base->_ImportOverlays;
-
-1;

commit 8c106d7fb14aa8d92d4676f0202aa0334ea63d39
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Oct 11 14:48:51 2011 +0400

    delete SLAs related code in RT::IR

diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index 47f5b69..e53ea66 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -79,65 +79,6 @@ my $ticket_sql_parser = Parse::BooleanLogic->new;
 
 =head1 FUNCTIONS
 
-=head2 BusinessHours
-
-Returns L<Business::Hours> object initilized with information from
-the config file. See option 'BusinessHours'.
-
-=cut
-
-sub BusinessHours {
-    my $bizhours = new Business::Hours;
-    if ( RT->Config->Get('BusinessHours') ) {
-        $bizhours->business_hours( %{ RT->Config->Get('BusinessHours') } );
-    }
-
-    return $bizhours;
-}
-
-=head2 DefaultSLA
-
-TODO: Not yet described.
-
-=cut
-
-sub DefaultSLA {
-    my $SLAObj = SLAInit();
-    return $SLAObj->SLA( time );
-}
-
-=head2 SLAInit
-
-Returns an object of L<Business::SLA> class or class defined in SLAModule
-config option.
-
-See also the following options: SLAModule, RTIR_CustomFieldsDefaults and SLA.
-
-=cut
-
-sub SLAInit {
-
-    my $class = RT->Config->Get('SLAModule') || 'Business::SLA';
-
-    my $SLAObj = $class->new();
-    $SLAObj->SetInHoursDefault( RT->Config->Get('RTIR_CustomFieldsDefaults')->{'SLA'}{'InHours'} );
-    $SLAObj->SetOutOfHoursDefault( RT->Config->Get('RTIR_CustomFieldsDefaults')->{'SLA'}{'OutOfHours'} );
-
-    my $bh = RT::IR::BusinessHours();
-    $SLAObj->SetBusinessHours($bh);
-
-    my $SLA = RT->Config->Get('SLA');
-    foreach my $key( keys %$SLA ) {
-        if ( $SLA->{ $key } =~ /^\d+$/ ) {
-            $SLAObj->Add( $key, ( BusinessMinutes => $SLA->{ $key } ) );
-        } else {
-            $SLAObj->Add( $key, %{ $SLA->{ $key } } );
-        }
-    }
-
-    return $SLAObj;
-}
-
 =head2 OurQueue
 
 Takes queue name or L<RT::Queue> object and returns its type

commit e922dc67df649b1b1e55a717b29e1200111c2c5b
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Oct 11 14:49:26 2011 +0400

    delete SLA options we have in RTIR

diff --git a/etc/RTIR_Config.pm b/etc/RTIR_Config.pm
index 9716036..04ef559 100644
--- a/etc/RTIR_Config.pm
+++ b/etc/RTIR_Config.pm
@@ -622,71 +622,6 @@ Set($RunWhoisRequestByDefault, 0);
 RTIR comes with very basic SLA implementation. Depending on the following
 options Due date of tickets is maintained.
 
-=over 4
-
-=item C<$SLAModule>
-
-Set the name of the Business::SLA class. Use this if you have
-a custom SLA module, for example:
-
-    Set($SLAModule, 'Business::MySLA');
-
-=cut
-
-Set($SLAModule, '');
-
-=item C<$SLA>
-
-Define service levels and set the number of minutes.
-
-=cut
-
-Set($SLA, {
-    'Full service'               => { BusinessMinutes => 60,    RealMinutes => 0 },
-    'Full service: out of hours' => { BusinessMinutes => 120,   RealMinutes => 0 },
-    'Reduced service'            => { BusinessMinutes => 120,   RealMinutes => 0 },
-    'Now (in business hours)'    => { BusinessMinutes => 0,     RealMinutes => 0 },
-    '60 Real Minutes'            => { BusinessMinutes => undef, RealMinutes => 60 },
-} );
-
-=item C<$BusinessHours>
-
-Set the Business Hours for your organization, for example:
-
-    Set($BusinessHours, {
-        0 => { Name => 'Sunday', Start => undef, End => undef },
-        1 => { Name => 'Monday', Start => '09:00', End => '18:00' },
-        2 => { Name => 'Tuesday', Start => '09:00', End => '18:00' },
-        ...
-    } );
-
-If left unset, defaults are Monday through Friday 09:00 to 18:00
-
-=cut
-
-Set( $BusinessHours, undef );
-
-=item C<$SLA_Response_InHours> and C<$SLA_Response_OutOfHours>
-
-Set service levels for responses in business hours and out,
-correspondingly.
-
-=cut
-
-Set($SLA_Response_InHours,    'Now (in business hours)');
-Set($SLA_Response_OutOfHours, 'Now (in business hours)');
-
-=item C<$SLA_Reopen_InHours> and C<$SLA_Reopen_OutOfHours>
-
-Set service levels for tickets re-opened in business hours and out,
-correspondingly.
-
 =cut
 
-Set($SLA_Reopen_InHours,    'Full service');
-Set($SLA_Reopen_OutOfHours, 'Full service: out of hours');
-
-=back
-
-=cut
 1;

commit 39ae4776b828aee1eaf3f1648bd76665de1df442
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Oct 11 15:57:39 2011 +0400

    delete scrip actions that deal with Starts date

diff --git a/etc/upgrade/2.9.0/content b/etc/upgrade/2.9.0/content
index 604b0ed..e8d17d7 100644
--- a/etc/upgrade/2.9.0/content
+++ b/etc/upgrade/2.9.0/content
@@ -326,6 +326,8 @@ our @Final = (
         remove_scrip_action('RTIR_SetDueReopen');
         remove_scrip_action('RTIR_SetDueToNow');
         remove_scrip_action('RTIR_UnsetDue');
+        remove_scrip_action('RTIR_SetStartsByBizHours');
+        remove_scrip_action('RTIR_SetStartsToNow');
     },
 
     # remove no longer needed scrip conditions and scrips based on them
diff --git a/lib/RT/Action/RTIR_SetStartsByBizHours.pm b/lib/RT/Action/RTIR_SetStartsByBizHours.pm
deleted file mode 100644
index de8f1ca..0000000
--- a/lib/RT/Action/RTIR_SetStartsByBizHours.pm
+++ /dev/null
@@ -1,91 +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::Action::RTIR_SetStartsByBizHours;
-use base 'RT::Action::RTIR';
-
-=head2 Prepare
-
-Determine if the Starts date is already set.
-
-=cut
-
-sub Prepare {
-    my $self = shift;
-
-    if ($self->TicketObj->StartsObj->Unix > 0) {
-        return 0;
-    }
-    return 1;
-}
-
-=head2 Commit
-
-Look up the SLA and set the Starts date to the next time during Business Hours
-
-=cut
-
-sub Commit {
-    my $self = shift;
-
-    my $date = RT::Date->new(RT->SystemUser);
-    $date->SetToNow;
-
-    my $bizhours = RT::IR::BusinessHours();
-
-    my $starts = $bizhours->first_after($date->Unix);
-    $date->Set(Format => 'unix', Value => $starts);
-    $self->TicketObj->SetStarts($date->ISO);
-
-    return 1;
-}
-
-RT::Base->_ImportOverlays;
-
-1;
diff --git a/lib/RT/Action/RTIR_SetStartsToNow.pm b/lib/RT/Action/RTIR_SetStartsToNow.pm
deleted file mode 100644
index 8d8047e..0000000
--- a/lib/RT/Action/RTIR_SetStartsToNow.pm
+++ /dev/null
@@ -1,93 +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::Action::RTIR_SetStartsToNow;
-use base 'RT::Action::RTIR';
-
-=head2 Prepare
-
-Determine if the Starts date is already set.
-
-=cut
-
-sub Prepare {
-    my $self = shift;
-
-    # if triggered by a "Set Starts" transaction, return 0
-    if ($self->TransactionObj->Type eq 'Set' &&
-        $self->TransactionObj->Field eq 'Starts')
-    {
-        return 0;
-    }
-
-    # set if the Starts value isn't already set
-    return 0 if $self->TicketObj->StartsObj->Unix > 0;
-
-    return 1;
-}
-
-=head2 Commit
-
-Set the Starts date to now.
-
-=cut
-
-sub Commit {
-    my $self = shift;
-
-    my $date = RT::Date->new(RT->SystemUser);
-    $date->SetToNow;
-    $self->TicketObj->SetStarts($date->ISO);
-
-    return 1;
-}
-
-RT::Base->_ImportOverlays;
-
-1;

commit 466d6e29ab155b7f887efb4c374ad7fc6e01a5ee
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Oct 11 15:58:29 2011 +0400

    test that Incident inherits Due date properly

diff --git a/t/dates/due-incidents.t b/t/dates/due-incidents.t
new file mode 100644
index 0000000..98bd6ad
--- /dev/null
+++ b/t/dates/due-incidents.t
@@ -0,0 +1,192 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use RT::IR::Test tests => 50;
+
+# link on create without due
+{
+    my $ir1 = RT::Ticket->new( RT->SystemUser );
+    my ($id, undef, $msg) = $ir1->Create(
+        Queue => 'Incident Reports',
+        Subject => 'IR1',
+    );
+    ok $id, 'created a ticket' or diag "error: $msg";
+    is $ir1->DueObj->Unix, 0;
+
+    my $inc = RT::Ticket->new( RT->SystemUser );
+    ($id, undef, $msg) = $inc->Create(
+        Queue => 'Incidents',
+        Subject => 'inc',
+        HasMember => $ir1->URI,
+    );
+    ok $id, 'created a ticket' or diag "error: $msg";
+    is $inc->DueObj->Unix, 0;
+}
+
+# link after create without due
+{
+    my $ir1 = RT::Ticket->new( RT->SystemUser );
+    my ($id, undef, $msg) = $ir1->Create(
+        Queue => 'Incident Reports',
+        Subject => 'IR1',
+    );
+    ok $id, 'created a ticket' or diag "error: $msg";
+    is $ir1->DueObj->Unix, 0;
+
+    my $inc = RT::Ticket->new( RT->SystemUser );
+    ($id, undef, $msg) = $inc->Create(
+        Queue => 'Incidents',
+        Subject => 'inc',
+    );
+    ok $id, 'created a ticket' or diag "error: $msg";
+
+    (my $status, $msg) = $ir1->AddLink( Type => 'MemberOf', Target => $inc->id );
+    ok $status, 'linked tickets' or diag "error: $msg";
+
+    is $inc->DueObj->Unix, 0;
+}
+
+# link on create with due
+{
+    my $ir1 = RT::Ticket->new( RT->SystemUser );
+    my ($id, undef, $msg) = $ir1->Create(
+        Queue => 'Incident Reports',
+        Subject => 'IR1',
+        Due => '2011-10-23 16:47:45',
+    );
+    ok $id, 'created a ticket' or diag "error: $msg";
+    is $ir1->DueObj->ISO, '2011-10-23 16:47:45';
+
+    my $inc = RT::Ticket->new( RT->SystemUser );
+    ($id, undef, $msg) = $inc->Create(
+        Queue => 'Incidents',
+        Subject => 'inc',
+        HasMember => $ir1->URI,
+    );
+    ok $id, 'created a ticket' or diag "error: $msg";
+    is $inc->DueObj->ISO, $ir1->DueObj->ISO;
+}
+
+# link after create with due
+{
+    my $ir1 = RT::Ticket->new( RT->SystemUser );
+    my ($id, undef, $msg) = $ir1->Create(
+        Queue => 'Incident Reports',
+        Subject => 'IR1',
+        Due => '2011-10-23 16:47:45',
+    );
+    ok $id, 'created a ticket' or diag "error: $msg";
+    is $ir1->DueObj->ISO, '2011-10-23 16:47:45';
+
+    my $inc = RT::Ticket->new( RT->SystemUser );
+    ($id, undef, $msg) = $inc->Create(
+        Queue => 'Incidents',
+        Subject => 'inc',
+    );
+    ok $id, 'created a ticket' or diag "error: $msg";
+
+    (my $status, $msg) = $ir1->AddLink( Type => 'MemberOf', Target => $inc->id );
+    ok $status, 'linked tickets' or diag "error: $msg";
+
+    $inc->Load( $inc->id ); # reload
+    is $inc->DueObj->ISO, $ir1->DueObj->ISO;
+}
+
+# change Due after linking
+{
+    my $ir1 = RT::Ticket->new( RT->SystemUser );
+    my ($id, undef, $msg) = $ir1->Create(
+        Queue => 'Incident Reports',
+        Subject => 'IR1',
+    );
+    ok $id, 'created a ticket' or diag "error: $msg";
+
+    my $inc = RT::Ticket->new( RT->SystemUser );
+    ($id, undef, $msg) = $inc->Create(
+        Queue => 'Incidents',
+        Subject => 'inc',
+        HasMember => $ir1->URI,
+    );
+    ok $id, 'created a ticket' or diag "error: $msg";
+    is $inc->DueObj->Unix, 0;
+
+    (my $status, $msg) = $ir1->SetDue('2011-10-23 16:47:45');
+    ok $status, "updated due on IR";
+    is $ir1->DueObj->ISO, '2011-10-23 16:47:45';
+
+    $inc->Load( $inc->id ); # reload
+    is $inc->DueObj->ISO, $ir1->DueObj->ISO;
+
+    ($status, $msg) = $ir1->SetDue('2011-11-23 16:47:45');
+    ok $status, "updated due on IR";
+    is $ir1->DueObj->ISO, '2011-11-23 16:47:45';
+
+    $inc->Load( $inc->id ); # reload
+    is $inc->DueObj->ISO, $ir1->DueObj->ISO;
+
+    ($status, $msg) = $ir1->SetDue('2011-09-23 16:47:45');
+    ok $status, "updated due on IR";
+    is $ir1->DueObj->ISO, '2011-09-23 16:47:45';
+
+    $inc->Load( $inc->id ); # reload
+    is $inc->DueObj->ISO, $ir1->DueObj->ISO;
+
+    ($status, $msg) = $ir1->SetDue('1970-01-01 00:00:00');
+    ok $status, "updated due on IR";
+    is $ir1->DueObj->ISO, '1970-01-01 00:00:00';
+
+    $inc->Load( $inc->id ); # reload
+    is $inc->DueObj->ISO, $ir1->DueObj->ISO;
+}
+
+# two IRs linked to Inc, play with Due
+{
+    my $ir1 = RT::Ticket->new( RT->SystemUser );
+    my ($id, undef, $msg) = $ir1->Create(
+        Queue => 'Incident Reports',
+        Subject => 'IR1',
+        Due => '2011-10-23 16:47:45',
+    );
+    ok $id, 'created a ticket' or diag "error: $msg";
+    is $ir1->DueObj->ISO, '2011-10-23 16:47:45';
+
+    my $ir2 = RT::Ticket->new( RT->SystemUser );
+    ($id, undef, $msg) = $ir2->Create(
+        Queue => 'Incident Reports',
+        Subject => 'IR2',
+        Due => '2011-10-24 16:47:45',
+    );
+    ok $id, 'created a ticket' or diag "error: $msg";
+    is $ir2->DueObj->ISO, '2011-10-24 16:47:45';
+
+    my $inc = RT::Ticket->new( RT->SystemUser );
+    ($id, undef, $msg) = $inc->Create(
+        Queue => 'Incidents',
+        Subject => 'inc',
+        HasMember => [$ir1->URI, $ir2->URI],
+    );
+    ok $id, 'created a ticket' or diag "error: $msg";
+    is $inc->DueObj->ISO, $ir1->DueObj->ISO;
+
+    (my $status, $msg) = $ir2->SetDue('2011-10-25 16:47:45');
+    ok $status, "updated due on IR";
+    is $ir2->DueObj->ISO, '2011-10-25 16:47:45';
+
+    $inc->Load( $inc->id ); # reload
+    is $inc->DueObj->ISO, $ir1->DueObj->ISO;
+
+    ($status, $msg) = $ir2->SetDue('2011-10-22 16:47:45');
+    ok $status, "updated due on IR";
+    is $ir2->DueObj->ISO, '2011-10-22 16:47:45';
+
+    $inc->Load( $inc->id ); # reload
+    is $inc->DueObj->ISO, $ir2->DueObj->ISO;
+
+    ($status, $msg) = $ir2->SetStatus('resolved');
+    ok $status, "updated status on IR";
+
+    $inc->Load( $inc->id ); # reload
+    is $inc->DueObj->ISO, $ir1->DueObj->ISO;
+}

commit f5d1f1973c43c35f98ae3024b255907176bf5d38
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Oct 11 16:01:58 2011 +0400

    don't create SLA CF out of the box
    
    we want RTx::SLA to take care of that

diff --git a/etc/initialdata b/etc/initialdata
index a9d4eb4..612faae 100644
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -61,18 +61,6 @@
         ],
     },
     {
-        Name        => 'SLA',
-        Type        => 'SelectSingle',
-        Queue       => 'Incident Reports',
-        Disabled    => 0,
-        Description => 'SLA for Incident Reports RTIR queue',
-        Values      => [
-            { Name => 'Full service',               SortOrder => 1 },
-            { Name => 'Full service: out of hours', SortOrder => 2 },
-            { Name => 'Reduced service',            SortOrder => 3 },
-        ],
-    },
-    {
         Name        => 'Function',
         Type        => 'SelectSingle',
         Queue       => 'Incidents',

commit a653698906b54a0e4082579723c1a2709e00bd9d
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Oct 11 16:02:52 2011 +0400

    RTIR's config has no special SLA options

diff --git a/html/RTIR/Elements/EditCustomFields b/html/RTIR/Elements/EditCustomFields
index cba91f0..2bc65a1 100644
--- a/html/RTIR/Elements/EditCustomFields
+++ b/html/RTIR/Elements/EditCustomFields
@@ -51,12 +51,8 @@ unless ( $TicketObj && $TicketObj->Id ) {
         if ( $ARGS{"$name-Value"} ) {
             $ARGS{"CustomField-".$CustomField->Id} = $ARGS{"$name-Value"};
         }
-        elsif ( $name eq 'SLA' ) {
-            $ARGS{"CustomField-".$CustomField->Id} = RT::IR::DefaultSLA();
-        }
         elsif ( defined $Defaults{ $name } ) {
-# if $Defaults{$name} is ref, it should be treated carefully, like the 'SLA'
-# above
+# if $Defaults{$name} is ref, it should be treated carefully
             unless ( ref $Defaults{ $name } ) {
                 $ARGS{"CustomField-".$CustomField->Id} = $Defaults{ $name };
             }

commit 6ecb6c3b8a907880c8bd96f18740c50b795279ec
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Oct 11 16:10:02 2011 +0400

    update todo

diff --git a/TODO.porting_over_RT4 b/TODO.porting_over_RT4
index c19f3cc..f17c918 100644
--- a/TODO.porting_over_RT4
+++ b/TODO.porting_over_RT4
@@ -1,3 +1,13 @@
+=== DOCS
+
+* UPGRADING-TO-3.0.0
+
+* walk through every change in etc/upgrade/2.9.0/content and
+  make sure documention for upgrading references everything
+
+* document how to switch over SLA extension, document Due
+  rules for incidents
+
 === FEATURES
 
 * Split incident: select which IRs, Invs, Blocks go where
@@ -16,12 +26,16 @@
 
 * Some pages with forms need new nice layouts like in RT, reply
   page comes first to mind
+** go over most common pages and look at layouts
 
 === CLEANUP && REFACTORING
 
 * stop abusing $session{'tickets'} so we can get working
   First, Prev, Next and Last links in RTIR.
 
+=== FIXES
+
+* html/RTIR/Reporting/Report.html references SLA
 
 === TESTS
 

commit 495072c7fee7d0f97190402223386939461b8abe
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Oct 11 18:16:21 2011 +0400

    delete Due tests that were checking old SLA implementation

diff --git a/t/dates/due-basic.t b/t/dates/due-basic.t
deleted file mode 100644
index 74419c5..0000000
--- a/t/dates/due-basic.t
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use RT::IR::Test tests => 14;
-
-my $duty_a = RT::Test->load_or_create_user(
-    Name       => 'duty a',
-    Password   => 'password',
-    MemberOf   => 'DutyTeam',
-);
-
-my $duty_b = RT::Test->load_or_create_user(
-    Name       => 'duty b',
-    Password   => 'password',
-    MemberOf   => 'DutyTeam',
-);
-
-my $customer = RT::Test->load_or_create_user(
-    Name       => 'customer',
-    Password   => 'password',
-);
-
-{
-    my $ticket = RT::Ticket->new( $duty_a );
-    my ($id, undef, $msg) = $ticket->Create(
-        Queue => 'Incident Reports',
-        Owner => $duty_a->id,
-        Requestor => $customer->id,
-    );
-    ok $id, 'created a ticket' or diag "error: $msg";
-
-    $ticket->Load( $id );
-    is $ticket->id, $id, 'loaded ticket';
-    is $ticket->Owner, $duty_a->id, 'correct owner';
-    ok $ticket->Due, 'due value';
-    # XXX: need something better
-    ok $ticket->DueObj->Unix > time, 'in the future';
-
-    { # duty_b replies
-        my $ticket = RT::Ticket->new( $duty_b );
-        $ticket->Load($id);
-        ok $ticket->id, 'laoded ticket';
-        my ($status, $msg) = $ticket->Correspond( Content => 'hey ho!' );
-        ok $status, 'replied' or diag "error: $msg";
-        ok $ticket->DueObj->Unix > time, 'in the future';
-    }
-
-    { # customer replies
-        my $ticket = RT::Ticket->new( $customer );
-        $ticket->Load($id);
-        ok $ticket->id, 'laoded ticket';
-        my ($status, $msg) = $ticket->Correspond( Content => 'hey ho!' );
-        ok $status, 'replied' or diag "error: $msg";
-        ok $ticket->DueObj->Unix < time, 'in the future';
-    }
-}
-

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


More information about the Rt-commit mailing list