From: kurund Date: Tue, 13 Aug 2013 12:37:30 +0000 (+0530) Subject: fixed note to return subject or body based on search field X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e319911430e88e2e8eada1a6bb108cdf1de7c025;p=civicrm-core.git fixed note to return subject or body based on search field --- diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 96a7dfd375..02a5510ef9 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -790,8 +790,14 @@ class CRM_Contact_BAO_Query { $this->_tables['civicrm_group'] = 1; } elseif ($name === 'notes') { + // if note field is subject then return subject else body of the note + $noteColumn = 'note'; + if (isset($noteField) && $noteField == 'note_subject') { + $noteColumn = 'subject'; + } + $this->_useGroupBy = TRUE; - $this->_select[$name] = "GROUP_CONCAT(DISTINCT(civicrm_note.note)) as notes"; + $this->_select[$name] = "GROUP_CONCAT(DISTINCT(civicrm_note.$noteColumn)) as notes"; $this->_element[$name] = 1; $this->_tables['civicrm_note'] = 1; }