Merge remote-tracking branch 'origin/master' into issue422_and_others_on_AddPersons

This commit is contained in:
Julien Fastré 2022-02-17 22:51:52 +01:00
commit 53d51fea2f
20 changed files with 69 additions and 51 deletions

View File

@ -9,15 +9,26 @@ and this project adheres to
* date versioning for test releases * date versioning for test releases
## Unreleased ## Unreleased
* AddPersons: remove ul-li html tags from AddPersons (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/419)
<!-- write down unreleased development here -->
* [person]: AddPersons: allow creation of person or thirdparty only (no users) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/422) * [person]: AddPersons: allow creation of person or thirdparty only (no users) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/422)
* [person]: AddPersons: allow creation of person or thirdparty depending on allowed types (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/422) * [person]: AddPersons: allow creation of person or thirdparty depending on allowed types (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/422)
* [person]: AddPersons: add suggestion of name when creating new person or thirdparty (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/422) * [person]: AddPersons: add suggestion of name when creating new person or thirdparty (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/422)
* [main] Address: fix small bug: when modifying an address without street (isNoAddress), also check errors if street is an empty string as back-end change null value to empty string for street (and streetNumber) * [main] Address: fix small bug: when modifying an address without street (isNoAddress), also check errors if street is an empty string as back-end change null value to empty string for street (and streetNumber)
* [main] Address: stronger client-side validation of addresses (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/449) * [main] Address: stronger client-side validation of addresses (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/449)
* [person] accompanying course: filter suggested entities by open participations (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/415)
[activity] can click through the cross icon for removing person in concerned group (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/476)
[activity] correct associated persons by considering only open participations (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/476)
* [person_resources]: Renderboxes used to display person/thirdparty info (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/465)
## Test releases
<!-- write down unreleased development here --> ### test release 2022-02-14
* AddPersons: remove ul-li html tags from AddPersons (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/419)
* [doc-generator] do not set required fields for mainPerson, person1, person2 (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement#456)
* [doc-generation] add age and obele in the mainPerson, person1 and person2 list + add obele in person renderString if addAge (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/370)
* [person] accompanying course work: fix on-the-fly update of thirdParty
* fix normalisation of accompanying course requestor api (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/378) * fix normalisation of accompanying course requestor api (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/378)
* [person] add a returnPath when clicking on some Person or ThirdParty badge (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/427) * [person] add a returnPath when clicking on some Person or ThirdParty badge (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/427)
* [person] accompanying course work: fix on-the-fly update of thirdParty * [person] accompanying course work: fix on-the-fly update of thirdParty
@ -35,8 +46,8 @@ and this project adheres to
* display full address in address.text in normalization. Adapt AddressRenderBox * display full address in address.text in normalization. Adapt AddressRenderBox
* [address]: Correction residential address 'depuis le' (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/459) * [address]: Correction residential address 'depuis le' (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/459)
* [Documents]: List view adapted to display more information (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/414) * [Documents]: List view adapted to display more information (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/414)
* [Thirdparty_contact]: address blurred if confidential in view page (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/450)
## Test releases * [homepage_widget]: If no sender then display as 'notification automatique' (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/435)
### test release 2021-02-01 ### test release 2021-02-01

View File

@ -357,7 +357,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
if (null !== $this->accompanyingPeriod) { if (null !== $this->accompanyingPeriod) {
$personsAssociated = []; $personsAssociated = [];
foreach ($this->accompanyingPeriod->getParticipations() as $participation) { foreach ($this->accompanyingPeriod->getOpenParticipations() as $participation) {
if ($this->persons->contains($participation->getPerson())) { if ($this->persons->contains($participation->getPerson())) {
$personsAssociated[] = $participation->getPerson(); $personsAssociated[] = $participation->getPerson();
} }

View File

@ -1,7 +1,7 @@
<template> <template>
<li> <li>
<span :title="person.text"> <span :title="person.text" @click.prevent="$emit('remove', person)">
<span class="chill_denomination" @click.prevent="$emit('remove', person)"> <span class="chill_denomination">
<person-text :person="person" :isCut="true"></person-text> <person-text :person="person" :isCut="true"></person-text>
</span> </span>
</span> </span>

View File

@ -17,7 +17,8 @@
<a :href="getNotificationUrl(n)">{{ n.title }}</a> <a :href="getNotificationUrl(n)">{{ n.title }}</a>
</span> </span>
</td> </td>
<td>{{ n.sender.text }}</td> <td v-if="n.sender != null">{{ n.sender.text }}</td>
<td v-else>{{ $t('automatic_notification')}}</td>
<td> <td>
<a class="btn btn-sm btn-show" <a class="btn btn-sm btn-show"
:href="getEntityUrl(n)"> :href="getEntityUrl(n)">

View File

@ -53,6 +53,7 @@ const appMessages = {
}, },
emergency: "Urgent", emergency: "Urgent",
confidential: "Confidentiel", confidential: "Confidentiel",
automatic_notification: "Notification automatique"
} }
}; };

View File

@ -11,7 +11,6 @@
* buttonText string * buttonText string
* displayBadge boolean (default: false) replace button by badge, need to define buttonText for content * displayBadge boolean (default: false) replace button by badge, need to define buttonText for content
* parent object (optional) pass parent context of the targetEntity (used for course resource comment) * parent object (optional) pass parent context of the targetEntity (used for course resource comment)
* isDead boolean (default: false) is the person dead
#} #}
<span class="onthefly-container" <span class="onthefly-container"
@ -29,10 +28,6 @@
data-button-text="{{ buttonText|e('html_attr') }}" data-button-text="{{ buttonText|e('html_attr') }}"
{% endif %} {% endif %}
{% if isDead is defined and isDead == 1 %}
data-is-dead="true"
{% endif %}
{% if displayBadge is defined and displayBadge == 1 %} {% if displayBadge is defined and displayBadge == 1 %}
data-display-badge="true" data-display-badge="true"
{% endif %} {% endif %}

View File

@ -60,6 +60,7 @@ class UserRefEventSubscriber implements EventSubscriberInterface
{ {
if ($period->hasPreviousUser() if ($period->hasPreviousUser()
&& $period->getUser() !== $this->security->getUser() && $period->getUser() !== $this->security->getUser()
&& null !== $period->getUser()
&& $period->getStep() !== AccompanyingPeriod::STEP_DRAFT && $period->getStep() !== AccompanyingPeriod::STEP_DRAFT
) { ) {
$this->generateNotificationToUser($period); $this->generateNotificationToUser($period);

View File

@ -30,7 +30,7 @@ class UserAccompanyingPeriodController extends AbstractController
} }
/** /**
* @Route("/{_locale}/accompanying-periods", name="chill_person_accompanying_period_user") * @Route("/{_locale}/person/accompanying-periods/my", name="chill_person_accompanying_period_user")
*/ */
public function listAction(Request $request) public function listAction(Request $request)
{ {
@ -44,13 +44,13 @@ class UserAccompanyingPeriodController extends AbstractController
); );
return $this->render('@ChillPerson/AccompanyingPeriod/user_periods_list.html.twig', [ return $this->render('@ChillPerson/AccompanyingPeriod/user_periods_list.html.twig', [
'accompanyingds' => $accompanyingPeriods, 'accompanyingPeriods' => $accompanyingPeriods,
'pagination' => $pagination, 'pagination' => $pagination,
]); ]);
} }
/** /**
* @Route("/{_locale}/accompanying-periods/drafts", name="chill_person_accompanying_period_draft_user") * @Route("/{_locale}/person/accompanying-periods/my/drafts", name="chill_person_accompanying_period_draft_user")
*/ */
public function listDraftsAction(Request $request) public function listDraftsAction(Request $request)
{ {

View File

@ -71,7 +71,7 @@ final class AccompanyingPeriodRepository implements ObjectRepository
$qb = $this->buildQueryByRecentUserHistory($user, $since); $qb = $this->buildQueryByRecentUserHistory($user, $since);
return $qb->select('a') return $qb->select('a')
->distinct(true) ->addOrderBy('userHistory.startDate', 'DESC')
->getQuery() ->getQuery()
->setMaxResults($limit) ->setMaxResults($limit)
->setFirstResult($offset) ->setFirstResult($offset)
@ -95,6 +95,7 @@ final class AccompanyingPeriodRepository implements ObjectRepository
$qb $qb
->join('a.userHistories', 'userHistory') ->join('a.userHistories', 'userHistory')
->where($qb->expr()->eq('a.user', ':user')) ->where($qb->expr()->eq('a.user', ':user'))
->andWhere($qb->expr()->neq('a.step', "'" . AccompanyingPeriod::STEP_DRAFT . "'"))
->andWhere($qb->expr()->gte('userHistory.startDate', ':since')) ->andWhere($qb->expr()->gte('userHistory.startDate', ':since'))
->andWhere($qb->expr()->isNull('userHistory.endDate')) ->andWhere($qb->expr()->isNull('userHistory.endDate'))
->setParameter('user', $user) ->setParameter('user', $user)

View File

@ -199,7 +199,7 @@ export default {
...mapState({ ...mapState({
suggestedEntities: state => { suggestedEntities: state => {
return [ return [
...state.accompanyingCourse.participations.map(p => p.person), ...state.accompanyingCourse.participations.filter((p) => p.endDate === null).map((p) => p.person),
...state.accompanyingCourse.resources.map(r => r.resource) ...state.accompanyingCourse.resources.map(r => r.resource)
] ]
.filter((e) => e !== null) .filter((e) => e !== null)

View File

@ -77,7 +77,7 @@ export default {
counter: state => state.accompanyingCourse.resources.length, counter: state => state.accompanyingCourse.resources.length,
suggestedEntities: state => [ suggestedEntities: state => [
state.accompanyingCourse.requestor, state.accompanyingCourse.requestor,
...state.accompanyingCourse.participations.map(p => p.person), ...state.accompanyingCourse.participations.filter((p) => p.endDate === null).map((p) => p.person),
] ]
.filter((e) => e !== null) .filter((e) => e !== null)
.filter( .filter(

View File

@ -20,6 +20,8 @@
<div class="flex-table accompanyingcourse-list"> <div class="flex-table accompanyingcourse-list">
{% for period in accompanyingPeriods %} {% for period in accompanyingPeriods %}
{% include '@ChillPerson/AccompanyingPeriod/_list_item.html.twig' with {'period': period, 'recordAction': _self.recordAction(period)} %} {% include '@ChillPerson/AccompanyingPeriod/_list_item.html.twig' with {'period': period, 'recordAction': _self.recordAction(period)} %}
{% else %}
<p class="chill-no-data-statement">{{ 'Any accompanying period'|trans }}</p>
{% endfor %} {% endfor %}
</div> </div>

View File

@ -172,7 +172,7 @@
{%- if options['customButtons']['replace'] is defined -%} {%- if options['customButtons']['replace'] is defined -%}
{{ options['customButtons']['replace'] }} {{ options['customButtons']['replace'] }}
{%- elseif is_granted('CHILL_PERSON_SEE', person) -%} {%- elseif is_granted('CHILL_PERSON_SEE', person) and options['addLink'] -%}
<li> <li>
<a class="btn btn-sm btn-show" title="{{ 'Show person'|trans }}" <a class="btn btn-sm btn-show" title="{{ 'Show person'|trans }}"
href="{{ path('chill_person_view', { person_id: person.id }) }}"></a> href="{{ path('chill_person_view', { person_id: person.id }) }}"></a>

View File

@ -56,6 +56,11 @@
{% if action is defined %} {% if action is defined %}
<ul class="record_actions sticky-form-buttons"> <ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a href="{{ path('chill_person_resource_list', { 'person_id': resource.personOwner.id } ) }}" class="btn btn-cancel">
{{ 'Cancel'|trans }}
</a>
</li>
<li class="edit"> <li class="edit">
<button class="btn btn-edit" <button class="btn btn-edit"
type="submit" id="newPersonResource"> type="submit" id="newPersonResource">

View File

@ -22,41 +22,33 @@
<div class="flex-table"> <div class="flex-table">
{% for resource in personResources %} {% for resource in personResources %}
<div class="item-bloc"> <div class="item-bloc">
<div class="item-row"> {% if resource.kind is not null %}
<div class="item-col" style="width: 50%"> <div class="item-row">
<section>
<p>{{ resource.kind.title.fr|capitalize }}</p>
</section>
</div>
{% endif %}
<div class="{% if resource.kind is not null %} separator {% endif %}">
{% if resource.person is not null %} {% if resource.person is not null %}
<div class="denomination h3"> {{ resource.person|chill_entity_render_box({
<span> 'render': 'bloc',
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { 'addLink': true,
action: 'show', displayBadge: true, 'addInfo': true,
targetEntity: { name: 'person', id: resource.person.id }, 'addAge': true
buttonText: resource.person|chill_entity_render_string, }) }}
isDead: resource.person.deathdate is not null
} %}
</span>
</div>
{% elseif resource.thirdparty is not null %} {% elseif resource.thirdparty is not null %}
<div class="denomination h3"> {{ resource.thirdparty|chill_entity_render_box({
<span> 'render': 'bloc',
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { 'showContacts': false,
action: 'show', displayBadge: true, 'addLink': true,
targetEntity: { name: 'thirdparty', id: resource.thirdparty.id }, 'isConfidential': (resource.thirdparty.contactDataAnonymous ? true : false)
buttonText: resource.thirdParty|chill_entity_render_string, }) }}
parent: resource.thirdparty.parent
} %}
</span>
</div>
{% else %} {% else %}
<div class="denomination h3"> <div class="denomination h3">
<span>{{ resource.freetext }}</span> <span>{{ resource.freetext }}</span>
</div> </div>
{% endif %} {% endif %}
</div>
<div class="item-col" style="justify-content: flex-end; ">
{% if resource.kind %}
<span>{{ resource.kind.title.fr|capitalize }}</span>
{% endif %}
</div>
</div> </div>
{% if resource.comment.comment is not empty %} {% if resource.comment.comment is not empty %}
<div class="item-row separator"> <div class="item-row separator">

View File

@ -62,7 +62,6 @@ class AccompanyingPeriodWorkVoter extends Voter
case self::UPDATE: case self::UPDATE:
return $this->security->isGranted(AccompanyingPeriodVoter::EDIT, $subject->getAccompanyingPeriod()); return $this->security->isGranted(AccompanyingPeriodVoter::EDIT, $subject->getAccompanyingPeriod());
default: default:
throw new UnexpectedValueException("attribute {$attribute} is not supported"); throw new UnexpectedValueException("attribute {$attribute} is not supported");
} }

View File

@ -161,11 +161,13 @@ class AccompanyingPeriodContext implements
'class' => Person::class, 'class' => Person::class,
'choices' => $persons, 'choices' => $persons,
'choice_label' => function (Person $p) { 'choice_label' => function (Person $p) {
return $this->personRender->renderString($p, []); return $this->personRender->renderString($p, ['addAge' => true]);
}, },
'multiple' => false, 'multiple' => false,
'expanded' => true, 'expanded' => true,
'required' => false,
'label' => $options[$key . 'Label'], 'label' => $options[$key . 'Label'],
'placeholder' => $this->translator->trans('Any person selected'),
]); ]);
} }
} }

View File

@ -83,6 +83,12 @@ class PersonRender extends AbstractChillEntityRender
. $this->addAltNames($person, false) . ' (' . $this->translator->trans('years_old', ['age' => $person->getAge()]) . ')'; . $this->addAltNames($person, false) . ' (' . $this->translator->trans('years_old', ['age' => $person->getAge()]) . ')';
} }
if (null !== $person->getDeathDate() && $options['addAge']) {
return $person->getFirstName() . ' ' . $person->getLastName()
. ' (‡)'
. $this->addAltNames($person, false);
}
return $person->getFirstName() . ' ' . $person->getLastName() return $person->getFirstName() . ' ' . $person->getLastName()
. $this->addAltNames($person, false); . $this->addAltNames($person, false);
} }

View File

@ -85,6 +85,7 @@ Course number: Parcours n°
Civility: Civilité Civility: Civilité
choose civility: -- choose civility: --
All genders: tous les genres All genders: tous les genres
Any person selected: Aucune personne sélectionnée
# dédoublonnage # dédoublonnage
Old person: Doublon Old person: Doublon
@ -239,6 +240,7 @@ Select a type: "Choisissez un type"
Select a person: "Choisissez un usager" Select a person: "Choisissez un usager"
Select a thirdparty: "Choisissez un tiers" Select a thirdparty: "Choisissez un tiers"
Contact person: "Personne de contact" Contact person: "Personne de contact"
Kind: "Type"
# pickAPersonType # pickAPersonType

View File

@ -115,7 +115,7 @@
<div class="flex-table"> <div class="flex-table">
{% for tp in thirdParty.activeChildren %} {% for tp in thirdParty.activeChildren %}
<div class="item-bloc"> <div class="item-bloc">
{{ tp|chill_entity_render_box({'render': 'bloc', 'addLink': false}) }} {{ tp|chill_entity_render_box({'render': 'bloc', 'addLink': false, 'isConfidential': tp.contactDataAnonymous ? true : false }) }}
</div> </div>
{% endfor %} {% endfor %}
</div> </div>