Commit e36d1a2a by Yvon

ccas : num anonymisation dans export adherent + filtre avec num anonymisation

parent 6f067521
......@@ -581,7 +581,18 @@ class AdherentAdmin extends AbstractAdmin
;
if ($this->getConfigurationPool()->getContainer()->getParameter('tav_env')) {
$datagridMapper->remove('cotisationajour');
$datagridMapper
->remove('cotisationajour');
if ($this->getConfigurationPool()->getContainer()->getParameter('ccas_mode')) {
$datagridMapper
->add('anonymoustoken', CallbackFilter::class, [
'callback' => [$this, 'getAnynomousTokenFilter'],
'field_type' => CheckboxType::class,
'label' => 'Avec numéro d\'anonymisation',
'show_filter' => true,
'advanced_filter' => false,
]);
}
}
}
......@@ -641,6 +652,26 @@ class AdherentAdmin extends AbstractAdmin
return true;
}
public function getAnynomousTokenFilter($queryBuilder, $alias, $field, $value)
{
if (!$value['value']) {
return false;
}
$container = $this->getConfigurationPool()->getContainer();
$em = $container->get('doctrine.orm.entity_manager');
$expr = $em->getExpressionBuilder();
// Use `andWhere` instead of `where` to prevent overriding existing `where` conditions
if ($value["value"]) {
$queryBuilder->andWhere(
'(' . $alias . '.anonymousToken is not null and ' . $alias . '.anonymousToken != false)'
);
}
return true;
}
/**
* @param EventDispatcherInterface $userManager
*/
......
......@@ -108,6 +108,9 @@ class CustomDoctrineORMQuerySourceIterator extends AbstractPropertySourceIterato
} else {
$data['Profil de cotisation'] = "Aucun profil assigné";
}
if ($this->container->getParameter('ccas_mode')) {
$data['Numéro d\'anonymisation'] = $adherent->getAnonymousToken();
}
} else {
$cotisEnd = $this->cotisationUtils->isCotisationValidForAdherent($adherent);
$cotisEnd = is_string($cotisEnd) ? new \DateTime( $cotisEnd ) : $cotisEnd;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment