X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FEvent%2FForm%2FTask%2FBatch.php;h=54fd23af494b3f401d92f69d1161619fdc60c517;hb=7cdbcb16520d540f0b7c5cb43c9511374d692931;hp=e0078ef21c32cd7f4f42612caa5725af3a643930;hpb=8f6ae60501d5d64ddbc6269648e71247dee0ce1b;p=civicrm-core.git diff --git a/CRM/Event/Form/Task/Batch.php b/CRM/Event/Form/Task/Batch.php index e0078ef21c..54fd23af49 100644 --- a/CRM/Event/Form/Task/Batch.php +++ b/CRM/Event/Form/Task/Batch.php @@ -1,7 +1,7 @@ get('ufGroupId'); if (!$ufGroupId) { @@ -163,19 +161,24 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task { // 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); @@ -186,6 +189,7 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task { ); } $entityColumnValueRole = CRM_Utils_Array::value($roleId, $entityColumnValue); + $entityColumnValueEventType = in_array($eventTypeId, $entityColumnValue) ? $eventTypeId : NULL; if (($this->_roleCustomDataTypeID == $customValue['extends_entity_column_id']) && ($entityColumnValueRole) ) { @@ -196,6 +200,11 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task { ) { 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); } @@ -216,20 +225,19 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task { $buttonName = $this->controller->getButtonName('submit'); if ($suppressFields && $buttonName != '_qf_Batch_next') { - CRM_Core_Session::setStatus(ts("FILE or Autocomplete Select type field(s) in the selected profile are not supported for Batch Update and have been excluded."), ts('Unsupported Field Type'), 'info'); + CRM_Core_Session::setStatus(ts("File or Autocomplete-Select type field(s) in the selected profile are not supported for Batch Update."), ts('Unsupported Field Type'), 'info'); } $this->addDefaultButtons(ts('Update Participant(s)')); } /** - * This function sets the default values for the form. + * Set default values for the form. * - * @access public * * @return void */ - function setDefaultValues() { + public function setDefaultValues() { if (empty($this->_fields)) { return; } @@ -261,9 +269,8 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task { } /** - * process the form after the input has been submitted and validated + * Process the form after the input has been submitted and validated * - * @access public * * @return void */ @@ -337,15 +344,14 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task { CRM_Core_Session::setStatus(ts('No updates have been saved.'), ts('Not Saved'), 'alert'); } } - //end of function /** - * @param $participantId - * @param $statusId + * @param int $participantId + * @param int $statusId * * @return Ambigous|void */ - static function updatePendingOnlineContribution($participantId, $statusId) { + public static function updatePendingOnlineContribution($participantId, $statusId) { if (!$participantId || !$statusId) { return; } @@ -391,4 +397,3 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task { return $updatedStatusId; } } -