diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php
index 3e32edfce..d46136173 100644
--- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php
+++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php
@@ -34,6 +34,7 @@ use Psr\Log\LoggerInterface;
use RuntimeException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
+use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
@@ -200,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);
@@ -393,12 +418,36 @@ final class ActivityController extends AbstractController
'role' => new Role('CHILL_ACTIVITY_CREATE'),
'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 created!'));
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js
index b7a5c791b..0c209e69a 100644
--- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js
+++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js
@@ -2,11 +2,15 @@ import { createApp } from 'vue';
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n'
import { activityMessages } from './i18n'
import store from './store'
+import PickTemplate from 'ChillDocGeneratorAssets/vuejs/_components/PickTemplatePreventMoving.vue';
+import {fetchTemplates} from 'ChillDocGeneratorAssets/api/pickTemplate.js';
import App from './App.vue';
const i18n = _createI18n(activityMessages);
+// app for activity
+
const hasSocialIssues = document.querySelector('#social-issues-acc') !== null;
const hasLocation = document.querySelector('#location') !== null;
const hasPerson = document.querySelector('#add-persons') !== null;
@@ -29,3 +33,54 @@ const app = createApp({
.use(i18n)
.component('app', App)
.mount('#activity');
+
+
+// app for picking template
+
+const i18nGendoc = _createI18n({});
+
+document.querySelectorAll('div[data-docgen-template-picker]').forEach(el => {
+ fetchTemplates(el.dataset.entityClass).then(templates => {
+ const picker = {
+ template:
+ '',
+ components: {
+ PickTemplate,
+ },
+ data() {
+ return {
+ templates: templates,
+ entityId: el.dataset.entityId,
+ }
+ },
+ methods: {
+ generateDoc({event, link, template}) {
+ console.log('generateDoc');
+ console.log('link', link);
+ console.log('template', template);
+
+ let hiddenInput = document.querySelector("input[data-template-id]");
+
+ if (hiddenInput === null) {
+ console.error('hidden input not found');
+ return;
+ }
+
+ hiddenInput.value = template;
+
+ let form = document.querySelector('form[name="chill_activitybundle_activity"');
+
+ if (form === null) {
+ console.error('form not found');
+ return;
+ }
+
+ form.submit();
+ }
+ }
+ };
+ createApp(picker).use(i18nGendoc).mount(el);
+ })
+
+});
diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig
index a59c596c3..3da97efd6 100644
--- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig
+++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig
@@ -89,9 +89,9 @@
{%- if edit_form.documents is defined -%}
{{ form_row(edit_form.documents) }}
+
{% endif %}
-
{% set person_id = null %}
{% if entity.person %}
diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/editAccompanyingCourse.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/editAccompanyingCourse.html.twig
index 09ff16fec..b278c0300 100644
--- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/editAccompanyingCourse.html.twig
+++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/editAccompanyingCourse.html.twig
@@ -24,12 +24,10 @@
window.activity = {{ activity_json|json_encode|raw }};
{{ encore_entry_script_tags('vue_activity') }}
- {{ encore_entry_script_tags('mod_docgen_picktemplate') }}
{% endblock %}
{% block css %}
{{ parent() }}
{{ encore_entry_link_tags('mod_async_upload') }}
{{ encore_entry_link_tags('vue_activity') }}
- {{ encore_entry_link_tags('mod_docgen_picktemplate') }}
{% endblock %}
diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/editPerson.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/editPerson.html.twig
index 72c74c68e..82c7403c6 100644
--- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/editPerson.html.twig
+++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/editPerson.html.twig
@@ -39,11 +39,9 @@
window.activity = {{ activity_json|json_encode|raw }};
{{ encore_entry_script_tags('vue_activity') }}
- {{ encore_entry_script_tags('mod_docgen_picktemplate') }}
{% endblock %}
{% block css %}
{{ encore_entry_link_tags('mod_async_upload') }}
{{ encore_entry_link_tags('vue_activity') }}
- {{ encore_entry_link_tags('mod_docgen_picktemplate') }}
{% endblock %}
diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig
index a0668119c..755e2e151 100644
--- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig
+++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig
@@ -87,6 +87,7 @@
{%- if form.documents is defined -%}
{{ form_row(form.documents) }}
+
{% endif %}
{%- if form.attendee is defined -%}
diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig
index 505d8c6cb..47a61bd86 100644
--- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig
+++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig
@@ -17,10 +17,6 @@
{{ parent() }}
{{ encore_entry_script_tags('mod_async_upload') }}
diff --git a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php
index 9a8e6b3b8..7ee09690a 100644
--- a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php
+++ b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php
@@ -17,7 +17,6 @@ use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithPublicFormInterface;
use Chill\DocGeneratorBundle\Context\Exception\UnexpectedTypeException;
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
use Chill\DocGeneratorBundle\Service\Context\BaseContextData;
-use Chill\DocStoreBundle\Entity\Document;
use Chill\DocStoreBundle\Entity\StoredObject;
use Chill\DocStoreBundle\Repository\DocumentCategoryRepository;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
@@ -210,11 +209,8 @@ class ActivityContext implements
*/
public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void
{
- $doc = new StoredObject();
- // TODO push document to remote
+ $entity->addDocument($storedObject);
- $this->em->persist($doc);
-
- $entity->addDocument($doc);
+ $this->em->persist($storedObject);
}
}
diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityReasonAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityReasonAggregatorTest.php
index fb98f0a8e..436bfc697 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityReasonAggregatorTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityReasonAggregatorTest.php
@@ -9,7 +9,7 @@
declare(strict_types=1);
-namespace Chill\ActivityBundle\Tests\Aggregator;
+namespace Chill\ActivityBundle\Tests\Export\Aggregator;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityTypeAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityTypeAggregatorTest.php
index 7959825a7..f6efe17a5 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityTypeAggregatorTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityTypeAggregatorTest.php
@@ -9,7 +9,7 @@
declare(strict_types=1);
-namespace Chill\ActivityBundle\Tests\Aggregator;
+namespace Chill\ActivityBundle\Tests\Export\Aggregator;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityUserAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityUserAggregatorTest.php
index 056ba6049..1447f473b 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityUserAggregatorTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityUserAggregatorTest.php
@@ -9,7 +9,7 @@
declare(strict_types=1);
-namespace Chill\ActivityBundle\Tests\Aggregator;
+namespace Chill\ActivityBundle\Tests\Export\Aggregator;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityReasonFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityReasonFilterTest.php
index cbac6febd..5b8ae08c3 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityReasonFilterTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityReasonFilterTest.php
@@ -9,7 +9,7 @@
declare(strict_types=1);
-namespace Chill\ActivityBundle\Tests\Filter;
+namespace Chill\ActivityBundle\Tests\Export\Filter;
use Chill\MainBundle\Test\Export\AbstractFilterTest;
use Doctrine\Common\Collections\ArrayCollection;
diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php
index f444c368b..94d99c2a7 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php
@@ -9,7 +9,7 @@
declare(strict_types=1);
-namespace Chill\ActivityBundle\Tests\Filter;
+namespace Chill\ActivityBundle\Tests\Export\Filter;
use Chill\MainBundle\Test\Export\AbstractFilterTest;
use DateTime;
diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php
index db27ec921..d3355b9ce 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php
@@ -9,7 +9,7 @@
declare(strict_types=1);
-namespace Chill\CustomFieldsBundle\Tests;
+namespace Chill\CustomFieldsBundle\Tests\CustomFields;
use Chill\CustomFieldsBundle\CustomFields\CustomFieldChoice;
use Chill\CustomFieldsBundle\Entity\CustomField;
diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsNumberTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsNumberTest.php
index 60381f567..fb0079f05 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsNumberTest.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsNumberTest.php
@@ -9,7 +9,7 @@
declare(strict_types=1);
-namespace Chill\CustomFieldsBundle\Tests;
+namespace Chill\CustomFieldsBundle\Tests\CustomFields;
use Chill\CustomFieldsBundle\CustomFields\CustomFieldNumber;
use Chill\CustomFieldsBundle\Entity\CustomField;
diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsTextTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsTextTest.php
index 50bf689d4..c1dca44c0 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsTextTest.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsTextTest.php
@@ -9,10 +9,11 @@
declare(strict_types=1);
-namespace Chill\CustomFieldsBundle\Tests;
+namespace Chill\CustomFieldsBundle\Tests\CustomFields;
use Chill\CustomFieldsBundle\CustomFields\CustomFieldText;
use Chill\CustomFieldsBundle\Entity\CustomField;
+use Chill\CustomFieldsBundle\Tests\CustomFieldTestHelper;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
/**
diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/Routing/RoutingLoaderTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/Routing/RoutingLoaderTest.php
index 3cde3890a..32c6639bc 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Tests/Routing/RoutingLoaderTest.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Tests/Routing/RoutingLoaderTest.php
@@ -9,7 +9,7 @@
declare(strict_types=1);
-namespace Chill\CustomFieldsBundle\Tests;
+namespace Chill\CustomFieldsBundle\Tests\Routing;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpFoundation\Response;
diff --git a/src/Bundle/ChillDocGeneratorBundle/Resources/public/lib/document-generator.js b/src/Bundle/ChillDocGeneratorBundle/Resources/public/lib/document-generator.js
new file mode 100644
index 000000000..beea190a3
--- /dev/null
+++ b/src/Bundle/ChillDocGeneratorBundle/Resources/public/lib/document-generator.js
@@ -0,0 +1,13 @@
+
+const buildLink = function(templateId, entityId, entityClass) {
+ const
+ entityIdEncoded = encodeURI(entityId),
+ returnPath = encodeURIComponent(window.location.pathname + window.location.search + window.location.hash),
+ entityClassEncoded = encodeURI(entityClass),
+ url = `/fr/doc/gen/generate/from/${templateId}/for/${entityClassEncoded}/${entityIdEncoded}?returnPath=${returnPath}`
+ ;
+ console.log('computed Url');
+ return url;
+};
+
+export {buildLink};
diff --git a/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue b/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue
index 04d563782..cd5121fc9 100644
--- a/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue
+++ b/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue
@@ -20,8 +20,8 @@
-
-
+
+
@@ -39,24 +39,27 @@
-
\ No newline at end of file
+
diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/PickWorkflow.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/PickWorkflow.vue
index 3a39c0eff..e74cd7ef2 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/PickWorkflow.vue
+++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/PickWorkflow.vue
@@ -6,7 +6,7 @@
@@ -31,7 +31,12 @@ export default {
workflowsAvailables: {
type: Array,
required: true,
- }
+ },
+ preventDefaultMoveToGenerate: {
+ type: Boolean,
+ required: false,
+ default: false,
+ },
},
emits: ['goToGenerateWorkflow'],
methods: {
@@ -39,6 +44,12 @@ export default {
return buildLinkCreate(workflowName, this.relatedEntityClass, this.relatedEntityId);
},
goToGenerateWorkflow(event, workflowName) {
+ console.log('goToGenerateWorkflow', event, workflowName);
+
+ if (!this.$props.preventDefaultMoveToGenerate) {
+ event.target.click();
+ }
+
this.$emit('goToGenerateWorkflow', {event, workflowName, link: this.makeLink(workflowName)});
}
}
diff --git a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig
index 4b14b39bc..64482c067 100644
--- a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig
+++ b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig
@@ -3,7 +3,58 @@
{% if transition_form is not null %}
{{ form_start(transition_form) }}
- {{ form_row(transition_form.transition) }}
+ {% set step = entity_workflow.currentStepChained %}
+ {% set labels = workflow_metadata(entity_workflow, 'label', step.currentStep) %}
+ {% set label = labels is null ? step.currentStep : labels|localize_translatable_string %}
+
+
+
+
+
+ {{ 'workflow.Current step'|trans }} :
+ {{ label }}
+
+
+
+ {% if step.previous is not null %}
+ {% if step.previous.comment is not empty %}
+
+
+
+ {{ step.previous.comment|chill_markdown_to_html }}
+
+
+
+ {% endif %}
+
+
+ {{ 'By'|trans }}
+ {{ step.previous.transitionBy|chill_entity_render_box }},
+ {{ step.previous.transitionAt|format_datetime('short', 'short') }}
+
+
+ {% else %}
+
+
{{ 'workflow.Created by'|trans }}
+
{{ step.entityWorkflow.createdBy|chill_entity_render_box }}
+
+
+
{{ 'Le'|trans }}
+
{{ step.entityWorkflow.createdAt|format_datetime('short', 'short') }}
+
+ {% endif %}
+
+
+
+
+ {% if transition_form.transitionFilter is defined %}
+ {{ form_row(transition_form.transitionFilter) }}
+ {% endif %}
+
+
+
+ {{ form_row(transition_form.transition) }}
+
{% if transition_form.freezeAfter is defined %}
{{ form_row(transition_form.freezeAfter) }}
diff --git a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_history.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_history.html.twig
index cee9d219c..e40e82dab 100644
--- a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_history.html.twig
+++ b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_history.html.twig
@@ -69,6 +69,18 @@
{% endif %}
+ {% if loop.last and step.destUser|length > 0 %}
+
+
+
{{ 'workflow.Users allowed to apply transition'|trans }} :
+
+ {% for u in step.destUser %}
+ - {{ u|chill_entity_render_box }}
+ {% endfor %}
+
+
+
+ {% endif %}
{% endfor %}
diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php
index 08deac745..4c09aaa55 100644
--- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php
+++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php
@@ -44,7 +44,6 @@ class NotificationNormalizer implements NormalizerAwareInterface, NormalizerInte
*/
public function normalize($object, ?string $format = null, array $context = [])
{
- dump($object);
$entity = $this->entityManager
->getRepository($object->getRelatedEntityClass())
->find($object->getRelatedEntityId());
diff --git a/src/Bundle/ChillMainBundle/Tests/Authorization/ParentRoleHelperTest.php b/src/Bundle/ChillMainBundle/Tests/Authorization/ParentRoleHelperTest.php
index 69a3ac733..05b18407a 100644
--- a/src/Bundle/ChillMainBundle/Tests/Authorization/ParentRoleHelperTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Authorization/ParentRoleHelperTest.php
@@ -9,7 +9,7 @@
declare(strict_types=1);
-namespace Chill\MainBundle\Tests\Security\Authorization;
+namespace Chill\MainBundle\Tests\Authorization;
use Chill\MainBundle\Security\ParentRoleHelper;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
diff --git a/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php b/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php
index 55f9b64c5..e7a6ee096 100644
--- a/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php
@@ -9,10 +9,11 @@
declare(strict_types=1);
-namespace Chill\MainBundle\Form\Type;
+namespace Chill\MainBundle\Tests\Form\Type;
use Chill\MainBundle\Entity\GroupCenter;
use Chill\MainBundle\Entity\User;
+use Chill\MainBundle\Form\CenterType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Test\TypeTestCase;
diff --git a/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php b/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php
index 07d7c7ab7..e9cbd5e3c 100644
--- a/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php
@@ -9,7 +9,7 @@
declare(strict_types=1);
-namespace Chill\MainBundle\Test\Search;
+namespace Chill\MainBundle\Tests\Search;
use Chill\MainBundle\Search\ParsingException;
use Chill\MainBundle\Search\SearchInterface;
diff --git a/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php b/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php
index 7208c3ee9..8e29a190b 100644
--- a/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php
@@ -9,7 +9,7 @@
declare(strict_types=1);
-namespace Chill\MainBundle\Tests\PasswordRecover;
+namespace Chill\MainBundle\Tests\Security\PasswordRecover;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Security\PasswordRecover\TokenManager;
diff --git a/src/Bundle/ChillMainBundle/Workflow/Validator/StepDestValid.php b/src/Bundle/ChillMainBundle/Workflow/Validator/StepDestValid.php
new file mode 100644
index 000000000..7c2d954b2
--- /dev/null
+++ b/src/Bundle/ChillMainBundle/Workflow/Validator/StepDestValid.php
@@ -0,0 +1,26 @@
+isFinal() && 0 < count($value->getDestUser())) {
+ $this->context->buildViolation($constraint->messageDestNotAllowed)
+ ->addViolation();
+ }
+
+ if (!$value->isFinal() && 0 === count($value->getDestUser())) {
+ $this->context->buildViolation($constraint->messageRequireDest)
+ ->addViolation();
+ }
+ }
+}
diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml
index 605cafe8e..d3173bd7c 100644
--- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml
+++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml
@@ -370,7 +370,8 @@ Workflow history: Historique de la décision
workflow:
Created by: Créé par
- Transition to apply: Ma décision
+ My decision: Ma décision
+ Next step: Prochaine étape
dest for next steps: Utilisateurs qui valideront la prochaine étape
Freeze: Geler
Freezed: Gelé
@@ -392,6 +393,9 @@ workflow:
dest: Workflows en attente d'action
you subscribed to all steps: Vous recevrez une notification à chaque étape
you subscribed to final step: Vous recevrez une notification à l'étape finale
+ Current step: Étape actuelle
+ Comment on last change: Commentaire à la transition précédente
+ Users allowed to apply transition: Utilisateurs pouvant valider cette étape
Subscribe final: Recevoir une notification à l'étape finale
Subscribe all steps: Recevoir une notification à chaque étape
diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php
index 1bb4bc1fe..757e8df79 100644
--- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php
@@ -99,7 +99,7 @@ class AccompanyingPeriodWorkEvaluationApiController
if ($request->query->getBoolean('countOnly', false)) {
return new JsonResponse(
- $this->serializer->serialize(new Counter($total), 'json', ['groups' => 'read']),
+ $this->serializer->serialize(new Counter($total), 'json', ['groups' => ['read']]),
JsonResponse::HTTP_OK,
[],
true
@@ -117,7 +117,7 @@ class AccompanyingPeriodWorkEvaluationApiController
$collection = new Collection($works, $paginator);
return new JsonResponse(
- $this->serializer->serialize($collection, 'json', ['groups' => 'read']),
+ $this->serializer->serialize($collection, 'json', ['groups' => ['read', 'read:evaluation:include-work']]),
JsonResponse::HTTP_OK,
[],
true
diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php
index 97424c2e3..b7e8d1c5d 100644
--- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php
+++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php
@@ -44,7 +44,8 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
{
/**
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
- * @Serializer\Groups({"read"})
+ * @Serializer\Groups({"read", "read:accompanyingPeriodWork:light"})
+ * @Serializer\Context(normalizationContext={"groups": {"read"}}, groups={"read:accompanyingPeriodWork:light"})
*/
private ?AccompanyingPeriod $accompanyingPeriod = null;
@@ -63,26 +64,26 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
/**
* @ORM\Column(type="datetime_immutable")
- * @Serializer\Groups({"read", "docgen:read"})
+ * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
*/
private ?DateTimeImmutable $createdAt = null;
/**
* @ORM\Column(type="boolean")
- * @Serializer\Groups({"read", "docgen:read"})
+ * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
*/
private bool $createdAutomatically = false;
/**
* @ORM\Column(type="text")
- * @Serializer\Groups({"read", "docgen:read"})
+ * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
*/
private string $createdAutomaticallyReason = '';
/**
* @ORM\ManyToOne(targetEntity=User::class)
* @ORM\JoinColumn(nullable=false)
- * @Serializer\Groups({"read", "docgen:read"})
+ * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
*/
private ?User $createdBy = null;
@@ -90,7 +91,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
* @Serializer\Groups({"accompanying_period_work:create"})
* @Serializer\Groups({"accompanying_period_work:edit"})
- * @Serializer\Groups({"read", "docgen:read"})
+ * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
* @Assert\GreaterThan(propertyPath="startDate",
* message="accompanying_course_work.The endDate should be greater than the start date"
* )
@@ -122,7 +123,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
- * @Serializer\Groups({"read", "docgen:read"})
+ * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light", "read:evaluation:include-work"})
*/
private ?int $id = null;
@@ -135,7 +136,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
/**
* @ORM\ManyToMany(targetEntity=Person::class)
* @ORM\JoinTable(name="chill_person_accompanying_period_work_person")
- * @Serializer\Groups({"read", "docgen:read"})
+ * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
* @Serializer\Groups({"accompanying_period_work:edit"})
* @Serializer\Groups({"accompanying_period_work:create"})
*/
@@ -151,8 +152,9 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
/**
* @ORM\ManyToOne(targetEntity=SocialAction::class)
- * @Serializer\Groups({"read", "docgen:read"})
+ * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
* @Serializer\Groups({"accompanying_period_work:create"})
+ * @Serializer\Context(normalizationContext={"groups": {"read"}}, groups={"read:accompanyingPeriodWork:light"})
*/
private ?SocialAction $socialAction = null;
@@ -160,7 +162,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
* @ORM\Column(type="date_immutable")
* @Serializer\Groups({"accompanying_period_work:create"})
* @Serializer\Groups({"accompanying_period_work:edit"})
- * @Serializer\Groups({"read", "docgen:read"})
+ * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"})
*/
private ?DateTimeImmutable $startDate = null;
diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php
index f9fbc95f9..68f508b95 100644
--- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php
+++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php
@@ -39,6 +39,8 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU
* targetEntity=AccompanyingPeriodWork::class,
* inversedBy="accompanyingPeriodWorkEvaluations"
* )
+ * @Serializer\Groups({"read:evaluation:include-work"})
+ * @Serializer\Context(normalizationContext={"groups": {"read:accompanyingPeriodWork:light"}}, groups={"read:evaluation:include-work"})
*/
private ?AccompanyingPeriodWork $accompanyingPeriodWork = null;
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue
index c88de825b..f9d1a747c 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue
@@ -251,6 +251,7 @@
relatedEntityClass="Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork"
:relatedEntityId="this.work.id"
:workflowsAvailables="this.work.workflows_availables"
+ @go-to-generate-workflow="goToGenerateWorkflow"
>
@@ -284,6 +285,7 @@ import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue';
import ListWorkflowModal from 'ChillMainAssets/vuejs/_components/EntityWorkflow/ListWorkflowModal.vue';
import PickWorkflow from 'ChillMainAssets/vuejs/_components/EntityWorkflow/PickWorkflow.vue';
import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue';
+import {buildLinkCreate} from 'ChillMainAssets/lib/entity-workflow/api.js';
const i18n = {
messages: {
@@ -334,7 +336,6 @@ export default {
ListWorkflowModal,
OnTheFly,
PickWorkflow,
- OnTheFly,
PersonText,
},
i18n,
@@ -461,6 +462,15 @@ export default {
removeThirdParty(t) {
this.$store.commit('removeThirdParty', t);
},
+ goToGenerateWorkflow({link}) {
+ console.log('save before leave to generate workflow')
+ const callback = (data) => {
+ window.location.assign(link);
+ };
+
+ return this.$store.dispatch('submit', callback)
+ .catch(e => { console.log(e); throw e; });
+ },
submit() {
this.$store.dispatch('submit');
},
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue
index 08cb6b3e6..faf4b0ed0 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue
@@ -10,16 +10,16 @@
-
-
+
-
+
-
@@ -106,8 +106,7 @@ export default {
this.toggleEditEvaluation();
},
goToGenerateWorkflow({event, link, workflowName}) {
- event.preventDefault();
- console.log(event, link, workflowName);
+ console.log('goToGenerate in evaluation', event, link, workflowName);
const callback = (data) => {
let evaluationId = data.accompanyingPeriodWorkEvaluations.find(e => e.key === this.evaluation.key).id;
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue
index fd856141e..cabebf973 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue
@@ -92,7 +92,8 @@
entityClass="Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation"
:id="evaluation.id"
:templates="getTemplatesAvailables"
- :beforeMove="submitBeforeGenerate"
+ :preventDefaultMoveToGenerate="true"
+ @go-to-generate-document="submitBeforeGenerate"
>
@@ -109,6 +110,7 @@ import CKEditor from '@ckeditor/ckeditor5-vue';
import ClassicEditor from 'ChillMainAssets/module/ckeditor5/index.js';
import { mapGetters, mapState } from 'vuex';
import PickTemplate from 'ChillDocGeneratorAssets/vuejs/_components/PickTemplate.vue';
+import {buildLink} from 'ChillDocGeneratorAssets/lib/document-generator';
const i18n = {
messages: {
@@ -123,7 +125,7 @@ const i18n = {
evaluation_public_comment: "Note publique",
evaluation_comment_placeholder: "Commencez à écrire ...",
evaluation_generate_a_document: "Générer un document",
- evaluation_choose_a_template: "Choisir un gabarit",
+ evaluation_choose_a_template: "Choisir un modèle",
evaluation_add_a_document: "Ajouter un document",
evaluation_add: "Ajouter une évaluation",
Documents: "Documents",
@@ -207,10 +209,11 @@ export default {
return `/wopi/edit/${storedObject.uuid}?returnPath=` + encodeURIComponent(
window.location.pathname + window.location.search + window.location.hash);
},
- submitBeforeGenerate() {
+ submitBeforeGenerate({template}) {
const callback = (data) => {
let evaluationId = data.accompanyingPeriodWorkEvaluations.find(e => e.key === this.evaluation.key).id;
- return Promise.resolve({entityId: evaluationId});
+
+ window.location.assign(buildLink(template, evaluationId, 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluation'));
};
return this.$store.dispatch('submit', callback).catch(e => { console.log(e); throw e; });
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js
index a46a0e221..0cc85fb76 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js
@@ -210,6 +210,7 @@ const store = createStore({
editEvaluation: true,
workflows_availables: state.work.workflows_availables_evaluation,
documents: [],
+ workflows: [],
};
state.evaluationsPicked.push(e);
},
diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php
index 1e4649dd7..a5156a78a 100644
--- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php
+++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php
@@ -44,6 +44,7 @@ class AccompanyingPeriodWorkEvaluationNormalizer implements ContextAwareNormaliz
*/
public function normalize($object, ?string $format = null, array $context = []): array
{
+ dump($context);
$initial = $this->normalizer->normalize($object, $format, array_merge(
$context,
[self::IGNORE_EVALUATION => spl_object_hash($object)]
diff --git a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php
index b20df016a..2dc51335c 100644
--- a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php
+++ b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php
@@ -109,7 +109,6 @@ final class AccompanyingPeriodConfidentialTest extends WebTestCase
$user = new stdClass();
$user->id = 0;
$user->type = 'user';
- dump($user);
$this->client->request(
Request::METHOD_PATCH,
diff --git a/src/Bundle/ChillReportBundle/Tests/DependencyInjection/ChillReportExtensionTest.php b/src/Bundle/ChillReportBundle/Tests/DependencyInjection/ChillReportExtensionTest.php
index 3a883b780..689e24699 100644
--- a/src/Bundle/ChillReportBundle/Tests/DependencyInjection/ChillReportExtensionTest.php
+++ b/src/Bundle/ChillReportBundle/Tests/DependencyInjection/ChillReportExtensionTest.php
@@ -9,8 +9,9 @@
declare(strict_types=1);
-namespace Chill\ReportBundle\Tests\Controller;
+namespace Chill\ReportBundle\Tests\DependencyInjection;
+use Exception;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
/**
diff --git a/src/Bundle/ChillThirdPartyBundle/Tests/Serializer/Normalizer/ThirdPartyDocGenNormalizerTest.php b/src/Bundle/ChillThirdPartyBundle/Tests/Serializer/Normalizer/ThirdPartyDocGenNormalizerTest.php
index 48a3ab8dd..1aaad8531 100644
--- a/src/Bundle/ChillThirdPartyBundle/Tests/Serializer/Normalizer/ThirdPartyDocGenNormalizerTest.php
+++ b/src/Bundle/ChillThirdPartyBundle/Tests/Serializer/Normalizer/ThirdPartyDocGenNormalizerTest.php
@@ -9,7 +9,7 @@
declare(strict_types=1);
-namespace Chill\ThirdPartyBundle\Test\Serializer\Normalizer;
+namespace Chill\ThirdPartyBundle\Tests\Serializer\Normalizer;
use Chill\MainBundle\Entity\Civility;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
diff --git a/src/Bundle/ChillThirdPartyBundle/Tests/Serializer/Normalizer/ThirdPartyJsonDenormalizerTest.php b/src/Bundle/ChillThirdPartyBundle/Tests/Serializer/Normalizer/ThirdPartyJsonDenormalizerTest.php
index 1134652f7..39c0f58e4 100644
--- a/src/Bundle/ChillThirdPartyBundle/Tests/Serializer/Normalizer/ThirdPartyJsonDenormalizerTest.php
+++ b/src/Bundle/ChillThirdPartyBundle/Tests/Serializer/Normalizer/ThirdPartyJsonDenormalizerTest.php
@@ -9,7 +9,7 @@
declare(strict_types=1);
-namespace Chill\ThirdPartyBundle\Test\Serializer\Normalizer;
+namespace Chill\ThirdPartyBundle\Tests\Serializer\Normalizer;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;