Feat: Assign potential comment to upload for later use
This commit is contained in:
@@ -57,7 +57,7 @@ class CheckController extends AbstractController
|
||||
$this->confirmDocument($document, 'confirm_invoice', Upload::STATUS_PAID);
|
||||
break;
|
||||
case Upload::STATUS_REJECTED:
|
||||
$this->rejectDocument($document);
|
||||
$this->rejectDocument($document, $formData->getComment());
|
||||
$this->eventDispatcher->dispatch(new DocumentRejectedEvent($formData), DocumentRejectedEvent::NAME);
|
||||
}
|
||||
|
||||
@@ -73,11 +73,14 @@ class CheckController extends AbstractController
|
||||
return $this->json($response);
|
||||
}
|
||||
|
||||
private function rejectDocument(Upload $document): void
|
||||
private function rejectDocument(Upload $document, string $comment = null): void
|
||||
{
|
||||
$transition = Upload::TYPE_CONTRACT === $document->getType() ? 'reject_contract' : 'reject_invoice';
|
||||
$this->workflow->apply($document->getDisposition(), $transition);
|
||||
$document->setStatus(Upload::STATUS_REJECTED);
|
||||
$document
|
||||
->setStatus(Upload::STATUS_REJECTED)
|
||||
->setComment($comment)
|
||||
;
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->addFlash('success', 'Das Dokument wurde abgelehnt');
|
||||
|
||||
Reference in New Issue
Block a user