diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/Household.php b/src/Bundle/ChillPersonBundle/Entity/Household/Household.php index d1cfb6fb9..db7ef2c2b 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Household/Household.php +++ b/src/Bundle/ChillPersonBundle/Entity/Household/Household.php @@ -98,7 +98,7 @@ class Household return $this->members; } - public function getCurrentMembers(\DateTimeImmutable $now = null): Collection + public function getCurrentMembers(?\DateTimeImmutable $now = null): Collection { $criteria = new Criteria(); $expr = Criteria::expr(); @@ -118,6 +118,19 @@ class Household return $this->getMembers()->matching($criteria); } + /** + * Get the persons currently associated to the household. + * + * Return a list of Person, instead of a list of HouseholdMembers + * + * @return Person[] + */ + public function getCurrentPersons(?\DateTimeImmutable $now = null): Collection + { + return $this->getCurrentMembers($now) + ->map(function(HouseholdMember $m) { return $m->getPerson(); }); + } + public function getNonCurrentMembers(\DateTimeImmutable $now = null): Collection { $criteria = new Criteria(); diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig index afcd2799c..44eed7782 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig @@ -7,9 +7,11 @@ {%- for n in person.altNames -%} {%- if loop.first -%}({% else %} {%- endif -%} - {{ n.label }} + {{- n.label -}} - {%- if loop.last %}) {% endif -%} + {%- if loop.last -%}) {%- endif -%} {%- endfor -%} {%- endif -%} - {%- if showLink is defined -%}{%- endif -%} + {%- if showLink is defined -%}{%- endif -%} +{#- tricks to remove easily whitespace after template -#} +{%- if true -%}{%- endif -%} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Household/members.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Household/members.html.twig index 538ec7dd0..610f80cde 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Household/members.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Household/members.html.twig @@ -14,7 +14,7 @@ {%- set members = household.currentMembersByPosition(p) %} {% if members|length > 0 %} -
{{ 'household.Those members does not share address'|trans }}
{% endif %} -