[rt-users] Plugins question
Jerrad Pierce
jpierce at cambridgeenergyalliance.org
Fri Sep 5 17:00:47 EDT 2008
Is it normal that one should have to add plugin locations to @INC for
scripts that don't use them?
I'm using RTx::Calendar (added to @Plugins in RT_SiteConfig.pm) and also
http://wiki.bestpractical.com/view/rtReminderMails (with a few patches below)
To get the latter to work I have to do
use lib qw'/opt/rt3/lib /opt/rt3/local/plugins/RTx-Calendar/lib/';
which seems rather gauche.
Patch 1: Report old reminders too
Patch 2: Reorder to show oldest (and presumably most important) first
Patch 3: English error
Patch 4: Access configuration variables in 3.8 style so that the script works
--- /tmp/a 2008-09-05 16:50:40.000000000 -0400
+++ /tmp/b 2008-09-05 16:51:06.000000000 -0400
@@ -1,6 +1,8 @@
# Calculate date boundaries.
my($dy,$dm,$dd) = Today();
-my $d_now = sprintf('%04d-%02d-%02d 00:00:00', $dy, $dm, $dd);
+#XXX Fetch overdue instead
+my $d_now = sprintf('%04d-%02d-%02d 00:00:00', 2008, 8, 14);
+#my $d_now = sprintf('%04d-%02d-%02d 00:00:00', $dy, $dm, $dd);
my $d_then = sprintf('%04d-%02d-%02d 23:59:59', Add_Delta_Days($dy,
$dm, $dd, $CONFIG_DUE_DAYS));
# Fetch list of matching tickets.
@@ -9,8 +11,8 @@
'Type = "reminder" AND '.
'(Status = "new" OR Status = "open") AND '.
'Due >= "'.$d_now.'" AND '.
- 'Due <= "'.$d_then.'"');
-$reminders->OrderBy(FIELD => 'Due', ORDER => 'DESC');
+ 'Due <= "'.$d_then.'"');
+$reminders->OrderBy(FIELD => 'Due', ORDER => 'ASC');
# Format result and group by e-mail address.
my %rcpts = ();
@@ -19,7 +21,7 @@
# Can this ever happen?
if ( ! $reminder->RefersTo->First) {
- $out .= "ERROR: \$reminder->RefersTo->First ist
leer:\n".Dumper($reminder)."\n\n";
+ $out .= "ERROR: \$reminder->RefersTo->First is
empty:\n".Dumper($reminder)."\n\n";
next;
}
my $ticket = $reminder->RefersTo->First->TargetObj;
@@ -53,7 +55,7 @@
"\n".
$rcpts{$rcpt};
# FIXME: Is there no proper RT library for this?
- open(MAIL, "| $RT::SendmailPath $RT::SendmailBounceArguments
$RT::SendmailArguments") or die("open sendmail: $!");
+ open(MAIL, '|'. RT->Config->Get('SendmailPath') .' '.
RT->Config->Get('SendmailBounceArguments') .' '.
RT->Config->Get('SendmailArguments')) or die("open sendmail: $!");
print(MAIL $mail) or die("print sendmail: $!");
close(MAIL) or die("close sendmail: $!");
}
--
Cambridge Energy Alliance: Save money & the planet
More information about the rt-users
mailing list