From 249a4c935e64a2d97c59aa3844182a54677aa79a Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Fri, 8 Dec 2023 08:26:58 +1300 Subject: [PATCH] Improve 3 way fallback of name,title, frontend_title --- CRM/Core/DAO.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CRM/Core/DAO.php b/CRM/Core/DAO.php index eb8a7499a3..679e1e2c14 100644 --- a/CRM/Core/DAO.php +++ b/CRM/Core/DAO.php @@ -958,7 +958,11 @@ class CRM_Core_DAO extends DB_DataObject { if (empty($values[$idField]) && array_key_exists('frontend_title', $fields) && empty($values['frontend_title'])) { $instance->frontend_title = $instance->title; } - if (empty($values[$idField]) && array_key_exists('title', $fields) && empty($values['title']) && !empty($values['frontend_title'])) { + if (empty($values[$idField]) && array_key_exists('frontend_title', $fields) && !$instance->frontend_title) { + // Still empty? Fall back to name. + $instance->frontend_title = $instance->name; + } + if (empty($values[$idField]) && array_key_exists('title', $fields) && empty($values['title']) && array_key_exists('frontend_title', $fields) && $instance->frontend_title) { $instance->title = $instance->frontend_title; } $instance->save(); -- 2.25.1