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

Merge branch 'connor-dev-scss' of git.unicaen.fr:open-source/oscar into connor-api

parents 78c11e0b 0ada1ea9
Loading
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -125,10 +125,20 @@ class GearmanJobLauncherService implements UseOscarConfigurationService, UseLogg
     * @param Organization $organization
     */
    public function triggerUpdateSearchIndexOrganization(Organization $organization): void
    {
        $this->triggerUpdateSearchIndexOrganizationById($organization->getId());
    }

    /**
     * Mise à jour de l'index de recherche de l'organisation
     *
     * @param Organization $organization
     */
    public function triggerUpdateSearchIndexOrganizationById(int $organizationId): void
    {
        $task = self::UPDATE_INDEX_ORGANIZATION;
        $params = ['organizationid' => $organization->getId()];
        $key = sprintf('%s-%s', $task, $organization->getId());
        $params = ['organizationid' => $organizationId];
        $key = sprintf('%s-%s', $task, $organizationId);
        $this->sendBackgroundTask($task, $params, $key);
    }

+12 −3
Original line number Diff line number Diff line
@@ -298,9 +298,18 @@ class OrganizationService implements UseOscarConfigurationService, UseEntityMana
     */
    public function deleteOrganization($id)
    {
        try {
            $o = $this->getOrganization($id);
            $org = $o->log();
            $this->getEntityManager()->remove($o);
            $this->getEntityManager()->flush();
            $this->getPersonService()->getActivityLogService()->addUserInfo("a supprimé l'organisation $org");
        } catch (\Exception $e){
            $msg = sprintf("Impossible de supprimer l'organisation '%s' : %s", $id, $e->getMessage());
            $this->getLoggerService()->error($msg);
            throw $e;
        }
        $this->getSearchEngineStrategy()->searchDelete($id);
    }

    /**
+22 −8
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ class OrganizationElasticSearch extends ElasticSearchEngine implements IOrganiza
            }
        }

        return [
        $datas = [
            'id'          => $object->getId(),
            'code'        => $object->getCode() ? $object->getCode() : "",
            'shortname'   => $object->getShortName(),
@@ -128,15 +128,19 @@ class OrganizationElasticSearch extends ElasticSearchEngine implements IOrganiza
            'persons_total'  => count($personsTotal),
//            'activities'  => array_values($activities),
            'activities_total'  => count($activities),
            //'projects'  => array_values($projects),
//            //'projects'  => array_values($projects),
            'projects_total'  => count($projects),
            'connectors'  => $connectors,
            'suborganizations'  => $subOrganizations,
            'activities'  => $activities,
            'connectors'  => $connectors,
//            'activities'  => $activities,
//            'connectors'  => $connectors,
            'codepic'     => $object->getCodepic(),
            'codenaf'     => $object->getCodenaf(),
        ];
//        echo "<pre>";
//        die(json_encode($datas, JSON_PRETTY_PRINT));

        return $datas;
    }

    public function getFieldsSearchedWeighted(string $search): array
@@ -233,11 +237,21 @@ class OrganizationElasticSearch extends ElasticSearchEngine implements IOrganiza
                    'close' => ['type' => 'boolean'],
                    'dateClose' => ['type' => 'date', 'format' => 'Y-m-d'],
                    'zipcode' => ['type' => 'text', 'analyzer' => 'folding_analyzer'],
                    'persons' => ['type' => 'object'],
                    'persons' => [
                        'type' => 'nested',
                        'properties' => [
                            'id' => ['type' => 'integer'],
                            'firstname' => ['type' => 'text', 'analyzer' => 'folding_analyzer'],
                            'lastname' => ['type' => 'text', 'analyzer' => 'folding_analyzer'],
                            'role' => ['type' => 'keyword'],
                            'primary' => ['type' => 'boolean'],
                            'dateend' => ['type' => 'date', 'format' => 'yyyy-MM-dd HH:mm:ss'],
                        ]
                    ],
                    'persons_total' => ['type' => 'long'],
                    'activities' => ['type' => 'object'],
                    //'activities' => ['type' => 'object'],
                    'activities_total' => ['type' => 'long'],
                    'projects' => ['type' => 'object'],
                    //'projects' => ['type' => 'object'],
                    'projects_total' => ['type' => 'long'],
                    'suborganizations' => ['type' => 'object'],
                ]
+49 −40
Original line number Diff line number Diff line
@@ -3,30 +3,35 @@
    <div class="breadcrumbs">
        <a href="javascript:history.back()" class="link">Retour</a>
    </div>
    <header class="header jumbotron organization type-<?= $organization->getTypeSlug() ?>">
    <header class="header">
        <?php if(count($ancestors)): ?>
        <h3>
            <small style="display: block">Structure référente</small>
            <span class="chain-values">
                <i class="icon-fork"></i>
                <?php foreach ($ancestors as $a): ?>
                <span class="ancestor">
                    <i class="icon-angle-right"></i>
                    <span class="element">
                        <a href="<?= $this->url('organization/show', ['id' => $a->getId()]) ?>">
                            <?= $a ?>
                        </a>
                    </span>
                <?php endforeach; ?>
            </span>
        </h3>
        <?php endif; ?>
        <h1>
            <?php if( $organization->getCode() ): ?>
                <abbr><?= $organization->getCode() ?></abbr>
                <code><?= $organization->getCode() ?></code>
            <?php endif; ?>
            <i class="icon-building-filled"></i>
            <strong>
                <?= $organization->getShortName() ? $organization->getShortName().', ' : '' ?>
            </strong>
            <em>
                <?= $organization->getFullname() ?>
            </em>

            <?php if( $organization->getTypeObj() ):?>
            <sup><small> (<?= $organization->getTypeObj() ?>)</small></sup>
            <span class="on-right cartouche cartouche-secondary"><?= $organization->getTypeObj() ?></span>
            <?php endif;?>
        </h1>
        <div class="details row">
@@ -106,14 +111,14 @@
                </dd>
            </dl>
            <div class="col-md-4">
                <h5>Description</h5>
                <?= $organization->getDescription() ? $organization->getDescription() : '<i class="missing-data">Aucun</i>' ?>
                <dl>
                    <dt>Description</dt>
                    <dd><?= $organization->getDescription() ? $organization->getDescription() : '<i class="missing-data">Aucune</i>' ?></dd>
                </dl>

                <h5>Synchronisation</h5>
                <dl>
                    <dt>CONNECTOR</dt>
                    <dt>Synchronisation</dt>
                    <dd>

                        <ul>
                            <?php foreach($connectors as $connector): ?>

@@ -133,11 +138,14 @@

                            <?php endforeach; ?>
                        </ul>

                    </dd>
                </dl>
            </div>


        </div>
        <nav>
        <div class="bg-white text-center">
            <nav class="btn-group inline-block">
                <a href="<?= $this->url('organization/edit', array('id' => $organization->getId())) ?>" class="btn btn-light btn-sm">
                    Éditer les informations
                </a>
@@ -146,8 +154,9 @@
                    Réindexer
                </a>

            <a href="<?= $this->url('timesheet/organization') ?>?id=<?= $organization->getId() ?>" class="btn btn-primary">Déclarations en attente</a>
                <a href="<?= $this->url('timesheet/organization') ?>?id=<?= $organization->getId() ?>" class="btn btn-primary btn-sm">Déclarations en attente</a>
            </nav>
        </div>

    </header>
    <section class="content">
@@ -197,7 +206,7 @@




<!--
        <h2>Projet <span class="label <?= count($projects)>0?'label-info':'label-default' ?>"><?= count($projects) ?></span></h2>
        <?php foreach($projects as $project): ?>
            <?= $this->partial('/oscar/project/project-item-openable.phtml', array(
@@ -266,4 +275,4 @@
        })
    </script>
</div>
-->
+3 −1
Original line number Diff line number Diff line
@@ -61,7 +61,9 @@ $person = $enroll->getPerson();
            <?php endif; ?>
        <?php endif; ?>

        <a href="<?= $this->url('person/show', ['id' => $person->getId()]) ?>" class="btn btn-xs btn-primary"><i class="icon-zoom-in-outline"></i> Fiche</a>
        <a href="<?= $this->url('person/show', ['id' => $person->getId()]) ?>" class="btn btn-sm btn-primary">
            <i class="icon-zoom-in-outline"></i> Fiche
        </a>

    </div>

Loading