case 'Event':
$componentBAO = 'CRM_Event_BAO_Participant';
$componentBAOName = 'Participant';
- $componentSubType = array('role_id', 'event_id');
+ $componentSubType = array('role_id', 'event_id', 'event_type_id');
break;
case 'Activity':
//get the component values.
CRM_Core_DAO::commonRetrieve($componentBAO, $params, $values);
+ if ($componentBAOName == 'Participant') {
+ $values += array('event_type_id' => CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $values['event_id'], 'event_type_id'));
+ }
$formattedGroupTree = array();
$dateTimeFields = array('participant_register_date', 'activity_date_time', 'receive_date', 'receipt_date', 'cancel_date', 'thankyou_date', 'membership_start_date', 'membership_end_date', 'join_date');
$skipValue = FALSE;
foreach ($formattedGroupTree as $tree) {
- if ('CheckBox' == CRM_Utils_Array::value('html_type', $tree['fields'][$customFieldDetails[0]])) {
- $skipValue = TRUE;
- $defaults['field'][$componentId][$name] = $customValue;
- break;
- }
- elseif (CRM_Utils_Array::value('data_type', $tree['fields'][$customFieldDetails[0]]) == 'Date') {
- $skipValue = TRUE;
+ if (!empty($tree['fields'][$customFieldDetails[0]])) {
+ if ('CheckBox' == CRM_Utils_Array::value('html_type', $tree['fields'][$customFieldDetails[0]])) {
+ $skipValue = TRUE;
+ $defaults['field'][$componentId][$name] = $customValue;
+ break;
+ }
+ elseif (CRM_Utils_Array::value('data_type', $tree['fields'][$customFieldDetails[0]]) == 'Date') {
+ $skipValue = TRUE;
- // CRM-6681, $default contains formatted date, time values.
- $defaults[$fldName] = $customValue;
- if (!empty($defaults[$customKey . '_time'])) {
- $defaults['field'][$componentId][$name . '_time'] = $defaults[$customKey . '_time'];
+ // CRM-6681, $default contains formatted date, time values.
+ $defaults[$fldName] = $customValue;
+ if (!empty($defaults[$customKey . '_time'])) {
+ $defaults['field'][$componentId][$name . '_time'] = $defaults[$customKey . '_time'];
+ }
}
}
}
// get the option value for custom data type
$this->_roleCustomDataTypeID = CRM_Core_OptionGroup::getValue('custom_data_type', 'ParticipantRole', 'name');
$this->_eventNameCustomDataTypeID = CRM_Core_OptionGroup::getValue('custom_data_type', 'ParticipantEventName', 'name');
+ $this->_eventTypeCustomDataTypeID = CRM_Core_OptionGroup::getValue('custom_data_type', 'ParticipantEventType', 'name');
// build custom data getFields array
$customFieldsRole = CRM_Core_BAO_CustomField::getFields('Participant', FALSE, FALSE, NULL, $this->_roleCustomDataTypeID);
$customFieldsEvent = CRM_Core_BAO_CustomField::getFields('Participant', FALSE, FALSE, NULL, $this->_eventNameCustomDataTypeID);
+ $customFieldsEventType = CRM_Core_BAO_CustomField::getFields('Participant', FALSE, FALSE, NULL, $this->_eventTypeCustomDataTypeID);
+
$customFields = CRM_Utils_Array::crmArrayMerge($customFieldsRole,
CRM_Core_BAO_CustomField::getFields('Participant', FALSE, FALSE, NULL, NULL, TRUE)
);
+ $customFields = CRM_Utils_Array::crmArrayMerge($customFieldsEventType, $customFields);
$this->_customFields = CRM_Utils_Array::crmArrayMerge($customFieldsEvent, $customFields);
foreach ($this->_participantIds as $participantId) {
$roleId = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Participant", $participantId, 'role_id');
$eventId = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Participant", $participantId, 'event_id');
+ $eventTypeId = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Event", $eventId, 'event_type_id');
foreach ($this->_fields as $name => $field) {
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) {
$customValue = CRM_Utils_Array::value($customFieldID, $this->_customFields);
);
}
$entityColumnValueRole = CRM_Utils_Array::value($roleId, $entityColumnValue);
+ $entityColumnValueEventType = CRM_Utils_Array::value(array_search($eventTypeId, $entityColumnValue), $entityColumnValue);
if (($this->_roleCustomDataTypeID == $customValue['extends_entity_column_id']) &&
($entityColumnValueRole)
) {
) {
CRM_Core_BAO_UFGroup::buildProfile($this, $field, NULL, $participantId);
}
+ elseif ($this->_eventTypeCustomDataTypeID == $customValue['extends_entity_column_id'] &&
+ ($entityColumnValueEventType == $eventTypeId)
+ ) {
+ CRM_Core_BAO_UFGroup::buildProfile($this, $field, NULL, $participantId);
+ }
elseif (CRM_Utils_System::isNull($entityColumnValueRole)) {
CRM_Core_BAO_UFGroup::buildProfile($this, $field, NULL, $participantId);
}