New permission for duplicate & export duplicate persons

Signed-off-by: Mathieu Jaumotte <mathieu.jaumotte@champs-libres.coop>
This commit is contained in:
2021-03-21 14:14:38 +01:00
parent 0149457fba
commit c34b992437
5 changed files with 229 additions and 9 deletions

View File

@@ -38,19 +38,16 @@ class SimilarPersonMatcher
CONST SIMILAR_SEARCH_ORDER_BY_SIMILARITY = 'similarity';
/**
*
* @var EntityManagerInterface
*/
protected $em;
/**
*
* @var AuthorizationHelper
*/
protected $authorizationHelper;
/**
*
* @var TokenStorageInterface
*/
protected $tokenStorage;
@@ -65,7 +62,6 @@ class SimilarPersonMatcher
$this->tokenStorage = $tokenStorage;
}
public function matchPerson(Person $person, $precision = 0.15, $orderBy = self::SIMILAR_SEARCH_ORDER_BY_SIMILARITY)
{
$centers = $this->authorizationHelper->getReachableCenters(
@@ -97,7 +93,6 @@ class SimilarPersonMatcher
$dql .= ' ORDER BY SIMILARITY(p.fullnameCanonical, UNACCENT(LOWER(:fullName))) DESC ';
}
$query = $this->em
->createQuery($dql)
->setParameter('fullName', $person->getFirstName() . ' ' . $person->getLastName())