On Fri, Jun 3, 2011 at 3:10 PM, Asif Iqbal <[email protected]> wrote:
> On Fri, Jul 16, 2010 at 3:10 PM, Asif Iqbal <[email protected]> wrote:
>> On Fri, Jul 9, 2010 at 2:45 PM, Kenneth Crocker <[email protected]> wrote:
>>> Asif,
>>>
>>> Sometimes, depending on the message, the number refers to the script being
>>> acted on or a user ID or a QueueID, etc. That's about all I know.
>>
>> I applied the attached patch on /opt/rt3/lib/RT/Action/SendEmail.pm
>>
>> and now info log generated by SendEmail.pm on rt.log shows like this
>>
>> <[email protected]>
>
> as shown in my patch, I were able to add the transaction id from
> $self->TransactionObj->id;
>
> I like to modify this patch to add user id who created the transaction and
> the optionla timeworked value for the transaction
>
> how do I get the user id and timeworked value of a transaction ?
Ok included patch (patched lib/RT/Action/SendMail.pm) added the
transaction id, user who worked on that transaction and timeworked
to the rt-version line in rt.log and it shows like this, sanitized. YMMV
Sun Jun 5 02:31:05 2011] [info]:
<rt-3.8.2-18896-1307241065-768.863978-87-0-5358179-6268...@rt.example.net>
#863978/5358179 - Scrip 87 Imported from RT 2.0
(/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:306)
How do I convert the $self->TransactionObj->Creator to the name of the creator?
>
>
>>
>> The last number is now transaction id.
>>
>> [..]
>
>
>
> --
> Asif Iqbal
> PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
> A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
>
--
Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
--- SendEmail.pm.orig 2011-06-04 22:35:07.377474204 -0400
+++ SendEmail.pm 2011-06-04 22:34:55.647456987 -0400
@@ -295,10 +295,15 @@
my $msgid = $MIMEObj->head->get('Message-ID');
chomp $msgid;
+ my $txid = $self->TransactionObj->id;
+ my $txtime = $self->TransactionObj->TimeTaken;
+ my $txuser = $self->TransactionObj->Creator;
+ my $msgidwithtxid = $msgid;
+ $msgidwithtxid =~ s/\@/-${txid}-${txuser}-${txtime}@/;
$self->ScripActionObj->{_Message_ID}++;
- $RT::Logger->info( $msgid . " #"
+ $RT::Logger->info( $msgidwithtxid . " #"
. $self->TicketObj->id . "/"
. $self->TransactionObj->id
. " - Scrip "
@@ -315,6 +320,7 @@
return $status unless ($status > 0 || exists $self->{'Deferred'});
my $success = $msgid . " sent ";
+ my $successwithtxid = $msgidwithtxid . " sent ";
foreach (@EMAIL_RECIPIENT_HEADERS) {
my $recipients = $MIMEObj->head->get($_);
$success .= " $_: " . $recipients if $recipients;
@@ -329,7 +335,7 @@
$success =~ s/\n//g;
- $RT::Logger->info($success);
+ $RT::Logger->info($successwithtxid);
return (1);
}
@@ -543,6 +549,11 @@
my $msgid = $MIMEObj->head->get('Message-ID');
chomp $msgid;
+ my $txid = $self->TransactionObj->id;
+ my $txtime = $self->TransactionObj->TimeTaken;
+ my $txuser = $self->TransactionObj->Creator;
+ my $msgidwithtxid = $msgid;
+ $msgidwithtxid =~ s/\@/-${txid}-${txuser}-${txtime}@/;
my ( $id, $msg ) = $transaction->Create(
Ticket => $self->TicketObj->Id,
@@ -763,6 +774,12 @@
# If the transaction has content and has the header RT-Squelch-Replies-To
my $msgid = $self->TemplateObj->MIMEObj->head->get('Message-Id');
+ my $txid = $self->TransactionObj->id;
+ my $txtime = $self->TransactionObj->TimeTaken;
+ my $txuser = $self->TransactionObj->Creator;
+ my $msgidwithtxid = $msgid;
+ $msgidwithtxid =~ s/\@/-${txid}-${txuser}-${txtime}@/;
+
if ( my $attachment = $self->TransactionObj->Attachments->First ) {
if ( $attachment->GetHeader('RT-DetectedAutoGenerated') ) {
@@ -775,7 +792,7 @@
# Don't send to any watchers.
@{ $self->{$_} } = () for (@EMAIL_RECIPIENT_HEADERS);
- $RT::Logger->info( $msgid
+ $RT::Logger->info( $msgidwithtxid
. " The incoming message was autogenerated. "
. "Not redistributing this message based on site configuration."
);
@@ -791,7 +808,7 @@
push @blacklist, $addr if ( !$user->Privileged );
}
}
- $RT::Logger->info( $msgid
+ $RT::Logger->info( $msgidwithtxid
. " The incoming message was autogenerated. "
. "Not redistributing this message to unprivileged users based on site configuration."
);
@@ -819,11 +836,11 @@
# Weed out any RT addresses. We really don't want to talk to ourselves!
# If we get a reply back, that means it's not an RT address
if ( !RT::EmailParser->CullRTAddresses($addr) ) {
- $RT::Logger->info( $msgid . "$addr appears to point to this RT instance. Skipping" );
+ $RT::Logger->info( $msgidwithtxid . "$addr appears to point to this RT instance. Skipping" );
next;
}
if ( grep /^\Q$addr\E$/, @blacklist ) {
- $RT::Logger->info( $msgid . "$addr was blacklisted for outbound mail on this transaction. Skipping");
+ $RT::Logger->info( $msgidwithtxid . "$addr was blacklisted for outbound mail on this transaction. Skipping");
next;
}
push @addrs, $addr;