Compare commits

..

1 Commits

195 changed files with 847 additions and 1937 deletions

View File

@@ -1,21 +0,0 @@
## v2.6.0 - 2023-09-14
### Feature
* ([#133](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/133)) Add locations in Aside Activity. By default, suggest user location, otherwise a select with all locations.
* ([#133](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/133)) Adapt Aside Activity exports: display location, filter by location, group by location
* Use the CRUD controller for center entity + add the isActive property to be able to mask instances of Center that are no longer in use.
### Fixed
* ([#107](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/107)) reinstate the fusion of duplicate persons
* Missing translation in Work Actions exports
* Reimplement the mission type filter on tasks, only for instances that have a config parameter indicating true for this.
* ([#135](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/135)) Corrects a typing error in 2 filters, which caused an
error when trying to reedit a saved export
* ([#136](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/136)) [household] when moving a person to a sharing position to a not-sharing position on the same household on the same date, remove the previous household membership on the same household. This fix duplicate member.
* Add missing translation for comment field placeholder in repositionning household editor.
* Do not send an email to creator twice when adding a comment to a notification
* ([#107](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/107)) Fix gestion doublon functionality to work with chill bundles v2
### UX
* Uniformize badge-person in household banner (background, size)

View File

@@ -1,3 +0,0 @@
## v2.6.1 - 2023-09-14
### Fixed
* Filter out active centers in exports, which uses a different PickCenterType.

View File

@@ -1,3 +0,0 @@
## v2.6.2 - 2023-09-18
### Fixed
* Fix doctrine mapping of AbstractTaskPlaceEvent and SingleTaskPlaceEvent: id property moved.

View File

@@ -6,36 +6,6 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).
## v2.6.2 - 2023-09-18
### Fixed
* Fix doctrine mapping of AbstractTaskPlaceEvent and SingleTaskPlaceEvent: id property moved.
## v2.6.1 - 2023-09-14
### Fixed
* Filter out active centers in exports, which uses a different PickCenterType.
## v2.6.0 - 2023-09-14
### Feature
* ([#133](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/133)) Add locations in Aside Activity. By default, suggest user location, otherwise a select with all locations.
* ([#133](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/133)) Adapt Aside Activity exports: display location, filter by location, group by location
* Use the CRUD controller for center entity + add the isActive property to be able to mask instances of Center that are no longer in use.
### Fixed
* ([#107](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/107)) reinstate the fusion of duplicate persons
* Missing translation in Work Actions exports
* Reimplement the mission type filter on tasks, only for instances that have a config parameter indicating true for this.
* ([#135](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/135)) Corrects a typing error in 2 filters, which caused an
error when trying to reedit a saved export
* ([#136](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/136)) [household] when moving a person to a sharing position to a not-sharing position on the same household on the same date, remove the previous household membership on the same household. This fix duplicate member.
* Add missing translation for comment field placeholder in repositionning household editor.
* Do not send an email to creator twice when adding a comment to a notification
* ([#107](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/107)) Fix gestion doublon functionality to work with chill bundles v2
### UX
* Uniformize badge-person in household banner (background, size)
## v2.5.3 - 2023-07-20
### Fixed
* ([#132](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/132)) Rendez-vous documents created would appear in all documents lists of all persons with an accompanying period. Or statements are now added to the where clause to filter out documents that come from unrelated accompanying period/ or person rendez-vous.

View File

@@ -94,7 +94,7 @@ class CountPerson implements ExportInterface
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
// we gather all center the user choose.
$centers = array_map(static fn ($el) => $el['center'], $acl);
$centers = array_map(static fn($el) => $el['center'], $acl);
$qb = $this->entityManager->createQueryBuilder();

View File

@@ -1,36 +0,0 @@
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
.. _faq:
Frequently asked questions
####################
Continuous integration
***********
Pipeline fails, but php-cs-fixer doesn't alert me when running it locally ?
========================================
It is possible that you run php-cs-fixer on your local instance of chill and no fixes are made.
Everything seems fine, so you push. However once the pipeline is run in gitlab, you're notified that it failed due to php
cs errors.
In this case it's likely that you have to update your version of php-cs-fixer.
php-cs-fixer is installed when building the docker image: https://gitea.champs-libres.be/Chill-project/chill-skeleton-basic/src/branch/main/Dockerfile#L50
Consequently, to update php-cs-fixer we have to update the image by building it again.
For this the following commands can be used,
.. code-block:: php
docker compose build --pull php
# replace existing containers
docker compose up -d --force-recreate php

View File

@@ -9,7 +9,7 @@
Development
###########
As Chill relies on the `symfony <http://symfony.com>`_ framework, reading the framework's documentation should answer most of your questions. We are explaining here some tips to work with Chill, and help with things we've encountered.
As Chill rely on the `symfony <http://symfony.com>`_ framework, reading the framework's documentation should answer most of your questions. We are explaining here some tips to work with Chill, and things we provide to encounter our needs.
.. toctree::
:maxdepth: 2
@@ -37,7 +37,6 @@ As Chill relies on the `symfony <http://symfony.com>`_ framework, reading the fr
Cron Jobs <cronjob.rst>
Info about entities <entity-info.rst>
Info about database (in French) <database-principles.rst>
Developer FAQ <FAQ.rst>
Layout and UI
**************

View File

@@ -56,7 +56,7 @@ class ChillMainConfiguration implements ConfigurationInterface
->end() // end of widgets
->end() // end of root/children
->end() // end of root
;
;
return $treeBuilder;
}

View File

@@ -2,13 +2,6 @@
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;

View File

@@ -13,4 +13,6 @@ namespace Chill\ActivityBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class ChillActivityBundle extends Bundle {}
class ChillActivityBundle extends Bundle
{
}

View File

@@ -72,7 +72,8 @@ final class ActivityController extends AbstractController
private readonly FilterOrderHelperFactoryInterface $filterOrderHelperFactory,
private readonly TranslatableStringHelperInterface $translatableStringHelper,
private readonly PaginatorFactory $paginatorFactory,
) {}
) {
}
/**
* Deletes a Activity entity.
@@ -319,6 +320,7 @@ final class ActivityController extends AbstractController
private function buildFilterOrder(AccompanyingPeriod|Person $associated): FilterOrderHelper
{
$filterBuilder = $this->filterOrderHelperFactory->create(self::class);
$types = $this->activityACLAwareRepository->findActivityTypeByAssociated($associated);
$jobs = $this->activityACLAwareRepository->findUserJobByAssociated($associated);

View File

@@ -36,7 +36,9 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface
$this->repository = $em->getRepository(Activity::class);
}
public function buildForm(FormBuilderInterface $builder) {}
public function buildForm(FormBuilderInterface $builder)
{
}
public function getFormDefaultData(): array
{
return [];

View File

@@ -36,7 +36,9 @@ class CountActivity implements ExportInterface, GroupedExportInterface
$this->repository = $em->getRepository(Activity::class);
}
public function buildForm(FormBuilderInterface $builder) {}
public function buildForm(FormBuilderInterface $builder)
{
}
public function getFormDefaultData(): array
{
return [];

View File

@@ -32,7 +32,9 @@ class CountActivity implements ExportInterface, GroupedExportInterface
$this->activityRepository = $activityRepository;
}
public function buildForm(FormBuilderInterface $builder) {}
public function buildForm(FormBuilderInterface $builder)
{
}
public function getFormDefaultData(): array
{
return [];

View File

@@ -50,7 +50,9 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface
$this->activityRepository = $activityRepository;
}
public function buildForm(FormBuilderInterface $builder) {}
public function buildForm(FormBuilderInterface $builder)
{
}
public function getFormDefaultData(): array
{
return [];

View File

@@ -104,7 +104,9 @@ class ListActivityHelper
->addGroupBy('location.id');
}
public function buildForm(FormBuilderInterface $builder) {}
public function buildForm(FormBuilderInterface $builder)
{
}
public function getAllowedFormattersTypes()
{

View File

@@ -42,13 +42,14 @@ class ActivityTypeFilter implements FilterInterface
public function alterQuery(QueryBuilder $qb, $data)
{
$qb->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM ' . Activity::class . ' act_type_filter_activity
WHERE act_type_filter_activity.activityType IN (:act_type_filter_activity_types) AND act_type_filter_activity.accompanyingPeriod = acp'
)
);
$qb->setParameter('act_type_filter_activity_types', $data['accepted_activitytypes']);
if (!in_array('activity', $qb->getAllAliases(), true)) {
$qb->join(Activity::class, 'activity', Expr\Join::WITH, 'activity.accompanyingPeriod = acp');
}
$clause = $qb->expr()->in('activity.activityType', ':selected_activity_types');
$qb->andWhere($clause);
$qb->setParameter('selected_activity_types', $data['accepted_activitytypes']);
}
public function applyOn()

View File

@@ -22,11 +22,11 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class EmergencyFilter implements FilterInterface
{
private const CHOICES = [
'activity is emergency' => 'true',
'activity is not emergency' => 'false',
'activity is emergency' => true,
'activity is not emergency' => false,
];
private const DEFAULT_CHOICE = 'false';
private const DEFAULT_CHOICE = false;
private TranslatorInterface $translator;

View File

@@ -23,7 +23,8 @@ final readonly class PeriodHavingActivityBetweenDatesFilter implements FilterInt
{
public function __construct(
private RollingDateConverterInterface $rollingDateConverter,
) {}
) {
}
public function getTitle()
{

View File

@@ -47,7 +47,8 @@ final readonly class ActivityACLAwareRepository implements ActivityACLAwareRepos
private EntityManagerInterface $em,
private Security $security,
private RequestStack $requestStack,
) {}
) {
}
/**
* @throws NonUniqueResultException
@@ -321,7 +322,7 @@ final readonly class ActivityACLAwareRepository implements ActivityACLAwareRepos
$counter++;
}
foreach ($person->getAccompanyingPeriodParticipations() as $participation) {
foreach ($person->getAccompanyingPeriodParticipations() as $participation) {
if (!$this->security->isGranted(ActivityVoter::SEE, $participation->getAccompanyingPeriod())) {
continue;
}

View File

@@ -43,7 +43,8 @@ final readonly class ActivityDocumentACLAwareRepository implements ActivityDocum
private CenterResolverManagerInterface $centerResolverManager,
private AuthorizationHelperForCurrentUserInterface $authorizationHelperForCurrentUser,
private Security $security
) {}
) {
}
public function buildFetchQueryActivityDocumentLinkedToPersonFromPersonContext(Person $person, ?DateTimeImmutable $startDate = null, ?DateTimeImmutable $endDate = null, ?string $content = null): FetchQueryInterface
{

View File

@@ -36,7 +36,8 @@ final class AccompanyingPeriodActivityGenericDocProvider implements GenericDocFo
private EntityManagerInterface $em,
private Security $security,
private ActivityDocumentACLAwareRepositoryInterface $activityDocumentACLAwareRepository,
) {}
) {
}
public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, ?DateTimeImmutable $startDate = null, ?DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface
{

View File

@@ -29,7 +29,8 @@ final readonly class PersonActivityGenericDocProvider implements GenericDocForPe
public function __construct(
private Security $security,
private ActivityDocumentACLAwareRepositoryInterface $personActivityDocumentACLAwareRepository,
) {}
) {
}
public function buildFetchQueryForPerson(Person $person, ?DateTimeImmutable $startDate = null, ?DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface
{

View File

@@ -122,4 +122,5 @@ class ActivityDocumentACLAwareRepositoryTest extends KernelTestCase
yield [$person, $scopes, true, null, new \DateTimeImmutable("1 week ago"), "content"];
yield [$person, [], true, new \DateTimeImmutable("1 month ago"), new \DateTimeImmutable("1 week ago"), "content"];
}
}

View File

@@ -13,4 +13,6 @@ namespace Chill\AsideActivityBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class ChillAsideActivityBundle extends Bundle {}
class ChillAsideActivityBundle extends Bundle
{
}

View File

@@ -33,7 +33,6 @@ final class AsideActivityController extends CRUDController
$asideActivity = new AsideActivity();
$asideActivity->setAgent($this->getUser());
$asideActivity->setLocation($this->getUser()->getCurrentLocation());
$duration = $request->query->get('duration', '300');
$duration = DateTime::createFromFormat('U', $duration);

View File

@@ -14,7 +14,6 @@ namespace Chill\AsideActivityBundle\Entity;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Entity\Location;
use DateTimeInterface;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
@@ -61,10 +60,9 @@ class AsideActivity implements TrackCreationInterface, TrackUpdateInterface
private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity=Location::class)
* @ORM\JoinColumn(nullable=true)
* @ORM\Column(type="string", length=100, nullable=true)
*/
private ?Location $location = null;
private $location;
/**
* @ORM\Column(type="text", nullable=true)
@@ -117,7 +115,7 @@ class AsideActivity implements TrackCreationInterface, TrackUpdateInterface
return $this->id;
}
public function getLocation(): ?Location
public function getLocation(): ?string
{
return $this->location;
}
@@ -177,7 +175,7 @@ class AsideActivity implements TrackCreationInterface, TrackUpdateInterface
return $this;
}
public function setLocation(?Location $location): self
public function setLocation(?string $location): self
{
$this->location = $location;

View File

@@ -1,98 +0,0 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\AsideActivityBundle\Export\Aggregator;
use Chill\AsideActivityBundle\Export\Declarations;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\MainBundle\Repository\LocationRepository;
use Closure;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
class ByLocationAggregator implements AggregatorInterface
{
public function __construct(private LocationRepository $locationRepository) {}
/**
* @inheritDoc
*/
public function buildForm(FormBuilderInterface $builder): void
{
// no form
}
/**
* @inheritDoc
*/
public function getFormDefaultData(): array
{
return [];
}
/**
* @inheritDoc
*/
public function getLabels($key, array $values, $data)
{
return function ($value): string {
if ('_header' === $value) {
return 'export.aggregator.Aside activity localisation';
}
if (null === $value || '' === $value || null === $l = $this->locationRepository->find($value)) {
return '';
}
return $l->getName();
};
}
/**
* @inheritDoc
*/
public function getQueryKeys($data): array
{
return ['by_aside_activity_location_aggregator'];
}
/**
* @inheritDoc
*/
public function getTitle(): string
{
return 'export.aggregator.Group by aside activity location';
}
/**
* @inheritDoc
*/
public function addRole(): ?string
{
return null;
}
/**
* @inheritDoc
*/
public function alterQuery(QueryBuilder $qb, $data): void
{
$qb->addSelect('IDENTITY(aside.location) AS by_aside_activity_location_aggregator')
->addGroupBy('by_aside_activity_location_aggregator');
}
/**
* @inheritDoc
*/
public function applyOn(): string
{
return Declarations::ASIDE_ACTIVITY_TYPE;
}
}

View File

@@ -31,7 +31,9 @@ class AvgAsideActivityDuration implements ExportInterface, GroupedExportInterfac
$this->repository = $repository;
}
public function buildForm(FormBuilderInterface $builder) {}
public function buildForm(FormBuilderInterface $builder)
{
}
public function getFormDefaultData(): array
{
return [];

View File

@@ -31,7 +31,9 @@ class CountAsideActivity implements ExportInterface, GroupedExportInterface
$this->repository = $repository;
}
public function buildForm(FormBuilderInterface $builder) {}
public function buildForm(FormBuilderInterface $builder)
{
}
public function getFormDefaultData(): array
{
return [];

View File

@@ -23,7 +23,6 @@ use Chill\MainBundle\Export\Helper\DateTimeHelper;
use Chill\MainBundle\Export\Helper\UserHelper;
use Chill\MainBundle\Export\ListInterface;
use Chill\MainBundle\Repository\CenterRepositoryInterface;
use Chill\MainBundle\Repository\LocationRepository;
use Chill\MainBundle\Repository\ScopeRepositoryInterface;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use DateTimeInterface;
@@ -59,7 +58,6 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
CenterRepositoryInterface $centerRepository,
AsideActivityCategoryRepository $asideActivityCategoryRepository,
CategoryRender $categoryRender,
private LocationRepository $locationRepository,
TranslatableStringHelperInterface $translatableStringHelper
) {
$this->em = $em;
@@ -72,8 +70,9 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
$this->translatableStringHelper = $translatableStringHelper;
}
public function buildForm(FormBuilderInterface $builder) {}
public function buildForm(FormBuilderInterface $builder)
{
}
public function getFormDefaultData(): array
{
return [];
@@ -146,19 +145,6 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
return $this->categoryRender->renderString($c, []);
};
case 'location':
return function ($value) {
if ('_header' === $value) {
return 'export.aside_activity.location';
}
if (null === $value || '' === $value || null === $l = $this->locationRepository->find($value)) {
return '';
}
return $l->getName();
};
case 'main_scope':
return function ($value) {
if ('_header' === $value) {
@@ -205,7 +191,6 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
'date',
'duration',
'note',
'location',
];
}
@@ -241,7 +226,6 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
->addSelect('IDENTITY(aside.type) AS aside_activity_type')
->addSelect('aside.date')
->addSelect('aside.duration')
->addSelect('IDENTITY(aside.location) AS location')
->addSelect('aside.note');
return $qb;

View File

@@ -31,7 +31,9 @@ class SumAsideActivityDuration implements ExportInterface, GroupedExportInterfac
$this->repository = $repository;
}
public function buildForm(FormBuilderInterface $builder) {}
public function buildForm(FormBuilderInterface $builder)
{
}
public function getFormDefaultData(): array
{
return [];

View File

@@ -1,104 +0,0 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\AsideActivityBundle\Export\Filter;
use Chill\AsideActivityBundle\Export\Declarations;
use Chill\MainBundle\Entity\Location;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Form\Type\PickUserLocationType;
use Chill\MainBundle\Repository\LocationRepository;
use Doctrine\ORM\QueryBuilder;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Security;
final readonly class ByLocationFilter implements FilterInterface
{
public function __construct(
private Security $security
) {}
/**
* @inheritDoc
*/
public function getTitle(): string
{
return 'export.filter.Filter by aside activity location';
}
/**
* @inheritDoc
*/
public function buildForm(FormBuilderInterface $builder): void
{
$builder
->add('locations', PickUserLocationType::class);
}
/**
* @inheritDoc
*/
public function getFormDefaultData(): array
{
$user = $this->security->getUser();
if ($user instanceof User) {
return [
'locations' => $user->getCurrentLocation(),
];
}
return [
'locations' => null,
];
}
/**
* @inheritDoc
*/
public function describeAction($data, $format = 'string'): array
{
$locations = $data['locations']->map(fn (Location $l): string => $l->getName());
return ['export.filter.Filtered by aside activity location: only %location%', [
'%location%' => implode(', ', $locations),
]];
}
/**
* @inheritDoc
*/
public function addRole(): ?string
{
return null;
}
/**
* @inheritDoc
*/
public function alterQuery(QueryBuilder $qb, $data): void
{
$clause = $qb->expr()->in('aside.location', ':locations');
$qb->andWhere($clause);
$qb->setParameter('locations', $data['locations']);
}
/**
* @inheritDoc
*/
public function applyOn(): string
{
return Declarations::ASIDE_ACTIVITY_TYPE;
}
}

View File

@@ -13,16 +13,13 @@ namespace Chill\AsideActivityBundle\Form;
use Chill\AsideActivityBundle\Entity\AsideActivity;
use Chill\AsideActivityBundle\Form\Type\PickAsideActivityCategoryType;
use Chill\MainBundle\Entity\Location;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Form\Type\ChillTextareaType;
use Chill\MainBundle\Form\Type\PickUserDynamicType;
use Chill\MainBundle\Form\Type\PickUserLocationType;
use DateInterval;
use DateTime;
use DateTimeImmutable;
use DateTimeZone;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
@@ -80,9 +77,7 @@ final class AsideActivityFormType extends AbstractType
->add('note', ChillTextareaType::class, [
'label' => 'Note',
'required' => false,
])
->add('location', PickUserLocationType::class)
;
]);
foreach (['duration'] as $fieldName) {
$builder->get($fieldName)

View File

@@ -39,9 +39,6 @@
</span>
{% endif %}
</div>
{%- if entity.location.name is defined -%}
<div><i class="fa fa-fw fa-map-marker"></i>{{ entity.location.name }}</div>
{%- endif -%}
</div>
<div class="item-col" style="justify-content: flex-end;">
<div class="box">

View File

@@ -22,13 +22,6 @@
<dt class="inline">{{ 'Created for'|trans }}</dt>
<dd>{{ entity.agent }}</dd>
<dt class="inline">{{ 'Asideactivity location'|trans }}</dt>
{%- if entity.location.name is defined -%}
<dd>{{ entity.location.name }}</dd>
{%- else -%}
<dd><span class="chill-no-data-statement">{{ 'No data given'|trans }}</span></dd>
{%- endif -%}
<h2 class="chill-red">{{ 'Activity data'|trans }}</h2>

View File

@@ -46,27 +46,19 @@ services:
tags:
- { name: chill.export_filter, alias: 'aside_activity_user_filter' }
Chill\AsideActivityBundle\Export\Filter\ByLocationFilter:
tags:
- { name: chill.export_filter, alias: 'aside_activity_location_filter' }
## Aggregators
chill.aside_activity.export.type_aggregator:
class: Chill\AsideActivityBundle\Export\Aggregator\ByActivityTypeAggregator
tags:
- { name: chill.export_aggregator, alias: 'activity_type_aggregator' }
- { name: chill.export_aggregator, alias: activity_type_aggregator }
chill.aside_activity.export.user_job_aggregator:
class: Chill\AsideActivityBundle\Export\Aggregator\ByUserJobAggregator
tags:
- { name: chill.export_aggregator, alias: 'aside_activity_user_job_aggregator' }
- { name: chill.export_aggregator, alias: aside_activity_user_job_aggregator }
chill.aside_activity.export.user_scope_aggregator:
class: Chill\AsideActivityBundle\Export\Aggregator\ByUserScopeAggregator
tags:
- { name: chill.export_aggregator, alias: 'aside_activity_user_scope_aggregator' }
Chill\AsideActivityBundle\Export\Aggregator\ByLocationAggregator:
tags:
- { name: chill.export_aggregator, alias: 'aside_activity_location_aggregator' }
- { name: chill.export_aggregator, alias: aside_activity_user_scope_aggregator }

View File

@@ -1,39 +0,0 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\Migrations\AsideActivity;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20230816112809 extends AbstractMigration
{
public function getDescription(): string
{
return 'Update location attribute in asideactivity';
}
public function down(Schema $schema): void
{
$this->addSql('DROP INDEX chill_asideactivity.IDX_A866DA0E64D218E');
$this->addSql('ALTER TABLE chill_asideactivity.AsideActivity DROP CONSTRAINT FK_A866DA0E64D218E');
$this->addSql('ALTER TABLE chill_asideactivity.AsideActivity DROP location_id');
$this->addSql('ALTER TABLE chill_asideactivity.AsideActivity ADD location VARCHAR(100) DEFAULT NULL');
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_asideactivity.asideactivity ADD location_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE chill_asideactivity.asideactivity DROP location');
$this->addSql('ALTER TABLE chill_asideactivity.asideactivity ADD CONSTRAINT FK_A866DA0E64D218E FOREIGN KEY (location_id) REFERENCES chill_main_location (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_A866DA0E64D218E ON chill_asideactivity.asideactivity (location_id)');
}
}

View File

@@ -26,7 +26,6 @@ Users: Utilisateurs
Emergency: Urgent
by: "Par "
location: Lieu
Asideactivity location: Localisation de l'activité
# Crud
crud:
@@ -183,7 +182,6 @@ export:
duration: Durée
note: Note
id: Identifiant
location: Localisation
Exports of aside activities: Exports des activités annexes
Count aside activities: Nombre d'activités annexes
@@ -204,16 +202,11 @@ export:
Filter by user jobs: Filtrer les activités annexes par métier des utilisateurs
'Filtered aside activities by user scope: only %scopes%': "Filtré par service des utilisateur: uniquement %scopes%"
Filter by user scope: Filtrer les activités annexes par service d'utilisateur
Filter by aside activity location: Filtrer les activités annexes par localisation
'Filtered by aside activity location: only %location%': "Filtré par localisation: uniquement %location%"
aggregator:
Group by aside activity type: Grouper les activités annexes par type d'activité
Aside activity type: Type d'activité annexe
Aggregate by user job: Grouper les activités annexes par métier des utilisateurs
Aggregate by user scope: Grouper les activités annexes par service des utilisateurs
Aside activity location: Localisation des activités annexe
Group by aside activity location: Grouper les activités annexes par localisation
Aside activity localisation: Localisation
# ROLES
CHILL_ASIDE_ACTIVITY_STATS: Statistiques pour les activités annexes

View File

@@ -29,11 +29,11 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class CalendarRangeFilter implements FilterInterface
{
private const CHOICES = [
'Not made within a calendar range' => 'true',
'Made within a calendar range' => 'false',
'Not made within a calendar range' => true,
'Made within a calendar range' => false,
];
private const DEFAULT_CHOICE = 'false';
private const DEFAULT_CHOICE = false;
private TranslatorInterface $translator;

View File

@@ -28,7 +28,8 @@ final readonly class MSUserAbsenceReader implements MSUserAbsenceReaderInterface
private HttpClientInterface $machineHttpClient,
private MapCalendarToUser $mapCalendarToUser,
private ClockInterface $clock,
) {}
) {
}
/**
* @throw UserAbsenceSyncException when the data cannot be reached or is not valid from microsoft
@@ -64,4 +65,5 @@ final readonly class MSUserAbsenceReader implements MSUserAbsenceReaderInterface
default => throw new UserAbsenceSyncException("this status is not documented by Microsoft")
};
}
}

View File

@@ -21,7 +21,8 @@ readonly class MSUserAbsenceSync
private MSUserAbsenceReaderInterface $absenceReader,
private ClockInterface $clock,
private LoggerInterface $logger,
) {}
) {
}
public function syncUserAbsence(User $user): void
{

View File

@@ -48,13 +48,23 @@ class NullRemoteCalendarConnector implements RemoteCalendarConnectorInterface
return [];
}
public function removeCalendar(string $remoteId, array $remoteAttributes, User $user, ?CalendarRange $associatedCalendarRange = null): void {}
public function removeCalendar(string $remoteId, array $remoteAttributes, User $user, ?CalendarRange $associatedCalendarRange = null): void
{
}
public function removeCalendarRange(string $remoteId, array $remoteAttributes, User $user): void {}
public function removeCalendarRange(string $remoteId, array $remoteAttributes, User $user): void
{
}
public function syncCalendar(Calendar $calendar, string $action, ?CalendarRange $previousCalendarRange, ?User $previousMainUser, ?array $oldInvites, ?array $newInvites): void {}
public function syncCalendar(Calendar $calendar, string $action, ?CalendarRange $previousCalendarRange, ?User $previousMainUser, ?array $oldInvites, ?array $newInvites): void
{
}
public function syncCalendarRange(CalendarRange $calendarRange): void {}
public function syncCalendarRange(CalendarRange $calendarRange): void
{
}
public function syncInvite(Invite $invite): void {}
public function syncInvite(Invite $invite): void
{
}
}

View File

@@ -23,4 +23,6 @@ use Symfony\Component\Form\FormBuilderInterface;
* @extends DocGeneratorContextWithPublicFormInterface<Calendar>
* @extends DocGeneratorContextWithAdminFormInterface<Calendar>
*/
interface CalendarContextInterface extends DocGeneratorContextWithPublicFormInterface, DocGeneratorContextWithAdminFormInterface {}
interface CalendarContextInterface extends DocGeneratorContextWithPublicFormInterface, DocGeneratorContextWithAdminFormInterface
{
}

View File

@@ -39,7 +39,8 @@ final readonly class AccompanyingPeriodCalendarGenericDocProvider implements Gen
public function __construct(
private Security $security,
private EntityManagerInterface $em
) {}
) {
}
/**
* @throws MappingException
@@ -189,4 +190,6 @@ final readonly class AccompanyingPeriodCalendarGenericDocProvider implements Gen
return $query;
}
}

View File

@@ -39,7 +39,8 @@ final readonly class PersonCalendarGenericDocProvider implements GenericDocForPe
public function __construct(
private Security $security,
private EntityManagerInterface $em
) {}
) {
}
private function addWhereClausesToQuery(FetchQuery $query, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null): FetchQuery
{

View File

@@ -172,4 +172,5 @@ class MSUserAbsenceReaderTest extends TestCase
"User is absent: absence is always enabled"
];
}
}

View File

@@ -16,7 +16,9 @@ use Symfony\Component\Form\FormBuilderInterface;
class CustomFieldsTitleType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options) {}
public function buildForm(FormBuilderInterface $builder, array $options)
{
}
public function getBlockPrefix()
{

View File

@@ -31,7 +31,8 @@ final readonly class GenericDocForAccompanyingPeriodController
private PaginatorFactory $paginator,
private Security $security,
private EngineInterface $twig,
) {}
) {
}
/**
* @param AccompanyingPeriod $accompanyingPeriod
@@ -93,4 +94,5 @@ final readonly class GenericDocForAccompanyingPeriodController
]
));
}
}

View File

@@ -30,7 +30,8 @@ final readonly class GenericDocForPerson
private PaginatorFactory $paginator,
private Security $security,
private EngineInterface $twig,
) {}
) {
}
/**
* @throws \Doctrine\DBAL\Exception
@@ -90,4 +91,5 @@ final readonly class GenericDocForPerson
]
));
}
}

View File

@@ -54,7 +54,8 @@ class FetchQuery implements FetchQueryInterface
private array $selectIdentifierTypes = [],
private array $selectDateParams = [],
private array $selectDateTypes = [],
) {}
) {
}
public function addJoinClause(string $sql, array $params = [], array $types = []): int
{
@@ -81,6 +82,7 @@ class FetchQuery implements FetchQueryInterface
}
unset($this->wheres[$index], $this->whereParams[$index], $this->whereTypes[$index]);
}
public function removeJoinClause(int $index): void
@@ -90,6 +92,7 @@ class FetchQuery implements FetchQueryInterface
}
unset($this->joins[$index], $this->joinParams[$index], $this->joinTypes[$index]);
}
public function getSelectKeyString(): string

View File

@@ -21,7 +21,8 @@ final readonly class GenericDocDTO
public array $identifiers,
public \DateTimeImmutable $docDate,
public AccompanyingPeriod|Person $linked,
) {}
) {
}
public function getContext(): string
{

View File

@@ -27,4 +27,5 @@ interface GenericDocForAccompanyingPeriodProviderInterface
* Return true if the user is allowed to see some documents for this provider.
*/
public function isAllowedForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod): bool;
}

View File

@@ -32,7 +32,8 @@ final readonly class AccompanyingCourseDocumentGenericDocProvider implements Gen
public function __construct(
private Security $security,
private EntityManagerInterface $entityManager,
) {}
) {
}
public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface
{
@@ -142,4 +143,5 @@ final readonly class AccompanyingCourseDocumentGenericDocProvider implements Gen
return $query;
}
}

View File

@@ -28,7 +28,8 @@ final readonly class PersonDocumentGenericDocProvider implements GenericDocForPe
public function __construct(
private Security $security,
private PersonDocumentACLAwareRepositoryInterface $personDocumentACLAwareRepository,
) {}
) {
}
public function buildFetchQueryForPerson(
Person $person,

View File

@@ -24,7 +24,8 @@ final readonly class AccompanyingCourseDocumentGenericDocRenderer implements Gen
public function __construct(
private AccompanyingCourseDocumentRepository $accompanyingCourseDocumentRepository,
private PersonDocumentRepository $personDocumentRepository,
) {}
) {
}
public function supports(GenericDocDTO $genericDocDTO, $options = []): bool
{

View File

@@ -25,7 +25,8 @@ final readonly class GenericDocExtensionRuntime implements RuntimeExtensionInter
* @var list<GenericDocRendererInterface>
*/
private iterable $renderers,
) {}
) {
}
/**
* @throws RuntimeError
@@ -45,4 +46,5 @@ final readonly class GenericDocExtensionRuntime implements RuntimeExtensionInter
throw new \LogicException("no renderer found");
}
}

View File

@@ -20,4 +20,5 @@ interface GenericDocRendererInterface
public function getTemplate(GenericDocDTO $genericDocDTO, $options = []): string;
public function getTemplateData(GenericDocDTO $genericDocDTO, $options = []): array;
}

View File

@@ -38,7 +38,8 @@ final readonly class PersonDocumentACLAwareRepository implements PersonDocumentA
private CenterResolverManagerInterface $centerResolverManager,
private AuthorizationHelperForCurrentUserInterface $authorizationHelperForCurrentUser,
private Security $security,
) {}
) {
}
public function buildQueryByPerson(Person $person): QueryBuilder
{
@@ -97,6 +98,7 @@ final readonly class PersonDocumentACLAwareRepository implements PersonDocumentA
continue;
}
$orPersonId[] = $participation->getPerson()->getId();
}
if ([] === $orPersonId) {

View File

@@ -54,6 +54,9 @@ class FetchQueryToSqlBuilderTest extends KernelTestCase
);
self::assertEquals(['foo', 'bar_baz', 'baz'], $params);
self::assertEquals([Types::STRING, Types::STRING, Types::STRING], $types);
}
public function testToSqlWithoutWhere(): void
@@ -82,4 +85,5 @@ class FetchQueryToSqlBuilderTest extends KernelTestCase
self::assertEquals([], $params);
self::assertEquals([], $types);
}
}

View File

@@ -142,6 +142,7 @@ class PersonDocumentACLAwareRepositoryTest extends KernelTestCase
yield [$period, new DateTimeImmutable('2 years ago'), new DateTimeImmutable('1 year ago'), null];
yield [$period, null, null, 'test'];
yield [$period, new DateTimeImmutable('2 years ago'), new DateTimeImmutable('1 year ago'), 'test'];
}
public function provideDataBuildFetchQueryForPerson(): iterable
@@ -153,4 +154,5 @@ class PersonDocumentACLAwareRepositoryTest extends KernelTestCase
yield [null, null, 'test'];
yield [new DateTimeImmutable('2 years ago'), new DateTimeImmutable('1 year ago'), 'test'];
}
}

View File

@@ -13,4 +13,6 @@ namespace Chill\EventBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class ChillEventBundle extends Bundle {}
class ChillEventBundle extends Bundle
{
}

View File

@@ -16,4 +16,6 @@ use Doctrine\ORM\EntityRepository;
/**
* Class EventRepository.
*/
class EventRepository extends EntityRepository {}
class EventRepository extends EntityRepository
{
}

View File

@@ -152,7 +152,7 @@ class EventSearch extends AbstractSearch
$orWhere = $qb->expr()->orX();
foreach ($reachableCenters as $center) {
$n = $n + 1;
$n = $n+1;
$circles = $this->authorizationHelper->getReachableScopes(
$this->security->getUser(),
'CHILL_EVENT_SEE',

View File

@@ -13,4 +13,6 @@ namespace Chill\FamilyMembersBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class ChillAMLIFamilyMembersBundle extends Bundle {}
class ChillAMLIFamilyMembersBundle extends Bundle
{
}

View File

@@ -150,7 +150,9 @@ abstract class AbstractCRUDController extends AbstractController
return new $class();
}
protected function customizeQuery(string $action, Request $request, $query): void {}
protected function customizeQuery(string $action, Request $request, $query): void
{
}
protected function getActionConfig(string $action)
{

View File

@@ -242,9 +242,13 @@ class CRUDController extends AbstractController
/**
* Customize the form created by createFormFor.
*/
protected function customizeForm(string $action, FormInterface $form) {}
protected function customizeForm(string $action, FormInterface $form)
{
}
protected function customizeQuery(string $action, Request $request, $query): void {}
protected function customizeQuery(string $action, Request $request, $query): void
{
}
/**
* @param $id
@@ -923,7 +927,9 @@ class CRUDController extends AbstractController
}
}
protected function onFormValid(string $action, object $entity, FormInterface $form, Request $request) {}
protected function onFormValid(string $action, object $entity, FormInterface $form, Request $request)
{
}
/**
* @param $action
@@ -946,55 +952,77 @@ class CRUDController extends AbstractController
/**
* @param $entity
*/
protected function onPostFlush(string $action, $entity, FormInterface $form, Request $request) {}
protected function onPostFlush(string $action, $entity, FormInterface $form, Request $request)
{
}
/**
* method used by indexAction.
*
* @param mixed $query
*/
protected function onPostIndexBuildQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator, $query) {}
protected function onPostIndexBuildQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator, $query)
{
}
/**
* method used by indexAction.
*
* @param mixed $entities
*/
protected function onPostIndexFetchQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator, $entities) {}
protected function onPostIndexFetchQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator, $entities)
{
}
/**
* @param $entity
*/
protected function onPostPersist(string $action, $entity, FormInterface $form, Request $request) {}
protected function onPostPersist(string $action, $entity, FormInterface $form, Request $request)
{
}
/**
* @param $entity
*/
protected function onPostRemove(string $action, $entity, FormInterface $form, Request $request) {}
protected function onPostRemove(string $action, $entity, FormInterface $form, Request $request)
{
}
protected function onPreDelete(string $action, Request $request) {}
protected function onPreDelete(string $action, Request $request)
{
}
/**
* @param $entity
*/
protected function onPreFlush(string $action, $entity, FormInterface $form, Request $request) {}
protected function onPreFlush(string $action, $entity, FormInterface $form, Request $request)
{
}
protected function onPreIndex(string $action, Request $request) {}
protected function onPreIndex(string $action, Request $request)
{
}
/**
* method used by indexAction.
*/
protected function onPreIndexBuildQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator) {}
protected function onPreIndexBuildQuery(string $action, Request $request, int $totalItems, PaginatorInterface $paginator)
{
}
/**
* @param $entity
*/
protected function onPrePersist(string $action, $entity, FormInterface $form, Request $request) {}
protected function onPrePersist(string $action, $entity, FormInterface $form, Request $request)
{
}
/**
* @param $entity
*/
protected function onPreRemove(string $action, $entity, FormInterface $form, Request $request) {}
protected function onPreRemove(string $action, $entity, FormInterface $form, Request $request)
{
}
/**
* Add ordering fields in the query build by self::queryEntities.

View File

@@ -16,4 +16,6 @@ use Symfony\Component\Form\AbstractType;
/**
* Class CRUDDeleteEntityForm.
*/
class CRUDDeleteEntityForm extends AbstractType {}
class CRUDDeleteEntityForm extends AbstractType
{
}

View File

@@ -213,8 +213,14 @@ class LoadPostalCodesCommand extends Command
}
}
class ExistingPostalCodeException extends Exception {}
class ExistingPostalCodeException extends Exception
{
}
class CountryCodeNotFoundException extends Exception {}
class CountryCodeNotFoundException extends Exception
{
}
class PostalCodeNotValidException extends Exception {}
class PostalCodeNotValidException extends Exception
{
}

View File

@@ -11,22 +11,176 @@ declare(strict_types=1);
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Form\CenterType;
use Chill\MainBundle\Pagination\PaginatorInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
/**
* Class CenterController.
*/
class CenterController extends CRUDController
class CenterController extends AbstractController
{
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
/**
* Creates a new Center entity.
*/
public function createAction(Request $request)
{
$query->addOrderBy('e.name', 'ASC');
$center = new Center();
$form = $this->createCreateForm($center);
$form->handleRequest($request);
return parent::orderQuery($action, $query, $request, $paginator);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($center);
$em->flush();
return $this->redirect($this->generateUrl('admin_center'));
}
return $this->render('@ChillMain/Center/new.html.twig', [
'entity' => $center,
'form' => $form->createView(),
]);
}
/**
* Displays a form to edit an existing Center entity.
*
* @param mixed $id
*/
public function editAction($id)
{
$em = $this->getDoctrine()->getManager();
$center = $em->getRepository(\Chill\MainBundle\Entity\Center::class)->find($id);
if (!$center) {
throw $this->createNotFoundException('Unable to find Center entity.');
}
$editForm = $this->createEditForm($center);
return $this->render('@ChillMain/Center/edit.html.twig', [
'entity' => $center,
'edit_form' => $editForm->createView(),
]);
}
/**
* Lists all Center entities.
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$entities = $em->getRepository(\Chill\MainBundle\Entity\Center::class)->findAll();
return $this->render('@ChillMain/Center/index.html.twig', [
'entities' => $entities,
]);
}
/**
* Displays a form to create a new Center entity.
*/
public function newAction()
{
$center = new Center();
$form = $this->createCreateForm($center);
return $this->render('@ChillMain/Center/new.html.twig', [
'entity' => $center,
'form' => $form->createView(),
]);
}
/**
* Finds and displays a Center entity.
*
* @param mixed $id
*/
public function showAction($id)
{
$em = $this->getDoctrine()->getManager();
$center = $em->getRepository(\Chill\MainBundle\Entity\Center::class)->find($id);
if (!$center) {
throw $this->createNotFoundException('Unable to find Center entity.');
}
return $this->render('@ChillMain/Center/show.html.twig', [
'entity' => $center,
]);
}
/**
* Edits an existing Center entity.
*
* @param mixed $id
*/
public function updateAction(Request $request, $id)
{
$em = $this->getDoctrine()->getManager();
$center = $em->getRepository(\Chill\MainBundle\Entity\Center::class)->find($id);
if (!$center) {
throw $this->createNotFoundException('Unable to find Center entity.');
}
$editForm = $this->createEditForm($center);
$editForm->handleRequest($request);
if ($editForm->isValid()) {
$em->flush();
return $this->redirect($this->generateUrl('admin_center_edit', ['id' => $id]));
}
return $this->render('@ChillMain/Center/edit.html.twig', [
'entity' => $center,
'edit_form' => $editForm->createView(),
]);
}
/**
* Creates a form to create a Center entity.
*
* @param Center $center The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createCreateForm(Center $center)
{
$form = $this->createForm(CenterType::class, $center, [
'action' => $this->generateUrl('admin_center_create'),
'method' => 'POST',
]);
$form->add('submit', SubmitType::class, ['label' => 'Create']);
return $form;
}
/**
* Creates a form to edit a Center entity.
*
* @param Center $center The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createEditForm(Center $center)
{
$form = $this->createForm(CenterType::class, $center, [
'action' => $this->generateUrl('admin_center_update', ['id' => $center->getId()]),
'method' => 'PUT',
]);
$form->add('submit', SubmitType::class, ['label' => 'Update']);
return $form;
}
}

View File

@@ -13,4 +13,6 @@ namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;
class LocationTypeController extends CRUDController {}
class LocationTypeController extends CRUDController
{
}

View File

@@ -44,5 +44,7 @@ class LoginController extends AbstractController
]);
}
public function LoginCheckAction(Request $request) {}
public function LoginCheckAction(Request $request)
{
}
}

View File

@@ -50,7 +50,8 @@ final class PermissionsGroupController extends AbstractController
private readonly EntityManagerInterface $em,
private readonly PermissionsGroupRepository $permissionsGroupRepository,
private readonly RoleScopeRepository $roleScopeRepository,
) {}
) {
}
/**
*/

View File

@@ -27,7 +27,8 @@ final readonly class UserExportController
private UserRepositoryInterface $userRepository,
private Security $security,
private TranslatorInterface $translator,
) {}
) {
}
/**
* @throws \League\Csv\CannotInsertRecord

View File

@@ -88,6 +88,7 @@ class CronManager implements CronManagerInterface
foreach ($orderedJobs as $job) {
if ($job->canRun($lasts[$job->getKey()] ?? null)) {
if (array_key_exists($job->getKey(), $lasts)) {
$executionData = $lasts[$job->getKey()]->getLastExecutionData();
$this->entityManager

View File

@@ -12,7 +12,6 @@ declare(strict_types=1);
namespace Chill\MainBundle\DependencyInjection;
use Chill\MainBundle\Controller\AddressApiController;
use Chill\MainBundle\Controller\CenterController;
use Chill\MainBundle\Controller\CivilityApiController;
use Chill\MainBundle\Controller\CivilityController;
use Chill\MainBundle\Controller\CountryController;
@@ -45,7 +44,6 @@ use Chill\MainBundle\Doctrine\DQL\Unaccent;
use Chill\MainBundle\Doctrine\ORM\Hydration\FlatHierarchyEntityHydrator;
use Chill\MainBundle\Doctrine\Type\NativeDateIntervalType;
use Chill\MainBundle\Doctrine\Type\PointType;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\Civility;
use Chill\MainBundle\Entity\Country;
use Chill\MainBundle\Entity\GeographicalUnitLayer;
@@ -55,7 +53,6 @@ use Chill\MainBundle\Entity\LocationType;
use Chill\MainBundle\Entity\Regroupment;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Entity\UserJob;
use Chill\MainBundle\Form\CenterType;
use Chill\MainBundle\Form\CivilityType;
use Chill\MainBundle\Form\CountryType;
use Chill\MainBundle\Form\LanguageType;
@@ -527,27 +524,6 @@ class ChillMainExtension extends Extension implements
],
],
],
[
'class' => Center::class,
'name' => 'center',
'base_path' => '/admin/center',
'form_class' => CenterType::class,
'controller' => CenterController::class,
'actions' => [
'index' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/Admin/Center/index.html.twig',
],
'new' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/Admin/Center/new.html.twig',
],
'edit' => [
'role' => 'ROLE_ADMIN',
'template' => '@ChillMain/Admin/Center/edit.html.twig',
],
],
],
],
'apis' => [
[

View File

@@ -48,11 +48,6 @@ class Center implements HasCenterInterface
*/
private string $name = '';
/**
* @ORM\Column(type="boolean")
*/
private bool $isActive = true;
/**
* @var Collection<Regroupment>
* @ORM\ManyToMany(targetEntity=Regroupment::class, mappedBy="centers")
@@ -126,11 +121,6 @@ class Center implements HasCenterInterface
return $this->regroupments;
}
public function getIsActive(): bool
{
return $this->isActive;
}
/**
* @param $name
*
@@ -142,11 +132,4 @@ class Center implements HasCenterInterface
return $this;
}
public function setIsActive(bool $isActive): self
{
$this->isActive = $isActive;
return $this;
}
}

View File

@@ -175,7 +175,9 @@ class User implements UserInterface
return $this;
}
public function eraseCredentials() {}
public function eraseCredentials()
{
}
public function getAbsenceStart(): ?DateTimeImmutable
{

View File

@@ -26,7 +26,8 @@ final readonly class ExportFormHelper
private AuthorizationHelperForCurrentUserInterface $authorizationHelper,
private ExportManager $exportManager,
private FormFactoryInterface $formFactory,
) {}
) {
}
public function getDefaultData(string $step, ExportInterface|DirectExportInterface $export, array $options = []): array
{

View File

@@ -20,4 +20,6 @@ namespace Chill\MainBundle\Export;
*
* When used, the `ExportManager` will not handle aggregator for this class.
*/
interface ListInterface extends ExportInterface {}
interface ListInterface extends ExportInterface
{
}

View File

@@ -11,10 +11,7 @@ declare(strict_types=1);
namespace Chill\MainBundle\Form;
use Chill\MainBundle\Entity\Center;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -24,18 +21,24 @@ class CenterType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', TextType::class, [
'label' => 'Nom',
])
->add('isActive', CheckboxType::class, [
'label' => 'Actif ?',
'required' => false,
]);
->add('name', TextType::class);
}
/**
* @param OptionsResolverInterface $resolver
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver
->setDefault('class', Center::class);
$resolver->setDefaults([
'data_class' => \Chill\MainBundle\Entity\Center::class,
]);
}
/**
* @return string
*/
public function getBlockPrefix()
{
return 'chill_mainbundle_center';
}
}

View File

@@ -19,7 +19,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class AggregatorType extends AbstractType
{
public function __construct() {}
public function __construct()
{
}
public function buildForm(FormBuilderInterface $builder, array $options)
{

View File

@@ -21,7 +21,9 @@ class FilterType extends AbstractType
{
public const ENABLED_FIELD = 'enabled';
public function __construct() {}
public function __construct()
{
}
public function buildForm(FormBuilderInterface $builder, array $options)
{

View File

@@ -57,14 +57,12 @@ final class PickCenterType extends AbstractType
$export->requiredRole()
);
$centersActive = array_filter($centers, fn (Center $c) => $c->getIsActive());
// order alphabetically
usort($centersActive, fn (Center $a, Center $b) => $a->getCenter() <=> $b->getName());
usort($centers, fn (Center $a, Center $b) => $a->getCenter() <=> $b->getName());
$builder->add('center', EntityType::class, [
'class' => Center::class,
'choices' => $centersActive,
'choices' => $centers,
'label' => 'center',
'multiple' => true,
'expanded' => true,

View File

@@ -122,6 +122,7 @@ final class FilterOrderType extends \Symfony\Component\Form\AbstractType
foreach ($helper->getUserPickers() as $name => [
'label' => $label, 'options' => $opts
]) {
$userPickersBuilder->add(
$name,
PickUserDynamicType::class,
@@ -135,6 +136,7 @@ final class FilterOrderType extends \Symfony\Component\Form\AbstractType
$builder->add($userPickersBuilder);
}
}
public static function buildCheckboxChoices(array $choices, array $trans = []): array

View File

@@ -61,8 +61,6 @@ class PickCenterType extends AbstractType
{
$centers = $this->getReachableCenters($options['role'], $options['scopes']);
$centersActive = array_filter($centers, fn (Center $c) => $c->getIsActive());
if (count($centers) <= 1) {
$multiple = $options['choice_options']['multiple'] ?? false;
$builder->add('center', HiddenType::class);
@@ -77,7 +75,7 @@ class PickCenterType extends AbstractType
$options['choice_options'],
[
'class' => Center::class,
'choices' => $centersActive,
'choices' => $centers,
]
)
);

View File

@@ -67,7 +67,6 @@ class UserType extends AbstractType
'class' => Center::class,
'query_builder' => static function (EntityRepository $er) {
$qb = $er->createQueryBuilder('c');
$qb->where($qb->expr()->eq('c.isActive', 'true'));
$qb->addOrderBy('c.name');
return $qb;

View File

@@ -40,18 +40,13 @@ class NotificationMailer
public function postPersistComment(NotificationComment $comment, PostPersistEventArgs $eventArgs): void
{
$dests = [$comment->getNotification()->getSender(), ...$comment->getNotification()->getAddressees()->toArray()];
$uniqueDests = [];
foreach ($dests as $dest) {
// avoid duplication
if (in_array(spl_object_hash($dest), $uniqueDests, true)) {
continue;
}
$uniqueDests[] = spl_object_hash($dest);
// do not send if the sender does not have any email, nor to the creator of the comment
if (null === $dest->getEmail() || $comment->getCreatedBy() === $dest) {
foreach (
array_merge(
$comment->getNotification()->getAddressees()->toArray(),
[$comment->getNotification()->getSender()]
) as $dest
) {
if (null === $dest->getEmail() || $comment->getCreatedBy() !== $dest) {
continue;
}
$email = new TemplatedEmail();

View File

@@ -13,4 +13,6 @@ namespace Chill\MainBundle\Notification\Exception;
use RuntimeException;
class NotificationHandlerNotFound extends RuntimeException {}
class NotificationHandlerNotFound extends RuntimeException
{
}

View File

@@ -16,4 +16,6 @@ use Redis;
/**
* Redis client configured by chill main.
*/
class ChillRedis extends Redis {}
class ChillRedis extends Redis
{
}

View File

@@ -29,12 +29,9 @@ final class CenterRepository implements CenterRepositoryInterface
return $this->repository->find($id, $lockMode, $lockVersion);
}
/**
* @return Center[]
*/
public function findActive(): array
{
return $this->repository->findBy(['isActive' => true], ['name' => 'ASC']);
return $this->findAll();
}
/**

View File

@@ -1,11 +0,0 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock admin_content %}

View File

@@ -1,39 +0,0 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block table_entities_thead_tr %}
<th>{{ 'Label'|trans }}</th>
<th>{{ 'Active'|trans }}</th>
<th>&nbsp;</th>
{% endblock %}
{% block table_entities_tbody %}
{% for entity in entities %}
<tr>
<td>{{ entity.name }}</td>
<td style="text-align:center">
{% if entity.isActive %}
<i class="fa fa-check-square-o"></i>
{% else %}
<i class="fa fa-square-o"></i>
{% endif %}
</td>
<td>
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_crud_center_edit', { 'id': entity.id }) }}" class="btn btn-edit"></a>
</li>
</ul>
</td>
</tr>
{% endfor %}
{% endblock %}
{% block actions_before %}
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
{% endblock %}
{% endembed %}
{% endblock %}

View File

@@ -1,11 +0,0 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock admin_content %}

View File

@@ -0,0 +1,23 @@
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block title %}{{ 'Center edit'|trans }}{% endblock %}
{% block admin_content -%}
<h1>{{ 'Center edit'|trans }}</h1>
{{ form_start(edit_form) }}
{{ form_row(edit_form.name) }}
<ul class="record_actions sticky-form-buttons">
<li class='cancel'>
<a href="{{ path('admin_center') }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
<li>
{{ form_widget(edit_form.submit, { 'attr' : { 'class' : 'btn btn-update' }}) }}
</li>
</ul>
{{ form_end(edit_form) }}
{% endblock %}

View File

@@ -0,0 +1,50 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}{{ 'Center list'|trans }}{% endblock %}
{% block admin_content -%}
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block index_header %}
<h1>{{ 'Center list'|trans }}</h1>
{% endblock %}
{% block filter_order %}{% endblock %}
{% block table_entities_thead_tr %}
<th>id</th>
<th>{{ 'Name'|trans }}</th>
<th>{{ 'Actions'|trans }}</th>
{% endblock %}
{% block table_entities_tbody %}
{% for entity in entities %}
<tr>
<td>{{ entity.id }}</td>
<td>{{ entity.name }}</td>
<td>
<ul class="record_actions">
<li>
<a href="{{ path('admin_center_edit', { 'id': entity.id }) }}" class="btn btn-edit">{{ 'edit'|trans }}</a>
</li>
</ul>
</td>
</tr>
{% endfor %}
{% endblock %}
{% block pagination %}{% endblock %}
{% block list_actions %}
<ul class="record_actions sticky-form-buttons">
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
<li>
<a href="{{ path('admin_center_new') }}" class="btn btn-create">{{ 'Create a new center'|trans }}</a>
</li>
</ul>
{% endblock list_actions %}
{% endembed %}
{% endblock %}

View File

@@ -0,0 +1,23 @@
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
{% block title %}{{ 'Center creation'|trans }}{% endblock %}
{% block admin_content -%}
<h1>{{ 'Center creation'|trans }}</h1>
{{ form_start(form) }}
{{ form_row(form.name) }}
<ul class="record_actions sticky-form-buttons">
<li class='cancel'>
<a href="{{ path('admin_center') }}" class="btn btn-cancel">
{{ 'Back to the list'|trans }}
</a>
</li>
<li>
{{ form_widget(form.submit, { 'attr' : { 'class' : 'btn btn-save' }}) }}
</li>
</ul>
{{ form_end(form) }}
{% endblock %}

View File

@@ -49,7 +49,7 @@ class AdminUserMenuBuilder implements LocalMenuBuilderInterface
]);
$menu->addChild('Center list', [
'route' => 'chill_crud_center_index',
'route' => 'admin_center',
])->setExtras(['order' => 1010]);
$menu->addChild('Regroupements des centres', [

View File

@@ -13,4 +13,6 @@ namespace Chill\MainBundle\Search;
use Exception;
class ParsingException extends Exception {}
class ParsingException extends Exception
{
}

View File

@@ -24,4 +24,6 @@ use const E_USER_DEPRECATED;
*
* This abstract Voter provide generic methods to handle object specific to Chill
*/
abstract class AbstractChillVoter extends Voter implements ChillVoterInterface {}
abstract class AbstractChillVoter extends Voter implements ChillVoterInterface
{
}

Some files were not shown because too many files have changed in this diff Show More