*
* @var array
*/
- protected $entityReferenceFields = array('membership_type_id');
+ protected $entityReferenceFields = array('event_id', 'membership_type_id');
/**
* Name of the selector to use.
$value = $extractEventId[2];
unset($query->_where[$grouping][$key]);
}
+ else if (strstr($val, 'civicrm_event.id IN')) {
+ //extract the first event id if multiple events are selected
+ preg_match('/civicrm_event.id IN \(\"(\d+)/', $val, $matches);
+ $value = $matches[1];
+ unset($query->_where[$grouping][$key]);
+ }
+ }
+ if ($exEventId) {
+ $extractEventId = explode(" ", $exEventId);
+ $value = $extractEventId[2];
+ }
+ else if(!empty($matches[1])) {
+ $value = $matches[1];
}
- $extractEventId = explode(" ", $exEventId);
- $value = $extractEventId[2];
unset($query->_where[$grouping][$key]);
}
$thisEventHasParent = CRM_Core_BAO_RecurringEntity::getParentFor($value, 'civicrm_event');
return;
case 'participant_fee_id':
- $feeLabel = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $value, 'label');
- $feeLabel = CRM_Core_DAO::escapeString(trim($feeLabel));
- if ($value) {
- $query->_where[$grouping][] = "civicrm_participant.fee_level LIKE '%$feeLabel%'";
- $query->_qill[$grouping][] = ts("Fee level") . " contains $feeLabel";
+ foreach ($value as $k => &$val) {
+ $val = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $val, 'label');
+ $val = CRM_Core_DAO::escapeString(trim($val));
}
+ $feeLabel = implode('|', $value);
+ $query->_where[$grouping][] = "civicrm_participant.fee_level REGEXP '{$feeLabel}'";
+ $query->_qill[$grouping][] = ts("Fee level") . " IN " . implode(', ', $value);
$query->_tables['civicrm_participant'] = $query->_whereTables['civicrm_participant'] = 1;
return;
$form->addEntityRef('event_id', ts('Event Name'), array(
'entity' => 'event',
'placeholder' => ts('- any -'),
+ 'multiple' => 1,
'select' => array('minimumInputLength' => 0),
)
);
),
)
);
- $form->add('text', 'participant_fee_id', ts('Fee Level'), array('class' => 'big crm-ajax-select'));
+ $obj = new CRM_Report_Form_Event_ParticipantListing();
+ $form->add('select', 'participant_fee_id',
+ ts('Fee Level'),
+ $obj->getPriceLevels(),
+ FALSE, array('class' => 'crm-select2', 'multiple' => 'multiple', 'placeholder' => ts('- any -'))
+ );
CRM_Core_Form_Date::buildDateRange($form, 'event', 1, '_start_date_low', '_end_date_high', ts('From'), FALSE);
);
}
- $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
+ $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues, 0, FALSE, NULL, array('event_id'));
$selector = new CRM_Event_Selector_Search($this->_queryParams,
$this->_action,
NULL,
// CRM-15379
if (!empty($this->_formValues['participant_fee_id'])) {
$participant_fee_id = $this->_formValues['participant_fee_id'];
- $feeLabel = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $participant_fee_id, 'label');
- $feeLabel = CRM_Core_DAO::escapeString(trim($feeLabel));
- $seatClause[] = "( participant.fee_level LIKE '%$feeLabel%' )";
+ foreach ($participant_fee_id as $k => &$val) {
+ $val = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $val, 'label');
+ $val = CRM_Core_DAO::escapeString(trim($val));
+ }
+ $feeLabel = implode('|', $participant_fee_id);
+ $seatClause[] = "( participant.fee_level REGEXP '{$feeLabel}' )";
}
$seatClause = implode(' AND ', $seatClause);
CRM_Core_BAO_CustomValue::fixCustomFieldValue($this->_formValues);
- $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
+ $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues, 0, FALSE, NULL, array('event_id'));
$this->set('formValues', $this->_formValues);
$this->set('queryParams', $this->_queryParams);
);
}
- $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
+ $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues, 0, FALSE, NULL, array('event_id'));
$selector = new CRM_Event_Selector_Search($this->_queryParams,
$this->_action,
if (!$(this).data('select2')) {
$(this).crmEntityRef();
}
- isRepeating = $(this).select2('data').extra.is_recur;
+ if (!$.isEmptyObject($(this).select2('data')[0].extra)) {
+ isRepeating = $(this).select2('data')[0].extra.is_recur;
+ }
}
if (isRepeating) {
$('.crm-event-form-block-event_include_repeating_events').show();
- $('label[for=event_include_repeating_events]').html(recurringLabel.replace('%1', $(this).select2('data').label));
+ $('label[for=event_include_repeating_events]').html(recurringLabel.replace('%1', $(this).select2('data')[0].label));
} else {
$('.crm-event-form-block-event_include_repeating_events').hide().find('input').prop('checked', false);
}
}
$('#event_id').each(toggleRecurrigCheckbox).change(toggleRecurrigCheckbox);
-
- // FIXME: This could be much simpler as an entityRef field but the priceFieldValue api doesn't currently support the filters we need
- $('#participant_fee_id').crmSelect2({
- placeholder: {/literal}'{ts escape="js"}- any -{/ts}'{literal},
- minimumInputLength: 1,
- allowClear: true,
- ajax: {
- url: "{/literal}{$dataURLEventFee}{literal}",
- data: function(term) {
- return {term: term};
- },
- results: function(response) {
- return {results: response};
- }
- },
- initSelection: function(el, callback) {
- CRM.api3('price_field_value', 'getsingle', {id: $(el).val()}).done(function(data) {
- callback({id: data.id, text: data.label});
- });
- }
- });
});
</script>
{/literal}