From 5b2f03521410bb89a8ccfa706d0c03824f57f64c Mon Sep 17 00:00:00 2001 From: Brad Embree Date: Mon, 2 Dec 2024 14:52:01 -0800 Subject: [PATCH] Display worked date for reply/comment transactions If worked date is different from created date display worked date as part of the transaction description. --- lib/RT/Transaction.pm | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm index 840cb42cd8..e4a4669beb 100644 --- a/lib/RT/Transaction.pm +++ b/lib/RT/Transaction.pm @@ -1141,11 +1141,34 @@ sub _CanonicalizeRoleName { }, Correspond => sub { my $self = shift; - return ("Correspondence added"); #loc() + + my $created_date = RT::Date->new(RT->SystemUser); + $created_date->Set(Format => 'date', Value => $self->Created); + my $worked_date = RT::Date->new(RT->SystemUser); + $worked_date->Set(Format => 'date', Value => $self->TimeWorkedDate); + + if ( $self->TimeWorkedDate && ( $created_date->Date ne $worked_date->Date ) ) { + return ("Correspondence added for [_1]", $worked_date->Date); #loc() + } + else { + return ("Correspondence added"); #loc() + } }, Comment => sub { my $self = shift; - return ("Comments added"); #loc() + + my $created_date = RT::Date->new(RT->SystemUser); + $created_date->Set(Format => 'date', Value => $self->Created); + my $worked_date = RT::Date->new(RT->SystemUser); + $worked_date->Set(Format => 'date', Value => $self->TimeWorkedDate); + + if ( $self->TimeWorkedDate && ( $created_date->Date ne $worked_date->Date ) ) { + return ("Comments added for [_1]", $worked_date->Date); #loc() + } + else { + return ("Comments added"); #loc() + } + }, CustomField => sub { my $self = shift;