From 5292865bef5dd2826c6d3845ce0276ad292f02f3 Mon Sep 17 00:00:00 2001 From: Dr Masroor Ehsan Date: Wed, 29 Jan 2025 21:25:28 +0600 Subject: [PATCH] report workflow_level --- app/Models/StudyReport.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Models/StudyReport.php b/app/Models/StudyReport.php index f32e5d0..988e9c7 100644 --- a/app/Models/StudyReport.php +++ b/app/Models/StudyReport.php @@ -4,6 +4,7 @@ use App\Domain\Report\ExportFormat; use App\Domain\Report\ReportStatus; +use App\Domain\Study\WorkflowLevel; use App\Services\Report\ReportStorage; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Concerns\HasTimestamps; @@ -96,12 +97,12 @@ public function getContent(): ?string public function eligibleForExport(): bool { - return $this->report_status->value >= ReportStatus::Finalized->value; + return $this->workflow_level->value >= WorkflowLevel::Finalized->value; } public function canRemove(User|int|null $user = null): bool { - if ($this->report_status->value < ReportStatus::Finalized->value) { + if ($this->workflow_level->value < WorkflowLevel::Finalized->value) { if ($this->read_by_id === me($user)->id) { return true; } @@ -117,7 +118,7 @@ public function canRemove(User|int|null $user = null): bool public function canEdit(User|int|null $user = null): bool { - if ($this->report_status->value < ReportStatus::Finalized->value && + if ($this->workflow_level->value < WorkflowLevel::Finalized->value && $this->study->canEditReport() && $this->read_by_id === me($user)->id) { return true; @@ -128,7 +129,7 @@ public function canEdit(User|int|null $user = null): bool public function isFinalized(): bool { - return $this->report_status->value >= ReportStatus::Finalized->value; + return $this->workflow_level->value >= WorkflowLevel::Finalized->value; } /**