summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2014-04-07 16:18:56 -0700
committerMark Wells <mark@freeside.biz>2014-04-07 16:18:56 -0700
commit35f1450398aec28d59643ca4e0b99dd638e8838c (patch)
tree4ff33a653a3248ada9d831081360053284e4d8fd /FS
parentc8d94e67465c81cbdef6e85f6fe303cc3a403e63 (diff)
avoid creating Set TimeWorked transactions where new value is empty, #28459
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/TicketSystem.pm10
1 files changed, 10 insertions, 0 deletions
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;
}