add message link to staff note signature notifications

This commit is contained in:
2025-01-01 06:00:46 +00:00
parent c3bc40561b
commit 81ba235b08
4 changed files with 37 additions and 10 deletions

View File

@@ -202,6 +202,7 @@ class StaffController extends AbstractController
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
/** @var StaffNote $note */
$note = $form->getData();
$note->setMemberCase($case);
@@ -209,9 +210,12 @@ class StaffController extends AbstractController
$sup = $this->entityManager->getRepository(Supervision::class)->findOneBy(['worker' => $user]);
$msg = MessageFactory::createStaffing($user, $sup->getSupervisor());
$this->entityManager->persist($msg);
$this->entityManager->persist($note);
$this->entityManager->persist($msg);
$this->entityManager->flush();
$msg->setLink("/staff/sup-sign-note/" . $note->getId());
$this->entityManager->persist($msg);
$this->entityManager->flush();
$this->addFlash('info', 'Staff note added');
@@ -256,7 +260,7 @@ class StaffController extends AbstractController
$note = $this->entityManager->getRepository(StaffNote::class)->find($noteId);
$case = $note->getMemberCase();
if ($note->supervisorSignDateTime || $note->workerSignDateTime) {
if ($note->getSupervisorSignDateTime() || $note->getWorkerSignDateTime()) {
$this->addFlash('error', 'This note has already been signed');
return $this->redirectToRoute('app_staff_view_note', ['noteId' => $noteId]);
}
@@ -362,10 +366,10 @@ class StaffController extends AbstractController
$note->setSupervisorSignDateTime(new \DateTimeImmutable());
/** @var UserCase $uc */
$uc = $this->entityManager->getRepository(UserCase::class)->findOneBy(['case' => $case]);
$uc = $this->entityManager->getRepository(UserCase::class)->findOneBy(['memberCase' => $case]);
$msg = MessageFactory::createSupervisorSignStaffNote($user, $uc->getUser(), $case);
$msg->setLink('/staff/sign-my-note/' . $note->getId());
$this->entityManager->persist($msg);
$this->entityManager->flush();