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; } /**