From 8f165fa55a5fded7863ab6b6b503b85efe36b066 Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 10 Jan 2017 16:23:04 +1300 Subject: [PATCH] Comment fixes --- CRM/Batch/BAO/Batch.php | 2 ++ CRM/Contact/BAO/Query.php | 32 ++++++++++++++++++++++++++------ CRM/Contribute/BAO/Query.php | 4 +++- CRM/Core/OptionValue.php | 4 ++++ 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/CRM/Batch/BAO/Batch.php b/CRM/Batch/BAO/Batch.php index 4985ee7c4e..f5ce3e4e04 100644 --- a/CRM/Batch/BAO/Batch.php +++ b/CRM/Batch/BAO/Batch.php @@ -708,6 +708,8 @@ LEFT JOIN civicrm_contribution_soft ON civicrm_contribution_soft.contribution_id $values['contribution_date_high'] = $date['to']; } $searchParams = CRM_Contact_BAO_Query::convertFormValues($values); + // @todo the use of defaultReturnProperties means the search will be inefficient + // as slow-unneeded properties are included. $query = new CRM_Contact_BAO_Query($searchParams, CRM_Contribute_BAO_Query::defaultReturnProperties(CRM_Contact_BAO_Query::MODE_CONTRIBUTE, FALSE diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 07f7ce6ab4..347a9f42a5 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -468,6 +468,10 @@ class CRM_Contact_BAO_Query { /** * Function which actually does all the work for the constructor. + * + * @param string $apiEntity + * The api entity being called. + * This sort-of duplicates $mode in a confusing way. Probably not by design. */ public function initialize($apiEntity = NULL) { $this->_select = array(); @@ -525,7 +529,7 @@ class CRM_Contact_BAO_Query { * versus search builder. * * The direction we are going is having the form convert values to a standardised format & - * moving away from wierd & wonderful where clause switches. + * moving away from weird & wonderful where clause switches. * * Fix and handle contact deletion nicely. * @@ -588,7 +592,7 @@ class CRM_Contact_BAO_Query { $this->_paramLookup[$value[0]] = array(); } if ($value[0] !== 'group') { - // Just trying to unravel how group interacts here! This whole function is wieid. + // Just trying to unravel how group interacts here! This whole function is weird. $this->_paramLookup[$value[0]][] = $value; } } @@ -596,6 +600,10 @@ class CRM_Contact_BAO_Query { /** * Some composite fields do not appear in the fields array hack to make them part of the query. + * + * @param $apiEntity + * The api entity being called. + * This sort-of duplicates $mode in a confusing way. Probably not by design. */ public function addSpecialFields($apiEntity) { static $special = array('contact_type', 'contact_sub_type', 'sort_name', 'display_name'); @@ -624,6 +632,10 @@ class CRM_Contact_BAO_Query { * clauses. Note that since the where clause introduces new * tables, the initial attempt also retrieves all variables used * in the params list + * + * @param string $apiEntity + * The api entity being called. + * This sort-of duplicates $mode in a confusing way. Probably not by design. */ public function selectClause($apiEntity = NULL) { @@ -666,6 +678,9 @@ class CRM_Contact_BAO_Query { if (in_array($name, array('groups', 'tags', 'notes')) && isset($this->_returnProperties[substr($name, 0, -1)]) ) { + // @todo instead of setting make exception to get us into + // an if clause that has handling for these fields buried with in it + // move the handling to here. $makeException = TRUE; } @@ -865,6 +880,7 @@ class CRM_Contact_BAO_Query { } } elseif ($name === 'tags') { + //@todo move this handling outside the big IF & ditch $makeException $this->_useGroupBy = TRUE; $this->_select[$name] = "GROUP_CONCAT(DISTINCT(civicrm_tag.name)) as tags"; $this->_element[$name] = 1; @@ -872,6 +888,7 @@ class CRM_Contact_BAO_Query { $this->_tables['civicrm_entity_tag'] = 1; } elseif ($name === 'groups') { + //@todo move this handling outside the big IF & ditch $makeException $this->_useGroupBy = TRUE; // Duplicates will be created here but better to sort them out in php land. $this->_select[$name] = " @@ -889,6 +906,7 @@ class CRM_Contact_BAO_Query { ); } elseif ($name === 'notes') { + //@todo move this handling outside the big IF & ditch $makeException // if note field is subject then return subject else body of the note $noteColumn = 'note'; if (isset($noteField) && $noteField == 'note_subject') { @@ -2331,7 +2349,6 @@ class CRM_Contact_BAO_Query { } } - /** * @param $where * @param $locType @@ -2834,9 +2851,9 @@ class CRM_Contact_BAO_Query { } /** - * Where / qill clause for contact_sub_type + * Where / qill clause for contact_sub_type. * - * @param $values + * @param array $values */ public function contactSubType(&$values) { list($name, $op, $value, $grouping, $wildcard) = $values; @@ -3140,7 +3157,7 @@ WHERE $smartGroupClause } /** - * Where / qill clause for tag + * Where / qill clause for tag. * * @param array $values */ @@ -4299,6 +4316,9 @@ civicrm_relationship.is_permission_a_b = 0 * Should permissions be ignored or should the logged in user's permissions be applied. * @param int $mode * This basically correlates to the component. + * @param string $apiEntity + * The api entity being called. + * This sort-of duplicates $mode in a confusing way. Probably not by design. * * @return array */ diff --git a/CRM/Contribute/BAO/Query.php b/CRM/Contribute/BAO/Query.php index d0db6208da..52ca2fc84d 100644 --- a/CRM/Contribute/BAO/Query.php +++ b/CRM/Contribute/BAO/Query.php @@ -44,7 +44,9 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query { static $_contribRecurPayment = NULL; /** - * Function get the import/export fields for contribution. + * Function get the searchable fields for contribution. + * + * This is basically the contribution fields plus some related entity fields. * * @param bool $checkPermission * diff --git a/CRM/Core/OptionValue.php b/CRM/Core/OptionValue.php index bd08be42ce..2e7417b6a9 100644 --- a/CRM/Core/OptionValue.php +++ b/CRM/Core/OptionValue.php @@ -306,6 +306,10 @@ class CRM_Core_OptionValue { $nameTitle = array(); if ($mode == 'contribute') { + // This is part of a move towards standardising option values but we + // should derive them from the fields array so am deprecating it again... + // note that the reason this was needed was that payment_instrument_id was + // not set to exportable. $nameTitle = array( 'payment_instrument' => array( 'name' => 'payment_instrument', -- 2.25.1