fixed note to return subject or body based on search field
authorkurund <kurund@civicrm.org>
Tue, 13 Aug 2013 12:37:30 +0000 (18:07 +0530)
committerkurund <kurund@civicrm.org>
Tue, 13 Aug 2013 12:37:30 +0000 (18:07 +0530)
CRM/Contact/BAO/Query.php

index 96a7dfd375e73d277ed385a9c32a290a353770c2..02a5510ef92bbb6d0ec7ec209914ab09d7fe2650 100644 (file)
@@ -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;
         }