Commit 54e7974b authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

Merge branch 'creed' of https://git.unicaen.fr/open-source/oscar into creed

parents 4bbb7030 73898f6b
Loading
Loading
Loading
Loading
+8 −0
Changes for module/Oscar/src/Oscar/Controller/OrganizationController.php: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ namespace Oscar\Controller;

use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException;
use Doctrine\ORM\Query;
use Elasticsearch\Common\Exceptions\BadRequest400Exception;
use Oscar\Connector\IConnector;
use Oscar\Connector\IConnectorOrganization;
use Oscar\Entity\Activity;
@@ -84,6 +85,8 @@ class OrganizationController extends AbstractOscarController
        $search = $this->params()->fromQuery('q', '');
        $type = $this->params()->fromQuery('t', []);
        $active = $this->params()->fromQuery('active', '');
        $error = null;
        $organizations = null;

        $filter = [
            'roles' => $this->params()->fromQuery('roles', []),
@@ -91,7 +94,11 @@ class OrganizationController extends AbstractOscarController
            'active' => $active,
        ];

        try {
            $organizations = $this->getOrganizationService()->getOrganizationsSearchPaged($search, $page, $filter);
        } catch (BadRequest400Exception $e) {
            $error = _("Expression de recherche incorrecte");
        }

        if ($this->getRequest()->isXmlHttpRequest()) {
            $result = [ 'datas' => []];
@@ -106,6 +113,7 @@ class OrganizationController extends AbstractOscarController

        return array(
            'entities' => $organizations,
            'error' => $error,
            'search' => $search,
            'types' => $this->getOrganizationService()->getOrganizationTypesSelect(),
            'type' => $type,
+11 −3
Changes for module/Oscar/src/Oscar/Controller/PersonController.php: 11 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -376,6 +376,8 @@ class PersonController extends AbstractOscarController
        $orderBy = $this->params()->fromQuery('orderby', 'lastname');
        $leader = $this->params()->fromQuery('leader', '');
        $format = $this->params()->fromQuery('format', '');
        $datas = [];
        $error = null;

        // Liste des critères de trie disponibles
        $orders = [
@@ -391,12 +393,16 @@ class PersonController extends AbstractOscarController
        }



        try {
            $datas = $this->getPersonService()->getPersonsSearchPaged($search, $page, [
                'filter_roles' => $filterRoles,
                'order_by' => $orderBy,
                'leader' => $leader
            ]);
        } catch (BadRequest400Exception $e){
            $error = "Expression de recherche incorrecte.";
            throw $e;
        }

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        /// Export CSV
@@ -444,7 +450,8 @@ class PersonController extends AbstractOscarController

        if ($this->getRequest()->isXmlHttpRequest()) {
            $json = [
                'datas' => []
                'datas' => [],
                'error' => $error
            ];
            foreach ($datas as $data) {
                $personData = $data->toArray();
@@ -466,6 +473,7 @@ class PersonController extends AbstractOscarController
            'roles' => $roles,
            'search' => $search,
            'persons' => $datas,
            'error' => $error,
            'filter_roles' =>  $filterRoles,
            'orderBy' => $orderBy,
            'orders' => $orders,
@@ -482,7 +490,7 @@ class PersonController extends AbstractOscarController
    {
        $search = $this->params()->fromQuery('q', '');
        if (strlen($search) < 2) {
            return $this->getResponseBadRequest("Not enough chars (4 required");
            return $this->getResponseBadRequest("Not enough chars (2 required");
        }
        $datas = $this->getPersonService()->search($search);

+12 −0
Changes for module/Oscar/view/oscar/organization/index.phtml: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -52,6 +52,16 @@ $markText = function( $text, $search ){

    <h3 class="text-center"><?= count($entities) ?> Résultat(s)</h3>


    <?php if($error): ?>
    <div class="alert alert-danger">
        <?= $error ?>
    </div>
    <?php endif; ?>


    <?php if($entities): ?>

    <?php /** @var \Oscar\Entity\Organization $entity */
    foreach( $entities as $entity ):
        $nbrProjects = count($entity->getProjects());
@@ -161,7 +171,9 @@ $markText = function( $text, $search ){
    }
    ?>
    <?= $this->pager($entities, $this->url().'?q='.urlencode($search).'&'.(implode('&', $types)).'&page=%s') ?>
    <?php endif; ?>
</section>

<?php if($this->grant()->privilege(\Oscar\Provider\Privileges::ORGANIZATION_DELETE)): ?>
<div style="position: fixed; bottom: 3em; right: 1em">
    <button id="fuzzion">FUSIONNER les organisations selectionnées</button>
+6 −0
Changes for module/Oscar/view/oscar/person/index.phtml: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -8,6 +8,12 @@
    </h1>
</header>

<?php if($error): ?>
<div class="alert-error alert">
    <?= $error ?>
</div>
<?php endif; ?>

<div class="container">
    <form action="<?= $this->url() ?>" method="get" class="form">
        <div class="input-group input-group-lg" style="">