$this->_contactType = CRM_Contact_BAO_Contact::getContactType($this->_tableID);
$mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
$hasReachedMax = CRM_Core_BAO_CustomGroup::hasReachedMaxLimit($this->_groupID, $this->_tableID);
- if ($hasReachedMax && $mode == 'add') {
+ if ($hasReachedMax && $mode === 'add') {
CRM_Core_Error::statusBounce(ts('The maximum record limit is reached'));
}
$this->_copyValueId = CRM_Utils_Request::retrieve('copyValueId', 'Positive', $this);
];
if (isset($fkFields[$field->data_type])) {
// Serialized fields store value-separated strings which are incompatible with FK constraints
- if ($field->serialize) {
- $params['type'] = 'varchar(255)';
- }
- else {
+ if (!$field->serialize) {
$params['fk_table_name'] = $fkFields[$field->data_type];
$params['fk_field_name'] = 'id';
$params['fk_attributes'] = 'ON DELETE SET NULL';
}
}
-
+ if ($field->serialize) {
+ $params['type'] = 'varchar(255)';
+ }
if (isset($field->default_value)) {
$params['default'] = "'{$field->default_value}'";
}
}
else {
$set[$field['column_name']] = "%{$count}";
- $params[$count] = [$value, $type];
+ // The second parameter is the type of the db field, which
+ // would be 'String' for a concatenated set of integers.
+ $params[$count] = [$value, $field['is_multiple'] ? 'String' : $type];
$count++;
}
else {
$query = "$sqlOP SET $setClause $where";
}
- $dao = CRM_Core_DAO::executeQuery($query, $params);
+ CRM_Core_DAO::executeQuery($query, $params);
CRM_Utils_Hook::custom($hookOP,
$hookID,