diff --git a/src/api/routes/people/people-groups.php b/src/api/routes/people/people-groups.php index d47f2acff8..69d158f993 100644 --- a/src/api/routes/people/people-groups.php +++ b/src/api/routes/people/people-groups.php @@ -89,7 +89,7 @@ } } - return SlimUtils::renderJSON($response, $members->toArray()); + return SlimUtils::renderJSON($response, ['Person2group2roleP2g2rs' => $members->toArray()]); }); $group->get('/{groupID:[0-9]+}/events', function (Request $request, Response $response, array $args): Response { diff --git a/src/skin/js/GroupView.js b/src/skin/js/GroupView.js index da2e529524..7debfe9ea1 100644 --- a/src/skin/js/GroupView.js +++ b/src/skin/js/GroupView.js @@ -8,12 +8,12 @@ $(document).ready(function () { "/roles", dataType: "json", }).done(function (data) { - window.CRM.groupRoles = data.ListOptions; + window.CRM.groupRoles = data?.ListOptions ?? []; $("#newRoleSelection").select2({ - data: $(window.CRM.groupRoles).map(function () { + data: window.CRM.groupRoles.map((groupRole)=> { return { - id: this.OptionId, - text: i18next.t(this.OptionName), + id: groupRole.OptionId, + text: i18next.t(groupRole.OptionName), }; }), }); @@ -261,7 +261,7 @@ function initDataTable() { }, )[0]; return ( - i18next.t(thisRole.OptionName) + + i18next.t(thisRole?.OptionName) + ''