TimeTracking-Automatic extension bad time updates bug


#1

Hi RT users,

We added the 2 extensions for TimeTracking:

RT-Extension-TimeTracking
RT-Extension-TimeTracking-Automatic

We noticed that in certain situations, the Automatic updates were in the 25 million minute range and the following error was found in the logs:

Jan 10 08:09:05 rt RT: [41644] Use of uninitialized value in subtraction (-) at /opt/rt/local/plugins/RT-Extension-TimeTracking-Automatic/html/Callbacks/RT-Extension-TimeTracking-Automatic/Ticket/Update.html/BeforeDisplay line 7.

The following patch appears to address the problem, I posted a bug report but there was no reponse.

— BeforeDisplay.ORIG 2019-01-10 13:53:56.590980382 -0600
+++ BeforeDisplay 2019-01-10 13:53:56.581980493 -0600
@@ -4,6 +4,6 @@
</%args>
<%init>
my $adjustment = RT->Config->Get(“TimeTrackingAdjustment”) || 0;
-my $worked = POSIX::ceil((time - $$ARGSRef{TimeTrackingAutomatic})/60) + $adjustment; # at least 1 minute
+my $worked = POSIX::ceil((time - ($$ARGSRef{TimeTrackingAutomatic} // time))/60) + $adjustment; # at least 1 minute
$Ticket->SetTimeWorked( $worked + $Ticket->TimeWorked );
</%init>

Regards,
Ken