You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Saving an object outside its edit form resets its custom fields to 0 #473
$custom_fields = new w2p_Core_CustomFields($this->_tbl_module, 'addedit', $id, 'edit');
$custom_fields->bind($_POST);
$custom_fields->store($id);
The constructor loads the object's current values, but w2p_Core_CustomFields::bind() (L158) sets every field that isn't in $_POST to 0, and store() writes them back. So any store() whose request didn't come from that object's full add/edit form wipes its custom field values, for example:
Project Designer bulk task updates (do_task_bulk_aed.php, about 15 store() calls),
the second store() in do_task_aed.php after a dependency date shift only survives because the same $_POST is still there,
every save from a future API request, cron job or import, where $_POST is empty.
Fix: pass custom field values explicitly (setCustomFields(array) before store()), have bind() change only the keys that are present, and skip the custom field step entirely when no values were given. The add/edit handlers pass their posted values.
Found by reading the code on dev-5.0.0 @ 179b4eaf; not yet reproduced on a running install.
Activity
Custom fields: only save the values a store() was given