[Bps-public-commit] rt-extension-repeatticket branch, master, updated. cc67c5ab0d277fe5bd9d355789664502a448982a
? sunnavy
sunnavy at bestpractical.com
Mon Jun 10 11:58:24 EDT 2013
The branch, master has been updated
via cc67c5ab0d277fe5bd9d355789664502a448982a (commit)
from 26467b4d0693c5de3bbd14ff3ed26c53b2e09af2 (commit)
Summary of changes:
lib/RT/Extension/RepeatTicket.pm | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
- Log -----------------------------------------------------------------
commit cc67c5ab0d277fe5bd9d355789664502a448982a
Author: sunnavy <sunnavy at bestpractical.com>
Date: Mon Jun 10 23:56:31 2013 +0800
new option RepeatTicketSubjectFormat to adjust repeated subject
diff --git a/lib/RT/Extension/RepeatTicket.pm b/lib/RT/Extension/RepeatTicket.pm
index 81a9c88..6d1d78e 100644
--- a/lib/RT/Extension/RepeatTicket.pm
+++ b/lib/RT/Extension/RepeatTicket.pm
@@ -470,6 +470,7 @@ sub GetActiveTickets {
return $tickets_ref;
}
+my $mason;
sub _RepeatTicket {
my $repeat_ticket = shift;
return unless $repeat_ticket;
@@ -488,7 +489,38 @@ sub _RepeatTicket {
};
$repeat->{$_} = $repeat_ticket->$_()
- for qw/Owner Subject FinalPriority TimeEstimated/;
+ for qw/Owner FinalPriority TimeEstimated/;
+
+ my $subject_format = RT->Config->Get('RepeatTicketSubjectFormat');
+ if ($subject_format) {
+ # append original subject if the new one doesn't include it.
+ if ( $subject_format !~ /__Subject__/ ) {
+ $subject_format .= ' __Subject__';
+ }
+
+ my $subject = $subject_format;
+ unless ( $mason ) {
+ require File::Temp;
+ my $data_dir = File::Temp::tempdir(CLEANUP => 1);
+ $mason = HTML::Mason::Interp->new(
+ RT::Interface::Web::Handler->DefaultHandlerArgs,
+ autohandler_name => '', # disable forced login and more
+ data_dir => $data_dir,
+ );
+ $mason->set_escape( h => \&RT::Interface::Web::EscapeUTF8 );
+ $mason->set_escape( u => \&RT::Interface::Web::EscapeURI );
+ }
+ $subject =~ s!__(.*?)__!$mason->exec(
+ "/Elements/ColumnMap",
+ Class => 'RT__Ticket',
+ Name => $1,
+ Attr => 'value'
+ )->($repeat_ticket);!eg;
+ $repeat->{Subject} = $subject;
+ }
+ else {
+ $repeat->{Subject} = $repeat_ticket->Subject;
+ }
my $members = $repeat_ticket->Members;
my ( @members, @members_of, @refers, @refers_by, @depends, @depends_by );
@@ -743,6 +775,7 @@ add RT::Extension::RepeatTicket to @Plugins in RT's etc/RT_SiteConfig.pm:
Set( @Plugins, qw(... RT::Extension::RepeatTicket) );
Set( $RepeatTicketCoexistentNumber, 1 ); # Optional
Set( $RepeatTicketLeadTime, 14 ); # Optional
+ Set( $RepeatTicketSubjectFormat, '__Subject__' );
add bin/rt-repeat-ticket to the daily cron job.
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list