[Rt-commit] rt branch, 4.2/rt-crontool-reminders, created. rt-4.1.13-34-g68883a4

Jim Brandt jbrandt at bestpractical.com
Mon Jul 1 10:00:03 EDT 2013


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

- Log -----------------------------------------------------------------
commit 711160f98a4dffc1000be11c563a21da5ed84d32
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 573775ae64adf27c44063bdfc9391a9441c7a779
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Mon Jul 1 09:40:09 2013 -0400

    Add docs for BeforeDue condition

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';
 

commit 68883a44f2fa767abd5567863267200e472fffa0
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Mon Jul 1 09:50:28 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.

diff --git a/docs/reminders.pod b/docs/reminders.pod
new file mode 100644
index 0000000..c2bc67d
--- /dev/null
+++ b/docs/reminders.pod
@@ -0,0 +1,67 @@
+=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,AlwaysNotifyActor \
+                   --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 Admin > Global > Templates >
+Create. You can look at the default template for examples of the values
+you can use to populate the email.
diff --git a/etc/initialdata b/etc/initialdata
index 29b9163..14adaf4 100644
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -384,6 +384,18 @@ Content-Type: text/html
 '
     },
     {  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..44f2129
--- /dev/null
+++ b/etc/upgrade/4.1.16/content
@@ -0,0 +1,16 @@
+use strict;
+use warnings;
+
+our @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}
+'
+    },
+);

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


More information about the Rt-commit mailing list