mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-06 13:29:43 +00:00
Compare commits
10 Commits
v4.5.1
...
405-aside-
Author | SHA1 | Date | |
---|---|---|---|
ac6336d197 | |||
a46b301e44 | |||
05f0443011 | |||
7f8d8f891e | |||
ddb932a4fa | |||
3a02f15bcd | |||
bc2fbee5c6 | |||
ebd10ca522 | |||
d3a31be412
|
|||
d159a82f88
|
6
.changes/unreleased/Fixed-20251003-224044.yaml
Normal file
6
.changes/unreleased/Fixed-20251003-224044.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: Fixed
|
||||
body: Fix the rendering of list of StoredObjectVersions, where there are kept version (before converting to pdf) and intermediate versions deleted
|
||||
time: 2025-10-03T22:40:44.685474863+02:00
|
||||
custom:
|
||||
Issue: ""
|
||||
SchemaChange: No schema change
|
6
.changes/unreleased/Fixed-20251006-121315.yaml
Normal file
6
.changes/unreleased/Fixed-20251006-121315.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: Fixed
|
||||
body: 'Notification: fix editing of sent notification by removing form.addressesEmails, a field that no longer exists'
|
||||
time: 2025-10-06T12:13:15.45905994+02:00
|
||||
custom:
|
||||
Issue: "434"
|
||||
SchemaChange: No schema change
|
@@ -120,3 +120,6 @@ chill_activity:
|
||||
-
|
||||
label: '5 hours'
|
||||
seconds: 18000
|
||||
|
||||
chill_aside_activity:
|
||||
show_concerned_persons_count: true
|
||||
|
@@ -25,6 +25,7 @@ final class ChillAsideActivityExtension extends Extension implements PrependExte
|
||||
$config = $this->processConfiguration($configuration, $configs);
|
||||
|
||||
$container->setParameter('chill_aside_activity.form.time_duration', $config['form']['time_duration']);
|
||||
$container->setParameter('chill_aside_activity.show_concerned_persons_count', $config['show_concerned_persons_count']);
|
||||
|
||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config'));
|
||||
$loader->load('services.yaml');
|
||||
|
@@ -141,6 +141,11 @@ class Configuration implements ConfigurationInterface
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->booleanNode('show_concerned_persons_count')
|
||||
->defaultTrue()
|
||||
->info('Show the concerned persons count field in aside activity forms and views')
|
||||
->end()
|
||||
->end();
|
||||
|
||||
return $treeBuilder;
|
||||
|
@@ -62,6 +62,10 @@ class AsideActivity implements TrackCreationInterface, TrackUpdateInterface
|
||||
#[ORM\ManyToOne(targetEntity: User::class)]
|
||||
private User $updatedBy;
|
||||
|
||||
#[Assert\GreaterThanOrEqual(0)]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: true)]
|
||||
private ?int $concernedPersonsCount = null;
|
||||
|
||||
public function getAgent(): ?User
|
||||
{
|
||||
return $this->agent;
|
||||
@@ -186,4 +190,16 @@ class AsideActivity implements TrackCreationInterface, TrackUpdateInterface
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getConcernedPersonsCount(): ?int
|
||||
{
|
||||
return $this->concernedPersonsCount;
|
||||
}
|
||||
|
||||
public function setConcernedPersonsCount(?int $concernedPersonsCount): self
|
||||
{
|
||||
$this->concernedPersonsCount = $concernedPersonsCount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,86 @@
|
||||
<?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 Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class ByConcernedPersonsCountAggregator implements AggregatorInterface
|
||||
{
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||
{
|
||||
$qb->addSelect('aside.concernedPersonsCount AS by_concerned_persons_count_aggregator')
|
||||
->addGroupBy('by_concerned_persons_count_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ASIDE_ACTIVITY_TYPE;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder): void
|
||||
{
|
||||
// No form needed
|
||||
}
|
||||
|
||||
public function getNormalizationVersion(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function normalizeFormData(array $formData): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data): callable
|
||||
{
|
||||
return function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
return 'export.aggregator.Concerned persons count';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return 'export.aggregator.No concerned persons count specified';
|
||||
}
|
||||
|
||||
return (string) $value;
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['by_concerned_persons_count_aggregator'];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'export.aggregator.Group by concerned persons count';
|
||||
}
|
||||
}
|
@@ -0,0 +1,116 @@
|
||||
<?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\Export;
|
||||
|
||||
use Chill\AsideActivityBundle\Export\Declarations;
|
||||
use Chill\AsideActivityBundle\Repository\AsideActivityRepository;
|
||||
use Chill\AsideActivityBundle\Security\AsideActivityVoter;
|
||||
use Chill\MainBundle\Export\ExportInterface;
|
||||
use Chill\MainBundle\Export\FormatterInterface;
|
||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
use Doctrine\ORM\Query;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class SumConcernedPersonsCountAsideActivity implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
public function __construct(private readonly AsideActivityRepository $repository) {}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder) {}
|
||||
|
||||
public function getNormalizationVersion(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function normalizeFormData(array $formData): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes(): array
|
||||
{
|
||||
return [FormatterInterface::TYPE_TABULAR];
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'export.Sum concerned persons count for aside activities';
|
||||
}
|
||||
|
||||
public function getGroup(): string
|
||||
{
|
||||
return 'export.Exports of aside activities';
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
if ('export_sum_concerned_persons_count' !== $key) {
|
||||
throw new \LogicException("the key {$key} is not used by this export");
|
||||
}
|
||||
|
||||
$labels = array_combine($values, $values);
|
||||
$labels['_header'] = $this->getTitle();
|
||||
|
||||
return static fn ($value) => $labels[$value];
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['export_sum_concerned_persons_count'];
|
||||
}
|
||||
|
||||
public function getResult($query, $data, \Chill\MainBundle\Export\ExportGenerationContext $context): array
|
||||
{
|
||||
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'export.Sum concerned persons count for aside activities';
|
||||
}
|
||||
|
||||
public function getType(): string
|
||||
{
|
||||
return Declarations::ASIDE_ACTIVITY_TYPE;
|
||||
}
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data, \Chill\MainBundle\Export\ExportGenerationContext $context): \Doctrine\ORM\QueryBuilder
|
||||
{
|
||||
$qb = $this->repository->createQueryBuilder('aside');
|
||||
|
||||
$qb->select('SUM(COALESCE(aside.concernedPersonsCount, 0)) as export_sum_concerned_persons_count');
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
public function requiredRole(): string
|
||||
{
|
||||
return AsideActivityVoter::STATS;
|
||||
}
|
||||
|
||||
public function supportsModifiers(): array
|
||||
{
|
||||
return [
|
||||
Declarations::ASIDE_ACTIVITY_TYPE,
|
||||
];
|
||||
}
|
||||
}
|
@@ -21,6 +21,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormEvent;
|
||||
use Symfony\Component\Form\FormEvents;
|
||||
@@ -29,11 +30,13 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
final class AsideActivityFormType extends AbstractType
|
||||
{
|
||||
private readonly array $timeChoices;
|
||||
private readonly bool $showConcernedPersonsCount;
|
||||
|
||||
public function __construct(
|
||||
ParameterBagInterface $parameterBag,
|
||||
) {
|
||||
$this->timeChoices = $parameterBag->get('chill_aside_activity.form.time_duration');
|
||||
$this->showConcernedPersonsCount = $parameterBag->get('chill_aside_activity.show_concerned_persons_count');
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
@@ -76,6 +79,16 @@ final class AsideActivityFormType extends AbstractType
|
||||
->add('location', PickUserLocationType::class)
|
||||
;
|
||||
|
||||
if ($this->showConcernedPersonsCount) {
|
||||
$builder->add('concernedPersonsCount', IntegerType::class, [
|
||||
'label' => 'Concerned persons count',
|
||||
'required' => false,
|
||||
'attr' => [
|
||||
'min' => 0,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
foreach (['duration'] as $fieldName) {
|
||||
$builder->get($fieldName)
|
||||
->addModelTransformer($durationTimeTransformer);
|
||||
|
@@ -42,6 +42,11 @@
|
||||
{%- if entity.location.name is defined -%}
|
||||
<div><i class="fa fa-fw fa-map-marker"></i>{{ entity.location.name }}</div>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if entity.concernedPersonsCount > 0 -%}
|
||||
<div><i class="fa fa-fw fa-user"></i>{{ entity.concernedPersonsCount }}</div>
|
||||
{%- endif -%}
|
||||
|
||||
</div>
|
||||
<div class="item-col" style="justify-content: flex-end;">
|
||||
<div class="box">
|
||||
|
@@ -38,6 +38,9 @@
|
||||
<dt class="inline">{{ 'Duration'|trans }}</dt>
|
||||
<dd>{{ entity.duration|date('H:i') }}</dd>
|
||||
|
||||
<dt class="inline">{{ 'Concerned persons count'|trans }}</dt>
|
||||
<dd>{{ entity.concernedPersonsCount }}</dd>
|
||||
|
||||
<dt class="inline">{{ 'Remark'|trans }}</dt>
|
||||
{%- if entity.note is empty -%}
|
||||
<dd>
|
||||
|
@@ -20,6 +20,10 @@ services:
|
||||
tags:
|
||||
- { name: chill.export, alias: 'avg_aside_activity_duration' }
|
||||
|
||||
Chill\AsideActivityBundle\Export\Export\SumConcernedPersonsCountAsideActivity:
|
||||
tags:
|
||||
- { name: chill.export, alias: 'sum_aside_activity_concerned_persons_count' }
|
||||
|
||||
## Filters
|
||||
chill.aside_activity.export.date_filter:
|
||||
class: Chill\AsideActivityBundle\Export\Filter\ByDateFilter
|
||||
@@ -70,3 +74,7 @@ services:
|
||||
Chill\AsideActivityBundle\Export\Aggregator\ByLocationAggregator:
|
||||
tags:
|
||||
- { name: chill.export_aggregator, alias: 'aside_activity_location_aggregator' }
|
||||
|
||||
Chill\AsideActivityBundle\Export\Aggregator\ByConcernedPersonsCountAggregator:
|
||||
tags:
|
||||
- { name: chill.export_aggregator, alias: 'aside_activity_concerned_persons_count_aggregator' }
|
||||
|
@@ -0,0 +1,33 @@
|
||||
<?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 Version20251006113048 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add concernedPersonsCount property to AsideActivity entity';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_asideactivity.asideactivity ADD concernedPersonsCount INT DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_asideactivity.AsideActivity DROP concernedPersonsCount');
|
||||
}
|
||||
}
|
@@ -27,6 +27,7 @@ Emergency: Urgent
|
||||
by: "Par "
|
||||
location: Lieu
|
||||
Asideactivity location: Localisation de l'activité
|
||||
Concerned persons count: Nombre d'usager concernés
|
||||
|
||||
# Crud
|
||||
crud:
|
||||
@@ -190,6 +191,7 @@ export:
|
||||
Count aside activities by various parameters.: Compte le nombre d'activités annexes selon divers critères
|
||||
Average aside activities duration: Durée moyenne des activités annexes
|
||||
Sum aside activities duration: Durée des activités annexes
|
||||
Sum concerned persons count for aside activities: Nombre d'usager concernés par les activités annexes
|
||||
filter:
|
||||
Filter by aside activity date: Filtrer les activités annexes par date
|
||||
Filter by aside activity type: Filtrer les activités annexes par type d'activité
|
||||
@@ -210,6 +212,8 @@ export:
|
||||
'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é
|
||||
Group by concerned persons count: Grouper les activités annexes par nombre d'usagers conernés
|
||||
Concerned persons count: Nombre d'usagers concernés
|
||||
Aside activity type: Type d'activité annexe
|
||||
by_user_job:
|
||||
Aggregate by user job: Grouper les activités annexes par métier des utilisateurs
|
||||
|
@@ -59,7 +59,7 @@ final readonly class StoredObjectVersionApiController
|
||||
|
||||
return new JsonResponse(
|
||||
$this->serializer->serialize(
|
||||
new Collection($items, $paginator),
|
||||
new Collection(array_values($items->toArray()), $paginator),
|
||||
'json',
|
||||
[AbstractNormalizer::GROUPS => ['read', StoredObjectVersionNormalizer::WITH_POINT_IN_TIMES_CONTEXT, StoredObjectVersionNormalizer::WITH_RESTORED_CONTEXT]]
|
||||
),
|
||||
|
@@ -3,9 +3,9 @@ import {
|
||||
StoredObject,
|
||||
StoredObjectPointInTime,
|
||||
StoredObjectVersionWithPointInTime,
|
||||
} from "./../../../types";
|
||||
} from "ChillDocStoreAssets/types";
|
||||
import UserRenderBoxBadge from "ChillMainAssets/vuejs/_components/Entity/UserRenderBoxBadge.vue";
|
||||
import { ISOToDatetime } from "./../../../../../../ChillMainBundle/Resources/public/chill/js/date";
|
||||
import { ISOToDatetime } from "ChillMainAssets/chill/js/date";
|
||||
import FileIcon from "ChillDocStoreAssets/vuejs/FileIcon.vue";
|
||||
import RestoreVersionButton from "ChillDocStoreAssets/vuejs/StoredObjectButton/HistoryButton/RestoreVersionButton.vue";
|
||||
import DownloadButton from "ChillDocStoreAssets/vuejs/StoredObjectButton/DownloadButton.vue";
|
||||
|
@@ -40,6 +40,10 @@ class StoredObjectVersionApiControllerTest extends \PHPUnit\Framework\TestCase
|
||||
$storedObject->registerVersion();
|
||||
}
|
||||
|
||||
// remove one version in the history
|
||||
$v5 = $storedObject->getVersions()->get(5);
|
||||
$storedObject->removeVersion($v5);
|
||||
|
||||
$security = $this->prophesize(Security::class);
|
||||
$security->isGranted(StoredObjectRoleEnum::SEE->value, $storedObject)
|
||||
->willReturn(true)
|
||||
@@ -53,6 +57,7 @@ class StoredObjectVersionApiControllerTest extends \PHPUnit\Framework\TestCase
|
||||
self::assertEquals($response->getStatusCode(), 200);
|
||||
self::assertIsArray($body);
|
||||
self::assertArrayHasKey('results', $body);
|
||||
self::assertIsList($body['results']);
|
||||
self::assertCount(10, $body['results']);
|
||||
}
|
||||
|
||||
|
@@ -21,8 +21,6 @@
|
||||
{{ form_row(form.title, { 'label': 'notification.subject'|trans }) }}
|
||||
{{ form_row(form.addressees, { 'label': 'notification.sent_to'|trans }) }}
|
||||
|
||||
{{ form_row(form.addressesEmails) }}
|
||||
|
||||
{% include handler.template(notification) with handler.templateData(notification) %}
|
||||
|
||||
<div class="mb-3 row">
|
||||
|
Reference in New Issue
Block a user