Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Won't Fix
-
Affects Version/s: 3.1.3, 3.2
-
Fix Version/s: 4.3.0
-
Component/s: None
-
Labels:None
Description
Discovered on my 3.1.3 installation, reproduced on 3.2 Development at sandbox.civicrm.org.
To recreate it, I created a new custom field, of the type Alphanumeric Checkbox. I created only one option, with the Default box checked, the Label set to some string, and the Value blank. I submitted the form, and Civi told me the option value could not be empty. I supplied the value and resubmitted the form, then got another error: something about an invalid default value for the field. (Interestingly, I seem to be able to produce the problem only once per installation, so I apologize for not supplying the error message verbatim.)
Once you've done all this, you end up with a custom field like this one: http://sandbox.civicrm.org/civicrm/admin/custom/group/field?action=update&reset=1&gid=5&id=9. On my installation, I could see the custom field in civicrm_custom_field, but the corresponding column in the civicrm_value_*_n was missing. Also of note is that the option_group_id field in the civicrm_custom_field table contained an ID for a nonexistent record in the option_group table.
The custom field you end up with is useless, and it can't be deleted. If you attempt to do so, you get:
DB Error: not found
Database Error Code: Can't DROP 'test_field_9'; check that column/key exists, 1091
Error Details:
Array
(
[callback] => Array
(
[0] => CRM_Core_Error
[1] => handle
)
[code] => -4
[message] => DB Error: not found
[mode] => 16
[debug_info] => ALTER TABLE civicrm_value_bug_test_5 DROP COLUMN `test_field_9` [nativecode=1091 ** Can't DROP 'test_field_9'; check that column/key exists]
[type] => DB_Error
[user_info] => ALTER TABLE civicrm_value_bug_test_5 DROP COLUMN `test_field_9` [nativecode=1091 ** Can't DROP 'test_field_9'; check that column/key exists]
[to_string] => [db_error: message="DB Error: not found" code=-4 mode=callback callback=CRM_Core_Error::handle prefix="" info=" ALTER TABLE civicrm_value_bug_test_5 DROP COLUMN `test_field_9` [nativecode=1091 ** Can't DROP 'test_field_9'; check that column/key exists]"]
)
If you're logging MySQL queries on sandbox.civicrm.org, you should be able to search against "bug_test" to find out what went wrong during the creation of the custom field.