diff options
author | Mark Wells <mark@freeside.biz> | 2014-04-07 16:19:09 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2014-04-07 16:19:09 -0700 |
commit | 2ea729e55651a288bbf3826c888f430806aab04c (patch) | |
tree | d51e0afe42ca79397b1e5feb1d1bbb1280111b24 /FS/FS/TicketSystem.pm | |
parent | a172aa2d549f2c62978fa1f6b6851a68ae0f2a4e (diff) |
avoid creating Set TimeWorked transactions where new value is empty, #28459
Diffstat (limited to 'FS/FS/TicketSystem.pm')
-rw-r--r-- | FS/FS/TicketSystem.pm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/FS/FS/TicketSystem.pm b/FS/FS/TicketSystem.pm index fa54e0b..3c972d0 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; } |