Skip to content

Commit

Permalink
Correctly find the id of related objects in search results
Browse files Browse the repository at this point in the history
  • Loading branch information
isleshocky77 committed Apr 13, 2024
1 parent 8735575 commit ac9e5c0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/Search/SearchResults.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,12 @@ protected function getRelatedId(SugarBean $obj, string $idName, string $link): ?
{
$relField = $idName;
if (isset($obj->$link)) {
$relId = $obj->$link->getFocus()->$relField;
$linkedBeans = $obj->$link->getBeans();
if(count($linkedBeans) === 1){
$relId = array_keys($linkedBeans)[0];
} else {
$relId = $obj->$link->getFocus()->$relField;
}
if (is_object($relId)) {
if (method_exists($relId, "getFocus")) {
$relId = $relId->getFocus()->id;
Expand Down

0 comments on commit ac9e5c0

Please sign in to comment.