diff --git a/doc/config/database.md b/doc/config/database.md index fdb51867632e6759f46edf2f87e8d7f6072b761e..417ac55204b72202f620571b003c8c9659e617af 100644 --- a/doc/config/database.md +++ b/doc/config/database.md @@ -85,7 +85,8 @@ CREATE TABLE public.unicaen_signature_process ( status int4 NULL, document_name varchar(255) NOT NULL, currentstep int4 NOT NULL, - CONSTRAINT unicaen_signature_process_pkey PRIMARY KEY (id), + label varchar(255) NULL DEFAULT NULL::character varying, + CONSTRAINT unicaen_signature_process_pkey PRIMARY KEY (id), CONSTRAINT fk_994855d2b4090c8a FOREIGN KEY (signatureflow_id) REFERENCES unicaen_signature_signatureflow(id) ); CREATE INDEX idx_994855d2b4090c8a ON public.unicaen_signature_process USING btree (signatureflow_id); @@ -131,13 +132,12 @@ CREATE TABLE public.unicaen_signature_process_step ( id int4 NOT NULL, process_id int4 NULL, signature_id int4 NULL, - signatureflowstep_id int4 NULL, - CONSTRAINT unicaen_signature_process_step_pkey PRIMARY KEY (id), + label varchar(255) NULL DEFAULT NULL::character varying, + + CONSTRAINT unicaen_signature_process_step_pkey PRIMARY KEY (id), CONSTRAINT fk_cf70b0a57ec2f574 FOREIGN KEY (process_id) REFERENCES unicaen_signature_process(id), - CONSTRAINT fk_cf70b0a5c352c4 FOREIGN KEY (signatureflowstep_id) REFERENCES unicaen_signature_signatureflowstep(id), CONSTRAINT fk_cf70b0a5ed61183a FOREIGN KEY (signature_id) REFERENCES unicaen_signature_signature(id) ); CREATE INDEX idx_cf70b0a57ec2f574 ON public.unicaen_signature_process_step USING btree (process_id); -CREATE INDEX idx_cf70b0a5c352c4 ON public.unicaen_signature_process_step USING btree (signatureflowstep_id); CREATE UNIQUE INDEX uniq_cf70b0a5ed61183a ON public.unicaen_signature_process_step USING btree (signature_id); ``` \ No newline at end of file diff --git a/doc/dev/database-install-sql.md b/doc/dev/database-install-sql.md index 82d5e66f4b7e788430acee6a9d9a6d1f2e0ce35f..66fc3fa57bf64a9456c3eaebbdcde99b4d48531f 100644 --- a/doc/dev/database-install-sql.md +++ b/doc/dev/database-install-sql.md @@ -100,6 +100,7 @@ CREATE TABLE unicaen_signature_process status int4 NULL, currentstep int4 NOT NULL, document_name varchar(255) NOT NULL, + label varchar(255) NULL DEFAULT NULL::character varying, signatureflow_id int4 NULL, CONSTRAINT unicaen_signature_process_pkey PRIMARY KEY (id), CONSTRAINT fk_994855d2b4090c8a FOREIGN KEY (signatureflow_id) REFERENCES unicaen_signature_signatureflow (id) @@ -112,14 +113,12 @@ CREATE TABLE unicaen_signature_process_step id int4 NOT NULL, process_id int4 NULL, signature_id int4 NULL, - signatureflowstep_id int4 NULL, + label varchar(255) NULL DEFAULT NULL::character varying, CONSTRAINT unicaen_signature_process_step_pkey PRIMARY KEY (id), CONSTRAINT fk_cf70b0a57ec2f574 FOREIGN KEY (process_id) REFERENCES unicaen_signature_process (id), - CONSTRAINT fk_cf70b0a5c352c4 FOREIGN KEY (signatureflowstep_id) REFERENCES unicaen_signature_signatureflowstep (id), CONSTRAINT fk_cf70b0a5ed61183a FOREIGN KEY (signature_id) REFERENCES unicaen_signature_signature (id) ); CREATE INDEX idx_cf70b0a57ec2f574 ON unicaen_signature_process_step USING btree (process_id); -CREATE INDEX idx_cf70b0a5c352c4 ON unicaen_signature_process_step USING btree (signatureflowstep_id); CREATE UNIQUE INDEX uniq_cf70b0a5ed61183a ON unicaen_signature_process_step USING btree (signature_id); -- Sequences diff --git a/src/Entity/Db/Process.php b/src/Entity/Db/Process.php index 499d7476dd18310ed30cb7a12d308041c1d7d827..af0597bc80e2bb9fe70d5084c55f4d87ea3929e3 100644 --- a/src/Entity/Db/Process.php +++ b/src/Entity/Db/Process.php @@ -54,6 +54,14 @@ class Process */ protected int $currentStep = 0; + /** + * Label du process issu du SignatureFlow + * + * @var ?string + * @ORM\Column (type="text", nullable=true) + */ + private ?string $label; + /** * @var SignatureFlow * @ORM\ManyToOne(targetEntity="SignatureFlow") @@ -181,6 +189,20 @@ class Process return $this; } + + public function getLabel(): ?string + { + return $this->label; + } + + public function setLabel(?string $label): ?string + { + $this->label = $label; + + return $this; + } + + /** * @return SignatureFlow */ @@ -232,11 +254,6 @@ class Process ); } - public function getLabel(): string - { - return $this->getSignatureFlow()->getLabel(); - } - public function isInProgress(): bool { return $this->getStatus() == Signature::STATUS_SIGNATURE_WAIT; diff --git a/src/Entity/Db/ProcessStep.php b/src/Entity/Db/ProcessStep.php index f71c3be254f7ae3b871610590d091daaecb6ba57..e2640a5d1e5d5346b0ce8f1d5adb0dffb70f6b5b 100644 --- a/src/Entity/Db/ProcessStep.php +++ b/src/Entity/Db/ProcessStep.php @@ -32,11 +32,15 @@ class ProcessStep */ private Signature $signature; + /** - * @var SignatureFlowStep - * @ORM\ManyToOne(targetEntity="SignatureFlowStep") + * Label de l'étape du process issu du SignatureFlowStep + * + * @var ?string + * @ORM\Column (type="text", nullable=true) */ - private SignatureFlowStep $signatureFlowStep; + private ?string $label; + /** * @return int @@ -89,23 +93,17 @@ class ProcessStep return $this; } - /** - * @return SignatureFlowStep - */ - public function getSignatureFlowStep(): SignatureFlowStep - { - return $this->signatureFlowStep; - } + public function setLabel($label) :ProcessStep { + $this->label = $label; - /** - * @param SignatureFlowStep $signatureFlowStep - */ - public function setSignatureFlowStep(SignatureFlowStep $signatureFlowStep): self - { - $this->signatureFlowStep = $signatureFlowStep; return $this; } + public function getLabel() :string { + return $this->label; + } + + /** * @return int */ @@ -114,9 +112,7 @@ class ProcessStep return $this->getSignature()->getOrder(); } - public function getLabel() :string { - return $this->getSignatureFlowStep()->getLabel(); - } + public function getLetterfileName() :string { return $this->getSignature()->getLetterfileKey(); diff --git a/src/Service/ProcessService.php b/src/Service/ProcessService.php index 54b7cb51eb2fe5b75681415df3a76515e2e4d36a..77067d0d2ce79536cd03d1d64119d2a8f264cf46 100644 --- a/src/Service/ProcessService.php +++ b/src/Service/ProcessService.php @@ -24,6 +24,7 @@ class ProcessService SignatureConfigurationServiceAwareTrait, SignatureServiceAwareTrait; + /** * @return ProcessRepository */ @@ -188,8 +189,7 @@ class ProcessService // Création des étapes $processStep = new ProcessStep(); $this->getObjectManager()->persist($processStep); - - $processStep->setSignatureFlowStep($signatureFlowStep); + $processStep->setLabel($signatureFlowStep->getLabel()); $processStep->setProcess($process); $process->getSteps()->add($processStep);