Merge branch 'master' into upgrade-php82

This commit is contained in:
Julien Fastré 2023-03-20 12:40:58 +01:00
commit 97a4c39941
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
18 changed files with 133 additions and 70 deletions

View File

@ -257,12 +257,10 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
/** /**
* Add a social issue. * Add a social issue.
* *
* Note: the social issue consistency (the fact that only yougest social issues * Note: the social issue consistency (the fact that only youngest social issues
* are kept) is processed by an entity listener: * are kept) is processed by an entity listener:
* *
* @see{\Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency\AccompanyingPeriodSocialIssueConsistencyEntityListener} * @see{\Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency\AccompanyingPeriodSocialIssueConsistencyEntityListener}
*
* @return $this
*/ */
public function addSocialIssue(SocialIssue $socialIssue): self public function addSocialIssue(SocialIssue $socialIssue): self
{ {
@ -270,6 +268,10 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
$this->socialIssues[] = $socialIssue; $this->socialIssues[] = $socialIssue;
} }
if ($this->getAccompanyingPeriod() !== null) {
$this->getAccompanyingPeriod()->addSocialIssue($socialIssue);
}
return $this; return $this;
} }
@ -550,6 +552,10 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
{ {
$this->accompanyingPeriod = $accompanyingPeriod; $this->accompanyingPeriod = $accompanyingPeriod;
foreach ($this->getSocialIssues() as $issue) {
$this->accompanyingPeriod->addSocialIssue($issue);
}
return $this; return $this;
} }

View File

@ -155,7 +155,7 @@ class ActivityContext implements
$options = $template->getOptions(); $options = $template->getOptions();
$data = []; $data = [];
$data = array_merge($data, $this->baseContextData->getData()); $data = array_merge($data, $this->baseContextData->getData($contextGenerationData['creator'] ?? null));
$data['activity'] = $this->normalizer->normalize($entity, 'docgen', ['docgen:expects' => Activity::class, 'groups' => 'docgen:read']); $data['activity'] = $this->normalizer->normalize($entity, 'docgen', ['docgen:expects' => Activity::class, 'groups' => 'docgen:read']);
$data['course'] = $this->normalizer->normalize($entity->getAccompanyingPeriod(), 'docgen', ['docgen:expects' => AccompanyingPeriod::class, 'groups' => 'docgen:read']); $data['course'] = $this->normalizer->normalize($entity->getAccompanyingPeriod(), 'docgen', ['docgen:expects' => AccompanyingPeriod::class, 'groups' => 'docgen:read']);

View File

@ -2,8 +2,8 @@ Budget: Budget
Resource: Inkomsten Resource: Inkomsten
Charge: Onkosten Charge: Onkosten
Budget for %name%: Budget van %name% Budget for %name%: Budget van %name%
Budget for household %household%: Budget van gezin Budget for household %household%: Budget van huishouden
Current budget household members: Actuele budget van gezinsleden Current budget household members: Actuele budget van leden huishouden
Show budget of %name%: Toon budget van %name% Show budget of %name%: Toon budget van %name%
See complete budget: Toon volledige budget See complete budget: Toon volledige budget
Hide budget: Verbergen Hide budget: Verbergen

View File

@ -158,7 +158,7 @@ final class CalendarContext implements CalendarContextInterface
$options = $this->getOptions($template); $options = $this->getOptions($template);
$data = array_merge( $data = array_merge(
$this->baseContextData->getData(), $this->baseContextData->getData($contextGenerationData['creator'] ?? null),
[ [
'calendar' => $this->normalizer->normalize($entity, 'docgen', ['docgen:expects' => Calendar::class, 'groups' => ['docgen:read']]), 'calendar' => $this->normalizer->normalize($entity, 'docgen', ['docgen:expects' => Calendar::class, 'groups' => ['docgen:read']]),
] ]

View File

@ -205,7 +205,7 @@ final class CalendarContextTest extends TestCase
?NormalizerInterface $normalizer = null ?NormalizerInterface $normalizer = null
): CalendarContext { ): CalendarContext {
$baseContext = $this->prophesize(BaseContextData::class); $baseContext = $this->prophesize(BaseContextData::class);
$baseContext->getData()->willReturn(['base_context' => 'data']); $baseContext->getData(null)->willReturn(['base_context' => 'data']);
$personRender = $this->prophesize(PersonRender::class); $personRender = $this->prophesize(PersonRender::class);
$personRender->renderString(Argument::type(Person::class), [])->willReturn('person name'); $personRender->renderString(Argument::type(Person::class), [])->willReturn('person name');

View File

@ -21,18 +21,14 @@ class BaseContextData
{ {
private NormalizerInterface $normalizer; private NormalizerInterface $normalizer;
private Security $security; public function __construct(NormalizerInterface $normalizer)
public function __construct(Security $security, NormalizerInterface $normalizer)
{ {
$this->security = $security;
$this->normalizer = $normalizer; $this->normalizer = $normalizer;
} }
public function getData(): array public function getData(?User $user = null): array
{ {
$data = []; $data = [];
$user = $this->security->getUser();
$data['creator'] = $this->normalizer->normalize( $data['creator'] = $this->normalizer->normalize(
$user instanceof User ? $user : null, $user instanceof User ? $user : null,

View File

@ -18,6 +18,7 @@ use Chill\DocGeneratorBundle\GeneratorDriver\DriverInterface;
use Chill\DocGeneratorBundle\GeneratorDriver\Exception\TemplateException; use Chill\DocGeneratorBundle\GeneratorDriver\Exception\TemplateException;
use Chill\DocStoreBundle\Entity\StoredObject; use Chill\DocStoreBundle\Entity\StoredObject;
use Chill\DocStoreBundle\Service\StoredObjectManagerInterface; use Chill\DocStoreBundle\Service\StoredObjectManagerInterface;
use Chill\MainBundle\Entity\User;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\File\File; use Symfony\Component\HttpFoundation\File\File;
@ -64,7 +65,8 @@ class Generator implements GeneratorInterface
array $contextGenerationDataNormalized, array $contextGenerationDataNormalized,
?StoredObject $destinationStoredObject = null, ?StoredObject $destinationStoredObject = null,
bool $isTest = false, bool $isTest = false,
?File $testFile = null ?File $testFile = null,
?User $creator = null
): ?string { ): ?string {
if ($destinationStoredObject instanceof StoredObject && StoredObject::STATUS_PENDING !== $destinationStoredObject->getStatus()) { if ($destinationStoredObject instanceof StoredObject && StoredObject::STATUS_PENDING !== $destinationStoredObject->getStatus()) {
$this->logger->info(self::LOG_PREFIX.'Aborting generation of an already generated document'); $this->logger->info(self::LOG_PREFIX.'Aborting generation of an already generated document');
@ -89,9 +91,10 @@ class Generator implements GeneratorInterface
$contextGenerationDataNormalized = array_merge( $contextGenerationDataNormalized = array_merge(
$contextGenerationDataNormalized, $contextGenerationDataNormalized,
$context instanceof DocGeneratorContextWithPublicFormInterface ? ['creator' => $creator],
$context->contextGenerationDataDenormalize($template, $entity, $contextGenerationDataNormalized) $context instanceof DocGeneratorContextWithPublicFormInterface ?
: [] $context->contextGenerationDataDenormalize($template, $entity, $contextGenerationDataNormalized)
: []
); );
$data = $context->getData($template, $entity, $contextGenerationDataNormalized); $data = $context->getData($template, $entity, $contextGenerationDataNormalized);

View File

@ -13,6 +13,7 @@ namespace Chill\DocGeneratorBundle\Service\Generator;
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate; use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
use Chill\DocStoreBundle\Entity\StoredObject; use Chill\DocStoreBundle\Entity\StoredObject;
use Chill\MainBundle\Entity\User;
use Symfony\Component\HttpFoundation\File\File; use Symfony\Component\HttpFoundation\File\File;
interface GeneratorInterface interface GeneratorInterface
@ -31,6 +32,7 @@ interface GeneratorInterface
array $contextGenerationDataNormalized, array $contextGenerationDataNormalized,
?StoredObject $destinationStoredObject = null, ?StoredObject $destinationStoredObject = null,
bool $isTest = false, bool $isTest = false,
?File $testFile = null ?File $testFile = null,
?User $creator = null
): ?string; ): ?string;
} }

View File

@ -15,7 +15,9 @@ use Chill\DocGeneratorBundle\Repository\DocGeneratorTemplateRepository;
use Chill\DocGeneratorBundle\Service\Generator\Generator; use Chill\DocGeneratorBundle\Service\Generator\Generator;
use Chill\DocStoreBundle\Entity\StoredObject; use Chill\DocStoreBundle\Entity\StoredObject;
use Chill\DocStoreBundle\Repository\StoredObjectRepository; use Chill\DocStoreBundle\Repository\StoredObjectRepository;
use Chill\MainBundle\Repository\UserRepositoryInterface;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException; use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface; use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
@ -32,18 +34,28 @@ class RequestGenerationHandler implements MessageHandlerInterface
private Generator $generator; private Generator $generator;
private LoggerInterface $logger;
private UserRepositoryInterface $userRepository;
public const AUTHORIZED_TRIALS = 5; public const AUTHORIZED_TRIALS = 5;
private const LOG_PREFIX = '[docgen message handler] ';
public function __construct( public function __construct(
DocGeneratorTemplateRepository $docGeneratorTemplateRepository, DocGeneratorTemplateRepository $docGeneratorTemplateRepository,
EntityManagerInterface $entityManager, EntityManagerInterface $entityManager,
Generator $generator, Generator $generator,
StoredObjectRepository $storedObjectRepository LoggerInterface $logger,
StoredObjectRepository $storedObjectRepository,
UserRepositoryInterface $userRepository
) { ) {
$this->docGeneratorTemplateRepository = $docGeneratorTemplateRepository; $this->docGeneratorTemplateRepository = $docGeneratorTemplateRepository;
$this->entityManager = $entityManager; $this->entityManager = $entityManager;
$this->generator = $generator; $this->generator = $generator;
$this->logger = $logger;
$this->storedObjectRepository = $storedObjectRepository; $this->storedObjectRepository = $storedObjectRepository;
$this->userRepository = $userRepository;
} }
public function __invoke(RequestGenerationMessage $message) public function __invoke(RequestGenerationMessage $message)
@ -60,6 +72,8 @@ class RequestGenerationHandler implements MessageHandlerInterface
throw new UnrecoverableMessageHandlingException('maximum number of retry reached'); throw new UnrecoverableMessageHandlingException('maximum number of retry reached');
} }
$creator = $this->userRepository->find($message->getCreatorId());
$destinationStoredObject->addGenerationTrial(); $destinationStoredObject->addGenerationTrial();
$this->entityManager->createQuery('UPDATE '.StoredObject::class.' s SET s.generationTrialsCounter = s.generationTrialsCounter + 1 WHERE s.id = :id') $this->entityManager->createQuery('UPDATE '.StoredObject::class.' s SET s.generationTrialsCounter = s.generationTrialsCounter + 1 WHERE s.id = :id')
->setParameter('id', $destinationStoredObject->getId()) ->setParameter('id', $destinationStoredObject->getId())
@ -69,7 +83,16 @@ class RequestGenerationHandler implements MessageHandlerInterface
$template, $template,
$message->getEntityId(), $message->getEntityId(),
$message->getContextGenerationData(), $message->getContextGenerationData(),
$destinationStoredObject $destinationStoredObject,
false,
null,
$creator
); );
$this->logger->info(self::LOG_PREFIX.'Request generation finished', [
'template_id' => $message->getTemplateId(),
'destination_stored_object' => $message->getDestinationStoredObjectId(),
'duration_int' => (new \DateTimeImmutable('now'))->getTimestamp() - $message->getCreatedAt()->getTimestamp(),
]);
} }
} }

View File

@ -27,6 +27,8 @@ class RequestGenerationMessage
private array $contextGenerationData; private array $contextGenerationData;
private \DateTimeImmutable $createdAt;
public function __construct( public function __construct(
User $creator, User $creator,
DocGeneratorTemplate $template, DocGeneratorTemplate $template,
@ -39,6 +41,7 @@ class RequestGenerationMessage
$this->entityId = $entityId; $this->entityId = $entityId;
$this->destinationStoredObjectId = $destinationStoredObject->getId(); $this->destinationStoredObjectId = $destinationStoredObject->getId();
$this->contextGenerationData = $contextGenerationData; $this->contextGenerationData = $contextGenerationData;
$this->createdAt = new \DateTimeImmutable('now');
} }
public function getCreatorId(): int public function getCreatorId(): int
@ -65,4 +68,9 @@ class RequestGenerationMessage
{ {
return $this->contextGenerationData; return $this->contextGenerationData;
} }
public function getCreatedAt(): \DateTimeImmutable
{
return $this->createdAt;
}
} }

View File

@ -17,6 +17,7 @@ use Chill\MainBundle\Repository\RegroupmentRepository;
use Exception; use Exception;
use Symfony\Component\Form\DataMapperInterface; use Symfony\Component\Form\DataMapperInterface;
use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormInterface;
use function array_key_exists;
use function count; use function count;
class ExportPickCenterDataMapper implements DataMapperInterface class ExportPickCenterDataMapper implements DataMapperInterface
@ -29,7 +30,7 @@ class ExportPickCenterDataMapper implements DataMapperInterface
* *
* @throws Exception * @throws Exception
* *
* @return mixed * @return void
*/ */
public function mapDataToForms($data, $forms) public function mapDataToForms($data, $forms)
{ {
@ -72,10 +73,12 @@ class ExportPickCenterDataMapper implements DataMapperInterface
$centers[spl_object_hash($center)] = $center; $centers[spl_object_hash($center)] = $center;
} }
foreach ($forms['regroupment']->getData() as $regroupment) { if (array_key_exists('regroupment', $forms)) {
/** @var Regroupment $regroupment */ foreach ($forms['regroupment']->getData() as $regroupment) {
foreach ($regroupment->getCenters() as $center) { /** @var Regroupment $regroupment */
$centers[spl_object_hash($center)] = $center; foreach ($regroupment->getCenters() as $center) {
$centers[spl_object_hash($center)] = $center;
}
} }
} }

View File

@ -253,8 +253,8 @@ No options availables. Your report is fully configured.: Geen beschikbare opties
Ungrouped exports: Overige expor Ungrouped exports: Overige expor
#export download #export download
Download export: Téléchargement du rapport Download export: Downloaden van rapport
Waiting for your report: En attente de votre rapport Waiting for your report: Wachten op je rapport
Download your report: Télécharger votre rapport Download your report: Télécharger votre rapport
Problem during download: Problème durant le téléchargement Problem during download: Problème durant le téléchargement
# sans valeur # sans valeur

View File

@ -59,6 +59,7 @@
:placeholder="$t('referrer.placeholder')" :placeholder="$t('referrer.placeholder')"
v-model="value" v-model="value"
@select="updateReferrer" @select="updateReferrer"
@remove="removeReferrer"
:options="users" :options="users"
:select-label="$t('multiselect.select_label')" :select-label="$t('multiselect.select_label')"
:deselect-label="$t('multiselect.deselect_label')" :deselect-label="$t('multiselect.deselect_label')"
@ -194,6 +195,17 @@ export default {
}); });
this.toggleModal() this.toggleModal()
}, },
removeReferrer() {
console.log('remove option')
this.$store.dispatch('updateReferrer', null)
.catch(({name, violations}) => {
if (name === 'ValidationException' || name === 'AccessException') {
violations.forEach((violation) => this.$toast.open({message: violation}));
} else {
this.$toast.open({message: 'An error occurred'})
}
});
},
cancelChange() { cancelChange() {
this.value = this.$store.state.accompanyingCourse.user this.value = this.$store.state.accompanyingCourse.user
this.toggleModal() this.toggleModal()

View File

@ -207,7 +207,7 @@ class AccompanyingPeriodContext implements
$options = $template->getOptions(); $options = $template->getOptions();
$data = []; $data = [];
$data = array_merge($data, $this->baseContextData->getData()); $data = array_merge($data, $this->baseContextData->getData($contextGenerationData['creator'] ?? null));
$data['course'] = $this->normalizer->normalize($entity, 'docgen', ['docgen:expects' => AccompanyingPeriod::class, 'groups' => 'docgen:read']); $data['course'] = $this->normalizer->normalize($entity, 'docgen', ['docgen:expects' => AccompanyingPeriod::class, 'groups' => 'docgen:read']);
foreach (['mainPerson', 'person1', 'person2'] as $k) { foreach (['mainPerson', 'person1', 'person2'] as $k) {

View File

@ -165,7 +165,7 @@ final class PersonContext implements PersonContextInterface
} }
$data = []; $data = [];
$data = array_merge($data, $this->baseContextData->getData()); $data = array_merge($data, $this->baseContextData->getData($contextGenerationData['creator'] ?? null));
$data['person'] = $this->normalizer->normalize($entity, 'docgen', [ $data['person'] = $this->normalizer->normalize($entity, 'docgen', [
'docgen:expects' => Person::class, 'docgen:expects' => Person::class,
'groups' => ['docgen:read'], 'groups' => ['docgen:read'],

View File

@ -54,7 +54,7 @@ class AccompanyingPeriodValidityValidator extends ConstraintValidator
$activities = $this->activityRepository->findBy(['accompanyingPeriod' => $period]); $activities = $this->activityRepository->findBy(['accompanyingPeriod' => $period]);
foreach ($activities as $activity) { foreach ($activities as $activity) {
$socialIssues = $activity->getSocialIssues()->toArray(); $socialIssues = array_merge($socialIssues, $activity->getSocialIssues()->toArray());
} }
foreach ($period->getWorks() as $work) { foreach ($period->getWorks() as $work) {
@ -64,7 +64,7 @@ class AccompanyingPeriodValidityValidator extends ConstraintValidator
$socialIssuesByKey = []; $socialIssuesByKey = [];
foreach ($socialIssues as $si) { foreach ($socialIssues as $si) {
$socialIssuesByKey[$si->getId()] = $si; $socialIssuesByKey[spl_object_hash($si)] = $si;
} }
$periodIssuesWithAncestors = []; $periodIssuesWithAncestors = [];
@ -75,7 +75,7 @@ class AccompanyingPeriodValidityValidator extends ConstraintValidator
$periodIssuesWithAncestors, $periodIssuesWithAncestors,
array_map( array_map(
static function (SocialIssue $si) { static function (SocialIssue $si) {
return $si->getId(); return spl_object_hash($si);
}, },
$si->getAncestors(true) $si->getAncestors(true)
) )

View File

@ -125,7 +125,7 @@ address_country_code: Landscode
'Alreay existing person': 'Reeds bestaand persoonsdossier' 'Alreay existing person': 'Reeds bestaand persoonsdossier'
'Add the person': 'Persoon toevoegen' 'Add the person': 'Persoon toevoegen'
'Add the person and create an accompanying period': "Persoon & hulpverleningstraject aanmaken" 'Add the person and create an accompanying period': "Persoon & hulpverleningstraject aanmaken"
'Add the person and create a household': "Persoon & gezin aanmaken" 'Add the person and create a household': "Persoon & huishouden aanmaken"
Show person: Toon persoonsdossier Show person: Toon persoonsdossier
'Confirm the creation': 'Aanmaak dossier bevestigen' 'Confirm the creation': 'Aanmaak dossier bevestigen'
'You will create this person': 'U zal het volgende dossier aanmaken' 'You will create this person': 'U zal het volgende dossier aanmaken'
@ -177,9 +177,9 @@ An accompanying period ends: Een hulpverleningstraject loopt op zijn einde
An accompanying period starts: Een hulpverleningstraject gaat van start An accompanying period starts: Een hulpverleningstraject gaat van start
Any accompanying periods are open: Geen enkel hulpverleningstraject open Any accompanying periods are open: Geen enkel hulpverleningstraject open
An accompanying period is open: Een hulpverleningstraject staat open An accompanying period is open: Een hulpverleningstraject staat open
Accompanying period list: Hulpverleningstraject Accompanying period list: Hulpverleningstrajecten
Accompanying period list for person: Hulpverleningstrajecten van persoon Accompanying period list for person: Hulpverleningstrajecten van persoon
Accompanying period: Hulpverleningstraject Accompanying period: Hulpverleningstrajecten
Any accompanying period: Geen enkel hulpverleningstraject Any accompanying period: Geen enkel hulpverleningstraject
period: Hulpverleningstraject period: Hulpverleningstraject
New accompanying course: Nieuw hulpverleningstraject New accompanying course: Nieuw hulpverleningstraject
@ -215,8 +215,8 @@ No resources: "Geen hulpverlening partners"
Persons associated: Betrokken personen Persons associated: Betrokken personen
Referrer: Doorverwijzer Referrer: Doorverwijzer
Referrers: Doorverwijzers Referrers: Doorverwijzers
Some peoples does not belong to any household currently. Add them to an household soon: Sommige personen maken nog geen deel uit van een gezin. Voeg ze zo snel mogelijk aan gezin toe. Some peoples does not belong to any household currently. Add them to an household soon: Sommige personen maken nog geen deel uit van een huishouden. Voeg ze zo snel mogelijk aan huishouden toe.
Add to household now: Toevoegen aan een gezin Add to household now: Toevoegen aan een huishouden
Any resource for this accompanying course: Geen enkele hulpverlening partner Any resource for this accompanying course: Geen enkele hulpverlening partner
course.draft: Ontwerp course.draft: Ontwerp
course.closed: Afgesloten course.closed: Afgesloten
@ -458,7 +458,7 @@ Accompanying course location: Locatie van hulpverleningstraject
This course is located by: Locatie bij This course is located by: Locatie bij
This course has a temporarily location: Voorlopige locatie This course has a temporarily location: Voorlopige locatie
Choose a person to locate by: Adres van persoon toewijzen Choose a person to locate by: Adres van persoon toewijzen
Associate at least one member with an household, and set an address to this household: Associeer minstens één betrokken persoon in dit hulpverleningstraject met een gezin en wijs een adres toe aan dit gezin. Associate at least one member with an household, and set an address to this household: Associeer minstens één betrokken persoon in dit hulpverleningstraject met een huishouden en wijs een adres toe aan dit huishouden.
Locate by: Adres toewijzen Locate by: Adres toewijzen
fix it: Aanvullen fix it: Aanvullen
accompanying_course: accompanying_course:
@ -480,23 +480,23 @@ accompanying_course_comment:
Read more: Meer lezen.. Read more: Meer lezen..
# Household # Household
Household: Gezin Household: Huishouden
Summary: Samenvatting Summary: Samenvatting
Members: Gezinsleden Members: Leden huishouden
Addresses: Addressen Addresses: Addressen
Move household: Nieuwe verhuis Move household: Nieuwe verhuis
Addresses history for household: Historiek adressen Addresses history for household: Historiek adressen
Household accompanying period: Hulpverleningstrajecten van gezin Household accompanying period: Hulpverleningstrajecten van huishouden
Household summary: Samenvatting gezin Household summary: Samenvatting huishouden
Edit household address: Adres gezin bijwerken Edit household address: Adres huishouden bijwerken
Show household: Gezin bekijken Show household: huishouden bekijken
Back to household: Terugkeren naar gezin Back to household: Terugkeren naar huishouden
Remove household composition: Gezinssamenstelling verwijderen Remove household composition: huishoudenssamenstelling verwijderen
Are you sure you want to remove this composition?: Bent u zeker deze gezinssamenstelling te willen verwijderen? Are you sure you want to remove this composition?: Bent u zeker deze huishoudenssamenstelling te willen verwijderen?
Concerns household n°%id%: Betrokken gezin n°%id% Concerns household n°%id%: Betrokken huishouden n°%id%
Composition: Gezinssamenstelling Composition: huishoudenssamenstelling
Budget: Budget Budget: Budget
The composition has been successfully removed.: De gezinssamenstelling werd verwijdert. The composition has been successfully removed.: De huishoudenssamenstelling werd verwijdert.
# accompanying course work # accompanying course work
Accompanying Course Actions: Hulpverleningsmaatregelen Accompanying Course Actions: Hulpverleningsmaatregelen
@ -560,16 +560,16 @@ You are getting a notification for a period you are not allowed to see: De notif
This is the minimal period details: Hulpverleningstraject n° This is the minimal period details: Hulpverleningstraject n°
household_composition: household_composition:
No composition yet: Geen enkele gezinssamenstelling toegewezen No composition yet: Geen enkele huishoudenssamenstelling toegewezen
Compositions: Gezinssamenstelling Compositions: huishoudenssamenstelling
endDate: Einddatum endDate: Einddatum
numberOfChildren: Aantal kinderen in het gezin numberOfChildren: Aantal kinderen in het huishouden
Household composition: Gezinssamenstelling Household composition: huishoudenssamenstelling
Composition added: Informatie over de gezinssamenstelling toegevoegd Composition added: Informatie over de huishoudenssamenstelling toegevoegd
Currently no composition: Geen enkele gezinssamenstelling toegewezen Currently no composition: Geen enkele huishoudenssamenstelling toegewezen
Add a composition: Een gezinssamenstelling toevoegen Add a composition: Een huishoudenssamenstelling toevoegen
Update composition: Gezinssamenstelling bijwerken Update composition: huishoudenssamenstelling bijwerken
Create: Een nieuwe gezinssamenstelling toewijzen Create: Een nieuwe huishoudenssamenstelling toewijzen
# docgen # docgen
Linked evaluations: Gerelateerde evaluaties Linked evaluations: Gerelateerde evaluaties

View File

@ -18,6 +18,7 @@ use Chill\MainBundle\Entity\User;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\Mime\Part\DataPart; use Symfony\Component\Mime\Part\DataPart;
@ -40,6 +41,8 @@ class Convert
private LoggerInterface $logger; private LoggerInterface $logger;
private RequestStack $requestStack;
private Security $security; private Security $security;
private StoredObjectManagerInterface $storedObjectManager; private StoredObjectManagerInterface $storedObjectManager;
@ -49,12 +52,14 @@ class Convert
*/ */
public function __construct( public function __construct(
HttpClientInterface $httpClient, HttpClientInterface $httpClient,
RequestStack $requestStack,
Security $security, Security $security,
StoredObjectManagerInterface $storedObjectManager, StoredObjectManagerInterface $storedObjectManager,
LoggerInterface $logger, LoggerInterface $logger,
ParameterBagInterface $parameters ParameterBagInterface $parameters
) { ) {
$this->httpClient = $httpClient; $this->httpClient = $httpClient;
$this->requestStack = $requestStack;
$this->security = $security; $this->security = $security;
$this->storedObjectManager = $storedObjectManager; $this->storedObjectManager = $storedObjectManager;
$this->logger = $logger; $this->logger = $logger;
@ -68,18 +73,23 @@ class Convert
} }
$content = $this->storedObjectManager->read($storedObject); $content = $this->storedObjectManager->read($storedObject);
$query = [];
$url = sprintf('%s/cool/convert-to/pdf', $this->collaboraDomain); if (null !== $request = $this->requestStack->getCurrentRequest()) {
$form = new FormDataPart([ $query['lang'] = $request->getLocale();
'data' => new DataPart($content, $storedObject->getUuid()->toString(), $storedObject->getType()), }
]);
$response = $this->httpClient->request('POST', $url, [
'headers' => $form->getPreparedHeaders()->toArray(),
'body' => $form->bodyToString(),
'timeout' => 10,
]);
try { try {
$url = sprintf('%s/cool/convert-to/pdf', $this->collaboraDomain);
$form = new FormDataPart([
'data' => new DataPart($content, $storedObject->getUuid()->toString(), $storedObject->getType()),
]);
$response = $this->httpClient->request('POST', $url, [
'headers' => $form->getPreparedHeaders()->toArray(),
'query' => $query,
'body' => $form->bodyToString(),
'timeout' => 10,
]);
return new Response($response->getContent(), Response::HTTP_OK, [ return new Response($response->getContent(), Response::HTTP_OK, [
'Content-Type' => 'application/pdf', 'Content-Type' => 'application/pdf',
]); ]);