mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
docgen: add more persons choices in person1, person2 and mainPerson
Allow to pick amongst: * requestor (if person) * resources of course (if person) * resources of person (if person)
This commit is contained in:
parent
9765bc5663
commit
7fbb3dfd07
@ -152,8 +152,25 @@ class AccompanyingPeriodContext implements
|
|||||||
$options = $template->getOptions();
|
$options = $template->getOptions();
|
||||||
$persons = $entity->getCurrentParticipations()->map(static function (AccompanyingPeriodParticipation $p) {
|
$persons = $entity->getCurrentParticipations()->map(static function (AccompanyingPeriodParticipation $p) {
|
||||||
return $p->getPerson();
|
return $p->getPerson();
|
||||||
})
|
});
|
||||||
->toArray();
|
|
||||||
|
foreach ($entity->getCurrentParticipations() as $p) {
|
||||||
|
foreach ($p->getPerson()->getResources() as $r) {
|
||||||
|
if (null !== $r->getPerson() && !$persons->contains($r->getPerson())) {
|
||||||
|
$persons->add($r->getPerson());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null !== $entity->getRequestorPerson() && !$persons->contains($entity->getRequestorPerson())) {
|
||||||
|
$persons->add($entity->getRequestorPerson());
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($entity->getResources() as $r) {
|
||||||
|
if (null !== $r->getPerson() && !$persons->contains($r->getPerson())) {
|
||||||
|
$persons->add($r->getPerson());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach (['mainPerson', 'person1', 'person2'] as $key) {
|
foreach (['mainPerson', 'person1', 'person2'] as $key) {
|
||||||
if ($options[$key] ?? false) {
|
if ($options[$key] ?? false) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user