From 99d9ce8922ebd223b6f58839cc511a02f2e63b77 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 23 Nov 2021 21:25:58 -0500 Subject: [PATCH] AllCoreTables - Fix getClassForTable in multilingual databases --- CRM/Core/DAO/AllCoreTables.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CRM/Core/DAO/AllCoreTables.php b/CRM/Core/DAO/AllCoreTables.php index febcb374a8..670ce3e06e 100644 --- a/CRM/Core/DAO/AllCoreTables.php +++ b/CRM/Core/DAO/AllCoreTables.php @@ -364,6 +364,11 @@ class CRM_Core_DAO_AllCoreTables { */ public static function getEntityNameForTable(string $tableName) { self::init(); + // CRM-19677: on multilingual setup, trim locale from $tableName to fetch class name + if (CRM_Core_I18n::isMultilingual()) { + global $dbLocale; + $tableName = str_replace($dbLocale, '', $tableName); + } $matches = CRM_Utils_Array::findAll(self::$entityTypes, ['table' => $tableName]); return $matches ? $matches[0]['name'] : NULL; } -- 2.25.1