public $_priceSet;
/**
- * The id of the participation that we are proceessing.
+ * The id of the participation that we are processing.
*
* @var int
*/
return 'Participant';
}
+ /**
+ * Default form context used as part of addField()
+ */
+ public function getDefaultContext() {
+ return 'create';
+ }
+
/**
* Set variables up before form is built.
*
// when custom data is included in this page
if (!empty($_POST['hidden_custom'])) {
+ $eventId = (int) CRM_Utils_Array::value('event_id', $_POST);
// Custom data of type participant role
// Note: Some earlier commits imply $_POST['role_id'] could be a comma separated string,
// not sure if that ever really happens
}
//custom data of type participant event
- CRM_Custom_Form_CustomData::preProcess($this, $this->_eventNameCustomDataTypeID, $_POST['event_id'], 1, 'Participant', $this->_id);
+ CRM_Custom_Form_CustomData::preProcess($this, $this->_eventNameCustomDataTypeID, $eventId, 1, 'Participant', $this->_id);
CRM_Custom_Form_CustomData::buildQuickForm($this);
CRM_Custom_Form_CustomData::setDefaultValues($this);
// custom data of type participant event type
$eventTypeId = NULL;
- if ($eventId = CRM_Utils_Array::value('event_id', $_POST)) {
+ if ($eventId) {
$eventTypeId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $eventId, 'event_type_id', 'id');
}
CRM_Custom_Form_CustomData::preProcess($this, $this->_eventTypeCustomDataTypeID, $eventTypeId,
$this->addElement('checkbox', 'is_notify', ts('Send Notification'), NULL);
- $this->add('text', 'source', ts('Event Source'));
+ $this->addField('source', array('entity' => 'Participant', 'name' => 'source'));
$noteAttributes = CRM_Core_DAO::getAttribute('CRM_Core_DAO_Note');
$this->add('textarea', 'note', ts('Notes'), $noteAttributes['note']);
}
if (!$this->_single && !empty($event_id)) {
$duplicateContacts = 0;
- while (list($k, $dupeCheckContactId) = each($this->_contactIds)) {
+ foreach ($this->_contactIds as $k => $dupeCheckContactId) {
// Eliminate contacts that have already been assigned to this event.
$dupeCheck = new CRM_Event_BAO_Participant();
$dupeCheck->contact_id = $dupeCheckContactId;
);
$customFields = CRM_Utils_Array::crmArrayMerge($customFieldsEvent, $customFields);
$customFields = CRM_Utils_Array::crmArrayMerge($customFieldsEventType, $customFields);
- $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params,
- $this->_id,
- 'Participant'
- );
+
+ $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $this->_id, $this->getDefaultEntity());
}
//do cleanup line items if participant edit the Event Fee.