mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch 'issue441_enfant_confie'
This commit is contained in:
commit
e10a6b4bf2
@ -14,6 +14,7 @@ and this project adheres to
|
||||
<!-- write down unreleased development here -->
|
||||
* [person] Order social issues by the field "ordering" (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/388)
|
||||
* [Person/Household list] when listing other simultaneous members of an household, exclude the members on person, not on members (avoid to show two membersship with the same person)
|
||||
* [Person] Display suffixText in RenderPerson, PersonText.vue, RenderPersonBox.vue (was made for displaying "enfant confie") (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/441)
|
||||
|
||||
## Test releases
|
||||
|
||||
|
@ -22,7 +22,7 @@ use Chill\DocStoreBundle\Repository\DocumentCategoryRepository;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Templating\Entity\PersonRender;
|
||||
use Chill\PersonBundle\Templating\Entity\PersonRenderInterface;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
@ -43,7 +43,7 @@ class ActivityContext implements
|
||||
|
||||
private NormalizerInterface $normalizer;
|
||||
|
||||
private PersonRender $personRender;
|
||||
private PersonRenderInterface $personRender;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
@ -54,7 +54,7 @@ class ActivityContext implements
|
||||
NormalizerInterface $normalizer,
|
||||
TranslatableStringHelperInterface $translatableStringHelper,
|
||||
EntityManagerInterface $em,
|
||||
PersonRender $personRender,
|
||||
PersonRenderInterface $personRender,
|
||||
TranslatorInterface $translator,
|
||||
BaseContextData $baseContextData
|
||||
) {
|
||||
|
@ -29,7 +29,6 @@ use Chill\MainBundle\Security\ProvideRoleInterface;
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverInterface;
|
||||
use Chill\MainBundle\Security\Resolver\ScopeResolverInterface;
|
||||
use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface;
|
||||
use Chill\MainBundle\Templating\Entity\CompilerPass as RenderEntityCompilerPass;
|
||||
use Chill\MainBundle\Templating\UI\NotificationCounterInterface;
|
||||
use Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
@ -70,7 +69,6 @@ class ChillMainBundle extends Bundle
|
||||
$container->addCompilerPass(new MenuCompilerPass());
|
||||
$container->addCompilerPass(new ACLFlagsCompilerPass());
|
||||
$container->addCompilerPass(new GroupingCenterCompilerPass());
|
||||
$container->addCompilerPass(new RenderEntityCompilerPass());
|
||||
$container->addCompilerPass(new CRUDControllerCompilerPass());
|
||||
}
|
||||
}
|
||||
|
@ -25,21 +25,17 @@ class ChillEntityRenderExtension extends AbstractExtension
|
||||
protected $defaultRender;
|
||||
|
||||
/**
|
||||
* @var ChillEntityRenderInterface
|
||||
* @var iterable|ChillEntityRenderInterface[]
|
||||
*/
|
||||
protected $renders = [];
|
||||
|
||||
/**
|
||||
* ChillEntityRenderExtension constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(iterable $renders)
|
||||
{
|
||||
$this->defaultRender = new ChillEntityRender();
|
||||
}
|
||||
|
||||
public function addRender(ChillEntityRenderInterface $render)
|
||||
{
|
||||
$this->renders[] = $render;
|
||||
$this->renders = $renders;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,31 +0,0 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\Templating\Entity;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* Add service tagged with `chill.render_entity` to appropriate service.
|
||||
*/
|
||||
class CompilerPass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
$extension = $container->getDefinition(ChillEntityRenderExtension::class);
|
||||
|
||||
foreach ($container->findTaggedServiceIds('chill.render_entity') as $id => $tags) {
|
||||
$extension->addMethodCall('addRender', [new Reference($id)]);
|
||||
}
|
||||
}
|
||||
}
|
@ -32,6 +32,8 @@ services:
|
||||
- { name: twig.extension }
|
||||
|
||||
Chill\MainBundle\Templating\Entity\ChillEntityRenderExtension:
|
||||
arguments:
|
||||
$renders: !tagged_iterator chill.render_entity
|
||||
tags:
|
||||
- { name: twig.extension }
|
||||
|
||||
|
@ -16,7 +16,7 @@ use Chill\MainBundle\Form\Type\CommentType;
|
||||
use Chill\PersonBundle\Entity\Person\PersonResource;
|
||||
use Chill\PersonBundle\Entity\Person\PersonResourceKind;
|
||||
use Chill\PersonBundle\Form\Type\PickPersonDynamicType;
|
||||
use Chill\PersonBundle\Templating\Entity\PersonRender;
|
||||
use Chill\PersonBundle\Templating\Entity\PersonRenderInterface;
|
||||
use Chill\PersonBundle\Templating\Entity\ResourceKindRender;
|
||||
use Chill\ThirdPartyBundle\Form\Type\PickThirdpartyDynamicType;
|
||||
use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
|
||||
@ -29,7 +29,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
final class PersonResourceType extends AbstractType
|
||||
{
|
||||
private PersonRender $personRender;
|
||||
private PersonRenderInterface $personRender;
|
||||
|
||||
private ResourceKindRender $resourceKindRender;
|
||||
|
||||
@ -37,7 +37,7 @@ final class PersonResourceType extends AbstractType
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(ResourceKindRender $resourceKindRender, PersonRender $personRender, ThirdPartyRender $thirdPartyRender, TranslatorInterface $translator)
|
||||
public function __construct(ResourceKindRender $resourceKindRender, PersonRenderInterface $personRender, ThirdPartyRender $thirdPartyRender, TranslatorInterface $translator)
|
||||
{
|
||||
$this->resourceKindRender = $resourceKindRender;
|
||||
$this->personRender = $personRender;
|
||||
|
@ -12,6 +12,7 @@
|
||||
<!-- use person-text here to avoid code duplication ? TODO -->
|
||||
<span class="firstname">{{ person.firstName }}</span>
|
||||
<span class="lastname">{{ person.lastName }}</span>
|
||||
<span v-if="person.suffixText" class="suffixtext"> {{ person.suffixText }}</span>
|
||||
<span v-if="person.altNames && options.addAltNames == true" class="altnames">
|
||||
<span :class="'altname altname-' + altNameKey">{{ altNameLabel }}</span>
|
||||
</span>
|
||||
@ -20,6 +21,7 @@
|
||||
<!-- use person-text here to avoid code duplication ? TODO -->
|
||||
<span class="firstname">{{ person.firstName }}</span>
|
||||
<span class="lastname">{{ person.lastName }}</span>
|
||||
<span v-if="person.suffixText" class="suffixtext"> {{ person.suffixText }}</span>
|
||||
<span v-if="person.deathdate" class="deathdate"> (‡)</span>
|
||||
<span v-if="person.altNames && options.addAltNames == true" class="altnames">
|
||||
<span :class="'altname altname-' + altNameKey">{{ altNameLabel }}</span>
|
||||
|
@ -6,6 +6,7 @@
|
||||
<span v-if="person.altNames && person.altNames.length > 0" class="altnames">
|
||||
<span :class="'altname altname-' + altNameKey"> ({{ altNameLabel }})</span>
|
||||
</span>
|
||||
<span v-if="person.suffixText" class="suffixtext"> {{ person.suffixText }}</span>
|
||||
<span class="age" v-if="this.addAge && person.birthdate !== null && person.deathdate === null">{{ $tc('renderbox.years_old', person.age) }}</span>
|
||||
<span v-else-if="this.addAge && person.deathdate !== null"> (‡)</span>
|
||||
</span>
|
||||
|
@ -12,6 +12,7 @@
|
||||
* hLevel integer
|
||||
* addDeath bool
|
||||
* addAgeBadge bool
|
||||
* suffixText bool
|
||||
* address_multiline bool
|
||||
* customButtons [
|
||||
'before' Twig\Markup, (injected with macro)
|
||||
@ -46,6 +47,11 @@
|
||||
<span>({{- 'years_old'|trans({ 'age': person.age }) -}})</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{%- if options['suffixText'] is defined -%}
|
||||
{% for o in options['suffixText'] %}
|
||||
<span>{{ o }}</span>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endmacro raw %}
|
||||
|
||||
{% macro label(person, options) %}
|
||||
|
@ -15,7 +15,7 @@ use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Repository\PersonNotDuplicateRepository;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Chill\PersonBundle\Templating\Entity\PersonRender;
|
||||
use Chill\PersonBundle\Templating\Entity\PersonRenderInterface;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
|
||||
@ -39,7 +39,7 @@ class SimilarPersonMatcher
|
||||
|
||||
protected PersonNotDuplicateRepository $personNotDuplicateRepository;
|
||||
|
||||
protected PersonRender $personRender;
|
||||
protected PersonRenderInterface $personRender;
|
||||
|
||||
/**
|
||||
* @var TokenStorageInterface
|
||||
@ -51,7 +51,7 @@ class SimilarPersonMatcher
|
||||
AuthorizationHelper $authorizationHelper,
|
||||
TokenStorageInterface $tokenStorage,
|
||||
PersonNotDuplicateRepository $personNotDuplicateRepository,
|
||||
PersonRender $personRender
|
||||
PersonRenderInterface $personRender
|
||||
) {
|
||||
$this->em = $em;
|
||||
$this->authorizationHelper = $authorizationHelper;
|
||||
|
@ -19,7 +19,7 @@ use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Entity\PersonAltName;
|
||||
use Chill\PersonBundle\Repository\Relationships\RelationshipRepository;
|
||||
use Chill\PersonBundle\Templating\Entity\PersonRender;
|
||||
use Chill\PersonBundle\Templating\Entity\PersonRenderInterface;
|
||||
use DateTimeInterface;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
|
||||
@ -37,7 +37,7 @@ class PersonDocGenNormalizer implements
|
||||
{
|
||||
use NormalizerAwareTrait;
|
||||
|
||||
private PersonRender $personRender;
|
||||
private PersonRenderInterface $personRender;
|
||||
|
||||
private RelationshipRepository $relationshipRepository;
|
||||
|
||||
@ -46,7 +46,7 @@ class PersonDocGenNormalizer implements
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
PersonRender $personRender,
|
||||
PersonRenderInterface $personRender,
|
||||
RelationshipRepository $relationshipRepository,
|
||||
TranslatorInterface $translator,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
|
@ -23,26 +23,18 @@ use Doctrine\Common\Collections\Collection;
|
||||
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait;
|
||||
use function array_key_exists;
|
||||
|
||||
/**
|
||||
* Serialize a Person entity.
|
||||
*/
|
||||
class PersonJsonNormalizer implements
|
||||
DenormalizerAwareInterface,
|
||||
DenormalizerInterface,
|
||||
NormalizerAwareInterface,
|
||||
NormalizerInterface
|
||||
class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwareInterface, PersonJsonNormalizerInterface
|
||||
{
|
||||
use DenormalizerAwareTrait;
|
||||
|
||||
use NormalizerAwareTrait;
|
||||
|
||||
use ObjectToPopulateTrait;
|
||||
|
||||
private CenterResolverManagerInterface $centerResolverManager;
|
||||
|
@ -0,0 +1,24 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Serializer\Normalizer;
|
||||
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
|
||||
/**
|
||||
* Serialize a Person entity.
|
||||
*/
|
||||
interface PersonJsonNormalizerInterface extends
|
||||
DenormalizerInterface,
|
||||
NormalizerInterface
|
||||
{
|
||||
}
|
@ -23,7 +23,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Templating\Entity\PersonRender;
|
||||
use Chill\PersonBundle\Templating\Entity\PersonRenderInterface;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
@ -48,7 +48,7 @@ class AccompanyingPeriodContext implements
|
||||
|
||||
private NormalizerInterface $normalizer;
|
||||
|
||||
private PersonRender $personRender;
|
||||
private PersonRenderInterface $personRender;
|
||||
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
@ -59,7 +59,7 @@ class AccompanyingPeriodContext implements
|
||||
NormalizerInterface $normalizer,
|
||||
TranslatableStringHelperInterface $translatableStringHelper,
|
||||
EntityManagerInterface $em,
|
||||
PersonRender $personRender,
|
||||
PersonRenderInterface $personRender,
|
||||
TranslatorInterface $translator,
|
||||
BaseContextData $baseContextData
|
||||
) {
|
||||
|
@ -22,7 +22,7 @@ use function array_key_exists;
|
||||
/**
|
||||
* Render a Person.
|
||||
*/
|
||||
class PersonRender extends AbstractChillEntityRender
|
||||
class PersonRender extends AbstractChillEntityRender implements PersonRenderInterface
|
||||
{
|
||||
private ConfigPersonAltNamesHelper $configAltNamesHelper;
|
||||
|
||||
@ -59,6 +59,7 @@ class PersonRender extends AbstractChillEntityRender
|
||||
'customArea' => $options['customArea'] ?? [],
|
||||
'addDeath' => $options['addDeath'] ?? true,
|
||||
'addAgeBadge' => $options['addAgeBadge'] ?? false,
|
||||
'suffixText' => $options['suffixText'] ?? [],
|
||||
];
|
||||
|
||||
return
|
||||
|
@ -0,0 +1,21 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Templating\Entity;
|
||||
|
||||
use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface;
|
||||
|
||||
/**
|
||||
* Render a Person.
|
||||
*/
|
||||
interface PersonRenderInterface extends ChillEntityRenderInterface
|
||||
{
|
||||
}
|
@ -12,7 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Templating\Entity\PersonRender;
|
||||
use Chill\PersonBundle\Templating\Entity\PersonRenderInterface;
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\ConstraintValidator;
|
||||
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
||||
@ -20,9 +20,9 @@ use Symfony\Component\Validator\Exception\UnexpectedValueException;
|
||||
|
||||
class LocationValidityValidator extends ConstraintValidator
|
||||
{
|
||||
private PersonRender $render;
|
||||
private PersonRenderInterface $render;
|
||||
|
||||
public function __construct(PersonRender $render)
|
||||
public function __construct(PersonRenderInterface $render)
|
||||
{
|
||||
$this->render = $render;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ namespace Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod;
|
||||
|
||||
use Chill\MainBundle\Util\DateRangeCovering;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||
use Chill\PersonBundle\Templating\Entity\PersonRender;
|
||||
use Chill\PersonBundle\Templating\Entity\PersonRenderInterface;
|
||||
use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
@ -26,11 +26,11 @@ class ParticipationOverlapValidator extends ConstraintValidator
|
||||
{
|
||||
private const MAX_PARTICIPATION = 1;
|
||||
|
||||
private PersonRender $personRender;
|
||||
private PersonRenderInterface $personRender;
|
||||
|
||||
private ThirdPartyRender $thirdpartyRender;
|
||||
|
||||
public function __construct(PersonRender $personRender, ThirdPartyRender $thirdPartyRender)
|
||||
public function __construct(PersonRenderInterface $personRender, ThirdPartyRender $thirdPartyRender)
|
||||
{
|
||||
$this->personRender = $personRender;
|
||||
$this->thirdpartyRender = $thirdPartyRender;
|
||||
|
@ -12,7 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod;
|
||||
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Templating\Entity\PersonRender;
|
||||
use Chill\PersonBundle\Templating\Entity\PersonRenderInterface;
|
||||
use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
||||
@ -24,11 +24,11 @@ use function in_array;
|
||||
|
||||
class ResourceDuplicateCheckValidator extends ConstraintValidator
|
||||
{
|
||||
private PersonRender $personRender;
|
||||
private PersonRenderInterface $personRender;
|
||||
|
||||
private ThirdPartyRender $thirdpartyRender;
|
||||
|
||||
public function __construct(PersonRender $personRender, ThirdPartyRender $thirdPartyRender)
|
||||
public function __construct(PersonRenderInterface $personRender, ThirdPartyRender $thirdPartyRender)
|
||||
{
|
||||
$this->personRender = $personRender;
|
||||
$this->thirdpartyRender = $thirdPartyRender;
|
||||
|
@ -13,7 +13,7 @@ namespace Chill\PersonBundle\Validator\Constraints\Household;
|
||||
|
||||
use Chill\MainBundle\Util\DateRangeCovering;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Templating\Entity\PersonRender;
|
||||
use Chill\PersonBundle\Templating\Entity\PersonRenderInterface;
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\ConstraintValidator;
|
||||
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
||||
@ -26,9 +26,9 @@ use function count;
|
||||
*/
|
||||
class HouseholdMembershipSequentialValidator extends ConstraintValidator
|
||||
{
|
||||
private PersonRender $render;
|
||||
private PersonRenderInterface $render;
|
||||
|
||||
public function __construct(PersonRender $render)
|
||||
public function __construct(PersonRenderInterface $render)
|
||||
{
|
||||
$this->render = $render;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user