From e319911430e88e2e8eada1a6bb108cdf1de7c025 Mon Sep 17 00:00:00 2001 From: kurund Date: Tue, 13 Aug 2013 18:07:30 +0530 Subject: [PATCH] fixed note to return subject or body based on search field --- CRM/Contact/BAO/Query.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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; } -- 2.25.1