From: monishdeb Date: Fri, 24 Apr 2015 21:36:52 +0000 (+0530) Subject: CRM-15619 regreesion fix on Event's id X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=97c1cf60f7177c091de1aa70d6ee87fd841cc2db;p=civicrm-core.git CRM-15619 regreesion fix on Event's id ---------------------------------------- * CRM-15619: Api breaks https://issues.civicrm.org/jira/browse/CRM-15619 --- diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 8a96542ce6..ef207bbb05 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -5658,11 +5658,17 @@ AND displayRelType.is_active = 1 * @return array */ public static function buildQillForFieldValue($daoName, $fieldName, $fieldValue, $op, $pseduoExtraParam = array()) { - $pseduoOptions = CRM_Core_PseudoConstant::get($daoName, $fieldName, $pseduoExtraParam = array()); $qillOperators = CRM_Core_SelectValues::getSearchBuilderOperators(); + if ($fieldName == 'activity_type_id') { $pseduoOptions = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE); } + elseif ($daoName == 'CRM_Event_DAO_Event' && $fieldName == 'id') { + $pseduoOptions = CRM_Event_BAO_Event::getEvents(0, $fieldValue, TRUE, TRUE, TRUE); + } + else { + $pseduoOptions = CRM_Core_PseudoConstant::get($daoName, $fieldName, $pseduoExtraParam = array()); + } //For those $fieldName which don't have any associated pseudoconstant defined if (empty($pseduoOptions)) { diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index e87dd2d235..84c64b4bfa 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -252,27 +252,35 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event { * 0 returns current and future events. * 1 if events all are required * 2 returns events since 3 months ago - * @param bool|int $id int id of a specific event to return + * @param int|array $id single int event id or array of multiple event ids to return * @param bool $isActive * true if you need only active events. * @param bool $checkPermission * true if you need to check permission else false. + * @param bool $titleOnly + * true if you need only title not appended with start date * * @return array */ public static function getEvents( $all = 0, - $id = FALSE, + $id = NULL, $isActive = TRUE, - $checkPermission = TRUE + $checkPermission = TRUE, + $titleOnly = FALSE ) { $query = " SELECT `id`, `title`, `start_date` FROM `civicrm_event` WHERE ( civicrm_event.is_template IS NULL OR civicrm_event.is_template = 0 )"; - if ($id) { - $query .= " AND `id` = {$id}"; + if (!empty($id)) { + if (is_array($id)) { + $query .= " AND `id` IN (" . implode(',', $id) . ")"; + } + else { + $query .= " AND `id` = {$id}"; + } } elseif ($all == 0) { // find only events ending in the future @@ -303,7 +311,10 @@ WHERE ( civicrm_event.is_template IS NULL OR civicrm_event.is_template = 0 )"; ) && $dao->title ) { - $events[$dao->id] = $dao->title . ' - ' . CRM_Utils_Date::customFormat($dao->start_date); + $events[$dao->id] = $dao->title; + if (!$titleOnly) { + $events[$dao->id] .= ' - ' . CRM_Utils_Date::customFormat($dao->start_date); + } } } diff --git a/xml/schema/Event/Event.xml b/xml/schema/Event/Event.xml index fb07045f9a..052bba1ed4 100644 --- a/xml/schema/Event/Event.xml +++ b/xml/schema/Event/Event.xml @@ -13,11 +13,6 @@ true Event 1.7 - - civicrm_event
- id - title -
id