+ {{ 'workflow.Cc'|trans ~ ' : ' }}
+
+ {% for u in step.ccUser %}{{ u|chill_entity_render_string }}{% if not loop.last %}, {% endif %}{% endfor %}
+
+
{% else %}
{{ 'workflow.Created by'|trans ~ ' : ' }}
diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml
index a85f40d67..051eb0df0 100644
--- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml
+++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml
@@ -473,6 +473,7 @@ workflow:
Current step: Étape actuelle
Comment on last change: Commentaire à la transition précédente
Users allowed to apply transition: Utilisateurs pouvant valider cette étape
+ Users put in Cc: Utilisateurs mis en copie
Workflow deleted with success: Le workflow a été supprimé
Delete workflow ?: Supprimer le workflow ?
Are you sure you want to delete this workflow ?: Êtes-vous sûr·e de vouloir supprimer ce workflow ?
@@ -489,6 +490,7 @@ workflow:
Previous transitionned: Anciens workflows
Previous workflow transitionned help: Workflows où vous avez exécuté une action.
For: Pour
+ Cc: Cc
You must select a next step, pick another decision if no next steps are available: Il faut une prochaine étape. Choissisez une autre décision si nécessaire.
An access key was also sent to those addresses: Un lien d'accès a été envoyé à ces adresses
Those users are also granted to apply a transition by using an access key: Ces utilisateurs ont obtenu l'accès grâce au lien reçu par email
diff --git a/src/Bundle/ChillMainBundle/translations/messages.nl.yml b/src/Bundle/ChillMainBundle/translations/messages.nl.yml
index 666e249ed..97a82b371 100644
--- a/src/Bundle/ChillMainBundle/translations/messages.nl.yml
+++ b/src/Bundle/ChillMainBundle/translations/messages.nl.yml
@@ -399,6 +399,7 @@ workflow:
Current step: Étape actuelle
Comment on last change: Commentaire à la transition précédente
Users allowed to apply transition: Utilisateurs pouvant valider cette étape
+ Users put in Cc: Utilisateurs mis en copie
Workflow deleted with success: Le workflow a été supprimé
Delete workflow ?: Supprimer le workflow ?
Are you sure you want to delete this workflow ?: Êtes-vous sûr·e de vouloir supprimer ce workflow ?
@@ -416,6 +417,7 @@ workflow:
Previous transitionned: Anciens workflows
Previous workflow transitionned help: Workflows où vous avez exécuté une action.
For: Pour
+ Cc: Cc
Subscribe final: Recevoir une notification à l'étape finale
From 3de5d29fe8efdf740e517a2facb64e175bb33828 Mon Sep 17 00:00:00 2001
From: nobohan
Date: Fri, 24 Mar 2023 14:57:02 +0100
Subject: [PATCH 21/67] Feature: show 'Cc' for notications as Cc
---
.../Controller/NotificationController.php | 23 ++++++++++++++++++-
.../NotificationTwigExtensionRuntime.php | 4 +++-
.../views/Notification/_list_item.html.twig | 18 ++++++++++++++-
...extension_list_notifications_for.html.twig | 1 +
.../views/Notification/list.html.twig | 3 ++-
.../views/Notification/show.html.twig | 3 ++-
.../translations/messages.fr.yml | 2 ++
.../translations/messages.nl.yml | 2 ++
8 files changed, 51 insertions(+), 5 deletions(-)
diff --git a/src/Bundle/ChillMainBundle/Controller/NotificationController.php b/src/Bundle/ChillMainBundle/Controller/NotificationController.php
index a6e876b6d..5b7fb269b 100644
--- a/src/Bundle/ChillMainBundle/Controller/NotificationController.php
+++ b/src/Bundle/ChillMainBundle/Controller/NotificationController.php
@@ -14,6 +14,7 @@ namespace Chill\MainBundle\Controller;
use Chill\MainBundle\Entity\Notification;
use Chill\MainBundle\Entity\NotificationComment;
use Chill\MainBundle\Entity\User;
+use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
use Chill\MainBundle\Form\NotificationCommentType;
use Chill\MainBundle\Form\NotificationType;
use Chill\MainBundle\Notification\Exception\NotificationHandlerNotFound;
@@ -21,6 +22,7 @@ use Chill\MainBundle\Notification\NotificationHandlerManager;
use Chill\MainBundle\Pagination\PaginatorFactory;
use Chill\MainBundle\Repository\NotificationRepository;
use Chill\MainBundle\Repository\UserRepository;
+use Chill\MainBundle\Repository\Workflow\EntityWorkflowRepository;
use Chill\MainBundle\Security\Authorization\NotificationVoter;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
@@ -68,7 +70,8 @@ class NotificationController extends AbstractController
NotificationHandlerManager $notificationHandlerManager,
PaginatorFactory $paginatorFactory,
TranslatorInterface $translator,
- UserRepository $userRepository
+ UserRepository $userRepository,
+ EntityWorkflowRepository $entityWorkflowRepository
) {
$this->em = $em;
$this->logger = $logger;
@@ -79,6 +82,7 @@ class NotificationController extends AbstractController
$this->paginatorFactory = $paginatorFactory;
$this->translator = $translator;
$this->userRepository = $userRepository;
+ $this->entityWorkflowRepository = $entityWorkflowRepository;
}
/**
@@ -345,6 +349,7 @@ class NotificationController extends AbstractController
'appendCommentForm' => isset($appendCommentForm) ? $appendCommentForm->createView() : null,
'editedCommentForm' => isset($editedCommentForm) ? $editedCommentForm->createView() : null,
'editedCommentId' => $commentId ?? null,
+ 'notificationCc' => $this->isNotificationCc($notification),
]);
// we mark the notification as read after having computed the response
@@ -364,6 +369,21 @@ class NotificationController extends AbstractController
];
}
+ private function isNotificationCc(Notification $notification): bool
+ {
+ $notificationCc = false;
+
+ if ($notification->getRelatedEntityClass() === EntityWorkflow::class) {
+ $relatedEntity = $this->entityWorkflowRepository->findOneBy(['id' => $notification->getRelatedEntityId()]);
+
+ if ($relatedEntity->getCurrentStepCreatedBy() !== $this->security->getUser()) {
+ $notificationCc = true;
+ }
+ }
+
+ return $notificationCc;
+ }
+
private function itemsForTemplate(array $notifications): array
{
$templateData = [];
@@ -373,6 +393,7 @@ class NotificationController extends AbstractController
'template' => $this->notificationHandlerManager->getTemplate($notification),
'template_data' => $this->notificationHandlerManager->getTemplateData($notification),
'notification' => $notification,
+ 'isNotificationCc' => $this->isNotificationCc($notification),
];
}
diff --git a/src/Bundle/ChillMainBundle/Notification/Templating/NotificationTwigExtensionRuntime.php b/src/Bundle/ChillMainBundle/Notification/Templating/NotificationTwigExtensionRuntime.php
index 8ccd420c5..5cf4ad084 100644
--- a/src/Bundle/ChillMainBundle/Notification/Templating/NotificationTwigExtensionRuntime.php
+++ b/src/Bundle/ChillMainBundle/Notification/Templating/NotificationTwigExtensionRuntime.php
@@ -74,7 +74,9 @@ class NotificationTwigExtensionRuntime implements RuntimeExtensionInterface
}
return $environment->render('@ChillMain/Notification/extension_list_notifications_for.html.twig', [
- 'notifications' => $notifications, 'appendCommentForms' => $appendCommentForms,
+ 'notifications' => $notifications,
+ 'appendCommentForms' => $appendCommentForms,
+ 'notificationCc' => false,
]);
}
}
diff --git a/src/Bundle/ChillMainBundle/Resources/views/Notification/_list_item.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Notification/_list_item.html.twig
index 1024d56b3..9bec09e4c 100644
--- a/src/Bundle/ChillMainBundle/Resources/views/Notification/_list_item.html.twig
+++ b/src/Bundle/ChillMainBundle/Resources/views/Notification/_list_item.html.twig
@@ -30,11 +30,27 @@
{% endif %}
{% if c.notification.addressees|length > 0 %}
-
+ {% if c.notification_cc is defined %}
+ {% if c.notification_cc %}
+
+
+ {{ 'notification.cc'|trans }} :
+
+
+ {% else %}
+
+
+ {{ 'notification.to'|trans }} :
+
+
+ {% endif %}
+ {% else %}
+
{{ 'notification.to'|trans }} :
+ {% endif %}
{% for a in c.notification.addressees %}
{{ a|chill_entity_render_string }}
diff --git a/src/Bundle/ChillMainBundle/Resources/views/Notification/extension_list_notifications_for.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Notification/extension_list_notifications_for.html.twig
index 748142ab8..77d16a6a1 100644
--- a/src/Bundle/ChillMainBundle/Resources/views/Notification/extension_list_notifications_for.html.twig
+++ b/src/Bundle/ChillMainBundle/Resources/views/Notification/extension_list_notifications_for.html.twig
@@ -6,6 +6,7 @@
'full_content': true,
'fold_item': true,
'action_button': true,
+ 'notification_cc': notificationCc,
} %}{#
#}
{% endfor %}
diff --git a/src/Bundle/ChillMainBundle/Resources/views/Notification/list.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Notification/list.html.twig
index 1f1cbe673..f7ab7f523 100644
--- a/src/Bundle/ChillMainBundle/Resources/views/Notification/list.html.twig
+++ b/src/Bundle/ChillMainBundle/Resources/views/Notification/list.html.twig
@@ -50,7 +50,8 @@
{% for data in datas %}
{% set notification = data.notification %}
{% include 'ChillMainBundle:Notification:_list_item.html.twig' with {
- 'fold_item': true
+ 'fold_item': true,
+ 'notification_cc': data.isNotificationCc
} %}
{% endfor %}
-
+
Date: Thu, 30 Mar 2023 20:25:59 +0200
Subject: [PATCH 39/67] =?UTF-8?q?change=20all=20translations=20using=20act?=
=?UTF-8?q?ivit=C3=A9=20to=20using=20=C3=A9change=20to=20make=20all=20chil?=
=?UTF-8?q?l=20versions=20coherent?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controller/ActivityControllerTest.php | 8 +-
.../translations/messages.fr.yml | 68 +++++++--------
.../translations/messages.nl.yaml | 82 +++++++++----------
.../translations/validators.fr.yml | 34 ++++----
.../views/PersonDuplicate/_sidepane.html.twig | 2 +-
.../translations/messages.fr.yml | 10 +--
.../translations/validators.fr.yml | 2 +-
7 files changed, 103 insertions(+), 103 deletions(-)
diff --git a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php
index e689e205d..e9905b171 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Controller/ActivityControllerTest.php
@@ -121,14 +121,14 @@ final class ActivityControllerTest extends WebTestCase
$client->getResponse()->getStatusCode(),
'Unexpected HTTP status code for GET /activity/'
);
- $crawler = $client->click($crawler->selectLink('Ajouter une nouvelle activité')
+ $crawler = $client->click($crawler->selectLink('Ajouter un nouveau échange')
->link());
$reason1 = $this->getRandomActivityReason();
$reason2 = $this->getRandomActivityReason([$reason1->getId()]);
// Fill in the form and submit it
- $form = $crawler->selectButton('Ajouter une nouvelle activité')->form([
+ $form = $crawler->selectButton('Ajouter un nouveau échange')->form([
'chill_activitybundle_activity' => [
'date' => '15-01-2015',
'durationTime' => 600,
@@ -152,9 +152,9 @@ final class ActivityControllerTest extends WebTestCase
);
// Edit the entity
- $crawler = $client->click($crawler->selectLink("Modifier l'activité")->link());
+ $crawler = $client->click($crawler->selectLink("Modifier l'échange")->link());
- $form = $crawler->selectButton("Sauver l'activité")->form([
+ $form = $crawler->selectButton("Sauver l'échange")->form([
'chill_activitybundle_activity' => [
'date' => '25-01-2015',
// 'remark' => 'Foo'
diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml
index 4dd67ceb8..3fb25d2d7 100644
--- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml
+++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml
@@ -1,7 +1,7 @@
#general
-Show the activity: Voir l'activité
-Edit the activity: Modifier l'activité
-Activity: Activité
+Show the activity: Voir l'échange
+Edit the activity: Modifier l'échange
+Activity: Échange
Duration time: Durée
Duration Time: Durée
durationTime: durée
@@ -13,21 +13,21 @@ user_username: nom de l'utilisateur
circle_name: nom du cercle
Remark: Commentaire
No comments: Aucun commentaire
-Add a new activity: Ajouter une nouvelle activité
-Activity list: Liste des activités
+Add a new activity: Ajouter une nouvelle échange
+Activity list: Liste des échanges
present: présent
not present: absent
Delete: Supprimer
Update: Mettre à jour
-Update activity: Modifier l'activité
+Update activity: Modifier l'échange
Scope: Cercle
-Activity data: Données de l'activité
-Activity location: Localisation de l'activité
+Activity data: Données de l'échange
+Activity location: Localisation de l'échange
No reason associated: Aucun sujet
No social issues associated: Aucune problématique sociale
No social actions associated: Aucune action d'accompagnement
-There isn't any activities.: Aucune activité enregistrée.
-type_name: type de l'activité
+There isn't any activities.: Aucun échange enregistrée.
+type_name: type de l'échange
person_firstname: prénom
person_lastname: nom de famille
person_id: identifiant de la personne
@@ -50,10 +50,10 @@ received: Reçu
#forms
-Activity creation: Nouvelle activité
+Activity creation: Nouvelle échange
Create: Créer
Back to the list: Retour à la liste
-Save activity: Sauver l'activité
+Save activity: Sauver l'échange
Reset form: Remise à zéro du formulaire
Choose the duration: Choisir la durée
Choose a type: Choisir un type
@@ -90,40 +90,40 @@ activity:
No documents: Aucun document
#timeline
-'%user% has done an %activity_type%': '%user% a effectué une activité de type "%activity_type%"'
+'%user% has done an %activity_type%': '%user% a effectué un échange de type "%activity_type%"'
#controller
-'Success : activity created!': L'activité a été créée.
-'The form is not valid. The activity has not been created !': Le formulaire est invalide. L'activité n'a pas été créée.
-'Success : activity updated!': L'activité a été mise à jour.
-'The form is not valid. The activity has not been updated !': Le formulaire est invalide. L'activité n'a pas été mise à jour.
+'Success : activity created!': L'échange a été créée.
+'The form is not valid. The activity has not been created !': Le formulaire est invalide. L'échange n'a pas été créée.
+'Success : activity updated!': L'échange a été mise à jour.
+'The form is not valid. The activity has not been updated !': Le formulaire est invalide. L'échange n'a pas été mise à jour.
# ROLES
-CHILL_ACTIVITY_CREATE: Créer une activité
-CHILL_ACTIVITY_UPDATE: Modifier une activité
-CHILL_ACTIVITY_SEE: Voir une activité
-CHILL_ACTIVITY_SEE_DETAILS: Voir le détail des activités
-CHILL_ACTIVITY_DELETE: Supprimer une activité
-CHILL_ACTIVITY_STATS: Statistique des activités
-CHILL_ACTIVITY_LIST: Liste des activités
+CHILL_ACTIVITY_CREATE: Créer un échange
+CHILL_ACTIVITY_UPDATE: Modifier un échange
+CHILL_ACTIVITY_SEE: Voir un échange
+CHILL_ACTIVITY_SEE_DETAILS: Voir le détail des échanges
+CHILL_ACTIVITY_DELETE: Supprimer un échange
+CHILL_ACTIVITY_STATS: Statistique des échanges
+CHILL_ACTIVITY_LIST: Liste des échanges
# admin
-Activities: Activités
-Activity configuration: Configuration des activités
-Activity configuration menu: Configuration des activités
-Activity types: Types d'activité
-Activity type configuration: Configuration des categories d'activités
-Activity Reasons: Sujets d'une activité
-Activity Reasons Category: Catégories de sujet d'activités
-Activity Types Categories: Catégories des types d'activité
-Activity Presences: Presences aux activités
+Activities: Échanges
+Activity configuration: Configuration des échanges
+Activity configuration menu: Configuration des échanges
+Activity types: Types d'échange
+Activity type configuration: Configuration des categories d'échanges
+Activity Reasons: Sujets d'un échange
+Activity Reasons Category: Catégories de sujet d'échanges
+Activity Types Categories: Catégories des types d'échange
+Activity Presences: Presences aux échanges
Associated activity reason category is inactive: La catégorie de sujet attachée est inactive
# Crud
crud:
activity_type:
- title_new: Nouveau type d'activité
+ title_new: Nouveau type d'échange
title_edit: Edition d'un type d'activité
activity_type_category:
title_new: Nouvelle catégorie de type d'activité
diff --git a/src/Bundle/ChillActivityBundle/translations/messages.nl.yaml b/src/Bundle/ChillActivityBundle/translations/messages.nl.yaml
index dac37fc7d..94a874b99 100644
--- a/src/Bundle/ChillActivityBundle/translations/messages.nl.yaml
+++ b/src/Bundle/ChillActivityBundle/translations/messages.nl.yaml
@@ -47,10 +47,10 @@ Reasons: Onderwerpen
#forms
-Activity creation: Nouvelle activité
+Activity creation: Nouvelle échange
Create: Créer
Back to the list: Retour à la liste
-Save activity: Sauver l'activité
+Save activity: Sauver l'échange
Reset form: Remise à zéro du formulaire
Choose the duration: Choisir la durée
Choose a type: Choisir un type
@@ -79,43 +79,43 @@ activity:
No documents: Aucun document
#timeline
-'%user% has done an %activity_type%': '%user% a effectué une activité de type "%activity_type%"'
+'%user% has done an %activity_type%': '%user% a effectué un échange de type "%activity_type%"'
#controller
-'Success : activity created!': L'activité a été créée.
-'The form is not valid. The activity has not been created !': Le formulaire est invalide. L'activité n'a pas été créée.
-'Success : activity updated!': L'activité a été mise à jour.
-'The form is not valid. The activity has not been updated !': Le formulaire est invalide. L'activité n'a pas été mise à jour.
+'Success : activity created!': L'échange a été créée.
+'The form is not valid. The activity has not been created !': Le formulaire est invalide. L'échange n'a pas été créée.
+'Success : activity updated!': L'échange a été mise à jour.
+'The form is not valid. The activity has not been updated !': Le formulaire est invalide. L'échange n'a pas été mise à jour.
# ROLES
-CHILL_ACTIVITY_CREATE: Créer une activité
-CHILL_ACTIVITY_UPDATE: Modifier une activité
-CHILL_ACTIVITY_SEE: Voir une activité
-CHILL_ACTIVITY_SEE_DETAILS: Voir le détail des activités
-CHILL_ACTIVITY_DELETE: Supprimer une activité
-CHILL_ACTIVITY_STATS: Statistique des activités
-CHILL_ACTIVITY_LIST: Liste des activités
+CHILL_ACTIVITY_CREATE: Créer un échange
+CHILL_ACTIVITY_UPDATE: Modifier un échange
+CHILL_ACTIVITY_SEE: Voir un échange
+CHILL_ACTIVITY_SEE_DETAILS: Voir le détail des échanges
+CHILL_ACTIVITY_DELETE: Supprimer un échange
+CHILL_ACTIVITY_STATS: Statistique des échanges
+CHILL_ACTIVITY_LIST: Liste des échanges
# admin
-Activities: Activités
-Activity configuration: Configuration des activités
-Activity configuration menu: Configuration des activités
-Activity types: Types d'activité
-Activity type configuration: Configuration des categories d'activités
-Activity Reasons: Sujets d'une activité
-Activity Reasons Category: Catégories de sujet d'activités
-Activity Types Categories: Catégories des types d'activité
-Activity Presences: Presences des activités
+Activities: Échanges
+Activity configuration: Configuration des échanges
+Activity configuration menu: Configuration des échanges
+Activity types: Types d'échange
+Activity type configuration: Configuration des categories d'échanges
+Activity Reasons: Sujets d'un échange
+Activity Reasons Category: Catégories de sujet d'échanges
+Activity Types Categories: Catégories des types d'échanges
+Activity Presences: Presences des échanges
# Crud
crud:
activity_type:
- title_new: Nouveau type d'activité
- title_edit: Edition d'un type d'activité
+ title_new: Nouveau type d'échange
+ title_edit: Edition d'un type d'échange
activity_type_category:
- title_new: Nouvelle catégorie de type d'activité
- title_edit: Edition d'une catégorie de type d'activité
+ title_new: Nouvelle catégorie de type d'échange
+ title_edit: Edition d'une catégorie de type d'échange
# activity reason admin
ActivityReason list: Liste des sujets
@@ -124,7 +124,7 @@ Active: Actif
Category: Catégorie
ActivityReason creation: Nouveau sujet
ActivityReason edit: Modification d'un sujet
-ActivityReason: Sujet d'activité
+ActivityReason: Sujet d'échange
The entity is inactive and won't be proposed: Le sujet est inactif et ne sera pas proposé
The entity is active and will be proposed: Le sujet est actif et sera proposé
@@ -133,13 +133,13 @@ ActivityReasonCategory list: Catégories de sujets
Create a new activity category reason: Créer une nouvelle catégorie
ActivityReasonCategory creation: Nouvelle catégorie de sujet
ActivityReasonCategory edit: Modification d'une catégorie de sujet
-ActivityReasonCategory: Catégorie de sujet d'activité
+ActivityReasonCategory: Catégorie de sujet d'échange
ActivityReasonCategory is active and will be proposed: La catégorie est active et sera proposée
ActivityReasonCategory is inactive and won't be proposed: La catégorie est inactive et ne sera pas proposée
# activity type type admin
-ActivityType list: Types d'activités
-Create a new activity type: Créer un nouveau type d'activité
+ActivityType list: Types d'échanges
+Create a new activity type: Créer un nouveau type d'échange
Persons visible: Visibilité du champ Personnes
Persons label: Libellé du champ Personnes
User visible: Visibilité du champ Utilisateur
@@ -177,20 +177,20 @@ Documents label: Libellé du champ Documents
# activity type category admin
ActivityTypeCategory list: Liste des catégories des types d'activité
-Create a new activity type category: Créer une nouvelle catégorie de type d'activité
+Create a new activity type category: Créer une nouvelle catégorie de type d'échange
# activity delete
-Remove activity: Supprimer une activité
-Are you sure you want to remove the activity about "%name%" ?: Êtes-vous sûr de vouloir supprimer une activité qui concerne "%name%" ?
-The activity has been successfully removed.: L'activité a été supprimée.
+Remove activity: Supprimer un échange
+Are you sure you want to remove the activity about "%name%" ?: Êtes-vous sûr de vouloir supprimer un échange qui concerne "%name%" ?
+The activity has been successfully removed.: L'échange a été supprimée.
# exports
-Count activities: Nombre d'activités
-Count activities by various parameters.: Compte le nombre d'activités enregistrées en fonction de différents paramètres.
-Sum activity duration: Total de la durée des activités
-Sum activities duration by various parameters.: Additionne la durée des activités en fonction de différents paramètres.
-List activities: Liste les activités
-Number of activities: Nombre d'activités
+Count activities: Nombre d'échanges
+Count activities by various parameters.: Compte le nombre d'échanges enregistrées en fonction de différents paramètres.
+Sum activity duration: Total de la durée des échanges
+Sum activities duration by various parameters.: Additionne la durée des échanges en fonction de différents paramètres.
+List activities: Liste les échanges
+Number of activities: Nombre d'échanges
#filters
Filter by reason: Filtrer par sujet d'activité
diff --git a/src/Bundle/ChillActivityBundle/translations/validators.fr.yml b/src/Bundle/ChillActivityBundle/translations/validators.fr.yml
index f2c104828..14617e752 100644
--- a/src/Bundle/ChillActivityBundle/translations/validators.fr.yml
+++ b/src/Bundle/ChillActivityBundle/translations/validators.fr.yml
@@ -1,22 +1,22 @@
The reasons's level should not be empty: Le niveau du sujet ne peut pas être vide
At least one reason must be choosen: Au moins un sujet doit être choisi
-For this type of activity, you must add at least one person: Pour ce type d'activité, vous devez ajouter au moins un usager
-For this type of activity, you must add at least one user: Pour ce type d'activité, vous devez ajouter au moins un utilisateur
-For this type of activity, you must add at least one third party: Pour ce type d'activité, vous devez ajouter au moins un tiers
-For this type of activity, user is required: Pour ce type d'activité, l'utilisateur est requis
-For this type of activity, date is required: Pour ce type d'activité, la date est requise
-For this type of activity, location is required: Pour ce type d'activité, la localisation est requise
-For this type of activity, attendee is required: Pour ce type d'activité, le champ "Présence de la personne" est requis
-For this type of activity, duration time is required: Pour ce type d'activité, la durée est requise
-For this type of activity, travel time is required: Pour ce type d'activité, la durée du trajet est requise
-For this type of activity, reasons is required: Pour ce type d'activité, le champ "sujet" est requis
-For this type of activity, comment is required: Pour ce type d'activité, un commentaire est requis
-For this type of activity, sent/received is required: Pour ce type d'activité, le champ Entrant/Sortant est requis
-For this type of activity, document is required: Pour ce type d'activité, un document est requis
-For this type of activity, emergency is required: Pour ce type d'activité, le champ "Urgent" est requis
-For this type of activity, accompanying period is required: Pour ce type d'activité, le parcours d'accompagnement est requis
-For this type of activity, you must add at least one social issue: Pour ce type d'activité, vous devez ajouter au moins une problématique sociale
-For this type of activity, you must add at least one social action: Pour ce type d'activité, vous devez indiquer au moins une action sociale
+For this type of activity, you must add at least one person: Pour ce type d'échange, vous devez ajouter au moins un usager
+For this type of activity, you must add at least one user: Pour ce type d'échange, vous devez ajouter au moins un utilisateur
+For this type of activity, you must add at least one third party: Pour ce type d'échange, vous devez ajouter au moins un tiers
+For this type of activity, user is required: Pour ce type d'échange, l'utilisateur est requis
+For this type of activity, date is required: Pour ce type d'échange, la date est requise
+For this type of activity, location is required: Pour ce type d'échange, la localisation est requise
+For this type of activity, attendee is required: Pour ce type d'échange, le champ "Présence de la personne" est requis
+For this type of activity, duration time is required: Pour ce type d'échange, la durée est requise
+For this type of activity, travel time is required: Pour ce type d'échange, la durée du trajet est requise
+For this type of activity, reasons is required: Pour ce type d'échange, le champ "sujet" est requis
+For this type of activity, comment is required: Pour ce type d'échange, un commentaire est requis
+For this type of activity, sent/received is required: Pour ce type d'échange, le champ Entrant/Sortant est requis
+For this type of activity, document is required: Pour ce type d'échange, un document est requis
+For this type of activity, emergency is required: Pour ce type d'échange, le champ "Urgent" est requis
+For this type of activity, accompanying period is required: Pour ce type d'échange, le parcours d'accompagnement est requis
+For this type of activity, you must add at least one social issue: Pour ce type d'échange, vous devez ajouter au moins une problématique sociale
+For this type of activity, you must add at least one social action: Pour ce type d'échange, vous devez indiquer au moins une action sociale
# admin
This parameter must be equal to social issue parameter: Ce paramètre doit être égal au paramètre "Visibilité du champs Problématiques sociales"
diff --git a/src/Bundle/ChillPersonBundle/Resources/views/PersonDuplicate/_sidepane.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/PersonDuplicate/_sidepane.html.twig
index f7fef7f93..660fff7a6 100644
--- a/src/Bundle/ChillPersonBundle/Resources/views/PersonDuplicate/_sidepane.html.twig
+++ b/src/Bundle/ChillPersonBundle/Resources/views/PersonDuplicate/_sidepane.html.twig
@@ -36,7 +36,7 @@
{%- macro links(person, options) -%}
+ {% if is_granted('CHILL_ACTIVITY_SEE', calendar.activity) %}
+
+
+
+ {% endif %}
+
+
+
+
+
+
+
+ {% endif %}
+
@@ -147,7 +183,12 @@
{% endif %}
{% endif %}
- {% if accompanyingCourse is defined and is_granted('CHILL_ACTIVITY_CREATE', accompanyingCourse) and calendar.activity is null %}
+ {% if calendar.activity is null and (
+ (calendar.context == 'accompanying_period' and is_granted('CHILL_ACTIVITY_CREATE', calendar.accompanyingPeriod))
+ or
+ (calendar.context == 'person' and is_granted('CHILL_ACTIVITY_CREATE', calendar.person))
+ )
+ %}
diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js b/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js
index 6b143a11d..99f83e1e3 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js
+++ b/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js
@@ -18,6 +18,7 @@ function loadDynamicPicker(element) {
isMultiple = parseInt(el.dataset.multiple) === 1,
uniqId = el.dataset.uniqid,
input = element.querySelector('[data-input-uniqid="'+ el.dataset.uniqid +'"]'),
+ // the "picked" will always be an array, even if multiple is false
picked = isMultiple ?
JSON.parse(input.value) : (
(input.value === '[]' || input.value === '') ?
@@ -54,15 +55,11 @@ function loadDynamicPicker(element) {
},
computed: {
notPickedSuggested() {
- if (this.multiple) {
- const pickedIds = new Set();
- for (const p of this.picked) {
- pickedIds.add(`${p.type}${p.id}`);
- }
- return this.suggested.filter(e => !pickedIds.has(`${e.type}${e.id}`))
+ const pickedIds = new Set();
+ for (const p of this.picked) {
+ pickedIds.add(`${p.type}${p.id}`);
}
-
- return this.suggested.filter(e => e.type !== this.picked.type && e.id !== e.picked.id);
+ return this.suggested.filter(e => !pickedIds.has(`${e.type}${e.id}`))
}
},
methods: {
@@ -90,7 +87,11 @@ function loadDynamicPicker(element) {
this.suggested.push(entity);
}
this.picked = this.picked.filter(e => !(e.type === entity.type && e.id === entity.id));
- input.value = JSON.stringify(this.picked);
+ if (this.multiple) {
+ input.value = JSON.stringify(this.picked);
+ } else {
+ input.value = "";
+ }
},
}
})
From 839b0fc826137ad82e49d12348834c9022ecc6c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julien=20Fastr=C3=A9?=
Date: Fri, 7 Apr 2023 16:24:28 +0200
Subject: [PATCH 53/67] Fixed: [section] remove hardcoded link to phonecall
aside activity
---
.../src/Menu/SectionMenuBuilder.php | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php b/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php
index d4ed7dbf9..f23fcdc8a 100644
--- a/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php
+++ b/src/Bundle/ChillAsideActivityBundle/src/Menu/SectionMenuBuilder.php
@@ -44,17 +44,6 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface
'order' => 11,
'icons' => ['plus'],
]);
- $menu->addChild($this->translator->trans('Phonecall'), [
- 'route' => 'chill_crud_aside_activity_new',
- 'routeParameters' => [
- 'type' => 1,
- 'duration' => 900,
- ],
- ])
- ->setExtras([
- 'order' => 12,
- 'icons' => ['plus'],
- ]);
}
}
From a42a4ab9bd8d8c7b4a57c23b58ea1fa3856bd9a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julien=20Fastr=C3=A9?=
Date: Fri, 7 Apr 2023 17:34:12 +0200
Subject: [PATCH 54/67] Fixed: fix empty result in household api search
fix https://gitlab.com/Chill-Projet/chill-bundles/-/issues/85
---
.../ChillMainBundle/Search/SearchApi.php | 25 ++++++++-----------
.../ChillMainBundle/Search/SearchApiQuery.php | 12 +++++++++
.../Search/SearchHouseholdApiProvider.php | 14 +++++++----
3 files changed, 32 insertions(+), 19 deletions(-)
diff --git a/src/Bundle/ChillMainBundle/Search/SearchApi.php b/src/Bundle/ChillMainBundle/Search/SearchApi.php
index 875383839..c8459dbdf 100644
--- a/src/Bundle/ChillMainBundle/Search/SearchApi.php
+++ b/src/Bundle/ChillMainBundle/Search/SearchApi.php
@@ -30,7 +30,7 @@ class SearchApi
private PaginatorFactory $paginator;
- private iterable $providers = [];
+ private iterable $providers;
public function __construct(
EntityManagerInterface $em,
@@ -42,9 +42,6 @@ class SearchApi
$this->paginator = $paginator;
}
- /**
- * @return Model/Result[]
- */
public function getResults(string $pattern, array $types, array $parameters): Collection
{
$queries = $this->findQueries($pattern, $types, $parameters);
@@ -53,10 +50,10 @@ class SearchApi
throw new SearchApiNoQueryException($pattern, $types, $parameters);
}
- $total = $this->countItems($queries, $types, $parameters);
+ $total = $this->countItems($queries);
$paginator = $this->paginator->create($total);
- $rawResults = $this->fetchRawResult($queries, $types, $parameters, $paginator);
+ $rawResults = $this->fetchRawResult($queries, $types, $paginator);
$this->prepareProviders($rawResults);
$results = $this->buildResults($rawResults);
@@ -64,7 +61,7 @@ class SearchApi
return new Collection($results, $paginator);
}
- private function buildCountQuery(array $queries, $types, $parameters)
+ private function buildCountQuery(array $queries): array
{
$query = 'SELECT SUM(c) AS count FROM ({union_unordered}) AS sq';
$unions = [];
@@ -88,7 +85,7 @@ class SearchApi
$items = [];
foreach ($rawResults as $r) {
- foreach ($this->providers as $k => $p) {
+ foreach ($this->providers as $p) {
if ($p->supportsResult($r['key'], $r['metadata'])) {
$items[] = (new SearchApiResult($r['pertinence']))
->setResult(
@@ -103,7 +100,7 @@ class SearchApi
return $items;
}
- private function buildUnionQuery(array $queries, $types, $parameters, Paginator $paginator)
+ private function buildUnionQuery(array $queries, Paginator $paginator): array
{
$query = '{unions} ORDER BY pertinence DESC LIMIT ? OFFSET ?';
$unions = [];
@@ -126,9 +123,9 @@ class SearchApi
];
}
- private function countItems($providers, $types, $parameters): int
+ private function countItems($providers): int
{
- [$countQuery, $parameters] = $this->buildCountQuery($providers, $types, $parameters);
+ [$countQuery, $parameters] = $this->buildCountQuery($providers);
$rsmCount = new ResultSetMappingBuilder($this->em);
$rsmCount->addScalarResult('count', 'count');
$countNq = $this->em->createNativeQuery($countQuery, $rsmCount);
@@ -137,9 +134,9 @@ class SearchApi
return (int) $countNq->getSingleScalarResult();
}
- private function fetchRawResult($queries, $types, $parameters, Paginator $paginator): array
+ private function fetchRawResult($queries, $types, Paginator $paginator): array
{
- [$union, $parameters] = $this->buildUnionQuery($queries, $types, $parameters, $paginator);
+ [$union, $parameters] = $this->buildUnionQuery($queries, $paginator);
$rsm = new ResultSetMappingBuilder($this->em);
$rsm->addScalarResult('key', 'key', Types::STRING)
->addScalarResult('metadata', 'metadata', Types::JSON)
@@ -172,7 +169,7 @@ class SearchApi
);
}
- private function prepareProviders(array $rawResults)
+ private function prepareProviders(array $rawResults): void
{
$metadatas = [];
$providers = [];
diff --git a/src/Bundle/ChillMainBundle/Search/SearchApiQuery.php b/src/Bundle/ChillMainBundle/Search/SearchApiQuery.php
index c7b661e4f..ad852d95a 100644
--- a/src/Bundle/ChillMainBundle/Search/SearchApiQuery.php
+++ b/src/Bundle/ChillMainBundle/Search/SearchApiQuery.php
@@ -16,6 +16,18 @@ use function count;
use function implode;
use function strtr;
+/**
+ * This create a query optimized for searching for the api response.
+ *
+ * When build, this class generate a SQL string and a list of a parameters which is suitable for running
+ * a native SQL query. This have usually the form of
+ *
+ * `SELECT '' as key, as metadata, as pertinence FROM WHERE `.
+ *
+ * The clause between `<>` are provided through the dedicated method in this class (@link{self::setSelectKey},
+ * @link{self::setFromClause}), etc.).
+ *
+ */
class SearchApiQuery
{
private ?string $fromClause = null;
diff --git a/src/Bundle/ChillPersonBundle/Search/SearchHouseholdApiProvider.php b/src/Bundle/ChillPersonBundle/Search/SearchHouseholdApiProvider.php
index 02d944d15..819554252 100644
--- a/src/Bundle/ChillPersonBundle/Search/SearchHouseholdApiProvider.php
+++ b/src/Bundle/ChillPersonBundle/Search/SearchHouseholdApiProvider.php
@@ -84,15 +84,19 @@ class SearchHouseholdApiProvider implements SearchApiInterface
count($phoneResult->getFound()) > 0 ? $phoneResult->getFound()[0] : null
);
+ $previousFrom = $query->getFromClause();
+ $previousParams = $query->getFromParams();
+
$query
- ->setDistinct(true, 'household_id')
+ ->setDistinct(true, 'cpphm.household_id')
->setFromClause(
- 'view_chill_person_household_address AS vcpha ' .
- 'JOIN chill_person_person AS person ON vcpha.person_id = person.id'
+ $previousFrom . ' '.
+ 'JOIN chill_person_household_members AS cpphm ON cpphm.person_id = person.id',
+ $previousParams
)
+ ->andWhereClause('(cpphm.startDate <= NOW() AND (cpphm.endDate IS NULL or cpphm.endDate > NOW()))')
->setSelectKey('household')
- ->andWhereClause('vcpha.validTo IS NULL', [])
- ->setSelectJsonbMetadata("jsonb_build_object('id', vcpha.household_id)");
+ ->setSelectJsonbMetadata("jsonb_build_object('id', cpphm.household_id)");
return $query;
}
From 9853845c9ce71d723e1211c101194044948fbf09 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julien=20Fastr=C3=A9?=
Date: Fri, 7 Apr 2023 17:38:57 +0200
Subject: [PATCH 55/67] Fixed: [workflow] show error message when applying a
transition and no dest users are chosen
fix https://gitlab.com/Chill-Projet/chill-bundles/-/issues/80
---
.../ChillMainBundle/Resources/views/Workflow/_decision.html.twig | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig
index bd9274739..0444abc69 100644
--- a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig
+++ b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig
@@ -66,6 +66,7 @@
{{ form_row(transition_form.future_dest_users) }}
{{ form_row(transition_form.future_dest_emails) }}
+ {{ form_errors(transition_form.future_dest_users) }}
{{ form_label(transition_form.comment) }}
From ef138339660e6ed890934ae2df97964ed69e4b79 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julien=20Fastr=C3=A9?=
Date: Tue, 11 Apr 2023 10:16:09 +0200
Subject: [PATCH 56/67] Fixed: [create person] handle case when the user has
two differents groups in the same center
Fix https://gitlab.com/Chill-Projet/chill-bundles/-/issues/72
---
.../Authorization/AuthorizationHelper.php | 13 +++++-----
.../AuthorizationHelperInterface.php | 6 ++---
.../Controller/PersonController.php | 24 +++++++++----------
3 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php
index 65e1cf688..9bb883317 100644
--- a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php
+++ b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php
@@ -63,7 +63,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface
*
* @param User $user The user
* @param array $centers a list of centers which are going to be filtered
- * @param Center|string $role
+ * @param string $role
*/
public function filterReachableCenters(User $user, array $centers, $role): array
{
@@ -113,13 +113,14 @@ class AuthorizationHelper implements AuthorizationHelperInterface
* Get reachable Centers for the given user, role,
* and optionally Scope.
*
- * @return array|Center[]
+ * @return list
*/
public function getReachableCenters(UserInterface $user, string $role, ?Scope $scope = null): array
{
if ($role instanceof Role) {
$role = $role->getRole();
}
+ /** @var array $centers */
$centers = [];
foreach ($user->getGroupCenters() as $groupCenter) {
@@ -129,13 +130,13 @@ class AuthorizationHelper implements AuthorizationHelperInterface
//check that the role is in the reachable roles
if ($this->isRoleReached($role, $roleScope->getRole())) {
if (null === $scope) {
- $centers[] = $groupCenter->getCenter();
+ $centers[spl_object_hash($groupCenter->getCenter())] = $groupCenter->getCenter();
break;
}
if ($scope->getId() === $roleScope->getScope()->getId()) {
- $centers[] = $groupCenter->getCenter();
+ $centers[spl_object_hash($groupCenter->getCenter())] = $groupCenter->getCenter();
break;
}
@@ -143,7 +144,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface
}
}
- return $centers;
+ return array_values($centers);
}
/**
@@ -194,7 +195,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface
*
* @return array|Scope[]
*/
- public function getReachableScopes(UserInterface $user, string $role, $center): array
+ public function getReachableScopes(UserInterface $user, string $role, Center|array $center): array
{
if ($role instanceof Role) {
$role = $role->getRole();
diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperInterface.php b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperInterface.php
index f7c1f5b46..1176cf1fa 100644
--- a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperInterface.php
+++ b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelperInterface.php
@@ -21,12 +21,12 @@ interface AuthorizationHelperInterface
* Get reachable Centers for the given user, role,
* and optionnaly Scope.
*
- * @return Center[]
+ * @return list
$center
*/
- public function getReachableScopes(UserInterface $user, string $role, $center): array;
+ public function getReachableScopes(UserInterface $user, string $role, Center|array $center): array;
}
diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonController.php b/src/Bundle/ChillPersonBundle/Controller/PersonController.php
index bb03a6b33..976f44703 100644
--- a/src/Bundle/ChillPersonBundle/Controller/PersonController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/PersonController.php
@@ -11,6 +11,8 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Controller;
+use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
+use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper;
use Chill\PersonBundle\Entity\Household\Household;
use Chill\PersonBundle\Entity\Household\HouseholdMember;
@@ -20,6 +22,7 @@ use Chill\PersonBundle\Form\PersonType;
use Chill\PersonBundle\Privacy\PrivacyEvent;
use Chill\PersonBundle\Repository\PersonRepository;
use Chill\PersonBundle\Search\SimilarPersonMatcher;
+use Chill\PersonBundle\Security\Authorization\PersonVoter;
use DateTimeImmutable;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
@@ -44,6 +47,8 @@ use function is_array;
final class PersonController extends AbstractController
{
+ private AuthorizationHelperInterface $authorizationHelper;
+
/**
* @var ConfigPersonAltNamesHelper
*/
@@ -87,6 +92,7 @@ final class PersonController extends AbstractController
private $validator;
public function __construct(
+ AuthorizationHelperInterface $authorizationHelper,
SimilarPersonMatcher $similarPersonMatcher,
TranslatorInterface $translator,
EventDispatcherInterface $eventDispatcher,
@@ -97,6 +103,7 @@ final class PersonController extends AbstractController
EntityManagerInterface $em,
Security $security
) {
+ $this->authorizationHelper = $authorizationHelper;
$this->similarPersonMatcher = $similarPersonMatcher;
$this->translator = $translator;
$this->eventDispatcher = $eventDispatcher;
@@ -206,22 +213,15 @@ final class PersonController extends AbstractController
*
* The next post compare the data with previous one and, if yes, show a
* review page if there are "alternate persons".
- *
- * @return Response|\Symfony\Component\HttpFoundation\RedirectResponse
*/
- public function newAction(Request $request)
+ public function newAction(Request $request): Response
{
$person = new Person();
- if (
- 1 === count($this->security->getUser()
- ->getGroupCenters())
- ) {
- $person->setCenter(
- $this->security->getUser()
- ->getGroupCenters()[0]
- ->getCenter()
- );
+ $authorizedCenters =$this->authorizationHelper->getReachableCenters($this->getUser(), PersonVoter::CREATE);
+
+ if (1 === count($authorizedCenters)) {
+ $person->setCenter($authorizedCenters[0]);
}
$form = $this->createForm(CreationPersonType::class, $person)
From 98aad8c4b6355d90f6afef837384b9d0243d1990 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julien=20Fastr=C3=A9?=
Date: Tue, 11 Apr 2023 10:45:10 +0200
Subject: [PATCH 57/67] Fixed: [accompanying period work / edit] allow endDate
to be equal to startDate, and show validation errors to users
Fix https://gitlab.com/Chill-Projet/chill-bundles/-/issues/79
---
.../AccompanyingPeriodWork.php | 4 +--
.../AccompanyingCourseWorkCreate/index.js | 25 ++++++++++++-------
.../AccompanyingCourseWorkCreate/store.js | 6 ++++-
.../vuejs/AccompanyingCourseWorkEdit/App.vue | 9 ++++++-
.../vuejs/AccompanyingCourseWorkEdit/index.js | 2 +-
.../vuejs/AccompanyingCourseWorkEdit/store.js | 3 +--
.../translations/validators.fr.yml | 3 +++
7 files changed, 36 insertions(+), 16 deletions(-)
diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php
index adb5ca358..5361012b3 100644
--- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php
+++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php
@@ -94,8 +94,8 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
* @Serializer\Groups({"accompanying_period_work:create"})
* @Serializer\Groups({"accompanying_period_work:edit"})
* @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"
+ * @Assert\GreaterThanOrEqual(propertyPath="startDate",
+ * message="accompanying_course_work.The endDate should be greater or equal than the start date"
* )
*/
private ?DateTimeImmutable $endDate = null;
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/index.js
index 7e54e2b0b..1f8a25d3a 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/index.js
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/index.js
@@ -1,15 +1,22 @@
-import { createApp } from 'vue';
-import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n';
-import { store } from './store';
-import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n'
+import {createApp} from 'vue';
+import {_createI18n} from 'ChillMainAssets/vuejs/_js/i18n';
+import {store} from './store';
+import {personMessages} from 'ChillPersonAssets/vuejs/_js/i18n'
import App from './App.vue';
+import VueToast from "vue-toast-notification";
const i18n = _createI18n(personMessages);
const app = createApp({
- template: ``,
+ template: ``,
})
-.use(store)
-.use(i18n)
-.component('app', App)
-.mount('#accompanying_course_work_create');
+ .use(store)
+ .use(i18n)
+ .use(VueToast, {
+ position: "bottom-right",
+ type: "error",
+ duration: 10000,
+ dismissible: true,
+ })
+ .component('app', App)
+ .mount('#accompanying_course_work_create');
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/store.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/store.js
index 3eee7c56a..138e6f6ed 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/store.js
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/store.js
@@ -107,6 +107,9 @@ const store = createStore({
setPostingWork(state) {
state.isPostingWork = true;
},
+ setPostingWorkDone(state) {
+ state.isPostingWork = false;
+ },
setStartDate(state, date) {
state.startDate = date;
},
@@ -150,11 +153,12 @@ const store = createStore({
const url = `/api/1.0/person/accompanying-course/${state.accompanyingCourse.id}/work.json`;
commit('setPostingWork');
- makeFetch('POST', url, payload)
+ return makeFetch('POST', url, payload)
.then((response) => {
window.location.assign(`/fr/person/accompanying-period/work/${response.id}/edit`)
})
.catch((error) => {
+ commit('setPostingWorkDone');
throw error;
});
},
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue
index 9a105dd8d..755e4455c 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue
@@ -549,7 +549,14 @@ export default {
.catch(e => { console.log(e); throw e; });
},
submit() {
- this.$store.dispatch('submit');
+ this.$store.dispatch('submit').catch((error) => {
+ if (error.name === 'ValidationException' || error.name === 'AccessException') {
+ error.violations.forEach((violation) => this.$toast.open({message: violation}));
+ } else {
+ this.$toast.open({message: 'An error occurred'});
+ throw error;
+ }
+ });
},
saveFormOnTheFly(payload) {
console.log('saveFormOnTheFly: type', payload.type, ', data', payload.data);
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/index.js
index 143d34215..b0868b48b 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/index.js
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/index.js
@@ -15,7 +15,7 @@ const app = createApp({
.use(VueToast, {
position: "bottom-right",
type: "error",
- duration: 5000,
+ duration: 10000,
dismissible: true
})
.use(i18n)
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js
index e075e65bc..47e4b2d3f 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js
@@ -500,9 +500,8 @@ const store = createStore({
window.location.assign(`/fr/person/accompanying-period/${state.work.accompanyingPeriod.id}/work`);
}
}).catch(error => {
- console.log('error on submit', error);
commit('setIsPosting', false);
- commit('setErrors', error.violations);
+ throw error;
});
},
updateDocumentTitle({commit}, payload) {
diff --git a/src/Bundle/ChillPersonBundle/translations/validators.fr.yml b/src/Bundle/ChillPersonBundle/translations/validators.fr.yml
index 8fcda47aa..f005755b1 100644
--- a/src/Bundle/ChillPersonBundle/translations/validators.fr.yml
+++ b/src/Bundle/ChillPersonBundle/translations/validators.fr.yml
@@ -71,3 +71,6 @@ relationship:
person_creation:
If you want to create an household, an address is required: Pour la création d'un ménage, une adresse est requise
+
+accompanying_course_work:
+ The endDate should be greater or equal than the start date: La date de fin doit être égale ou supérieure à la date de début
From 841bdb0ebfe6096fc210951b58c2f7b0518c5bcd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julien=20Fastr=C3=A9?=
Date: Tue, 11 Apr 2023 11:43:01 +0200
Subject: [PATCH 58/67] fix issues from master
---
src/Bundle/ChillMainBundle/Search/SearchApi.php | 6 +++---
.../Security/Authorization/AuthorizationHelper.php | 5 -----
.../ChillPersonBundle/Controller/PersonController.php | 4 ----
3 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/src/Bundle/ChillMainBundle/Search/SearchApi.php b/src/Bundle/ChillMainBundle/Search/SearchApi.php
index c8459dbdf..1fea71c46 100644
--- a/src/Bundle/ChillMainBundle/Search/SearchApi.php
+++ b/src/Bundle/ChillMainBundle/Search/SearchApi.php
@@ -11,8 +11,8 @@ declare(strict_types=1);
namespace Chill\MainBundle\Search;
-use Chill\MainBundle\Pagination\Paginator;
use Chill\MainBundle\Pagination\PaginatorFactory;
+use Chill\MainBundle\Pagination\PaginatorInterface;
use Chill\MainBundle\Serializer\Model\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\EntityManagerInterface;
@@ -100,7 +100,7 @@ class SearchApi
return $items;
}
- private function buildUnionQuery(array $queries, Paginator $paginator): array
+ private function buildUnionQuery(array $queries, PaginatorInterface $paginator): array
{
$query = '{unions} ORDER BY pertinence DESC LIMIT ? OFFSET ?';
$unions = [];
@@ -134,7 +134,7 @@ class SearchApi
return (int) $countNq->getSingleScalarResult();
}
- private function fetchRawResult($queries, $types, Paginator $paginator): array
+ private function fetchRawResult($queries, $types, PaginatorInterface $paginator): array
{
[$union, $parameters] = $this->buildUnionQuery($queries, $paginator);
$rsm = new ResultSetMappingBuilder($this->em);
diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php
index 9bb883317..768b35a75 100644
--- a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php
+++ b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php
@@ -63,7 +63,6 @@ class AuthorizationHelper implements AuthorizationHelperInterface
*
* @param User $user The user
* @param array $centers a list of centers which are going to be filtered
- * @param string $role
*/
public function filterReachableCenters(User $user, array $centers, $role): array
{
@@ -197,10 +196,6 @@ class AuthorizationHelper implements AuthorizationHelperInterface
*/
public function getReachableScopes(UserInterface $user, string $role, Center|array $center): array
{
- if ($role instanceof Role) {
- $role = $role->getRole();
- }
-
return $this->getReachableCircles($user, $role, $center);
}
diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonController.php b/src/Bundle/ChillPersonBundle/Controller/PersonController.php
index 976f44703..ae12c566d 100644
--- a/src/Bundle/ChillPersonBundle/Controller/PersonController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/PersonController.php
@@ -64,8 +64,6 @@ final class PersonController extends AbstractController
*/
protected $personRepository;
- private Security $security;
-
/**
* @var SimilarPersonMatcher
*/
@@ -101,7 +99,6 @@ final class PersonController extends AbstractController
LoggerInterface $logger,
ValidatorInterface $validator,
EntityManagerInterface $em,
- Security $security
) {
$this->authorizationHelper = $authorizationHelper;
$this->similarPersonMatcher = $similarPersonMatcher;
@@ -112,7 +109,6 @@ final class PersonController extends AbstractController
$this->logger = $logger;
$this->validator = $validator;
$this->em = $em;
- $this->security = $security;
}
public function editAction($person_id, Request $request)
From 4db1ff405e6063176154d9cac3959b6ad2bdbf33 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julien=20Fastr=C3=A9?=
Date: Tue, 11 Apr 2023 13:04:08 +0200
Subject: [PATCH 59/67] fix new phpstan issues
---
.../ChillEventBundle/Search/EventSearch.php | 32 ++++++++-----------
.../Widget/AddWidgetConfigurationTrait.php | 2 +-
.../MultipleObjectsToIdTransformer.php | 6 +---
.../Search/SearchInterface.php | 4 +--
.../Authorization/AuthorizationHelper.php | 1 +
.../ChillPersonBundle/Search/PersonSearch.php | 25 ++++-----------
.../Search/ThirdPartySearch.php | 3 ++
7 files changed, 29 insertions(+), 44 deletions(-)
diff --git a/src/Bundle/ChillEventBundle/Search/EventSearch.php b/src/Bundle/ChillEventBundle/Search/EventSearch.php
index 90eca34bc..a7ac22592 100644
--- a/src/Bundle/ChillEventBundle/Search/EventSearch.php
+++ b/src/Bundle/ChillEventBundle/Search/EventSearch.php
@@ -113,27 +113,23 @@ class EventSearch extends AbstractSearch
]
);
}
+ // format is "json"
+ $results = [];
+ $search = $this->search($terms, $start, $limit, $options);
- if ('json' === $format) {
- $results = [];
- $search = $this->search($terms, $start, $limit, $options);
-
- foreach ($search as $item) {
- $results[] = [
- 'id' => $item->getId(),
- 'text' => $item->getDate()->format('d/m/Y, H:i') . ' → ' .
- // $item->getType()->getName()['fr'] . ': ' . // display the type of event
- $item->getName(),
- ];
- }
-
- return [
- 'results' => $results,
- 'pagination' => [
- 'more' => $paginator->hasNextPage(),
- ],
+ foreach ($search as $item) {
+ $results[] = [
+ 'id' => $item->getId(),
+ 'text' => $item->getDate()->format('d/m/Y, H:i') . ' → ' .
+ // $item->getType()->getName()['fr'] . ': ' . // display the type of event
+ $item->getName(),
];
}
+
+ return [
+ 'results' => $results,
+ 'more' => $paginator->hasNextPage(),
+ ];
}
public function supports($domain, $format)
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AddWidgetConfigurationTrait.php b/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AddWidgetConfigurationTrait.php
index a6688fca2..3cff6583e 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AddWidgetConfigurationTrait.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AddWidgetConfigurationTrait.php
@@ -211,7 +211,7 @@ trait AddWidgetConfigurationTrait
*
* @throws InvalidConfigurationException if a service's tag does not have the "alias" key
*
- * @return type
+ * @return array
*/
protected function getWidgetAliasesbyPlace($place, ContainerBuilder $containerBuilder)
{
diff --git a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php
index aca165652..a21f49b2c 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/DataTransformer/MultipleObjectsToIdTransformer.php
@@ -31,8 +31,6 @@ class MultipleObjectsToIdTransformer implements DataTransformerInterface
* Transforms a string (id) to an object (item).
*
* @param mixed $array
- *
- * @return ArrayCollection
*/
public function reverseTransform($array)
{
@@ -53,10 +51,8 @@ class MultipleObjectsToIdTransformer implements DataTransformerInterface
* Transforms an object (use) to a string (id).
*
* @param array $array
- *
- * @return ArrayCollection
*/
- public function transform($array)
+ public function transform($array): array
{
$ret = [];
diff --git a/src/Bundle/ChillMainBundle/Search/SearchInterface.php b/src/Bundle/ChillMainBundle/Search/SearchInterface.php
index 7fced2ff9..a7cd285fe 100644
--- a/src/Bundle/ChillMainBundle/Search/SearchInterface.php
+++ b/src/Bundle/ChillMainBundle/Search/SearchInterface.php
@@ -71,9 +71,9 @@ interface SearchInterface
* @param array $terms the string to search
* @param int $start the first result (for pagination)
* @param int $limit the number of result (for pagination)
- * @param string $format The format for result
+ * @param "html"|"json" $format The format for result
*
- * @return string, an HTML string
+ * @return string|array a string if format is html, an array if format is json
*/
public function renderResult(array $terms, $start = 0, $limit = 50, array $options = [], $format = 'html');
diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php
index 768b35a75..828f53757 100644
--- a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php
+++ b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php
@@ -63,6 +63,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface
*
* @param User $user The user
* @param array $centers a list of centers which are going to be filtered
+ * @param mixed $role
*/
public function filterReachableCenters(User $user, array $centers, $role): array
{
diff --git a/src/Bundle/ChillPersonBundle/Search/PersonSearch.php b/src/Bundle/ChillPersonBundle/Search/PersonSearch.php
index 3de2fd4f1..7cd1849a3 100644
--- a/src/Bundle/ChillPersonBundle/Search/PersonSearch.php
+++ b/src/Bundle/ChillPersonBundle/Search/PersonSearch.php
@@ -203,15 +203,6 @@ class PersonSearch extends AbstractSearch implements HasAdvancedSearchFormInterf
return true;
}
- /**
- * (non-PHPdoc).
- *
- * @see \Chill\MainBundle\Search\SearchInterface::renderResult()
- *
- * @param mixed $start
- * @param mixed $limit
- * @param mixed $format
- */
public function renderResult(array $terms, $start = 0, $limit = 50, array $options = [], $format = 'html')
{
$terms = $this->findAdditionnalInDefault($terms);
@@ -236,15 +227,13 @@ class PersonSearch extends AbstractSearch implements HasAdvancedSearchFormInterf
]
);
}
-
- if ('json' === $format) {
- return [
- 'results' => $this->search($terms, $start, $limit, array_merge($options, ['simplify' => true])),
- 'pagination' => [
- 'more' => $paginator->hasNextPage(),
- ],
- ];
- }
+ // format is "json"
+ return [
+ 'results' => $this->search($terms, $start, $limit, array_merge($options, ['simplify' => true])),
+ 'pagination' => [
+ 'more' => $paginator->hasNextPage(),
+ ],
+ ];
}
public function supports($domain, $format)
diff --git a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php
index 5a46edad8..ae967ea8d 100644
--- a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php
+++ b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php
@@ -100,6 +100,9 @@ class ThirdPartySearch implements SearchInterface
'more' => $paginator->hasNextPage(),
];
}
+ if ('html' === $format) {
+ throw new \UnexpectedValueException("format not supported");
+ }
}
public function supports($domain, $format): bool
From 8bec6feb969e1a1e700ba2a5f888e3995277b12e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julien=20Fastr=C3=A9?=
Date: Tue, 11 Apr 2023 22:01:47 +0200
Subject: [PATCH 60/67] DX: fix ci and phpstan issues
---
.../ChillActivityBundle/Tests/Form/ActivityTypeTest.php | 6 +++---
.../ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php | 2 +-
.../ChillThirdPartyBundle/Search/ThirdPartySearch.php | 5 ++---
.../migrations/Version20230215175150.php | 2 +-
4 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/Bundle/ChillActivityBundle/Tests/Form/ActivityTypeTest.php b/src/Bundle/ChillActivityBundle/Tests/Form/ActivityTypeTest.php
index b6cb6fc7b..df0a602a4 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Form/ActivityTypeTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Form/ActivityTypeTest.php
@@ -112,9 +112,9 @@ final class ActivityTypeTest extends KernelTestCase
'attendee' => true,
]]);
-// var_dump($form->getErrors()->count()); var_dump($form->isValid());
-// foreach($form->getErrors() as $e) { fwrite(STDOUT, var_dump($e->getMessage())); }
-// var_dump($form->getErrors());
+ // var_dump($form->getErrors()->count()); var_dump($form->isValid());
+ // foreach($form->getErrors() as $e) { fwrite(STDOUT, var_dump($e->getMessage())); }
+ // var_dump($form->getErrors());
$this->assertTrue($form->isSynchronized(), 'Test the form is synchronized');
$this->assertTrue($form->isValid(), 'test the form is valid');
diff --git a/src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php b/src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php
index c3197936e..76da401a3 100644
--- a/src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php
+++ b/src/Bundle/ChillMainBundle/CRUD/Routing/CRUDRoutesLoader.php
@@ -101,7 +101,7 @@ class CRUDRoutesLoader extends Loader
$singleCollection = $action['single_collection'] ?? '_entity' === $name ? 'single' : null;
if ('collection' === $singleCollection) {
-// continue;
+ // continue;
}
// compute default action
diff --git a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php
index ae967ea8d..2c7948a2d 100644
--- a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php
+++ b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php
@@ -100,9 +100,8 @@ class ThirdPartySearch implements SearchInterface
'more' => $paginator->hasNextPage(),
];
}
- if ('html' === $format) {
- throw new \UnexpectedValueException("format not supported");
- }
+ // format "html"
+ throw new \UnexpectedValueException("format html not supported");
}
public function supports($domain, $format): bool
diff --git a/src/Bundle/ChillThirdPartyBundle/migrations/Version20230215175150.php b/src/Bundle/ChillThirdPartyBundle/migrations/Version20230215175150.php
index 223c9aeae..fefe1c339 100644
--- a/src/Bundle/ChillThirdPartyBundle/migrations/Version20230215175150.php
+++ b/src/Bundle/ChillThirdPartyBundle/migrations/Version20230215175150.php
@@ -25,7 +25,7 @@ final class Version20230215175150 extends AbstractMigration implements Container
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_3party.third_party DROP profession');
-// $this->addSql('ALTER TABLE chill_3party.third_party ADD profession_id INT DEFAULT NULL');
+ // $this->addSql('ALTER TABLE chill_3party.third_party ADD profession_id INT DEFAULT NULL');
}
public function getDescription(): string
From 2a4b73457bccc70cabb47e6ca927f38325dd0104 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julien=20Fastr=C3=A9?=
Date: Wed, 12 Apr 2023 17:48:02 +0200
Subject: [PATCH 61/67] DX: fix phpstan issues
---
.../Service/DocGenerator/ActivityContext.php | 3 --
...tActivitiesByAccompanyingPeriodContext.php | 4 ---
.../Service/DocGenerator/CalendarContext.php | 12 +------
.../DocGenerator/CalendarContextInterface.php | 33 ++-----------------
...GeneratorContextWithAdminFormInterface.php | 4 +++
...eneratorContextWithPublicFormInterface.php | 3 +-
6 files changed, 10 insertions(+), 49 deletions(-)
diff --git a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php
index d577fd911..ad570a8a4 100644
--- a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php
+++ b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php
@@ -240,9 +240,6 @@ class ActivityContext implements
return $options['mainPerson'] || $options['person1'] || $options['person2'];
}
- /**
- * @param Activity $entity
- */
public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void
{
$storedObject->setTitle($this->translatableStringHelper->localize($template->getName()));
diff --git a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php
index f1951978c..e10ee3da4 100644
--- a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php
+++ b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php
@@ -53,8 +53,6 @@ class ListActivitiesByAccompanyingPeriodContext implements
private PersonRepository $personRepository;
- private Security $security;
-
private SocialActionRepository $socialActionRepository;
private SocialIssueRepository $socialIssueRepository;
@@ -75,7 +73,6 @@ class ListActivitiesByAccompanyingPeriodContext implements
ThirdPartyRepository $thirdPartyRepository,
TranslatableStringHelperInterface $translatableStringHelper,
UserRepository $userRepository,
- Security $security
) {
$this->accompanyingPeriodContext = $accompanyingPeriodContext;
$this->activityACLAwareRepository = $activityACLAwareRepository;
@@ -86,7 +83,6 @@ class ListActivitiesByAccompanyingPeriodContext implements
$this->thirdPartyRepository = $thirdPartyRepository;
$this->translatableStringHelper = $translatableStringHelper;
$this->userRepository = $userRepository;
- $this->security = $security;
}
public function adminFormReverseTransform(array $data): array
diff --git a/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php b/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php
index f5b244027..cabb7dcce 100644
--- a/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php
+++ b/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php
@@ -31,8 +31,6 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
use function count;
-/**
- */
final class CalendarContext implements CalendarContextInterface
{
private BaseContextData $baseContextData;
@@ -150,10 +148,8 @@ final class CalendarContext implements CalendarContextInterface
}
/**
- * param array{mainPerson?: Person, thirdParty?: ThirdParty, title: string} $contextGenerationData
- * @param mixed $entity
*/
- public function getData(DocGeneratorTemplate $template, $entity, array $contextGenerationData = []): array
+ public function getData(DocGeneratorTemplate $template, mixed $entity, array $contextGenerationData = []): array
{
$options = $this->getOptions($template);
@@ -274,9 +270,6 @@ final class CalendarContext implements CalendarContextInterface
return $denormalized;
}
- /**
- * param array{mainPerson?: Person, thirdParty?: ThirdParty, title: string} $contextGenerationData
- */
public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void
{
$options = $this->getOptions($template);
@@ -287,9 +280,6 @@ final class CalendarContext implements CalendarContextInterface
$this->entityManager->persist($doc);
}
- /**
- * return array{askMainPerson: bool, mainPersonLabel: ?string, askThirdParty: bool, thirdPartyLabel: ?string, trackDateTime: bool} $options
- */
private function getOptions(DocGeneratorTemplate $template): array
{
return $template->getOptions();
diff --git a/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContextInterface.php b/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContextInterface.php
index 4ae85d33a..527203003 100644
--- a/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContextInterface.php
+++ b/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContextInterface.php
@@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Chill\CalendarBundle\Service\DocGenerator;
use Chill\CalendarBundle\Entity\Calendar;
+use Chill\DocGeneratorBundle\Context\DocGeneratorContextInterface;
use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithAdminFormInterface;
use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithPublicFormInterface;
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
@@ -19,37 +20,9 @@ use Chill\DocStoreBundle\Entity\StoredObject;
use Symfony\Component\Form\FormBuilderInterface;
/**
- * @template-extends DocGeneratorContextWithPublicFormInterface
+ * @extends DocGeneratorContextWithPublicFormInterface
+ * @extends DocGeneratorContextWithAdminFormInterface
*/
interface CalendarContextInterface extends DocGeneratorContextWithPublicFormInterface, DocGeneratorContextWithAdminFormInterface
{
- public function adminFormReverseTransform(array $data): array;
-
- public function adminFormTransform(array $data): array;
-
- public function buildAdminForm(FormBuilderInterface $builder): void;
-
- public function buildPublicForm(FormBuilderInterface $builder, DocGeneratorTemplate $template, $entity): void;
-
- public function getData(DocGeneratorTemplate $template, $entity, array $contextGenerationData = []): array;
-
- public function getDescription(): string;
-
- public function getEntityClass(): string;
-
- public function getFormData(DocGeneratorTemplate $template, $entity): array;
-
- public static function getKey(): string;
-
- public function getName(): string;
-
- public function hasAdminForm(): bool;
-
- public function hasPublicForm(DocGeneratorTemplate $template, $entity): bool;
-
- public function contextGenerationDataNormalize(DocGeneratorTemplate $template, $entity, array $data): array;
-
- public function contextGenerationDataDenormalize(DocGeneratorTemplate $template, $entity, array $data): array;
-
- public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void;
}
diff --git a/src/Bundle/ChillDocGeneratorBundle/Context/DocGeneratorContextWithAdminFormInterface.php b/src/Bundle/ChillDocGeneratorBundle/Context/DocGeneratorContextWithAdminFormInterface.php
index 4707bf398..732d4b796 100644
--- a/src/Bundle/ChillDocGeneratorBundle/Context/DocGeneratorContextWithAdminFormInterface.php
+++ b/src/Bundle/ChillDocGeneratorBundle/Context/DocGeneratorContextWithAdminFormInterface.php
@@ -13,6 +13,10 @@ namespace Chill\DocGeneratorBundle\Context;
use Symfony\Component\Form\FormBuilderInterface;
+/**
+ * @template T of object
+ * @extends DocGeneratorContextInterface
+ */
interface DocGeneratorContextWithAdminFormInterface extends DocGeneratorContextInterface
{
public function adminFormReverseTransform(array $data): array;
diff --git a/src/Bundle/ChillDocGeneratorBundle/Context/DocGeneratorContextWithPublicFormInterface.php b/src/Bundle/ChillDocGeneratorBundle/Context/DocGeneratorContextWithPublicFormInterface.php
index a60a35123..496524206 100644
--- a/src/Bundle/ChillDocGeneratorBundle/Context/DocGeneratorContextWithPublicFormInterface.php
+++ b/src/Bundle/ChillDocGeneratorBundle/Context/DocGeneratorContextWithPublicFormInterface.php
@@ -15,7 +15,8 @@ use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
use Symfony\Component\Form\FormBuilderInterface;
/**
- * @template T
+ * @template T of object
+ * @extends DocGeneratorContextInterface
*/
interface DocGeneratorContextWithPublicFormInterface extends DocGeneratorContextInterface
{
From d0830079da1b1ed0a2a943ab83393519d7ffc8ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julien=20Fastr=C3=A9?=
Date: Wed, 12 Apr 2023 18:17:48 +0200
Subject: [PATCH 62/67] DX: fix generation in test mode
---
...istActivitiesByAccompanyingPeriodContext.php | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php
index e10ee3da4..266fadfee 100644
--- a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php
+++ b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php
@@ -36,11 +36,14 @@ use DateTime;
use libphonenumber\PhoneNumber;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\FormBuilderInterface;
-use Symfony\Component\Security\Core\Security;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
use function in_array;
+/**
+ * @implements DocGeneratorContextWithPublicFormInterface
+ * @implements DocGeneratorContextWithAdminFormInterface
+ */
class ListActivitiesByAccompanyingPeriodContext implements
DocGeneratorContextWithAdminFormInterface,
DocGeneratorContextWithPublicFormInterface
@@ -132,13 +135,13 @@ class ListActivitiesByAccompanyingPeriodContext implements
$normalized = $this->accompanyingPeriodContext->contextGenerationDataNormalize($template, $entity, $data);
foreach (['myActivitiesOnly', 'myWorksOnly'] as $k) {
- $normalized[$k] = null !== ($data[$k] ?? null) ? $data[$k] : false;
+ $normalized[$k] = $data[$k] ?? false;
}
return $normalized;
}
- public function filterActivitiesByUser(array $activities, User $user): array
+ private function filterActivitiesByUser(array $activities, User $user): array
{
return array_filter(
$activities,
@@ -151,7 +154,7 @@ class ListActivitiesByAccompanyingPeriodContext implements
);
}
- public function filterWorksByUser(array $works, User $user): array
+ private function filterWorksByUser(array $works, User $user): array
{
return array_filter(
$works,
@@ -165,14 +168,14 @@ class ListActivitiesByAccompanyingPeriodContext implements
);
}
- public function getData(DocGeneratorTemplate $template, $entity, array $contextGenerationData = []): array
+ public function getData(DocGeneratorTemplate $template, object $entity, array $contextGenerationData = []): array
{
$data = $this->accompanyingPeriodContext->getData($template, $entity, $contextGenerationData);
$activities = $this->getActivitiesSimplified($entity);
$myActivitiesOnly = $contextGenerationData['myActivitiesOnly'];
- if ($myActivitiesOnly) {
+ if ($myActivitiesOnly && isset($contextGenerationData['creator'])) {
$activities = $this->filterActivitiesByUser($activities, $contextGenerationData['creator']);
}
@@ -180,7 +183,7 @@ class ListActivitiesByAccompanyingPeriodContext implements
$myWorksOnly = $contextGenerationData['myWorksOnly'];
- if ($myWorksOnly) {
+ if ($myWorksOnly && isset($contextGenerationData['creator'])) {
$data['course']['works'] = $this->filterWorksByUser($data['course']['works'], $contextGenerationData['creator']);
}
return $data;
From a553dc9aab8684682a40ffa4b4e690be948f5b65 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julien=20Fastr=C3=A9?=
Date: Wed, 12 Apr 2023 18:18:08 +0200
Subject: [PATCH 63/67] =?UTF-8?q?UI:=20fix=20replacement=20Activit=C3=A9?=
=?UTF-8?q?=20=3D>=20=C3=A9change=20in=20french=20translations?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Bundle/ChillActivityBundle/translations/messages.fr.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml
index c90478785..b64635f69 100644
--- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml
+++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml
@@ -326,9 +326,9 @@ This is the minimal activity data: Activité n°
docgen:
Activity basic: Echange
- A basic context for activity: Contexte pour les activités
- Accompanying period with a list of activities: Parcours d'accompagnement avec liste des activités
- Accompanying period with a list of activities description: Ce contexte reprend les informations du parcours, et tous les activités pour un parcours. Les activités ne sont pas filtrés.
+ A basic context for activity: Contexte pour les échanges
+ Accompanying period with a list of activities: Parcours d'accompagnement avec liste des échanges
+ Accompanying period with a list of activities description: Ce contexte reprend les informations du parcours, et tous les échanges pour un parcours. Les échanges ne sont pas filtrés.
myActivitiesOnly: Prendre en compte uniquement les échanges dans lesquels je suis intervenu
myWorksOnly: Prendre en compte uniquement les actions d'accompagnement dont je suis référent
From 1cd153fb78827d295202d871b2ae73315b47176b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julien=20Fastr=C3=A9?=
Date: Thu, 13 Apr 2023 09:58:22 +0200
Subject: [PATCH 64/67] DX: fix CS
---
.../Workflow/Notification/WorkflowNotificationHandler.php | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php b/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php
index 438e4c0e3..d3e848d41 100644
--- a/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php
+++ b/src/Bundle/ChillMainBundle/Workflow/Notification/WorkflowNotificationHandler.php
@@ -30,8 +30,7 @@ class WorkflowNotificationHandler implements NotificationHandlerInterface
EntityWorkflowRepository $entityWorkflowRepository,
EntityWorkflowManager $entityWorkflowManager,
Security $security
- )
- {
+ ) {
$this->entityWorkflowRepository = $entityWorkflowRepository;
$this->entityWorkflowManager = $entityWorkflowManager;
$this->security = $security;
From 63759a940f27c157a1686ac23d14c02b2338a9bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julien=20Fastr=C3=A9?=
Date: Thu, 13 Apr 2023 12:21:48 +0200
Subject: [PATCH 65/67] Feature: [homepage] group the counter of tasks in
warning and alert state into one counter
---
.../Resources/public/vuejs/HomepageWidget/App.vue | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/App.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/App.vue
index fbf453b47..5f0526729 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/App.vue
+++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/App.vue
@@ -46,8 +46,7 @@
:class="{'active': activeTab === 'MyTasks'}"
@click="selectTab('MyTasks')">
{{ $t('my_tasks.tab') }}
-
-
+
From a21637331fe61f70be7907496c8e622d247e2a34 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julien=20Fastr=C3=A9?=
Date: Thu, 13 Apr 2023 12:24:44 +0200
Subject: [PATCH 66/67] Fixed: [workflow] validation of users in cc and dest
The validation is processed at the form step, so before the transition is processed
---
.../Controller/WorkflowController.php | 6 ++-
.../Entity/Workflow/EntityWorkflow.php | 4 +-
.../Entity/Workflow/EntityWorkflowStep.php | 2 -
.../ChillMainBundle/Form/WorkflowStepType.php | 14 ++++++
.../Constraints/Entity/WorkflowStepUsers.php | 27 ------------
.../Entity/WorkflowStepUsersValidator.php | 43 -------------------
.../translations/validators.fr.yml | 3 +-
7 files changed, 24 insertions(+), 75 deletions(-)
delete mode 100644 src/Bundle/ChillMainBundle/Validator/Constraints/Entity/WorkflowStepUsers.php
delete mode 100644 src/Bundle/ChillMainBundle/Validator/Constraints/Entity/WorkflowStepUsersValidator.php
diff --git a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php
index 789e8dc34..ee09cc1a6 100644
--- a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php
+++ b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php
@@ -333,7 +333,11 @@ class WorkflowController extends AbstractController
$transitionForm = $this->createForm(
WorkflowStepType::class,
$entityWorkflow->getCurrentStep(),
- ['transition' => true, 'entity_workflow' => $entityWorkflow, 'suggested_users' => $usersInvolved]
+ [
+ 'transition' => true,
+ 'entity_workflow' => $entityWorkflow,
+ 'suggested_users' => $usersInvolved
+ ]
);
$transitionForm->handleRequest($request);
diff --git a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php
index 73f4c2b04..d0f558cd5 100644
--- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php
+++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php
@@ -16,6 +16,7 @@ use Chill\MainBundle\Doctrine\Model\TrackCreationTrait;
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
use Chill\MainBundle\Entity\User;
+use Chill\MainBundle\Validator\Constraints\Entity\WorkflowStepUsersOnTransition;
use Chill\MainBundle\Workflow\Validator\EntityWorkflowCreation;
use DateTimeInterface;
use Doctrine\Common\Collections\ArrayCollection;
@@ -24,6 +25,7 @@ use Doctrine\ORM\Mapping as ORM;
use Iterator;
use RuntimeException;
use Symfony\Component\Serializer\Annotation as Serializer;
+use Symfony\Component\Validator\Constraints as Assert;
use function count;
use function is_array;
@@ -97,7 +99,7 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
/**
* @ORM\OneToMany(targetEntity=EntityWorkflowStep::class, mappedBy="entityWorkflow", orphanRemoval=true, cascade={"persist"})
* @ORM\OrderBy({"transitionAt": "ASC", "id": "ASC"})
- *
+ * @Assert\Valid(traverse=true)
* @var Collection|EntityWorkflowStep[]
*/
private Collection $steps;
diff --git a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php
index 39729aa96..e43d524a4 100644
--- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php
+++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php
@@ -12,7 +12,6 @@ declare(strict_types=1);
namespace Chill\MainBundle\Entity\Workflow;
use Chill\MainBundle\Entity\User;
-use Chill\MainBundle\Validator\Constraints\Entity\WorkflowStepUsers;
use DateTimeImmutable;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
@@ -25,7 +24,6 @@ use function in_array;
/**
* @ORM\Entity
* @ORM\Table("chill_main_workflow_entity_step")
- * @WorkflowStepUsers()
*/
class EntityWorkflowStep
{
diff --git a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php
index 3ef37c03a..16dc0a4a5 100644
--- a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php
+++ b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php
@@ -243,6 +243,20 @@ class WorkflowStepType extends AbstractType
}
}
),
+ new Callback(
+ function ($step, ExecutionContextInterface $context, $payload) {
+ $form = $context->getObject();
+
+ foreach($form->get('future_dest_users')->getData() as $u) {
+ if (in_array($u, $form->get('future_cc_users')->getData(), true)) {
+ $context
+ ->buildViolation('workflow.The user in cc cannot be a dest user in the same workflow step')
+ ->atPath('ccUsers')
+ ->addViolation();
+ }
+ }
+ }
+ )
]);
}
}
diff --git a/src/Bundle/ChillMainBundle/Validator/Constraints/Entity/WorkflowStepUsers.php b/src/Bundle/ChillMainBundle/Validator/Constraints/Entity/WorkflowStepUsers.php
deleted file mode 100644
index 842df37cf..000000000
--- a/src/Bundle/ChillMainBundle/Validator/Constraints/Entity/WorkflowStepUsers.php
+++ /dev/null
@@ -1,27 +0,0 @@
-getDestUser() as $u) {
- if ($value->getCcUser()->contains($u)) {
- $this->context
- ->buildViolation($constraint->message)
- ->atPath('ccUsers')
- ->addViolation();
- }
- }
- }
-}
diff --git a/src/Bundle/ChillMainBundle/translations/validators.fr.yml b/src/Bundle/ChillMainBundle/translations/validators.fr.yml
index 31d3bdc73..4ab9bde34 100644
--- a/src/Bundle/ChillMainBundle/translations/validators.fr.yml
+++ b/src/Bundle/ChillMainBundle/translations/validators.fr.yml
@@ -33,6 +33,7 @@ notification:
workflow:
You must add at least one dest user or email: Indiquez au moins un destinataire ou une adresse email
+ The user in cc cannot be a dest user in the same workflow step: L'utilisateur en copie ne peut pas être présent dans les utilisateurs qui valideront la prochaine étape
rolling_date:
- When fixed date is selected, you must provide a date: Indiquez la date fixe choisie
\ No newline at end of file
+ When fixed date is selected, you must provide a date: Indiquez la date fixe choisie
From a9fe8349786509dd87cd85cb9c10b89f4e4ff945 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julien=20Fastr=C3=A9?=
Date: Thu, 13 Apr 2023 12:25:06 +0200
Subject: [PATCH 67/67] Fixed: [homepage] count also workflows in cc
---
.../Resources/public/vuejs/HomepageWidget/App.vue | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/App.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/App.vue
index 5f0526729..315fd863f 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/App.vue
+++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/App.vue
@@ -54,7 +54,7 @@
:class="{'active': activeTab === 'MyWorkflows'}"
@click="selectTab('MyWorkflows')">
{{ $t('my_workflows.tab') }}
-
+
@@ -149,4 +149,4 @@ export default {
a.nav-link {
cursor: pointer;
}
-
\ No newline at end of file
+