add ListPerson

Add / complete list of person.

Some SQL function are added to allow to get the last address at a given date.
This commit is contained in:
2017-01-31 12:18:07 +01:00
parent 045119d61f
commit 25cad2f11d
21 changed files with 747 additions and 270 deletions

View File

@@ -130,36 +130,6 @@ class PersonController extends Controller
return $this->redirect($url);
}
}
/**
* Return a csv file with all the persons
*
* @return A csv file with all the persons
*/
public function exportAction()
{
$em = $this->getDoctrine()->getManager();
$chillSecurityHelper = $this->get('chill.main.security.authorization.helper');
$user = $this->get('security.context')->getToken()->getUser();
$reachableCenters = $chillSecurityHelper->getReachableCenters($user,
new Role('CHILL_PERSON_SEE'));
$personRepository = $em->getRepository('ChillPersonBundle:Person');
$qb = $personRepository->createQueryBuilder('p');
$qb->where($qb->expr()->in('p.center', ':centers'))
->setParameter('centers', $reachableCenters);
$persons = $qb->getQuery()->getResult();
$response = $this->render('ChillPersonBundle:Person:export.csv.twig',
array(
'persons' => $persons,
'cf_group' => $this->getCFGroup()));
$response->headers->set('Content-Type', 'text/csv; charset=utf-8');
$response->headers->set('Content-Disposition', 'attachment; filename="export_person.csv"');
return $response;
}
public function newAction()
{