diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1a3031354..8e36787e3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,9 @@ and this project adheres to
## Unreleased
+* [person] Accompanying course evaluation documents: disable the WOPI edit link if mimetype not supported and if no keyInfos
+(https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/585)
+
* [activity] display error messages above the form in creating a new location (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/481)
* [activity] show required field in activity edit/new by an asterix in the vuejs fields (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/494)
* [ACL] fix allow to see the course, event if the scope'course does not contains the scope's user
@@ -67,7 +70,7 @@ and this project adheres to
* [social_action] Translation changed in evaluation section (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/512)
* [filiation] Possible to add person (or create onthefly) to add to filiation graph + add relation (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/519)
* [household] Within parcours listing page of household add create button (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/560)
-* [person_resource] bugfix when adding thirdparty or freetext resource (no issue)
+* [person_resource] bugfix when adding thirdparty or freetext resource + prevent personOwner themselves to be added. (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/526)
* [aside_activity] style correction + sticky-form create button (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/529)
## Test releases
diff --git a/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php b/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php
index eca770fe0..3bf1850a4 100644
--- a/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php
+++ b/src/Bundle/ChillCalendarBundle/Menu/AccompanyingCourseMenuBuilder.php
@@ -41,12 +41,14 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
$period = $parameters['accompanyingCourse'];
if (AccompanyingPeriod::STEP_DRAFT !== $period->getStep()) {
+ /*
$menu->addChild($this->translator->trans('Calendar'), [
'route' => 'chill_calendar_calendar_list',
'routeParameters' => [
'accompanying_period_id' => $period->getId(),
], ])
->setExtras(['order' => 35]);
+ */
}
}
diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php
index 8913951e6..e5324a6cf 100644
--- a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php
+++ b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php
@@ -283,7 +283,7 @@ final class DocGeneratorTemplateController extends AbstractController
}
$datas = $context->getData($template, $entity, $contextGenerationData);
- if ($isTest && $form['show_data']->getData()) {
+ if ($isTest && isset($form) && $form['show_data']->getData()) {
// very ugly hack...
dd($datas);
}
diff --git a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_notification_include.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_notification_include.html.twig
index 221ddf4b4..558207818 100644
--- a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_notification_include.html.twig
+++ b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_notification_include.html.twig
@@ -1,12 +1,11 @@
+
+ {{ 'workflow_'|trans }}
+
+
-
- {{ 'workflow_'|trans }}
-
- {% include handler.templateTitle(entity_workflow) with handler.templateTitleData(entity_workflow)|merge({
+ {% include handler.template(entity_workflow) with handler.templateData(entity_workflow)|merge({
'description': true,
'breadcrumb': true,
- 'add_classes': 'ms-3 h3'
+ 'add_classes': ''
}) %}
-
-
diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php b/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php
index 004961594..6d35f8140 100644
--- a/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php
@@ -145,30 +145,16 @@ final class PersonResourceController extends AbstractController
public function newAction(Request $request, $person_id)
{
$personOwner = $this->personRepository->find($person_id);
+ $personResource = new PersonResource();
+ $personResource->setPersonOwner($personOwner);
- $form = $this->createForm(PersonResourceType::class);
+ $form = $this->createForm(PersonResourceType::class, $personResource);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$this->denyAccessUnlessGranted(PersonVoter::CREATE, $personOwner);
- $personResource = new PersonResource();
-
- $person = $form['person']->getData();
- $thirdparty = $form['thirdparty']->getData();
- $freetext = $form['freetext']->getData();
- $comment = $form['comment']->getData();
- $kind = $form['kind']->getData();
-
- $personResource->setKind($kind);
- $personResource->setPerson($person);
- $personResource->setThirdParty($thirdparty);
- $personResource->setFreeText($freetext);
- $personResource->setComment($comment);
-
- $personResource->setPersonOwner($personOwner);
-
$this->em->persist($personResource);
$this->em->flush();
diff --git a/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php b/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php
index 31af0a649..aeab09fea 100644
--- a/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php
+++ b/src/Bundle/ChillPersonBundle/Form/PersonResourceType.php
@@ -29,12 +29,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
final class PersonResourceType extends AbstractType
{
- private PersonRenderInterface $personRender;
-
private ResourceKindRender $resourceKindRender;
- private ThirdPartyRender $thirdPartyRender;
-
private TranslatorInterface $translator;
public function __construct(ResourceKindRender $resourceKindRender, PersonRenderInterface $personRender, ThirdPartyRender $thirdPartyRender, TranslatorInterface $translator)
diff --git a/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php
index 929fb2ae0..57be8fecf 100644
--- a/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php
+++ b/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php
@@ -96,7 +96,19 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
$workflow = $this->registry->get($period, 'accompanying_period_lifecycle');
- if (null !== $period->getClosingDate()) {
+ if ($this->security->isGranted(AccompanyingPeriodVoter::EDIT, $period)) {
+ if ($workflow->can($period, 'close')) {
+ $menu->addChild($this->translator->trans('Close Accompanying Course'), [
+ 'route' => 'chill_person_accompanying_course_close',
+ 'routeParameters' => [
+ 'accompanying_period_id' => $period->getId(),
+ ], ])
+ ->setExtras(['order' => 99999]);
+ }
+ }
+
+ if (null !== $period->getClosingDate()
+ && $this->security->isGranted(AccompanyingPeriodVoter::RE_OPEN_COURSE, $period)) {
$menu->addChild($this->translator->trans('Re-open accompanying course'), [
'route' => 'chill_person_accompanying_course_reopen',
'routeParameters' => [
@@ -104,15 +116,6 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
], ])
->setExtras(['order' => 99998]);
}
-
- if ($workflow->can($period, 'close')) {
- $menu->addChild($this->translator->trans('Close Accompanying Course'), [
- 'route' => 'chill_person_accompanying_course_close',
- 'routeParameters' => [
- 'accompanying_period_id' => $period->getId(),
- ], ])
- ->setExtras(['order' => 99999]);
- }
}
public static function getMenuIds(): array
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 d8e2cc660..eff62bbbb 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue
@@ -67,17 +67,14 @@
-
@@ -116,9 +113,8 @@
:storedObject="d.storedObject"
>
-
-
+
@@ -223,7 +219,79 @@ export default {
maxFiles: 1,
maxPostSize: 15000000,
required: false,
- }
+ },
+ mime: [
+ // TODO temporary hardcoded. to be replaced by twig extension or a collabora server query
+ 'application/clarisworks',
+ 'application/coreldraw',
+ 'application/macwriteii',
+ 'application/msword',
+ 'application/vnd.lotus-1-2-3',
+ 'application/vnd.ms-excel',
+ 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
+ 'application/vnd.ms-excel.sheet.macroEnabled.12',
+ 'application/vnd.ms-excel.template.macroEnabled.12',
+ 'application/vnd.ms-powerpoint',
+ 'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
+ 'application/vnd.ms-powerpoint.template.macroEnabled.12',
+ 'application/vnd.ms-visio.drawing',
+ 'application/vnd.ms-word.document.macroEnabled.12',
+ 'application/vnd.ms-word.template.macroEnabled.12',
+ 'application/vnd.ms-works',
+ 'application/vnd.oasis.opendocument.chart',
+ 'application/vnd.oasis.opendocument.formula',
+ 'application/vnd.oasis.opendocument.graphics',
+ 'application/vnd.oasis.opendocument.graphics-flat-xml',
+ 'application/vnd.oasis.opendocument.graphics-template',
+ 'application/vnd.oasis.opendocument.presentation',
+ 'application/vnd.oasis.opendocument.presentation-flat-xml',
+ 'application/vnd.oasis.opendocument.presentation-template',
+ 'application/vnd.oasis.opendocument.spreadsheet',
+ 'application/vnd.oasis.opendocument.spreadsheet-flat-xml',
+ 'application/vnd.oasis.opendocument.spreadsheet-template',
+ 'application/vnd.oasis.opendocument.text',
+ 'application/vnd.oasis.opendocument.text-flat-xml',
+ 'application/vnd.oasis.opendocument.text-master',
+ 'application/vnd.oasis.opendocument.text-master-template',
+ 'application/vnd.oasis.opendocument.text-template',
+ 'application/vnd.oasis.opendocument.text-web',
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
+ 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
+ 'application/vnd.openxmlformats-officedocument.presentationml.template',
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
+ 'application/vnd.sun.xml.calc',
+ 'application/vnd.sun.xml.calc.template',
+ 'application/vnd.sun.xml.chart',
+ 'application/vnd.sun.xml.draw',
+ 'application/vnd.sun.xml.draw.template',
+ 'application/vnd.sun.xml.impress',
+ 'application/vnd.sun.xml.impress.template',
+ 'application/vnd.sun.xml.math',
+ 'application/vnd.sun.xml.writer',
+ 'application/vnd.sun.xml.writer.global',
+ 'application/vnd.sun.xml.writer.template',
+ 'application/vnd.visio',
+ 'application/vnd.visio2013',
+ 'application/vnd.wordperfect',
+ 'application/x-abiword',
+ 'application/x-aportisdoc',
+ 'application/x-dbase',
+ 'application/x-dif-document',
+ 'application/x-fictionbook+xml',
+ 'application/x-gnumeric',
+ 'application/x-hwp',
+ 'application/x-iwork-keynote-sffkey',
+ 'application/x-iwork-numbers-sffnumbers',
+ 'application/x-iwork-pages-sffpages',
+ 'application/x-mspublisher',
+ 'application/x-mswrite',
+ 'application/x-pagemaker',
+ 'application/x-sony-bbeb',
+ 'application/x-t602',
+ ]
}
},
computed: {
@@ -271,6 +339,10 @@ export default {
},
methods: {
ISOToDatetime,
+ canEditDocument(document) {
+ return 'storedObject' in document ?
+ this.mime.includes(document.storedObject.type) && document.storedObject.keyInfos.length === 0 : false;
+ },
listAllStatus() {
console.log('load all status');
let url = `/api/`;
@@ -337,3 +409,10 @@ export default {
},
}
+
+
diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php
index 9a2ee860d..e53d40eee 100644
--- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php
+++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php
@@ -34,12 +34,23 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH
self::FULL,
self::TOGGLE_CONFIDENTIAL_ALL,
self::TOGGLE_INTENSITY,
+ self::RE_OPEN_COURSE,
];
public const CREATE = 'CHILL_PERSON_ACCOMPANYING_PERIOD_CREATE';
+ /**
+ * role to DELETE the course.
+ *
+ * Will be true only for the creator, and if the course is still at DRAFT step.
+ */
public const DELETE = 'CHILL_PERSON_ACCOMPANYING_PERIOD_DELETE';
+ /**
+ * role to EDIT the course.
+ *
+ * If the course is closed, it will be always false.
+ */
public const EDIT = 'CHILL_PERSON_ACCOMPANYING_PERIOD_UPDATE';
/**
@@ -47,6 +58,14 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH
*/
public const FULL = 'CHILL_PERSON_ACCOMPANYING_PERIOD_FULL';
+ /**
+ * Reopen a closed course.
+ *
+ * This forward to the EDIT role, without taking into account that the course
+ * is closed
+ */
+ public const RE_OPEN_COURSE = 'CHILL_PERSON_ACCOMPANYING_PERIOD_REOPEN';
+
public const SEE = 'CHILL_PERSON_ACCOMPANYING_PERIOD_SEE';
/**
@@ -116,6 +135,10 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH
if (in_array($attribute, [self::EDIT, self::DELETE], true)) {
return false;
}
+
+ if (self::RE_OPEN_COURSE === $attribute) {
+ return $this->voterHelper->voteOnAttribute(self::EDIT, $subject, $token);
+ }
}
if (AccompanyingPeriod::STEP_DRAFT === $subject->getStep()) {
diff --git a/src/Bundle/ChillPersonBundle/translations/validators.fr.yml b/src/Bundle/ChillPersonBundle/translations/validators.fr.yml
index 452365c4c..492f50396 100644
--- a/src/Bundle/ChillPersonBundle/translations/validators.fr.yml
+++ b/src/Bundle/ChillPersonBundle/translations/validators.fr.yml
@@ -57,3 +57,4 @@ Only the referrer can change the confidentiality of a parcours: 'Seul le référ
# resource
You must associate at least one entity: Associez un usager, un tiers ou indiquez une description libre
+You cannot associate a resource with the same person: Vous ne pouvez pas ajouter la personne elle-même en tant que ressource.
\ No newline at end of file
diff --git a/src/Bundle/ChillTaskBundle/Menu/MenuBuilder.php b/src/Bundle/ChillTaskBundle/Menu/MenuBuilder.php
index 170f3eb54..47503f052 100644
--- a/src/Bundle/ChillTaskBundle/Menu/MenuBuilder.php
+++ b/src/Bundle/ChillTaskBundle/Menu/MenuBuilder.php
@@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Chill\TaskBundle\Menu;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
+use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\TaskBundle\Security\Authorization\TaskVoter;
use Knp\Menu\MenuItem;
use LogicException;
@@ -40,9 +41,11 @@ class MenuBuilder implements LocalMenuBuilderInterface
public function buildAccompanyingCourseMenu($menu, $parameters)
{
+ /** @var AccompanyingPeriod $course */
$course = $parameters['accompanyingCourse'];
- if ($this->authorizationChecker->isGranted(TaskVoter::SHOW, $course)) {
+ if ($this->authorizationChecker->isGranted(TaskVoter::SHOW, $course)
+ && AccompanyingPeriod::STEP_DRAFT !== $course->getStep()) {
$menu->addChild(
$this->translator->trans('Tasks'),
[