<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task {
/**
- * the title of the group
+ * The title of the group
*
* @var string
*/
protected $_title;
/**
- * maximum profile fields that will be displayed
+ * Maximum profile fields that will be displayed
*
*/
protected $_maxFields = 9;
/**
- * variable to store redirect path
+ * Variable to store redirect path
*
*/
protected $_userContext;
/**
- * variable to store previous status id.
+ * Variable to store previous status id.
*
*/
protected $_fromStatusIds;
/**
- * build all the data structures needed to build the form
+ * Build all the data structures needed to build the form
*
* @return void
- * @access public
*/
- function preProcess() {
+ public function preProcess() {
/*
* initialize the task and row fields
*/
}
/**
- * Build the form
+ * Build the form object
*
- * @access public
*
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
$ufGroupId = $this->get('ufGroupId');
if (!$ufGroupId) {
// 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 = in_array($eventTypeId, $entityColumnValue) ? $eventTypeId : NULL;
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);
}
$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;
}
}
/**
- * 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
*/
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;
}
return $updatedStatusId;
}
}
-