mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-05 07:19:49 +00:00
Implement logic to save metadata to signature
This commit is contained in:
parent
52a9aab73f
commit
8a7b48b201
@ -15,7 +15,9 @@ use Chill\MainBundle\Entity\User;
|
|||||||
use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
|
use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
|
||||||
use Chill\MainBundle\Entity\Workflow\EntityWorkflowComment;
|
use Chill\MainBundle\Entity\Workflow\EntityWorkflowComment;
|
||||||
use Chill\MainBundle\Entity\Workflow\EntityWorkflowStep;
|
use Chill\MainBundle\Entity\Workflow\EntityWorkflowStep;
|
||||||
|
use Chill\MainBundle\Entity\Workflow\EntityWorkflowStepSignature;
|
||||||
use Chill\MainBundle\Form\EntityWorkflowCommentType;
|
use Chill\MainBundle\Form\EntityWorkflowCommentType;
|
||||||
|
use Chill\MainBundle\Form\WorkflowSignatureMetadataType;
|
||||||
use Chill\MainBundle\Form\WorkflowStepType;
|
use Chill\MainBundle\Form\WorkflowStepType;
|
||||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||||
use Chill\MainBundle\Repository\Workflow\EntityWorkflowRepository;
|
use Chill\MainBundle\Repository\Workflow\EntityWorkflowRepository;
|
||||||
@ -36,6 +38,7 @@ use Symfony\Component\Routing\Annotation\Route;
|
|||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||||
use Symfony\Component\Workflow\Registry;
|
use Symfony\Component\Workflow\Registry;
|
||||||
use Symfony\Component\Workflow\TransitionBlocker;
|
use Symfony\Component\Workflow\TransitionBlocker;
|
||||||
|
use Symfony\Component\Workflow\Workflow;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
class WorkflowController extends AbstractController
|
class WorkflowController extends AbstractController
|
||||||
@ -284,16 +287,6 @@ class WorkflowController extends AbstractController
|
|||||||
if (!$signatures->isEmpty()) {
|
if (!$signatures->isEmpty()) {
|
||||||
$signaturesByPerson = $signatures[0]->getSigner() instanceof Person;
|
$signaturesByPerson = $signatures[0]->getSigner() instanceof Person;
|
||||||
}
|
}
|
||||||
/* $personSignatures = [];
|
|
||||||
$userSignatures = [];*/
|
|
||||||
|
|
||||||
/* foreach ($signatures as $signature) {
|
|
||||||
if ($signature->getSigner() instanceof Person) {
|
|
||||||
$personSignatures[] = $signature->getSigner();
|
|
||||||
} else {
|
|
||||||
$userSignatures[] = $signature->getSigner();
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if (\count($workflow->getEnabledTransitions($entityWorkflow)) > 0) {
|
if (\count($workflow->getEnabledTransitions($entityWorkflow)) > 0) {
|
||||||
// possible transition
|
// possible transition
|
||||||
@ -385,4 +378,41 @@ class WorkflowController extends AbstractController
|
|||||||
|
|
||||||
return $lines;
|
return $lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Route(path: '/{_locale}/main/workflow/{id}/signature/{signature_id}/metadata', name: 'chill_main_workflow_signature_metadata')]
|
||||||
|
public function addSignatureMetadata(EntityWorkflow $entityWorkflow, EntityWorkflowStepSignature $signature, Request $request): Response
|
||||||
|
{
|
||||||
|
$metadataForm = $this->createForm(WorkflowSignatureMetadataType::class);
|
||||||
|
$metadataForm->add('submit', SubmitType::class, ['label' => $this->translator->trans('Save')]);
|
||||||
|
|
||||||
|
|
||||||
|
$metadataForm->handleRequest($request);
|
||||||
|
|
||||||
|
if ($metadataForm->isSubmitted() && $metadataForm->isValid()) {
|
||||||
|
$data = $metadataForm->getData();
|
||||||
|
|
||||||
|
$signature->setSignatureMetadata(
|
||||||
|
[
|
||||||
|
'documentType' => $data['documentType'],
|
||||||
|
'documentNumber' => $data['documentNumber'],
|
||||||
|
'expirationDate' => $data['expirationDate'],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->entityManager->persist($signature);
|
||||||
|
$this->entityManager->flush();
|
||||||
|
|
||||||
|
//Todo should redirect to document for actual signing? To be adjusted still
|
||||||
|
return $this->redirectToRoute('chill_main_workflow_show', ['id' => $entityWorkflow->getId()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this->render(
|
||||||
|
'@ChillMain/Workflow/_signature_metadata.html.twig',
|
||||||
|
[
|
||||||
|
'metadata_form' => $metadataForm->createView(),
|
||||||
|
'person' => $signature->getSigner()
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,12 @@
|
|||||||
<div class="col-sm-6"><span>{{ s.getSigner.username }}</span></div>
|
<div class="col-sm-6"><span>{{ s.getSigner.username }}</span></div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
|
{% if signaturesByPerson %}
|
||||||
|
<a class="btn btn-show" href="{{ chill_path_add_return_path('chill_main_workflow_signature_metadata', { 'id': entity_workflow.id, 'signature_id': s.id}) }}">{{ 'workflow.signature_zone.button_sign'|trans }}</a>
|
||||||
|
{% else %}
|
||||||
<a class="btn btn-show" href="#">{{ 'workflow.signature_zone.button_sign'|trans }}</a>
|
<a class="btn btn-show" href="#">{{ 'workflow.signature_zone.button_sign'|trans }}</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if s.state is same as('signed') %}
|
{% if s.state is same as('signed') %}
|
||||||
<p class="updatedBy">{{ s.stateDate }}</p>
|
<p class="updatedBy">{{ s.stateDate }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -531,6 +531,11 @@ workflow:
|
|||||||
signature_zone:
|
signature_zone:
|
||||||
title: Appliquer les signatures éléctroniques
|
title: Appliquer les signatures éléctroniques
|
||||||
button_sign: Signer
|
button_sign: Signer
|
||||||
|
metadata:
|
||||||
|
sign_by: 'Signature pour %name%'
|
||||||
|
docType: Type de document
|
||||||
|
docNumber: Numéro de document
|
||||||
|
docExpiration: Date d'expiration
|
||||||
|
|
||||||
|
|
||||||
Subscribe final: Recevoir une notification à l'étape finale
|
Subscribe final: Recevoir une notification à l'étape finale
|
||||||
|
Loading…
x
Reference in New Issue
Block a user