EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
fix list tree where
Yuri Kuznetsov2e9437572dd6
diff --git a/application/Espo/Core/Controllers/RecordTree.php b/application/Espo/Core/Controllers/RecordTree.phpindex 37ee9a797a..66f267056b 100644--- a/application/Espo/Core/Controllers/RecordTree.php+++ b/application/Espo/Core/Controllers/RecordTree.php@@ -63,15 +63,12 @@ class RecordTree extends Recordreturn (object) $this->actionListTree($request->getRouteParams(), $request->getParsedBody(), $request);}- $where = $request->getQueryParams()['where'] ?? null;+ $selectParams = $this->fetchSearchParamsFromRequest($request);+$parentId = $request->getQueryParam('parentId');$maxDepth = $request->getQueryParam('maxDepth');$onlyNotEmpty = (bool) $request->getQueryParam('onlyNotEmpty');- if ($where !== null && !is_array($where)) {- throw new BadRequest();- }-if ($maxDepth !== null) {$maxDepth = (int) $maxDepth;}@@ -79,7 +76,7 @@ class RecordTree extends Record$collection = $this->getRecordTreeService()->getTree($parentId,[- 'where' => $where,+ 'where' => $selectParams->getWhere(),'onlyNotEmpty' => $onlyNotEmpty,],$maxDepthdiff --git a/application/Espo/Services/RecordTree.php b/application/Espo/Services/RecordTree.phpindex 5ce2b89b26..e24c2afe35 100644--- a/application/Espo/Services/RecordTree.php+++ b/application/Espo/Services/RecordTree.php@@ -64,7 +64,7 @@ class RecordTree extends Recordprotected $categoryField = null;/**- * @param array<string, mixed> $params+ * @param array{where?: ?WhereItem, onlyNotEmpty?: bool} $params* @return ?Collection<Entity>* @throws Forbidden* @throws BadRequest@@ -84,7 +84,7 @@ class RecordTree extends Record}/**- * @param array<string, mixed> $params+ * @param array{where?: ?WhereItem, onlyNotEmpty?: bool} $params* @return ?Collection<Entity>* @throws BadRequest* @throws Forbidden@@ -104,7 +104,11 @@ class RecordTree extends Recordreturn null;}- $searchParams = SearchParams::fromRaw($params);+ $searchParams = SearchParams::create();++ if (isset($params['where'])) {+ $searchParams = $searchParams->withWhere($params['where']);+ }$selectBuilder = $this->selectBuilderFactory->create()