Fix: Resolve impossible confirmation of uploaded contract
This commit is contained in:
@@ -76,36 +76,39 @@ class CheckController extends AbstractController
|
|||||||
|
|
||||||
private function rejectDocument(Upload $document, string $comment = null): 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
|
$document
|
||||||
->setStatus(Upload::STATUS_REJECTED)
|
->setStatus(Upload::STATUS_REJECTED)
|
||||||
->setComment($comment)
|
->setComment($comment)
|
||||||
;
|
;
|
||||||
$this->entityManager->flush();
|
|
||||||
|
|
||||||
$this->addFlash('success', 'Das Dokument wurde abgelehnt');
|
$this->addFlash('success', 'Das Dokument wurde abgelehnt');
|
||||||
$this->logger->info('Reject document', [
|
$this->logger->info('Reject document', [
|
||||||
'document' => $document->getOriginalFilename(),
|
'document' => $document->getOriginalFilename(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$transition = Upload::TYPE_CONTRACT === $document->getType() ? 'reject_contract' : 'reject_invoice';
|
||||||
|
$this->workflow->apply($document->getDisposition(), $transition);
|
||||||
|
|
||||||
|
$this->entityManager->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function confirmDocument(Upload $document, string $transition, string $status): void
|
private function confirmDocument(Upload $document, string $transition, string $status): void
|
||||||
{
|
{
|
||||||
|
$document->setStatus($status);
|
||||||
|
$this->addFlash('success', 'Das Dokument wurde bestätigt');
|
||||||
|
$this->logger->info('Confirm document', [
|
||||||
|
'document' => $document->getOriginalFilename(),
|
||||||
|
]);
|
||||||
|
|
||||||
if (true === $this->workflow->can($document->getDisposition(), $transition)) {
|
if (true === $this->workflow->can($document->getDisposition(), $transition)) {
|
||||||
$document->setStatus($status);
|
|
||||||
$this->workflow->apply($document->getDisposition(), $transition);
|
$this->workflow->apply($document->getDisposition(), $transition);
|
||||||
$this->entityManager->flush();
|
|
||||||
$this->addFlash('success', 'Das Dokument wurde bestätigt');
|
|
||||||
$this->logger->info('Confirm document', [
|
|
||||||
'document' => $document->getOriginalFilename(),
|
|
||||||
]);
|
|
||||||
} else {
|
} else {
|
||||||
$blockers = $this->workflow->buildTransitionBlockerList($document->getDisposition(), $transition);
|
$blockers = $this->workflow->buildTransitionBlockerList($document->getDisposition(), $transition);
|
||||||
foreach ($blockers as $blocker) {
|
foreach ($blockers as $blocker) {
|
||||||
$this->addFlash('error', $blocker->getMessage());
|
$this->addFlash('error', $blocker->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->entityManager->flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user