[rt-users] Adjusting SetSubjectToken

Sharlon Carty scarty at gmail.com
Tue Feb 26 09:40:39 EST 2008


Hello everyone,

I am trying to add the date to the subject line that rt generates. for
example [rtname #260208-101]
I adjusted as follows:

sub SetSubjectToken {
    my $self = shift;
    my $sub  = $self->TemplateObj->MIMEObj->head->get('Subject');
    my $id   = $self->TicketObj->id;

    my $token_re = $RT::EmailSubjectTagRegex;
    $token_re = qr/\Q$RT::rtname\E/o unless $token_re;
    return if $sub =~ /\[$token_re\s+# strftime('%d%m%y', @{[localtime()]})
-$id\]/;

    $sub =~ s/(\r\n|\n|\s)/ /gi;
    chomp $sub;
    $self->TemplateObj->MIMEObj->head->replace(
        Subject => "[$RT::rtname #" . strftime('%d%m%y', @{[localtime()]}) .
"-$id] $sub",
    );

Works perfectly when creating a ticket, but whenever replying to the ticket
a new ticket is created.
I believe it has to do with     return if $sub =~ /\[$token_re\s+#
strftime('%d%m%y', @{[localtime()]}) -$id\]/;

I hardly know perl and was available to google appending strings in perl.
But the above I do not know how to figure out.

Any help would be appreciated.
}


-- 
- - Sharlon (c).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20080226/d728a0e9/attachment.htm>


More information about the rt-users mailing list