From 5b7be62ad0d33d031657582274c1f55c0459ae13 Mon Sep 17 00:00:00 2001 From: colemanw Date: Tue, 12 Dec 2023 11:28:59 -0500 Subject: [PATCH] ContactType - Ensure stable order MySql *usually* returns records ordered by id, but not always. This keeps it stable. --- CRM/Contact/BAO/ContactType.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CRM/Contact/BAO/ContactType.php b/CRM/Contact/BAO/ContactType.php index 0059f499e4..30c064e888 100644 --- a/CRM/Contact/BAO/ContactType.php +++ b/CRM/Contact/BAO/ContactType.php @@ -837,6 +837,8 @@ WHERE ($subtypeClause)"; $contactTypes = $cache->get($cacheKey); if ($contactTypes === NULL) { $query = CRM_Utils_SQL_Select::from('civicrm_contact_type'); + // Ensure stable order + $query->orderBy('id'); $dao = CRM_Core_DAO::executeQuery($query->toSQL()); $contactTypes = array_column($dao->fetchAll(), NULL, 'name'); $parents = array_column($contactTypes, NULL, 'id'); -- 2.25.1