fix: rework document and disposition workflow
This commit is contained in:
@@ -12,8 +12,8 @@ framework:
|
||||
- new
|
||||
- checking_contract
|
||||
- confirmed
|
||||
- ended
|
||||
- checking_invoice
|
||||
- paid
|
||||
- completed
|
||||
transitions:
|
||||
upload_contract:
|
||||
@@ -23,23 +23,14 @@ framework:
|
||||
from: checking_contract
|
||||
to: confirmed
|
||||
reject_contract:
|
||||
from:
|
||||
- confirmed
|
||||
- checking_contract
|
||||
from: checking_contract
|
||||
to: new
|
||||
upload_invoice:
|
||||
from:
|
||||
- confirmed
|
||||
- completed
|
||||
from: ended
|
||||
to: checking_invoice
|
||||
reject_invoice:
|
||||
from: checking_invoice
|
||||
to: ended
|
||||
confirm_invoice:
|
||||
from: checking_invoice
|
||||
to: paid
|
||||
reject_invoice:
|
||||
from:
|
||||
- paid
|
||||
- checking_invoice
|
||||
to: confirmed
|
||||
complete:
|
||||
from: confirmed
|
||||
to: completed
|
||||
|
||||
@@ -23,6 +23,7 @@ class Disposition implements BlameableEntityInterface, TimestampableEntityInterf
|
||||
public const STATUS_NEW = 'new';
|
||||
public const STATUS_CHECKING_CONTRACT = 'checking_contract';
|
||||
public const STATUS_CONFIRMED = 'confirmed';
|
||||
public const STATUS_ENDED = 'ended';
|
||||
public const STATUS_CHECKING_INVOICE = 'checking_invoice';
|
||||
public const STATUS_PAID = 'paid';
|
||||
public const STATUS_COMPLETED = 'completed';
|
||||
|
||||
@@ -110,7 +110,7 @@ class DispositionWorkflowGuardSubscriber implements EventSubscriberInterface
|
||||
$disposition = $event->getSubject();
|
||||
$invoiceDocument = $disposition->getDocumentByType(Upload::TYPE_INVOICE);
|
||||
|
||||
if (null === $invoiceDocument || Upload::STATUS_CHECKED !== $invoiceDocument->getStatus()) {
|
||||
if (null === $invoiceDocument || Upload::STATUS_PAID !== $invoiceDocument->getStatus()) {
|
||||
$message = $this
|
||||
->translator
|
||||
->trans('message.confirm_invoice.document_missing_or_not_checked')
|
||||
|
||||
@@ -225,13 +225,21 @@ class DispositionRepository extends ServiceEntityRepository
|
||||
return $qb
|
||||
->innerJoin('disposition.assignment', 'assignment')
|
||||
->innerJoin('assignment.destination', 'destination')
|
||||
->where($qb->expr()->orX(
|
||||
->where($qb->expr()->andX(
|
||||
$qb->expr()->in('disposition.status', ':status'),
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->andX(
|
||||
$qb->expr()->isNotNull('assignment.dateTo'),
|
||||
$qb->expr()->lte('assignment.dateTo', ':dateTo')
|
||||
),
|
||||
$qb->expr()->lte('destination.dateTo', ':dateTo')
|
||||
)
|
||||
))
|
||||
->setParameter('status', [
|
||||
Disposition::STATUS_NEW,
|
||||
Disposition::STATUS_CHECKING_CONTRACT,
|
||||
Disposition::STATUS_CONFIRMED,
|
||||
])
|
||||
->setParameter('dateTo', new \DateTimeImmutable())
|
||||
->getQuery()
|
||||
->getResult()
|
||||
|
||||
@@ -18,7 +18,8 @@ class DispositionStatusService
|
||||
{
|
||||
$endedDispositions = $this
|
||||
->entityManager
|
||||
->getRepository(Disposition::class)->findEndedDispositions()
|
||||
->getRepository(Disposition::class)
|
||||
->findEndedDispositions()
|
||||
;
|
||||
|
||||
if (0 === $count = count($endedDispositions)) {
|
||||
@@ -26,7 +27,7 @@ class DispositionStatusService
|
||||
}
|
||||
|
||||
foreach ($endedDispositions as $disposition) {
|
||||
$disposition->setStatus(Disposition::STATUS_COMPLETED);
|
||||
$disposition->setStatus(Disposition::STATUS_ENDED);
|
||||
}
|
||||
|
||||
$this->entityManager->flush();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
{% block content %}
|
||||
{% set assignment = disposition.assignment %}
|
||||
<h1 class="text-2xl font-bold pb-8">
|
||||
{% if workflow_has_marked_place(disposition, 'completed') %}
|
||||
{% if workflow_has_marked_place(disposition, 'ended') %}
|
||||
Dein Einsatz ist abgeschlossen
|
||||
{% else %}
|
||||
Dein Einsatz wurde bestätigt!
|
||||
@@ -76,10 +76,23 @@
|
||||
{% endif %}
|
||||
|
||||
{# Upload invoice #}
|
||||
{% if workflow_has_marked_place(disposition, 'completed') %}
|
||||
{% if workflow_has_marked_place(disposition, 'ended') %}
|
||||
<h2 class="text-lg font-bold pb-4">
|
||||
Honorarnote
|
||||
</h2>
|
||||
|
||||
{# Existing invoice has been rejected #}
|
||||
{% set invoice = disposition.documentByType('invoice') %}
|
||||
{% if invoice and invoice.status == constant('App\\Entity\\Upload::STATUS_REJECTED') %}
|
||||
<twig:MessageBox message="Deine Honorarnote muss überarbeitet werden" type="error"/>
|
||||
{% if invoice.comment %}
|
||||
<div class="py-2">
|
||||
<strong>Begründung:</strong> {{ invoice.comment|nl2br }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{# New invoice #}
|
||||
{% if workflow_can(disposition, 'upload_invoice') %}
|
||||
{{ form_start(form) }}
|
||||
<div class="flex flex-col space-y-4">
|
||||
@@ -135,10 +148,21 @@
|
||||
<div class="pb-4">
|
||||
Wir prüfen das Dokument schnellstmöglich.
|
||||
</div>
|
||||
|
||||
{# Existing upload is being checked #}
|
||||
{% set invoice = disposition.documentByType('invoice') %}
|
||||
{% if invoice and invoice.status == constant('App\\Entity\\Upload::STATUS_PENDING') %}
|
||||
<twig:MessageBox message="Deine Honorarnote befindet sich in Bearbeitung"/>
|
||||
{% if invoice.comment %}
|
||||
<div class="py-2">
|
||||
<strong>Begründung:</strong> {{ invoice.comment|nl2br }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{# Invoice paid #}
|
||||
{% if workflow_has_marked_place(disposition, 'paid') %}
|
||||
{% if workflow_has_marked_place(disposition, 'completed') %}
|
||||
<h3 class="text-xl font-bold pb-4">
|
||||
Dein Honorar wurde überwiesen
|
||||
</h3>
|
||||
|
||||
Reference in New Issue
Block a user