Compare commits

..

4 Commits

68 changed files with 389 additions and 261 deletions

View File

@@ -0,0 +1,6 @@
kind: DX
body: Create an unique source of trust for translations
time: 2025-01-31T13:18:01.239211506+01:00
custom:
Issue: "333"
SchemaChange: No schema change

View File

@@ -0,0 +1,6 @@
kind: Feature
body: Suggest all referrers within actions of the accompanying period when creating an activity
time: 2025-01-30T12:02:07.053587034+01:00
custom:
Issue: "349"
SchemaChange: No schema change

View File

@@ -0,0 +1,6 @@
kind: Feature
body: Add possibility to export a csv with all social issues and social actions
time: 2025-01-30T12:04:59.754998541+01:00
custom:
Issue: "343"
SchemaChange: No schema change

View File

@@ -0,0 +1,6 @@
kind: Feature
body: Restore document to previous kept version when a workflow is canceled
time: 2025-02-14T15:03:28.707250207+01:00
custom:
Issue: "360"
SchemaChange: No schema change

View File

@@ -0,0 +1,6 @@
kind: Feature
body: Add a list of third parties from within the admin (csv download)
time: 2025-02-19T12:09:28.487991703+01:00
custom:
Issue: "341"
SchemaChange: No schema change

View File

@@ -0,0 +1,6 @@
kind: Fixed
body: fix generation of document with accompanying period context, and list of activities and works
time: 2025-02-14T12:10:10.920355454+01:00
custom:
Issue: ""
SchemaChange: No schema change

View File

@@ -1,6 +0,0 @@
## v3.10.0 - 2025-03-17
### Feature
* ([#363](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/363)) Display social actions grouped per social issue within activity form
### Fixed
* ([#362](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/362)) Fix Dependency Injection, which prevented to save the CalendarRange
* ([#368](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/368)) fix search query for user groups

View File

@@ -1,10 +0,0 @@
## v3.9.0 - 2025-02-27
### Feature
* ([#349](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/349)) Suggest all referrers within actions of the accompanying period when creating an activity
* ([#343](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/343)) Add possibility to export a csv with all social issues and social actions
* ([#360](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/360)) Restore document to previous kept version when a workflow is canceled
* ([#341](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/341)) Add a list of third parties from within the admin (csv download)
### Fixed
* fix generation of document with accompanying period context, and list of activities and works
### DX
* ([#333](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/333)) Create an unique source of trust for translations

View File

@@ -1,3 +0,0 @@
## v3.9.1 - 2025-02-27
### Fixed
* Fix post/patch request with missing 'type' property for gender

View File

@@ -1,3 +0,0 @@
## v3.9.2 - 2025-02-27
### Fixed
* Use fetchResults method to fetch all social issues instead of only the first page

View File

@@ -6,32 +6,6 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie). and is generated by [Changie](https://github.com/miniscruff/changie).
## v3.10.0 - 2025-03-17
### Feature
* ([#363](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/363)) Display social actions grouped per social issue within activity form
### Fixed
* ([#362](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/362)) Fix Dependency Injection, which prevented to save the CalendarRange
* ([#368](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/368)) fix search query for user groups
## v3.9.2 - 2025-02-27
### Fixed
* Use fetchResults method to fetch all social issues instead of only the first page
## v3.9.1 - 2025-02-27
### Fixed
* Fix post/patch request with missing 'type' property for gender
## v3.9.0 - 2025-02-27
### Feature
* ([#349](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/349)) Suggest all referrers within actions of the accompanying period when creating an activity
* ([#343](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/343)) Add possibility to export a csv with all social issues and social actions
* ([#360](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/360)) Restore document to previous kept version when a workflow is canceled
* ([#341](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/341)) Add a list of third parties from within the admin (csv download)
### Fixed
* fix generation of document with accompanying period context, and list of activities and works
### DX
* ([#333](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/333)) Create an unique source of trust for translations
## v3.8.2 - 2025-02-10 ## v3.8.2 - 2025-02-10
### Fixed ### Fixed
* ([#358](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/358)) Remove "filter" button on list of documents in the workflow's "add attachement" modal * ([#358](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/358)) Remove "filter" button on list of documents in the workflow's "add attachement" modal

View File

@@ -1,5 +1,5 @@
// @ts-ignore Cannot find module (when used within an app) // @ts-ignore Cannot find module (when used within an app)
import { trans, setLocale, setLocaleFallbacks } from "@symfony/ux-translator"; import { trans, getLocale, setLocale, setLocaleFallbacks } from "@symfony/ux-translator";
setLocaleFallbacks({"en": "fr", "nl": "fr", "fr": "en"}); setLocaleFallbacks({"en": "fr", "nl": "fr", "fr": "en"});
setLocale('fr'); setLocale('fr');

View File

@@ -68,23 +68,14 @@
socialActionsSelected.length) socialActionsSelected.length)
" "
> >
<div <check-social-action
id="actionsList" v-for="action in socialActionsList"
v-for="group in socialActionsList" :key="action.id"
:key="group.issue" :action="action"
:selection="socialActionsSelected"
@updateSelected="updateActionsSelected"
> >
<span class="badge bg-chill-l-gray text-dark">{{ </check-social-action>
group.issue
}}</span>
<check-social-action
v-for="action in group.actions"
:key="action.id"
:action="action"
:selection="socialActionsSelected"
@updateSelected="updateActionsSelected"
>
</check-social-action>
</div>
</template> </template>
<span <span
@@ -158,44 +149,53 @@ export default {
}, },
}, },
mounted() { mounted() {
/* Load other issues in multiselect */ /* Load others issues in multiselect
*/
this.issueIsLoading = true; this.issueIsLoading = true;
this.actionAreLoaded = false; this.actionAreLoaded = false;
getSocialIssues().then(
(response) =>
new Promise((resolve) => {
this.$store.commit("updateIssuesOther", response.results);
getSocialIssues().then((response) => { /* Add in list the issues already associated (if not yet listed)
/* Add issues to the store */ */
this.$store.commit("updateIssuesOther", response); this.socialIssuesSelected.forEach((issue) => {
if (
this.socialIssuesList.filter(
(i) => i.id === issue.id,
).length !== 1
) {
this.$store.commit("addIssueInList", issue);
}
}, this);
/* Add in list the issues already associated (if not yet listed) */ /* Remove from multiselect the issues that are not yet in checkbox list
this.socialIssuesSelected.forEach((issue) => { */
if ( this.socialIssuesList.forEach((issue) => {
this.socialIssuesList.filter((i) => i.id === issue.id) this.$store.commit("removeIssueInOther", issue);
.length !== 1 }, this);
) {
this.$store.commit("addIssueInList", issue);
}
});
/* Remove from multiselect the issues that are not yet in the checkbox list */ /* Filter issues
this.socialIssuesList.forEach((issue) => { */
this.$store.commit("removeIssueInOther", issue); this.$store.commit("filterList", "issues");
});
/* Filter issues */ /* Add in list the actions already associated (if not yet listed)
this.$store.commit("filterList", "issues"); */
this.socialActionsSelected.forEach((action) => {
this.$store.commit("addActionInList", action);
}, this);
/* Add in list the actions already associated (if not yet listed) */ /* Filter issues
this.socialActionsSelected.forEach((action) => { */
this.$store.commit("addActionInList", action); this.$store.commit("filterList", "actions");
});
/* Filter actions */ this.issueIsLoading = false;
this.$store.commit("filterList", "actions"); this.actionAreLoaded = true;
this.updateActionsList();
this.issueIsLoading = false; resolve();
this.actionAreLoaded = true; }),
this.updateActionsList(); );
});
}, },
methods: { methods: {
/* When choosing an issue in multiselect, add it in checkboxes (as selected), /* When choosing an issue in multiselect, add it in checkboxes (as selected),
@@ -258,23 +258,7 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "ChillMainAssets/module/bootstrap/shared";
@import "ChillPersonAssets/chill/scss/mixins";
@import "ChillMainAssets/chill/scss/chill_variables";
span.multiselect__single { span.multiselect__single {
display: none !important; display: none !important;
} }
#actionsList {
border-radius: 0.5rem;
padding: 1rem;
margin: 0.5rem;
background-color: whitesmoke;
}
span.badge {
margin-bottom: 0.5rem;
@include badge_social($social-issue-color);
}
</style> </style>

View File

@@ -10,9 +10,7 @@
:value="action" :value="action"
/> />
<label class="form-check-label" :for="action.id"> <label class="form-check-label" :for="action.id">
<span class="badge bg-light text-dark" :title="action.text">{{ <span class="badge bg-light text-dark">{{ action.text }}</span>
action.text
}}</span>
</label> </label>
</div> </div>
</span> </span>
@@ -45,9 +43,5 @@ span.badge {
font-size: 95%; font-size: 95%;
margin-bottom: 5px; margin-bottom: 5px;
margin-right: 1em; margin-right: 1em;
max-width: 100%; /* Adjust as needed */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
} }
</style> </style>

View File

@@ -124,19 +124,9 @@ const store = createStore({
); );
}, },
socialActionsListSorted(state) { socialActionsListSorted(state) {
return [...state.socialActionsList] return [...state.socialActionsList].sort(
.sort((a, b) => a.ordering - b.ordering) (a, b) => a.ordering - b.ordering,
.reduce((acc, action) => { );
const issueText = action.issue?.text || "Uncategorized";
// Find if the group for the issue already exists
let group = acc.find((item) => item.issue === issueText);
if (!group) {
group = { issue: issueText, actions: [] };
acc.push(group);
}
group.actions.push(action);
return acc;
}, []);
}, },
}, },
mutations: { mutations: {

View File

@@ -15,6 +15,7 @@ use Chill\CalendarBundle\Repository\CalendarRepository;
use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\CRUD\Controller\ApiController;
use Chill\MainBundle\Entity\User; use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Serializer\Model\Collection; use Chill\MainBundle\Serializer\Model\Collection;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
@@ -23,7 +24,10 @@ use Symfony\Component\Routing\Annotation\Route;
class CalendarAPIController extends ApiController class CalendarAPIController extends ApiController
{ {
public function __construct(private readonly CalendarRepository $calendarRepository) {} public function __construct(private readonly CalendarRepository $calendarRepository, ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
#[Route(path: '/api/1.0/calendar/calendar/by-user/{id}.{_format}', name: 'chill_api_single_calendar_list_by-user', requirements: ['_format' => 'json'])] #[Route(path: '/api/1.0/calendar/calendar/by-user/{id}.{_format}', name: 'chill_api_single_calendar_list_by-user', requirements: ['_format' => 'json'])]
public function listByUser(User $user, Request $request, string $_format): JsonResponse public function listByUser(User $user, Request $request, string $_format): JsonResponse

View File

@@ -15,6 +15,7 @@ use Chill\CalendarBundle\Repository\CalendarRangeRepository;
use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\CRUD\Controller\ApiController;
use Chill\MainBundle\Entity\User; use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Serializer\Model\Collection; use Chill\MainBundle\Serializer\Model\Collection;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
@@ -23,7 +24,10 @@ use Symfony\Component\Routing\Annotation\Route;
class CalendarRangeAPIController extends ApiController class CalendarRangeAPIController extends ApiController
{ {
public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository) {} public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository, ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
#[Route(path: '/api/1.0/calendar/calendar-range-available/{id}.{_format}', name: 'chill_api_single_calendar_range_available', requirements: ['_format' => 'json'])] #[Route(path: '/api/1.0/calendar/calendar-range-available/{id}.{_format}', name: 'chill_api_single_calendar_range_available', requirements: ['_format' => 'json'])]
public function availableRanges(User $user, Request $request, string $_format): JsonResponse public function availableRanges(User $user, Request $request, string $_format): JsonResponse

View File

@@ -96,13 +96,13 @@
</div> </div>
</div> </div>
<FullCalendar :options="calendarOptions" ref="calendarRef"> <FullCalendar :options="calendarOptions" ref="calendarRef">
<template v-slot:eventContent="{ arg }: {arg: { event: EventApi }}"> <template v-slot:eventContent="arg: EventApi">
<span :class="eventClasses(arg.event)"> <span :class="eventClasses(arg.event)">
<b v-if="arg.event.extendedProps.is === 'remote'">{{ <b v-if="arg.event.extendedProps.is === 'remote'">{{
arg.event.title arg.event.title
}}</b> }}</b>
<b v-else-if="arg.event.extendedProps.is === 'range'" <b v-else-if="arg.event.extendedProps.is === 'range'"
>{{ arg.event.startStr }} - >{{ arg.timeText }} -
{{ arg.event.extendedProps.locationName }}</b {{ arg.event.extendedProps.locationName }}</b
> >
<b v-else-if="arg.event.extendedProps.is === 'local'">{{ <b v-else-if="arg.event.extendedProps.is === 'local'">{{

View File

@@ -14,6 +14,7 @@ namespace Chill\DocStoreBundle\Controller;
use Chill\DocStoreBundle\Entity\StoredObject; use Chill\DocStoreBundle\Entity\StoredObject;
use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\CRUD\Controller\ApiController;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
@@ -27,7 +28,10 @@ class StoredObjectApiController extends ApiController
private readonly Security $security, private readonly Security $security,
private readonly SerializerInterface $serializer, private readonly SerializerInterface $serializer,
private readonly EntityManagerInterface $entityManager, private readonly EntityManagerInterface $entityManager,
) {} ManagerRegistry $managerRegistry,
) {
parent::__construct($managerRegistry);
}
/** /**
* Creates a new stored object. * Creates a new stored object.

View File

@@ -92,7 +92,8 @@
> >
<button <button
:disabled=" :disabled="
isFirstSignatureZone userSignatureZone === null ||
userSignatureZone?.index < 1
" "
class="btn btn-light btn-sm" class="btn btn-light btn-sm"
@click="turnSignature(-1)" @click="turnSignature(-1)"
@@ -102,7 +103,7 @@
<span>|</span> <span>|</span>
<button <button
:disabled=" :disabled="
isLastSignatureZone userSignatureZone?.index >= signature.zones.length - 1
" "
class="btn btn-light btn-sm" class="btn btn-light btn-sm"
@click="turnSignature(1)" @click="turnSignature(1)"
@@ -199,7 +200,10 @@
class="col-4 d-xl-none text-center turnSignature p-0" class="col-4 d-xl-none text-center turnSignature p-0"
> >
<button <button
:disabled="!hasSignatureZoneSelected" :disabled="
userSignatureZone === null ||
userSignatureZone?.index < 1
"
class="btn btn-light btn-sm" class="btn btn-light btn-sm"
@click="turnSignature(-1)" @click="turnSignature(-1)"
> >
@@ -208,7 +212,7 @@
<span>|</span> <span>|</span>
<button <button
:disabled=" :disabled="
isLastSignatureZone userSignatureZone?.index >= signature.zones.length - 1
" "
class="btn btn-light btn-sm" class="btn btn-light btn-sm"
@click="turnSignature(1)" @click="turnSignature(1)"
@@ -222,7 +226,8 @@
> >
<button <button
:disabled=" :disabled="
isFirstSignatureZone userSignatureZone === null ||
userSignatureZone?.index < 1
" "
class="btn btn-light btn-sm" class="btn btn-light btn-sm"
@click="turnSignature(-1)" @click="turnSignature(-1)"
@@ -231,7 +236,9 @@
</button> </button>
<span>|</span> <span>|</span>
<button <button
:disabled="isLastSignatureZone" :disabled="
userSignatureZone?.index >= signature.zones.length - 1
"
class="btn btn-light btn-sm" class="btn btn-light btn-sm"
@click="turnSignature(1)" @click="turnSignature(1)"
> >
@@ -326,7 +333,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {ref, Ref, reactive, computed} from "vue"; import { ref, Ref, reactive } from "vue";
import { useToast } from "vue-toast-notification"; import { useToast } from "vue-toast-notification";
import "vue-toast-notification/dist/theme-sugar.css"; import "vue-toast-notification/dist/theme-sugar.css";
import { import {
@@ -426,14 +433,6 @@ const $toast = useToast();
const signature = window.signature; const signature = window.signature;
const isFirstSignatureZone = () => userSignatureZone.value?.index ? userSignatureZone.value.index < 1 : false
const isLastSignatureZone = () => userSignatureZone.value?.index ? userSignatureZone.value.index >= signature.zones.length - 1 : false
/**
* Return true if the user has selected a user zone (existing on the doc or created by the user)
*/
const hasSignatureZoneSelected = computed<boolean>(() => userSignatureZone.value !== null);
const setZoomLevel = async (zoomLevel: string) => { const setZoomLevel = async (zoomLevel: string) => {
zoom.value = Number.parseFloat(zoomLevel); zoom.value = Number.parseFloat(zoomLevel);
await resetPages(); await resetPages();

View File

@@ -3,9 +3,8 @@ import Modal from "ChillMainAssets/vuejs/_components/Modal.vue";
import { reactive } from "vue"; import { reactive } from "vue";
import HistoryButtonList from "ChillDocStoreAssets/vuejs/StoredObjectButton/HistoryButton/HistoryButtonList.vue"; import HistoryButtonList from "ChillDocStoreAssets/vuejs/StoredObjectButton/HistoryButton/HistoryButtonList.vue";
import { import {
StoredObject, StoredObjectVersion, StoredObject,
StoredObjectVersionWithPointInTime, StoredObjectVersionWithPointInTime,
StoredObjectPointInTime
} from "./../../../types"; } from "./../../../types";
interface HistoryButtonListConfig { interface HistoryButtonListConfig {
@@ -29,8 +28,6 @@ const open = () => {
state.opened = true; state.opened = true;
}; };
const onRestoreVersion = (payload : { newVersion: StoredObjectVersionWithPointInTime }) => emit('restoreVersion', payload)
defineExpose({ open }); defineExpose({ open });
</script> </script>
<template> <template>
@@ -46,7 +43,7 @@ defineExpose({ open });
:can-edit="canEdit" :can-edit="canEdit"
:stored-object="storedObject" :stored-object="storedObject"
@restore-version=" @restore-version="
onRestoreVersion (payload) => emit('restoreVersion', payload)
" "
></history-button-list> ></history-button-list>
</template> </template>

View File

@@ -14,6 +14,7 @@ namespace Chill\DocStoreBundle\Tests\Controller;
use Chill\DocStoreBundle\Controller\StoredObjectApiController; use Chill\DocStoreBundle\Controller\StoredObjectApiController;
use Chill\DocStoreBundle\Entity\StoredObject; use Chill\DocStoreBundle\Entity\StoredObject;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ManagerRegistry;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
@@ -45,7 +46,9 @@ class StoredObjectApiControllerTest extends TestCase
{"type": "stored-object", "id": 1} {"type": "stored-object", "id": 1}
JSON); JSON);
$controller = new StoredObjectApiController($security, $serializer, $entityManager); $managerRegistry = $this->createMock(ManagerRegistry::class);
$controller = new StoredObjectApiController($security, $serializer, $entityManager, $managerRegistry);
$actual = $controller->createStoredObject(); $actual = $controller->createStoredObject();

View File

@@ -39,6 +39,8 @@ abstract class AbstractCRUDController extends AbstractController
*/ */
protected array $crudConfig = []; protected array $crudConfig = [];
public function __construct(protected ManagerRegistry $managerRegistry) {}
/** /**
* get the role given from the config. * get the role given from the config.
*/ */
@@ -63,6 +65,7 @@ abstract class AbstractCRUDController extends AbstractController
parent::getSubscribedServices(), parent::getSubscribedServices(),
[ [
'chill_main.paginator_factory' => PaginatorFactory::class, 'chill_main.paginator_factory' => PaginatorFactory::class,
ManagerRegistry::class => ManagerRegistry::class,
'translator' => TranslatorInterface::class, 'translator' => TranslatorInterface::class,
AuthorizationHelper::class => AuthorizationHelper::class, AuthorizationHelper::class => AuthorizationHelper::class,
EventDispatcherInterface::class => EventDispatcherInterface::class, EventDispatcherInterface::class => EventDispatcherInterface::class,
@@ -212,7 +215,7 @@ abstract class AbstractCRUDController extends AbstractController
protected function getManagerRegistry(): ManagerRegistry protected function getManagerRegistry(): ManagerRegistry
{ {
return $this->container->get('doctrine'); return $this->managerRegistry;
} }
/** /**
@@ -225,7 +228,7 @@ abstract class AbstractCRUDController extends AbstractController
protected function getValidator(): ValidatorInterface protected function getValidator(): ValidatorInterface
{ {
return $this->container->get('validator'); return $this->get('validator');
} }
/** /**

View File

@@ -13,6 +13,7 @@ namespace Chill\MainBundle\CRUD\Controller;
use Chill\MainBundle\Pagination\PaginatorInterface; use Chill\MainBundle\Pagination\PaginatorInterface;
use Chill\MainBundle\Serializer\Model\Collection; use Chill\MainBundle\Serializer\Model\Collection;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
@@ -23,6 +24,11 @@ use Symfony\Component\Validator\ConstraintViolationListInterface;
class ApiController extends AbstractCRUDController class ApiController extends AbstractCRUDController
{ {
public function __construct(ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
/** /**
* Base method for handling api action. * Base method for handling api action.
* *

View File

@@ -13,6 +13,7 @@ namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\CRUD\Controller\ApiController;
use Chill\MainBundle\Entity\Address; use Chill\MainBundle\Entity\Address;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
@@ -20,7 +21,10 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
class AddressApiController extends ApiController class AddressApiController extends ApiController
{ {
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} public function __construct(protected ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
/** /**
* Duplicate an existing address. * Duplicate an existing address.

View File

@@ -17,6 +17,7 @@ use Chill\MainBundle\Pagination\PaginatorFactory;
use Chill\MainBundle\Pagination\PaginatorInterface; use Chill\MainBundle\Pagination\PaginatorInterface;
use Chill\MainBundle\Repository\AddressReferenceRepository; use Chill\MainBundle\Repository\AddressReferenceRepository;
use Chill\MainBundle\Serializer\Model\Collection; use Chill\MainBundle\Serializer\Model\Collection;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
@@ -26,7 +27,10 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
final class AddressReferenceAPIController extends ApiController final class AddressReferenceAPIController extends ApiController
{ {
public function __construct(private readonly AddressReferenceRepository $addressReferenceRepository, private readonly PaginatorFactory $paginatorFactory) {} public function __construct(private readonly AddressReferenceRepository $addressReferenceRepository, private readonly PaginatorFactory $paginatorFactory, ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
#[Route(path: '/api/1.0/main/address-reference/by-postal-code/{id}/search.json')] #[Route(path: '/api/1.0/main/address-reference/by-postal-code/{id}/search.json')]
public function search(PostalCode $postalCode, Request $request): JsonResponse public function search(PostalCode $postalCode, Request $request): JsonResponse

View File

@@ -13,10 +13,16 @@ namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\CRUD\Controller\ApiController;
use Chill\MainBundle\Pagination\PaginatorInterface; use Chill\MainBundle\Pagination\PaginatorInterface;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
class CivilityApiController extends ApiController class CivilityApiController extends ApiController
{ {
public function __construct(protected ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator, $_format) protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator, $_format)
{ {
return $query->addOrderBy('e.order', 'ASC'); return $query->addOrderBy('e.order', 'ASC');

View File

@@ -12,5 +12,12 @@ declare(strict_types=1);
namespace Chill\MainBundle\Controller; namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\CRUD\Controller\ApiController;
use Doctrine\Persistence\ManagerRegistry;
class CountryApiController extends ApiController {} class CountryApiController extends ApiController
{
public function __construct(protected ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
}

View File

@@ -13,10 +13,16 @@ namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\CRUD\Controller\ApiController;
use Chill\MainBundle\Pagination\PaginatorInterface; use Chill\MainBundle\Pagination\PaginatorInterface;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
class GenderApiController extends ApiController class GenderApiController extends ApiController
{ {
public function __construct(protected ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
protected function customizeQuery(string $action, Request $request, $query): void protected function customizeQuery(string $action, Request $request, $query): void
{ {
$query $query

View File

@@ -12,5 +12,12 @@ declare(strict_types=1);
namespace Chill\MainBundle\Controller; namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\CRUD\Controller\ApiController;
use Doctrine\Persistence\ManagerRegistry;
class GeographicalUnitApiController extends ApiController {} class GeographicalUnitApiController extends ApiController
{
public function __construct(protected ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
}

View File

@@ -14,6 +14,7 @@ namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\CRUD\Controller\ApiController;
use Chill\MainBundle\Pagination\PaginatorInterface; use Chill\MainBundle\Pagination\PaginatorInterface;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
/** /**
@@ -21,6 +22,11 @@ use Symfony\Component\HttpFoundation\Request;
*/ */
class LocationApiController extends ApiController class LocationApiController extends ApiController
{ {
public function __construct(protected ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
protected function customizeQuery(string $action, Request $request, $query): void protected function customizeQuery(string $action, Request $request, $query): void
{ {
$query $query

View File

@@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Chill\MainBundle\Controller; namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\CRUD\Controller\ApiController;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
/** /**
@@ -19,6 +20,11 @@ use Symfony\Component\HttpFoundation\Request;
*/ */
class LocationTypeApiController extends ApiController class LocationTypeApiController extends ApiController
{ {
public function __construct(protected ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
public function customizeQuery(string $action, Request $request, $query): void public function customizeQuery(string $action, Request $request, $query): void
{ {
$query->andWhere( $query->andWhere(

View File

@@ -16,6 +16,7 @@ use Chill\MainBundle\Pagination\PaginatorFactory;
use Chill\MainBundle\Repository\CountryRepository; use Chill\MainBundle\Repository\CountryRepository;
use Chill\MainBundle\Repository\PostalCodeRepositoryInterface; use Chill\MainBundle\Repository\PostalCodeRepositoryInterface;
use Chill\MainBundle\Serializer\Model\Collection; use Chill\MainBundle\Serializer\Model\Collection;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
@@ -26,7 +27,10 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
final class PostalCodeAPIController extends ApiController final class PostalCodeAPIController extends ApiController
{ {
public function __construct(private readonly CountryRepository $countryRepository, private readonly PostalCodeRepositoryInterface $postalCodeRepository, private readonly PaginatorFactory $paginatorFactory) {} public function __construct(private readonly CountryRepository $countryRepository, private readonly PostalCodeRepositoryInterface $postalCodeRepository, private readonly PaginatorFactory $paginatorFactory, ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
#[Route(path: '/api/1.0/main/postal-code/search.json')] #[Route(path: '/api/1.0/main/postal-code/search.json')]
public function search(Request $request): JsonResponse public function search(Request $request): JsonResponse

View File

@@ -12,10 +12,16 @@ declare(strict_types=1);
namespace Chill\MainBundle\Controller; namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\CRUD\Controller\ApiController;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
class ScopeApiController extends ApiController class ScopeApiController extends ApiController
{ {
public function __construct(protected ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
protected function customizeQuery(string $action, Request $request, $query): void protected function customizeQuery(string $action, Request $request, $query): void
{ {
if ('_index' === $action) { if ('_index' === $action) {

View File

@@ -15,6 +15,7 @@ use Chill\MainBundle\CRUD\Controller\ApiController;
use Chill\MainBundle\Pagination\PaginatorInterface; use Chill\MainBundle\Pagination\PaginatorInterface;
use Chill\MainBundle\Security\ChillSecurity; use Chill\MainBundle\Security\ChillSecurity;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
@@ -22,7 +23,10 @@ use Symfony\Component\Routing\Annotation\Route;
class UserApiController extends ApiController class UserApiController extends ApiController
{ {
public function __construct(private readonly ChillSecurity $security) {} public function __construct(private readonly ChillSecurity $security, ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
#[Route(path: '/api/1.0/main/user-current-location.{_format}', name: 'chill_main_user_current_location', requirements: ['_format' => 'json'])] #[Route(path: '/api/1.0/main/user-current-location.{_format}', name: 'chill_main_user_current_location', requirements: ['_format' => 'json'])]
public function currentLocation(mixed $_format): JsonResponse public function currentLocation(mixed $_format): JsonResponse

View File

@@ -12,5 +12,12 @@ declare(strict_types=1);
namespace Chill\MainBundle\Controller; namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\CRUD\Controller\ApiController;
use Doctrine\Persistence\ManagerRegistry;
class UserGroupApiController extends ApiController {} class UserGroupApiController extends ApiController
{
public function __construct(protected ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
}

View File

@@ -12,10 +12,16 @@ declare(strict_types=1);
namespace Chill\MainBundle\Controller; namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\CRUD\Controller\ApiController;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
class UserJobApiController extends ApiController class UserJobApiController extends ApiController
{ {
public function __construct(protected ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
protected function customizeQuery(string $action, Request $request, $query): void protected function customizeQuery(string $action, Request $request, $query): void
{ {
if ('_index' === $action) { if ('_index' === $action) {

View File

@@ -75,8 +75,8 @@ final class UserGroupRepository implements UserGroupRepositoryInterface, LocaleA
->setWhereClauses(' ->setWhereClauses('
ug.active AND ( ug.active AND (
SIMILARITY(LOWER(UNACCENT(?)), ug.label->>?) > 0.15 SIMILARITY(LOWER(UNACCENT(?)), ug.label->>?) > 0.15
OR LOWER(UNACCENT(ug.label->>?)) LIKE \'%\' || LOWER(UNACCENT(?)) || \'%\') OR ug.label->>? LIKE \'%\' || LOWER(UNACCENT(?)) || \'%\')
', [$pattern, $lang, $lang, $pattern]); ', [$pattern, $lang, $pattern, $lang]);
return $query; return $query;
} }

View File

@@ -12,6 +12,10 @@ function loadDynamicPicker(element) {
let apps = element.querySelectorAll('[data-module="pick-dynamic"]'); let apps = element.querySelectorAll('[data-module="pick-dynamic"]');
apps.forEach(function (el) { apps.forEach(function (el) {
let suggested;
let as_id;
let submit_on_adding_new_entity;
let label;
const isMultiple = parseInt(el.dataset.multiple) === 1, const isMultiple = parseInt(el.dataset.multiple) === 1,
uniqId = el.dataset.uniqid, uniqId = el.dataset.uniqid,
input = element.querySelector( input = element.querySelector(
@@ -22,12 +26,12 @@ function loadDynamicPicker(element) {
? JSON.parse(input.value) ? JSON.parse(input.value)
: input.value === "[]" || input.value === "" : input.value === "[]" || input.value === ""
? null ? null
: [JSON.parse(input.value)], : [JSON.parse(input.value)];
suggested = JSON.parse(el.dataset.suggested), suggested = JSON.parse(el.dataset.suggested);
as_id = parseInt(el.dataset.asId) === 1, as_id = parseInt(el.dataset.asId) === 1;
submit_on_adding_new_entity = submit_on_adding_new_entity =
parseInt(el.dataset.submitOnAddingNewEntity) === 1, parseInt(el.dataset.submitOnAddingNewEntity) === 1;
label = el.dataset.label; label = el.dataset.label;
if (!isMultiple) { if (!isMultiple) {
if (input.value === "[]") { if (input.value === "[]") {

View File

@@ -45,9 +45,6 @@ const onPickGenericDoc = ({
}) => { }) => {
emit("pickGenericDoc", { genericDoc }); emit("pickGenericDoc", { genericDoc });
}; };
const onRemoveAttachment = (payload: { attachment: WorkflowAttachment }) => { emit('removeAttachment', payload) };
</script> </script>
<template> <template>
@@ -59,7 +56,7 @@ const onRemoveAttachment = (payload: { attachment: WorkflowAttachment }) => { em
></pick-generic-doc-modal> ></pick-generic-doc-modal>
<attachment-list <attachment-list
:attachments="props.attachments" :attachments="props.attachments"
@removeAttachment="onRemoveAttachment" @removeAttachment="(payload) => emit('removeAttachment', payload)"
></attachment-list> ></attachment-list>
<ul class="record_actions"> <ul class="record_actions">
<li> <li>

View File

@@ -72,10 +72,6 @@ const placeTrans = (str: string): string => {
} }
}; };
const onPickDocument = (payload: { genericDoc: GenericDocForAccompanyingPeriod }) => emit('pickGenericDoc', payload);
const onRemoveGenericDoc = (payload: {genericDoc: GenericDocForAccompanyingPeriod}) => emit('removeGenericDoc', payload);
const filteredDocuments = computed<GenericDocForAccompanyingPeriod[]>(() => { const filteredDocuments = computed<GenericDocForAccompanyingPeriod[]>(() => {
if (false === loaded.value) { if (false === loaded.value) {
return []; return [];
@@ -249,9 +245,9 @@ const filteredDocuments = computed<GenericDocForAccompanyingPeriod[]>(() => {
:accompanying-period-id="accompanyingPeriodId" :accompanying-period-id="accompanyingPeriodId"
:genericDoc="g" :genericDoc="g"
:is-picked="isPicked(g)" :is-picked="isPicked(g)"
@pickGenericDoc="onPickDocument" @pickGenericDoc="(payload) => emit('pickGenericDoc', payload)"
@removeGenericDoc=" @removeGenericDoc="
onRemoveGenericDoc (payload) => emit('removeGenericDoc', payload)
" "
></pick-generic-doc-item> ></pick-generic-doc-item>
</div> </div>

View File

@@ -34,7 +34,6 @@ class GenderDocGenNormalizer implements ContextAwareNormalizerInterface, Normali
'id' => $gender->getId(), 'id' => $gender->getId(),
'label' => $this->translatableStringHelper->localize($gender->getLabel()), 'label' => $this->translatableStringHelper->localize($gender->getLabel()),
'genderTranslation' => $gender->getGenderTranslation(), 'genderTranslation' => $gender->getGenderTranslation(),
'type' => 'chill_main_gender',
]; ];
} }
} }

View File

@@ -68,8 +68,8 @@ class AddressReferenceBEFromBestAddress
$csv->setDelimiter(','); $csv->setDelimiter(',');
$csv->setHeaderOffset(0); $csv->setHeaderOffset(0);
$stmt = new Statement(); $stmt = Statement::create()
$stmt = $stmt->process($csv); ->process($csv);
foreach ($stmt as $record) { foreach ($stmt as $record) {
$this->baseImporter->importAddress( $this->baseImporter->importAddress(

View File

@@ -55,32 +55,32 @@ class AddressReferenceFromBAN
$csv = Reader::createFromStream($csvDecompressed); $csv = Reader::createFromStream($csvDecompressed);
$csv->setDelimiter(';')->setHeaderOffset(0); $csv->setDelimiter(';')->setHeaderOffset(0);
$stmt = new Statement(); $stmt = Statement::create()
$stmt = $stmt->process($csv, [ ->process($csv, [
'id', 'id',
'id_fantoir', 'id_fantoir',
'numero', 'numero',
'rep', 'rep',
'nom_voie', 'nom_voie',
'code_postal', 'code_postal',
'code_insee', 'code_insee',
'nom_commune', 'nom_commune',
'code_insee_ancienne_commune', 'code_insee_ancienne_commune',
'nom_ancienne_commune', 'nom_ancienne_commune',
'x', 'x',
'y', 'y',
'lon', 'lon',
'lat', 'lat',
'type_position', 'type_position',
'alias', 'alias',
'nom_ld', 'nom_ld',
'libelle_acheminement', 'libelle_acheminement',
'nom_afnor', 'nom_afnor',
'source_position', 'source_position',
'source_nom_voie', 'source_nom_voie',
'certification_commune', 'certification_commune',
'cad_parcelles', 'cad_parcelles',
]); ]);
foreach ($stmt as $record) { foreach ($stmt as $record) {
$this->baseImporter->importAddress( $this->baseImporter->importAddress(

View File

@@ -43,17 +43,17 @@ class AddressReferenceFromBano
$csv = Reader::createFromStream($file); $csv = Reader::createFromStream($file);
$csv->setDelimiter(','); $csv->setDelimiter(',');
$stmt = new Statement(); $stmt = Statement::create()
$stmt = $stmt->process($csv, [ ->process($csv, [
'refId', 'refId',
'streetNumber', 'streetNumber',
'street', 'street',
'postcode', 'postcode',
'city', 'city',
'_o', '_o',
'lat', 'lat',
'lon', 'lon',
]); ]);
foreach ($stmt as $record) { foreach ($stmt as $record) {
$this->baseImporter->importAddress( $this->baseImporter->importAddress(

View File

@@ -54,8 +54,7 @@ class AddressReferenceLU
private function process_address(Reader $csv, ?string $sendAddressReportToEmail = null): void private function process_address(Reader $csv, ?string $sendAddressReportToEmail = null): void
{ {
$stmt = new Statement(); $stmt = Statement::create()->process($csv);
$stmt = $stmt->process($csv);
foreach ($stmt as $record) { foreach ($stmt as $record) {
$this->addressBaseImporter->importAddress( $this->addressBaseImporter->importAddress(
$record['id_geoportail'], $record['id_geoportail'],
@@ -75,8 +74,7 @@ class AddressReferenceLU
private function process_postal_code(Reader $csv): void private function process_postal_code(Reader $csv): void
{ {
$stmt = new Statement(); $stmt = Statement::create()->process($csv);
$stmt = $stmt->process($csv);
$arr_postal_codes = []; $arr_postal_codes = [];
foreach ($stmt as $record) { foreach ($stmt as $record) {
if (false === \array_key_exists($record['code_postal'], $arr_postal_codes)) { if (false === \array_key_exists($record['code_postal'], $arr_postal_codes)) {

View File

@@ -61,7 +61,6 @@ final class GenderDocGenNormalizerTest extends TestCase
'id' => 1, 'id' => 1,
'label' => 'homme', 'label' => 'homme',
'genderTranslation' => GenderEnum::MALE, 'genderTranslation' => GenderEnum::MALE,
'type' => 'chill_main_gender',
]; ];
$this->assertEquals($expected, $this->normalizer->normalize($gender)); $this->assertEquals($expected, $this->normalizer->normalize($gender));

View File

@@ -943,16 +943,6 @@ paths:
description: "ok" description: "ok"
401: 401:
description: "Unauthorized" description: "Unauthorized"
/1.0/main/gender.json:
get:
tags:
- gender
summary: Return all gender types
responses:
200:
description: "ok"
401:
description: "Unauthorized"
/1.0/main/user-job.json: /1.0/main/user-job.json:
get: get:
tags: tags:

View File

@@ -2,6 +2,7 @@ services:
_defaults: _defaults:
autowire: true autowire: true
autoconfigure: true autoconfigure: true
public: false
Chill\MainBundle\Controller\: Chill\MainBundle\Controller\:
resource: '../../Controller' resource: '../../Controller'

View File

@@ -29,6 +29,7 @@ use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepos
use Chill\PersonBundle\Repository\AccompanyingPeriodRepository; use Chill\PersonBundle\Repository\AccompanyingPeriodRepository;
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
use Chill\ThirdPartyBundle\Entity\ThirdParty; use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Doctrine\Persistence\ManagerRegistry;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
@@ -46,7 +47,10 @@ use Symfony\Component\Workflow\Registry;
final class AccompanyingCourseApiController extends ApiController final class AccompanyingCourseApiController extends ApiController
{ {
public function __construct(private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly EventDispatcherInterface $eventDispatcher, private readonly ReferralsSuggestionInterface $referralAvailable, private readonly Registry $registry, private readonly ValidatorInterface $validator, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry, private readonly AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository) {} public function __construct(private readonly AccompanyingPeriodRepository $accompanyingPeriodRepository, private readonly EventDispatcherInterface $eventDispatcher, private readonly ReferralsSuggestionInterface $referralAvailable, private readonly Registry $registry, private readonly ValidatorInterface $validator, protected ManagerRegistry $managerRegistry, private readonly AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository)
{
parent::__construct($managerRegistry);
}
public function commentApi($id, Request $request, string $_format): Response public function commentApi($id, Request $request, string $_format): Response
{ {

View File

@@ -16,6 +16,7 @@ use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Serializer\Model\Collection; use Chill\MainBundle\Serializer\Model\Collection;
use Chill\MainBundle\Serializer\Model\Counter; use Chill\MainBundle\Serializer\Model\Counter;
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository; use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
@@ -27,7 +28,10 @@ class AccompanyingCourseWorkApiController extends ApiController
public function __construct( public function __construct(
private readonly AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository, private readonly AccompanyingPeriodWorkRepository $accompanyingPeriodWorkRepository,
private readonly Security $security, private readonly Security $security,
) {} ManagerRegistry $managerRegistry,
) {
parent::__construct($managerRegistry);
}
#[Route(path: '/api/1.0/person/accompanying-period/work/my-near-end')] #[Route(path: '/api/1.0/person/accompanying-period/work/my-near-end')]
public function myWorksNearEndDate(Request $request): JsonResponse public function myWorksNearEndDate(Request $request): JsonResponse

View File

@@ -12,5 +12,12 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Controller; namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\CRUD\Controller\ApiController;
use Doctrine\Persistence\ManagerRegistry;
class AccompanyingPeriodCommentApiController extends ApiController {} class AccompanyingPeriodCommentApiController extends ApiController
{
public function __construct(protected ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
}

View File

@@ -12,5 +12,12 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Controller; namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\CRUD\Controller\ApiController;
use Doctrine\Persistence\ManagerRegistry;
class AccompanyingPeriodResourceApiController extends ApiController {} class AccompanyingPeriodResourceApiController extends ApiController
{
public function __construct(protected ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
}

View File

@@ -22,6 +22,7 @@ use Chill\PersonBundle\Event\Person\PersonAddressMoveEvent;
use Chill\PersonBundle\Repository\Household\HouseholdACLAwareRepositoryInterface; use Chill\PersonBundle\Repository\Household\HouseholdACLAwareRepositoryInterface;
use Chill\PersonBundle\Repository\Household\HouseholdRepository; use Chill\PersonBundle\Repository\Household\HouseholdRepository;
use Chill\PersonBundle\Security\Authorization\HouseholdVoter; use Chill\PersonBundle\Security\Authorization\HouseholdVoter;
use Doctrine\Persistence\ManagerRegistry;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
@@ -31,7 +32,10 @@ use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
class HouseholdApiController extends ApiController class HouseholdApiController extends ApiController
{ {
public function __construct(private readonly EventDispatcherInterface $eventDispatcher, private readonly HouseholdRepository $householdRepository, private readonly HouseholdACLAwareRepositoryInterface $householdACLAwareRepository, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {} public function __construct(private readonly EventDispatcherInterface $eventDispatcher, private readonly HouseholdRepository $householdRepository, private readonly HouseholdACLAwareRepositoryInterface $householdACLAwareRepository, protected ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
/** /**
* @return \Symfony\Component\HttpFoundation\JsonResponse * @return \Symfony\Component\HttpFoundation\JsonResponse

View File

@@ -13,10 +13,16 @@ namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\CRUD\Controller\ApiController;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
class HouseholdCompositionTypeApiController extends ApiController class HouseholdCompositionTypeApiController extends ApiController
{ {
public function __construct(protected ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
/** /**
* @param QueryBuilder $query * @param QueryBuilder $query
*/ */

View File

@@ -23,6 +23,7 @@ use Chill\PersonBundle\Repository\Household\PositionRepository;
use Chill\PersonBundle\Repository\PersonRepository; use Chill\PersonBundle\Repository\PersonRepository;
use Chill\PersonBundle\Security\Authorization\HouseholdVoter; use Chill\PersonBundle\Security\Authorization\HouseholdVoter;
use Chill\PersonBundle\Security\Authorization\PersonVoter; use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
@@ -47,9 +48,10 @@ class HouseholdMemberController extends ApiController
private readonly HouseholdRepository $householdRepository, private readonly HouseholdRepository $householdRepository,
private readonly Security $security, private readonly Security $security,
private readonly PositionRepository $positionRepository, private readonly PositionRepository $positionRepository,
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry,
protected ParameterBagInterface $parameterBag, protected ParameterBagInterface $parameterBag,
ManagerRegistry $managerRegistry,
) { ) {
parent::__construct($managerRegistry);
$this->household_fields_visibility = $parameterBag->get('chill_person.household_fields'); $this->household_fields_visibility = $parameterBag->get('chill_person.household_fields');
} }

View File

@@ -12,10 +12,16 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Controller; namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\CRUD\Controller\ApiController;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
class OpeningApiController extends ApiController class OpeningApiController extends ApiController
{ {
public function __construct(protected ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
protected function customizeQuery(string $action, Request $request, $qb): void protected function customizeQuery(string $action, Request $request, $qb): void
{ {
$qb->where($qb->expr()->gt('e.noActiveAfter', ':now')) $qb->where($qb->expr()->gt('e.noActiveAfter', ':now'))

View File

@@ -18,6 +18,7 @@ use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Security\Authorization\PersonVoter; use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Chill\PersonBundle\Security\AuthorizedCenterOnPersonCreationInterface; use Chill\PersonBundle\Security\AuthorizedCenterOnPersonCreationInterface;
use Doctrine\Persistence\ManagerRegistry;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@@ -32,7 +33,9 @@ class PersonApiController extends ApiController
private readonly AuthorizedCenterOnPersonCreationInterface $authorizedCenterOnPersonCreation, private readonly AuthorizedCenterOnPersonCreationInterface $authorizedCenterOnPersonCreation,
private readonly ConfigPersonAltNamesHelper $configPersonAltNameHelper, private readonly ConfigPersonAltNamesHelper $configPersonAltNameHelper,
ParameterBagInterface $parameterBag, ParameterBagInterface $parameterBag,
ManagerRegistry $managerRegistry,
) { ) {
parent::__construct($managerRegistry);
$this->showCenters = $parameterBag->get('chill_main')['acl']['form_show_centers']; $this->showCenters = $parameterBag->get('chill_main')['acl']['form_show_centers'];
} }

View File

@@ -12,5 +12,12 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Controller; namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\CRUD\Controller\ApiController;
use Doctrine\Persistence\ManagerRegistry;
class RelationApiController extends ApiController {} class RelationApiController extends ApiController
{
public function __construct(protected ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
}

View File

@@ -15,12 +15,16 @@ use Chill\MainBundle\CRUD\Controller\ApiController;
use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Repository\Relationships\RelationshipRepository; use Chill\PersonBundle\Repository\Relationships\RelationshipRepository;
use Chill\PersonBundle\Security\Authorization\PersonVoter; use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Doctrine\Persistence\ManagerRegistry;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
class RelationshipApiController extends ApiController class RelationshipApiController extends ApiController
{ {
public function __construct(private readonly RelationshipRepository $repository) {} public function __construct(private readonly RelationshipRepository $repository, ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
/** /**
* @ParamConverter("person", options={"id": "person_id"}) * @ParamConverter("person", options={"id": "person_id"})

View File

@@ -13,10 +13,16 @@ namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\CRUD\Controller\ApiController;
use Chill\MainBundle\Pagination\PaginatorInterface; use Chill\MainBundle\Pagination\PaginatorInterface;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
class SocialIssueApiController extends ApiController class SocialIssueApiController extends ApiController
{ {
public function __construct(protected ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
protected function customizeQuery(string $action, Request $request, $query): void protected function customizeQuery(string $action, Request $request, $query): void
{ {
$query->where( $query->where(

View File

@@ -16,12 +16,16 @@ use Chill\MainBundle\Pagination\PaginatorFactory;
use Chill\MainBundle\Serializer\Model\Collection; use Chill\MainBundle\Serializer\Model\Collection;
use Chill\PersonBundle\Entity\SocialWork\SocialAction; use Chill\PersonBundle\Entity\SocialWork\SocialAction;
use Chill\PersonBundle\Repository\SocialWork\GoalRepository; use Chill\PersonBundle\Repository\SocialWork\GoalRepository;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
class SocialWorkGoalApiController extends ApiController class SocialWorkGoalApiController extends ApiController
{ {
public function __construct(private readonly GoalRepository $goalRepository, private readonly PaginatorFactory $paginator) {} public function __construct(private readonly GoalRepository $goalRepository, private readonly PaginatorFactory $paginator, ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
public function listBySocialAction(Request $request, SocialAction $action): Response public function listBySocialAction(Request $request, SocialAction $action): Response
{ {

View File

@@ -16,12 +16,16 @@ use Chill\MainBundle\Serializer\Model\Collection;
use Chill\PersonBundle\Entity\SocialWork\Goal; use Chill\PersonBundle\Entity\SocialWork\Goal;
use Chill\PersonBundle\Entity\SocialWork\SocialAction; use Chill\PersonBundle\Entity\SocialWork\SocialAction;
use Chill\PersonBundle\Repository\SocialWork\ResultRepository; use Chill\PersonBundle\Repository\SocialWork\ResultRepository;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
class SocialWorkResultApiController extends ApiController class SocialWorkResultApiController extends ApiController
{ {
public function __construct(private readonly ResultRepository $resultRepository) {} public function __construct(private readonly ResultRepository $resultRepository, ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
public function listByGoal(Request $request, Goal $goal): Response public function listByGoal(Request $request, Goal $goal): Response
{ {

View File

@@ -16,6 +16,7 @@ use Chill\MainBundle\Pagination\PaginatorFactory;
use Chill\MainBundle\Serializer\Model\Collection; use Chill\MainBundle\Serializer\Model\Collection;
use Chill\PersonBundle\Entity\SocialWork\SocialAction; use Chill\PersonBundle\Entity\SocialWork\SocialAction;
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository; use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Clock\ClockInterface; use Symfony\Component\Clock\ClockInterface;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@@ -26,7 +27,10 @@ final class SocialWorkSocialActionApiController extends ApiController
private readonly SocialIssueRepository $socialIssueRepository, private readonly SocialIssueRepository $socialIssueRepository,
private readonly PaginatorFactory $paginator, private readonly PaginatorFactory $paginator,
private readonly ClockInterface $clock, private readonly ClockInterface $clock,
) {} ManagerRegistry $managerRegistry,
) {
parent::__construct($managerRegistry);
}
public function listBySocialIssueApi($id, Request $request) public function listBySocialIssueApi($id, Request $request)
{ {

View File

@@ -33,7 +33,18 @@ const getUserJobs = () => fetchResults("/api/1.0/main/user-job.json");
const getSocialIssues = () => { const getSocialIssues = () => {
const url = `/api/1.0/person/social-work/social-issue.json`; const url = `/api/1.0/person/social-work/social-issue.json`;
return fetchResults(url); return fetch(url).then((response) => {
if (response.ok) {
return response.json();
}
throw {
msg: "Error while retriving Social Issues.",
sta: response.status,
txt: response.statusText,
err: new Error(),
body: response.body,
};
});
}; };
const whoami = () => { const whoami = () => {

View File

@@ -29,7 +29,7 @@
<script> <script>
import VueMultiselect from "vue-multiselect"; import VueMultiselect from "vue-multiselect";
import { fetchResults } from "ChillMainAssets/lib/api/apiMethods"; import { makeFetch } from "ChillMainAssets/lib/api/apiMethods";
import { mapGetters, mapState } from "vuex"; import { mapGetters, mapState } from "vuex";
export default { export default {
@@ -51,11 +51,16 @@ export default {
}, },
methods: { methods: {
getOptions() { getOptions() {
fetchResults(`/api/1.0/person/social-work/social-issue.json`).then( const url = `/api/1.0/person/social-work/social-issue.json`;
(response) => { makeFetch("GET", url)
this.options = response; .then((response) => {
}, this.options = response.results;
); return response;
})
.catch((error) => {
commit("catchError", error);
this.$toast.open({ message: error.txt });
});
}, },
updateSocialIssues(value) { updateSocialIssues(value) {
this.$store this.$store

View File

@@ -6,7 +6,7 @@ import {
} from "ChillMainAssets/chill/js/date"; } from "ChillMainAssets/chill/js/date";
import { findSocialActionsBySocialIssue } from "ChillPersonAssets/vuejs/_api/SocialWorkSocialAction.js"; import { findSocialActionsBySocialIssue } from "ChillPersonAssets/vuejs/_api/SocialWorkSocialAction.js";
// import { create } from 'ChillPersonAssets/vuejs/_api/AccompanyingCourseWork.js'; // import { create } from 'ChillPersonAssets/vuejs/_api/AccompanyingCourseWork.js';
import { fetchResults, makeFetch } from "ChillMainAssets/lib/api/apiMethods"; import { makeFetch } from "ChillMainAssets/lib/api/apiMethods";
const debug = process.env.NODE_ENV !== "production"; const debug = process.env.NODE_ENV !== "production";
@@ -168,9 +168,9 @@ const store = createStore({
}, },
fetchOtherSocialIssues({ commit }) { fetchOtherSocialIssues({ commit }) {
const url = `/api/1.0/person/social-work/social-issue.json`; const url = `/api/1.0/person/social-work/social-issue.json`;
return fetchResults(url) return makeFetch("GET", url)
.then((response) => { .then((response) => {
commit("updateIssuesOther", response); // Directly commit the array of issues commit("updateIssuesOther", response.results);
}) })
.catch((error) => { .catch((error) => {
throw error; throw error;

View File

@@ -12,5 +12,12 @@ declare(strict_types=1);
namespace Chill\ThirdPartyBundle\Controller; namespace Chill\ThirdPartyBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController; use Chill\MainBundle\CRUD\Controller\ApiController;
use Doctrine\Persistence\ManagerRegistry;
class ThirdPartyApiController extends ApiController {} class ThirdPartyApiController extends ApiController
{
public function __construct(protected ManagerRegistry $managerRegistry)
{
parent::__construct($managerRegistry);
}
}