diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2a05545ed..a3b180cac 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,8 @@ and this project adheres to
## Unreleased
+* [parcours] autosave of the pinned comment for draft accompanying course (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/477)
+* [main] filter user job in undispatch acc period to assign (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/472)
* [main] filter user job in undispatch acc period to assign (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/472)
* [person] Add url in accompanying period work evaluations entity and form (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/476)
* [person] Add document generation in admin and in person/{id}/document (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/464)
@@ -30,6 +32,7 @@ and this project adheres to
* [confidential] Fix position of toggle button so it does not cover text nor fall outside of box (no issue)
* [parcours] Fix edit of both thirdparty and contact name (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/474)
* [template] do not list inactive templates (for doc generator)
+* [household] bugfix if position of member is null, renderbox no longer throws an error (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/480)
* [parcours] location cannot be removed if linked to a user (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/478)
* [person] email added to twig personRenderbox (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/490)
* [person] Add link to current household in person banner (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/484)
diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/api/apiMethods.js b/src/Bundle/ChillMainBundle/Resources/public/lib/api/apiMethods.js
index 67f3e2f42..75f1a21c8 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/lib/api/apiMethods.js
+++ b/src/Bundle/ChillMainBundle/Resources/public/lib/api/apiMethods.js
@@ -1,17 +1,22 @@
/**
* Generic api method that can be adapted to any fetch request
*/
-const makeFetch = (method, url, body) => {
- return fetch(url, {
+const makeFetch = (method, url, body, options) => {
+ let opts = {
method: method,
headers: {
'Content-Type': 'application/json;charset=utf-8'
},
body: (body !== null) ? JSON.stringify(body) : null
- })
+ };
+
+ if (typeof options !== 'undefined') {
+ opts = Object.assign(opts, options);
+ }
+
+ return fetch(url, opts)
.then(response => {
if (response.ok) {
- console.log('200 error')
return response.json();
}
diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php
index b05da5626..1f85e4ad0 100644
--- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php
+++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php
@@ -15,6 +15,7 @@ use Chill\MainBundle\DependencyInjection\MissingBundleException;
use Chill\MainBundle\Security\Authorization\ChillExportVoter;
use Chill\PersonBundle\Controller\HouseholdCompositionTypeApiController;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;
+use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodCommentVoter;
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodResourceVoter;
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
@@ -415,6 +416,25 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
],
],
],
+ [
+ 'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\Comment::class,
+ 'name' => 'accompanying_period_comment',
+ 'base_path' => '/api/1.0/person/accompanying-period/comment',
+ 'base_role' => 'ROLE_USER',
+ 'actions' => [
+ '_entity' => [
+ 'methods' => [
+ Request::METHOD_GET => false,
+ Request::METHOD_PATCH => true,
+ Request::METHOD_HEAD => false,
+ Request::METHOD_DELETE => false,
+ ],
+ 'roles' => [
+ Request::METHOD_PATCH => AccompanyingPeriodCommentVoter::EDIT,
+ ],
+ ],
+ ],
+ ],
[
'class' => \Chill\PersonBundle\Entity\AccompanyingPeriod\Resource::class,
'name' => 'accompanying_period_resource',
diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
index d75ade12b..bd3211c5d 100644
--- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
+++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
@@ -257,9 +257,11 @@ class AccompanyingPeriod implements
/**
* @ORM\ManyToOne(
- * targetEntity=Comment::class
+ * targetEntity=Comment::class,
+ * cascade={"persist"},
* )
* @Groups({"read"})
+ * @ORM\JoinColumn(onDelete="SET NULL")
*/
private ?Comment $pinnedComment = null;
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Comment.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Comment.vue
index a852d71a0..8ae7dfff4 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Comment.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Comment.vue
@@ -14,24 +14,27 @@