Commit 8bcdc3a8 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

MAJ Moteur de recherche (Avenant)

 - On peut filtrer les Projets/Activités selon la présence d'un avenant (Filtre par défaut)
 - On peut filtrer sur le type de modification apportées via l'avenant (OU)
 - On peut filtrer sur la date de l'avenant (tranche)
 - On peut filtrer sur l'état de l'avenant (Brouillon/Effectif)

Amélioration de la mise en page des filtres
Mise à jour du Mapping (Rebuild requis)
parent 5c79a74c
Loading
Loading
Loading
Loading
Loading
+1 −0
Changes for module/Oscar/src/Oscar/Controller/ProjectGrantController.php: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -2929,6 +2929,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif
        $filtersOptions['keywords'] = $this->getProjectGrantSearchService()->getFilterOptionsKeywords();
        $filtersOptions['status'] = $this->getAdministrationConfigService()->activityStatusSelect(true, true, false);
        $filtersOptions['documentsTypes'] = $this->getProjectGrantSearchService()->getFilterOptionsDocumentTypes();
        $filtersOptions['avenantTypes'] = $this->getProjectGrantSearchService()->getFilterOptionsAvenantTypes();
        $filtersOptions['milestones'] = $milestonesType;
        $filtersOptions['milestonesProgressions'] = $milestonesProgressions;
        $filtersOptions['rolesPersons'] = $rolesPersons;
+4 −1
Changes for module/Oscar/src/Oscar/Entity/Activity.php: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -783,7 +783,10 @@ class Activity implements ResourceInterface
        return $this->dateCached;
    }

    public function getAvenants(): Collection
    /**
     * @return ActivityAvenant[]
     */
    public function getAvenants()
    {
        return $this->avenants;
    }
+19 −1
Changes for module/Oscar/src/Oscar/Entity/ActivityAvenant.php: 19 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ class ActivityAvenant
     * @var ?string
     * @ORM\Column(type="string", options={"default" : NULL}, nullable=true)
     */
    protected ?string $filename;
    protected $filename;

    /**
     * Commentaire de l'utilisateur
@@ -209,4 +209,22 @@ class ActivityAvenant
    {
        return $this->getFilename() !== null && $this->getStatus() === self::STATUS_DRAFT;
    }

    public function toElastic() :array
    {
        $modifications = [];
        $types = [];
        /** @var ActivityAvenantModification $modification */
        foreach ($this->getModifications() as $modification) {
            $modifications[] = $modification->toElastic();
            $types[] = $modification->getType();
        }
        return [
            'id' => $this->getId(),
            'date' => $this->getDateAvenant()?$this->getDateAvenant()->format('Y-m-d'):null,
            'status' => $this->getStatus(),
            'types' => $types,
            'modifications' => $modifications,
        ];
    }
}
+9 −0
Changes for module/Oscar/src/Oscar/Entity/ActivityAvenantModification.php: 9 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -182,4 +182,13 @@ class ActivityAvenantModification
            'info' => $this->getInfo(),
        ];
    }

    public function toElastic()
    {
        return [
            'id' => $this->getId(),
            'type' => $this->getType(),
            'info' => $this->getInfo(),
        ];
    }
}
+1 −4
Changes for module/Oscar/src/Oscar/Service/ActivityAvenantsService.php: 1 added line, 4 removed lines.
Original line number Diff line number Diff line
@@ -136,10 +136,6 @@ class ActivityAvenantsService implements
            $avenant->setFilename($fileUploaded);
        }

        //if (($mode == "create" && !$fileUploaded)) {
        //    throw new OscarException("Fichier manquant");
        //}

        // Modification
        foreach ($idsModification as $modificationId) {
            $modification = $this->getEntityManager()->getRepository(ActivityAvenantModification::class)->find($modificationId);
@@ -150,6 +146,7 @@ class ActivityAvenantsService implements
            $avenant->setDateAvenant($avenant_date);
            $avenant->setComment($datas['comment']);
            $this->getEntityManager()->flush();
            $this->getProjectGrantService()->getGearmanJobLauncherService()->triggerUpdateSearchIndexActivity($avenant->getActivity());
        } catch (\Exception $e) {
            $this->getLoggerService()->critical($e->getMessage());
            if ($fileUploaded) {
Loading