From 073cd6cf138b71bebe68b7b5deb7f9ae91f9b001 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 17 Jan 2022 14:34:18 -0500 Subject: [PATCH] SavedSearch - Deprecate/remove redundant/unused functions --- CRM/Contact/BAO/SavedSearch.php | 66 ++------------------------------- 1 file changed, 4 insertions(+), 62 deletions(-) diff --git a/CRM/Contact/BAO/SavedSearch.php b/CRM/Contact/BAO/SavedSearch.php index bc240243c8..c9141eaa56 100644 --- a/CRM/Contact/BAO/SavedSearch.php +++ b/CRM/Contact/BAO/SavedSearch.php @@ -20,23 +20,6 @@ */ class CRM_Contact_BAO_SavedSearch extends CRM_Contact_DAO_SavedSearch { - /** - * Query the db for all saved searches. - * - * @return array - * contains the search name as value and and id as key - */ - public function getAll() { - $savedSearch = new CRM_Contact_DAO_SavedSearch(); - $savedSearch->selectAdd(); - $savedSearch->selectAdd('id, name'); - $savedSearch->find(); - while ($savedSearch->fetch()) { - $aSavedSearch[$savedSearch->id] = $savedSearch->name; - } - return $aSavedSearch; - } - /** * Retrieve DB object based on input parameters. * @@ -274,57 +257,16 @@ WHERE $where"; } /** - * Get from where email (whatever that means!). + * Deprecated function, gets a value from Group entity * + * @deprecated * @param int $id - * - * @return array - */ - public static function fromWhereEmail($id) { - $params = self::getSearchParams($id); - - if ($params) { - if (!empty($params['customSearchID'])) { - return CRM_Contact_BAO_SearchCustom::fromWhereEmail(NULL, $id); - } - else { - $tables = $whereTables = ['civicrm_contact' => 1, 'civicrm_email' => 1]; - $where = CRM_Contact_BAO_SavedSearch::whereClause($id, $tables, $whereTables); - $from = CRM_Contact_BAO_Query::fromClause($whereTables); - return [$from, $where]; - } - } - else { - // fix for CRM-7240 - $from = " -FROM civicrm_contact contact_a -LEFT JOIN civicrm_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_email.is_primary = 1) -"; - $where = " ( 1 ) "; - $tables['civicrm_contact'] = $whereTables['civicrm_contact'] = 1; - $tables['civicrm_email'] = $whereTables['civicrm_email'] = 1; - return [$from, $where]; - } - } - - /** - * Given an id, get the name of the saved search. - * - * @param int $id - * The id of the saved search. - * * @param string $value * - * @return string - * the name of the saved search + * @return string|null */ public static function getName($id, $value = 'name') { - $group = new CRM_Contact_DAO_Group(); - $group->saved_search_id = $id; - if ($group->find(TRUE)) { - return $group->$value; - } - return NULL; + return parent::getFieldValue('CRM_Contact_DAO_Group', $id, $value, 'saved_search_id'); } /** -- 2.25.1