[Rt-commit] rt branch, 4.2/rt-crontool-reminders, created. rt-4.1.8-265-gbb7cd30

Jim Brandt jbrandt at bestpractical.com
Fri May 10 16:04:42 EDT 2013


The branch, 4.2/rt-crontool-reminders has been created
        at  bb7cd30bc63ca0d7f788869a8a01a04073af6790 (commit)

- Log -----------------------------------------------------------------
commit 51d1d214a9a6c5fadc53833e8f9bb7ec2b32088b
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri May 10 14:39:38 2013 -0400

    Add AlwaysNotifyActor option for RT::Action::Notify
    
    Provide a way to force notifications even if they would be
    prevented by the NotifyActor setting. This is useful for automated
    notification jobs that might not send email as intended due to
    NotifyActor settings.

diff --git a/lib/RT/Action/Notify.pm b/lib/RT/Action/Notify.pm
index 0fc29c1..41a992b 100644
--- a/lib/RT/Action/Notify.pm
+++ b/lib/RT/Action/Notify.pm
@@ -71,8 +71,8 @@ sub Prepare {
 
 =head2 SetRecipients
 
-Sets the recipients of this meesage to Owner, Requestor, AdminCc, Cc or All. 
-Explicitly B<does not> notify the creator of the transaction by default
+Sets the recipients of this message to Owner, Requestor, AdminCc, Cc or All.
+Explicitly B<does not> notify the creator of the transaction by default.
 
 =cut
 
@@ -146,6 +146,15 @@ sub SetRecipients {
     }
 }
 
+=head2 RemoveInappropriateRecipients
+
+Remove transaction creator as appropriate for the NotifyActor setting.
+
+To send email to the selected receipients regardless of RT's NotifyActor
+configuration, include AlwaysNotifyActor in the list of arguments.
+
+=cut
+
 sub RemoveInappropriateRecipients {
     my $self = shift;
 
@@ -159,7 +168,8 @@ sub RemoveInappropriateRecipients {
             return unless lc $_[0] eq lc $creator;
             return "not sending to $creator, creator of the transaction, due to NotifyActor setting";
         },
-    ) unless RT->Config->Get('NotifyActor',$TransactionCurrentUser);
+    ) unless RT->Config->Get('NotifyActor',$TransactionCurrentUser)
+             || $self->Argument =~ /\bAlwaysNotifyActor\b/;
 
     $self->SUPER::RemoveInappropriateRecipients();
 }

commit bb7cd30bc63ca0d7f788869a8a01a04073af6790
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri May 10 14:23:53 2013 -0400

    Add new docs for reminders including rt-crontool example
    
    The reminder docs include an example of how to schedule automatic
    email for reminders using the included template and new
    AlwaysNotifyActor option. Docs added for RT::Action::BeforeDue
    since it is used in the example.

diff --git a/docs/reminders.pod b/docs/reminders.pod
new file mode 100644
index 0000000..6845203
--- /dev/null
+++ b/docs/reminders.pod
@@ -0,0 +1,68 @@
+=head1 Reminders
+
+Reminders can be attached to a ticket to notify you take some action
+on the ticket. Although there are fields like "Due" on tickets, some
+tickets have dependencies or sub-tasks that need to be completed before you
+can do the ticket. For a "Deploy New Certificate" ticket, for example, you may
+need to remind yourself to order the new cert first.
+
+Reminders are sort of mini-tickets and in fact they are implemented as
+tickets themselves.
+
+Each Reminder has:
+
+=over
+
+=item * Subject
+
+=item * Owner
+
+=item * Due date
+
+=item * Status (new, open, resolved, ...)
+
+=back
+
+=head1 Creating a Reminder
+
+Reminders are attached to tickets, so you create them in the Reminders section of
+the ticket display. Once you give it an Owner and a Due date, the Reminder will
+appear on the Owner's "At-a-glance" page by default.
+
+If you don't see reminders, it may be turned off. Display of reminders can be
+disabled with the C<$EnableReminders> flag in C<RT_SiteConfig.pm>. By default,
+reminders are turned on.
+
+=head1 Email Reminders
+
+While seeing reminders in the web display is handy, you may also want to send out
+email based on reminders that are due or are soon to be due. You can use the
+C<rt-crontool> utility to schedule a job to send these emails for you.
+
+To schedule the reminders, add a line like the following to your RT crontab:
+
+    0 6 * * * root /opt/rt4/bin/rt-crontool \
+                   --search RT::Search::FromSQL \
+                   --search-arg 'Type = "reminder" and (Status = "open" or Status = "new")' \
+                   --condition RT::Condition::BeforeDue \
+                   --condition-arg 2d \
+                   --action RT::Action::SendEmail \
+                   --action-arg Owner \
+                   --transaction first \
+                   --template 'Reminder'
+
+If you have modified the status values for reminders such that you have more
+active statuses than "open" and "new" you should add them as part of your
+"FromSQL" query. You typically
+won't want to send out email on "resolved" reminders, but you could add that
+to the query as well.
+
+The argument to C<RT::Condition::BeforeDue> is an amount of time in the form
+"1d2h3m4s" for 1 day and 2 hours and 3 minutes and 4 seconds. As shown in the
+example, single values can also be passed. The run frequency in your crontab
+should be consistent with the time period you set to avoid missing reminders.
+
+The template value refers to a Template in your RT system. You can use the
+default Reminder template or create your own in Tools > Configuration >
+Global > Templates > Create. You can look at the default template for some
+examples of the values you can use to populate the email.
diff --git a/etc/initialdata b/etc/initialdata
index 47a9b38..fef3680 100755
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -307,6 +307,18 @@ This is a comment.  It is not sent to the Requestor(s):
     },
 
     {  Queue       => '0',
+       Name        => 'Reminder',                           # loc
+       Description => 'Default reminder template',          # loc
+       Content     =>
+'Subject:{$Ticket->Subject} is due {$Ticket->DueObj->AsString}
+
+This reminder is for ticket #{$Target = $Ticket->RefersTo->First->TargetObj;$Target->Id}.
+
+{RT->Config->Get(\'WebURL\')}Ticket/Display.html?id={$Target->Id}
+'
+    },
+
+    {  Queue       => '0',
        Name        => 'Status Change',                                     # loc
        Description => 'Ticket status changed',                             # loc
        Content     => 'Subject: Status Changed to: {$Transaction->NewValue}
diff --git a/etc/upgrade/4.1.16/content b/etc/upgrade/4.1.16/content
new file mode 100644
index 0000000..a0ba3ce
--- /dev/null
+++ b/etc/upgrade/4.1.16/content
@@ -0,0 +1,13 @@
+ at Templates = (
+    {  Queue       => '0',
+       Name        => 'Reminder',                           # loc
+       Description => 'Default reminder template',          # loc
+       Content     =>
+'Subject:{$Ticket->Subject} is due {$Ticket->DueObj->AsString}
+
+This reminder is for ticket #{$Target = $Ticket->RefersTo->First->TargetObj;$Target->Id}.
+
+{RT->Config->Get(\'WebURL\')}Ticket/Display.html?id={$Target->Id}
+'
+    },
+);
diff --git a/lib/RT/Condition/BeforeDue.pm b/lib/RT/Condition/BeforeDue.pm
index 82b2c11..1e27865 100644
--- a/lib/RT/Condition/BeforeDue.pm
+++ b/lib/RT/Condition/BeforeDue.pm
@@ -46,6 +46,23 @@
 #
 # END BPS TAGGED BLOCK }}}
 
+=head1 NAME
+
+RT::Condition::BeforeDue
+
+=head1 DESCRIPTION
+
+Returns true if the ticket we're operating on is within the
+amount of time defined by the passed in argument.
+
+The passed in value is a date in the format "1d2h3m4s"
+for 1 day and 2 hours and 3 minutes and 4 seconds. Single
+units can also be passed such as 1d for just one day.
+
+
+=cut
+
+
 package RT::Condition::BeforeDue;
 use base 'RT::Condition';
 

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


More information about the Rt-commit mailing list