From 2ea729e55651a288bbf3826c888f430806aab04c Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Mon, 7 Apr 2014 16:19:09 -0700 Subject: avoid creating Set TimeWorked transactions where new value is empty, #28459 --- FS/FS/TicketSystem.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'FS') diff --git a/FS/FS/TicketSystem.pm b/FS/FS/TicketSystem.pm index fa54e0bbd..3c972d0bd 100644 --- a/FS/FS/TicketSystem.pm +++ b/FS/FS/TicketSystem.pm @@ -357,6 +357,16 @@ sub _upgrade_data { warn "Removed $rows dangling ticket-$table links\n" if $rows > 0; } + # Fix ticket transactions on the Time* fields where the NewValue (or + # OldValue, though this is not known to happen) is an empty string + foreach (qw(newvalue oldvalue)) { + my $rows = $dbh->do( + "UPDATE transactions SET $_ = '0' WHERE objecttype='RT::Ticket' AND ". + "field IN ('TimeWorked', 'TimeEstimated', 'TimeLeft') AND $_ = ''" + ) or die $dbh->errstr; + warn "Fixed $rows transactions with empty time values\n" if $rows > 0; + } + return; } -- cgit v1.2.1