From 6516816a980d7b8e5594a078a0b37d2d44f4f7ac Mon Sep 17 00:00:00 2001 From: Eleazar Resendez Date: Wed, 29 Oct 2025 14:04:46 -0600 Subject: [PATCH 1/3] fix(SmartExtract): adjust non-system task filtering based on HITL configuration --- ProcessMaker/Traits/TaskControllerIndexMethods.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ProcessMaker/Traits/TaskControllerIndexMethods.php b/ProcessMaker/Traits/TaskControllerIndexMethods.php index 0461c94ec1..881605b4da 100644 --- a/ProcessMaker/Traits/TaskControllerIndexMethods.php +++ b/ProcessMaker/Traits/TaskControllerIndexMethods.php @@ -154,6 +154,7 @@ private function excludeNonVisibleTasks($query, $request) { $nonSystem = filter_var($request->input('non_system'), FILTER_VALIDATE_BOOLEAN); $allTasks = filter_var($request->input('all_tasks'), FILTER_VALIDATE_BOOLEAN); + $hitlEnabled = filter_var(config('smart-extract.hitl_enabled'), FILTER_VALIDATE_BOOLEAN); $query->when(!$allTasks, function ($query) { $query->where(function ($query) { $query->where('element_type', '=', 'task'); @@ -163,7 +164,7 @@ private function excludeNonVisibleTasks($query, $request) }); }); }) - ->when($nonSystem, function ($query) { + ->when($nonSystem && !$hitlEnabled, function ($query) { $query->nonSystem(); }); } From 97b34033a5ee402f4fb26f57f1dbb257b47326ca Mon Sep 17 00:00:00 2001 From: Eleazar Resendez Date: Wed, 29 Oct 2025 14:49:28 -0600 Subject: [PATCH 2/3] refine non-system task filtering based on HITL configuration --- .../Traits/TaskControllerIndexMethods.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ProcessMaker/Traits/TaskControllerIndexMethods.php b/ProcessMaker/Traits/TaskControllerIndexMethods.php index 881605b4da..8cc3d0ada8 100644 --- a/ProcessMaker/Traits/TaskControllerIndexMethods.php +++ b/ProcessMaker/Traits/TaskControllerIndexMethods.php @@ -164,8 +164,20 @@ private function excludeNonVisibleTasks($query, $request) }); }); }) - ->when($nonSystem && !$hitlEnabled, function ($query) { - $query->nonSystem(); + ->when($nonSystem, function ($query) use ($hitlEnabled) { + if (!$hitlEnabled) { + $query->nonSystem(); + + return; + } + + $query->where(function ($query) { + $query->nonSystem(); + $query->orWhere(function ($query) { + $query->where('element_type', '=', 'task'); + $query->where('element_name', '=', 'Manual Document Review'); + }); + }); }); } From c0bb4b633686cbc242cb196a7f9adb873b725cbb Mon Sep 17 00:00:00 2001 From: Eleazar Resendez Date: Wed, 29 Oct 2025 15:02:16 -0600 Subject: [PATCH 3/3] add mergeHitlCaseNumber method to handle case number retrieval from parent request --- ProcessMaker/Http/Resources/Task.php | 26 ++++++++++++++++++++- resources/js/tasks/components/TasksList.vue | 2 +- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ProcessMaker/Http/Resources/Task.php b/ProcessMaker/Http/Resources/Task.php index cde9101604..fe19ce85b5 100644 --- a/ProcessMaker/Http/Resources/Task.php +++ b/ProcessMaker/Http/Resources/Task.php @@ -74,6 +74,8 @@ public function toArray($request) $this->addAssignableUsers($array, $include); + $this->mergeHitlCaseNumber($array); + return $array; } @@ -114,6 +116,28 @@ private function addAssignableUsers(&$array, $include) } } + private function mergeHitlCaseNumber(array &$array): void + { + if (!config('smart-extract.hitl_enabled')) { + return; + } + + if (!empty(data_get($array, 'process_request.case_number'))) { + return; + } + + $this->processRequest->loadMissing('parentRequest'); + $parentCaseNumber = $this->processRequest->parentRequest?->case_number; + if (!$parentCaseNumber) { + return; + } + + data_set($array, 'process_request.case_number', $parentCaseNumber); + if (empty($array['case_number'])) { + $array['case_number'] = $parentCaseNumber; + } + } + /** * Add the active users to the list of assigned users * @@ -131,7 +155,7 @@ private function addActiveAssignedUsers(array $users, array $assignedUsers) ->whereNotIn('status', Process::NOT_ASSIGNABLE_USER_STATUS) ->whereIn('id', $chunk) ->pluck('id')->toArray(); - $assignedUsers = array_merge($assignedUsers,$activeUsers); + $assignedUsers = array_merge($assignedUsers, $activeUsers); } return $assignedUsers; diff --git a/resources/js/tasks/components/TasksList.vue b/resources/js/tasks/components/TasksList.vue index 340b746566..aae5f56de2 100644 --- a/resources/js/tasks/components/TasksList.vue +++ b/resources/js/tasks/components/TasksList.vue @@ -496,7 +496,7 @@ export default { return ` - # ${processRequest.case_number || record.case_number} + # ${processRequest.case_number || record.case_number || ""} `; }, formatCaseTitle(processRequest, record) {