From 8fcc0e9b5f88af9949696ebe2c606ebf930f5ca1 Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Fri, 1 Nov 2024 10:37:01 -0400 Subject: [PATCH 1/2] Use the right context of data to evaluate parallel task self service assignment --- ProcessMaker/Repositories/TokenRepository.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ProcessMaker/Repositories/TokenRepository.php b/ProcessMaker/Repositories/TokenRepository.php index ac00c94301..3cdd89a00e 100644 --- a/ProcessMaker/Repositories/TokenRepository.php +++ b/ProcessMaker/Repositories/TokenRepository.php @@ -7,6 +7,7 @@ use Illuminate\Support\Facades\Log; use Mustache_Engine; use ProcessMaker\Mail\TaskActionByEmail; +use ProcessMaker\Managers\DataManager; use ProcessMaker\Models\ProcessAbeRequestToken; use ProcessMaker\Models\ProcessCollaboration; use ProcessMaker\Models\ProcessRequest as Instance; @@ -128,8 +129,10 @@ public function persistActivityActivated(ActivityInterface $activity, TokenInter $token->self_service_groups = ['users' => $evaluatedUsers, 'groups' => $evaluatedGroups]; break; case 'process_variable': - $evaluatedUsers = $selfServiceUsers ? $token->getInstance()->getDataStore()->getData($selfServiceUsers) : []; - $evaluatedGroups = $selfServiceGroups ? $token->getInstance()->getDataStore()->getData($selfServiceGroups) : []; + $dataManager = new DataManager(); + $tokenData = $dataManager->getData($token); + $evaluatedUsers = $selfServiceUsers ? $tokenData[$selfServiceUsers] ?? null: []; + $evaluatedGroups = $selfServiceGroups ? $tokenData[$selfServiceGroups] ?? null : []; // If we have single values we put it inside an array $evaluatedUsers = is_array($evaluatedUsers) ? $evaluatedUsers : [$evaluatedUsers]; From d7bf753ec054a05bebbb4380dcde405c01900c34 Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Mon, 4 Nov 2024 10:24:15 -0400 Subject: [PATCH 2/2] Use expression to evaluate variables for self service users and groups --- ProcessMaker/Repositories/TokenRepository.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ProcessMaker/Repositories/TokenRepository.php b/ProcessMaker/Repositories/TokenRepository.php index 3cdd89a00e..749b3ff54c 100644 --- a/ProcessMaker/Repositories/TokenRepository.php +++ b/ProcessMaker/Repositories/TokenRepository.php @@ -8,6 +8,7 @@ use Mustache_Engine; use ProcessMaker\Mail\TaskActionByEmail; use ProcessMaker\Managers\DataManager; +use ProcessMaker\Models\FeelExpressionEvaluator; use ProcessMaker\Models\ProcessAbeRequestToken; use ProcessMaker\Models\ProcessCollaboration; use ProcessMaker\Models\ProcessRequest as Instance; @@ -131,8 +132,9 @@ public function persistActivityActivated(ActivityInterface $activity, TokenInter case 'process_variable': $dataManager = new DataManager(); $tokenData = $dataManager->getData($token); - $evaluatedUsers = $selfServiceUsers ? $tokenData[$selfServiceUsers] ?? null: []; - $evaluatedGroups = $selfServiceGroups ? $tokenData[$selfServiceGroups] ?? null : []; + $feel = new FeelExpressionEvaluator(); + $evaluatedUsers = $selfServiceUsers ? $feel->render($selfServiceUsers, $tokenData) ?? null: []; + $evaluatedGroups = $selfServiceGroups ? $feel->render($selfServiceGroups, $tokenData) ?? null : []; // If we have single values we put it inside an array $evaluatedUsers = is_array($evaluatedUsers) ? $evaluatedUsers : [$evaluatedUsers];