mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-25 09:03:48 +00:00
add document from activity
This commit is contained in:
@@ -201,12 +201,36 @@ final class ActivityController extends AbstractController
|
||||
'role' => new Role('CHILL_ACTIVITY_UPDATE'),
|
||||
'activityType' => $entity->getActivityType(),
|
||||
'accompanyingPeriod' => $accompanyingPeriod,
|
||||
])->handleRequest($request);
|
||||
]);
|
||||
|
||||
if ($form->has('documents')) {
|
||||
$form->add('gendocTemplateId', HiddenType::class, [
|
||||
'mapped' => false,
|
||||
'data' => null,
|
||||
'attr' => [
|
||||
// required for js
|
||||
'data-template-id' => 'data-template-id',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->entityManager->persist($entity);
|
||||
$this->entityManager->flush();
|
||||
|
||||
if ($form->has('gendocTemplateId') && '' !== $form['gendocTemplateId']) {
|
||||
return $this->redirectToRoute(
|
||||
'chill_docgenerator_generate_from_template',
|
||||
[
|
||||
'template' => $form->get('gendocTemplateId')->getData(),
|
||||
'entityClassName' => Activity::class,
|
||||
'entityId' => $entity->getId(),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$this->addFlash('success', $this->get('translator')->trans('Success : activity updated!'));
|
||||
|
||||
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
||||
@@ -410,12 +434,20 @@ final class ActivityController extends AbstractController
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
if ($form->has('gendocTemplateId')) {
|
||||
dd($form->get('gendocTemplateId')->getData());
|
||||
}
|
||||
$this->entityManager->persist($entity);
|
||||
$this->entityManager->flush();
|
||||
|
||||
if ($form->has('gendocTemplateId') && '' !== $form['gendocTemplateId']) {
|
||||
return $this->redirectToRoute(
|
||||
'chill_docgenerator_generate_from_template',
|
||||
[
|
||||
'template' => $form->get('gendocTemplateId')->getData(),
|
||||
'entityClassName' => Activity::class,
|
||||
'entityId' => $entity->getId(),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$this->addFlash('success', $this->get('translator')->trans('Success : activity created!'));
|
||||
|
||||
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
||||
|
Reference in New Issue
Block a user