fix: keep upload files until their deletion is committed

This commit is contained in:
fromme committed 2026-10-15 12:49:48 +02:00
1 parent 7e182e3d51
commit 4aa2d7a5e6
5 files changed
+221 -12

No files matched your search

@@ -79,6 +79,14 @@ class DetailController extends AbstractController
private function uploadContract(Disposition $disposition, UploadSessionDto $uploadSession): void
{
// The session can hold files of other types, so a non-empty session alone does not
// mean there is anything to replace the existing document with.
if (true === $uploadSession->getUploadsByType(Upload::TYPE_CONTRACT)->isEmpty()) {
$this->addFlash('error', 'Bitte lade zuerst den Honorarvertrag hoch');
return;
}
if (null !== $existingUpload = $disposition->getDocumentByType(Upload::TYPE_CONTRACT)) {
$this->entityManager->remove($existingUpload);
}
@@ -116,6 +124,14 @@ class DetailController extends AbstractController
private function uploadInvoice(Disposition $disposition, UploadSessionDto $uploadSession): void
{
// The session can hold files of other types, so a non-empty session alone does not
// mean there is anything to replace the existing document with.
if (true === $uploadSession->getUploadsByType(Upload::TYPE_INVOICE)->isEmpty()) {
$this->addFlash('error', 'Bitte lade zuerst die Honorarnote hoch');
return;
}
if (null !== $existingUpload = $disposition->getDocumentByType(Upload::TYPE_INVOICE)) {
$this->entityManager->remove($existingUpload);
}