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