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;
}
}
}
+ # RT core _will_ allow Set transactions that change these
+ # fields to empty strings, but internally change the values
+ # to zero. This is sloppy and causes some problems.
+ foreach my $field (qw(TimeWorked TimeEstimated TimeLeft)) {
+ $ARGSRef->{$field} =~ s/\s//g;
+ $ARGSRef->{$field} ||= 0;
+ }
+
my @results = UpdateRecordObject(
AttributesRef => \@attribs,
Object => $TicketObj,