Skip to content

Commit

Permalink
Display worked date for reply/comment transactions
Browse files Browse the repository at this point in the history
If worked date is different from created date display worked date as part of the
transaction description.
  • Loading branch information
bkembreeBPS committed Dec 3, 2024
1 parent c732709 commit 8515ff9
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions lib/RT/Transaction.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1141,11 +1141,31 @@ sub _CanonicalizeRoleName {
},
Correspond => sub {
my $self = shift;
return ("Correspondence added"); #loc()

if ( my $worked_date = $self->TimeWorkedDate ) {
my $created_date = RT::Date->new(RT->SystemUser);
$created_date->Set( Format => 'date', Value => $self->Created );

if ( $created_date->Date ne $worked_date ) {
return ( "Correspondence added for [_1]", $worked_date ); #loc()
}
}

return ("Correspondence added"); #loc()
},
Comment => sub {
my $self = shift;
return ("Comments added"); #loc()

if ( my $worked_date = $self->TimeWorkedDate ) {
my $created_date = RT::Date->new(RT->SystemUser);
$created_date->Set( Format => 'date', Value => $self->Created );

if ( $created_date->Date ne $worked_date ) {
return ( "Comments added for [_1]", $worked_date ); #loc()
}
}

return ("Comments added"); #loc()
},
CustomField => sub {
my $self = shift;
Expand Down Expand Up @@ -1768,6 +1788,8 @@ sub TimeWorkedDate {
my $obj = RT::Date->new( RT->SystemUser );
my $time_worked_date = $self->_Value('TimeWorkedDate');

return unless $time_worked_date;

# TimeWorkedDate should be just a date, but some DBs store it as a datetime.
# Detect this and return only the date part.

Expand Down

0 comments on commit 8515ff9

Please sign in to comment.