[rt-devel] CustomFieldValues bug (and solution)

Bart Duchesne bduc at dyndaco.com
Mon Feb 16 08:18:15 EST 2004


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

-------------- next part --------------
--- Ticket_Overlay.pm.org	2004-02-16 14:12:35.000000000 +0100
+++ Ticket_Overlay.pm	2004-02-16 14:01:54.000000000 +0100
@@ -3572,7 +3572,7 @@
         $new_value->Load($new_value_id);
 
         # now that adding the new value was successful, delete the old one
-	if ($old_value) {
+	if (defined $old_value) {
 	    my ($val, $msg) = $cf->DeleteValueForTicket(Ticket => $self->Id, Content => $old_value);
 	    unless ($val) { 
 	    		return (0,$msg);


More information about the Rt-devel mailing list