fix: promote called-off status of assignment to potential dispositions

This commit is contained in:
Björn Fromme
2025-07-22 16:19:31 +02:00
parent 231d0f315b
commit 0fc7684fc7
@@ -3,6 +3,7 @@
namespace App\Controller\Administrative\Assignment;
use App\Entity\Assignment;
use App\Entity\Disposition;
use App\Event\AssignmentCalledOffEvent;
use App\Htmx\HxRedirectResponse;
use Doctrine\ORM\EntityManagerInterface;
@@ -19,7 +20,7 @@ class CallOffController extends AbstractController
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly EventDispatcherInterface $eventDispatcher,
private readonly LoggerInterface $logger
private readonly LoggerInterface $logger,
) {
}
@@ -30,6 +31,13 @@ class CallOffController extends AbstractController
if (true === $request->isMethod('POST')) {
$assignment->setStatus(Assignment::STATUS_CALLED_OFF);
foreach ($assignment->getDispositions() as $disposition) {
$disposition
->setStatus(Disposition::STATUS_CALLED_OFF)
->setCalledOffBy(Disposition::CALLED_OFF_BY_OFFICE)
;
}
$this->entityManager->flush();
$this
@@ -52,4 +60,4 @@ class CallOffController extends AbstractController
'assignment' => $assignment,
]);
}
}
}