Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Request Tracker: Commit

rt branch, 4.2/rt-crontool-reminders, created. rt-4.0.5-283-gb55378c

 

 

Request Tracker commit RSS feed   Index | Next | Previous | View Threaded


jbrandt at bestpractical

Apr 17, 2012, 2:05 PM

Post #1 of 1 (214 views)
Permalink
rt branch, 4.2/rt-crontool-reminders, created. rt-4.0.5-283-gb55378c

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

- Log -----------------------------------------------------------------
commit 395f97f804d0b0c375c4d5abcb8cd37aca6543d0
Author: Jim Brandt <jbrandt [at] bestpractical>
Date: Tue Apr 17 16:19:00 2012 -0400

Added new docs for reminders include how to schedule automatic email with rt-crontool.

diff --git a/bin/rt-crontool.in b/bin/rt-crontool.in
index 035c634..a15c0b1 100755
--- a/bin/rt-crontool.in
+++ b/bin/rt-crontool.in
@@ -354,6 +354,8 @@ sub help {
. loc( "[_1] - Output status updates to STDOUT", "--verbose" ) . "\n";
print "\n";
print "\n";
+ print loc("To use this tool, you must create a user account on the server, set up a user in RT, and set Unix login field in the Identity configuration in RT to the server username.") . "\n";
+ print "\n";
print loc("Security:")."\n";
print loc("This tool allows the user to run arbitrary perl modules from within RT.")." ".
loc("If this tool were setgid, a hostile local user could use this tool to gain administrative access to RT.")." ".
@@ -410,7 +412,9 @@ rt-crontool - a tool to act on tickets from an external scheduling tool
=head1 DESCRIPTION

This script is a tool to act on tickets from an external scheduling tool, such
-as cron.
+as cron. To use this tool, you must create a user account on the server, set up
+a user in RT, and set Unix login field in the Identity configuration in RT to
+the server username.

Security:

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/lib/RT/Condition/BeforeDue.pm b/lib/RT/Condition/BeforeDue.pm
index 11c40e6..88aacb9 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 b55378c5c09ab02402861b2555631ba0ac03d2ea
Author: Jim Brandt <jbrandt [at] bestpractical>
Date: Tue Apr 17 17:03:33 2012 -0400

Added new Reminder template to initial data and upgrade content. Tested with a simple upgrade and an initial install.

diff --git a/etc/initialdata b/etc/initialdata
index 468f935..fb0e842 100755
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -304,6 +304,19 @@ This is a comment. It is not sent to the Requestor(s):
},

{ Queue => '0',
+ Name => 'Reminder', # loc
+ Description => 'Default reminder template', # loc
+ Content =>
+'To: { $Target = $Ticket->RefersTo->First->TargetObj; ($Argument eq \'TicketOwner\' ? $Target : $Ticket)->OwnerObj->EmailAddress }
+Subject: {$Ticket->Subject} is due {$Ticket->DueAsString}
+
+This reminder is for ticket #{$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.0/content b/etc/upgrade/4.1.0/content
index 80783eb..6625550 100644
--- a/etc/upgrade/4.1.0/content
+++ b/etc/upgrade/4.1.0/content
@@ -22,4 +22,17 @@
},
);

+@Templates = (
+ { Queue => '0',
+ Name => 'Reminder', # loc
+ Description => 'Default reminder template', # loc
+ Content =>
+'To: { $Target = $Ticket->RefersTo->First->TargetObj; ($Argument eq \'TicketOwner\' ? $Target : $Ticket)->OwnerObj->EmailAddress }
+Subject: {$Ticket->Subject} is due {$Ticket->DueAsString}

+This reminder is for ticket #{$Target->Id}.
+
+{RT->Config->Get(\'WebURL\')}Ticket/Display.html?id={$Target->Id}
+'
+ },
+);

-----------------------------------------------------------------------
_______________________________________________
Rt-commit mailing list
Rt-commit [at] lists
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit

Request Tracker commit RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.