X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FEvent%2FBAO%2FQuery.php;h=376d3062e0cd8217903ffe1315093911beabe916;hb=3410006a55b7e8b4d90c69c07d367f93b2454872;hp=26b36a36bc28ec356818ab81b38aa7d18916194f;hpb=0ec03e9fabc23b802ac80cb68c44b5abaf7f8585;p=civicrm-core.git diff --git a/CRM/Event/BAO/Query.php b/CRM/Event/BAO/Query.php index 26b36a36bc..376d3062e0 100644 --- a/CRM/Event/BAO/Query.php +++ b/CRM/Event/BAO/Query.php @@ -56,7 +56,7 @@ class CRM_Event_BAO_Query { } /** - * build select for CiviEvent + * Build select for CiviEvent * * @param $query * @@ -207,6 +207,7 @@ class CRM_Event_BAO_Query { } } + /** * @param $query */ @@ -256,6 +257,42 @@ class CRM_Event_BAO_Query { $query->_tables['civicrm_event'] = $query->_whereTables['civicrm_event'] = 1; return; + case 'event_include_repeating_events': + /** + * Include Repeating Events + */ + //Get parent of this event + $exEventId = ''; + if ($query->_where[$grouping]) { + foreach($query->_where[$grouping] as $key => $val) { + if (strstr($val, 'civicrm_event.id =')) { + $exEventId = $val; + $extractEventId = explode(" ", $val); + $value = $extractEventId[2]; + unset($query->_where[$grouping][$key]); + } + } + $extractEventId = explode(" ", $exEventId); + $value = $extractEventId[2]; + unset($query->_where[$grouping][$key]); + } + $thisEventHasParent = CRM_Core_BAO_RecurringEntity::getParentFor($value, 'civicrm_event'); + if ($thisEventHasParent) { + $getAllConnections = CRM_Core_BAO_RecurringEntity::getEntitiesForParent($thisEventHasParent, 'civicrm_event'); + $allEventIds = array(); + foreach($getAllConnections as $key => $val) { + $allEventIds[] = $val['id']; + } + if (!empty($allEventIds)) { + $op = "IN"; + $value = "(".implode(",", $allEventIds).")"; + } + } + $query->_where[$grouping][] = "civicrm_event.id $op {$value}"; + $query->_qill[$grouping][] = ts('Include Repeating Events (If Any) ') . " = TRUE"; + $query->_tables['civicrm_event'] = $query->_whereTables['civicrm_event'] = 1; + return; + case 'event_type_id': $eventTypes = CRM_Core_OptionGroup::values("event_type"); @@ -333,7 +370,7 @@ class CRM_Event_BAO_Query { $status = $value; } - if (count($val) > 1) { + if (count($val) > 0) { $op = 'IN'; $status = "({$status})"; } @@ -347,7 +384,9 @@ class CRM_Event_BAO_Query { } } else { - $names[] = $statusTypes[$value]; + if (!empty($value)) { + $names[] = $statusTypes[$value]; + } } $query->_qill[$grouping][] = ts('Participant Status %1', array(1 => $op)) . ' ' . implode(' ' . ts('or') . ' ', $names); @@ -378,7 +417,9 @@ class CRM_Event_BAO_Query { $names = array(); foreach ($val as $id => $dontCare) { - $names[] = $roleTypes[$id]; + if (!empty($roleTypes[$id]) ) { + $names[] = $roleTypes[$id]; + } } if (!empty($names)) { @@ -413,7 +454,7 @@ class CRM_Event_BAO_Query { return; case 'participant_id': - $query->_where[$grouping][] = "civicrm_participant.id $op $value"; + $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_participant.id", $op, $value, "Integer"); $query->_tables['civicrm_participant'] = $query->_whereTables['civicrm_participant'] = 1; return; @@ -459,7 +500,7 @@ class CRM_Event_BAO_Query { } /** - * @param $name + * @param string $name * @param $mode * @param $side * @@ -505,7 +546,7 @@ class CRM_Event_BAO_Query { } /** - * getter for the qill object + * Getter for the qill object * * @return string * @access public @@ -594,6 +635,7 @@ class CRM_Event_BAO_Query { $form->add('text', 'participant_fee_id', ts('Fee Level'), array('class' => 'big crm-ajax-select')); CRM_Core_Form_Date::buildDateRange($form, 'event', 1, '_start_date_low', '_end_date_high', ts('From'), FALSE); + $eventIncludeRepeatingEvents = &$form->addElement('checkbox', "event_include_repeating_events", NULL, ts(' Include Repeating Events (If Any) ? ')); $status = CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label'); foreach ($status as $id => $Name) { @@ -637,7 +679,7 @@ class CRM_Event_BAO_Query { /** * @param $row - * @param $id + * @param int $id */ static function searchAction(&$row, $id) {}