[Rt-commit] r6861 - in rt/branches/3.7-EXPERIMENTAL-RTIR-2.2: .

ruz at bestpractical.com ruz at bestpractical.com
Fri Jan 26 14:30:30 EST 2007


Author: ruz
Date: Fri Jan 26 14:30:30 2007
New Revision: 6861

Modified:
   rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/   (props changed)
   rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/lib/RT/Action/SendEmail.pm

Log:
 r4441 at cubic-pc (orig r6812):  ruz | 2007-01-26 18:34:57 +0300
 * if we have subject line regexp then we should use it during mail sending.
   This will allow us to send email with any token we want that matches the
   regexp, by defining it in a template. So now it's possible to use:
 
   Subject: [not-rtname-token-that-match-re #{ $Ticket->id }] ...
 


Modified: rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/lib/RT/Action/SendEmail.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/lib/RT/Action/SendEmail.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL-RTIR-2.2/lib/RT/Action/SendEmail.pm	Fri Jan 26 14:30:30 2007
@@ -692,13 +692,21 @@
 
 sub SetSubjectToken {
     my $self = shift;
-    my $tag  = "[". RT->Config->Get('rtname') ." #". $self->TicketObj->id ."]";
     my $sub  = $self->TemplateObj->MIMEObj->head->get('Subject');
-    unless ( $sub =~ /\Q$tag\E/ ) {
-        $sub =~ s/(\r\n|\n|\s)/ /gi;
-        chomp $sub;
-        $self->TemplateObj->MIMEObj->head->replace( 'Subject', "$tag $sub" );
-    }
+    my $id   = $self->TicketObj->id;
+
+    my $token_re = RT->Config->Get('EmailSubjectTagRegex');
+    unless ( $token_re ) {
+        my $rtname = RT->Config->Get('rtname');
+        $token_re = qr/\Q$rtname\E/o;
+    }
+    return if $sub =~ /\[$token_re\s+#$id\]/;
+
+    $sub =~ s/(\r\n|\n|\s)/ /gi;
+    chomp $sub;
+    $self->TemplateObj->MIMEObj->head->replace(
+        Subject => "[$RT::rtname #$id] $sub",
+    );
 }
 
 # }}}


More information about the Rt-commit mailing list