3 +--------------------------------------------------------------------+
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2019 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2019
35 class CRM_Event_BAO_Query
extends CRM_Core_BAO_Query
{
38 * Function get the import/export fields for contribution.
40 * @param bool $checkPermission
43 * Associative array of contribution fields
45 public static function &getFields($checkPermission = TRUE) {
47 $fields = array_merge($fields, CRM_Event_DAO_Event
::import());
48 $fields = array_merge($fields, self
::getParticipantFields());
49 $fields = array_merge($fields, CRM_Core_DAO_Discount
::export());
57 public static function &getParticipantFields() {
58 $fields = CRM_Event_BAO_Participant
::importableFields('Individual', TRUE, TRUE);
63 * Build select for CiviEvent.
67 public static function select(&$query) {
68 if (($query->_mode
& CRM_Contact_BAO_Query
::MODE_EVENT
) ||
69 CRM_Contact_BAO_Query
::componentPresent($query->_returnProperties
, 'participant_')
71 $query->_select
['participant_id'] = "civicrm_participant.id as participant_id";
72 $query->_element
['participant_id'] = 1;
73 $query->_tables
['civicrm_participant'] = $query->_whereTables
['civicrm_participant'] = 1;
76 if (!empty($query->_returnProperties
['participant_fee_level'])) {
77 $query->_select
['participant_fee_level'] = "civicrm_participant.fee_level as participant_fee_level";
78 $query->_element
['participant_fee_level'] = 1;
81 //add participant contact ID
82 if (!empty($query->_returnProperties
['participant_contact_id'])) {
83 $query->_select
['participant_contact_id'] = "civicrm_participant.contact_id as participant_contact_id";
84 $query->_element
['participant_contact_id'] = 1;
88 if (!empty($query->_returnProperties
['participant_fee_amount'])) {
89 $query->_select
['participant_fee_amount'] = "civicrm_participant.fee_amount as participant_fee_amount";
90 $query->_element
['participant_fee_amount'] = 1;
94 if (!empty($query->_returnProperties
['participant_fee_currency'])) {
95 $query->_select
['participant_fee_currency'] = "civicrm_participant.fee_currency as participant_fee_currency";
96 $query->_element
['participant_fee_currency'] = 1;
99 //add event title also if event id is select
100 if (!empty($query->_returnProperties
['event_id']) ||
!empty($query->_returnProperties
['event_title'])) {
101 $query->_select
['event_id'] = "civicrm_event.id as event_id";
102 $query->_select
['event_title'] = "civicrm_event.title as event_title";
103 $query->_element
['event_id'] = 1;
104 $query->_element
['event_title'] = 1;
105 $query->_tables
['civicrm_event'] = 1;
106 $query->_whereTables
['civicrm_event'] = 1;
109 //add start date / end date
110 if (!empty($query->_returnProperties
['event_start_date'])) {
111 $query->_select
['event_start_date'] = "civicrm_event.start_date as event_start_date";
112 $query->_element
['event_start_date'] = 1;
115 if (!empty($query->_returnProperties
['event_end_date'])) {
116 $query->_select
['event_end_date'] = "civicrm_event.end_date as event_end_date";
117 $query->_element
['event_end_date'] = 1;
121 if (!empty($query->_returnProperties
['event_type'])) {
122 $query->_select
['event_type'] = "event_type.label as event_type";
123 $query->_element
['event_type'] = 1;
124 $query->_tables
['event_type'] = 1;
125 $query->_whereTables
['event_type'] = 1;
128 if (!empty($query->_returnProperties
['event_type_id'])) {
129 $query->_select
['event_type_id'] = "civicrm_event.event_type_id as event_type_id";
130 $query->_element
['event_type_id'] = 1;
131 $query->_tables
['civicrm_event'] = 1;
132 $query->_whereTables
['civicrm_event'] = 1;
136 if (!empty($query->_returnProperties
['participant_status_id'])) {
137 $query->_select
['participant_status_id'] = "civicrm_participant.status_id as participant_status_id";
138 $query->_element
['participant_status_id'] = 1;
139 $query->_tables
['civicrm_participant'] = 1;
140 $query->_whereTables
['civicrm_participant'] = 1;
143 // get particupant_status label
144 if (!empty($query->_returnProperties
['participant_status'])) {
145 $query->_select
['participant_status'] = "participant_status.label as participant_status";
146 $query->_element
['participant_status'] = 1;
147 $query->_tables
['participant_status'] = 1;
148 $query->_whereTables
['civicrm_participant'] = 1;
151 //add participant_role_id
152 if (!empty($query->_returnProperties
['participant_role_id'])) {
153 $query->_select
['participant_role_id'] = "civicrm_participant.role_id as participant_role_id";
154 $query->_element
['participant_role_id'] = 1;
155 $query->_tables
['civicrm_participant'] = 1;
156 $query->_whereTables
['civicrm_participant'] = 1;
157 $query->_pseudoConstantsSelect
['participant_role_id'] = [
158 'pseudoField' => 'participant_role_id',
159 'idCol' => 'participant_role_id',
163 //add participant_role
164 if (!empty($query->_returnProperties
['participant_role'])) {
165 $query->_select
['participant_role'] = "civicrm_participant.role_id as participant_role";
166 $query->_element
['participant_role'] = 1;
167 $query->_tables
['participant_role'] = 1;
168 $query->_whereTables
['civicrm_participant'] = 1;
169 $query->_pseudoConstantsSelect
['participant_role'] = [
170 'pseudoField' => 'participant_role',
171 'idCol' => 'participant_role',
176 if (!empty($query->_returnProperties
['participant_register_date'])) {
177 $query->_select
['participant_register_date'] = "civicrm_participant.register_date as participant_register_date";
178 $query->_element
['participant_register_date'] = 1;
182 if (!empty($query->_returnProperties
['participant_source'])) {
183 $query->_select
['participant_source'] = "civicrm_participant.source as participant_source";
184 $query->_element
['participant_source'] = 1;
185 $query->_tables
['civicrm_participant'] = $query->_whereTables
['civicrm_participant'] = 1;
189 if (!empty($query->_returnProperties
['participant_note'])) {
190 $query->_select
['participant_note'] = "participant_note.note as participant_note";
191 $query->_element
['participant_note'] = 1;
192 $query->_tables
['participant_note'] = 1;
193 $query->_whereTables
['participant_note'] = 1;
196 if (!empty($query->_returnProperties
['participant_is_pay_later'])) {
197 $query->_select
['participant_is_pay_later'] = "civicrm_participant.is_pay_later as participant_is_pay_later";
198 $query->_element
['participant_is_pay_later'] = 1;
201 if (!empty($query->_returnProperties
['participant_is_test'])) {
202 $query->_select
['participant_is_test'] = "civicrm_participant.is_test as participant_is_test";
203 $query->_element
['participant_is_test'] = 1;
206 if (!empty($query->_returnProperties
['participant_registered_by_id'])) {
207 $query->_select
['participant_registered_by_id'] = "civicrm_participant.registered_by_id as participant_registered_by_id";
208 $query->_element
['participant_registered_by_id'] = 1;
212 if (!empty($query->_returnProperties
['participant_discount_name'])) {
213 $query->_select
['participant_discount_name'] = "discount_name.title as participant_discount_name";
214 $query->_element
['participant_discount_name'] = 1;
215 $query->_tables
['civicrm_discount'] = 1;
216 $query->_tables
['participant_discount_name'] = 1;
217 $query->_whereTables
['civicrm_discount'] = 1;
218 $query->_whereTables
['participant_discount_name'] = 1;
221 //carry campaign id to selectors.
222 if (!empty($query->_returnProperties
['participant_campaign_id'])) {
223 $query->_select
['participant_campaign_id'] = 'civicrm_participant.campaign_id as participant_campaign_id';
224 $query->_element
['participant_campaign_id'] = 1;
232 public static function where(&$query) {
234 foreach (array_keys($query->_params
) as $id) {
235 if (empty($query->_params
[$id][0])) {
238 if (substr($query->_params
[$id][0], 0, 6) == 'event_' ||
239 substr($query->_params
[$id][0], 0, 12) == 'participant_'
241 if ($query->_mode
== CRM_Contact_BAO_Query
::MODE_CONTACTS
) {
242 $query->_useDistinct
= TRUE;
244 $grouping = $query->_params
[$id][3];
245 self
::whereClauseSingle($query->_params
[$id], $query);
254 public static function whereClauseSingle(&$values, &$query) {
255 $checkPermission = empty($query->_skipPermission
);
256 list($name, $op, $value, $grouping, $wildcard) = $values;
257 $fields = array_merge(CRM_Event_BAO_Event
::fields(), CRM_Event_BAO_Participant
::exportableFields());
260 case 'event_start_date_low':
261 case 'event_start_date_high':
262 $query->dateQueryBuilder($values,
263 'civicrm_event', 'event_start_date', 'start_date', 'Start Date'
267 case 'event_end_date_low':
268 case 'event_end_date_high':
269 $query->dateQueryBuilder($values,
270 'civicrm_event', 'event_end_date', 'end_date', 'End Date'
274 case 'event_include_repeating_events':
276 * Include Repeating Events
278 //Get parent of this event
280 if ($query->_where
[$grouping]) {
281 foreach ($query->_where
[$grouping] as $key => $val) {
282 if (strstr($val, 'civicrm_event.id =')) {
284 $extractEventId = explode(" ", $val);
285 $value = $extractEventId[2];
286 $where = $query->_where
[$grouping][$key];
288 elseif (strstr($val, 'civicrm_event.id IN')) {
289 //extract the first event id if multiple events are selected
290 preg_match('/civicrm_event.id IN \(\"(\d+)/', $val, $matches);
291 $value = $matches[1];
292 $where = $query->_where
[$grouping][$key];
296 $extractEventId = explode(" ", $exEventId);
297 $value = $extractEventId[2];
299 elseif (!empty($matches[1])) {
300 $value = $matches[1];
302 $where = $query->_where
[$grouping][$key];
304 $thisEventHasParent = CRM_Core_BAO_RecurringEntity
::getParentFor($value, 'civicrm_event');
305 if ($thisEventHasParent) {
306 $getAllConnections = CRM_Core_BAO_RecurringEntity
::getEntitiesForParent($thisEventHasParent, 'civicrm_event');
308 foreach ($getAllConnections as $key => $val) {
309 $allEventIds[] = $val['id'];
311 if (!empty($allEventIds)) {
313 $value = "(" . implode(",", $allEventIds) . ")";
316 $query->_where
[$grouping][] = "{$where} OR civicrm_event.id $op {$value}";
317 $query->_qill
[$grouping][] = ts('Include Repeating Events');
318 $query->_tables
['civicrm_event'] = $query->_whereTables
['civicrm_event'] = 1;
321 case 'participant_is_test':
322 $key = array_search('civicrm_participant.is_test = 0', $query->_where
[$grouping]);
324 unset($query->_where
[$grouping][$key]);
326 case 'participant_test':
327 // We dont want to include all tests for sql OR CRM-7827
328 if (!$value ||
$query->getOperator() != 'OR') {
329 $query->_where
[$grouping][] = CRM_Contact_BAO_Query
::buildClause("civicrm_participant.is_test",
335 $isTest = $value ?
'a Test' : 'not a Test';
336 $query->_qill
[$grouping][] = ts("Participant is %1", [1 => $isTest]);
337 $query->_tables
['civicrm_participant'] = $query->_whereTables
['civicrm_participant'] = 1;
341 case 'participant_fee_id':
343 foreach ($value as $val) {
344 $labels[] = CRM_Core_DAO
::getFieldValue('CRM_Price_DAO_PriceFieldValue', $val, 'label');
346 $query->_where
[$grouping][] = "civicrm_line_item.price_field_value_id IN (" . implode(', ', $value) . ")";
347 $query->_qill
[$grouping][] = ts("Fee level") . " IN " . implode(', ', $labels);
348 $query->_tables
['civicrm_participant'] = $query->_tables
['civicrm_line_item'] = $query->_whereTables
['civicrm_line_item'] = 1;
351 case 'participant_fee_amount_high':
352 case 'participant_fee_amount_low':
353 $query->numberRangeBuilder($values,
354 'civicrm_participant', 'participant_fee_amount', 'fee_amount', 'Fee Amount'
358 case 'participant_status_id':
359 if ($value && is_array($value) && strpos($op, 'IN') === FALSE) {
362 case 'participant_status':
363 case 'participant_source':
364 case 'participant_id':
365 case 'participant_contact_id':
366 case 'participant_is_pay_later':
367 case 'participant_fee_amount':
368 case 'participant_fee_level':
369 case 'participant_campaign_id':
370 case 'participant_registered_by_id':
373 if (in_array($name, [
374 'participant_status_id',
375 'participant_source',
377 'participant_contact_id',
378 'participant_fee_amount',
379 'participant_fee_level',
380 'participant_is_pay_later',
381 'participant_campaign_id',
382 'participant_registered_by_id',
384 $name = str_replace('participant_', '', $name);
385 if ($name == 'is_pay_later') {
389 elseif ($name == 'participant_status') {
393 $dataType = !empty($fields[$qillName]['type']) ? CRM_Utils_Type
::typeToString($fields[$qillName]['type']) : 'String';
394 $tableName = empty($tableName) ?
'civicrm_participant' : $tableName;
395 if (is_array($value) && in_array(key($value), CRM_Core_DAO
::acceptedSQLOperators(), TRUE)) {
397 $value = $value[$op];
399 $query->_where
[$grouping][] = CRM_Contact_BAO_Query
::buildClause("$tableName.$name", $op, $value, $dataType);
401 list($op, $value) = CRM_Contact_BAO_Query
::buildQillForFieldValue('CRM_Event_DAO_Participant', $name, $value, $op);
402 $query->_qill
[$grouping][] = ts('%1 %2 %3', [1 => $fields[$qillName]['title'], 2 => $op, 3 => $value]);
403 $query->_tables
['civicrm_participant'] = $query->_whereTables
['civicrm_participant'] = 1;
406 case 'participant_role':
407 case 'participant_role_id':
411 $dataType = !empty($fields[$qillName]['type']) ? CRM_Utils_Type
::typeToString($fields[$qillName]['type']) : 'String';
412 $tableName = empty($tableName) ?
'civicrm_participant' : $tableName;
413 if (is_array($value) && in_array(key($value), CRM_Core_DAO
::acceptedSQLOperators(), TRUE)) {
415 $value = $value[$op];
417 if (!strstr($op, 'NULL') && !strstr($op, 'EMPTY') && !strstr($op, 'LIKE')) {
418 $regexOp = (strstr($op, '!') ||
strstr($op, 'NOT')) ?
'NOT REGEXP' : 'REGEXP';
419 $regexp = "([[:cntrl:]]|^)" . implode('([[:cntrl:]]|$)|([[:cntrl:]]|^)', (array) $value) . "([[:cntrl:]]|$)";
420 $query->_where
[$grouping][] = CRM_Contact_BAO_Query
::buildClause("civicrm_participant.$name", $regexOp, $regexp, 'String');
423 $query->_where
[$grouping][] = CRM_Contact_BAO_Query
::buildClause("$tableName.$name", $op, $value, $dataType);
426 list($op, $value) = CRM_Contact_BAO_Query
::buildQillForFieldValue('CRM_Event_DAO_Participant', $name, $value, $op);
427 $query->_qill
[$grouping][] = ts('%1 %2 %3', [1 => $fields[$qillName]['title'], 2 => $op, 3 => $value]);
428 $query->_tables
['civicrm_participant'] = $query->_whereTables
['civicrm_participant'] = 1;
431 case 'participant_register_date':
432 case 'participant_register_date_high':
433 case 'participant_register_date_low':
434 $query->dateQueryBuilder($values,
435 'civicrm_participant', 'participant_register_date', 'register_date', 'Register Date'
440 case 'participant_event_id':
441 $name = str_replace('participant_', '', $name);
442 case 'event_is_public':
443 case 'event_type_id':
446 if (in_array($name, [
451 $name = str_replace('event_', '', $name);
453 $dataType = !empty($fields[$qillName]['type']) ? CRM_Utils_Type
::typeToString($fields[$qillName]['type']) : 'String';
455 $query->_where
[$grouping][] = CRM_Contact_BAO_Query
::buildClause("civicrm_event.$name", $op, $value, $dataType);
456 $query->_tables
['civicrm_event'] = $query->_whereTables
['civicrm_event'] = 1;
457 if (!array_key_exists($qillName, $fields)) {
460 list($op, $value) = CRM_Contact_BAO_Query
::buildQillForFieldValue('CRM_Event_DAO_Event', $name, $value, $op, ['check_permission' => $checkPermission]);
461 $query->_qill
[$grouping][] = ts('%1 %2 %3', [1 => $fields[$qillName]['title'], 2 => $op, 3 => $value]);
464 case 'participant_note':
465 $query->_tables
['civicrm_participant'] = $query->_whereTables
['civicrm_participant'] = 1;
466 $query->_tables
['participant_note'] = $query->_whereTables
['participant_note'] = 1;
467 $query->_where
[$grouping][] = CRM_Contact_BAO_Query
::buildClause('participant_note.note', $op, $value, 'String');
468 $query->_qill
[$grouping][] = ts('%1 %2 %3', [1 => $fields[$name]['title'], 2 => $op, 3 => $value]);
474 * @param string $name
478 * @return null|string
480 public static function from($name, $mode, $side) {
483 case 'civicrm_participant':
484 $from = " LEFT JOIN civicrm_participant ON civicrm_participant.contact_id = contact_a.id ";
487 case 'civicrm_event':
489 $from = " LEFT JOIN civicrm_event ON civicrm_participant.event_id = civicrm_event.id ";
493 $from = " $side JOIN civicrm_option_group option_group_event_type ON (option_group_event_type.name = 'event_type')";
494 $from .= " $side JOIN civicrm_option_value event_type ON (civicrm_event.event_type_id = event_type.value AND option_group_event_type.id = event_type.option_group_id ) ";
497 case 'participant_note':
498 $from .= " $side JOIN civicrm_note participant_note ON ( participant_note.entity_table = 'civicrm_participant' AND
499 civicrm_participant.id = participant_note.entity_id )";
502 case 'participant_status':
503 $from .= " $side JOIN civicrm_participant_status_type participant_status ON (civicrm_participant.status_id = participant_status.id) ";
506 case 'participant_role':
507 $from = " $side JOIN civicrm_option_group option_group_participant_role ON (option_group_participant_role.name = 'participant_role')";
508 $from .= " $side JOIN civicrm_option_value participant_role ON ((civicrm_participant.role_id = participant_role.value OR SUBSTRING_INDEX(role_id,'\ 1', 1) = participant_role.value)
509 AND option_group_participant_role.id = participant_role.option_group_id ) ";
512 case 'participant_discount_name':
513 $from = " $side JOIN civicrm_discount discount ON ( civicrm_participant.discount_id = discount.id )";
514 $from .= " $side JOIN civicrm_option_group discount_name ON ( discount_name.id = discount.price_set_id ) ";
517 case 'civicrm_line_item':
518 $from .= " $side JOIN civicrm_line_item ON civicrm_line_item.entity_id = civicrm_participant.id AND civicrm_line_item.entity_table = 'civicrm_participant'";
526 * @param bool $includeCustomFields
530 public static function defaultReturnProperties(
532 $includeCustomFields = TRUE
535 if ($mode & CRM_Contact_BAO_Query
::MODE_EVENT
) {
538 'contact_sub_type' => 1,
543 'event_start_date' => 1,
544 'event_end_date' => 1,
546 'participant_id' => 1,
547 'participant_status' => 1,
548 'participant_status_id' => 1,
549 'participant_role' => 1,
550 'participant_role_id' => 1,
551 'participant_note' => 1,
552 'participant_register_date' => 1,
553 'participant_source' => 1,
554 'participant_fee_level' => 1,
555 'participant_is_test' => 1,
556 'participant_is_pay_later' => 1,
557 'participant_fee_amount' => 1,
558 'participant_discount_name' => 1,
559 'participant_fee_currency' => 1,
560 'participant_registered_by_id' => 1,
561 'participant_campaign_id' => 1,
564 if ($includeCustomFields) {
565 // also get all the custom participant properties
566 $fields = CRM_Core_BAO_CustomField
::getFieldsForImport('Participant');
567 if (!empty($fields)) {
568 foreach ($fields as $name => $dontCare) {
569 $properties[$name] = 1;
579 * Get the metadata for fields to be included on the grant search form.
581 * @throws \CiviCRM_API3_Exception
583 public static function getSearchFieldMetadata() {
585 'participant_status_id',
586 'participant_register_date',
588 $metadata = civicrm_api3('Participant', 'getfields', [])['values'];
589 return array_intersect_key($metadata, array_flip($fields));
593 * Build the event search form.
595 * @param \CRM_Event_Form_Search $form
597 * @throws \CiviCRM_API3_Exception
598 * @throws \CRM_Core_Exception
600 public static function buildSearchForm(&$form) {
601 $form->addSearchFieldMetadata(['Participant' => self
::getSearchFieldMetadata()]);
602 $form->addFormFieldsFromMetadata();
603 $dataURLEventFee = CRM_Utils_System
::url('civicrm/ajax/eventFee',
608 $form->assign('dataURLEventFee', $dataURLEventFee);
610 $form->addEntityRef('event_id', ts('Event Name'), [
612 'placeholder' => ts('- any -'),
614 'select' => ['minimumInputLength' => 0],
616 $form->addEntityRef('event_type_id', ts('Event Type'), [
617 'entity' => 'OptionValue',
618 'placeholder' => ts('- any -'),
619 'select' => ['minimumInputLength' => 0],
621 'params' => ['option_group_id' => 'event_type'],
624 $obj = new CRM_Report_Form_Event_ParticipantListing();
625 $form->add('select', 'participant_fee_id',
627 $obj->getPriceLevels(),
628 FALSE, ['class' => 'crm-select2', 'multiple' => 'multiple', 'placeholder' => ts('- any -')]
631 CRM_Core_Form_Date
::buildDateRange($form, 'event', 1, '_start_date_low', '_end_date_high', ts('From'), FALSE);
633 $form->addElement('hidden', 'event_date_range_error');
634 $form->addFormRule(['CRM_Event_BAO_Query', 'formRule'], $form);
636 $form->addElement('checkbox', "event_include_repeating_events", NULL, ts('Include participants from all events in the %1 series', [1 => '<em>%1</em>']));
638 $form->addSelect('participant_role_id',
640 'entity' => 'participant',
641 'label' => ts('Participant Role'),
642 'multiple' => 'multiple',
643 'option_url' => NULL,
644 'placeholder' => ts('- any -'),
648 $form->addYesNo('participant_test', ts('Participant is a Test?'), TRUE);
649 $form->addYesNo('participant_is_pay_later', ts('Participant is Pay Later?'), TRUE);
650 $form->addElement('text', 'participant_fee_amount_low', ts('From'), ['size' => 8, 'maxlength' => 8]);
651 $form->addElement('text', 'participant_fee_amount_high', ts('To'), ['size' => 8, 'maxlength' => 8]);
653 $form->addRule('participant_fee_amount_low', ts('Please enter a valid money value.'), 'money');
654 $form->addRule('participant_fee_amount_high', ts('Please enter a valid money value.'), 'money');
656 self
::addCustomFormFields($form, ['Participant', 'Event']);
658 CRM_Campaign_BAO_Campaign
::addCampaignInComponentSearch($form, 'participant_campaign_id');
660 $form->assign('validCiviEvent', TRUE);
661 $form->setDefaults(['participant_test' => 0]);
667 public static function tableNames(&$tables) {
668 //add participant table
669 if (!empty($tables['civicrm_event'])) {
670 $tables = array_merge(['civicrm_participant' => 1], $tables);
675 * Check if the values in the date range are in correct chronological order.
677 * @todo Get this to work with CRM_Utils_Rule::validDateRange
679 * @param array $fields
680 * @param array $files
681 * @param CRM_Core_Form $form
685 public static function formRule($fields, $files, $form) {
688 if ((empty($fields['event_start_date_low']) ||
empty($fields['event_end_date_high']))) {
691 $lowDate = strtotime($fields['event_start_date_low']);
692 $highDate = strtotime($fields['event_end_date_high']);
694 if ($lowDate > $highDate) {
695 $errors['event_date_range_error'] = ts('Please check that your Event Date Range is in correct chronological order.');
698 return empty($errors) ?
TRUE : $errors;