mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
0029bffe3d
https://community.openproject.org/wp/49765 https://community.openproject.org/wp/49784 Original bug was OP#49765: creating a list custom field and then adding a comment to an existing work package would be impossible. An error "<custom field> was attempted to be written but is not writable" was displayed. In WorkPackageContract, when evaluating what was changed by the user and by the system, it checks if the custom values are newly set and if they are default. The default check was wrong for list custom field, as the default value was an integer, and the value was a string (created automatically by Redmine::Acts::Customizable#custom_field_values). i.e. check was `367 == "367"` The default check was wrong for multi-value list custom field as well, as the default value was a stringified array of integers, i.e. check was `[367, 368] == "[367, 368]"`. And it is plain wrong anyway because two CustomValue must be created in this case: one with value 367, second with value 368. This prevented default values to be pre-selected in the new work package form (bug #49784). This commit fixes the default check by returning strings for default value of list custom fields (bug #49765) and by creating multiple CustomValue for multi-value list custom fields (bug #49784) when none is present.