Skip to content

Commit b08cbdf

Browse files
committed
Only set Resolved date when transitioning to inactive
In our RT instance we have multiple inactive states: resolved and closed. When work is completed on a ticket it is marked as resolved, and the Resolved date is updated accordingly. At a later stage the ticket is moved from resolved to closed, which prevents it being re-opened. Currently this change from resolved to closed changes the Resolved date again. With this change, the Resolved date is only set if transitioning from a non-inactive state to inactive (or the Resolved date isn't set).
1 parent 6ad6e01 commit b08cbdf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/RT/Ticket.pm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2579,9 +2579,14 @@ sub _SetStatus {
25792579
);
25802580
}
25812581

2582+
my $raw_resolved = RT::Date->new(RT->SystemUser);
2583+
$raw_resolved->Set(Format => 'ISO', Value => $self->__Value('Resolved'));
2584+
25822585
# When we close a ticket, set the 'Resolved' attribute to now.
25832586
# It's misnamed, but that's just historical.
2584-
if ( $args{NewLifecycle}->IsInactive($args{Status}) ) {
2587+
if ( ( !$raw_resolved->IsSet || !$args{Lifecycle}->IsInactive($old) )
2588+
&& $args{NewLifecycle}->IsInactive( $args{Status} ) )
2589+
{
25852590
$self->_Set(
25862591
Field => 'Resolved',
25872592
Value => $now->ISO,

0 commit comments

Comments
 (0)