Loading module/Oscar/src/Oscar/Controller/ProjectGrantController.php +3 −0 Original line number Diff line number Diff line Loading @@ -2927,6 +2927,8 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif $filtersOptions['activityTypes'] = $this->getActivityTypeService()->getActivityTypesTree(true); $filtersOptions['disciplines'] = $this->getProjectGrantSearchService()->getFilterOptionsDisciplines(); $filtersOptions['keywords'] = $this->getProjectGrantSearchService()->getFilterOptionsKeywords(); $filtersOptions['status'] = $this->getAdministrationConfigService()->activityStatusSelect(true, true, false); $filtersOptions['milestones'] = $milestonesType; $filtersOptions['milestonesProgressions'] = $milestonesProgressions; Loading @@ -2935,6 +2937,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif $filtersOptions['filters'] = $filters; $filtersOptions['sorts'] = $sorts; $filtersOptions['directions'] = $directions; $filtersOptions['numbers'] = $this->getProjectGrantSearchService()->getFilterOptionsActivityNumbers(); //'activityDocumentTypes' => $this->getProjectGrantSearchService()->getFilterOptionsMilestones(), //'countries' => $this->getProjectGrantSearchService()->getFilterOptionsCountries(), Loading module/Oscar/src/Oscar/Entity/Activity.php +9 −0 Original line number Diff line number Diff line Loading @@ -1781,6 +1781,15 @@ class Activity implements ResourceInterface return $motscles; } public function getMotsclesArrayIds() { $motscles = []; foreach ($this->getMotscles() as $m) { $motscles[] = $m->getId(); } return $motscles; } /** * @return self */ Loading module/Oscar/src/Oscar/Service/ProjectGrantSearchService.php +10 −0 Original line number Diff line number Diff line Loading @@ -1226,6 +1226,16 @@ class ProjectGrantSearchService implements UseEntityManager, UsePersonService, U return $disciplines; } public function getFilterOptionsKeywords(): array { /** @var ActivityMotCleRepository $repo */ $repo = $this->getEntityManager()->getRepository(ActivityMotCle::class); $keywords = $repo->getAllArray(); return $keywords; } /** * Liste des pays. * @return array Loading module/Oscar/src/Oscar/Service/ProjectGrantService.php +96 −4 Original line number Diff line number Diff line Loading @@ -2209,6 +2209,24 @@ class ProjectGrantService implements UseGearmanJobLauncherService, UseOscarConfi "field" => 'dateNegociation', "raw" => 'adn;;;' ], "anu" => [ "key" => 'anu', "label" => $this->getOscarConfigurationService()->oscarText("Numérotation"), "field" => null, "raw" => 'anu;;;' ], "dis" => [ "key" => 'dis', "label" => $this->getOscarConfigurationService()->oscarText("Disciplines"), "field" => null, "raw" => 'dis;;;' ], "key" => [ "key" => 'key', "label" => $this->getOscarConfigurationService()->oscarText("Motclefs"), "field" => null, "raw" => 'key;;;' ], "as" => [ "key" => 'as', "label" => $this->getOscarConfigurationService()->oscarText("Statut"), Loading Loading @@ -2379,6 +2397,68 @@ class ProjectGrantService implements UseGearmanJobLauncherService, UseOscarConfi break; ///////////////////////////////////////////// STATUS case 'dis': if( !$value1 ){ $error = "Aucune discipline"; } else { if( $value2 == '1' ){ if (!array_key_exists('dis', $filterNotES)) { $filterNotES['dis'] = []; } } else { if (!array_key_exists('dis', $filterES)) { $filterES['dis'] = []; } } if( $value2 == '1' ){ $filterNotES['dis'][] = [ 'term' => [ 'disciplines_ids' => $value1 ] ]; } else { $filterES['dis'][] = [ 'term' => [ 'disciplines_ids' => $value1 ] ]; } } break; case 'key': if( !$value1 ){ $error = "Aucun mot-clef"; } else { if( $value2 == '1' ){ if (!array_key_exists('keys', $filterNotES)) { $filterNotES['keys'] = []; } } else { if (!array_key_exists('keys', $filterES)) { $filterES['keys'] = []; } } if( $value2 == '1' ){ $filterNotES['keys'][] = [ 'term' => [ 'keywords_ids' => $value1 ] ]; } else { $filterES['keys'][] = [ 'term' => [ 'keywords_ids' => $value1 ] ]; } } break; case 'as': if( !$value1 ){ $error = "Aucun status selectionné"; Loading Loading @@ -2422,6 +2502,18 @@ class ProjectGrantService implements UseGearmanJobLauncherService, UseOscarConfi break; ///////////////////////////////////////////// PERSONNES case 'anu': if (!array_key_exists('anu', $filterES)) { $filterES['anu'] = []; } if( $value2 == '' ){ $currentFilter = ["exists" => ["field" => "numbers.$value1"]]; } else { $currentFilter = ["term" => ["numbers.$value1" => $value2]]; } $filterES['anu'][] = $currentFilter; break; case 'ap': if (!array_key_exists('ap', $filterES)) { $filterES['ap'] = []; Loading Loading @@ -2593,15 +2685,15 @@ class ProjectGrantService implements UseGearmanJobLauncherService, UseOscarConfi case 'orp': if ($modeProject) { $filterNotES[] = [ "exists" => [ ["exists" => [ "field" => "activities" ] ]] ]; } else { $filterNotES[] = [ "exists" => [ ["exists" => [ "field" => "project" ] ]] ]; } break; Loading module/Oscar/src/Oscar/Strategy/Search/ElasticActivitySearch.php +10 −5 Original line number Diff line number Diff line Loading @@ -53,7 +53,9 @@ class ElasticActivitySearch extends ElasticSearchEngine implements IActivitySear 'oscar' => ['type' => 'keyword'], 'amount' => ['type' => 'float'], 'keywords' => ['type' => 'keyword'], 'keywords_ids' => ['type' => 'keyword'], 'disciplines' => ['type' => 'keyword'], 'disciplines_ids' => ['type' => 'keyword'], 'financialImpact' => ['type' => 'keyword'], 'dateCreated' => ['type' => 'date', 'format' => 'yyyy-MM-dd HH:mm:ss'], 'dateUpdated' => ['type' => 'date', 'format' => 'yyyy-MM-dd HH:mm:ss'], Loading @@ -70,9 +72,8 @@ class ElasticActivitySearch extends ElasticSearchEngine implements IActivitySear 'jalons' => $mapper->getMappingMilestones(), 'persons' => $mapper->getMappingAffectationPerson(), 'organizations' => $mapper->getMappingAffectationOrganization(), // 'numerotation' => [ 'type' => 'text', 'analyzer, => 'french_analyzer 'analyzer' => 'french_analyzer'], // 'numbers' => [ 'type' => 'nested' ], 'numbers' => ['type' => 'flattened'], 'numbers_values' => ['type' => 'keyword'], ] ] ]; Loading Loading @@ -167,7 +168,9 @@ class ElasticActivitySearch extends ElasticSearchEngine implements IActivitySear 'amount' => $activity->getAmount(), 'financialImpact' => $activity->getFinancialImpact(), 'disciplines' => $activity->getDisciplinesArray(), 'disciplines_ids' => $activity->getDisciplinesIds(), 'keywords' => $activity->getMotsclesArray(), 'keywords_ids' => $activity->getMotsclesArrayIds(), 'dateCreated' => $mapper->formatDateTimeNullable($activity->getDateCreated(), true), 'dateUpdated' => $mapper->formatDateTimeNullable($activity->getDateUpdated(), true), 'dateStart' => $mapper->formatDateTimeNullable($activity->getDateStart()), Loading @@ -175,6 +178,8 @@ class ElasticActivitySearch extends ElasticSearchEngine implements IActivitySear 'dateSigned' => $mapper->formatDateTimeNullable($activity->getDateSigned()), 'dateNegociation' => $mapper->formatDateTimeNullable($activity->getDateNegociation()), 'dateOpened' => $mapper->formatDateTimeNullable($activity->getDateOpened()), 'numbers' => $activity->getNumbers(), 'numbers_values' => $activity->getNumbersValues(), 'jalons' => $jalons, 'project' => $project, 'persons' => $members, Loading Loading @@ -240,7 +245,7 @@ class ElasticActivitySearch extends ElasticSearchEngine implements IActivitySear $query["bool"]["should"][] = ["match" => ["project.description" => ["query" => $search, "fuzziness" => 1, "boost" => 3]]]; // Champ NUMBERS $query["bool"]["should"][] = ["match" => ["numbers" => ["query" => $search, "fuzziness" => 1, "boost" => 5]]]; $query["bool"]["should"][] = ["match" => ["numbers_values" => ["query" => $search, "boost" => 20]]]; // Champ MOTSCLES Loading @@ -254,7 +259,7 @@ class ElasticActivitySearch extends ElasticSearchEngine implements IActivitySear $query["bool"]["should"][] = ["match" => ["organization.shortname" => ["query" => $search, "fuzziness" => 1]]]; $query["bool"]["should"][] = ["match" => ["organization.longname" => ["query" => $search, "fuzziness" => 1]]]; // echo '<pre>'; echo json_encode($query['bool']['should'], JSON_PRETTY_PRINT); die(); return $query; } Loading Loading
module/Oscar/src/Oscar/Controller/ProjectGrantController.php +3 −0 Original line number Diff line number Diff line Loading @@ -2927,6 +2927,8 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif $filtersOptions['activityTypes'] = $this->getActivityTypeService()->getActivityTypesTree(true); $filtersOptions['disciplines'] = $this->getProjectGrantSearchService()->getFilterOptionsDisciplines(); $filtersOptions['keywords'] = $this->getProjectGrantSearchService()->getFilterOptionsKeywords(); $filtersOptions['status'] = $this->getAdministrationConfigService()->activityStatusSelect(true, true, false); $filtersOptions['milestones'] = $milestonesType; $filtersOptions['milestonesProgressions'] = $milestonesProgressions; Loading @@ -2935,6 +2937,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif $filtersOptions['filters'] = $filters; $filtersOptions['sorts'] = $sorts; $filtersOptions['directions'] = $directions; $filtersOptions['numbers'] = $this->getProjectGrantSearchService()->getFilterOptionsActivityNumbers(); //'activityDocumentTypes' => $this->getProjectGrantSearchService()->getFilterOptionsMilestones(), //'countries' => $this->getProjectGrantSearchService()->getFilterOptionsCountries(), Loading
module/Oscar/src/Oscar/Entity/Activity.php +9 −0 Original line number Diff line number Diff line Loading @@ -1781,6 +1781,15 @@ class Activity implements ResourceInterface return $motscles; } public function getMotsclesArrayIds() { $motscles = []; foreach ($this->getMotscles() as $m) { $motscles[] = $m->getId(); } return $motscles; } /** * @return self */ Loading
module/Oscar/src/Oscar/Service/ProjectGrantSearchService.php +10 −0 Original line number Diff line number Diff line Loading @@ -1226,6 +1226,16 @@ class ProjectGrantSearchService implements UseEntityManager, UsePersonService, U return $disciplines; } public function getFilterOptionsKeywords(): array { /** @var ActivityMotCleRepository $repo */ $repo = $this->getEntityManager()->getRepository(ActivityMotCle::class); $keywords = $repo->getAllArray(); return $keywords; } /** * Liste des pays. * @return array Loading
module/Oscar/src/Oscar/Service/ProjectGrantService.php +96 −4 Original line number Diff line number Diff line Loading @@ -2209,6 +2209,24 @@ class ProjectGrantService implements UseGearmanJobLauncherService, UseOscarConfi "field" => 'dateNegociation', "raw" => 'adn;;;' ], "anu" => [ "key" => 'anu', "label" => $this->getOscarConfigurationService()->oscarText("Numérotation"), "field" => null, "raw" => 'anu;;;' ], "dis" => [ "key" => 'dis', "label" => $this->getOscarConfigurationService()->oscarText("Disciplines"), "field" => null, "raw" => 'dis;;;' ], "key" => [ "key" => 'key', "label" => $this->getOscarConfigurationService()->oscarText("Motclefs"), "field" => null, "raw" => 'key;;;' ], "as" => [ "key" => 'as', "label" => $this->getOscarConfigurationService()->oscarText("Statut"), Loading Loading @@ -2379,6 +2397,68 @@ class ProjectGrantService implements UseGearmanJobLauncherService, UseOscarConfi break; ///////////////////////////////////////////// STATUS case 'dis': if( !$value1 ){ $error = "Aucune discipline"; } else { if( $value2 == '1' ){ if (!array_key_exists('dis', $filterNotES)) { $filterNotES['dis'] = []; } } else { if (!array_key_exists('dis', $filterES)) { $filterES['dis'] = []; } } if( $value2 == '1' ){ $filterNotES['dis'][] = [ 'term' => [ 'disciplines_ids' => $value1 ] ]; } else { $filterES['dis'][] = [ 'term' => [ 'disciplines_ids' => $value1 ] ]; } } break; case 'key': if( !$value1 ){ $error = "Aucun mot-clef"; } else { if( $value2 == '1' ){ if (!array_key_exists('keys', $filterNotES)) { $filterNotES['keys'] = []; } } else { if (!array_key_exists('keys', $filterES)) { $filterES['keys'] = []; } } if( $value2 == '1' ){ $filterNotES['keys'][] = [ 'term' => [ 'keywords_ids' => $value1 ] ]; } else { $filterES['keys'][] = [ 'term' => [ 'keywords_ids' => $value1 ] ]; } } break; case 'as': if( !$value1 ){ $error = "Aucun status selectionné"; Loading Loading @@ -2422,6 +2502,18 @@ class ProjectGrantService implements UseGearmanJobLauncherService, UseOscarConfi break; ///////////////////////////////////////////// PERSONNES case 'anu': if (!array_key_exists('anu', $filterES)) { $filterES['anu'] = []; } if( $value2 == '' ){ $currentFilter = ["exists" => ["field" => "numbers.$value1"]]; } else { $currentFilter = ["term" => ["numbers.$value1" => $value2]]; } $filterES['anu'][] = $currentFilter; break; case 'ap': if (!array_key_exists('ap', $filterES)) { $filterES['ap'] = []; Loading Loading @@ -2593,15 +2685,15 @@ class ProjectGrantService implements UseGearmanJobLauncherService, UseOscarConfi case 'orp': if ($modeProject) { $filterNotES[] = [ "exists" => [ ["exists" => [ "field" => "activities" ] ]] ]; } else { $filterNotES[] = [ "exists" => [ ["exists" => [ "field" => "project" ] ]] ]; } break; Loading
module/Oscar/src/Oscar/Strategy/Search/ElasticActivitySearch.php +10 −5 Original line number Diff line number Diff line Loading @@ -53,7 +53,9 @@ class ElasticActivitySearch extends ElasticSearchEngine implements IActivitySear 'oscar' => ['type' => 'keyword'], 'amount' => ['type' => 'float'], 'keywords' => ['type' => 'keyword'], 'keywords_ids' => ['type' => 'keyword'], 'disciplines' => ['type' => 'keyword'], 'disciplines_ids' => ['type' => 'keyword'], 'financialImpact' => ['type' => 'keyword'], 'dateCreated' => ['type' => 'date', 'format' => 'yyyy-MM-dd HH:mm:ss'], 'dateUpdated' => ['type' => 'date', 'format' => 'yyyy-MM-dd HH:mm:ss'], Loading @@ -70,9 +72,8 @@ class ElasticActivitySearch extends ElasticSearchEngine implements IActivitySear 'jalons' => $mapper->getMappingMilestones(), 'persons' => $mapper->getMappingAffectationPerson(), 'organizations' => $mapper->getMappingAffectationOrganization(), // 'numerotation' => [ 'type' => 'text', 'analyzer, => 'french_analyzer 'analyzer' => 'french_analyzer'], // 'numbers' => [ 'type' => 'nested' ], 'numbers' => ['type' => 'flattened'], 'numbers_values' => ['type' => 'keyword'], ] ] ]; Loading Loading @@ -167,7 +168,9 @@ class ElasticActivitySearch extends ElasticSearchEngine implements IActivitySear 'amount' => $activity->getAmount(), 'financialImpact' => $activity->getFinancialImpact(), 'disciplines' => $activity->getDisciplinesArray(), 'disciplines_ids' => $activity->getDisciplinesIds(), 'keywords' => $activity->getMotsclesArray(), 'keywords_ids' => $activity->getMotsclesArrayIds(), 'dateCreated' => $mapper->formatDateTimeNullable($activity->getDateCreated(), true), 'dateUpdated' => $mapper->formatDateTimeNullable($activity->getDateUpdated(), true), 'dateStart' => $mapper->formatDateTimeNullable($activity->getDateStart()), Loading @@ -175,6 +178,8 @@ class ElasticActivitySearch extends ElasticSearchEngine implements IActivitySear 'dateSigned' => $mapper->formatDateTimeNullable($activity->getDateSigned()), 'dateNegociation' => $mapper->formatDateTimeNullable($activity->getDateNegociation()), 'dateOpened' => $mapper->formatDateTimeNullable($activity->getDateOpened()), 'numbers' => $activity->getNumbers(), 'numbers_values' => $activity->getNumbersValues(), 'jalons' => $jalons, 'project' => $project, 'persons' => $members, Loading Loading @@ -240,7 +245,7 @@ class ElasticActivitySearch extends ElasticSearchEngine implements IActivitySear $query["bool"]["should"][] = ["match" => ["project.description" => ["query" => $search, "fuzziness" => 1, "boost" => 3]]]; // Champ NUMBERS $query["bool"]["should"][] = ["match" => ["numbers" => ["query" => $search, "fuzziness" => 1, "boost" => 5]]]; $query["bool"]["should"][] = ["match" => ["numbers_values" => ["query" => $search, "boost" => 20]]]; // Champ MOTSCLES Loading @@ -254,7 +259,7 @@ class ElasticActivitySearch extends ElasticSearchEngine implements IActivitySear $query["bool"]["should"][] = ["match" => ["organization.shortname" => ["query" => $search, "fuzziness" => 1]]]; $query["bool"]["should"][] = ["match" => ["organization.longname" => ["query" => $search, "fuzziness" => 1]]]; // echo '<pre>'; echo json_encode($query['bool']['should'], JSON_PRETTY_PRINT); die(); return $query; } Loading