From: Eileen McNaughton Date: Thu, 7 Dec 2023 19:26:58 +0000 (+1300) Subject: Improve 3 way fallback of name,title, frontend_title X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=249a4c935e64a2d97c59aa3844182a54677aa79a;p=civicrm-core.git Improve 3 way fallback of name,title, frontend_title --- 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();