mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Add PDF signature zone availability checks
Introduce `PDFSignatureZoneAvailable` service to check available PDF signature zones. Updated `WorkflowAddSignatureController` to use the new service. Added unit tests to verify the correctness of the functionality.
This commit is contained in:
parent
e17203ca3a
commit
667e144681
@ -47,7 +47,7 @@ class PDFSignatureZoneAvailable
|
||||
$this->collectSignaturesInUse($entityWorkflow)
|
||||
);
|
||||
|
||||
return array_filter($zones, fn (PDFSignatureZone $zone) => !in_array($zone->index, $signatureZonesIndexes, true));
|
||||
return array_values(array_filter($zones, fn (PDFSignatureZone $zone) => !in_array($zone->index, $signatureZonesIndexes, true)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,7 +30,7 @@ final readonly class WorkflowAddSignatureController
|
||||
private Environment $twig
|
||||
) {}
|
||||
|
||||
#[Route(path: '/{_locale}/main/workflow/signature/{id}/sign', name: 'chill_main_workflow_signature', methods: 'GET')]
|
||||
#[Route(path: '/{_locale}/main/workflow/signature/{id}/sign', name: 'chill_main_workflow_signature_add', methods: 'GET')]
|
||||
public function __invoke(EntityWorkflowStepSignature $signature, Request $request): Response
|
||||
{
|
||||
$entityWorkflow = $signature->getStep()->getEntityWorkflow();
|
||||
|
@ -377,7 +377,7 @@ class WorkflowController extends AbstractController
|
||||
$signature = $this->entityManager->getRepository(EntityWorkflowStepSignature::class)->find($signature_id);
|
||||
|
||||
if ($signature->getSigner() instanceof User) {
|
||||
return $this->redirectToRoute('chill_main_workflow_signature', ['signature_id' => $signature_id]);
|
||||
return $this->redirectToRoute('chill_main_workflow_signature_add', ['id' => $signature_id]);
|
||||
}
|
||||
|
||||
$metadataForm = $this->createForm(WorkflowSignatureMetadataType::class);
|
||||
@ -401,7 +401,7 @@ class WorkflowController extends AbstractController
|
||||
$this->entityManager->persist($signature);
|
||||
$this->entityManager->flush();
|
||||
|
||||
return $this->redirectToRoute('chill_main_workflow_signature', ['signature_id' => $signature_id]);
|
||||
return $this->redirectToRoute('chill_main_workflow_signature_add', ['id' => $signature_id]);
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
|
Loading…
x
Reference in New Issue
Block a user