Custom fields with a column name that is the same as a core field cause an unhandled exception
I have custom field group that contains fields mirrored with an MSSQL DB. As it turns out, one of the columns in the table that contains the fields for the group has the exact same name as a column in the core contact table. I am not entirely sure how this happened given that the column names usually end up with a "_" appended to the field name in the DB. I think some of the fields in this group were added through a custom extension.
As it turns out, the column in the custom field group table is named 'is_deceased'. I intend to do some debugging but I fear that there may not be an easy solution to the problem. Also concerned that this could cause problems elsewhere in the app... Is there a way to rename a column?
Thanks in advance for any assistance and/or pointers regarding this issue. .
A.J.
I am getting the fatal exception below.
$Fatal Error Details = array(3) {
["message"]=>
string(34) "Field "is_deceased" already exists"
["code"]=>
NULL
["exception"]=>
object(Civi\DataProcessor\DataSpecification\FieldExistsException)#2535 (7) {
["message":protected]=>
string(34) "Field "is_deceased" already exists"
["string":"Exception":private]=>
string(0) ""
["code":protected]=>
int(0)
["file":protected]=>
string(150) "/XXXXX/sites/all/civicrm/ext/dataprocessor/Civi/DataProcessor/DataSpecification/DataSpecification.php"
["line":protected]=>
int(33)
["trace":"Exception":private]=>
array(17) {
[0]=>
array(6) {
["file"]=>
string(138) "/XXXXX/sites/all/civicrm/ext/dataprocessor/Civi/DataProcessor/DataSpecification/Utils.php"
["line"]=>
int(103)
["function"]=>
string(21) "addFieldSpecification"
["class"]=>
string(54) "Civi\DataProcessor\DataSpecification\DataSpecification"
["type"]=>
string(2) "->"
["args"]=>
array(2) {
[0]=>
string(11) "is_deceased"
[1]=>
object(Civi\DataProcessor\DataSpecification\CustomFieldSpecification)#2531 (13) {
["customGroupName"]=>
string(19) "GLDB_Contact_Lookup"
["customGroupTableName"]=>
string(30) "civicrm_value_gldb_contact__36"
["customFieldColumnName"]=>
string(11) "is_deceased"
["customFieldName"]=>
string(11) "is_deceased"
["customFieldTitle"]=>
string(13) "GLDB Deceased"
["customGroupTitle"]=>
string(19) "GLDB Contact Lookup"
["customFieldId"]=>
string(3) "266"
["customField"]=>
array(10) {
["id"]=>
string(3) "266"
["name"]=>
string(11) "is_deceased"
["label"]=>
string(13) "GLDB Deceased"
["column_name"]=>
string(11) "is_deceased"
["data_type"]=>
string(7) "Boolean"
["html_type"]=>
string(5) "Radio"
["is_required"]=>
string(1) "0"
["is_view"]=>
string(1) "0"
["is_searchable"]=>
string(1) "1"
["in_selector"]=>
string(1) "0"
}
["name"]=>
string(11) "is_deceased"
["type"]=>
string(7) "Boolean"
["title"]=>
string(34) "GLDB Contact Lookup: GLDB Deceased"
["alias"]=>
string(32) "_GLDB_Contact_Lookup_is_deceased"
["options"]=>
array(2) {
[1]=>
string(3) "Yes"
[0]=>
string(2) "No"
}
}
}
}