diff --git a/app/Http/Controllers/Staff/ReportController.php b/app/Http/Controllers/Staff/ReportController.php index 2988ac8..71bd170 100644 --- a/app/Http/Controllers/Staff/ReportController.php +++ b/app/Http/Controllers/Staff/ReportController.php @@ -82,7 +82,7 @@ public function view(string $uuid) ReportManager::ensureDownloadAccess(); $manager = ReportManager::fromReport($uuid); $title = 'Report Quick View ' . $manager->getStudy()->getPatientDemographic(); - $report = $manager->getReport(); + $report = $manager->getReportForViewing(); $copy_button = false; if ($report->isFinalized()) { $stamper = new StampService($report->read_by_id); diff --git a/app/Services/AuditTrail/Activity.php b/app/Services/AuditTrail/Activity.php index a9677ca..851baf5 100644 --- a/app/Services/AuditTrail/Activity.php +++ b/app/Services/AuditTrail/Activity.php @@ -36,6 +36,8 @@ enum Activity: int case Report_Delete = 202; case Report_Finalize = 203; + case Report_View = 204; + case Report_Download = 205; case User_Login = 301; diff --git a/app/Services/Report/ReportManager.php b/app/Services/Report/ReportManager.php index fabadd6..0048be3 100644 --- a/app/Services/Report/ReportManager.php +++ b/app/Services/Report/ReportManager.php @@ -138,4 +138,14 @@ public function getReport(): ?StudyReport { return $this->report; } + + public function getReportForViewing(): ?StudyReport + { + audit() + ->on($this->study) + ->did(Activity::Report_View) + ->log(); + + return $this->report; + } }