Commit 9d5685f6 authored by Thomas Hamel's avatar Thomas Hamel
Browse files

WIP : amélioration form saisie thèse (gestion améliorée des modal sur la fiche d'une thèse...)

parent b87eea58
Loading
Loading
Loading
Loading
+27 −4
Changes for doc/release-notes/8.x.0/01_saisie_these.sql: 27 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -171,13 +171,22 @@ ALTER TABLE these
    ADD CONSTRAINT fk_pays_cotut_id
        FOREIGN KEY (pays_cotut_id) REFERENCES pays(id);

WITH updated_these AS (
UPDATE these t
SET pays_cotut_id = (
    SELECT p.id
SET pays_cotut_id = p.id
    FROM pays p
    WHERE unaccent(regexp_replace(p.libelle_iso, '[-]', ' ', 'g')) = unaccent(regexp_replace(t.lib_pays_cotut, '[-]', ' ', 'g'))
WHERE unaccent(lower(t.lib_pays_cotut)) = unaccent(lower(p.libelle))
   OR
    unaccent(lower(t.lib_pays_cotut)) = unaccent(lower(p.libelle_iso))
   OR (
    unaccent(lower(t.lib_pays_cotut)) = 'republique tcheque' AND unaccent(lower(p.libelle)) = 'tchequie'
    )
   OR (
    unaccent(lower(t.lib_pays_cotut)) = 'cote d ivoire' AND unaccent(lower(p.libelle)) = 'cote d''ivoire'
    )
WHERE t.lib_pays_cotut IS NOT NULL;
    RETURNING t.*
    )
SELECT * FROM updated_these;

--
-- Table TITREACCES
@@ -213,3 +222,17 @@ WHERE t.code_pays_titre_acces IS NOT NULL;
-- Attention certaines colonnes sont utilisées dans des vues (Utiliser le script 03_matviews.sql présent ici : doc/release-notes/8.4.0)
ALTER TABLE unite_rech DROP COLUMN etab_support;
ALTER TABLE unite_rech DROP COLUMN autres_etab;

--
-- Table INDIVIDU
--

UPDATE individu i
SET pays_id_nationalite = (SELECT p.id
                           FROM pays p
                           WHERE INITCAP(SUBSTRING(p.libelle_nationalite, 1, 1)) ||
                                 lower(SUBSTRING(unaccent(p.libelle_nationalite), 2)) =
                                 INITCAP(SUBSTRING(i.nationalite, 1, 1)) ||
                                 lower(SUBSTRING(unaccent(i.nationalite), 2)))
WHERE i.nationalite IS NOT NULL
  and i.pays_id_nationalite is null;
 No newline at end of file
+5 −2
Changes for module/Application/config/module.config.php: 5 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@ use Application\Entity\UserWrapperFactory;
use Application\Entity\UserWrapperFactoryFactory;
use Application\Event\UserAuthenticatedEventListenerFactory;
use Application\Event\UserRoleSelectedEventListener;
use Application\Form\Factory\RoleFormFactory;
use Application\Form\RoleForm;
use Application\Navigation\NavigationFactoryFactory;
use Application\ORM\Query\Functions\Npd;
use Application\ORM\Query\Functions\StrReduce;
@@ -215,7 +217,7 @@ return array(
    'service_manager' => array(
        'aliases' => array(
            'UserContextService' => 'UnicaenAuth\Service\UserContext',
            RoleService::class => 'RoleService',
            'RoleService' =>  RoleService::class,
            UserContextService::class => 'UserContextService',
        ),
        'invokables' => array(
@@ -227,7 +229,7 @@ return array(
            'UnicaenAuth\Service\UserContext' => UserContextServiceFactory::class,
            'UserAuthenticatedEventListener' => UserAuthenticatedEventListenerFactory::class,
            'Sygal\Memcached'                => MemcachedFactory::class,
            'RoleService' => RoleServiceFactory::class,
            RoleService::class => RoleServiceFactory::class,
            SourceCodeStringHelper::class => SourceCodeStringHelperFactory::class,
            UserWrapperFactory::class => UserWrapperFactoryFactory::class,
        ),
@@ -307,6 +309,7 @@ return array(
        ],
        'factories' => [
            'EcoleDoctoraleForm' => EcoleDoctoraleFormFactory::class,
            RoleForm::class => RoleFormFactory::class,
        ],
//        'initializers' => [
//            'UnicaenApp\Service\EntityManagerAwareInitializer',
+42
Changes for module/Application/config/others/admin.config.php: 42 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -21,6 +21,9 @@ return [
                        'index',
                        'incrementer-ordre',
                        'decrementer-ordre',
                        'ajouter',
                        'editer',
                        'supprimer',
                    ],
                    'roles' => [
                        'Administrateur technique'
@@ -79,6 +82,45 @@ return [
                    ],
                ],
            ],
            'role' => [
                'type'          => 'Segment',
                'options'       => [
                    'route'    => '/role',
                ],
                'may_terminate' => false,
                'child_routes' => [
                    'ajouterRole' => [
                        'type'          => Segment::class,
                        'options'       => [
                            'route'    => '/ajouter',
                            'defaults' => [
                                'controller'    => RoleController::class,
                                'action'        => 'ajouter',
                            ],
                        ],
                    ],
                    'editerRole' => [
                        'type'          => Segment::class,
                        'options'       => [
                            'route'    => '/editer/:role',
                            'defaults' => [
                                'controller'    => RoleController::class,
                                'action'        => 'editer',
                            ],
                        ],
                    ],
                    'supprimerRole' => [
                        'type'          => Segment::class,
                        'options'       => [
                            'route'    => '/supprimer/:role',
                            'defaults' => [
                                'controller'    => RoleController::class,
                                'action'        => 'supprimer',
                            ],
                        ],
                    ],
                ]
            ],
            'gestion-privilege' => [
                'type'          => Literal::class,
                'options'       => [
+9 −1
Changes for module/Application/src/Application/Controller/Factory/RoleControllerFactory.php: 9 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -3,9 +3,11 @@
namespace Application\Controller\Factory;

use Application\Controller\RoleController;
use Structure\Service\Etablissement\EtablissementService;
use Application\Form\RoleForm;
use Application\Service\Role\RoleService;
use Application\Service\Source\SourceService;
use Interop\Container\ContainerInterface;
use Structure\Service\Etablissement\EtablissementService;

class RoleControllerFactory
{
@@ -22,9 +24,15 @@ class RoleControllerFactory
        $roleService = $container->get('RoleService');
        $etablissementService = $container->get(EtablissementService::class);

        $theseSaisieForm = $container->get('FormElementManager')->get(RoleForm::class);
        $sourceService = $container->get(SourceService::class);

        $controller = new RoleController();
        $controller->setRoleService($roleService);
        $controller->setEtablissementService($etablissementService);
        $controller->setRoleForm($theseSaisieForm);
        $controller->setSource($sourceService->fetchApplicationSource());


        return $controller;
    }
+42
Changes for module/Application/src/Application/Controller/RoleController.php: 42 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2,13 +2,19 @@

namespace Application\Controller;

use Application\Entity\Db\Role;
use Application\Form\RoleFormAwareTrait;
use Structure\Service\Etablissement\EtablissementServiceAwareTrait;
use Application\Service\Role\RoleServiceAwareTrait;
use Laminas\View\Model\ViewModel;
use UnicaenDbImport\Entity\Db\Traits\SourceAwareTrait;

class RoleController  extends AbstractController {
    use RoleServiceAwareTrait;
    use EtablissementServiceAwareTrait;
    use RoleFormAwareTrait;
    use SourceAwareTrait;
    use \UnicaenAuth\Service\Traits\RoleServiceAwareTrait;

    public function indexAction()
    {
@@ -25,6 +31,42 @@ class RoleController extends AbstractController {
        ]);
    }

    public function ajouterAction()
    {
        $request = $this->getRequest();
        $form = $this->getRoleForm();



        $viewModel = new ViewModel([
            'form' => $form,
        ]);

        $form->bind(new Role());

        if (!$request->isPost()) {
            return $viewModel;
        }

        $data = $request->getPost();
        $form->setData($data);
        if (!$form->isValid()) {
            return $viewModel;
        }

        /** @var Role $role */
        $role = $form->getData();
        $role->setSource($this->source);
        $role->setSourceCode(uniqid());

//        $this->theseService->saveThese($these);

        $this->flashMessenger()->addSuccessMessage("Rôle créé avec succès.");

//        return $this->redirect()->toRoute('these/identite', ['these' => $these->getId()], [], true);
        return null;
    }

//    public function incrementerOrdreAction() {
//        $idRole = $this->params()->fromRoute('role');
//        $role = $this->getRoleService()->getRepository()->find($idRole);
Loading