From 46bd5d9ceb1358bc332cdff0d2409dfbf511ae5f Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 7 Apr 2021 16:16:25 -0400 Subject: [PATCH] APIv4 - Prevent api adding default join conditions when it shouldn't When adding an explicit join, the api will search for a default condition unless an fk field has been explicitly set. This fixes an error when the api thought no fk field was present when it actually was. --- Civi/Api4/Query/Api4SelectQuery.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Civi/Api4/Query/Api4SelectQuery.php b/Civi/Api4/Query/Api4SelectQuery.php index 3a2d80efd3..8e42ed2b25 100644 --- a/Civi/Api4/Query/Api4SelectQuery.php +++ b/Civi/Api4/Query/Api4SelectQuery.php @@ -658,7 +658,7 @@ class Api4SelectQuery { return FALSE; } foreach ([$sideA, $sideB] as $expr) { - if ($expr === "$alias.id" || !empty($joinEntityFields["$alias.$expr"]['fk_entity'])) { + if ($expr === "$alias.id" || !empty($joinEntityFields[str_replace("$alias.", '', $expr)]['fk_entity'])) { return TRUE; } } -- 2.25.1