<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
+ | CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Case_BAO_Query {
/**
+ * Get fields.
+ *
* @param bool $excludeActivityFields
*
* @return array
*/
public static function &getFields($excludeActivityFields = FALSE) {
- $fields = array();
$fields = CRM_Case_BAO_Case::exportableFields();
// add activity related fields
/**
* Build select for Case.
*
- * @param $query
- *
- * @return void
+ * @param CRM_Contact_BAO_Query $query
*/
public static function select(&$query) {
if (($query->_mode & CRM_Contact_BAO_Query::MODE_CASE) || !empty($query->_returnProperties['case_id'])) {
}
/**
- * Given a list of conditions in query generate the required
- * where clause
- *
- * @param $query
+ * Given a list of conditions in query generate the required where clause.
*
- * @return void
+ * @param CRM_Contact_BAO_Query $query
*/
public static function where(&$query) {
foreach ($query->_params as $id => $values) {
if ($query->_mode == CRM_Contact_BAO_Query::MODE_CONTACTS) {
$query->_useDistinct = TRUE;
}
- $grouping = $query->_params[$id][3];
self::whereClauseSingle($query->_params[$id], $query);
}
}
/**
* Where clause for a single field.
*
- * @param $values
- * @param $query
+ * CRM-17120 adds a test that checks the Qill on some of these parameters.
+ * However, I couldn't find a way, other than via test, to access the
+ * case_activity options in the code below and invalid sql was returned.
+ * Perhaps the options are just legacy?
*
- * @return void
+ * Also, CRM-17120 locks in the Qill - but it probably is not quite right as I
+ * see 'Activity Type = Scheduled' (rather than activity status).
+ *
+ * See CRM_Case_BAO_QueryTest for more.
+ *
+ * @param array $values
+ * @param CRM_Contact_BAO_Query $query
*/
public static function whereClauseSingle(&$values, &$query) {
list($name, $op, $value, $grouping, $wildcard) = $values;
case 'case_recent_activity_type':
$names = $value;
- if ($activityType = CRM_Core_OptionGroup::getLabel('activity_type', $value, 'value')) {
+ if (($activityType = CRM_Core_PseudoConstant::getLabel('CRM_Activity_BAO_Activity', 'activity_type_id', $value)) != FALSE) {
$names = $activityType;
}
case 'case_activity_status_id':
$names = $value;
- if ($activityStatus = CRM_Core_OptionGroup::getLabel('activity_status', $value, 'value')) {
+ if (($activityStatus = CRM_Core_PseudoConstant::getLabel('CRM_Activity_BAO_Activity', 'status_id', $value)) != FALSE) {
$names = $activityStatus;
}
case 'case_activity_medium_id':
$names = $value;
- if ($activityMedium = CRM_Core_OptionGroup::getLabel('encounter_medium', $value, 'value')) {
+ if (($activityMedium = CRM_Core_PseudoConstant::getLabel('CRM_Activity_BAO_Activity', 'medium_id', $value)) != FALSE) {
$names = $activityMedium;
}
}
/**
+ * Build from clause.
+ *
* @param string $name
- * @param $mode
- * @param $side
+ * @param string $mode
+ * @param string $side
*
* @return string
*/
/**
* This includes any extra fields that might need for export etc.
+ *
+ * @param string $mode
+ *
+ * @return array|null
*/
public static function extraReturnProperties($mode) {
$properties = NULL;
}
/**
- * Add all the elements shared between case search and advanaced search.
- *
+ * Add all the elements shared between case search and advanced search.
*
* @param CRM_Core_Form $form
- *
- * @return void
*/
public static function buildSearchForm(&$form) {
$config = CRM_Core_Config::singleton();