mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 05:44:24 +00:00
Merge branch '128-export-group-activity-by-localisation' into testing
This commit is contained in:
commit
0288fd22cf
5
.changes/unreleased/Feature-20230711-150055.yaml
Normal file
5
.changes/unreleased/Feature-20230711-150055.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
kind: Feature
|
||||||
|
body: '[Export] allow to group activities by localisation'
|
||||||
|
time: 2023-07-11T15:00:55.770070399+02:00
|
||||||
|
custom:
|
||||||
|
Issue: "128"
|
@ -0,0 +1,80 @@
|
|||||||
|
<?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\ActivityBundle\Export\Aggregator;
|
||||||
|
|
||||||
|
use Chill\ActivityBundle\Export\Declarations;
|
||||||
|
use Chill\ActivityBundle\Repository\ActivityTypeRepositoryInterface;
|
||||||
|
use Chill\MainBundle\Export\AggregatorInterface;
|
||||||
|
use Chill\MainBundle\Repository\LocationRepository;
|
||||||
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
|
use Closure;
|
||||||
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use function in_array;
|
||||||
|
|
||||||
|
final readonly class ActivityLocationAggregator implements AggregatorInterface
|
||||||
|
{
|
||||||
|
public const KEY = 'activity_location_aggregator';
|
||||||
|
|
||||||
|
public function addRole(): ?string
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
|
{
|
||||||
|
if (!in_array('actloc', $qb->getAllAliases(), true)) {
|
||||||
|
$qb->leftJoin('activity.location', 'actloc');
|
||||||
|
}
|
||||||
|
$qb->addSelect(sprintf('actloc.name AS %s', self::KEY));
|
||||||
|
$qb->addGroupBy(self::KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function applyOn(): string
|
||||||
|
{
|
||||||
|
return Declarations::ACTIVITY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
{
|
||||||
|
// no form required for this aggregator
|
||||||
|
}
|
||||||
|
public function getFormDefaultData(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLabels($key, array $values, $data): Closure
|
||||||
|
{
|
||||||
|
return function ($value): string {
|
||||||
|
if ('_header' === $value) {
|
||||||
|
return 'export.aggregator.activity.by_location.Activity Location';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null === $value || '' === $value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getQueryKeys($data): array
|
||||||
|
{
|
||||||
|
return [self::KEY];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTitle()
|
||||||
|
{
|
||||||
|
return 'export.aggregator.activity.by_location.Title';
|
||||||
|
}
|
||||||
|
}
|
@ -148,6 +148,10 @@ services:
|
|||||||
tags:
|
tags:
|
||||||
- { name: chill.export_aggregator, alias: activity_common_type_aggregator }
|
- { name: chill.export_aggregator, alias: activity_common_type_aggregator }
|
||||||
|
|
||||||
|
Chill\ActivityBundle\Export\Aggregator\ActivityLocationAggregator:
|
||||||
|
tags:
|
||||||
|
- { name: chill.export_aggregator, alias: activity_common_location_aggregator }
|
||||||
|
|
||||||
chill.activity.export.user_aggregator:
|
chill.activity.export.user_aggregator:
|
||||||
class: Chill\ActivityBundle\Export\Aggregator\ActivityUserAggregator
|
class: Chill\ActivityBundle\Export\Aggregator\ActivityUserAggregator
|
||||||
tags:
|
tags:
|
||||||
|
@ -389,6 +389,9 @@ export:
|
|||||||
is sent: envoyé
|
is sent: envoyé
|
||||||
is received: reçu
|
is received: reçu
|
||||||
Group activity by sentreceived: Grouper les échanges par envoyé / reçu
|
Group activity by sentreceived: Grouper les échanges par envoyé / reçu
|
||||||
|
by_location:
|
||||||
|
Activity Location: Localisation de l'échange
|
||||||
|
Title: Grouper les échanges par localisation de l'échange
|
||||||
|
|
||||||
generic_doc:
|
generic_doc:
|
||||||
filter:
|
filter:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user