From 5fa296f76320e34fd0a23600c5a839ed6fa5423f Mon Sep 17 00:00:00 2001 From: atif-shaikh Date: Tue, 16 Sep 2014 18:37:46 +0530 Subject: [PATCH] CRM-15304 - DB Error on sorting Activities fields - Status, Type and Subject on Advance Search - Activity display mode https://issues.civicrm.org/jira/browse/CRM-15304 --- CRM/Activity/BAO/Query.php | 8 ++++---- CRM/Activity/Selector/Search.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CRM/Activity/BAO/Query.php b/CRM/Activity/BAO/Query.php index 0fa38fe4ab..e378efe51d 100644 --- a/CRM/Activity/BAO/Query.php +++ b/CRM/Activity/BAO/Query.php @@ -51,7 +51,7 @@ class CRM_Activity_BAO_Query { } if (!empty($query->_returnProperties['activity_type_id'])) { - $query->_select['activity_type_id'] = "activity_type.id as activity_type_id"; + $query->_select['activity_type_id'] = "activity_type.value as activity_type_id"; $query->_element['activity_type_id'] = 1; $query->_tables['civicrm_activity'] = 1; $query->_tables['activity_type'] = 1; @@ -60,8 +60,7 @@ class CRM_Activity_BAO_Query { } if (!empty($query->_returnProperties['activity_type'])) { - $query->_select['activity_type'] = "activity_type.label as activity_type, - civicrm_activity.activity_type_id as activity_type_id"; + $query->_select['activity_type'] = "activity_type.label as activity_type"; $query->_element['activity_type'] = 1; $query->_tables['civicrm_activity'] = 1; $query->_tables['activity_type'] = 1; @@ -91,7 +90,8 @@ class CRM_Activity_BAO_Query { } if (!empty($query->_returnProperties['activity_status'])) { - $query->_select['activity_status'] = "activity_status.label as activity_status"; + $query->_select['activity_status'] = "activity_status.label as activity_status, + civicrm_activity.status_id as status_id"; $query->_element['activity_status'] = 1; $query->_tables['civicrm_activity'] = 1; $query->_tables['activity_status'] = 1; diff --git a/CRM/Activity/Selector/Search.php b/CRM/Activity/Selector/Search.php index 910ff50537..0bd140e84d 100644 --- a/CRM/Activity/Selector/Search.php +++ b/CRM/Activity/Selector/Search.php @@ -379,7 +379,7 @@ class CRM_Activity_Selector_Search extends CRM_Core_Selector_Base implements CRM ), array( 'name' => ts('Subject'), - 'sort' => 'subject', + 'sort' => 'activity_subject', 'direction' => CRM_Utils_Sort::DONTCARE, ), array( -- 2.25.1