diff --git a/ProcessMaker/Events/ScriptCreated.php b/ProcessMaker/Events/ScriptCreated.php index 2cb128bdd0..3df5d591ac 100644 --- a/ProcessMaker/Events/ScriptCreated.php +++ b/ProcessMaker/Events/ScriptCreated.php @@ -5,6 +5,7 @@ use Illuminate\Foundation\Events\Dispatchable; use ProcessMaker\Contracts\SecurityLogEventInterface; use ProcessMaker\Models\Script; +use ProcessMaker\Models\ScriptCategory; use ProcessMaker\Traits\FormatSecurityLogChanges; class ScriptCreated implements SecurityLogEventInterface @@ -13,9 +14,8 @@ class ScriptCreated implements SecurityLogEventInterface use FormatSecurityLogChanges; private array $changes; - private array $original; - + public string $categoryName = ''; private Script $script; /** @@ -28,6 +28,10 @@ public function __construct(Script $script, array $changes) { $this->script = $script; $this->changes = $changes; + $categoryId = $this->script['script_category_id'] ?? ''; + if (!empty($categoryId)) { + $this->categoryName = ScriptCategory::where('id', $categoryId)->value('name'); + } } /** @@ -54,6 +58,9 @@ public function getData(): array 'created_at' => $this->script->getAttribute('created_at'), ] : [ 'name' => $this->script->getAttribute('title'), + 'description' => $this->script->getAttribute('description'), + 'category' => $this->categoryName, + 'language' => $this->script->getAttribute('language') ]; unset($this->changes['code']); unset($this->original['code']); diff --git a/ProcessMaker/Events/ScriptDeleted.php b/ProcessMaker/Events/ScriptDeleted.php index ef2fefe100..a4a526486c 100644 --- a/ProcessMaker/Events/ScriptDeleted.php +++ b/ProcessMaker/Events/ScriptDeleted.php @@ -2,6 +2,7 @@ namespace ProcessMaker\Events; +use Carbon\Carbon; use Illuminate\Foundation\Events\Dispatchable; use ProcessMaker\Contracts\SecurityLogEventInterface; use ProcessMaker\Models\Script; @@ -45,6 +46,7 @@ public function getData(): array { return [ 'name' => $this->script->getAttribute('title'), + 'deleted_at' => Carbon::now() ]; }