diff --git a/CHANGELOG.md b/CHANGELOG.md
index ff62b029c..57ecdf5a2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,77 @@ and this project adheres to
## Unreleased
+* [Datepickers] datepickers fixed when using keyboard to enter date (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/545)
+* [social_action] Display 'agents traitants' in parcours resumé and social action list (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/568)
+* [Person_search] Closed parcours shown within an accordeon that can be opened/closed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/574)
+
+## Test releases
+
+### 2021-04-24
+
+* [notification email on course designation] allow raw string in email content generation
+* [Accompanying period work] list evaluations associated to a work by startDate, and then by id, from the most recent to older
+* [Documents] Change wording 'créer' to 'enregistrer' (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/634)
+* [Parcours]: The number of 'mes parcours' displayed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/572)
+* [Hompage_widget]: Renaming of tabs and removal of social actions tab (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/570)
+* [activity]: Ignore thirdparties when creating a social action via an activity (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/573)
+* [parcours]: change wording of warning message and button when user is not associated to a household yet (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/590#note_918370943)
+* [Accompanying period work evaluations] list documents associated to a work by creation date, and then by id, from the most recent to older
+* [Course comment] add validationConstraint NotNull and NotBlank on comment content, to avoid sql error
+* [Notifications] delay the sending of notificaiton to kernel.terminate
+* [Notifications / Period user change] fix the sending of notification when user changes
+* [Activity form] invert 'incoming' and 'receiving' in Activity form
+* [Activity form] keep the same order for 'attendee' field in new and edit form
+* [list with period] use "sameas" test operator to introduce requestor in list
+* [notification email on course designation] allow raw string in email content generation
+* [Accompanying period work] list evaluations associated to a work by startDate, and then by id, from the most recent to older
+
+
+### 2021-04-13
+
+* [person] household address: add a form for editing the validFrom date (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/541)
+* [person] householdmemberseditor: fix composition type bug in select form (vuejs) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/543)
+* [docgen] add more persons choices in docgen for course: amongst requestor (if person), resources of course (if person), and PersonResource (if person);
+* [docgen] add a new context with a list of activities in course
+* [docgen] add a comment in budget lines
+* [notifications] allow to send a notification to an email address. The address receive an access link
+* [adresses] add constraints in database to avoid errors later: postcode not null, and validfrom <= validto
+* [accompanying work editor] add a label on document title input
+
+### 2021-04-07
+
+* notification list: move action buttons outside of the toggle
+* fix detecting of non-read notification
+* filter users which are disabled in search user api
+* order query for location and add pagination in list
+* allow every person which has part for a workflow to see the workflow page
+* able to see the workflow if the evaluation document has been deleted
+* hardcode the list of supported mime types for edition with collabora
+* list of accompanying course: allow to see the pinned comment in list_item
+
+### 2021-04-06
+
+* [main] notification toggle read: correct js syntax for compilation in production (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/548)
+* [parcours] Display of interlocuteurs changed to flex-table in parcours edit page to prevent cut-off of information (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/535)
+* [activity] espace entre les boutons pour supprimer les documents
+
+
+### continuous release in February and March
+
+* Creation of PickCivilityType, and implementation in PersonType and ThirdpartyType
+* [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
+* [search] enforce limit of results for fetching rsults by search api https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/576
+* [activity] Fix delete button for document (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/554)
+* [activity] Add return path the document generation (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/553)
+* [person] add person ressource to person docgen normaliser (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/517)
+* [person] AccompanyingCourseWorkEdit: fix deleting evaluation documents (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/546)
+* [person] AccompanyingCourseWorkEdit: download existing documents (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/512)
+* [person] AccompanyingCourseWorkEdit: replace document by a new one (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/511)
+* [person] AccompanyingPeriodWork: add referrers to work, add doctrine event listener to add logged user to referrers collection and display a referrers list in work list (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/502)
* [person] AccompanyingPeriodWorkEvaluation: fix circular reference when serialising (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/495)
* [person] order accompanying period by opening date in search persons, person and household period lists (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/493)
* [parcours] autosave of the pinned comment for draft accompanying course (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/477)
@@ -27,7 +98,8 @@ and this project adheres to
* [Person/Household list] when listing other simultaneous members of an household, exclude the members on person, not on members (avoid to show two membersship with the same person)
* [draft periods] add a delete button (if acl granted) on each draft period listed on draft period page (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/463)
* [Person] Display suffixText in RenderPerson, PersonText.vue, RenderPersonBox.vue (was made for displaying "enfant confie") (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/441)
-* [person] residential address: show residential address or info in PersonRenderBox, refactor Residential Address (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/439)
+* [budget]: budget enabled for persons and households (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/469)
+* [person] residential address: show residential address or info in PersonRenderBox, refactor Residential Address (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/439)
* [thirdparty] Add a contact to a thirdparty from within onTheFly (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/345)
* [documents] Improve flex-table item-col placement when long buttons and long metadata
* [thirdparty] Fix display of multiple contact badges so they wrap onto next line (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/482)
@@ -44,10 +116,25 @@ and this project adheres to
* [phonenumber] Remove placeholder in phonenumber field (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/496)
* [person_resource] separate create page created to avoid confusion (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/504)
* [contact] add contact button color changed plus the pipe at the side removed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/506)
+* [thirdparty] For contacts show current civility/profession in edit form + fix saving of edited information (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/491)
* [household] create-edit household composition placed in separate page to avoid confusion (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/505)
* [blur] Improved positioning of toggle icon (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/486)
-
-## Test releases
+* [thirdparty] add firstname field to thirdparty 'child' or 'contact' types (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/508)
+* [household] create-edit household composition placed in separate page to avoid confusion (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/505)
+* [blur] Improved positioning of toggle icon (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/486)
+* [parcours] List of parcours for a specific user so they can be reassigned in case of absence (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/509)
+* [thirdparty] Thirdparty view page, english text translated (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/534)
+* [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 + 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)
+* [budget] order within the menu adjusted (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/592)
+* [onthefly] fix create person. Bug was noticed in filiation (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/591)
+* [parcours] Create document buttons made sticky (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/532)
+* [person] Trailing guillemet removed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/530)
+* [notification] Display of social action within workflow notification set to display block (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/537)
+* [onthefly] trim trailing whitespace in email of person and thirdparty (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/542)
### test release 2022-02-21
@@ -75,8 +162,6 @@ and this project adheres to
* [bug]: fix confidential toggle of address in thirdpartyrenderbox (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/460)
-## Test releases
-* Creation of PickCivilityType, and implementation in PersonType and ThirdpartyType
### test release 2022-02-14
@@ -103,6 +188,7 @@ and this project adheres to
* [address]: Correction residential address 'depuis le' (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/459)
* [Documents]: List view adapted to display more information (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/414)
* [Thirdparty_contact]: address blurred if confidential in view page (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/450)
+* [thirdparty] Add a contact to a thirdparty from within onTheFly (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/345)
### test release 2021-02-01
@@ -125,18 +211,9 @@ and this project adheres to
* [fast_actions] improve fast-actions buttons override mechanism, fix https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/413
* [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
* [thirdparty] Add a contact to a thirdparty from within onTheFly (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/345)
-
-
-## Test releases
-=======
* [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
->>>>>>> issue422_and_others_on_AddPersons
-=======
-* [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
-* [thirdparty] Add a contact to a thirdparty from within onTheFly (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/345)
->>>>>>> b0d50d315c8e00959a967badac9cf5057ab2b4bc
### test release 2021-01-31
* [person] accompanying course: optimisation: do not fetch some resources for the banner (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/409)
diff --git a/docs/source/development/pagination.rst b/docs/source/development/pagination.rst
index 1a2c91ff0..a9df72805 100644
--- a/docs/source/development/pagination.rst
+++ b/docs/source/development/pagination.rst
@@ -32,7 +32,7 @@ Then, render the pagination using the dedicated twig function.
{% block title 'Item list'|trans %}
- {% block personcontent %}
+ {% block content %}
diff --git a/docs/source/development/user-interface/layout-template-usage.rst b/docs/source/development/user-interface/layout-template-usage.rst
index 69848c650..1ddbacafd 100644
--- a/docs/source/development/user-interface/layout-template-usage.rst
+++ b/docs/source/development/user-interface/layout-template-usage.rst
@@ -156,7 +156,7 @@ This layout extend `ChillMainBundle::layoutWithVerticalMenu.html.twig` add the p
It proposes 1 new block :
-* personcontent
+* content
* where to display the information of the person
diff --git a/phpstan-deprecations.neon b/phpstan-deprecations.neon
index 1e80ab775..2de8b8bc8 100644
--- a/phpstan-deprecations.neon
+++ b/phpstan-deprecations.neon
@@ -222,33 +222,6 @@ parameters:
count: 1
path: src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php
- -
- message:
- """
- #^Class Chill\\\\AMLI\\\\BudgetBundle\\\\Controller\\\\AbstractElementController extends deprecated class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\Controller\\:
- since Symfony 4\\.2, use "Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController" instead\\.$#
- """
- count: 1
- path: src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php
-
- -
- message:
- """
- #^Class Chill\\\\AMLI\\\\BudgetBundle\\\\Controller\\\\ElementController extends deprecated class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\Controller\\:
- since Symfony 4\\.2, use "Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController" instead\\.$#
- """
- count: 1
- path: src/Bundle/ChillBudgetBundle/Controller/ElementController.php
-
- -
- message:
- """
- #^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
- since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
- """
- count: 1
- path: src/Bundle/ChillBudgetBundle/Security/Authorization/BudgetElementVoter.php
-
-
message:
"""
diff --git a/phpstan-types.neon b/phpstan-types.neon
index ddde5cc03..dc3f67a73 100644
--- a/phpstan-types.neon
+++ b/phpstan-types.neon
@@ -250,11 +250,6 @@ parameters:
count: 1
path: src/Bundle/ChillMainBundle/Entity/Address.php
- -
- message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
- count: 1
- path: src/Bundle/ChillMainBundle/Entity/Embeddable/CommentEmbeddable.php
-
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
@@ -455,18 +450,8 @@ parameters:
count: 1
path: src/Bundle/ChillThirdPartyBundle/Repository/ThirdPartyRepository.php
- -
- message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
- count: 1
- path: src/Bundle/ChillThirdPartyBundle/Search/ThirdPartyApiSearch.php
-
-
message: "#^Method Chill\\\\ThirdPartyBundle\\\\Search\\\\ThirdPartySearch\\:\\:renderResult\\(\\) should return string but return statement is missing\\.$#"
count: 1
path: src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php
- -
- message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
- count: 1
- path: src/Bundle/ChillThirdPartyBundle/Templating/Entity/ThirdPartyRender.php
-
diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php
index 3858979ef..a89b1d67c 100644
--- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php
+++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php
@@ -179,14 +179,15 @@ final class ActivityController extends AbstractController
{
$view = null;
- [$person, $accompanyingPeriod] = $this->getEntity($request);
-
$entity = $this->activityRepository->find($id);
if (null === $entity) {
throw $this->createNotFoundException('Unable to find Activity entity.');
}
+ $accompanyingPeriod = $entity->getAccompanyingPeriod();
+ $person = $entity->getPerson();
+
if ($entity->getAccompanyingPeriod() instanceof AccompanyingPeriod) {
$view = 'ChillActivityBundle:Activity:editAccompanyingCourse.html.twig';
$accompanyingPeriod = $entity->getAccompanyingPeriod();
@@ -220,6 +221,9 @@ final class ActivityController extends AbstractController
$this->entityManager->persist($entity);
$this->entityManager->flush();
+ $params = $this->buildParamsToUrl($person, $accompanyingPeriod);
+ $params['id'] = $entity->getId();
+
if ($form->has('gendocTemplateId') && null !== $form['gendocTemplateId']->getData()) {
return $this->redirectToRoute(
'chill_docgenerator_generate_from_template',
@@ -227,15 +231,13 @@ final class ActivityController extends AbstractController
'template' => $form->get('gendocTemplateId')->getData(),
'entityClassName' => Activity::class,
'entityId' => $entity->getId(),
+ 'returnPath' => $this->generateUrl('chill_activity_activity_edit', $params),
]
);
}
$this->addFlash('success', $this->get('translator')->trans('Success : activity updated!'));
- $params = $this->buildParamsToUrl($person, $accompanyingPeriod);
- $params['id'] = $entity->getId();
-
return $this->redirectToRoute('chill_activity_activity_show', $params);
}
@@ -444,6 +446,9 @@ final class ActivityController extends AbstractController
'template' => $form->get('gendocTemplateId')->getData(),
'entityClassName' => Activity::class,
'entityId' => $entity->getId(),
+ 'returnPath' => $this->generateUrl('chill_activity_activity_edit', [
+ 'id' => $entity->getId(),
+ ]),
]
);
}
diff --git a/src/Bundle/ChillActivityBundle/EntityListener/ActivityEntityListener.php b/src/Bundle/ChillActivityBundle/EntityListener/ActivityEntityListener.php
index ab370e89e..88adf9723 100644
--- a/src/Bundle/ChillActivityBundle/EntityListener/ActivityEntityListener.php
+++ b/src/Bundle/ChillActivityBundle/EntityListener/ActivityEntityListener.php
@@ -66,9 +66,6 @@ class ActivityEntityListener
$newAction->addPerson($person);
}
- foreach ($associatedThirdparties as $thirdparty) {
- $newAction->setHandlingThierparty($thirdparty);
- }
$this->em->persist($newAction);
$this->em->flush();
}
diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityType.php b/src/Bundle/ChillActivityBundle/Form/ActivityType.php
index 6f935ad99..6e75bde25 100644
--- a/src/Bundle/ChillActivityBundle/Form/ActivityType.php
+++ b/src/Bundle/ChillActivityBundle/Form/ActivityType.php
@@ -125,7 +125,9 @@ class ActivityType extends AbstractType
}
if ($activityType->isVisible('socialIssues') && $accompanyingPeriod) {
- $builder->add('socialIssues', HiddenType::class);
+ $builder->add('socialIssues', HiddenType::class, [
+ 'required' => $activityType->getSocialIssuesVisible() === 2,
+ ]);
$builder->get('socialIssues')
->addModelTransformer(new CallbackTransformer(
static function (iterable $socialIssuesAsIterable): string {
@@ -151,7 +153,9 @@ class ActivityType extends AbstractType
}
if ($activityType->isVisible('socialActions') && $accompanyingPeriod) {
- $builder->add('socialActions', HiddenType::class);
+ $builder->add('socialActions', HiddenType::class, [
+ 'required' => $activityType->getSocialActionsVisible() === 2,
+ ]);
$builder->get('socialActions')
->addModelTransformer(new CallbackTransformer(
static function (iterable $socialActionsAsIterable): string {
@@ -305,6 +309,7 @@ class ActivityType extends AbstractType
'label' => $activityType->getLabel('documents'),
'required' => $activityType->isRequired('documents'),
'allow_add' => true,
+ 'allow_delete' => true,
'button_add_label' => 'activity.Insert a document',
'button_remove_label' => 'activity.Remove a document',
'empty_collection_explain' => 'No documents',
@@ -338,7 +343,9 @@ class ActivityType extends AbstractType
}
if ($activityType->isVisible('location')) {
- $builder->add('location', HiddenType::class)
+ $builder->add('location', HiddenType::class, [
+ 'required' => $activityType->getLocationVisible() === 2,
+ ])
->get('location')
->addModelTransformer(new CallbackTransformer(
static function (?Location $location): string {
@@ -366,8 +373,8 @@ class ActivityType extends AbstractType
'label' => $activityType->getLabel('sentReceived'),
'required' => $activityType->isRequired('sentReceived'),
'choices' => [
- 'Sent' => Activity::SENTRECEIVED_SENT,
'Received' => Activity::SENTRECEIVED_RECEIVED,
+ 'Sent' => Activity::SENTRECEIVED_SENT,
],
]);
}
diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php
index 48f750c26..d960a0c21 100644
--- a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php
+++ b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php
@@ -12,13 +12,20 @@ declare(strict_types=1);
namespace Chill\ActivityBundle\Repository;
use Chill\ActivityBundle\Entity\Activity;
+use Chill\ActivityBundle\Entity\ActivityPresence;
+use Chill\ActivityBundle\Entity\ActivityType;
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
+use Chill\MainBundle\Entity\Location;
+use Chill\MainBundle\Entity\LocationType;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
+use Doctrine\DBAL\Types\Types;
+use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\EntityManagerInterface;
+use Doctrine\ORM\Query\ResultSetMappingBuilder;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Security\Core\Security;
@@ -72,6 +79,86 @@ final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInte
->findByAccompanyingPeriod($period, $scopes, true, $limit, $start, $orderBy);
}
+ public function findByAccompanyingPeriodSimplified(AccompanyingPeriod $period, ?int $limit = 1000): array
+ {
+ $rsm = new ResultSetMappingBuilder($this->em);
+
+ $sql = '
+ SELECT
+ a.id AS activity_id,
+ date,
+ CASE WHEN durationtime IS NOT NULL THEN (EXTRACT(EPOCH from durationtime) / 60)::int ELSE 0 END AS durationtimeminute,
+ attendee_id,
+ comment_comment,
+ emergency,
+ sentreceived,
+ CASE WHEN traveltime IS NOT NULL THEN (EXTRACT(EPOCH from traveltime) / 60)::int ELSE 0 END AS traveltimeminute,
+ t.id AS type_id, t.name as type_name,
+ p.id AS presence_id, p.name AS presence_name,
+ location.id AS location_id, location.address_id, location.name AS location_name, location.phonenumber1, location.phonenumber2, location.email,
+ location.locationtype_id, locationtype.title AS locationtype_title,
+ users.userids AS userids,
+ thirdparties.thirdpartyids,
+ persons.personids,
+ actions.socialactionids,
+ issues.socialissueids
+
+ FROM activity a
+ LEFT JOIN chill_main_location location ON a.location_id = location.id
+ LEFT JOIN chill_main_location_type locationtype ON location.locationtype_id = locationtype.id
+ LEFT JOIN activitytpresence p ON a.attendee_id = p.id
+ LEFT JOIN activitytype t ON a.type_id = t.id
+ LEFT JOIN LATERAL (SELECT jsonb_agg(user_id) userids, activity_id FROM activity_user AS au WHERE a.id = au.activity_id GROUP BY activity_id) AS users ON TRUE
+ LEFT JOIN LATERAL (SELECT jsonb_agg(thirdparty_id) thirdpartyids, activity_id FROM activity_thirdparty AS au WHERE a.id = au.activity_id GROUP BY activity_id) AS thirdparties ON TRUE
+ LEFT JOIN LATERAL (SELECT jsonb_agg(person_id) personids, activity_id FROM activity_person AS au WHERE a.id = au.activity_id GROUP BY activity_id) AS persons ON TRUE
+ LEFT JOIN LATERAL (SELECT jsonb_agg(socialaction_id) socialactionids, activity_id FROM chill_activity_activity_chill_person_socialaction AS au WHERE a.id = au.activity_id GROUP BY activity_id) AS actions ON TRUE
+ LEFT JOIN LATERAL (SELECT jsonb_agg(socialissue_id) socialissueids, activity_id FROM chill_activity_activity_chill_person_socialissue AS au WHERE a.id = au.activity_id GROUP BY activity_id) AS issues ON TRUE
+
+ WHERE accompanyingperiod_id = ?
+ ORDER BY a.date DESC, a.id DESC
+ LIMIT ?
+ ';
+
+ $rsm
+ ->addEntityResult(Activity::class, 'a')
+ ->addFieldResult('a', 'activity_id', 'id')
+ ->addFieldResult('a', 'date', 'date')
+ ->addFieldResult('a', 'comment', 'comment')
+ ->addFieldResult('a', 'sentreceived', 'sentReceived')
+ ->addFieldResult('a', 'emergency', 'emergency')
+ ->addJoinedEntityResult(Location::class, 'location', 'a', 'location')
+ ->addFieldResult('location', 'location_id', 'id')
+ ->addFieldResult('location', 'location_name', 'name')
+ ->addFieldResult('location', 'phonenumber1', 'phonenumber1')
+ ->addFieldResult('location', 'phonenumber2', 'phonenumber2')
+ ->addFieldResult('location', 'email', 'email')
+ ->addJoinedEntityResult(LocationType::class, 'locationType', 'location', 'locationType')
+ ->addFieldResult('locationType', 'locationtype_id', 'id')
+ ->addFieldResult('locationType', 'locationtype_title', 'title')
+ ->addJoinedEntityResult(ActivityType::class, 'activityType', 'a', 'activityType')
+ ->addFieldResult('activityType', 'type_id', 'id')
+ ->addFieldResult('activityType', 'type_name', 'name')
+ ->addJoinedEntityResult(ActivityPresence::class, 'activityPresence', 'a', 'attendee')
+ ->addFieldResult('activityPresence', 'presence_id', 'id')
+ ->addFieldResult('activityPresence', 'presence_name', 'name')
+
+ // results which cannot be mapped into entity
+ ->addScalarResult('comment_comment', 'comment', Types::TEXT)
+ ->addScalarResult('userids', 'userIds', Types::JSON)
+ ->addScalarResult('thirdpartyids', 'thirdPartyIds', Types::JSON)
+ ->addScalarResult('personids', 'personIds', Types::JSON)
+ ->addScalarResult('socialactionids', 'socialActionIds', Types::JSON)
+ ->addScalarResult('socialissueids', 'socialIssueIds', Types::JSON)
+ ->addScalarResult('durationtimeminute', 'durationTimeMinute', Types::INTEGER)
+ ->addScalarResult('traveltimeminute', 'travelTimeMinute', Types::INTEGER);
+
+ $nq = $this->em->createNativeQuery($sql, $rsm);
+
+ $nq->setParameter(0, $period->getId())->setParameter(1, $limit);
+
+ return $nq->getResult(AbstractQuery::HYDRATE_ARRAY);
+ }
+
/**
* @param array $orderBy
*
diff --git a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepositoryInterface.php b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepositoryInterface.php
index 56fb112f9..1fc6d22b1 100644
--- a/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepositoryInterface.php
+++ b/src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepositoryInterface.php
@@ -21,6 +21,15 @@ interface ActivityACLAwareRepositoryInterface
*/
public function findByAccompanyingPeriod(AccompanyingPeriod $period, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = []): array;
+ /**
+ * Return a list of activities, simplified as array (not object).
+ *
+ * The aim of this method is to get a long list of activities and keep performance.
+ *
+ * @return array an array of array, each item representing an activity
+ */
+ public function findByAccompanyingPeriodSimplified(AccompanyingPeriod $period, ?int $limit = 1000): array;
+
/**
* @return Activity[]|array
*/
diff --git a/src/Bundle/ChillActivityBundle/Resources/public/page/edit_activity/index.scss b/src/Bundle/ChillActivityBundle/Resources/public/page/edit_activity/index.scss
new file mode 100644
index 000000000..5d1ccf976
--- /dev/null
+++ b/src/Bundle/ChillActivityBundle/Resources/public/page/edit_activity/index.scss
@@ -0,0 +1,23 @@
+div.chill-dropzone__below-zone {
+ a.btn-delete {
+ display: none;
+ }
+}
+
+ul[data-collection-name="documents"] {
+ button.remove-entry {
+ margin: 0.5rem 0!important;
+ }
+}
+
+
+// do it in js does not work
+// document.addEventListener('DOMContentLoaded', e => {
+// const dropzoneBelow = document.querySelectorAll('div.chill-dropzone__below-zone');
+// dropzoneBelow.forEach(
+// d => {
+// const a = d.querySelector('a.btn-delete');
+// d.removeChild(a);
+// }
+// )
+// });
diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location.vue b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location.vue
index 91c5db839..42a69e4c5 100644
--- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location.vue
+++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location.vue
@@ -1,7 +1,7 @@