| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
static $_statusTransitionsRules = array(
'Pending from pay later' => array('Registered', 'Cancelled'),
*/
static $_statusTransitionsRules = array(
'Pending from pay later' => array('Registered', 'Cancelled'),
// ensure that role ids are encoded as a string
if (isset($params['role_id']) && is_array($params['role_id'])) {
// ensure that role ids are encoded as a string
if (isset($params['role_id']) && is_array($params['role_id'])) {
if (!empty($params['id'])) {
$participantBAO->id = CRM_Utils_Array::value('id', $params);
$participantBAO->find(TRUE);
if (!empty($params['id'])) {
$participantBAO->id = CRM_Utils_Array::value('id', $params);
$participantBAO->find(TRUE);
if (array_key_exists($noteFld, $params)) {
$noteValue = $params[$noteFld];
$hasNoteField = TRUE;
if (array_key_exists($noteFld, $params)) {
$noteValue = $params[$noteFld];
$hasNoteField = TRUE;
$eventId,
$returnEmptySeats = FALSE,
$includeWaitingList = TRUE,
$eventId,
$returnEmptySeats = FALSE,
$includeWaitingList = TRUE,
// It might be case there are some empty spaces and still event
// is full, as waitlist might represent group require spaces > empty.
// It might be case there are some empty spaces and still event
// is full, as waitlist might represent group require spaces > empty.
- $participantRoles = CRM_Event_PseudoConstant::participantRole(NULL, 'filter = 1');
- $countedStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 1');
- $waitingStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Waiting'");
+ $participantRoles = CRM_Event_PseudoConstant::participantRole(NULL, 'filter = 1');
+ $countedStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 1');
+ $waitingStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Waiting'");
$onWaitlistStatusId = array_search('On waitlist', $waitingStatuses);
//when we do require only waiting count don't consider counted.
$onWaitlistStatusId = array_search('On waitlist', $waitingStatuses);
//when we do require only waiting count don't consider counted.
- $whereClause = ' WHERE ' . implode(' AND ', $where);
- $whereClause .= " AND participant.status_id = $onWaitlistStatusId ";
+ $whereClause = ' WHERE ' . implode(' AND ', $where);
+ $whereClause .= " AND participant.status_id = $onWaitlistStatusId ";
- $where[] = ' participant.status_id IN ( ' . implode(', ', array_keys($countedStatuses)) . ' ) ';
- $whereClause = ' WHERE ' . implode(' AND ', $where);
+ $where[] = ' participant.status_id IN ( ' . implode(', ', array_keys($countedStatuses)) . ' ) ';
+ $whereClause = ' WHERE ' . implode(' AND ', $where);
while ($participants->fetch()) {
if ($participants->event_full_text) {
$eventFullText = $participants->event_full_text;
while ($participants->fetch()) {
if ($participants->event_full_text) {
$eventFullText = $participants->event_full_text;
*/
public static function &importableFields($contactType = 'Individual', $status = TRUE, $onlyParticipant = FALSE) {
if (!self::$_importableFields) {
*/
public static function &importableFields($contactType = 'Individual', $status = TRUE, $onlyParticipant = FALSE) {
if (!self::$_importableFields) {
'title' => ts('Participant Note'),
'name' => 'participant_note',
'headerPattern' => '/(participant.)?note$/i',
'title' => ts('Participant Note'),
'name' => 'participant_note',
'headerPattern' => '/(participant.)?note$/i',
// Split status and status id into 2 fields
// Fixme: it would be better to leave as 1 field and intelligently handle both during import
// Split status and status id into 2 fields
// Fixme: it would be better to leave as 1 field and intelligently handle both during import
'title' => ts('Participant Status'),
'name' => 'participant_status',
'data_type' => CRM_Utils_Type::T_STRING,
'title' => ts('Participant Status'),
'name' => 'participant_status',
'data_type' => CRM_Utils_Type::T_STRING,
$tmpFields['participant_status_id']['title'] = ts('Participant Status Id');
// Split role and role id into 2 fields
$tmpFields['participant_status_id']['title'] = ts('Participant Status Id');
// Split role and role id into 2 fields
'title' => ts('Participant Role'),
'name' => 'participant_role',
'data_type' => CRM_Utils_Type::T_STRING,
'title' => ts('Participant Role'),
'name' => 'participant_role',
'data_type' => CRM_Utils_Type::T_STRING,
'title' => ts('Event Type'),
'name' => 'event_type',
'data_type' => CRM_Utils_Type::T_STRING,
'title' => ts('Event Type'),
'name' => 'event_type',
'data_type' => CRM_Utils_Type::T_STRING,
// Using new Dedupe rule.
$ruleParams = array(
'contact_type' => $contactType,
// Using new Dedupe rule.
$ruleParams = array(
'contact_type' => $contactType,
$extIdentifier = CRM_Utils_Array::value('external_identifier', $contactFields);
if ($extIdentifier) {
$tmpContactField['external_identifier'] = $extIdentifier;
$extIdentifier = CRM_Utils_Array::value('external_identifier', $contactFields);
if ($extIdentifier) {
$tmpContactField['external_identifier'] = $extIdentifier;
- $tmpContactField['external_identifier']['title'] =
- CRM_Utils_Array::value('title', $extIdentifier) . ' (match to contact)';
+ $tmpContactField['external_identifier']['title'] = CRM_Utils_Array::value('title', $extIdentifier) . ' (match to contact)';
$fields = array_merge($fields, $tmpContactField);
$fields = array_merge($fields, $tmpFields);
$fields = array_merge($fields, $tmpContactField);
$fields = array_merge($fields, $tmpFields);
- ));
-
- //CRM-13595 add event id to participant export
- $eventid = array(
- 'event_id' => array(
- 'title' => 'Event ID',
- 'name' => 'event_id',
- ));
- $eventtitle = array(
- 'event_title' => array(
- 'title' => 'Event Title',
- 'name' => 'event_title',
- ));
+ 'type' => CRM_Utils_Type::T_STRING,
+ ),
+ );
- $fields = array_merge($participantFields, $participantStatus, $participantRole, $eventid, $eventtitle, $noteField, $discountFields);
+ $fields = array_merge($participantFields, $participantStatus, $participantRole, $eventFields, $noteField, $discountFields);
*/
public static function resolveDefaults(&$defaults, $reverse = FALSE) {
self::lookupValue($defaults, 'event', CRM_Event_PseudoConstant::event(), $reverse);
*/
public static function resolveDefaults(&$defaults, $reverse = FALSE) {
self::lookupValue($defaults, 'event', CRM_Event_PseudoConstant::event(), $reverse);
*/
public static function deleteParticipant($id) {
CRM_Utils_Hook::pre('delete', 'Participant', $id, CRM_Core_DAO::$_nullArray);
*/
public static function deleteParticipant($id) {
CRM_Utils_Hook::pre('delete', 'Participant', $id, CRM_Core_DAO::$_nullArray);
*/
public static function checkDuplicate($input, &$duplicates) {
$eventId = CRM_Utils_Array::value('event_id', $input);
*/
public static function checkDuplicate($input, &$duplicates) {
$eventId = CRM_Utils_Array::value('event_id', $input);
- $query = "SELECT id FROM civicrm_participant WHERE $clause";
- $dao = CRM_Core_DAO::executeQuery($query, $input);
+ $query = "SELECT id FROM civicrm_participant WHERE $clause";
+ $dao = CRM_Core_DAO::executeQuery($query, $input);
}
elseif ((substr($eventLevel, 0, 1) == CRM_Core_DAO::VALUE_SEPARATOR)) {
$eventLevel = implode(', ', explode(CRM_Core_DAO::VALUE_SEPARATOR,
}
elseif ((substr($eventLevel, 0, 1) == CRM_Core_DAO::VALUE_SEPARATOR)) {
$eventLevel = implode(', ', explode(CRM_Core_DAO::VALUE_SEPARATOR,
}
elseif ((substr($eventLevel, -1, 1) == CRM_Core_DAO::VALUE_SEPARATOR)) {
$eventLevel = implode(', ', explode(CRM_Core_DAO::VALUE_SEPARATOR,
}
elseif ((substr($eventLevel, -1, 1) == CRM_Core_DAO::VALUE_SEPARATOR)) {
$eventLevel = implode(', ', explode(CRM_Core_DAO::VALUE_SEPARATOR,
*/
public static function getAdditionalParticipantIds($primaryParticipantId, $excludeCancel = TRUE, $oldStatusId = NULL) {
$additionalParticipantIds = array();
*/
public static function getAdditionalParticipantIds($primaryParticipantId, $excludeCancel = TRUE, $oldStatusId = NULL) {
$additionalParticipantIds = array();
$where = 'WHERE participant.id IN ( ' . implode(', ', $participantIds) . ' )';
$query = "$select $from $where";
$where = 'WHERE participant.id IN ( ' . implode(', ', $participantIds) . ' )';
$query = "$select $from $where";
- $feeInfo = CRM_Core_DAO::executeQuery($query);
- $feeProperties = array('fee_level', 'fee_amount');
+ $feeInfo = CRM_Core_DAO::executeQuery($query);
+ $feeProperties = array('fee_level', 'fee_amount');
- 'lineId', 'label', 'qty', 'unit_price',
- 'line_total', 'field_title', 'html_type',
- 'price_field_id', 'participant_count', 'price_field_value_id', 'description',
+ 'lineId',
+ 'label',
+ 'qty',
+ 'unit_price',
+ 'line_total',
+ 'field_title',
+ 'html_type',
+ 'price_field_id',
+ 'participant_count',
+ 'price_field_value_id',
+ 'description',
*/
public static function getAdditionalParticipants($primaryParticipantID) {
$additionalParticipantIDs = array();
*/
public static function getAdditionalParticipants($primaryParticipantID) {
$additionalParticipantIDs = array();
*/
public static function updateParticipantStatus($participantID, $oldStatusID, $newStatusID = NULL, $updatePrimaryStatus = FALSE) {
if (!$participantID || !$oldStatusID) {
*/
public static function updateParticipantStatus($participantID, $oldStatusID, $newStatusID = NULL, $updatePrimaryStatus = FALSE) {
if (!$participantID || !$oldStatusID) {
*/
public static function updateStatus($participantIds, $statusId, $updateRegisterDate = FALSE) {
if (!is_array($participantIds) || empty($participantIds) || !$statusId) {
*/
public static function updateStatus($participantIds, $statusId, $updateRegisterDate = FALSE) {
if (!is_array($participantIds) || empty($participantIds) || !$statusId) {
- static function transitionParticipants($participantIds, $toStatusId,
+ public static function transitionParticipants(
+ $participantIds, $toStatusId,
$fromStatusId = NULL, $returnResult = FALSE, $skipCascadeRule = FALSE
) {
if (!is_array($participantIds) || empty($participantIds) || !$toStatusId) {
$fromStatusId = NULL, $returnResult = FALSE, $skipCascadeRule = FALSE
) {
if (!is_array($participantIds) || empty($participantIds) || !$toStatusId) {
- 'domain' => array('name', 'phone', 'address', 'email'),
+ 'domain' => array('name', 'phone', 'address', 'email'),
* @param string $mailType
* (eg 'approval', 'confirm', 'expired' ).
*
* @param string $mailType
* (eg 'approval', 'confirm', 'expired' ).
*
array_key_exists($processedId, $results['mailedParticipants'])
) {
$statusMsg .= '<br /> ' . ts("Participant status has been updated to '%1'. An email has been sent to %2.",
array_key_exists($processedId, $results['mailedParticipants'])
) {
$statusMsg .= '<br /> ' . ts("Participant status has been updated to '%1'. An email has been sent to %2.",
- array(
- 1 => $allStatuses[$statusChangeTo],
- 2 => $results['mailedParticipants'][$processedId],
- )
- );
+ array(
+ 1 => $allStatuses[$statusChangeTo],
+ 2 => $results['mailedParticipants'][$processedId],
+ )
+ );
if (is_string($emptySeats) && $emptySeats !== NULL) {
$maxParticipants = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $eventId, 'max_participants');
$eventfullMsg = ts("This event currently has the maximum number of participants registered (%1). However, you can still override this limit and register additional participants using this form.", array(
if (is_string($emptySeats) && $emptySeats !== NULL) {
$maxParticipants = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $eventId, 'max_participants');
$eventfullMsg = ts("This event currently has the maximum number of participants registered (%1). However, you can still override this limit and register additional participants using this form.", array(
*/
public static function getAdditionalParticipantUrl($participantIds) {
foreach ($participantIds as $value) {
*/
public static function getAdditionalParticipantUrl($participantIds) {
foreach ($participantIds as $value) {
$details = self::participantDetails($value);
$viewUrl = CRM_Utils_System::url('civicrm/contact/view/participant',
"action=view&reset=1&id={$value}&cid={$details['cid']}"
$details = self::participantDetails($value);
$viewUrl = CRM_Utils_System::url('civicrm/contact/view/participant',
"action=view&reset=1&id={$value}&cid={$details['cid']}"
LEFT JOIN civicrm_price_field cpf ON cpfv.price_field_id = cpf.id
WHERE cpf.price_set_id = %1 AND cpfv.label LIKE %2";
$params = array(
LEFT JOIN civicrm_price_field cpf ON cpfv.price_field_id = cpf.id
WHERE cpf.price_set_id = %1 AND cpfv.label LIKE %2";
$params = array(
- 1 => array($priceSetId, 'Integer'),
- 2 => array($feeLevel, 'String'));
+ 1 => array($priceSetId, 'Integer'),
+ 2 => array($feeLevel, 'String'),
+ );
$mainAmount = CRM_Core_DAO::singleValueQuery($query, $params);
$relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Discounts Account is' "));
$contributionParams['trxnParams']['from_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType(
$contributionParams['contribution']->financial_type_id, $relationTypeId);
if (!empty($contributionParams['trxnParams']['from_financial_account_id'])) {
$contributionParams['trxnParams']['total_amount'] = $mainAmount - $contributionParams['total_amount'];
$mainAmount = CRM_Core_DAO::singleValueQuery($query, $params);
$relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Discounts Account is' "));
$contributionParams['trxnParams']['from_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType(
$contributionParams['contribution']->financial_type_id, $relationTypeId);
if (!empty($contributionParams['trxnParams']['from_financial_account_id'])) {
$contributionParams['trxnParams']['total_amount'] = $mainAmount - $contributionParams['total_amount'];
- $contributionParams['trxnParams']['payment_processor_id'] = $contributionParams['trxnParams']['payment_instrument_id'] =
- $contributionParams['trxnParams']['check_number'] = $contributionParams['trxnParams']['trxn_id'] =
- $contributionParams['trxnParams']['net_amount'] = $contributionParams['trxnParams']['fee_amount'] = NULL;
+ $contributionParams['trxnParams']['payment_processor_id'] = NULL;
+ $contributionParams['trxnParams']['payment_instrument_id'] = NULL;
+ $contributionParams['trxnParams']['check_number'] = NULL;
+ $contributionParams['trxnParams']['trxn_id'] = NULL;
+ $contributionParams['trxnParams']['net_amount'] = NULL;
+ $contributionParams['trxnParams']['fee_amount'] = NULL;
*/
public static function deleteContactParticipant($contactId) {
$participant = new CRM_Event_DAO_Participant();
*/
public static function deleteContactParticipant($contactId) {
$participant = new CRM_Event_DAO_Participant();
unset($insertLines[$previousLineItem['price_field_value_id']]);
// for updating the line items i.e. use-case - once deselect-option selecting again
if (($previousLineItem['line_total'] != $submittedLineItems[$previousLineItem['price_field_value_id']]['line_total']) ||
unset($insertLines[$previousLineItem['price_field_value_id']]);
// for updating the line items i.e. use-case - once deselect-option selecting again
if (($previousLineItem['line_total'] != $submittedLineItems[$previousLineItem['price_field_value_id']]['line_total']) ||
$updateLines[$previousLineItem['price_field_value_id']] = $submittedLineItems[$previousLineItem['price_field_value_id']];
$updateLines[$previousLineItem['price_field_value_id']]['id'] = $id;
}
$updateLines[$previousLineItem['price_field_value_id']] = $submittedLineItems[$previousLineItem['price_field_value_id']];
$updateLines[$previousLineItem['price_field_value_id']]['id'] = $id;
}
// if not submitted and difference is not 0 make it negative
if (!in_array($updateFinancialItemInfoValues['price_field_value_id'], $submittedFieldValueIds) && $updateFinancialItemInfoValues['differenceAmt'] != 0) {
// INSERT negative financial_items
// if not submitted and difference is not 0 make it negative
if (!in_array($updateFinancialItemInfoValues['price_field_value_id'], $submittedFieldValueIds) && $updateFinancialItemInfoValues['differenceAmt'] != 0) {
// INSERT negative financial_items
CRM_Financial_BAO_FinancialItem::create($updateFinancialItemInfoValues, NULL, $trxnId);
// INSERT negative financial_items for tax amount
if ($previousLineItems[$updateFinancialItemInfoValues['entity_id']]['tax_amount']) {
CRM_Financial_BAO_FinancialItem::create($updateFinancialItemInfoValues, NULL, $trxnId);
// INSERT negative financial_items for tax amount
if ($previousLineItems[$updateFinancialItemInfoValues['entity_id']]['tax_amount']) {
$updateFinancialItemInfoValues['description'] = $taxTerm;
if ($updateFinancialItemInfoValues['financial_type_id']) {
$updateFinancialItemInfoValues['financial_account_id'] = CRM_Contribute_BAO_Contribution::getFinancialAccountId($updateFinancialItemInfoValues['financial_type_id']);
$updateFinancialItemInfoValues['description'] = $taxTerm;
if ($updateFinancialItemInfoValues['financial_type_id']) {
$updateFinancialItemInfoValues['financial_account_id'] = CRM_Contribute_BAO_Contribution::getFinancialAccountId($updateFinancialItemInfoValues['financial_type_id']);
$updateLineItem = "UPDATE civicrm_line_item li
INNER JOIN civicrm_financial_item fi
ON (li.id = fi.entity_id AND fi.entity_table = 'civicrm_line_item')
$updateLineItem = "UPDATE civicrm_line_item li
INNER JOIN civicrm_financial_item fi
ON (li.id = fi.entity_id AND fi.entity_table = 'civicrm_line_item')
$partUpdateFeeAmt['id'] = $participantId;
foreach ($lineItems as $lineValue) {
if ($lineValue['price_field_value_id']) {
$partUpdateFeeAmt['id'] = $participantId;
foreach ($lineItems as $lineValue) {
if ($lineValue['price_field_value_id']) {
$ftDetail = CRM_Core_BAO_FinancialTrxn::getBalanceTrxnAmt($contributionId);
// adjusted amount financial_trxn creation
if (empty($ftDetail['trxn_id'])) {
$ftDetail = CRM_Core_BAO_FinancialTrxn::getBalanceTrxnAmt($contributionId);
// adjusted amount financial_trxn creation
if (empty($ftDetail['trxn_id'])) {
- $updatedContribution =
- CRM_Contribute_BAO_Contribution::getValues(array('id' => $contributionId), CRM_Core_DAO::$_nullArray, CRM_Core_DAO::$_nullArray);
+ $updatedContribution = CRM_Contribute_BAO_Contribution::getValues(
+ array('id' => $contributionId),
+ CRM_Core_DAO::$_nullArray,
+ CRM_Core_DAO::$_nullArray
+ );
$relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
$toFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($updatedContribution->financial_type_id, $relationTypeId);
$relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
$toFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($updatedContribution->financial_type_id, $relationTypeId);
'payment_instrument_id' => $updatedContribution->payment_instrument_id,
'contribution_id' => $updatedContribution->id,
'trxn_date' => date('YmdHis'),
'payment_instrument_id' => $updatedContribution->payment_instrument_id,
'contribution_id' => $updatedContribution->id,
'trxn_date' => date('YmdHis'),
*/
public static function buildOptions($fieldName, $context = NULL, $props = array()) {
$params = array('condition' => array());
*/
public static function buildOptions($fieldName, $context = NULL, $props = array()) {
$params = array('condition' => array());
return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context);
}
return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context);
}