From 86ddc1cca5918662d87d4ec58ac45bc02a907c04 Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Tue, 3 Jan 2017 16:24:59 +0530 Subject: [PATCH] Fix setDefault on status id smart group formvalues --- CRM/Activity/BAO/Query.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CRM/Activity/BAO/Query.php b/CRM/Activity/BAO/Query.php index db841e1e692f..03691c0912d0 100644 --- a/CRM/Activity/BAO/Query.php +++ b/CRM/Activity/BAO/Query.php @@ -431,7 +431,13 @@ public static function buildSearchForm(&$form) { $form->addSelect('status_id', array('entity' => 'activity', 'multiple' => 'multiple', 'option_url' => NULL, 'placeholder' => ts('- any -')) ); - $form->setDefaults(array('status_id' => array($activityStatus['Completed'], $activityStatus['Scheduled']))); + $ssID = $form->get('ssID'); + $status = array($activityStatus['Completed'], $activityStatus['Scheduled']); + if (!empty($ssID) && !empty($form->_formValues['activity_status_id'])) { + $status = $form->_formValues['activity_status_id']; + } + $form->setDefaults(array('status_id' => $status)); + $form->addElement('text', 'activity_text', ts('Activity Text'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name')); $form->addRadio('activity_option', '', CRM_Core_SelectValues::activityTextOptions());