Commit 8ea9c9a4 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

- Up : On peut rendre indisponible un type de document existant

parent d8237c4f
Loading
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -1742,15 +1742,16 @@ class AdministrationController extends AbstractOscarController implements
                try {
                    $id = null;
                    $label = $this->params()->fromPost('label');
                    $description = $this->params()->fromPost('description');
                    $description = "";
                    $default = $this->params()->fromPost('default', '');
                    $this->getLoggerService()->info("Enregistrement de type de document '$signatureflow_id'");
                    $active = $this->params()->fromPost('active', '');

                    $documentRepository->createOrUpdateTypeDocument(
                        $id,
                        $label,
                        $description,
                        $default == 'on'
                        $default == 'on',
                        $active == 'on'
                    );
                } catch (\Exception $e) {
                    return $this->jsonErrorLogged("Impossible d'ajouter le type de document", $e);
@@ -1768,16 +1769,18 @@ class AdministrationController extends AbstractOscarController implements
                        throw new \Exception("Pas d'identifiant");
                    }
                    $label = $_PUT->get('label');
                    $description = $_PUT->get('description');
                    $description = $_PUT->get('description', '');
                    $default = $_PUT->get('default', '');
                    $active = $_PUT->get('active', '');
                    $signatureflow_id = intval($_PUT->get('signatureflow_id'));
                    $this->getLoggerService()->info(" > $id, $label, $description, $signatureflow_id");

                    $documentRepository->createOrUpdateTypeDocument(
                        $id,
                        $label,
                        $description,
                        $default == 'on'
                        "",
                        $default == 'on',
                        $active == 'on'
                    );
                    return $this->getResponseOk();
                } catch (\Exception $e) {
+2 −0
Original line number Diff line number Diff line
@@ -180,6 +180,7 @@ class ContractDocumentRepository extends AbstractTreeDataRepository
        string $label = "",
        string $description = "",
        bool $default = false,
        bool $active = true,
        int $signatureflow_id = 0
    ): void {
        if ($id == null) {
@@ -197,6 +198,7 @@ class ContractDocumentRepository extends AbstractTreeDataRepository

        $type->setLabel($label)
            ->setDefault($default)
            ->setActive($active)
            ->setDescription($description);

        $this->getEntityManager()->flush();
+1 −1
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ class Discipline
     * @var boolean
     * @ORM\Column(type="boolean", nullable=false, options={"default"=true})
     */
    protected $active = false;
    protected $active = true;

    /**
     * @var \Doctrine\Common\Collections\Collection
+23 −1
Original line number Diff line number Diff line
@@ -45,6 +45,14 @@ class TypeDocument implements ITrackable
     */
    private bool $default = false;

    /**
     * Est disponible à la selection
     *
     * @var boolean
     * @ORM\Column(type="boolean", nullable=false, options={"default"=true})
     */
    protected $active = true;

    /**
     * @return bool
     */
@@ -61,6 +69,19 @@ class TypeDocument implements ITrackable
        return $this->getDefault();
    }

    public function isActive(): bool
    {
        return $this->active;
    }

    public function setActive(bool $active): self
    {
        $this->active = $active;
        return $this;
    }



    /**
     * @param bool $default
     */
@@ -144,7 +165,8 @@ class TypeDocument implements ITrackable
            'id' => $this->getId(),
            'label' => $this->getLabel(),
            'description' => $this->getDescription(),
            'default' => $this->isDefault()
            'default' => $this->isDefault(),
            'active' => $this->isActive(),
        );
    }
}
+5 −3
Original line number Diff line number Diff line
@@ -769,10 +769,12 @@ class ProjectGrantApiService implements

        // Types de document
        foreach ($typesDocumentsDatas as $typeDocument) {
            if( $typeDocument->isActive() ){
                $typeDatas = $typeDocument->toArray();
                $typeDatas['flow'] = false;
                $typesDocuments[] = $typeDatas;
            }
        }

        $out['processDatas'] = $processDatas;
        $out['typesDocuments'] = $typesDocuments;
Loading