Commit e94e495c authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

(DONE) Tâche 12112 (Page récap BU)

parent 92e49473
Loading
Loading
Loading
Loading
Loading
+30 −0
Changes for module/Application/config/others/these.config.php: 30 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -14,7 +14,10 @@ use Application\Form\Factory\MetadonneeTheseFormFactory;
use Application\Form\Factory\RdvBuHydratorFactory;
use Application\Form\Factory\RdvBuTheseDoctorantFormFactory;
use Application\Form\Factory\RdvBuTheseFormFactory;
use Application\Form\Factory\RecapBuFormFactory;
use Application\Form\Factory\RecapBuHydratorFactory;
use Application\Form\Hydrator\RdvBuHydrator;
use Application\Form\Hydrator\RecapBuHydrator;
use Application\Provider\Privilege\ThesePrivileges;
use Application\Service\Acteur\ActeurService;
use Application\Service\Message\DiffusionMessages;
@@ -208,6 +211,7 @@ return [
                    'controller' => 'Application\Controller\These',
                    'action'     => [
                        'modifier-rdv-bu',
                        'recap-bu',
                    ],
                    'privileges' => [
                        ThesePrivileges::THESE_SAISIE_RDV_BU,
@@ -612,6 +616,18 @@ return [
                            ],
                        ],
                    ],
                    'recap-bu' => [
                        'type'          => 'Segment',
                        'options'       => [
                            'route'       => '/recap-bu/:these',
                            'constraints' => [
                                'these' => '\d+',
                            ],
                            'defaults'    => [
                                'action' => 'recap-bu',
                            ],
                        ],
                    ],
                    'exporter-convention-mise-en-ligne' => [
                        'type'          => 'Segment',
                        'options'       => [
@@ -689,6 +705,18 @@ return [
                                'etape' => null,
                                'visible' => 'Assertion\\These',
                            ],
                            'recapbu' => [
                                'label'    => 'Récapitulatif BU',
                                'route'    => 'these/recap-bu',
                                'withtarget' => true,
                                'paramsInject' => [
                                    'these',
                                ],
                                'icon' => 'glyphicon glyphicon-exclamation-sign',
                                'resource' => PrivilegeController::getResourceId('Application\Controller\These', 'modifier-rdv-bu'),
                                'etape' => null,
                                'visible' => 'Assertion\\These',
                            ],

                            'divider-these' => [
                                'label'    => null,
@@ -849,6 +877,7 @@ return [
            'DiffusionTheseForm' => DiffusionTheseFormFactory::class,
            'RdvBuTheseForm' => RdvBuTheseFormFactory::class,
            'RdvBuTheseDoctorantForm' => RdvBuTheseDoctorantFormFactory::class,
            'RecapBuForm' => RecapBuFormFactory::class,
        ],
        'initializers' => [
            ServiceAwareInitializer::class,
@@ -859,6 +888,7 @@ return [
            'DiffusionHydrator' => DiffusionHydratorFactory::class,
            'AttestationHydrator' => AttestationHydratorFactory::class,
            'RdvBuHydrator' => RdvBuHydratorFactory::class,
            'RecapBuHydrator' => RecapBuHydratorFactory::class,
        )
    ),
    'service_manager' => [
+54 −1
Changes for module/Application/src/Application/Controller/TheseController.php: 54 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ use Application\Entity\Db\Fichier;
use Application\Entity\Db\MetadonneeThese;
use Application\Entity\Db\NatureFichier;
use Application\Entity\Db\RdvBu;
use Application\Entity\Db\RecapBu;
use Application\Entity\Db\Role;
use Application\Entity\Db\These;
use Application\Entity\Db\TypeValidation;
@@ -19,9 +20,11 @@ use Application\Filter\IdifyFilterAwareTrait;
use Application\Form\AttestationTheseForm;
use Application\Form\ConformiteFichierForm;
use Application\Form\DiffusionTheseForm;
use Application\Form\Hydrator\RecapBuHydrator;
use Application\Form\MetadonneeTheseForm;
use Application\Form\RdvBuTheseDoctorantForm;
use Application\Form\RdvBuTheseForm;
use Application\Form\RecapBuForm;
use Application\Service\Etablissement\EtablissementServiceAwareInterface;
use Application\Service\Etablissement\EtablissementServiceAwareTrait;
use Application\Service\Fichier\Exception\ValidationImpossibleException;
@@ -47,6 +50,8 @@ use Doctrine\ORM\Tools\Pagination\Paginator;
use DoctrineORMModule\Paginator\Adapter\DoctrinePaginator;
use Retraitement\Exception\TimedOutCommandException;
use UnicaenApp\Exception\RuntimeException;
use UnicaenApp\Service\EntityManagerAwareInterface;
use UnicaenApp\Service\EntityManagerAwareTrait;
use UnicaenApp\Service\MessageCollectorAwareTrait;
use UnicaenApp\Traits\MessageAwareInterface;
use Zend\Form\Element\Hidden;
@@ -60,7 +65,7 @@ class TheseController extends AbstractController implements
    ValidationServiceAwareInterface, VersionFichierServiceAwareInterface,
    TheseServiceAwareInterface, RoleServiceAwareInterface, FichierServiceAwareInterface,
    WorkflowServiceAwareInterface, NotificationServiceAwareInterface,
    EtablissementServiceAwareInterface
    EtablissementServiceAwareInterface, EntityManagerAwareInterface
{
    use VariableServiceAwareTrait;
    use TheseServiceAwareTrait;
@@ -73,6 +78,7 @@ class TheseController extends AbstractController implements
    use NotificationServiceAwareTrait;
    use IdifyFilterAwareTrait;
    use EtablissementServiceAwareTrait;
    use EntityManagerAwareTrait;

    private $timeoutRetraitement;

@@ -1357,4 +1363,51 @@ class TheseController extends AbstractController implements

        return $this;
    }


    /**
     * @return ViewModel
     * @throws \Doctrine\ORM\OptimisticLockException
     */
    public function recapBuAction() {

        $DEBUG = false;

        /**
         * @var These $these
         * @var RecapBu $recap
         */

        //recuperation de l'objet ou création d'un nouveau si non existant
        $repo = $this->entityManager->getRepository(RecapBu::class);
        $these = $this->requestedThese();
        $recap = $repo->findOneBy(["these" => $these]);
        if ($recap === null) {
            if ($DEBUG) echo "Creation d'un nouveau RecapBU <br/>";
            $recap = new RecapBu();
            $recap->setThese($these);
        } else {
            if ($DEBUG) echo "Récupération d'un RecapBU existant <br/>";
            if ($DEBUG) echo $recap->getId() . "|" . $recap->getThese()->getId() . "|" .
                             $recap->getOrcid() . "|" . $recap->getNNT() . "|" . $recap->getVigilance() . "<br/>";
        }

        //creation du formulaire via le service pour avoir appel de la factory (qui fera init et setHydrator)
        $form = $this->getServiceLocator()->get('formElementManager')->get('RecapBuForm');
        $form->bind($recap); // appel de Hydrator::extract

        if ($this->getRequest()->isPost()) {
            $form->setData($this->getRequest()->getPost()); // appel de Hydrator::hydrate

            if ($form->isValid()) {
                $this->entityManager->persist($recap);
                $this->entityManager->flush($recap);
            }
        }

        return new ViewModel([
            'these' => $these,
            'form' => $form,
        ]);
    }
}
 No newline at end of file
+20 −0
Changes for module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.RecapBu.dcm.xml: 20 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
  <entity name="Application\Entity\Db\RecapBu" table="RECAP_BU">
    <id name="id" type="integer" column="ID">
      <generator strategy="SEQUENCE"/>
    </id>

    <field name="orcid"       type="string" column="ORCID" length="19" nullable="true"/>
    <field name="nnt"         type="string" column="NNT" length="15" nullable="true"/>
    <field name="vigilance"   type="string" column="VIGILANCE" length="2048" nullable="true"/>

    <one-to-one field="these" target-entity="Application\Entity\Db\These">
      <join-columns>
        <join-column name="THESE_ID" referenced-column-name="ID"/>
      </join-columns>
    </one-to-one>


  </entity>
</doctrine-mapping>
+99 −0
Changes for module/Application/src/Application/Entity/Db/RecapBu.php: 99 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

namespace Application\Entity\Db;

class RecapBu {

    private $id;
    protected $these;
    protected $orcid;
    protected $nnt;
    protected $vigilance;

    public function getId() {
        return $this->id;
    }

    /**
     * @return mixed
     */
    public function getThese()
    {
        return $this->these;
    }

    /**
     * @param mixed $these
     */
    public function setThese($these)
    {
        $this->these = $these;
    }


    /**
     * @return mixed
     */
    public function getOrcid()
    {
        return $this->orcid;
    }

    /**
     * @param mixed $orcid
     */
    public function setOrcid($orcid)
    {
        $this->orcid = $orcid;
    }

    /**
     * @return mixed
     */
    public function getNNT()
    {
        return $this->nnt;
    }

    /**
     * @param mixed $nnt
     */
    public function setNNT($nnt)
    {
        $this->nnt = $nnt;
    }

    /**
     * @return mixed
     */
    public function getVigilance()
    {
        return $this->vigilance;
    }

    /**
     * @param mixed $vigilance
     */
    public function setVigilance($vigilance)
    {
        $this->vigilance = $vigilance;
    }

//    public function getArrayCopy() {
//        $data = array();
//        $data['id'] = $this->id;
//        $data['orcid'] = $this->orcid;
//        $data['nnt'] = $this->nnt;
//        $data['vigilance'] = $this->vigilance;
//        return $data;
//    }
//
//    public function exchangeArray($recap) {
//        $data = array();
//        $data['id'] = $recap->id;
//        $data['orcid'] = $recap->orcid;
//        $data['nnt'] = $recap->nnt;
//        $data['vigilance'] = $recap->vigilance;
//        return $data;
//    }
}
 No newline at end of file
+23 −0
Changes for module/Application/src/Application/Form/Factory/RecapBuFormFactory.php: 23 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

namespace Application\Form\Factory;

use Application\Form\Hydrator\RecapBuHydrator;
use Application\Form\RecapBuForm;
use Zend\Form\FormElementManager;

class RecapBuFormFactory
{
    public function __invoke(FormElementManager $formElementManager)
    {
        $sl = $formElementManager->getServiceLocator();

        $form = new RecapBuForm();

        $hydrator = $sl->get('HydratorManager')->get('RecapBuHydrator');
        $form->setHydrator($hydrator);
        $form->init();
        
        return $form;
    }
}
 No newline at end of file
Loading