really do not show thirdparty which are not active

This commit is contained in:
Julien Fastré 2022-03-30 15:26:45 +02:00
parent 9812710cd0
commit dae9d48574
2 changed files with 8 additions and 1 deletions

View File

@ -34,6 +34,12 @@ final class ThirdPartyACLAwareRepository implements ThirdPartyACLAwareRepository
{ {
$qb = $this->thirdPartyRepository->createQueryBuilder('tp'); $qb = $this->thirdPartyRepository->createQueryBuilder('tp');
$qb->leftJoin('tp.parent', 'parent')
->andWhere($qb->expr()->andX(
'tp.active = \'TRUE\'',
$qb->expr()->orX($qb->expr()->isNull('parent'), 'parent.active = \'TRUE\'')
));
if (null !== $filterString) { if (null !== $filterString) {
$qb->andWhere($qb->expr()->like('tp.canonicalized', 'LOWER(UNACCENT(:filterString))')) $qb->andWhere($qb->expr()->like('tp.canonicalized', 'LOWER(UNACCENT(:filterString))'))
->setParameter('filterString', '%' . $filterString . '%'); ->setParameter('filterString', '%' . $filterString . '%');

View File

@ -113,7 +113,8 @@ class ThirdPartyApiSearch implements SearchApiInterface
[], [],
...$pertinenceArgs ...$pertinenceArgs
)) ))
->andWhereClause(implode(' AND ', $wheres), array_merge( ->andWhereClause(implode(' AND ', $wheres)
.' AND tparty.active IS TRUE and (parent.active IS TRUE OR parent IS NULL)', array_merge(
[], [],
...$whereArgs ...$whereArgs
)); ));