Commit d506374a authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

- Suppression de la dépendances entre les Process/ProcessStep

parent 4ca4f85e
Loading
Loading
Loading
Loading

doc/update-2.0.md

0 → 100644
+31 −0
Original line number Diff line number Diff line
# UPDATE 2.0

## Nouveautés

 - Dépendance faible entre les process et signatureflow (modèle des process)


## Mise à jour du modèle

Via Doctrine : 

```bash
php vendor/bin/doctrine-module orm:schema-tool:update --force --complete
```

Via SQL :

```sql
ALTER TABLE unicaen_signature_process ADD description TEXT DEFAULT NULL;
```

## Mise à jour des données existantes

```sql
-- On copie les LABELS/DESCRIPTION
UPDATE unicaen_signature_process
    SET label = sf.label, 
        description = sf.description
FROM unicaen_signature_signatureflow sf
    WHERE sf.id = signatureflow_id;
```
 No newline at end of file
+10 −6
Original line number Diff line number Diff line
@@ -444,18 +444,22 @@ class AdministrationController extends AbstractActionController
                    }
                }



                if ($step['observers_options']) {
                    $step['observers_options_infos'] = [];

                    $method = $step['method'];
                    $recipientsMethod = $this->getSignatureService()->getSignatureConfigurationService(
                    )->getMethodByKey($method);
                    $recipientsMethod = $this->getSignatureService()
                        ->getSignatureConfigurationService()
                        ->getMethodByKey($method);

                    if( !array_key_exists('options', $recipientsMethod) ) {
                        $msg = "La clef 'options' est manquante pour la méthode '$method'";
                        $this->getSignatureService()->getLoggerService()->error($msg);
                    } else {
                        $recipientsOptionsKeys = array_column($recipientsMethod['options'], 'key');

                        foreach ($step['observers_options'] as $key => $value) {
                        $index = array_search($key, array_column($recipientsMethod['options'], 'key'));
                            $index = array_search($key, $recipientsOptionsKeys);
                            $optionsDatas = $recipientsMethod['options'][$index];

                            $step['observers_options_infos'][$optionsDatas['label']] = [];
@@ -468,7 +472,7 @@ class AdministrationController extends AbstractActionController
                            }
                        }
                    }

                }

                $signatureflows[$i]['steps'][$j]['options'] = $step['options'];
                $signatureflows[$i]['steps'][$j]['observers_options'] = $step['observers_options'];
+12 −22
Original line number Diff line number Diff line
@@ -63,10 +63,19 @@ class Process
    private ?string $label = null;

    /**
     * @var SignatureFlow
     * @ORM\ManyToOne(targetEntity="SignatureFlow")
     * Description du process issu du SignatureFlow
     *
     * @var ?string
     * @ORM\Column (type="text", nullable=true)
     */
    private SignatureFlow $signatureFlow;
    private ?string $description = null;

    /**
     * ANCIEN CHAMP
     *
     * @ORM\Column (type="integer", nullable=true)
     */
    private ?int $signatureFlow_id = null;

    /**
     * @var string
@@ -201,25 +210,6 @@ class Process

        return $this;
    }


    /**
     * @return SignatureFlow
     */
    public function getSignatureFlow(): SignatureFlow
    {
        return $this->signatureFlow;
    }

    /**
     * @param SignatureFlow $process
     */
    public function setSignatureFlow(SignatureFlow $signatureFlow): self
    {
        $this->signatureFlow = $signatureFlow;
        return $this;
    }

    /**
     * @return string
     */
+2 −0
Original line number Diff line number Diff line
@@ -71,6 +71,8 @@ class SignatureRecipientRepository extends EntityRepository
            $qb->setParameters($params);
        }

        $qb->orderBy('s.dateSend', "desc");

        return $qb->getQuery()->getResult();
    }
}
 No newline at end of file
+4 −5
Original line number Diff line number Diff line
@@ -148,9 +148,9 @@ class ProcessService
    {
        $process = new Process();
        $this->getObjectManager()->persist($process);
        $process->setDocumentName($documentName)
            ->setStatus(Signature::STATUS_PROCESS_UNCONFIGURED)
            ->setSignatureFlow($this->getSignatureFlow($signatureFlowId));
        $process
            ->setDocumentName($documentName)
            ->setStatus(Signature::STATUS_PROCESS_UNCONFIGURED);
        $this->getObjectManager()->flush();
        return $process;
    }
@@ -176,9 +176,8 @@ class ProcessService
     * @return void
     * @throws SignatureException
     */
    public function configureProcess(Process $process, array $jsonDatas): void
    public function configureProcess(Process $process, array $jsonDatas, SignatureFlow $signatureFlow): void
    {
        $signatureFlow = $process->getSignatureFlow();

        $process->setDateCreated(new \DateTime())
            ->setStatus(Signature::STATUS_SIGNATURE_DRAFT);
Loading