Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: None
-
Fix Version/s: 1.4
-
Component/s: None
-
Labels:None
Description
This is a two-part issue relating the the deletion and updating of custom_value fields when a custom_option instance is deleted or updated.
1. Bug in deletion of custom_value values:
Currently when a custom_value row (custom field multiple choice option) is deleted, Option.php calls the del() function in CRM/Core/BAO/CustomOption.php. This function is designed to find and remove corresponding entries in custom_value. The function generally works BUT it assumes that the custom_values are stored in char_data column. This may not be true, as we can have select and radio custom fields with other data_types (int, float, etc.). This code needs to be modified to check the data_type of the field which the deleted option belongs to and look for/remove values from the correct column in civicrm_custom_value.
2. Implement UPDATE function for custom_value values:
Currently if the user changes the value of a multiple choice option, we don't do anything about existing custom_value entries for that option. We need to implement code similar to the del() function to find and update corresponding custom_value values and call that from CRM/Custom/Form/Option.php postProcess when action is UPDATE. Again, it's important that we use the field's data_type to determine which custom_value column we evaluate/update.