AnyReminderTransaction: Difference between revisions

From Request Tracker Wiki
Jump to navigation Jump to search
m (2 revisions imported)
(No difference)

Revision as of 15:03, 6 April 2016

Overview

This modification allows to associate scrips to the creation of a reminder.

Tested only on 3.6.3

How to set up AnyReminderTransaction in RT3:

1. Save the following code to /path/to/rt3/local/lib/RT/Condition/AnyReminderTransaction.pm

# BEGIN BPS TAGGED BLOCK {{{
 #
 # COPYRIGHT:
 #
 # Copyright (c) 2007 Revolution Linux, Inc
 # <mjeanson@revolutionlinux.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.
 #
 # END BPS TAGGED BLOCK }}}
 
 package RT::Condition::AnyReminderTransaction;
 require RT::Condition::Generic;
 
 use strict;
 use vars qw/@ISA/;
 @ISA = qw(RT::Condition::Generic);
 
 
 =head2 IsApplicable
 
 If the ticket object type is "reminder" return true, otherwise return false
 
 =cut
 
 sub IsApplicable {
     my $self = shift;
     if ($self->TicketObj->Type eq 'reminder') {
         return(1);
     }
     else {
         return(undef);
     }
 }
 
 eval "require RT::Condition::AnyReminderTransaction_Vendor";
 die $@ if ($@ && $@ !~ qr{^Can't locate RT/Condition/AnyReminderTransaction_Vendor.pm});
 eval "require RT::Condition::AnyReminderTransaction_Local";
 die $@ if ($@ && $@ !~ qr{^Can't locate RT/Condition/AnyReminderTransaction_Local.pm});
 
 1;
 
 
 

2. Save the following code in a datafile named AnyReminderTransaction.insert on your server:

@ScripConditions = (
    { Name                 => 'On Reminder Create',                       # loc
      Description          => 'When a reminder is created',               # loc
      ApplicableTransTypes => 'Create',
      ExecModule           => 'AnyReminderTransaction', },
);

3. Run the RT3 Setup Database tool specifying to insert the datafile just saved. This will create the ScripConditions in RT's database.

/path/to/rt3/sbin/rt-setup-database --action insert --datafile /path/to/AnyReminderTransaction.insert