Loading module/Oscar/src/Oscar/Controller/OrganizationController.php +1 −1 Original line number Diff line number Diff line Loading @@ -110,7 +110,7 @@ class OrganizationController extends AbstractOscarController implements UseOrgan public function index2Action() { $types = $this->getOrganizationService()->getOrganizationTypesSelect(); $types = $this->getOrganizationService()->getOrganizationTypesSelectHierarchie2(); $sorting = [ Loading module/Oscar/src/Oscar/Service/OrganizationService.php +54 −8 Original line number Diff line number Diff line Loading @@ -723,6 +723,36 @@ class OrganizationService implements UseOscarConfigurationService, UseEntityMana return $options; } private function addSubOrganizationTypesSelectHierarchie2(&$options, $types, $type, $prefix) { foreach ($types as $subtype) { if ($subtype->getRoot() != null && $subtype->getRoot()->getId() != $subtype->getId() && $subtype->getRoot()->getId() == $type->getId()) { $item = []; $item['id'] = $subtype->getId(); $item['label'] = $prefix . ' - ' . (string)$subtype; $options[] = $item; $this->addSubOrganizationTypesSelectHierarchie2($options, $types, $subtype, $prefix . ' '); } } } public function getOrganizationTypesSelectHierarchie2() { $options = []; $types = $this->getEntityManager()->getRepository(OrganizationType::class)->findBy([], ['label' => 'ASC']); foreach ($types as $type) { if ($type->getRoot()) { continue; } $item = []; $item['id'] = $type->getId(); $item['label'] = (string)$type; $options[] = $item; $this->addSubOrganizationTypesSelectHierarchie2($options, $types, $type, ' '); } return $options; } public function searchUpdate(Organization $organization): void { $this->updateIndex($organization); Loading Loading @@ -775,6 +805,18 @@ class OrganizationService implements UseOscarConfigurationService, UseEntityMana return new UnicaenDoctrinePaginator($qb, $page); } private function addWithSubTypes2(&$typesToSearchFor, $type) { foreach ($typesToSearchFor as $t) { if ($t == $type->getLabel()) { return; } } $typesToSearchFor[] = $type->getLabel(); foreach ($type->getChildren() as $c) { $this->addWithSubTypes2($typesToSearchFor, $c); } } public function searchOrganizations(string $search, int $page, array $filters = []): array { $body = [ Loading Loading @@ -815,15 +857,19 @@ class OrganizationService implements UseOscarConfigurationService, UseEntityMana // Filtre sur les types d'organisation if (array_key_exists('type', $filters)) { $types = $this->getOrganizationTypesSelect(); $out = []; foreach ($types as $key=>$type) { if( in_array($key, $filters['type']) ){ $out[] = $type; $allTypes = $this->getEntityManager()->getRepository(OrganizationType::class)->findAll(); $typesToSearchFor = []; foreach ($allTypes as $a) { foreach ($filters['type'] as $key) { if ($a->getId() == $key) { $this->addWithSubTypes2($typesToSearchFor, $a); continue; } } if(count($out)){ $filtersQuery[] = ['terms' => ['typeorg' => $out]]; } if(count($typesToSearchFor)){ $filtersQuery[] = ['terms' => ['typeorg' => $typesToSearchFor]]; } } Loading Loading @@ -1081,7 +1127,7 @@ class OrganizationService implements UseOscarConfigurationService, UseEntityMana } if (count($cleanTypes) > 0) { $allTypes = $types = $this->getEntityManager()->getRepository(OrganizationType::class)->findAll(); $allTypes = $this->getEntityManager()->getRepository(OrganizationType::class)->findAll(); $typesToSearchFor = []; foreach ($allTypes as $a) { foreach ($cleanTypes as $c) { Loading ui/src/views/OrganizationList.vue +6 −3 Original line number Diff line number Diff line Loading @@ -141,10 +141,10 @@ export default { computed: { selectTypes() { let types = []; Object.keys(this.types).forEach(key => { this.types.forEach(key => { if (key) { types.push( {'code': key, 'label': this.types[key]} {'code': key.id, 'label': key.label} ); } }) Loading Loading @@ -209,8 +209,11 @@ export default { this.rbp = params.has('rbp') ? params.get("rbp") : 10; this.filterDirection = params.has('direction') ? params.get("direction") : 'DESC'; this.filterUsage = params.has('usage') ? params.get("usage") : 'all'; this.filterType = []; if (params.has('t') && params.get('t')) { this.filterType = params.get("t").split(','); params.get("t").split(',').forEach(a => { this.filterType.push(parseInt(a)); }); } this.search(this.page); } Loading ui/src/OrganizationList.js +1 −1 File changed.Contains only whitespace changes. Show changes Loading
module/Oscar/src/Oscar/Controller/OrganizationController.php +1 −1 Original line number Diff line number Diff line Loading @@ -110,7 +110,7 @@ class OrganizationController extends AbstractOscarController implements UseOrgan public function index2Action() { $types = $this->getOrganizationService()->getOrganizationTypesSelect(); $types = $this->getOrganizationService()->getOrganizationTypesSelectHierarchie2(); $sorting = [ Loading
module/Oscar/src/Oscar/Service/OrganizationService.php +54 −8 Original line number Diff line number Diff line Loading @@ -723,6 +723,36 @@ class OrganizationService implements UseOscarConfigurationService, UseEntityMana return $options; } private function addSubOrganizationTypesSelectHierarchie2(&$options, $types, $type, $prefix) { foreach ($types as $subtype) { if ($subtype->getRoot() != null && $subtype->getRoot()->getId() != $subtype->getId() && $subtype->getRoot()->getId() == $type->getId()) { $item = []; $item['id'] = $subtype->getId(); $item['label'] = $prefix . ' - ' . (string)$subtype; $options[] = $item; $this->addSubOrganizationTypesSelectHierarchie2($options, $types, $subtype, $prefix . ' '); } } } public function getOrganizationTypesSelectHierarchie2() { $options = []; $types = $this->getEntityManager()->getRepository(OrganizationType::class)->findBy([], ['label' => 'ASC']); foreach ($types as $type) { if ($type->getRoot()) { continue; } $item = []; $item['id'] = $type->getId(); $item['label'] = (string)$type; $options[] = $item; $this->addSubOrganizationTypesSelectHierarchie2($options, $types, $type, ' '); } return $options; } public function searchUpdate(Organization $organization): void { $this->updateIndex($organization); Loading Loading @@ -775,6 +805,18 @@ class OrganizationService implements UseOscarConfigurationService, UseEntityMana return new UnicaenDoctrinePaginator($qb, $page); } private function addWithSubTypes2(&$typesToSearchFor, $type) { foreach ($typesToSearchFor as $t) { if ($t == $type->getLabel()) { return; } } $typesToSearchFor[] = $type->getLabel(); foreach ($type->getChildren() as $c) { $this->addWithSubTypes2($typesToSearchFor, $c); } } public function searchOrganizations(string $search, int $page, array $filters = []): array { $body = [ Loading Loading @@ -815,15 +857,19 @@ class OrganizationService implements UseOscarConfigurationService, UseEntityMana // Filtre sur les types d'organisation if (array_key_exists('type', $filters)) { $types = $this->getOrganizationTypesSelect(); $out = []; foreach ($types as $key=>$type) { if( in_array($key, $filters['type']) ){ $out[] = $type; $allTypes = $this->getEntityManager()->getRepository(OrganizationType::class)->findAll(); $typesToSearchFor = []; foreach ($allTypes as $a) { foreach ($filters['type'] as $key) { if ($a->getId() == $key) { $this->addWithSubTypes2($typesToSearchFor, $a); continue; } } if(count($out)){ $filtersQuery[] = ['terms' => ['typeorg' => $out]]; } if(count($typesToSearchFor)){ $filtersQuery[] = ['terms' => ['typeorg' => $typesToSearchFor]]; } } Loading Loading @@ -1081,7 +1127,7 @@ class OrganizationService implements UseOscarConfigurationService, UseEntityMana } if (count($cleanTypes) > 0) { $allTypes = $types = $this->getEntityManager()->getRepository(OrganizationType::class)->findAll(); $allTypes = $this->getEntityManager()->getRepository(OrganizationType::class)->findAll(); $typesToSearchFor = []; foreach ($allTypes as $a) { foreach ($cleanTypes as $c) { Loading
ui/src/views/OrganizationList.vue +6 −3 Original line number Diff line number Diff line Loading @@ -141,10 +141,10 @@ export default { computed: { selectTypes() { let types = []; Object.keys(this.types).forEach(key => { this.types.forEach(key => { if (key) { types.push( {'code': key, 'label': this.types[key]} {'code': key.id, 'label': key.label} ); } }) Loading Loading @@ -209,8 +209,11 @@ export default { this.rbp = params.has('rbp') ? params.get("rbp") : 10; this.filterDirection = params.has('direction') ? params.get("direction") : 'DESC'; this.filterUsage = params.has('usage') ? params.get("usage") : 'all'; this.filterType = []; if (params.has('t') && params.get('t')) { this.filterType = params.get("t").split(','); params.get("t").split(',').forEach(a => { this.filterType.push(parseInt(a)); }); } this.search(this.page); } Loading