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

Fix : Les organisations supprimées manuellement sont bien supprimées de l'indexation ES

parent 8cc463ba
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);
    }

+9 −0
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);
    }

    /**