2424 Commits

Author SHA1 Message Date
2ed42e1a2c
Fix cs with php-cs-fier version 3.49 2024-02-08 21:12:27 +01:00
aa0cadfa84
Add conflict resolution for generated API + add test
Implemented additional code to handle version conflicts when editing accompanying period work. By keeping track of the current version and returning an HTTP conflict response when it doesn't match with the provided entity version, users are properly alerted to update their entity before continuing. Furthermore, adjusted BadRequestHttpException to match correct arguments order and introduced entity version as query parameter for the URL.

ensure kernel is shutdown after generating data
2024-02-08 14:33:30 +01:00
9b9c2774ad
Allow Pick*Type to submit the form when selection an entity, and apply inside Event 2024-02-08 12:59:50 +01:00
e902b6d409
Create a page which list events 2024-02-08 12:59:50 +01:00
cef218fed5
Add interface for pagination 2024-02-08 12:59:47 +01:00
f11f7498d7
Add new option "as_id" to Pick*DynamicType
This option will make the app return a single id of the entity in data, and not the entity json.
2024-02-08 12:54:44 +01:00
3bb911b4d0
Update version within PUT request
Try to add api logic

check for version being the same instead of smaller

implementing optimistic locking and displaying correct message in frontend

rector fixes

adjust violation message and add translation in translation.yaml

add translator in apiController
2024-02-08 12:09:51 +01:00
2b968b9a5b order centers dropdown alphabetically 2024-02-08 11:21:33 +01:00
32ae2f8f0d
Add a separate method for onPersist, use same private resetCache method 2024-02-07 13:55:31 +01:00
15f8432ce0
Use PostUpdateEventArgs typing instead of PostPersistEventArgs 2024-02-07 13:55:29 +01:00
036fe8d6f8
upgrade php-cs 3.49 2024-02-07 10:43:53 +01:00
27ce322690
upgrade php-cs-fixer to 3.47.0 2024-01-22 12:14:39 +01:00
3c8e59e088 php cs fixes after updating php cs fixer 2024-01-10 10:31:25 +01:00
825cd127d1
update php-cs-fixer and rector + fix rules 2024-01-09 13:50:45 +01:00
a63b40fb6c
use service subscriber injection to inject manager registry 2024-01-09 13:48:14 +01:00
5703fd0046
Refactor code to directly use Doctrine's ManagerRegistry
Replaced most of the invocations of getDoctrine()->getManager() with ManagerRegistry->getManager(), and added ManagerRegistry injection to controllers where needed. This is part of an ongoing effort to improve code clarity, and avoid unnecessary method chaining in various parts of the codebase.
2023-12-16 19:09:34 +01:00
655dc02538
CRUDRoutesLoader: use the syntax controller::method instead of the deprecated controller:method 2023-12-14 23:57:20 +01:00
1098bafd3d
Replaced the deprecated 'self::$container->get' with 'self::getContainer()->get' using rector
This change is made to comply with the new Symfony standards and to avoid deprecation warnings for future versions. The update touches various functionalities, including retrieving EntityManagerInterface instance and various service classes within the test files.
2023-12-14 23:36:56 +01:00
4a99480f50
fixup! Fix some tests 2023-12-14 23:22:48 +01:00
312eb5ec7c
Refactor parseDate function signature in AbstractSearch
Removed unnecessary comments and added type hinting to the function parseDate in the AbstractSearch class. Any string passed to this function will now explicitly be expected as a string data type, increasing code robustness and easing debugging process.
2023-12-14 23:05:36 +01:00
2dd1b7c943
Fix some tests 2023-12-14 23:05:35 +01:00
7ba3435c41
Refactor PrepareClientTrait to use the loginUser method 2023-12-14 22:56:50 +01:00
912f7d3211
remove some deprecations 2023-12-14 14:09:57 +01:00
da997badd9
Fix phpstan issues 2023-12-12 22:43:44 +01:00
af663cf27c
Create the helper ChillSecurity
En symfony 5.4 le typage a été vraiment amélioré, et phpstan peut détecter plus d'erreur potentielles.

Mais le problème est que Symfony "type" les `User` avec son propre `Symfony\Component\Security\Core\User\UserInterface` alors qu'on a besoin de `Chill\MainBundle\Entity\User`.

Imaginons qu'on a ceci:

```php

namespace Chill\Bundle\Service;

final readonly class SomeService
{
    public function myMethod(\Chill\MainBundle\Entity\User $user): void
    {
        // ...
    }
}
```

Quand on l'appelle dans un contrôleur ou dans un service:

```php

namespace Chill\Bundle\Service;

use Symfony\Component\Security\Core\Security;

final readonly OtherService
{
    public function __construct(private Security $security, private SomeService $service) {}

    public function __invoke(): void
    {
        $this->service->myMethod($this->security->getUser());
    }
}
```

PHPstan va se plaindre:

```
Parameter #1 $user of method SomeService::myMethod() expects Chill\MainBundle\Entity\User, Symfony\Component\Security\Core\User\UserInterface|null given.
```

Du coup, j'ai créé ce service:

```php
<?php

namespace Chill\MainBundle\Security;

use Chill\MainBundle\Entity\User;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Security\Core\Security;

/**
 * Security helper for Chill user
 *
 * Provides security-related functionality such as user retrieval, authorization checks,
 * and token retrieval, in a context where only an authenticated @see{User::class} is expected.
 *
 */
final readonly class ChillSecurity implements AuthorizationCheckerInterface
{

    public function hasUser(): bool
    {
        // implementation detail not shown here
    }

    public function getUser(): User
    {
        // implementation detail not shown here
    }

    public function isGranted($attribute, $subject = null): bool
    {
        // implementation detail not shown here
    }

    public function getToken(): ?TokenInterface
    {
        // implementation detail not shown here
    }
}
```

Et maintenant, on peut faire:

```php

namespace Chill\Bundle\Service;

use Chill\MainBundle\Security\ChillSecurity;

final readonly OtherService
{
    public function __construct(private ChillSecurity $security, private SomeService $service) {}

    public function __invoke(): void
    {
        $this->service->myMethod($this->security->getUser());
    }
}
```

Et tout va bien se passer.

Ca sera dans la version de chill qui fait passer à symfony 5.4.
2023-12-12 22:43:24 +01:00
f35f5f0876
fixup! fix typo in classname (Phonenumber => PhoneNumber) 2023-12-12 17:19:28 +01:00
e2a37fd80b
fix typo in classname (Phonenumber => PhoneNumber) 2023-12-12 17:12:01 +01:00
f68deca992
Fix icu message 2023-12-12 16:13:58 +01:00
2f8de4bf01
Upgrade recipes: symfony/security-bundle 2023-12-12 16:08:46 +01:00
c6bb7b1d98
Rector rules: apply rules for 5.0 types 2023-12-12 16:08:46 +01:00
f424c5464f
Fix issues with new version of rector 2023-12-04 16:46:48 +01:00
673518e0eb Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles 2023-11-30 12:15:47 +01:00
4700a0fef7 update URL for postal code FR import 2023-11-30 12:15:22 +01:00
fffc4a9c33
Fix error on listEvaluation
- force default calcDate
- Export / UserHelper: handle case when a single user is given, when we expect more than one user
2023-11-29 22:22:06 +01:00
be57c96a2f Add phonenumber to user 2023-11-16 15:12:12 +00:00
d8fa743bc9
Export: fix loading of form for "filter action by type, goal and result" 2023-11-16 10:57:59 +01:00
eaa40d6725
DX: remove some unnecessary console.log 2023-11-16 10:57:32 +01:00
e9df26c2f7
Export: add clauses on the social work start date and end date within the filter "Filter accompanying period by accompanying period work"' 2023-11-15 13:25:08 +01:00
86e659edd4
DX: replace some string by constants 2023-11-14 21:17:09 +01:00
83fe3ec3fc
Export: add a "filter activity by creator job" filter 2023-11-07 16:06:22 +01:00
c6deb21606 replace old method of getting translator with injection of translatorInterface 2023-10-26 15:20:19 +02:00
2c50f484f0
Fix export controller when generating an export without any data in session 2023-10-24 20:46:23 +02:00
617d09ab8a Merge branch '179-remove-filter-by-center-in-exports' into 'master'
Resolve "Export: permettre de ne pas filtrer les résultats par centre"

Closes #179

See merge request Chill-Projet/chill-bundles!599
2023-10-24 13:18:03 +00:00
4375ecf49a
[export controller] skip the page "select a center" when the configuration value of filter_stats_by_center is set to false 2023-10-19 17:43:32 +02:00
a6e930958b
[export] create a parameter that will force to skip the filtering by center (ACL) when generating an export 2023-10-19 17:19:28 +02:00
5f805626f7
[export] sort filters and aggregators by title 2023-10-19 14:39:22 +02:00
981dc6a959
[export] add a filter and aggregator on accompanying periods: group by activity type (accompanying course having at least one activity from this type) 2023-10-19 10:33:56 +02:00
a4edb34668
[export] add a filter and aggregator on accompanying period work: group/filter by handling third party 2023-10-19 10:33:55 +02:00
bc2041cbdd
apply more cs rules for php-cs 2023-10-17 13:27:03 +02:00
c9cfe4c7e9
DX: mark some functions as pure 2023-10-17 10:43:12 +02:00