diff --git a/src/Bundle/ChillActivityBundle/Entity/Activity.php b/src/Bundle/ChillActivityBundle/Entity/Activity.php index 8fcae3e0b..2a5ae6acb 100644 --- a/src/Bundle/ChillActivityBundle/Entity/Activity.php +++ b/src/Bundle/ChillActivityBundle/Entity/Activity.php @@ -257,12 +257,10 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac /** * 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: * * @see{\Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency\AccompanyingPeriodSocialIssueConsistencyEntityListener} - * - * @return $this */ public function addSocialIssue(SocialIssue $socialIssue): self { @@ -270,6 +268,10 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac $this->socialIssues[] = $socialIssue; } + if ($this->getAccompanyingPeriod() !== null) { + $this->getAccompanyingPeriod()->addSocialIssue($socialIssue); + } + return $this; } @@ -550,6 +552,10 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac { $this->accompanyingPeriod = $accompanyingPeriod; + foreach ($this->getSocialIssues() as $issue) { + $this->accompanyingPeriod->addSocialIssue($issue); + } + return $this; } diff --git a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php index 60af723dc..01b7e2945 100644 --- a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php +++ b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php @@ -155,7 +155,7 @@ class ActivityContext implements $options = $template->getOptions(); $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['course'] = $this->normalizer->normalize($entity->getAccompanyingPeriod(), 'docgen', ['docgen:expects' => AccompanyingPeriod::class, 'groups' => 'docgen:read']); diff --git a/src/Bundle/ChillBudgetBundle/translations/messages.nl.yml b/src/Bundle/ChillBudgetBundle/translations/messages.nl.yml index 5fd21520d..de334f79f 100644 --- a/src/Bundle/ChillBudgetBundle/translations/messages.nl.yml +++ b/src/Bundle/ChillBudgetBundle/translations/messages.nl.yml @@ -2,8 +2,8 @@ Budget: Budget Resource: Inkomsten Charge: Onkosten Budget for %name%: Budget van %name% -Budget for household %household%: Budget van gezin -Current budget household members: Actuele budget van gezinsleden +Budget for household %household%: Budget van huishouden +Current budget household members: Actuele budget van leden huishouden Show budget of %name%: Toon budget van %name% See complete budget: Toon volledige budget Hide budget: Verbergen diff --git a/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php b/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php index 52509cbce..f5b244027 100644 --- a/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php +++ b/src/Bundle/ChillCalendarBundle/Service/DocGenerator/CalendarContext.php @@ -158,7 +158,7 @@ final class CalendarContext implements CalendarContextInterface $options = $this->getOptions($template); $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']]), ] diff --git a/src/Bundle/ChillCalendarBundle/Tests/Service/DocGenerator/CalendarContextTest.php b/src/Bundle/ChillCalendarBundle/Tests/Service/DocGenerator/CalendarContextTest.php index be31485d4..cbb4ea3af 100644 --- a/src/Bundle/ChillCalendarBundle/Tests/Service/DocGenerator/CalendarContextTest.php +++ b/src/Bundle/ChillCalendarBundle/Tests/Service/DocGenerator/CalendarContextTest.php @@ -205,7 +205,7 @@ final class CalendarContextTest extends TestCase ?NormalizerInterface $normalizer = null ): CalendarContext { $baseContext = $this->prophesize(BaseContextData::class); - $baseContext->getData()->willReturn(['base_context' => 'data']); + $baseContext->getData(null)->willReturn(['base_context' => 'data']); $personRender = $this->prophesize(PersonRender::class); $personRender->renderString(Argument::type(Person::class), [])->willReturn('person name'); diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php b/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php index e7b56ed88..5aed8554b 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Context/BaseContextData.php @@ -21,18 +21,14 @@ class BaseContextData { private NormalizerInterface $normalizer; - private Security $security; - - public function __construct(Security $security, NormalizerInterface $normalizer) + public function __construct(NormalizerInterface $normalizer) { - $this->security = $security; $this->normalizer = $normalizer; } - public function getData(): array + public function getData(?User $user = null): array { $data = []; - $user = $this->security->getUser(); $data['creator'] = $this->normalizer->normalize( $user instanceof User ? $user : null, diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php index 624bf2435..b2655e57c 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/Generator.php @@ -18,6 +18,7 @@ use Chill\DocGeneratorBundle\GeneratorDriver\DriverInterface; use Chill\DocGeneratorBundle\GeneratorDriver\Exception\TemplateException; use Chill\DocStoreBundle\Entity\StoredObject; use Chill\DocStoreBundle\Service\StoredObjectManagerInterface; +use Chill\MainBundle\Entity\User; use Doctrine\ORM\EntityManagerInterface; use Psr\Log\LoggerInterface; use Symfony\Component\HttpFoundation\File\File; @@ -64,7 +65,8 @@ class Generator implements GeneratorInterface array $contextGenerationDataNormalized, ?StoredObject $destinationStoredObject = null, bool $isTest = false, - ?File $testFile = null + ?File $testFile = null, + ?User $creator = null ): ?string { if ($destinationStoredObject instanceof StoredObject && StoredObject::STATUS_PENDING !== $destinationStoredObject->getStatus()) { $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, - $context instanceof DocGeneratorContextWithPublicFormInterface ? - $context->contextGenerationDataDenormalize($template, $entity, $contextGenerationDataNormalized) - : [] + ['creator' => $creator], + $context instanceof DocGeneratorContextWithPublicFormInterface ? + $context->contextGenerationDataDenormalize($template, $entity, $contextGenerationDataNormalized) + : [] ); $data = $context->getData($template, $entity, $contextGenerationDataNormalized); diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorInterface.php b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorInterface.php index fc2f0e2f9..dcef8f99d 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorInterface.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorInterface.php @@ -13,6 +13,7 @@ namespace Chill\DocGeneratorBundle\Service\Generator; use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate; use Chill\DocStoreBundle\Entity\StoredObject; +use Chill\MainBundle\Entity\User; use Symfony\Component\HttpFoundation\File\File; interface GeneratorInterface @@ -31,6 +32,7 @@ interface GeneratorInterface array $contextGenerationDataNormalized, ?StoredObject $destinationStoredObject = null, bool $isTest = false, - ?File $testFile = null + ?File $testFile = null, + ?User $creator = null ): ?string; } diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php index eec6ce666..49c3430ad 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationHandler.php @@ -15,7 +15,9 @@ use Chill\DocGeneratorBundle\Repository\DocGeneratorTemplateRepository; use Chill\DocGeneratorBundle\Service\Generator\Generator; use Chill\DocStoreBundle\Entity\StoredObject; use Chill\DocStoreBundle\Repository\StoredObjectRepository; +use Chill\MainBundle\Repository\UserRepositoryInterface; use Doctrine\ORM\EntityManagerInterface; +use Psr\Log\LoggerInterface; use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException; use Symfony\Component\Messenger\Handler\MessageHandlerInterface; @@ -32,18 +34,28 @@ class RequestGenerationHandler implements MessageHandlerInterface private Generator $generator; + private LoggerInterface $logger; + + private UserRepositoryInterface $userRepository; + public const AUTHORIZED_TRIALS = 5; + private const LOG_PREFIX = '[docgen message handler] '; + public function __construct( DocGeneratorTemplateRepository $docGeneratorTemplateRepository, EntityManagerInterface $entityManager, Generator $generator, - StoredObjectRepository $storedObjectRepository + LoggerInterface $logger, + StoredObjectRepository $storedObjectRepository, + UserRepositoryInterface $userRepository ) { $this->docGeneratorTemplateRepository = $docGeneratorTemplateRepository; $this->entityManager = $entityManager; $this->generator = $generator; + $this->logger = $logger; $this->storedObjectRepository = $storedObjectRepository; + $this->userRepository = $userRepository; } public function __invoke(RequestGenerationMessage $message) @@ -60,6 +72,8 @@ class RequestGenerationHandler implements MessageHandlerInterface throw new UnrecoverableMessageHandlingException('maximum number of retry reached'); } + $creator = $this->userRepository->find($message->getCreatorId()); + $destinationStoredObject->addGenerationTrial(); $this->entityManager->createQuery('UPDATE '.StoredObject::class.' s SET s.generationTrialsCounter = s.generationTrialsCounter + 1 WHERE s.id = :id') ->setParameter('id', $destinationStoredObject->getId()) @@ -69,7 +83,16 @@ class RequestGenerationHandler implements MessageHandlerInterface $template, $message->getEntityId(), $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(), + ]); } } diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationMessage.php b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationMessage.php index 3a1318d39..99d4074df 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationMessage.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Messenger/RequestGenerationMessage.php @@ -27,6 +27,8 @@ class RequestGenerationMessage private array $contextGenerationData; + private \DateTimeImmutable $createdAt; + public function __construct( User $creator, DocGeneratorTemplate $template, @@ -39,6 +41,7 @@ class RequestGenerationMessage $this->entityId = $entityId; $this->destinationStoredObjectId = $destinationStoredObject->getId(); $this->contextGenerationData = $contextGenerationData; + $this->createdAt = new \DateTimeImmutable('now'); } public function getCreatorId(): int @@ -65,4 +68,9 @@ class RequestGenerationMessage { return $this->contextGenerationData; } + + public function getCreatedAt(): \DateTimeImmutable + { + return $this->createdAt; + } } diff --git a/src/Bundle/ChillMainBundle/Form/DataMapper/ExportPickCenterDataMapper.php b/src/Bundle/ChillMainBundle/Form/DataMapper/ExportPickCenterDataMapper.php index 0d21b0adb..549805fc5 100644 --- a/src/Bundle/ChillMainBundle/Form/DataMapper/ExportPickCenterDataMapper.php +++ b/src/Bundle/ChillMainBundle/Form/DataMapper/ExportPickCenterDataMapper.php @@ -17,6 +17,7 @@ use Chill\MainBundle\Repository\RegroupmentRepository; use Exception; use Symfony\Component\Form\DataMapperInterface; use Symfony\Component\Form\FormInterface; +use function array_key_exists; use function count; class ExportPickCenterDataMapper implements DataMapperInterface @@ -29,7 +30,7 @@ class ExportPickCenterDataMapper implements DataMapperInterface * * @throws Exception * - * @return mixed + * @return void */ public function mapDataToForms($data, $forms) { @@ -72,10 +73,12 @@ class ExportPickCenterDataMapper implements DataMapperInterface $centers[spl_object_hash($center)] = $center; } - foreach ($forms['regroupment']->getData() as $regroupment) { - /** @var Regroupment $regroupment */ - foreach ($regroupment->getCenters() as $center) { - $centers[spl_object_hash($center)] = $center; + if (array_key_exists('regroupment', $forms)) { + foreach ($forms['regroupment']->getData() as $regroupment) { + /** @var Regroupment $regroupment */ + foreach ($regroupment->getCenters() as $center) { + $centers[spl_object_hash($center)] = $center; + } } } diff --git a/src/Bundle/ChillMainBundle/translations/messages.nl.yml b/src/Bundle/ChillMainBundle/translations/messages.nl.yml index 4412ad015..97341dd3c 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.nl.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.nl.yml @@ -253,8 +253,8 @@ No options availables. Your report is fully configured.: Geen beschikbare opties Ungrouped exports: Overige expor #export download -Download export: Téléchargement du rapport -Waiting for your report: En attente de votre rapport +Download export: Downloaden van rapport +Waiting for your report: Wachten op je rapport Download your report: Télécharger votre rapport Problem during download: Problème durant le téléchargement # sans valeur diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Referrer.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Referrer.vue index b16e8828a..aff143dfe 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Referrer.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Referrer.vue @@ -59,6 +59,7 @@ :placeholder="$t('referrer.placeholder')" v-model="value" @select="updateReferrer" + @remove="removeReferrer" :options="users" :select-label="$t('multiselect.select_label')" :deselect-label="$t('multiselect.deselect_label')" @@ -194,6 +195,17 @@ export default { }); 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() { this.value = this.$store.state.accompanyingCourse.user this.toggleModal() diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php index 00f7a86fb..3a92df3a4 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php @@ -207,7 +207,7 @@ class AccompanyingPeriodContext implements $options = $template->getOptions(); $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']); foreach (['mainPerson', 'person1', 'person2'] as $k) { diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContext.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContext.php index 86b29585c..c7c7d2352 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContext.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContext.php @@ -165,7 +165,7 @@ final class PersonContext implements PersonContextInterface } $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', [ 'docgen:expects' => Person::class, 'groups' => ['docgen:read'], diff --git a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/AccompanyingPeriodValidityValidator.php b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/AccompanyingPeriodValidityValidator.php index 51462c56e..9454d31d0 100644 --- a/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/AccompanyingPeriodValidityValidator.php +++ b/src/Bundle/ChillPersonBundle/Validator/Constraints/AccompanyingPeriod/AccompanyingPeriodValidityValidator.php @@ -54,7 +54,7 @@ class AccompanyingPeriodValidityValidator extends ConstraintValidator $activities = $this->activityRepository->findBy(['accompanyingPeriod' => $period]); foreach ($activities as $activity) { - $socialIssues = $activity->getSocialIssues()->toArray(); + $socialIssues = array_merge($socialIssues, $activity->getSocialIssues()->toArray()); } foreach ($period->getWorks() as $work) { @@ -64,7 +64,7 @@ class AccompanyingPeriodValidityValidator extends ConstraintValidator $socialIssuesByKey = []; foreach ($socialIssues as $si) { - $socialIssuesByKey[$si->getId()] = $si; + $socialIssuesByKey[spl_object_hash($si)] = $si; } $periodIssuesWithAncestors = []; @@ -75,7 +75,7 @@ class AccompanyingPeriodValidityValidator extends ConstraintValidator $periodIssuesWithAncestors, array_map( static function (SocialIssue $si) { - return $si->getId(); + return spl_object_hash($si); }, $si->getAncestors(true) ) diff --git a/src/Bundle/ChillPersonBundle/translations/messages.nl.yml b/src/Bundle/ChillPersonBundle/translations/messages.nl.yml index 2ecbd41a0..941f9d585 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.nl.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.nl.yml @@ -125,7 +125,7 @@ address_country_code: Landscode 'Alreay existing person': 'Reeds bestaand persoonsdossier' 'Add the person': 'Persoon toevoegen' '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 'Confirm the creation': 'Aanmaak dossier bevestigen' '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 Any accompanying periods are open: Geen enkel hulpverleningstraject 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: Hulpverleningstraject +Accompanying period: Hulpverleningstrajecten Any accompanying period: Geen enkel hulpverleningstraject period: Hulpverleningstraject New accompanying course: Nieuw hulpverleningstraject @@ -215,8 +215,8 @@ No resources: "Geen hulpverlening partners" Persons associated: Betrokken personen Referrer: Doorverwijzer 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. -Add to household now: Toevoegen aan een gezin +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 huishouden Any resource for this accompanying course: Geen enkele hulpverlening partner course.draft: Ontwerp course.closed: Afgesloten @@ -458,7 +458,7 @@ Accompanying course location: Locatie van hulpverleningstraject This course is located by: Locatie bij This course has a temporarily location: Voorlopige locatie 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 fix it: Aanvullen accompanying_course: @@ -480,23 +480,23 @@ accompanying_course_comment: Read more: Meer lezen.. # Household -Household: Gezin +Household: Huishouden Summary: Samenvatting -Members: Gezinsleden +Members: Leden huishouden Addresses: Addressen Move household: Nieuwe verhuis Addresses history for household: Historiek adressen -Household accompanying period: Hulpverleningstrajecten van gezin -Household summary: Samenvatting gezin -Edit household address: Adres gezin bijwerken -Show household: Gezin bekijken -Back to household: Terugkeren naar gezin -Remove household composition: Gezinssamenstelling verwijderen -Are you sure you want to remove this composition?: Bent u zeker deze gezinssamenstelling te willen verwijderen? -Concerns household n°%id%: Betrokken gezin n°%id% -Composition: Gezinssamenstelling +Household accompanying period: Hulpverleningstrajecten van huishouden +Household summary: Samenvatting huishouden +Edit household address: Adres huishouden bijwerken +Show household: huishouden bekijken +Back to household: Terugkeren naar huishouden +Remove household composition: huishoudenssamenstelling verwijderen +Are you sure you want to remove this composition?: Bent u zeker deze huishoudenssamenstelling te willen verwijderen? +Concerns household n°%id%: Betrokken huishouden n°%id% +Composition: huishoudenssamenstelling 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 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° household_composition: - No composition yet: Geen enkele gezinssamenstelling toegewezen - Compositions: Gezinssamenstelling + No composition yet: Geen enkele huishoudenssamenstelling toegewezen + Compositions: huishoudenssamenstelling endDate: Einddatum - numberOfChildren: Aantal kinderen in het gezin - Household composition: Gezinssamenstelling - Composition added: Informatie over de gezinssamenstelling toegevoegd - Currently no composition: Geen enkele gezinssamenstelling toegewezen - Add a composition: Een gezinssamenstelling toevoegen - Update composition: Gezinssamenstelling bijwerken - Create: Een nieuwe gezinssamenstelling toewijzen + numberOfChildren: Aantal kinderen in het huishouden + Household composition: huishoudenssamenstelling + Composition added: Informatie over de huishoudenssamenstelling toegevoegd + Currently no composition: Geen enkele huishoudenssamenstelling toegewezen + Add a composition: Een huishoudenssamenstelling toevoegen + Update composition: huishoudenssamenstelling bijwerken + Create: Een nieuwe huishoudenssamenstelling toewijzen # docgen Linked evaluations: Gerelateerde evaluaties diff --git a/src/Bundle/ChillWopiBundle/src/Controller/Convert.php b/src/Bundle/ChillWopiBundle/src/Controller/Convert.php index c7b8b77c3..09fe19678 100644 --- a/src/Bundle/ChillWopiBundle/src/Controller/Convert.php +++ b/src/Bundle/ChillWopiBundle/src/Controller/Convert.php @@ -18,6 +18,7 @@ use Chill\MainBundle\Entity\User; use Psr\Log\LoggerInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\Mime\Part\DataPart; @@ -40,6 +41,8 @@ class Convert private LoggerInterface $logger; + private RequestStack $requestStack; + private Security $security; private StoredObjectManagerInterface $storedObjectManager; @@ -49,12 +52,14 @@ class Convert */ public function __construct( HttpClientInterface $httpClient, + RequestStack $requestStack, Security $security, StoredObjectManagerInterface $storedObjectManager, LoggerInterface $logger, ParameterBagInterface $parameters ) { $this->httpClient = $httpClient; + $this->requestStack = $requestStack; $this->security = $security; $this->storedObjectManager = $storedObjectManager; $this->logger = $logger; @@ -68,18 +73,23 @@ class Convert } $content = $this->storedObjectManager->read($storedObject); - - $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(), - 'body' => $form->bodyToString(), - 'timeout' => 10, - ]); + $query = []; + if (null !== $request = $this->requestStack->getCurrentRequest()) { + $query['lang'] = $request->getLocale(); + } 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, [ 'Content-Type' => 'application/pdf', ]);