Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Optimize code to handle better edge cases
  • Loading branch information
sanjacornelius committed Feb 9, 2024
commit 0387e9b60ff5f43382f66ad5d591f3553bba5beb
11 changes: 3 additions & 8 deletions ProcessMaker/ImportExport/Exporters/ScriptExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,9 @@ public function import() : bool

foreach ($this->getDependents('user', true) as $dependent) {
$scriptUser = $dependent->model;
if (!is_null($scriptUser->id)) {
// Assign the user ID to run the script
$this->model->run_as_user_id = $scriptUser->id;
} else {
// If the user is not set in the dependent modal, default to the admin user
$adminUser = User::where('is_administrator', true)->first();
$this->model->run_as_user_id = $adminUser->id;
}
// Assign the user ID to run the script
// If the user is not set in the dependent modal, default to the admin user
$this->model->run_as_user_id = $scriptUser?->id ?? User::where('is_administrator', true)->first()->id;
}

foreach ($this->getDependents('executor', true) as $dependent) {
Expand Down