close#326 - When clicking on add a report, we should directly go to the report form if we have only one possible report

This commit is contained in:
Marc Ducobu 2014-11-14 16:49:26 +01:00
parent 4a035d27d7
commit 22c295b51b

View File

@ -73,6 +73,14 @@ class ReportController extends Controller
$cFGroups = $em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')
->findByEntity('Chill\ReportBundle\Entity\Report');
if(count($cFGroups) === 1 ){
return $this->redirect(
$this->generateUrl('report_new',
array('person_id' => $person_id, 'cf_group_id' => $cFGroups[0]->getId())));
}
$cFGroupsChoice = array();
foreach ($cFGroups as $cFGroup) {