From 2fe77f2610c8075a5685fd937270b9a3a361fd79 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 8 Mar 2023 19:45:33 +0100 Subject: [PATCH 01/37] UX [admin][templates] fix styles on permissionsgroup pages for standard acl model (not vendee) --- .../views/PermissionsGroup/edit.html.twig | 47 +++++++++---------- .../views/PermissionsGroup/index.html.twig | 2 +- .../views/PermissionsGroup/show.html.twig | 16 +++---- 3 files changed, 29 insertions(+), 36 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig index 0f854f7ed..a7875c4ff 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig @@ -12,7 +12,7 @@ {% if edit_form.flags is defined %} {{ form_row(edit_form.flags) }} {% endif %} - {{ form_row(edit_form.submit, { 'attr': { 'class': 'btn btn-chill-green' } } ) }} + {{ form_row(edit_form.submit, { 'attr': { 'class': 'btn btn-save float-end' } } ) }} {{ form_end(edit_form) }}

{{ 'Grant those permissions'|trans }} :

@@ -22,7 +22,7 @@

{{ title|default("Unclassified")|trans }}

- +
@@ -41,7 +41,7 @@ {{ 'Which implies'|trans }} : {% for role in expanded_roles[role_scope.role] %}{{ role|trans }}{% if not loop.last %}, {% endif %}{% endfor %} {% endif %} - - @@ -66,30 +66,25 @@

{{ 'This group does not provide any permission'|trans }}

{%- endif -%} -
-

{{ 'Grant new permissions'|trans }}

- {{ form_start(add_role_scopes_form) }} - {{ form_errors(add_role_scopes_form) }} - {{ form_row(add_role_scopes_form.composed_role_scope.role) }} - {{ form_row(add_role_scopes_form.composed_role_scope.scope) }} +

{{ 'Grant new permissions'|trans }}

- + {{ form_start(add_role_scopes_form) }} + {{ form_errors(add_role_scopes_form) }} + {{ form_row(add_role_scopes_form.composed_role_scope.role) }} + {{ form_row(add_role_scopes_form.composed_role_scope.scope) }} - {{ form_end(add_role_scopes_form) }} -
+ + {{ form_end(add_role_scopes_form) }} {% endblock %} diff --git a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/index.html.twig b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/index.html.twig index 1b35e9799..06ddb94f5 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/index.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/index.html.twig @@ -5,7 +5,7 @@ {% block admin_content -%}

{{ 'Permissions group list'|trans }}

-
{{ 'Role'|trans }} + {%- if role_scope.scope is not null -%} {{ role_scope.scope.name|localize_translatable_string }} @@ -50,9 +50,9 @@ N/A {%- endif -%} + {{ form_start(delete_role_scopes_form[role_scope.id]) }} - {{ form_widget(delete_role_scopes_form[role_scope.id].submit, { 'attr': { 'class': 'btn btn-chill-red' } } ) }} + {{ form_widget(delete_role_scopes_form[role_scope.id].submit, { 'attr': { 'class': 'btn btn-remove' } } ) }} {{ form_end(delete_role_scopes_form[role_scope.id]) }}
+
diff --git a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/show.html.twig b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/show.html.twig index eb93c4968..e960c79f7 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/show.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/show.html.twig @@ -18,7 +18,7 @@ {% for title, role_scopes in role_scopes_sorted %}

{{ title|default('Unclassified')|trans }}

-
{{ 'Name'|trans }}
+
@@ -36,7 +36,7 @@ {{ 'Which implies'|trans }} : {% for role in expanded_roles[role_scope.role] %}{{ role|trans }}{% if not loop.last %}, {% endif %}{% endfor %} {% endif %} -
{{ 'Role'|trans }}{%- if role_scope.scope is not null -%} + {%- if role_scope.scope is not null -%} {{ role_scope.scope.name|localize_translatable_string }} {%- else -%} N/A @@ -57,17 +57,15 @@ {% endif %} {% endblock %} From 19e51cc74c891fb085adf15787d8f15b24b5370f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 14 Apr 2023 12:11:04 +0200 Subject: [PATCH 02/37] Fix: new column name in hexasmal data for geographical coordinates --- .../Service/Import/PostalCodeFRFromOpenData.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php index f6cc2bd99..e2d25350d 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php +++ b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php @@ -78,8 +78,8 @@ class PostalCodeFRFromOpenData private function handleRecord(array $record): void { - if ('' !== trim($record['coordonnees_gps'])) { - [$lat, $lon] = array_map(static fn ($el) => (float) trim($el), explode(',', $record['coordonnees_gps'])); + if ('' !== trim($record['coordonnees_geographiques'] ?? $record['coordonnees_gps'])) { + [$lat, $lon] = array_map(static fn ($el) => (float) trim($el), explode(',', $record['coordonnees_geographiques'] ?? $record['coordonnees_gps'])); } else { $lat = $lon = 0.0; } From 91ba0c983d5de10276f120e33999a3c6d11ef998 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 14 Apr 2023 12:23:23 +0200 Subject: [PATCH 03/37] UX: improve admin > permissiongroup templates --- .../translations/messages.fr.yml | 1 + .../Resources/public/chill/chillmain.scss | 6 +++ .../views/PermissionsGroup/edit.html.twig | 50 ++++++++++--------- .../views/PermissionsGroup/index.html.twig | 2 +- .../views/PermissionsGroup/new.html.twig | 7 ++- .../views/PermissionsGroup/show.html.twig | 20 ++++---- .../Resources/views/User/edit.html.twig | 18 +++---- 7 files changed, 60 insertions(+), 44 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index b64635f69..bfa9039e7 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -106,6 +106,7 @@ 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 +CHILL_ACTIVITY_CREATE_PERSON: Créer un échange lié à un usager # admin Activities: Échanges diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss index 3c9fc8601..2523ee202 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/chillmain.scss @@ -375,6 +375,12 @@ span.dt { font-weight: bolder; background-color: var(--bs-chill-light-gray); } +/// help text +.help-text { + margin-top: 0.25rem; + font-size: 0.875em; + color: var(--bs-gray); +} /* diff --git a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig index a7875c4ff..2404c8c0d 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig @@ -3,7 +3,7 @@ {% block title %}{{ 'PermissionsGroup "%name%" edit'|trans( { '%name%': entity.name } ) }}{% endblock %} {% block admin_content -%} -

{{ 'PermissionsGroup "%name%" edit'|trans( { '%name%': entity.name } ) }}

+

{{ 'PermissionsGroup "%name%" edit'|trans( { '%name%': entity.name } ) }}

{{ 'Details'|trans }}

@@ -15,17 +15,17 @@ {{ form_row(edit_form.submit, { 'attr': { 'class': 'btn btn-save float-end' } } ) }} {{ form_end(edit_form) }} -

{{ 'Grant those permissions'|trans }} :

+

{{ 'Grant those permissions'|trans }} :

{%- if entity.getRoleScopes|length > 0 -%} {% for title, role_scopes in role_scopes_sorted %}

{{ title|default("Unclassified")|trans }}

- +
- + @@ -37,9 +37,10 @@
{{ 'Role'|trans }}{{ 'Role'|trans }} {{ 'Circle'|trans }} {{ 'Actions'|trans }}
{{ role_scope.role|trans }} {% if expanded_roles[role_scope.role]|length > 1 %} -
- {{ 'Which implies'|trans }} : {% for role in expanded_roles[role_scope.role] %}{{ role|trans }}{% if not loop.last %}, {% endif %}{% endfor %} - {% endif %} +
+ {{ 'Which implies'|trans }} : {% for role in expanded_roles[role_scope.role] %}{{ role|trans }}{% if not loop.last %}, {% endif %}{% endfor %} +
+ {% endif %}
{%- if role_scope.scope is not null -%} @@ -66,25 +67,28 @@

{{ 'This group does not provide any permission'|trans }}

{%- endif -%} +
+

{{ 'Grant new permissions'|trans }}

-

{{ 'Grant new permissions'|trans }}

+ {{ form_start(add_role_scopes_form) }} + {{ form_errors(add_role_scopes_form) }} + {{ form_row(add_role_scopes_form.composed_role_scope.role) }} + {{ form_row(add_role_scopes_form.composed_role_scope.scope) }} - {{ form_start(add_role_scopes_form) }} - {{ form_errors(add_role_scopes_form) }} - {{ form_row(add_role_scopes_form.composed_role_scope.role) }} - {{ form_row(add_role_scopes_form.composed_role_scope.scope) }} + - + {{ form_end(add_role_scopes_form) }} +
- {{ form_end(add_role_scopes_form) }} {% endblock %} diff --git a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/index.html.twig b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/index.html.twig index 06ddb94f5..6741898e3 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/index.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/index.html.twig @@ -5,7 +5,7 @@ {% block admin_content -%}

{{ 'Permissions group list'|trans }}

- +
diff --git a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/new.html.twig b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/new.html.twig index 921db8e6d..f8a1f7c31 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/new.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/new.html.twig @@ -10,8 +10,6 @@ {% if form.flags is defined %} {{ form_row(form.flags) }} {% endif %} - {{ form_row(form.submit, { 'attr': { 'class': 'btn btn-chill-green' } } ) }} - {{ form_end(form) }}
  • @@ -19,5 +17,10 @@ {{ 'Back to the list'|trans }}
  • +
  • + {{ form_widget(form.submit, { 'attr': { 'class': 'btn btn-create' } } ) }} +
+ + {{ form_end(form) }} {% endblock %} diff --git a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/show.html.twig b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/show.html.twig index e960c79f7..1271d2d60 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/show.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/show.html.twig @@ -3,26 +3,27 @@ {% block title %}{{ 'Permission group "%name%"'|trans({ '%name%': entity.name }) }}{% endblock %} {% block admin_content -%} -

{{ 'Permission group "%name%"'|trans({ '%name%': entity.name }) }}

+

{{ 'Permission group "%name%"'|trans({ '%name%': entity.name }) }}

-
{{ 'Name'|trans }}
+
- +
{{ 'Name'|trans }}{{ entity.name }}{{ entity.name }}
+ {% if role_scopes_sorted|length > 0 %} -

{{ 'Grant those permissions'|trans }} :

+

{{ 'Grant those permissions'|trans }} :

{% for title, role_scopes in role_scopes_sorted %}

{{ title|default('Unclassified')|trans }}

- +
- + @@ -32,14 +33,15 @@ diff --git a/src/Bundle/ChillMainBundle/Resources/views/User/edit.html.twig b/src/Bundle/ChillMainBundle/Resources/views/User/edit.html.twig index 0ecbdef9f..efbdc60d4 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/User/edit.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/User/edit.html.twig @@ -7,7 +7,7 @@

{{ 'Permissions granted'|trans }}

{% if entity.groupcenters|length > 0 %} -
{{ 'Role'|trans }}{{ 'Circle'|trans }}{{ 'Circle'|trans }}
{{ role_scope.role|trans }} {% if expanded_roles[role_scope.role]|length > 1 %} -
- {{ 'Which implies'|trans }} : {% for role in expanded_roles[role_scope.role] %}{{ role|trans }}{% if not loop.last %}, {% endif %}{% endfor %} +
+ {{ 'Which implies'|trans }} : {% for role in expanded_roles[role_scope.role] %}{{ role|trans }}{% if not loop.last %}, {% endif %}{% endfor %} +
{% endif %}
{%- if role_scope.scope is not null -%} {{ role_scope.scope.name|localize_translatable_string }} {%- else -%} - N/A + N/A {%- endif -%}
+
@@ -19,18 +19,18 @@ {% for groupcenter in entity.groupcenters %} @@ -47,7 +47,7 @@ {{ form_start(add_groupcenter_form) }} {{ form_row(add_groupcenter_form.composed_groupcenter.center) }} {{ form_row(add_groupcenter_form.composed_groupcenter.permissionsgroup) }} - {{ form_row(add_groupcenter_form.submit, { 'attr' : { 'class': 'btn btn-chill-green' } } ) }} + {{ form_row(add_groupcenter_form.submit, { 'attr' : { 'class': 'btn btn-create' } } ) }} {{ form_end(add_groupcenter_form) }} {% endif %} From 0af13b028e1d13e377f5ed4b5adb0445bb31d51a Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 14 Apr 2023 12:47:59 +0200 Subject: [PATCH 04/37] UX: improve admin templates --- .../views/DocGeneratorTemplate/index.html.twig | 4 +--- .../views/DocumentCategory/index.html.twig | 6 +++--- .../Resources/views/CRUD/_edit_content.html.twig | 2 +- .../Resources/views/CRUD/_index.html.twig | 2 +- .../Resources/views/User/edit.html.twig | 6 +++--- .../Resources/views/User/index.html.twig | 15 ++++++++------- .../Resources/views/UserJob/index.html.twig | 10 +++++----- 7 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/Bundle/ChillDocGeneratorBundle/Resources/views/DocGeneratorTemplate/index.html.twig b/src/Bundle/ChillDocGeneratorBundle/Resources/views/DocGeneratorTemplate/index.html.twig index 73527edb3..1adb6872b 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Resources/views/DocGeneratorTemplate/index.html.twig +++ b/src/Bundle/ChillDocGeneratorBundle/Resources/views/DocGeneratorTemplate/index.html.twig @@ -27,9 +27,7 @@ {% endfor %} diff --git a/src/Bundle/ChillDocStoreBundle/Resources/views/DocumentCategory/index.html.twig b/src/Bundle/ChillDocStoreBundle/Resources/views/DocumentCategory/index.html.twig index 5731f57f5..ff20257a5 100644 --- a/src/Bundle/ChillDocStoreBundle/Resources/views/DocumentCategory/index.html.twig +++ b/src/Bundle/ChillDocStoreBundle/Resources/views/DocumentCategory/index.html.twig @@ -5,14 +5,14 @@ {% block admin_content %}

{{ 'Document category list' | trans }}

-
{{ 'Permission group'|trans }}
- - {{ groupcenter.permissionsgroup.name }} - + + {{ groupcenter.permissionsgroup.name }} + - - {{ groupcenter.center.name }} - + + {{ groupcenter.center.name }} + {{ form_start(delete_groupcenter_form[groupcenter.id]) }} - {{ form_row(delete_groupcenter_form[groupcenter.id].submit, { 'attr': { 'class': 'btn btn-chill-red' } } ) }} + {{ form_row(delete_groupcenter_form[groupcenter.id].submit, { 'attr': { 'class': 'btn btn-remove' } } ) }} {{ form_rest(delete_groupcenter_form[groupcenter.id]) }} {{ form_end(delete_groupcenter_form[groupcenter.id]) }} - - {{ 'Edit'|trans }} - +
+
- + @@ -23,7 +23,7 @@ -
{{ 'Creator bundle id' | trans }} {{ 'Internal id inside creator bundle' | trans }} {{ 'Document class' | trans }} {{ 'Name' | trans }}{{ 'Actions' | trans }}{{ 'Actions' | trans }}
{{ document_category.documentClass }} {{ document_category.name | localize_translatable_string}} + {{ ('crud.'~crud_name~'.title_edit')|trans }} +

{{ ('crud.'~crud_name~'.title_edit')|trans }}

{% endblock crud_content_header %} {% block crud_content_form %} diff --git a/src/Bundle/ChillMainBundle/Resources/views/CRUD/_index.html.twig b/src/Bundle/ChillMainBundle/Resources/views/CRUD/_index.html.twig index eaacc1f73..81e29a52e 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/CRUD/_index.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/CRUD/_index.html.twig @@ -14,7 +14,7 @@ {% endblock %} {% else %} {% block table_entities %} - +
{% block table_entities_thead_tr %} diff --git a/src/Bundle/ChillMainBundle/Resources/views/User/edit.html.twig b/src/Bundle/ChillMainBundle/Resources/views/User/edit.html.twig index efbdc60d4..4ac863ee6 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/User/edit.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/User/edit.html.twig @@ -4,7 +4,7 @@ {% embed '@ChillMain/CRUD/_edit_content.html.twig' %} {% block crud_content_after_form %} {% if access_permissions_group_list %} -

{{ 'Permissions granted'|trans }}

+

{{ 'Permissions granted'|trans }}

{% if entity.groupcenters|length > 0 %}
@@ -28,9 +28,9 @@ {{ groupcenter.center.name }} - diff --git a/src/Bundle/ChillMainBundle/Resources/views/User/index.html.twig b/src/Bundle/ChillMainBundle/Resources/views/User/index.html.twig index b57e17c06..e4e7d70d8 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/User/index.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/User/index.html.twig @@ -69,19 +69,20 @@ {% endblock %} - + {% block table_entities_tbody %} {% for entity in entities %} @@ -25,19 +25,19 @@ {% endfor %} {% endblock %} - + {% block actions_before %}
  • {{'Back to the admin'|trans}}
  • {% endblock %} - + {% endembed %} {% endblock %} From d759b9c727cbda1e7cb39df6a2474d2596aba6cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 14 Apr 2023 13:11:29 +0200 Subject: [PATCH 05/37] Fixed: [import social work metadata] make association from parent/child SocialIssue and SocialAction on the owning side --- .../ChillPersonBundle/Service/Import/SocialWorkMetadata.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php b/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php index f1050b134..3d7b60254 100644 --- a/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php +++ b/src/Bundle/ChillPersonBundle/Service/Import/SocialWorkMetadata.php @@ -287,7 +287,7 @@ final class SocialWorkMetadata implements SocialWorkMetadataInterface $return['socialActionChild'] = $previousSocialActionChild; } else { $return['socialActionChild'] = $child = (new SocialAction())->setTitle(['fr' => $socialActionChildTitle]); - $parent->addChild($child); + $child->setParent($parent); $child->setIssue($socialIssue)->setOrdering($orderingChild); $this->entityManager->persist($child); } @@ -332,7 +332,7 @@ final class SocialWorkMetadata implements SocialWorkMetadataInterface } elseif (null !== $socialIssueChildTitle) { $return['socialIssueChild'] = $child = (new SocialIssue())->setTitle(['fr' => $socialIssueChildTitle]) ->setOrdering($orderingChild); - $parent->addChild($child); + $child->setParent($parent); $this->entityManager->persist($child); } else { $return['socialIssueChild'] = null; From 318a84e04da8a55f672b1a9d9e0c46e6ce867aae Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 14 Apr 2023 13:22:31 +0200 Subject: [PATCH 06/37] permissiongroup: complete translation, remove itself role in 'which implies' --- .../ChillActivityBundle/translations/messages.fr.yml | 2 ++ .../Resources/views/PermissionsGroup/edit.html.twig | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index bfa9039e7..0a7aacfd8 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -107,6 +107,8 @@ CHILL_ACTIVITY_DELETE: Supprimer un échange CHILL_ACTIVITY_STATS: Statistique des échanges CHILL_ACTIVITY_LIST: Liste des échanges CHILL_ACTIVITY_CREATE_PERSON: Créer un échange lié à un usager +CHILL_ACTIVITY_CREATE_ACCOMPANYING_COURSE: Créer un échange lié à un parcours +CHILL_ACTIVITY_FULL: Voir les détails, créer, supprimer et mettre à jour un échange # admin Activities: Échanges diff --git a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig index 2404c8c0d..a4c1e76fe 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig @@ -38,7 +38,13 @@ {{ role_scope.role|trans }} {% if expanded_roles[role_scope.role]|length > 1 %}
    - {{ 'Which implies'|trans }} : {% for role in expanded_roles[role_scope.role] %}{{ role|trans }}{% if not loop.last %}, {% endif %}{% endfor %} + {{ 'Which implies'|trans }} : + {% for role in expanded_roles[role_scope.role] %} + {% if role != role_scope.role %} + {{ role|trans }} + {% if not loop.last %}, {% endif %} + {% endif %} + {% endfor %}
    {% endif %} From 8042edc13c3f22b6c0e63d27c2f593d5d3fbfb59 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 14 Apr 2023 13:55:54 +0200 Subject: [PATCH 07/37] UX: [permissiongroup] fix form with new sticky-form class --- .../public/chill/scss/record_actions.scss | 40 ++++++++++++++----- .../views/PermissionsGroup/edit.html.twig | 2 +- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/record_actions.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/record_actions.scss index b8f60e250..57be7c8b4 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/record_actions.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/record_actions.scss @@ -1,3 +1,11 @@ +/// mixin to set sticky area on bottom when scrolling +@mixin sticky-bottom { + position: sticky; + bottom: 0; + margin-top: 4em; + z-index: 1000; +} + ul.record_actions { display: flex; flex-direction: row; @@ -53,16 +61,30 @@ ul.record_actions { } } } + +.sticky-form { + background-color: $white; + padding: 1em; + margin: -1em; + border-top: 1px solid $chill-ll-gray; + @include sticky-bottom; + + .sticky-form-buttons { + position: initial; + bottom: unset; + margin-top: unset; + z-index: unset; + } +} + .sticky-form-buttons { - margin-top: 4em; - background-color: $beige; - position: sticky; - bottom: 0.3em; - text-align: center; - display: flex; - padding: 0.8em 1.6em; - border-radius: 0; - z-index: 1000; + display: flex; + background-color: $beige; + text-align: center; + padding: 0.8em 1.6em; + border-radius: 0; + @include sticky-bottom; + bottom: 0.3em; } /// EXCEPTIONS diff --git a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig index a4c1e76fe..36d0b5404 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig @@ -73,7 +73,7 @@

    {{ 'This group does not provide any permission'|trans }}

    {%- endif -%} -
    +

    {{ 'Grant new permissions'|trans }}

    {{ form_start(add_role_scopes_form) }} From 27415ce86856cd7b2b5a76832836cd9015cb873d Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 14 Apr 2023 14:38:23 +0200 Subject: [PATCH 08/37] UX: [permissiongroup] sticky form more compact, and with help text --- .../ChillMainBundle/Form/Type/ComposedRoleScopeType.php | 1 + .../Resources/views/PermissionsGroup/edit.html.twig | 8 ++++++-- src/Bundle/ChillMainBundle/translations/messages.fr.yml | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php b/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php index 1d541cbd7..627ce596a 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php @@ -88,6 +88,7 @@ class ComposedRoleScopeType extends AbstractType ]) ->add('scope', EntityType::class, [ 'class' => Scope::class, + 'placeholder' => 'Choose amongst scopes', 'choice_label' => static function (Scope $scope) use ($translatableStringHelper) { return $translatableStringHelper->localize($scope->getName()); }, diff --git a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig index 36d0b5404..438bc8289 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig @@ -78,8 +78,12 @@ {{ form_start(add_role_scopes_form) }} {{ form_errors(add_role_scopes_form) }} - {{ form_row(add_role_scopes_form.composed_role_scope.role) }} - {{ form_row(add_role_scopes_form.composed_role_scope.scope) }} + +
    + {{ form_widget(add_role_scopes_form.composed_role_scope.role, { 'attr': { 'class': 'w-50' }}) }} + {{ form_widget(add_role_scopes_form.composed_role_scope.scope) }} +
    +
    {{ 'Help to pick role an scope'|trans }}
    • diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index 369abf628..af1ec5b01 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -168,11 +168,13 @@ New permission group: Nouveau groupe de permissions PermissionsGroup "%name%" edit: Modification du groupe de permission '%name%' Role: Rôle Choose amongst roles: Choisir parmi les rôles +Choose amongst scopes: Choisir un cercle Add permission: Ajouter les permissions This group does not provide any permission: Ce groupe n'attribue aucune permission The role '%role%' has been removed: Le rôle "%role%" a été enlevé de ce groupe de permission The role '%role%' on circle '%scope%' has been removed: Le rôle "%role%" sur le cercle "%scope%" a été enlevé de ce groupe de permission Unclassified: Non classifié +Help to pick role an scope: Les rôles marqués d'un (*) ne nécessitent pas de cercle. #admin section for users User configuration: Gestion des utilisateurs From 324a350bf16515da548748db96b24e2be0fc0247 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 14 Apr 2023 15:14:08 +0200 Subject: [PATCH 09/37] UX: [permissiongroup] improve transition between form and behind content --- .../Resources/public/chill/scss/record_actions.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/record_actions.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/record_actions.scss index 57be7c8b4..c3fe6d65c 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/record_actions.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/record_actions.scss @@ -66,7 +66,7 @@ ul.record_actions { background-color: $white; padding: 1em; margin: -1em; - border-top: 1px solid $chill-ll-gray; + box-shadow: 0 -20px 20px -20px rgba($chill-gray, .5); @include sticky-bottom; .sticky-form-buttons { From 83ce3b3e92606e98d3a1b0780537ec84549eec1e Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 14 Apr 2023 15:28:43 +0200 Subject: [PATCH 10/37] =?UTF-8?q?Use=20=E2=9A=91=20char=20to=20mark=20role?= =?UTF-8?q?s=20without=20scopes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChillActivityBundle/translations/messages.fr.yml | 4 ++-- .../ChillMainBundle/translations/messages.fr.yml | 2 +- .../ChillPersonBundle/translations/messages.fr.yml | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 0a7aacfd8..581df7431 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -104,8 +104,8 @@ 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 +CHILL_ACTIVITY_STATS: Statistique des échanges (⚑) +CHILL_ACTIVITY_LIST: Liste des échanges (⚑) CHILL_ACTIVITY_CREATE_PERSON: Créer un échange lié à un usager CHILL_ACTIVITY_CREATE_ACCOMPANYING_COURSE: Créer un échange lié à un parcours CHILL_ACTIVITY_FULL: Voir les détails, créer, supprimer et mettre à jour un échange diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index af1ec5b01..99ba90310 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -174,7 +174,7 @@ This group does not provide any permission: Ce groupe n'attribue aucune permissi The role '%role%' has been removed: Le rôle "%role%" a été enlevé de ce groupe de permission The role '%role%' on circle '%scope%' has been removed: Le rôle "%role%" sur le cercle "%scope%" a été enlevé de ce groupe de permission Unclassified: Non classifié -Help to pick role an scope: Les rôles marqués d'un (*) ne nécessitent pas de cercle. +Help to pick role an scope: Les rôles marqués d'un (⚑) ne nécessitent pas de cercle. #admin section for users User configuration: Gestion des utilisateurs diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 18e3ab13f..2ca57f5f7 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -308,12 +308,12 @@ Opening the accompanying period: Ouverture d'un parcours d'accompagnement 'Timeline for %name%': 'Historique de %name%' # ROLES -CHILL_PERSON_SEE: Voir les usagers -CHILL_PERSON_UPDATE: Modifier les usagers -CHILL_PERSON_CREATE: Ajouter des usagers -CHILL_PERSON_STATS: Statistiques sur les usagers -CHILL_PERSON_LISTS: Liste des usagers -CHILL_PERSON_DUPLICATE: Gérer les doublons d'usagers +CHILL_PERSON_SEE: Voir les usagers (⚑) +CHILL_PERSON_UPDATE: Modifier les usagers (⚑) +CHILL_PERSON_CREATE: Ajouter des usagers (⚑) +CHILL_PERSON_STATS: Statistiques sur les usagers (⚑) +CHILL_PERSON_LISTS: Liste des usagers (⚑) +CHILL_PERSON_DUPLICATE: Gérer les doublons d'usagers (⚑) CHILL_PERSON_ACCOMPANYING_PERIOD_SEE: Vision simplifiée d'un parcours d'accompagnement CHILL_PERSON_ACCOMPANYING_PERIOD_CONFIDENTIAL: Voir et modifier les parcours d'accompagnement confidentielles From 91d40d91535de36df6f17dd44085991c281e7157 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 14 Apr 2023 16:44:38 +0200 Subject: [PATCH 11/37] =?UTF-8?q?remove=20(=E2=9A=91)=20mark=20in=20added?= =?UTF-8?q?=20roles=20table=20(use=20flag=20only=20in=20form=20select)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Resources/views/PermissionsGroup/edit.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig index 438bc8289..0e1bf4551 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig @@ -35,13 +35,13 @@ {% for role_scope in role_scopes %}
    diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index 99ba90310..53619952c 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -425,6 +425,7 @@ No entities: Aucun élément CHILL_FOO_SEE: Voir un élément CHILL_FOO_EDIT: Modifier un élément +chill_export: Exports (statistiques) #Show templates Date: Date From ffc3a97651eac6b09d3750c476563952cb91518d Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 14 Apr 2023 17:17:41 +0200 Subject: [PATCH 13/37] Permissions more readables with scope before role --- .../views/PermissionsGroup/edit.html.twig | 20 +++++++++---------- .../views/PermissionsGroup/show.html.twig | 14 ++++++------- .../translations/messages.fr.yml | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig index 0e1bf4551..18e91f2c5 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig @@ -25,8 +25,8 @@
    + {{ form_start(delete_groupcenter_form[groupcenter.id]) }} - {{ form_row(delete_groupcenter_form[groupcenter.id].submit, { 'attr': { 'class': 'btn btn-remove' } } ) }} + {{ form_widget(delete_groupcenter_form[groupcenter.id].submit, { 'attr': { 'class': 'btn btn-remove' } } ) }} {{ form_rest(delete_groupcenter_form[groupcenter.id]) }} {{ form_end(delete_groupcenter_form[groupcenter.id]) }}
      + + {% if is_granted('ROLE_ALLOWED_TO_SWITCH') %} +
    • + +
    • + {% endif %} +
    • {% if allow_change_password is same as(true) %}
    • - -
    • - {% endif %} - - {% if is_granted('ROLE_ALLOWED_TO_SWITCH') %} -
    • - +
    • {% endif %}
    diff --git a/src/Bundle/ChillMainBundle/Resources/views/UserJob/index.html.twig b/src/Bundle/ChillMainBundle/Resources/views/UserJob/index.html.twig index e8ea9ec38..3902b33cf 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/UserJob/index.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/UserJob/index.html.twig @@ -2,14 +2,14 @@ {% block admin_content %} {% embed '@ChillMain/CRUD/_index.html.twig' %} - + {% block table_entities_thead_tr %}
    id {{ 'Label'|trans }} {{ 'Active'|trans }} {{ 'Actions'|trans }}
    • - +
    - {{ role_scope.role|trans }} + {{ role_scope.role|trans|replace({'(⚑)': ''}) }} {% if expanded_roles[role_scope.role]|length > 1 %}
    {{ 'Which implies'|trans }} : {% for role in expanded_roles[role_scope.role] %} {% if role != role_scope.role %} - {{ role|trans }} + {{ role|trans|replace({'(⚑)': ''}) }} {% if not loop.last %}, {% endif %} {% endif %} {% endfor %} From 499417aea5500a09b14dae0c33368ce673c71862 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 14 Apr 2023 17:04:04 +0200 Subject: [PATCH 12/37] permissiongroup: complete translation, remove itself role in 'which implies' --- .../Resources/views/PermissionsGroup/show.html.twig | 10 ++++++++-- .../ChillMainBundle/translations/messages.fr.yml | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/show.html.twig b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/show.html.twig index 1271d2d60..140c6b9aa 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/show.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/show.html.twig @@ -31,10 +31,16 @@ {% for role_scope in role_scopes %}
    - {{ role_scope.role|trans }} + {{ role_scope.role|trans|replace({'(⚑)': ''}) }} {% if expanded_roles[role_scope.role]|length > 1 %}
    - {{ 'Which implies'|trans }} : {% for role in expanded_roles[role_scope.role] %}{{ role|trans }}{% if not loop.last %}, {% endif %}{% endfor %} + {{ 'Which implies'|trans }} : + {% for role in expanded_roles[role_scope.role] %} + {% if role != role_scope.role %} + {{ role|trans|replace({'(⚑)': ''}) }} + {% if not loop.last %}, {% endif %} + {% endif %} + {% endfor %}
    {% endif %}
    - + @@ -34,6 +34,15 @@ {% for role_scope in role_scopes %} + -
    {{ 'Role'|trans }} {{ 'Circle'|trans }}{{ 'Role'|trans }} {{ 'Actions'|trans }}
    + {%- if role_scope.scope is not null -%} + + {{ role_scope.scope.name|localize_translatable_string }} + + {%- else -%} + N/A + {%- endif -%} + {{ role_scope.role|trans|replace({'(⚑)': ''}) }} {% if expanded_roles[role_scope.role]|length > 1 %} @@ -48,15 +57,6 @@ {% endif %} - {%- if role_scope.scope is not null -%} - - {{ role_scope.scope.name|localize_translatable_string }} - - {%- else -%} - N/A - {%- endif -%} - {{ form_start(delete_role_scopes_form[role_scope.id]) }} {{ form_widget(delete_role_scopes_form[role_scope.id].submit, { 'attr': { 'class': 'btn btn-remove' } } ) }} diff --git a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/show.html.twig b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/show.html.twig index 140c6b9aa..e457fd913 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/show.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/show.html.twig @@ -22,14 +22,20 @@ - + {% for role_scope in role_scopes %} + - {% endfor %} diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index 53619952c..0acaffe79 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -167,7 +167,7 @@ Permissionsgroup: Groupe de permissions New permission group: Nouveau groupe de permissions PermissionsGroup "%name%" edit: Modification du groupe de permission '%name%' Role: Rôle -Choose amongst roles: Choisir parmi les rôles +Choose amongst roles: Choisir un rôle Choose amongst scopes: Choisir un cercle Add permission: Ajouter les permissions This group does not provide any permission: Ce groupe n'attribue aucune permission From 2b42db87dcbba52195fb50fd62ff31274d0930c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 14 Apr 2023 21:59:25 +0200 Subject: [PATCH 14/37] fix: [referrer scope aggregator] fix period overlapping --- .../AccompanyingCourseAggregators/ReferrerScopeAggregator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php index 4f8c6f0ef..ccbd21da1 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php @@ -64,7 +64,7 @@ class ReferrerScopeAggregator implements AggregatorInterface $qb->expr()->lte($userHistory . '.startDate', ':' . $dateCalc), $qb->expr()->orX( $qb->expr()->isNull($userHistory . '.endDate'), - $qb->expr()->lt($userHistory . '.endDate', ':' . $dateCalc) + $qb->expr()->gt($userHistory . '.endDate', ':' . $dateCalc) ) ) ) From 33051366d48ec01793787b1fee77fcd653c9a6ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 14 Apr 2023 23:20:59 +0200 Subject: [PATCH 15/37] Fix: [remote calendar ms graph] set another date format The previous date format was compliant with the spec described here: https://learn.microsoft.com/en-us/graph/api/user-list-calendarview?view=graph-rest-1.0&tabs=http However, the date format was not accepted. This should be fix the date format. --- .../Connector/MSGraphRemoteCalendarConnector.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php index 0454bae69..d8742ee63 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php @@ -107,8 +107,8 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface 'users/' . $userId . '/calendarView', [ 'query' => [ - 'startDateTime' => $startDate->format(DateTimeImmutable::ATOM), - 'endDateTime' => $endDate->format(DateTimeImmutable::ATOM), + 'startDateTime' => $startDate->setTimezone(RemoteEventConverter::getRemoteTimeZone())->format(RemoteEventConverter::getRemoteDateTimeSimpleFormat()), + 'endDateTime' => $endDate->setTimezone(RemoteEventConverter::getRemoteTimeZone())->format(RemoteEventConverter::getRemoteDateTimeSimpleFormat()), '$count' => 'true', '$top' => 0, ], @@ -181,8 +181,8 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface 'users/' . $userId . '/calendarView', [ 'query' => [ - 'startDateTime' => $startDate->format(DateTimeImmutable::ATOM), - 'endDateTime' => $endDate->format(DateTimeImmutable::ATOM), + 'startDateTime' => $startDate->setTimezone(RemoteEventConverter::getRemoteTimeZone())->format(RemoteEventConverter::getRemoteDateTimeSimpleFormat()), + 'endDateTime' => $endDate->setTimezone(RemoteEventConverter::getRemoteTimeZone())->format(RemoteEventConverter::getRemoteDateTimeSimpleFormat()), '$select' => 'id,subject,start,end,isAllDay', '$top' => $limit, '$skip' => $offset, @@ -539,7 +539,7 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface $userId = $this->mapCalendarToUser->getUserId($user); if (null === $userId) { - throw new Exception('no remote calendar for this user', [ + throw new Exception('no remote calendar for this user', 55698, [ 'user' => $user->getId(), 'remoteId' => $remoteId, ]); From ffa94dbe40273685b04091beb83bd0c055191a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 14 Apr 2023 23:41:37 +0200 Subject: [PATCH 16/37] Fix: [msgraph calendar subscription] fix infinite iterating on calendar subscription When the total of user to subscribe is a multiple of offset, the subscription was an infinite loop --- .../Command/MapAndSubscribeUserCalendarCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php b/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php index 902fe4c38..d0fdd0a02 100644 --- a/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php +++ b/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php @@ -76,7 +76,7 @@ class MapAndSubscribeUserCalendarCommand extends Command 'expiration' => $expiration->format(DateTimeImmutable::ATOM), ]); - while ($offset < ($total - 1)) { + while ($offset < $total) { $users = $this->userRepository->findByMostOldSubscriptionOrWithoutSubscriptionOrData( $interval, $limit, From c48c5875c66249edf2ee86aecb40cd87eb0e888a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 14 Apr 2023 23:47:33 +0200 Subject: [PATCH 17/37] DX: fix phpstan issues --- .../Connector/MSGraphRemoteCalendarConnector.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php index d8742ee63..d14ebaa02 100644 --- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php +++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraphRemoteCalendarConnector.php @@ -539,10 +539,13 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface $userId = $this->mapCalendarToUser->getUserId($user); if (null === $userId) { - throw new Exception('no remote calendar for this user', 55698, [ - 'user' => $user->getId(), - 'remoteId' => $remoteId, - ]); + throw new Exception( + sprintf( + 'no remote calendar for this user: %s, remoteid: %s', + $user->getId(), + $remoteId + ) + ); } try { From d898f3ffce2daa855cdc3d2ad726a26b68af3549 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 17 Apr 2023 10:44:43 +0200 Subject: [PATCH 18/37] Feature [manual] update user manual link in footer --- .../ChillMainBundle/Resources/views/Layout/_footer.html.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/views/Layout/_footer.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Layout/_footer.html.twig index dbec69008..df6ba912b 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Layout/_footer.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Layout/_footer.html.twig @@ -1,8 +1,8 @@

    {{ 'This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License'|trans|raw }} -
    - +
    +
    {{ 'User manual'|trans }}

    From b69fb740b1c94956ed6bf12406bb9b6c616c6814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 18 Apr 2023 11:36:46 +0200 Subject: [PATCH 19/37] Fix: make geographical units valid during imports --- .../Service/Import/GeographicalUnitBaseImporter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php b/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php index 99f919406..1ec6b70de 100644 --- a/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php +++ b/src/Bundle/ChillMainBundle/Service/Import/GeographicalUnitBaseImporter.php @@ -207,7 +207,7 @@ final class GeographicalUnitBaseImporter (id, geom, unitname, layer_id, unitrefid) SELECT nextval('chill_main_geographical_unit_id_seq'), - geom, + st_makevalid(geom), unitName, layer.id, unitKey From a0d0c3840f0c4c964545ca38530737ea4c467d30 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 18 Apr 2023 19:04:30 +0200 Subject: [PATCH 20/37] Fix deprecated Role call --- .../ChillActivityBundle/Controller/ActivityController.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 798ae77b4..97678af50 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -41,7 +41,6 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Serializer\SerializerInterface; use Symfony\Contracts\Translation\TranslatorInterface; use function array_key_exists; @@ -213,7 +212,7 @@ final class ActivityController extends AbstractController $form = $this->createForm(ActivityType::class, $entity, [ 'center' => $this->centerResolver->resolveCenters($entity)[0] ?? null, - 'role' => new Role('CHILL_ACTIVITY_UPDATE'), + 'role' => 'CHILL_ACTIVITY_UPDATE', 'activityType' => $entity->getActivityType(), 'accompanyingPeriod' => $accompanyingPeriod, ]); @@ -442,7 +441,7 @@ final class ActivityController extends AbstractController $form = $this->createForm(ActivityType::class, $entity, [ 'center' => $this->centerResolver->resolveCenters($entity)[0] ?? null, - 'role' => new Role('CHILL_ACTIVITY_CREATE'), + 'role' => 'CHILL_ACTIVITY_CREATE', 'activityType' => $entity->getActivityType(), 'accompanyingPeriod' => $accompanyingPeriod, ]); From 034e2553bc89946d1a8196ebd0d6fc82eff53ea5 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 18 Apr 2023 21:13:24 +0200 Subject: [PATCH 21/37] Fix option with RoleWithoutScope distinction. Remove flag. --- .../translations/messages.fr.yml | 4 +-- .../views/PermissionsGroup/edit.html.twig | 29 +++++++++++++++++-- .../views/PermissionsGroup/show.html.twig | 4 +-- .../translations/messages.fr.yml | 4 ++- .../translations/messages.fr.yml | 12 ++++---- 5 files changed, 39 insertions(+), 14 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 581df7431..0a7aacfd8 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -104,8 +104,8 @@ 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 (⚑) +CHILL_ACTIVITY_STATS: Statistique des échanges +CHILL_ACTIVITY_LIST: Liste des échanges CHILL_ACTIVITY_CREATE_PERSON: Créer un échange lié à un usager CHILL_ACTIVITY_CREATE_ACCOMPANYING_COURSE: Créer un échange lié à un parcours CHILL_ACTIVITY_FULL: Voir les détails, créer, supprimer et mettre à jour un échange diff --git a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig index 18e91f2c5..2404178b2 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig @@ -44,13 +44,13 @@ {%- endif -%}
    -
    {{ 'Role'|trans }} {{ 'Circle'|trans }}{{ 'Role'|trans }}
    {%- if role_scope.scope is not null -%} + {{ role_scope.scope.name|localize_translatable_string }} + {%- else -%} + N/A + {%- endif -%} + {{ role_scope.role|trans|replace({'(⚑)': ''}) }} {% if expanded_roles[role_scope.role]|length > 1 %} @@ -44,12 +50,6 @@ {% endif %} {%- if role_scope.scope is not null -%} - {{ role_scope.scope.name|localize_translatable_string }} - {%- else -%} - N/A - {%- endif -%} -
    - {{ role_scope.role|trans|replace({'(⚑)': ''}) }} + {{ role_scope.role|trans }} {% if expanded_roles[role_scope.role]|length > 1 %}
    {{ 'Which implies'|trans }} : {% for role in expanded_roles[role_scope.role] %} {% if role != role_scope.role %} - {{ role|trans|replace({'(⚑)': ''}) }} + {{ role|trans }} {% if not loop.last %}, {% endif %} {% endif %} {% endfor %} @@ -83,7 +83,7 @@ {{ form_widget(add_role_scopes_form.composed_role_scope.role, { 'attr': { 'class': 'w-50' }}) }} {{ form_widget(add_role_scopes_form.composed_role_scope.scope) }}
    -
    {{ 'Help to pick role an scope'|trans }}
    +
    {{ 'Help to pick role and scope'|trans }}
    • @@ -102,3 +102,26 @@ {% endblock %} + +{% block js %} + +{% endblock %} diff --git a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/show.html.twig b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/show.html.twig index e457fd913..b183bc19e 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/show.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/show.html.twig @@ -37,13 +37,13 @@ {%- endif -%}
    - {{ role_scope.role|trans|replace({'(⚑)': ''}) }} + {{ role_scope.role|trans }} {% if expanded_roles[role_scope.role]|length > 1 %}
    {{ 'Which implies'|trans }} : {% for role in expanded_roles[role_scope.role] %} {% if role != role_scope.role %} - {{ role|trans|replace({'(⚑)': ''}) }} + {{ role|trans }} {% if not loop.last %}, {% endif %} {% endif %} {% endfor %} diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index 0acaffe79..b8349ce2e 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -174,7 +174,9 @@ This group does not provide any permission: Ce groupe n'attribue aucune permissi The role '%role%' has been removed: Le rôle "%role%" a été enlevé de ce groupe de permission The role '%role%' on circle '%scope%' has been removed: Le rôle "%role%" sur le cercle "%scope%" a été enlevé de ce groupe de permission Unclassified: Non classifié -Help to pick role an scope: Les rôles marqués d'un (⚑) ne nécessitent pas de cercle. +Help to pick role and scope: Certains rôles ne nécessitent pas de cercle. +The role need scope: Ce rôle nécessite un cercle. +The role does not need scope: Ce rôle ne nécessite pas de cercle ! #admin section for users User configuration: Gestion des utilisateurs diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 2ca57f5f7..18e3ab13f 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -308,12 +308,12 @@ Opening the accompanying period: Ouverture d'un parcours d'accompagnement 'Timeline for %name%': 'Historique de %name%' # ROLES -CHILL_PERSON_SEE: Voir les usagers (⚑) -CHILL_PERSON_UPDATE: Modifier les usagers (⚑) -CHILL_PERSON_CREATE: Ajouter des usagers (⚑) -CHILL_PERSON_STATS: Statistiques sur les usagers (⚑) -CHILL_PERSON_LISTS: Liste des usagers (⚑) -CHILL_PERSON_DUPLICATE: Gérer les doublons d'usagers (⚑) +CHILL_PERSON_SEE: Voir les usagers +CHILL_PERSON_UPDATE: Modifier les usagers +CHILL_PERSON_CREATE: Ajouter des usagers +CHILL_PERSON_STATS: Statistiques sur les usagers +CHILL_PERSON_LISTS: Liste des usagers +CHILL_PERSON_DUPLICATE: Gérer les doublons d'usagers CHILL_PERSON_ACCOMPANYING_PERIOD_SEE: Vision simplifiée d'un parcours d'accompagnement CHILL_PERSON_ACCOMPANYING_PERIOD_CONFIDENTIAL: Voir et modifier les parcours d'accompagnement confidentielles From cb1ea8c622afffc180bb5edb3669e9940ef76849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 19 Apr 2023 12:04:52 +0200 Subject: [PATCH 22/37] DX: [mailer] deprecate the chill mailer based on swift mailer --- composer.json | 1 - .../ChillMainBundle/Notification/Mailer.php | 69 +++++++------------ .../PasswordRecover/RecoverPasswordHelper.php | 68 ++++++------------ .../config/services/notification.yaml | 6 -- .../config/services/security.yaml | 6 +- 5 files changed, 47 insertions(+), 103 deletions(-) diff --git a/composer.json b/composer.json index 033b3f19b..b47856954 100644 --- a/composer.json +++ b/composer.json @@ -47,7 +47,6 @@ "symfony/monolog-bundle": "^3.5", "symfony/security-bundle": "^4.4", "symfony/serializer": "^5.3", - "symfony/swiftmailer-bundle": "^3.5", "symfony/templating": "^4.4", "symfony/translation": "^4.4", "symfony/twig-bundle": "^4.4", diff --git a/src/Bundle/ChillMainBundle/Notification/Mailer.php b/src/Bundle/ChillMainBundle/Notification/Mailer.php index c63a96f04..307d5d1df 100644 --- a/src/Bundle/ChillMainBundle/Notification/Mailer.php +++ b/src/Bundle/ChillMainBundle/Notification/Mailer.php @@ -15,7 +15,10 @@ use Chill\MainBundle\Entity\User; use Psr\Log\LoggerInterface; use Swift_Mailer; use Swift_Message; +use Symfony\Component\Mailer\MailerInterface; +use Symfony\Component\Mime\Email; use Symfony\Component\Routing\RouterInterface; +use Symfony\Component\Templating\EngineInterface; use Symfony\Contracts\Translation\TranslatorInterface; use Twig\Environment; @@ -26,43 +29,34 @@ use function call_user_func; * Classe d'aide pour l'envoi de notification. * * Héberge toutes les méthodes pour ré-écrire les URL en fonction de la langue de l'utilisateur. + * + * @deprecated use the MailerInterface */ class Mailer { - /** - * @var Swift_Mailer - */ - protected $forcedMailer; - /** * @var LoggerInterface */ - protected $logger; - - /** - * @var Swift_Mailer - */ - protected $mailer; + private $logger; /** * @var array */ - protected $routeParameters; + private $routeParameters; /** * @var RouterInterface */ - protected $router; + private $router; /** * @var TranslatorInterface */ - protected $translator; + private $translator; - /** - * @var \Twig\Environment - */ - protected $twig; + private EngineInterface $twig; + + private MailerInterface $mailer; /** * Mailer constructor. @@ -70,11 +64,9 @@ class Mailer * @param $routeParameters */ public function __construct( + MailerInterface $mailer, LoggerInterface $logger, - Environment $twig, - Swift_Mailer $mailer, - // due to bug https://github.com/symfony/swiftmailer-bundle/issues/127 - // \Swift_Transport $mailerTransporter, + EngineInterface $twig, RouterInterface $router, TranslatorInterface $translator, $routeParameters @@ -82,7 +74,6 @@ class Mailer $this->logger = $logger; $this->twig = $twig; $this->mailer = $mailer; - //$this->forcedMailer = new \Swift_Mailer($mailerTransporter); $this->router = $router; $this->translator = $translator; $this->routeParameters = $routeParameters; @@ -115,20 +106,6 @@ class Mailer return $content; } - /** - * @param $force - * - * @throws \Symfony\Component\Mailer\Exception\TransportExceptionInterface - */ - public function sendMessage(Swift_Message $message, $force) - { - if ($force) { - $this->forcedMailer->send($message); - } else { - $this->mailer->send($message); - } - } - /** * Envoie une notification à un utilisateur. * @@ -155,23 +132,25 @@ class Mailer $subject[2] ?? null ); - $message = (new Swift_Message($subjectI18n)) - ->setFrom($fromEmail, $fromName) - ->setTo($to); + $email = new Email(); + $email->addTo($to)->subject($subjectI18n); foreach ($bodies as $contentType => $content) { - $message->setBody($content, $contentType); + match ($contentType) { + 'text/plain' => $email->text($content), + default => $email->text($content), + }; } if (null !== $callback) { - call_user_func($callback, $message); + call_user_func($callback, $email); } $this->logger->info('[notification] Sending notification', [ - 'to' => $message->getTo(), - 'subject' => $message->getSubject(), + 'to' => $email->getTo(), + 'subject' => $email->getSubject() ]); - $this->sendMessage($message, $force); + $this->mailer->send($email); } } diff --git a/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php b/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php index 07114e4b5..42881e291 100644 --- a/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php +++ b/src/Bundle/ChillMainBundle/Security/PasswordRecover/RecoverPasswordHelper.php @@ -14,6 +14,8 @@ namespace Chill\MainBundle\Security\PasswordRecover; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Notification\Mailer; use DateTimeInterface; +use Symfony\Bridge\Twig\Mime\TemplatedEmail; +use Symfony\Component\Mailer\MailerInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use function array_merge; @@ -22,33 +24,26 @@ class RecoverPasswordHelper { public const RECOVER_PASSWORD_ROUTE = 'password_recover'; - /** - * @var Mailer - */ - protected $mailer; - - protected $routeParameters; + private MailerInterface $mailer; /** * @var TokenManager */ - protected $tokenManager; + private $tokenManager; /** * @var UrlGeneratorInterface */ - protected $urlGenerator; + private $urlGenerator; public function __construct( TokenManager $tokenManager, UrlGeneratorInterface $urlGenerator, - Mailer $mailer, - array $routeParameters + MailerInterface $mailer, ) { $this->tokenManager = $tokenManager; $this->urlGenerator = $urlGenerator; $this->mailer = $mailer; - $this->routeParameters = $routeParameters; } /** @@ -59,27 +54,14 @@ class RecoverPasswordHelper */ public function generateUrl(User $user, DateTimeInterface $expiration, $absolute = true, array $parameters = []) { - $context = $this->urlGenerator->getContext(); - $previousHost = $context->getHost(); - $previousScheme = $context->getScheme(); - - $context->setHost($this->routeParameters['host']); - $context->setScheme($this->routeParameters['scheme']); - - $url = $this->urlGenerator->generate( + return $this->urlGenerator->generate( self::RECOVER_PASSWORD_ROUTE, array_merge( $this->tokenManager->generate($user, $expiration), $parameters ), - $absolute ? UrlGeneratorInterface::ABSOLUTE_URL : UrlGeneratorInterface::ABSOLUTE_PATH + UrlGeneratorInterface::ABSOLUTE_URL ); - - // reset the host - $context->setHost($previousHost); - $context->setScheme($previousScheme); - - return $url; } public function sendRecoverEmail( @@ -91,26 +73,20 @@ class RecoverPasswordHelper array $additionalUrlParameters = [], $emailSubject = 'Recover your password' ) { - $content = $this->mailer->renderContentToUser( - $user, - $template, - array_merge( - [ - 'user' => $user, - 'url' => $this->generateUrl($user, $expiration, true, $additionalUrlParameters), - ], - $templateParameters - ) - ); + if (null === $user->getEmail() || '' === trim($user->getEmail())) { + throw new \UnexpectedValueException("No emaail associated to the user"); + } - $this->mailer->sendNotification( - $user, - [$emailSubject], - [ - 'text/plain' => $content, - ], - null, - $force - ); + $email = (new TemplatedEmail()) + ->subject($emailSubject) + ->to($user->getEmail()) + ->textTemplate($template) + ->context([ + 'user' => $user, + 'url' => $this->generateUrl($user, $expiration, true, $additionalUrlParameters), + ...$templateParameters + ]); + + $this->mailer->send($email); } } diff --git a/src/Bundle/ChillMainBundle/config/services/notification.yaml b/src/Bundle/ChillMainBundle/config/services/notification.yaml index bb0b6bb8c..29cbce946 100644 --- a/src/Bundle/ChillMainBundle/config/services/notification.yaml +++ b/src/Bundle/ChillMainBundle/config/services/notification.yaml @@ -10,12 +10,6 @@ services: Chill\MainBundle\Notification\Mailer: arguments: - $logger: '@Psr\Log\LoggerInterface' - $twig: '@Twig\Environment' - $mailer: '@swiftmailer.mailer.default' - # $mailerTransporter: '@swiftmailer.transport' - $router: '@Symfony\Component\Routing\RouterInterface' - $translator: '@Symfony\Contracts\Translation\TranslatorInterface' $routeParameters: '%chill_main.notifications%' Chill\MainBundle\Notification\NotificationHandlerManager: diff --git a/src/Bundle/ChillMainBundle/config/services/security.yaml b/src/Bundle/ChillMainBundle/config/services/security.yaml index c0d9f98b9..38089becf 100644 --- a/src/Bundle/ChillMainBundle/config/services/security.yaml +++ b/src/Bundle/ChillMainBundle/config/services/security.yaml @@ -61,11 +61,7 @@ services: arguments: $secret: '%kernel.secret%' - Chill\MainBundle\Security\PasswordRecover\RecoverPasswordHelper: - arguments: - $tokenManager: '@Chill\MainBundle\Security\PasswordRecover\TokenManager' - $mailer: '@Chill\MainBundle\Notification\Mailer' - $routeParameters: "%chill_main.notifications%" + Chill\MainBundle\Security\PasswordRecover\RecoverPasswordHelper: ~ Chill\MainBundle\Security\PasswordRecover\PasswordRecoverEventSubscriber: arguments: From a1421ea99f2c502f46f3ffbf93a73eb0e9963aa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 19 Apr 2023 12:58:40 +0200 Subject: [PATCH 23/37] Fix: fix usage of scope picker with unactives scopes --- .../Form/Type/ScopePickerType.php | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php b/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php index 79ed6df40..6f1a5837f 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php @@ -60,16 +60,17 @@ class ScopePickerType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { - $items = array_filter( - $this->authorizationHelper->getReachableScopes( - $this->security->getUser(), - $options['role'] instanceof Role ? $options['role']->getRole() : $options['role'], - $options['center'] - ), - static function (Scope $s) { - return $s->isActive(); - } - ); + $items = array_values( + array_filter( + $this->authorizationHelper->getReachableScopes( + $this->security->getUser(), + $options['role'] instanceof Role ? $options['role']->getRole() : $options['role'], + $options['center'] + ), + static function (Scope $s) { + return $s->isActive(); + } + )); if (0 === count($items)) { throw new RuntimeException('no scopes are reachable. This form should not be shown to user'); From 906d1fdab51bdc17c1c15d6901ebe09b9a0eee06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 19 Apr 2023 13:01:48 +0200 Subject: [PATCH 24/37] DX: remove usage of deprecated Role class --- .../Controller/SingleTaskController.php | 13 +++++-------- src/Bundle/ChillTaskBundle/Form/SingleTaskType.php | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php index 530f54b01..0cdcd7173 100644 --- a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php +++ b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php @@ -33,6 +33,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormFactoryInterface; +use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -205,7 +206,7 @@ final class SingleTaskController extends AbstractController . 'allowed to edit this task'); $event = (new UIEvent('single-task', $task)) - ->setForm($this->setCreateForm($task, new Role(TaskVoter::UPDATE))); + ->setForm($this->setCreateForm($task, TaskVoter::UPDATE)); $this->eventDispatcher->dispatch(UIEvent::EDIT_FORM, $event); $form = $event->getForm(); @@ -557,7 +558,7 @@ final class SingleTaskController extends AbstractController $this->denyAccessUnlessGranted($role, $task, 'You are not ' . 'allowed to create this task'); - $form = $this->setCreateForm($task, new Role($role)); + $form = $this->setCreateForm($task, $role); $form->handleRequest($request); @@ -650,7 +651,7 @@ final class SingleTaskController extends AbstractController /** * @return \Symfony\Component\Form\FormInterface */ - protected function setCreateForm(SingleTask $task, Role $role) + protected function setCreateForm(SingleTask $task, string $role) { $form = $this->createForm(SingleTaskType::class, $task, [ 'role' => $role, @@ -684,12 +685,8 @@ final class SingleTaskController extends AbstractController /** * Creates a form to delete a Task entity by id. - * - * @param mixed $id The entity id - * - * @return \Symfony\Component\Form\Form The form */ - private function createDeleteForm($id) + private function createDeleteForm($id): FormInterface { return $this->createFormBuilder() ->setAction($this->generateUrl( diff --git a/src/Bundle/ChillTaskBundle/Form/SingleTaskType.php b/src/Bundle/ChillTaskBundle/Form/SingleTaskType.php index 56e33954b..d27a2aa06 100644 --- a/src/Bundle/ChillTaskBundle/Form/SingleTaskType.php +++ b/src/Bundle/ChillTaskBundle/Form/SingleTaskType.php @@ -81,7 +81,7 @@ class SingleTaskType extends AbstractType ->add('circle', ScopePickerType::class, [ 'center' => $center, 'role' => $options['role'], - 'required' => false, + 'required' => true, ]); } } From e6163b2bc3a8e1d7bb4581586ab74321c5b1b37a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 19 Apr 2023 13:05:21 +0200 Subject: [PATCH 25/37] DX: fix cs --- .../DocGenerator/ListActivitiesByAccompanyingPeriodContext.php | 1 - .../Controller/AddressToReferenceMatcherController.php | 1 - src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php | 3 ++- src/Bundle/ChillMainBundle/Form/WorkflowStepType.php | 2 +- .../ChillMainBundle/migrations/Version20230306145728.php | 1 - src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php | 1 + 6 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php index 266fadfee..b2272dd7b 100644 --- a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php +++ b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ListActivitiesByAccompanyingPeriodContext.php @@ -120,7 +120,6 @@ class ListActivitiesByAccompanyingPeriodContext implements public function contextGenerationDataDenormalize(DocGeneratorTemplate $template, $entity, array $data): array { - $denormalized = $this->accompanyingPeriodContext->contextGenerationDataDenormalize($template, $entity, $data); foreach (['myActivitiesOnly', 'myWorksOnly'] as $k) { diff --git a/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php b/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php index 5cdefceb5..aab63aea3 100644 --- a/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php +++ b/src/Bundle/ChillMainBundle/Controller/AddressToReferenceMatcherController.php @@ -107,5 +107,4 @@ class AddressToReferenceMatcherController true ); } - } diff --git a/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php b/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php index 6f1a5837f..2529a0655 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php @@ -70,7 +70,8 @@ class ScopePickerType extends AbstractType static function (Scope $s) { return $s->isActive(); } - )); + ) + ); if (0 === count($items)) { throw new RuntimeException('no scopes are reachable. This form should not be shown to user'); diff --git a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php index 16dc0a4a5..54d953016 100644 --- a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php +++ b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php @@ -247,7 +247,7 @@ class WorkflowStepType extends AbstractType function ($step, ExecutionContextInterface $context, $payload) { $form = $context->getObject(); - foreach($form->get('future_dest_users')->getData() as $u) { + 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') diff --git a/src/Bundle/ChillMainBundle/migrations/Version20230306145728.php b/src/Bundle/ChillMainBundle/migrations/Version20230306145728.php index 09a0ece6e..32e138f54 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20230306145728.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20230306145728.php @@ -69,7 +69,6 @@ final class Version20230306145728 extends AbstractMigration $this->addSql('CREATE INDEX IDX_165051F63174800F ON chill_main_address (createdBy_id)'); $this->addSql('CREATE INDEX IDX_165051F665FF1AEC ON chill_main_address (updatedBy_id)'); $this->addSql('COMMENT ON COLUMN chill_main_address_reference.point IS \'(DC2Type:point)\''); - } public function down(Schema $schema): void diff --git a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php index 0cdcd7173..2ba9488b6 100644 --- a/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php +++ b/src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php @@ -685,6 +685,7 @@ final class SingleTaskController extends AbstractController /** * Creates a form to delete a Task entity by id. + * @param mixed $id */ private function createDeleteForm($id): FormInterface { From a59e84b029442abac632559f13272a5fb96f5892 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 20 Apr 2023 14:54:36 +0200 Subject: [PATCH 26/37] Display too draft periods without creator in periods of a person --- .../Repository/AccompanyingPeriodACLAwareRepository.php | 3 ++- .../views/AccompanyingPeriod/user_draft_periods_list.html.twig | 1 + src/Bundle/ChillPersonBundle/translations/messages.fr.yml | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php index e28832bf9..9327172ac 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php @@ -174,7 +174,8 @@ final class AccompanyingPeriodACLAwareRepository implements AccompanyingPeriodAC ->andWhere( $qb->expr()->orX( $qb->expr()->neq('ap.step', ':draft'), - $qb->expr()->eq('ap.createdBy', ':creator') + $qb->expr()->orX($qb->expr()->eq('ap.createdBy', ':creator'), + $qb->expr()->isNull('ap.createdBy')) ) ) ->setParameter('draft', AccompanyingPeriod::STEP_DRAFT) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_draft_periods_list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_draft_periods_list.html.twig index d7bd8eea6..ef38ee7b9 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_draft_periods_list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_draft_periods_list.html.twig @@ -22,6 +22,7 @@

    {{ 'My accompanying periods in draft'|trans }}

    +

    {{ 'Display draft periods created by me'|trans }}

    {% for period in accompanyingPeriods %} diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 18e3ab13f..01634bb21 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -966,6 +966,7 @@ Linked evaluations: Évaluations associées # Accompanying period per user My accompanying periods: Mes parcours My accompanying periods in draft: Mes parcours brouillons +Display draft periods created by me: Affiche les parcours brouillon que j'ai créé (pas ceux dont je suis référent) Number of periods: Nombre de parcours workflow: From dde35be9c3cd29eca96ddc917f20f3300cfe7c66 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 20 Apr 2023 18:05:39 +0200 Subject: [PATCH 27/37] hide pagination if no periods --- .../AccompanyingPeriod/user_draft_periods_list.html.twig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_draft_periods_list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_draft_periods_list.html.twig index ef38ee7b9..60f6ae9e0 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_draft_periods_list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_draft_periods_list.html.twig @@ -32,7 +32,9 @@ {% endfor %}
    - {{ chill_pagination(pagination) }} + {% if accompanyingPeriods|length > 0 %} + {{ chill_pagination(pagination) }} + {% endif %}
    From 631d65a57ff28d5fedabd5d5819a58e3c15f31c2 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 20 Apr 2023 18:09:25 +0200 Subject: [PATCH 28/37] improve indentation --- .../Repository/AccompanyingPeriodACLAwareRepository.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php index 9327172ac..0aaabd05f 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php @@ -174,8 +174,10 @@ final class AccompanyingPeriodACLAwareRepository implements AccompanyingPeriodAC ->andWhere( $qb->expr()->orX( $qb->expr()->neq('ap.step', ':draft'), - $qb->expr()->orX($qb->expr()->eq('ap.createdBy', ':creator'), - $qb->expr()->isNull('ap.createdBy')) + $qb->expr()->orX( + $qb->expr()->eq('ap.createdBy', ':creator'), + $qb->expr()->isNull('ap.createdBy') + ) ) ) ->setParameter('draft', AccompanyingPeriod::STEP_DRAFT) From 025ee2ea950548038f9d536e2c87398759dccfc7 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 20 Apr 2023 20:24:23 +0200 Subject: [PATCH 29/37] UX: [Admin][persmissionsgroup] complete in template: content wrapper with bootstrap classes --- .../public/chill/scss/record_actions.scss | 2 +- .../views/PermissionsGroup/edit.html.twig | 125 +++++++++--------- 2 files changed, 66 insertions(+), 61 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/record_actions.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/record_actions.scss index c3fe6d65c..5158a826e 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/record_actions.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/record_actions.scss @@ -64,7 +64,7 @@ ul.record_actions { .sticky-form { background-color: $white; - padding: 1em; + padding-top: 1.25em; margin: -1em; box-shadow: 0 -20px 20px -20px rgba($chill-gray, .5); @include sticky-bottom; diff --git a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig index 2404178b2..df63cc848 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/PermissionsGroup/edit.html.twig @@ -3,77 +3,82 @@ {% block title %}{{ 'PermissionsGroup "%name%" edit'|trans( { '%name%': entity.name } ) }}{% endblock %} {% block admin_content -%} -

    {{ 'PermissionsGroup "%name%" edit'|trans( { '%name%': entity.name } ) }}

    +
    +
    -

    {{ 'Details'|trans }}

    +

    {{ 'PermissionsGroup "%name%" edit'|trans( { '%name%': entity.name } ) }}

    - {{ form_start(edit_form) }} - {{ form_row(edit_form.name) }} - {% if edit_form.flags is defined %} - {{ form_row(edit_form.flags) }} - {% endif %} - {{ form_row(edit_form.submit, { 'attr': { 'class': 'btn btn-save float-end' } } ) }} - {{ form_end(edit_form) }} +

    {{ 'Details'|trans }}

    -

    {{ 'Grant those permissions'|trans }} :

    + {{ form_start(edit_form) }} + {{ form_row(edit_form.name) }} + {% if edit_form.flags is defined %} + {{ form_row(edit_form.flags) }} + {% endif %} + {{ form_row(edit_form.submit, { 'attr': { 'class': 'btn btn-save float-end' } } ) }} + {{ form_end(edit_form) }} - {%- if entity.getRoleScopes|length > 0 -%} - {% for title, role_scopes in role_scopes_sorted %} +

    {{ 'Grant those permissions'|trans }} :

    -

    {{ title|default("Unclassified")|trans }}

    + {%- if entity.getRoleScopes|length > 0 -%} + {% for title, role_scopes in role_scopes_sorted %} - - +

    {{ title|default("Unclassified")|trans }}

    + +
    + + + + + + + + + + {% for role_scope in role_scopes %} - - - + + + - - - {% for role_scope in role_scopes %} - - - - - + {% endfor %} + +
    {{ 'Circle'|trans }}{{ 'Role'|trans }}{{ 'Actions'|trans }}
    {{ 'Circle'|trans }}{{ 'Role'|trans }}{{ 'Actions'|trans }} + {%- if role_scope.scope is not null -%} + + {{ role_scope.scope.name|localize_translatable_string }} + + {%- else -%} + N/A + {%- endif -%} + + {{ role_scope.role|trans }} + {% if expanded_roles[role_scope.role]|length > 1 %} +
    + {{ 'Which implies'|trans }} : + {% for role in expanded_roles[role_scope.role] %} + {% if role != role_scope.role %} + {{ role|trans }} + {% if not loop.last %}, {% endif %} + {% endif %} + {% endfor %} +
    + {% endif %} +
    + {{ form_start(delete_role_scopes_form[role_scope.id]) }} + {{ form_widget(delete_role_scopes_form[role_scope.id].submit, { 'attr': { 'class': 'btn btn-remove' } } ) }} + {{ form_end(delete_role_scopes_form[role_scope.id]) }} +
    - {%- if role_scope.scope is not null -%} - - {{ role_scope.scope.name|localize_translatable_string }} - - {%- else -%} - N/A - {%- endif -%} - - {{ role_scope.role|trans }} - {% if expanded_roles[role_scope.role]|length > 1 %} -
    - {{ 'Which implies'|trans }} : - {% for role in expanded_roles[role_scope.role] %} - {% if role != role_scope.role %} - {{ role|trans }} - {% if not loop.last %}, {% endif %} - {% endif %} - {% endfor %} -
    - {% endif %} -
    - {{ form_start(delete_role_scopes_form[role_scope.id]) }} - {{ form_widget(delete_role_scopes_form[role_scope.id].submit, { 'attr': { 'class': 'btn btn-remove' } } ) }} - {{ form_end(delete_role_scopes_form[role_scope.id]) }} -
    + {% endfor %} - {% endfor %} -
    - {% endfor %} + {%- else -%} +

    {{ 'This group does not provide any permission'|trans }}

    + {%- endif -%} - {%- else -%} -

    {{ 'This group does not provide any permission'|trans }}

    - {%- endif -%} + +
    -

    {{ 'Grant new permissions'|trans }}

    {{ form_start(add_role_scopes_form) }} @@ -100,7 +105,7 @@ {{ form_end(add_role_scopes_form) }}
    - +
    {% endblock %} {% block js %} From 7cb7897e1223095cbff702ad9662c5cf1d21a566 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 21 Apr 2023 18:05:29 +0200 Subject: [PATCH 30/37] Align address detail button style with banner context buttons --- .../AddressDetails/AddressDetailsButton.vue | 4 +-- .../Resources/public/chill/chillperson.scss | 36 +++++++++++++------ .../Resources/views/Person/banner.html.twig | 5 +-- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/AddressDetails/AddressDetailsButton.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/AddressDetails/AddressDetailsButton.vue index 7e060de4c..2bca56379 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/AddressDetails/AddressDetailsButton.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/AddressDetails/AddressDetailsButton.vue @@ -1,7 +1,7 @@