[Rt-commit] rtir branch, 5.0/set-sla-by-priority, repushed

Craig Kaiser craig at bestpractical.com
Wed Jun 3 16:40:50 EDT 2020


The branch 5.0/set-sla-by-priority was deleted and repushed:
       was c033b3cd6778fd2d870b856318472c95d0629955
       now 21ce96d8754134fec5d7798ae34786cbf77a2376

1: 252ca887 < -:  ------- Create custom field 'Severity'
2: c033b3cd ! 1: 21ce96d8 Set SLA based on priority on priority change
    @@ -15,14 +15,11 @@
     +updated the corresponding SLA will be set. This feature will only be enabled
     +when a priority value matches to an SLA value.
     +
    -+Using priority as string is fine so long as the numeric value of the string matches
    -+the config value for C<%RTIR_PriorityToSLA>.
    -+
    -+Set(%RTIR_PriorityToSLA,
    -+    0      => 'normal',
    -+    50     => 'high',
    -+    100    => 'urgent'
    -+);
    ++    Set(%RTIR_PriorityToSLA,
    ++        Low        => 'normal',
    ++        Medium     => 'high',
    ++        100        => 'urgent'
    ++    );
     +
     +=cut
     +
    @@ -38,7 +35,7 @@
     +    },
     +    {   Name => 'RTIR Set SLA Based On Priority',
     +        Description => '',
    -+        ExecModule => 'RTIR_SetSLA'
    ++        ExecModule => 'RTIR_SetSLAFromPriority'
          }
      );
      
    @@ -49,7 +46,7 @@
     +    {   Name                 => 'RTIR On Priority Change',           # loc
     +        Description          => "Whenever priority changes", # loc
     +        ApplicableTransTypes => 'Any',
    -+        ExecModule           => 'RTIR_PriorityChange',
    ++        ExecModule           => 'RTIR_CreateOrPriorityChange',
     +    },
      );
      
    @@ -70,17 +67,63 @@
      );
      
     
    -diff --git a/lib/RT/Action/RTIR_SetSLA.pm b/lib/RT/Action/RTIR_SetSLA.pm
    +diff --git a/lib/RT/Action/RTIR_SetSLAFromPriority.pm b/lib/RT/Action/RTIR_SetSLAFromPriority.pm
     new file mode 100644
     --- /dev/null
    -+++ b/lib/RT/Action/RTIR_SetSLA.pm
    -@@
    ++++ b/lib/RT/Action/RTIR_SetSLAFromPriority.pm
    +@@
    ++# BEGIN BPS TAGGED BLOCK {{{
    ++#
    ++# COPYRIGHT:
    ++#
    ++# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
    ++#                                          <sales 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., 51 Franklin Street, Fifth Floor, Boston, MA
    ++# 02110-1301 or visit their web page on the internet at
    ++# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
    ++#
    ++#
    ++# 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 }}}
    ++
    ++package RT::Action::RTIR_SetSLAFromPriority;
     +use strict;
     +use warnings;
    -+
    -+package RT::Action::RTIR_SetSLA;
    -+
    -+use base qw(RT::Action::SLA);
    ++use base 'RT::Action::RTIR';
     +
     +=head2 Prepare
     +
    @@ -101,8 +144,15 @@
     +
     +    my $priority_to_sla = RT::Config->Get( 'RTIR_PriorityToSLA' ) || ();
     +
    -+    if ( $priority_to_sla->{ $self->TicketObj->Priority } ) {
    -+        my ($ret, $msg) = $self->TicketObj->SetSLA( $priority_to_sla->{ $self->TicketObj->Priority } );
    ++    my $sla = $priority_to_sla->{ $self->TicketObj->Priority} || $priority_to_sla->{ $self->TicketObj->PriorityAsString};
    ++
    ++    if ( $sla ) {
    ++        # Nothing to do
    ++        if ( $self->TicketObj->SLA && $self->TicketObj->SLA eq $sla ) {
    ++            return 1;
    ++        }
    ++
    ++        my ($ret, $msg) = $self->TicketObj->SetSLA( $sla );
     +        RT::Logger->error( "Could not set ticket SLA from priority: $msg" ) unless $ret;
     +        return $ret;
     +    }
    @@ -111,19 +161,64 @@
     +
     +1;
     
    -diff --git a/lib/RT/Condition/RTIR_PriorityChange.pm b/lib/RT/Condition/RTIR_PriorityChange.pm
    +diff --git a/lib/RT/Condition/RTIR_CreateOrPriorityChange.pm b/lib/RT/Condition/RTIR_CreateOrPriorityChange.pm
     new file mode 100644
     --- /dev/null
    -+++ b/lib/RT/Condition/RTIR_PriorityChange.pm
    -@@
    -+package RT::Condition::RTIR_PriorityChange;
    -+
    -+use base 'RT::Condition';
    -+
    ++++ b/lib/RT/Condition/RTIR_CreateOrPriorityChange.pm
    +@@
    ++# BEGIN BPS TAGGED BLOCK {{{
    ++#
    ++# COPYRIGHT:
    ++#
    ++# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
    ++#                                          <sales 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., 51 Franklin Street, Fifth Floor, Boston, MA
    ++# 02110-1301 or visit their web page on the internet at
    ++# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
    ++#
    ++#
    ++# 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 }}}
    ++package RT::Condition::RTIR_CreateOrPriorityChange;
     +use strict;
     +use warnings;
    -+
    -+=head1 RTIR_PriorityChange
    ++use base 'RT::Condition::RTIR';
    ++
    ++=head1 RTIR_CreateOrPriorityChange
     +
     +Returns true when priority value is updated.
     +
    @@ -138,10 +233,10 @@
     +    }
     +    else {
     +        return unless $self->TransactionObj->Field eq 'Priority';
    -+        return unless $self->TransactionObj->NewValue;
     +        return 1;
     +    }
     +    return;
     +}
     +
     +1;
    ++



More information about the rt-commit mailing list