CustomFieldValues bug (and solution)

Hi all,

Just discovered a bug in AddCustomFieldValue for SingleValue customfields.

If the value changes from x to zero (0) it works; if it is then changed
back to something else than zero a double record exists in the
ticketcustomfieldvalues table.
The zero record is not deleted because there is a check on ($old_value)
and not on (defined $old_value).

It only shows up in 3.0.9 and not in 3.0.7 because of the order by id
that is added in Ticket_Overlay::CustomFieldValues
The records exists double in the database however.

Patch attached

regards,

Bart

patch (453 Bytes)