mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch 'issue313_activity' into 'master'
activity: avoid existing entities being added in Users, ThirdParties, Persons See merge request Chill-Projet/chill-bundles!237
This commit is contained in:
commit
02a8c1ae10
@ -11,6 +11,7 @@ and this project adheres to
|
|||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
<!-- write down unreleased development here -->
|
<!-- write down unreleased development here -->
|
||||||
|
* [activity] add custom validation on the Activity class, based on what is required from the ActivityType (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/188)
|
||||||
* [main] translate multiselect messages when selecting/creating address
|
* [main] translate multiselect messages when selecting/creating address
|
||||||
* [main] set the coordinates of the city when creating a new address OR choosing "pas d'adresse complète"
|
* [main] set the coordinates of the city when creating a new address OR choosing "pas d'adresse complète"
|
||||||
* Use the user.label in accompanying course banner, instead of username;
|
* Use the user.label in accompanying course banner, instead of username;
|
||||||
|
@ -70,11 +70,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php
|
path: src/Bundle/ChillPersonBundle/Serializer/Normalizer/MembersEditorNormalizer.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Undefined variable\\: \\$value$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/LocationValidityValidator.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Undefined variable\\: \\$choiceSlug$#"
|
message: "#^Undefined variable\\: \\$choiceSlug$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -408,7 +408,7 @@ final class ActivityController extends AbstractController
|
|||||||
|
|
||||||
$activity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']);
|
$activity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']);
|
||||||
|
|
||||||
$defaultLocationId = $this->getUser()->getCurrentLocation()->getId();
|
$defaultLocation = $this->getUser()->getCurrentLocation();
|
||||||
|
|
||||||
return $this->render($view, [
|
return $this->render($view, [
|
||||||
'person' => $person,
|
'person' => $person,
|
||||||
@ -416,7 +416,7 @@ final class ActivityController extends AbstractController
|
|||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
'form' => $form->createView(),
|
'form' => $form->createView(),
|
||||||
'activity_json' => $activity_array,
|
'activity_json' => $activity_array,
|
||||||
'default_location_id' => $defaultLocationId,
|
'default_location' => $defaultLocation,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ class AdminActivityTypeController extends CRUDController
|
|||||||
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
|
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
|
||||||
{
|
{
|
||||||
/** @var \Doctrine\ORM\QueryBuilder $query */
|
/** @var \Doctrine\ORM\QueryBuilder $query */
|
||||||
return $query->orderBy('e.ordering', 'ASC');
|
return $query->orderBy('e.ordering', 'ASC')
|
||||||
|
->addOrderBy('e.id', 'ASC');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
namespace Chill\ActivityBundle\Entity;
|
namespace Chill\ActivityBundle\Entity;
|
||||||
|
|
||||||
|
use Chill\ActivityBundle\Validator\Constraints as ActivityValidator;
|
||||||
use Chill\DocStoreBundle\Entity\Document;
|
use Chill\DocStoreBundle\Entity\Document;
|
||||||
use Chill\MainBundle\Entity\Center;
|
use Chill\MainBundle\Entity\Center;
|
||||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||||
@ -41,6 +42,7 @@ use Symfony\Component\Serializer\Annotation\SerializedName;
|
|||||||
* @DiscriminatorMap(typeProperty="type", mapping={
|
* @DiscriminatorMap(typeProperty="type", mapping={
|
||||||
* "activity": Activity::class
|
* "activity": Activity::class
|
||||||
* })
|
* })
|
||||||
|
* @ActivityValidator\ActivityValidity
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -202,7 +204,9 @@ class Activity implements HasCenterInterface, HasScopeInterface, AccompanyingPer
|
|||||||
public function addPerson(?Person $person): self
|
public function addPerson(?Person $person): self
|
||||||
{
|
{
|
||||||
if (null !== $person) {
|
if (null !== $person) {
|
||||||
$this->persons[] = $person;
|
if (!$this->persons->contains($person)) {
|
||||||
|
$this->persons[] = $person;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@ -236,7 +240,9 @@ class Activity implements HasCenterInterface, HasScopeInterface, AccompanyingPer
|
|||||||
public function addThirdParty(?ThirdParty $thirdParty): self
|
public function addThirdParty(?ThirdParty $thirdParty): self
|
||||||
{
|
{
|
||||||
if (null !== $thirdParty) {
|
if (null !== $thirdParty) {
|
||||||
$this->thirdParties[] = $thirdParty;
|
if (!$this->thirdParties->contains($thirdParty)) {
|
||||||
|
$this->thirdParties[] = $thirdParty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@ -245,7 +251,9 @@ class Activity implements HasCenterInterface, HasScopeInterface, AccompanyingPer
|
|||||||
public function addUser(?User $user): self
|
public function addUser(?User $user): self
|
||||||
{
|
{
|
||||||
if (null !== $user) {
|
if (null !== $user) {
|
||||||
$this->users[] = $user;
|
if (!$this->users->contains($user)) {
|
||||||
|
$this->users[] = $user;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -12,6 +12,7 @@ namespace Chill\ActivityBundle\Entity;
|
|||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use Symfony\Component\Serializer\Annotation\Groups;
|
use Symfony\Component\Serializer\Annotation\Groups;
|
||||||
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ActivityType.
|
* Class ActivityType.
|
||||||
@ -29,11 +30,13 @@ class ActivityType
|
|||||||
public const FIELD_REQUIRED = 2;
|
public const FIELD_REQUIRED = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @deprecated not in use
|
||||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||||
*/
|
*/
|
||||||
private string $accompanyingPeriodLabel = '';
|
private string $accompanyingPeriodLabel = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @deprecated not in use
|
||||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
||||||
*/
|
*/
|
||||||
private int $accompanyingPeriodVisible = self::FIELD_INVISIBLE;
|
private int $accompanyingPeriodVisible = self::FIELD_INVISIBLE;
|
||||||
@ -195,16 +198,21 @@ class ActivityType
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
||||||
|
* @Assert\EqualTo(propertyPath="socialIssuesVisible", message="This parameter must be equal to social issue parameter")
|
||||||
*/
|
*/
|
||||||
private int $socialActionsVisible = self::FIELD_INVISIBLE;
|
private int $socialActionsVisible = self::FIELD_INVISIBLE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
* @ORM\Column(type="string", nullable=false, options={"default": ""})
|
||||||
|
*
|
||||||
|
* @deprecated not in use
|
||||||
*/
|
*/
|
||||||
private string $socialDataLabel = '';
|
private string $socialDataLabel = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
||||||
|
*
|
||||||
|
* @deprecated not in use
|
||||||
*/
|
*/
|
||||||
private int $socialDataVisible = self::FIELD_INVISIBLE;
|
private int $socialDataVisible = self::FIELD_INVISIBLE;
|
||||||
|
|
||||||
@ -260,16 +268,6 @@ class ActivityType
|
|||||||
*/
|
*/
|
||||||
private int $userVisible = self::FIELD_REQUIRED;
|
private int $userVisible = self::FIELD_REQUIRED;
|
||||||
|
|
||||||
public function getAccompanyingPeriodLabel(): string
|
|
||||||
{
|
|
||||||
return $this->accompanyingPeriodLabel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getAccompanyingPeriodVisible(): int
|
|
||||||
{
|
|
||||||
return $this->accompanyingPeriodVisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get active
|
* Get active
|
||||||
* return true if the type is active.
|
* return true if the type is active.
|
||||||
@ -446,16 +444,6 @@ class ActivityType
|
|||||||
return $this->socialActionsVisible;
|
return $this->socialActionsVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSocialDataLabel(): string
|
|
||||||
{
|
|
||||||
return $this->socialDataLabel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getSocialDataVisible(): int
|
|
||||||
{
|
|
||||||
return $this->socialDataVisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getSocialIssuesLabel(): ?string
|
public function getSocialIssuesLabel(): ?string
|
||||||
{
|
{
|
||||||
return $this->socialIssuesLabel;
|
return $this->socialIssuesLabel;
|
||||||
@ -537,20 +525,6 @@ class ActivityType
|
|||||||
return self::FIELD_INVISIBLE !== $this->{$property};
|
return self::FIELD_INVISIBLE !== $this->{$property};
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setAccompanyingPeriodLabel(string $accompanyingPeriodLabel): self
|
|
||||||
{
|
|
||||||
$this->accompanyingPeriodLabel = $accompanyingPeriodLabel;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setAccompanyingPeriodVisible(int $accompanyingPeriodVisible): self
|
|
||||||
{
|
|
||||||
$this->accompanyingPeriodVisible = $accompanyingPeriodVisible;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set active
|
* Set active
|
||||||
* set to true if the type is active.
|
* set to true if the type is active.
|
||||||
@ -768,20 +742,6 @@ class ActivityType
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setSocialDataLabel(string $socialDataLabel): self
|
|
||||||
{
|
|
||||||
$this->socialDataLabel = $socialDataLabel;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setSocialDataVisible(int $socialDataVisible): self
|
|
||||||
{
|
|
||||||
$this->socialDataVisible = $socialDataVisible;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setSocialIssuesLabel(string $socialIssuesLabel): self
|
public function setSocialIssuesLabel(string $socialIssuesLabel): self
|
||||||
{
|
{
|
||||||
$this->socialIssuesLabel = $socialIssuesLabel;
|
$this->socialIssuesLabel = $socialIssuesLabel;
|
||||||
|
@ -56,7 +56,7 @@ class ActivityTypeType extends AbstractType
|
|||||||
'persons', 'user', 'date', 'place', 'persons',
|
'persons', 'user', 'date', 'place', 'persons',
|
||||||
'thirdParties', 'durationTime', 'travelTime', 'attendee',
|
'thirdParties', 'durationTime', 'travelTime', 'attendee',
|
||||||
'reasons', 'comment', 'sentReceived', 'documents',
|
'reasons', 'comment', 'sentReceived', 'documents',
|
||||||
'emergency', 'accompanyingPeriod', 'socialData', 'users',
|
'emergency', 'socialIssues', 'socialActions', 'users',
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<concerned-groups></concerned-groups>
|
<concerned-groups v-if="hasPerson"></concerned-groups>
|
||||||
<social-issues-acc></social-issues-acc>
|
<social-issues-acc v-if="hasSocialIssues"></social-issues-acc>
|
||||||
<location></location>
|
<location v-if="hasLocation"></location>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -11,6 +11,7 @@ import Location from './components/Location.vue';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "App",
|
name: "App",
|
||||||
|
props: ['hasSocialIssues', 'hasLocation', 'hasPerson'],
|
||||||
components: {
|
components: {
|
||||||
ConcernedGroups,
|
ConcernedGroups,
|
||||||
SocialIssuesAcc,
|
SocialIssuesAcc,
|
||||||
|
@ -7,8 +7,19 @@ import App from './App.vue';
|
|||||||
|
|
||||||
const i18n = _createI18n(activityMessages);
|
const i18n = _createI18n(activityMessages);
|
||||||
|
|
||||||
|
const hasSocialIssues = document.querySelector('#social-issues-acc') !== null;
|
||||||
|
const hasLocation = document.querySelector('#location') !== null;
|
||||||
|
const hasPerson = document.querySelector('#add-persons') !== null;
|
||||||
|
|
||||||
const app = createApp({
|
const app = createApp({
|
||||||
template: `<app></app>`,
|
template: `<app :hasSocialIssues="hasSocialIssues", :hasLocation="hasLocation", :hasPerson="hasPerson"></app>`,
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
hasSocialIssues,
|
||||||
|
hasLocation,
|
||||||
|
hasPerson,
|
||||||
|
};
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.use(store)
|
.use(store)
|
||||||
.use(i18n)
|
.use(i18n)
|
||||||
|
@ -28,7 +28,9 @@
|
|||||||
{{ form_row(edit_form.socialActions) }}
|
{{ form_row(edit_form.socialActions) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{%- if edit_form.socialIssues is defined or edit_form.socialIssues is defined -%}
|
||||||
<div id="social-issues-acc"></div>
|
<div id="social-issues-acc"></div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{%- if edit_form.reasons is defined -%}
|
{%- if edit_form.reasons is defined -%}
|
||||||
{{ form_row(edit_form.reasons) }}
|
{{ form_row(edit_form.reasons) }}
|
||||||
@ -46,9 +48,10 @@
|
|||||||
{%- if edit_form.users is defined -%}
|
{%- if edit_form.users is defined -%}
|
||||||
{{ form_widget(edit_form.users) }}
|
{{ form_widget(edit_form.users) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<div id="add-persons"></div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div id="add-persons"></div>
|
|
||||||
|
|
||||||
<h2 class="chill-red">{{ 'Activity data'|trans }}</h2>
|
<h2 class="chill-red">{{ 'Activity data'|trans }}</h2>
|
||||||
|
|
||||||
|
@ -29,25 +29,29 @@
|
|||||||
{{ form_row(form.socialActions) }}
|
{{ form_row(form.socialActions) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div id="social-issues-acc"></div>
|
{%- if edit_form.socialIssues is defined or edit_form.socialIssues is defined -%}
|
||||||
|
<div id="social-issues-acc"></div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{%- if form.reasons is defined -%}
|
{%- if form.reasons is defined -%}
|
||||||
{{ form_row(form.reasons) }}
|
{{ form_row(form.reasons) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2>
|
{%- if edit_form.persons is defined or edit_form.thirdParties is defined or edit_form.users is defined -%}
|
||||||
|
<h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2>
|
||||||
|
|
||||||
{%- if form.persons is defined -%}
|
{%- if form.persons is defined -%}
|
||||||
{{ form_widget(form.persons) }}
|
{{ form_widget(form.persons) }}
|
||||||
|
{% endif %}
|
||||||
|
{%- if form.thirdParties is defined -%}
|
||||||
|
{{ form_widget(form.thirdParties) }}
|
||||||
|
{% endif %}
|
||||||
|
{%- if form.users is defined -%}
|
||||||
|
{{ form_widget(form.users) }}
|
||||||
|
{% endif %}
|
||||||
|
<div id="add-persons"></div>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- if form.thirdParties is defined -%}
|
|
||||||
{{ form_widget(form.thirdParties) }}
|
|
||||||
{% endif %}
|
|
||||||
{%- if form.users is defined -%}
|
|
||||||
{{ form_widget(form.users) }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<div id="add-persons"></div>
|
|
||||||
|
|
||||||
<h2 class="chill-red">{{ 'Activity data'|trans }}</h2>
|
<h2 class="chill-red">{{ 'Activity data'|trans }}</h2>
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
||||||
});
|
});
|
||||||
window.activity = {{ activity_json|json_encode|raw }};
|
window.activity = {{ activity_json|json_encode|raw }};
|
||||||
window.default_location_id = {{ default_location_id }};
|
{% if default_location is not null %}window.default_location_id = {{ default_location.id }}{% endif %};
|
||||||
</script>
|
</script>
|
||||||
{{ encore_entry_script_tags('vue_activity') }}
|
{{ encore_entry_script_tags('vue_activity') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\ActivityBundle\Validator\Constraints;
|
||||||
|
|
||||||
|
use Symfony\Component\Validator\Constraint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Annotation
|
||||||
|
*/
|
||||||
|
class ActivityValidity extends Constraint
|
||||||
|
{
|
||||||
|
public const IS_REQUIRED_MESSAGE = ' is required';
|
||||||
|
|
||||||
|
public const ROOT_MESSAGE = 'For this type of activity, ';
|
||||||
|
|
||||||
|
public $noPersonsMessage = 'For this type of activity, you must add at least one person';
|
||||||
|
|
||||||
|
public $noThirdPartiesMessage = 'For this type of activity, you must add at least one third party';
|
||||||
|
|
||||||
|
public $noUsersMessage = 'For this type of activity, you must add at least one user';
|
||||||
|
|
||||||
|
public $socialActionsMessage = 'For this type of activity, you must add at least one social action';
|
||||||
|
|
||||||
|
public $socialIssuesMessage = 'For this type of activity, you must add at least one social issue';
|
||||||
|
|
||||||
|
public function getTargets()
|
||||||
|
{
|
||||||
|
return self::CLASS_CONSTRAINT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function makeIsRequiredMessage(string $property)
|
||||||
|
{
|
||||||
|
return self::ROOT_MESSAGE . $property . self::IS_REQUIRED_MESSAGE;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,126 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\ActivityBundle\Validator\Constraints;
|
||||||
|
|
||||||
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
|
use Symfony\Component\Validator\Constraint;
|
||||||
|
use Symfony\Component\Validator\ConstraintValidator;
|
||||||
|
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
||||||
|
use Symfony\Component\Validator\Exception\UnexpectedValueException;
|
||||||
|
|
||||||
|
class ActivityValidityValidator extends ConstraintValidator
|
||||||
|
{
|
||||||
|
public function validate($activity, Constraint $constraint)
|
||||||
|
{
|
||||||
|
if (!$constraint instanceof ActivityValidity) {
|
||||||
|
throw new UnexpectedTypeException($constraint, ActivityValidity::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$activity instanceof Activity) {
|
||||||
|
throw new UnexpectedValueException($activity, Activity::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activity->getActivityType()->getPersonsVisible() === 2 && count($activity->getPersons()) === 0) {
|
||||||
|
$this->context
|
||||||
|
->buildViolation($constraint->noPersonsMessage)
|
||||||
|
->addViolation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activity->getActivityType()->getUsersVisible() === 2 && count($activity->getUsers()) === 0) {
|
||||||
|
$this->context
|
||||||
|
->buildViolation($constraint->noUsersMessage)
|
||||||
|
->addViolation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activity->getActivityType()->getThirdPartiesVisible() === 2 && count($activity->getThirdParties()) === 0) {
|
||||||
|
$this->context
|
||||||
|
->buildViolation($constraint->noThirdPartiesMessage)
|
||||||
|
->addViolation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activity->getActivityType()->getUserVisible() === 2 && null === $activity->getUser()) {
|
||||||
|
$this->context
|
||||||
|
->buildViolation($constraint->makeIsRequiredMessage('user'))
|
||||||
|
->addViolation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activity->getActivityType()->getDateVisible() === 2 && null === $activity->getDate()) {
|
||||||
|
$this->context
|
||||||
|
->buildViolation($constraint->makeIsRequiredMessage('date'))
|
||||||
|
->addViolation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activity->getActivityType()->getLocationVisible() === 2 && null === $activity->getLocation()) {
|
||||||
|
$this->context
|
||||||
|
->buildViolation($constraint->makeIsRequiredMessage('location'))
|
||||||
|
->addViolation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activity->getActivityType()->getDurationTimeVisible() === 2 && null === $activity->getDurationTime()) {
|
||||||
|
$this->context
|
||||||
|
->buildViolation($constraint->makeIsRequiredMessage('duration time'))
|
||||||
|
->addViolation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activity->getActivityType()->getTravelTimeVisible() === 2 && null === $activity->getTravelTime()) {
|
||||||
|
$this->context
|
||||||
|
->buildViolation($constraint->makeIsRequiredMessage('travel time'))
|
||||||
|
->addViolation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activity->getActivityType()->getAttendeeVisible() === 2 && null === $activity->getAttendee()) {
|
||||||
|
$this->context
|
||||||
|
->buildViolation($constraint->makeIsRequiredMessage('attendee'))
|
||||||
|
->addViolation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activity->getActivityType()->getReasonsVisible() === 2 && null === $activity->getReasons()) {
|
||||||
|
$this->context
|
||||||
|
->buildViolation($constraint->makeIsRequiredMessage('reasons'))
|
||||||
|
->addViolation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activity->getActivityType()->getCommentVisible() === 2 && null === $activity->getComment()) {
|
||||||
|
$this->context
|
||||||
|
->buildViolation($constraint->makeIsRequiredMessage('comment'))
|
||||||
|
->addViolation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activity->getActivityType()->getSentReceivedVisible() === 2 && null === $activity->getSentReceived()) {
|
||||||
|
$this->context
|
||||||
|
->buildViolation($constraint->makeIsRequiredMessage('sent/received'))
|
||||||
|
->addViolation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activity->getActivityType()->getDocumentsVisible() === 2 && null === $activity->getDocuments()) {
|
||||||
|
$this->context
|
||||||
|
->buildViolation($constraint->makeIsRequiredMessage('document'))
|
||||||
|
->addViolation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activity->getActivityType()->getEmergencyVisible() === 2 && null === $activity->getEmergency()) {
|
||||||
|
$this->context
|
||||||
|
->buildViolation($constraint->makeIsRequiredMessage('emergency'))
|
||||||
|
->addViolation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activity->getActivityType()->getSocialIssuesVisible() === 2 && $activity->getSocialIssues()->count() === 0) {
|
||||||
|
$this->context
|
||||||
|
->buildViolation($constraint->socialIssuesMessage)
|
||||||
|
->addViolation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($activity->getActivityType()->getSocialActionsVisible() === 2 && $activity->getSocialActions()->count() === 0) {
|
||||||
|
$this->context
|
||||||
|
->buildViolation($constraint->socialActionsMessage)
|
||||||
|
->addViolation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -27,3 +27,8 @@ services:
|
|||||||
|
|
||||||
Chill\ActivityBundle\Repository\:
|
Chill\ActivityBundle\Repository\:
|
||||||
resource: '../Repository/'
|
resource: '../Repository/'
|
||||||
|
|
||||||
|
Chill\ActivityBundle\Validator\Constraints\:
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
|
resource: '../Validator/Constraints/'
|
||||||
|
@ -139,34 +139,40 @@ ActivityReasonCategory is inactive and won't be proposed: La catégorie est inac
|
|||||||
# activity type type admin
|
# activity type type admin
|
||||||
ActivityType list: Types d'activités
|
ActivityType list: Types d'activités
|
||||||
Create a new activity type: Créer un nouveau type d'activité
|
Create a new activity type: Créer un nouveau type d'activité
|
||||||
Persons visible: Visibilté du champ Personnes
|
Persons visible: Visibilité du champ Personnes
|
||||||
Persons label: Libellé du champ Personnes
|
Persons label: Libellé du champ Personnes
|
||||||
User visible: Visibilté du champ Utilisateur
|
User visible: Visibilité du champ Utilisateur
|
||||||
User label: Libellé du champ Utilisateur
|
User label: Libellé du champ Utilisateur
|
||||||
Date visible: Visibilté du champ Date
|
Date visible: Visibilité du champ Date
|
||||||
Date label: Libellé du champ Date
|
Date label: Libellé du champ Date
|
||||||
Place visible: Visibilté du champ Lieu
|
Place visible: Visibilité du champ Lieu
|
||||||
Place label: Libellé du champ Lieu
|
Place label: Libellé du champ Lieu
|
||||||
Third parties visible: Visibilté du champ Tiers
|
Third parties visible: Visibilité du champ Tiers
|
||||||
Third parties label: Libellé du champ Tiers
|
Third parties label: Libellé du champ Tiers
|
||||||
Duration time visible: Visibilté du champ Durée
|
Duration time visible: Visibilité du champ Durée
|
||||||
Duration time label: Libellé du champ Durée
|
Duration time label: Libellé du champ Durée
|
||||||
Travel time visible: Visibilté du champ Durée de déplacement
|
Travel time visible: Visibilité du champ Durée de déplacement
|
||||||
Travel time label: Libellé du champ Durée de déplacement
|
Travel time label: Libellé du champ Durée de déplacement
|
||||||
Attendee visible: Visibilté du champ Présence de l'usager
|
Attendee visible: Visibilité du champ Présence de l'usager
|
||||||
Attendee label: Libellé du champ Présence de l'usager
|
Attendee label: Libellé du champ Présence de l'usager
|
||||||
Reasons visible: Visibilté du champ Sujet
|
Reasons visible: Visibilité du champ Sujet
|
||||||
Reasons label: Libellé du champ Sujet
|
Reasons label: Libellé du champ Sujet
|
||||||
Comment visible: Visibilté du champ Commentaire
|
Comment visible: Visibilité du champ Commentaire
|
||||||
Comment label: Libellé du champ Commentaire
|
Comment label: Libellé du champ Commentaire
|
||||||
Emergency visible: Visibilté du champ Urgent
|
Emergency visible: Visibilité du champ Urgent
|
||||||
Emergency label: Libellé du champ Urgent
|
Emergency label: Libellé du champ Urgent
|
||||||
Accompanying period visible: Visibilté du champ Période d'accompagnement
|
Accompanying period visible: Visibilité du champ Période d'accompagnement
|
||||||
Accompanying period label: Libellé du champ Période d'accompagnement
|
Accompanying period label: Libellé du champ Période d'accompagnement
|
||||||
Social data visible: Visibilté du champ Données sociales
|
Social issues visible: Visibilité du champ Problématiques sociales
|
||||||
Social data label: Libellé du champ Données sociales
|
Social issues label: Libellé du champ Problématiques sociales
|
||||||
Users visible: Visibilté du champ Utilisateurs
|
Social actions visible: Visibilité du champ Action sociale
|
||||||
|
Social actions label: Libellé du champ Action sociale
|
||||||
|
Users visible: Visibilité du champ Utilisateurs
|
||||||
Users label: Libellé du champ Utilisateurs
|
Users label: Libellé du champ Utilisateurs
|
||||||
|
Sent received visible: Visibilité du champ Entrant / Sortant
|
||||||
|
Sent received label: Libellé du champ Entrant / Sortant
|
||||||
|
Documents visible: Visibilité du champ Documents
|
||||||
|
Documents label: Libellé du champ Documents
|
||||||
|
|
||||||
# activity type category admin
|
# activity type category admin
|
||||||
ActivityTypeCategory list: Liste des catégories des types d'activité
|
ActivityTypeCategory list: Liste des catégories des types d'activité
|
||||||
|
@ -1,2 +1,22 @@
|
|||||||
The reasons's level should not be empty: Le niveau du sujet ne peut pas être vide
|
The reasons's level should not be empty: Le niveau du sujet ne peut pas être vide
|
||||||
At least one reason must be choosen: Au moins un sujet doit être choisi
|
At least one reason must be choosen: Au moins un sujet doit être choisi
|
||||||
|
For this type of activity, you must add at least one person: Pour ce type d'activité, vous devez ajouter au moins un usager
|
||||||
|
For this type of activity, you must add at least one user: Pour ce type d'activité, vous devez ajouter au moins un utilisateur
|
||||||
|
For this type of activity, you must add at least one third party: Pour ce type d'activité, vous devez ajouter au moins un tiers
|
||||||
|
For this type of activity, user is required: Pour ce type d'activité, l'utilisateur est requis
|
||||||
|
For this type of activity, date is required: Pour ce type d'activité, la date est requise
|
||||||
|
For this type of activity, location is required: Pour ce type d'activité, la localisation est requise
|
||||||
|
For this type of activity, attendee is required: Pour ce type d'activité, le champ "Présence de la personne" est requis
|
||||||
|
For this type of activity, duration time is required: Pour ce type d'activité, la durée est requise
|
||||||
|
For this type of activity, travel time is required: Pour ce type d'activité, la durée du trajet est requise
|
||||||
|
For this type of activity, reasons is required: Pour ce type d'activité, le champ "sujet" est requis
|
||||||
|
For this type of activity, comment is required: Pour ce type d'activité, un commentaire est requis
|
||||||
|
For this type of activity, sent/received is required: Pour ce type d'activité, le champ Entrant/Sortant est requis
|
||||||
|
For this type of activity, document is required: Pour ce type d'activité, un document est requis
|
||||||
|
For this type of activity, emergency is required: Pour ce type d'activité, le champ "Urgent" est requis
|
||||||
|
For this type of activity, accompanying period is required: Pour ce type d'activité, le parcours d'accompagnement est requis
|
||||||
|
For this type of activity, you must add at least one social issue: Pour ce type d'activité, vous devez ajouter au moins une problématique sociale
|
||||||
|
For this type of activity, you must add at least one social action: Pour ce type d'activité, vous devez indiquez au moins une action sociale
|
||||||
|
|
||||||
|
# admin
|
||||||
|
This parameter must be equal to social issue parameter: Ce paramètre doit être égal au paramètre "Visibilité du champs Problématiques sociales"
|
||||||
|
@ -32,7 +32,7 @@ class LocationValidityValidator extends ConstraintValidator
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$period instanceof AccompanyingPeriod) {
|
if (!$period instanceof AccompanyingPeriod) {
|
||||||
throw new UnexpectedValueException($value, AccompanyingPeriod::class);
|
throw new UnexpectedValueException($period, AccompanyingPeriod::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($period->getLocationStatus() === 'person') {
|
if ($period->getLocationStatus() === 'person') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user