mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
Merge branch 'master' into 118-design-filterOrder
This commit is contained in:
@@ -40,6 +40,10 @@ class ByActivityNumberAggregator implements AggregatorInterface
|
||||
{
|
||||
// No form needed
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
|
@@ -52,6 +52,10 @@ class ByCreatorAggregator implements AggregatorInterface
|
||||
{
|
||||
// no form
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
|
@@ -57,6 +57,10 @@ class BySocialActionAggregator implements AggregatorInterface
|
||||
{
|
||||
// no form
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
|
@@ -57,6 +57,10 @@ class BySocialIssueAggregator implements AggregatorInterface
|
||||
{
|
||||
// no form
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
|
@@ -57,6 +57,10 @@ class ByThirdpartyAggregator implements AggregatorInterface
|
||||
{
|
||||
// no form
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
|
@@ -57,6 +57,10 @@ class CreatorScopeAggregator implements AggregatorInterface
|
||||
{
|
||||
// no form
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
|
@@ -29,14 +29,6 @@ class DateAggregator implements AggregatorInterface
|
||||
|
||||
private const DEFAULT_CHOICE = 'year';
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
@@ -84,9 +76,12 @@ class DateAggregator implements AggregatorInterface
|
||||
'multiple' => false,
|
||||
'expanded' => true,
|
||||
'empty_data' => self::DEFAULT_CHOICE,
|
||||
'data' => self::DEFAULT_CHOICE,
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return ['frequency' => self::DEFAULT_CHOICE];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
|
@@ -57,6 +57,10 @@ class LocationTypeAggregator implements AggregatorInterface
|
||||
{
|
||||
// no form
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
|
@@ -60,6 +60,10 @@ class ActivityTypeAggregator implements AggregatorInterface
|
||||
{
|
||||
// no form required for this aggregator
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data): Closure
|
||||
{
|
||||
|
@@ -58,6 +58,10 @@ class ActivityUserAggregator implements AggregatorInterface
|
||||
{
|
||||
// nothing to add
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, $values, $data): Closure
|
||||
{
|
||||
|
@@ -56,6 +56,10 @@ class ActivityUsersAggregator implements AggregatorInterface
|
||||
{
|
||||
// nothing to add on the form
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
|
@@ -55,6 +55,10 @@ class ActivityUsersJobAggregator implements \Chill\MainBundle\Export\AggregatorI
|
||||
{
|
||||
// nothing to add in the form
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
|
@@ -55,6 +55,10 @@ class ActivityUsersScopeAggregator implements \Chill\MainBundle\Export\Aggregato
|
||||
{
|
||||
// nothing to add in the form
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
|
@@ -110,6 +110,10 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
||||
]
|
||||
);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
|
@@ -47,6 +47,10 @@ class SentReceivedAggregator implements AggregatorInterface
|
||||
{
|
||||
// No form needed
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data): callable
|
||||
{
|
||||
|
@@ -39,6 +39,10 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes(): array
|
||||
{
|
||||
|
@@ -40,6 +40,10 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
||||
{
|
||||
// TODO: Implement buildForm() method.
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes(): array
|
||||
{
|
||||
|
@@ -39,6 +39,10 @@ class CountActivity implements ExportInterface, GroupedExportInterface
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes(): array
|
||||
{
|
||||
|
@@ -44,6 +44,10 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
{
|
||||
$this->helper->buildForm($builder);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes()
|
||||
{
|
||||
|
@@ -40,6 +40,10 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
// TODO: Implement buildForm() method.
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes(): array
|
||||
{
|
||||
|
@@ -40,6 +40,10 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
||||
{
|
||||
// TODO: Implement buildForm() method.
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes(): array
|
||||
{
|
||||
|
@@ -35,6 +35,10 @@ class CountActivity implements ExportInterface, GroupedExportInterface
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes()
|
||||
{
|
||||
|
@@ -88,6 +88,10 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
])],
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes()
|
||||
{
|
||||
|
@@ -53,6 +53,10 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes()
|
||||
{
|
||||
|
@@ -68,6 +68,10 @@ class ActivityTypeFilter implements FilterInterface
|
||||
'expanded' => true,
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
|
@@ -52,6 +52,10 @@ class ByCreatorFilter implements FilterInterface
|
||||
'multiple' => true,
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
|
@@ -60,6 +60,10 @@ class BySocialActionFilter implements FilterInterface
|
||||
'multiple' => true,
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
|
@@ -60,6 +60,10 @@ class BySocialIssueFilter implements FilterInterface
|
||||
'multiple' => true,
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
|
@@ -68,9 +68,12 @@ class EmergencyFilter implements FilterInterface
|
||||
'multiple' => false,
|
||||
'expanded' => true,
|
||||
'empty_data' => self::DEFAULT_CHOICE,
|
||||
'data' => self::DEFAULT_CHOICE,
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return ['accepted_emergency' => self::DEFAULT_CHOICE];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
|
@@ -44,6 +44,10 @@ class HasNoActivityFilter implements FilterInterface
|
||||
{
|
||||
//no form needed
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
|
@@ -46,6 +46,10 @@ class LocationFilter implements FilterInterface
|
||||
'label' => 'pick location',
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
|
@@ -65,6 +65,10 @@ class LocationTypeFilter implements FilterInterface
|
||||
//'label' => false,
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
|
@@ -69,9 +69,12 @@ class SentReceivedFilter implements FilterInterface
|
||||
'multiple' => false,
|
||||
'expanded' => true,
|
||||
'empty_data' => self::DEFAULT_CHOICE,
|
||||
'data' => self::DEFAULT_CHOICE,
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return ['accepted_sentreceived' => self::DEFAULT_CHOICE];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
|
@@ -61,6 +61,10 @@ class UserFilter implements FilterInterface
|
||||
'label' => 'Creators',
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
|
@@ -71,6 +71,10 @@ class UserScopeFilter implements FilterInterface
|
||||
'expanded' => true,
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
|
@@ -80,11 +80,9 @@ class ActivityDateFilter implements FilterInterface
|
||||
$builder
|
||||
->add('date_from', PickRollingDateType::class, [
|
||||
'label' => 'Activities after this date',
|
||||
'data' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START),
|
||||
])
|
||||
->add('date_to', PickRollingDateType::class, [
|
||||
'label' => 'Activities before this date',
|
||||
'data' => new RollingDate(RollingDate::T_TODAY),
|
||||
]);
|
||||
|
||||
$builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) {
|
||||
@@ -127,6 +125,10 @@ class ActivityDateFilter implements FilterInterface
|
||||
}
|
||||
});
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return ['date_from' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START), 'date_to' => new RollingDate(RollingDate::T_TODAY)];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string')
|
||||
{
|
||||
|
@@ -78,6 +78,10 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter
|
||||
],
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string')
|
||||
{
|
||||
|
@@ -56,6 +56,10 @@ class ActivityUsersFilter implements FilterInterface
|
||||
'label' => 'Users',
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string')
|
||||
{
|
||||
|
@@ -82,6 +82,10 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt
|
||||
'expanded' => false,
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string')
|
||||
{
|
||||
|
@@ -112,7 +112,6 @@ class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInt
|
||||
{
|
||||
$builder->add('date_from', DateType::class, [
|
||||
'label' => 'Implied in an activity after this date',
|
||||
'data' => new DateTime(),
|
||||
'attr' => ['class' => 'datepicker'],
|
||||
'widget' => 'single_text',
|
||||
'format' => 'dd-MM-yyyy',
|
||||
@@ -120,7 +119,6 @@ class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInt
|
||||
|
||||
$builder->add('date_to', DateType::class, [
|
||||
'label' => 'Implied in an activity before this date',
|
||||
'data' => new DateTime(),
|
||||
'attr' => ['class' => 'datepicker'],
|
||||
'widget' => 'single_text',
|
||||
'format' => 'dd-MM-yyyy',
|
||||
@@ -130,7 +128,6 @@ class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInt
|
||||
'class' => ActivityReason::class,
|
||||
'choice_label' => fn (ActivityReason $reason): ?string => $this->translatableStringHelper->localize($reason->getName()),
|
||||
'group_by' => fn (ActivityReason $reason): ?string => $this->translatableStringHelper->localize($reason->getCategory()->getName()),
|
||||
'data' => $this->activityReasonRepository->findAll(),
|
||||
'multiple' => true,
|
||||
'expanded' => false,
|
||||
'label' => 'Activity reasons for those activities',
|
||||
@@ -176,6 +173,10 @@ class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInt
|
||||
}
|
||||
});
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return ['date_from' => new DateTime(), 'date_to' => new DateTime(), 'reasons' => $this->activityReasonRepository->findAll()];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string')
|
||||
{
|
||||
|
@@ -60,6 +60,10 @@ class UsersJobFilter implements FilterInterface
|
||||
'expanded' => true,
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string')
|
||||
{
|
||||
|
@@ -67,6 +67,10 @@ class UsersScopeFilter implements FilterInterface
|
||||
'expanded' => true,
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string')
|
||||
{
|
||||
|
@@ -0,0 +1,198 @@
|
||||
<?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\Repository;
|
||||
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
|
||||
use Chill\ActivityBundle\Service\GenericDoc\Providers\AccompanyingPeriodActivityGenericDocProvider;
|
||||
use Chill\ActivityBundle\Service\GenericDoc\Providers\PersonActivityGenericDocProvider;
|
||||
use Chill\DocStoreBundle\Entity\PersonDocument;
|
||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||
use Chill\DocStoreBundle\GenericDoc\FetchQuery;
|
||||
use Chill\DocStoreBundle\GenericDoc\FetchQueryInterface;
|
||||
use Chill\DocStoreBundle\GenericDoc\Providers\PersonDocumentGenericDocProvider;
|
||||
use Chill\DocStoreBundle\Repository\PersonDocumentACLAwareRepositoryInterface;
|
||||
use Chill\DocStoreBundle\Security\Authorization\PersonDocumentVoter;
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelperForCurrentUserInterface;
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodWorkVoter;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Mapping\MappingException;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\HttpKernel\HttpCache\Store;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
final readonly class ActivityDocumentACLAwareRepository implements ActivityDocumentACLAwareRepositoryInterface
|
||||
{
|
||||
public function __construct(
|
||||
private EntityManagerInterface $em,
|
||||
private CenterResolverManagerInterface $centerResolverManager,
|
||||
private AuthorizationHelperForCurrentUserInterface $authorizationHelperForCurrentUser,
|
||||
private Security $security
|
||||
) {
|
||||
}
|
||||
|
||||
public function buildFetchQueryActivityDocumentLinkedToPersonFromPersonContext(Person $person, ?DateTimeImmutable $startDate = null, ?DateTimeImmutable $endDate = null, ?string $content = null): FetchQueryInterface
|
||||
{
|
||||
$query = $this->buildBaseFetchQueryActivityDocumentLinkedToPersonFromPersonContext($person, $startDate, $endDate, $content);
|
||||
|
||||
return $this->addFetchQueryByPersonACL($query, $person);
|
||||
}
|
||||
|
||||
public function buildBaseFetchQueryActivityDocumentLinkedToPersonFromPersonContext(Person $person, ?DateTimeImmutable $startDate = null, ?DateTimeImmutable $endDate = null, ?string $content = null): FetchQuery
|
||||
{
|
||||
$storedObjectMetadata = $this->em->getClassMetadata(StoredObject::class);
|
||||
$activityMetadata = $this->em->getClassMetadata(Activity::class);
|
||||
|
||||
$query = new FetchQuery(
|
||||
PersonActivityGenericDocProvider::KEY,
|
||||
sprintf('jsonb_build_object(\'id\', stored_obj.%s, \'activity_id\', activity.%s)', $storedObjectMetadata->getSingleIdentifierColumnName(), $activityMetadata->getSingleIdentifierColumnName()),
|
||||
sprintf('stored_obj.%s', $storedObjectMetadata->getColumnName('createdAt')),
|
||||
sprintf('%s AS stored_obj', $storedObjectMetadata->getSchemaName().'.'.$storedObjectMetadata->getTableName())
|
||||
);
|
||||
|
||||
$query->addJoinClause(
|
||||
'JOIN public.activity_storedobject activity_doc ON activity_doc.storedobject_id = stored_obj.id'
|
||||
);
|
||||
|
||||
$query->addJoinClause(
|
||||
'JOIN public.activity activity ON activity.id = activity_doc.activity_id'
|
||||
);
|
||||
|
||||
$query->addWhereClause(
|
||||
sprintf('activity.%s = ?', $activityMetadata->getSingleAssociationJoinColumnName('person')),
|
||||
[$person->getId()],
|
||||
[Types::INTEGER]
|
||||
);
|
||||
|
||||
return $this->addWhereClauses($query, $startDate, $endDate, $content);
|
||||
}
|
||||
|
||||
public function buildFetchQueryActivityDocumentLinkedToAccompanyingPeriodFromPersonContext(Person $person, ?DateTimeImmutable $startDate = null, ?DateTimeImmutable $endDate = null, ?string $content = null): FetchQuery
|
||||
{
|
||||
$storedObjectMetadata = $this->em->getClassMetadata(StoredObject::class);
|
||||
$activityMetadata = $this->em->getClassMetadata(Activity::class);
|
||||
|
||||
$query = new FetchQuery(
|
||||
AccompanyingPeriodActivityGenericDocProvider::KEY,
|
||||
sprintf('jsonb_build_object(\'id\', stored_obj.%s, \'activity_id\', activity.%s)', $storedObjectMetadata->getSingleIdentifierColumnName(), $activityMetadata->getSingleIdentifierColumnName()),
|
||||
sprintf('stored_obj.%s', $storedObjectMetadata->getColumnName('createdAt')),
|
||||
sprintf('%s AS stored_obj', $storedObjectMetadata->getSchemaName().'.'.$storedObjectMetadata->getTableName())
|
||||
);
|
||||
|
||||
$query->addJoinClause(
|
||||
'JOIN public.activity_storedobject activity_doc ON activity_doc.storedobject_id = stored_obj.id'
|
||||
);
|
||||
|
||||
$query->addJoinClause(
|
||||
'JOIN public.activity activity ON activity.id = activity_doc.activity_id'
|
||||
);
|
||||
|
||||
// add documents of activities from parcours context
|
||||
$or = [];
|
||||
$orParams = [];
|
||||
$orTypes = [];
|
||||
foreach ($person->getAccompanyingPeriodParticipations() as $participation) {
|
||||
if (!$this->security->isGranted(ActivityVoter::SEE, $participation->getAccompanyingPeriod())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$or[] = sprintf(
|
||||
'(activity.%s = ? AND stored_obj.%s BETWEEN ?::date AND COALESCE(?::date, \'infinity\'::date))',
|
||||
$activityMetadata->getSingleAssociationJoinColumnName('accompanyingPeriod'),
|
||||
$storedObjectMetadata->getColumnName('createdAt')
|
||||
);
|
||||
$orParams = [...$orParams, $participation->getAccompanyingPeriod()->getId(),
|
||||
DateTimeImmutable::createFromInterface($participation->getStartDate()),
|
||||
null === $participation->getEndDate() ? null : DateTimeImmutable::createFromInterface($participation->getEndDate())];
|
||||
$orTypes = [...$orTypes, Types::INTEGER, Types::DATE_IMMUTABLE, Types::DATE_IMMUTABLE];
|
||||
}
|
||||
|
||||
if ([] === $or) {
|
||||
$query->addWhereClause('TRUE = FALSE');
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
$query->addWhereClause(sprintf('(%s)', implode(' OR ', $or)), $orParams, $orTypes);
|
||||
|
||||
return $this->addWhereClauses($query, $startDate, $endDate, $content);
|
||||
}
|
||||
|
||||
private function addWhereClauses(FetchQuery $query, ?DateTimeImmutable $startDate = null, ?DateTimeImmutable $endDate = null, ?string $content = null): FetchQuery
|
||||
{
|
||||
$storedObjectMetadata = $this->em->getClassMetadata(StoredObject::class);
|
||||
|
||||
if (null !== $startDate) {
|
||||
$query->addWhereClause(
|
||||
sprintf('stored_obj.%s >= ?', $storedObjectMetadata->getColumnName('createdAt')),
|
||||
[$startDate],
|
||||
[Types::DATE_IMMUTABLE]
|
||||
);
|
||||
}
|
||||
|
||||
if (null !== $endDate) {
|
||||
$query->addWhereClause(
|
||||
sprintf('stored_obj.%s < ?', $storedObjectMetadata->getColumnName('createdAt')),
|
||||
[$endDate],
|
||||
[Types::DATE_IMMUTABLE]
|
||||
);
|
||||
}
|
||||
|
||||
if (null !== $content and '' !== $content) {
|
||||
$query->addWhereClause(
|
||||
'stored_obj.title ilike ?',
|
||||
['%' . $content . '%'],
|
||||
[Types::STRING]
|
||||
);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
private function addFetchQueryByPersonACL(FetchQuery $fetchQuery, Person $person): FetchQuery
|
||||
{
|
||||
$activityMetadata = $this->em->getClassMetadata(Activity::class);
|
||||
|
||||
$reachableScopes = [];
|
||||
|
||||
foreach ($this->centerResolverManager->resolveCenters($person) as $center) {
|
||||
$reachableScopes = [
|
||||
...$reachableScopes,
|
||||
...$this->authorizationHelperForCurrentUser->getReachableScopes(ActivityVoter::SEE, $center)
|
||||
];
|
||||
}
|
||||
|
||||
if ([] === $reachableScopes) {
|
||||
$fetchQuery->addWhereClause('FALSE = TRUE');
|
||||
|
||||
return $fetchQuery;
|
||||
}
|
||||
|
||||
$fetchQuery->addWhereClause(
|
||||
sprintf(
|
||||
'activity.%s IN (%s)',
|
||||
$activityMetadata->getSingleAssociationJoinColumnName('scope'),
|
||||
implode(', ', array_fill(0, count($reachableScopes), '?'))
|
||||
),
|
||||
array_map(static fn (Scope $s) => $s->getId(), $reachableScopes),
|
||||
array_fill(0, count($reachableScopes), Types::INTEGER)
|
||||
);
|
||||
|
||||
return $fetchQuery;
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
<?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\Repository;
|
||||
|
||||
use Chill\DocStoreBundle\GenericDoc\FetchQuery;
|
||||
use Chill\DocStoreBundle\GenericDoc\FetchQueryInterface;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use DateTimeImmutable;
|
||||
|
||||
/**
|
||||
* Gives queries usable for fetching documents, with ACL aware
|
||||
*/
|
||||
interface ActivityDocumentACLAwareRepositoryInterface
|
||||
{
|
||||
/**
|
||||
* Return a fetch query for querying document's activities for a person
|
||||
*
|
||||
* This method must check the rights to see a document: the user must be allowed to see the given activities
|
||||
*/
|
||||
public function buildFetchQueryActivityDocumentLinkedToPersonFromPersonContext(Person $person, ?DateTimeImmutable $startDate = null, ?DateTimeImmutable $endDate = null, ?string $content = null): FetchQueryInterface;
|
||||
|
||||
/**
|
||||
* Return a fetch query for querying document's activities for an activity in accompanying periods, but for a given person
|
||||
*
|
||||
* This method must check the rights to see a document: the user must be allowed to see the given accompanying periods
|
||||
*/
|
||||
public function buildFetchQueryActivityDocumentLinkedToAccompanyingPeriodFromPersonContext(Person $person, ?DateTimeImmutable $startDate = null, ?DateTimeImmutable $endDate = null, ?string $content = null): FetchQuery;
|
||||
}
|
@@ -1,5 +1,7 @@
|
||||
// Access to Bootstrap variables and mixins
|
||||
@import '~ChillMainAssets/module/bootstrap/shared';
|
||||
@import '~ChillPersonAssets/chill/scss/mixins.scss';
|
||||
@import 'bootstrap/scss/_badge.scss';
|
||||
|
||||
//// ACTIVITY CREATION
|
||||
// first step: select type page
|
||||
@@ -96,3 +98,25 @@ li.document-list-item {
|
||||
justify-content: space-between;
|
||||
margin-bottom: 0.3rem;
|
||||
}
|
||||
|
||||
.badge-activity-type {
|
||||
display: inline-block;
|
||||
background-color: #f3f3f3;
|
||||
|
||||
.title_label {
|
||||
@include chill_badge(#9acd32);
|
||||
}
|
||||
|
||||
.title_action {
|
||||
padding: var(--bs-badge-padding-y) var(--bs-badge-padding-x);
|
||||
margin-right: 1rem;
|
||||
|
||||
font-size: var(--bs-badge-font-size);
|
||||
font-weight: var(--bs-badge-font-weight);
|
||||
line-height: 1;
|
||||
color: var(--bs-badge-color);
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,83 @@
|
||||
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
||||
{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}
|
||||
{% import '@ChillPerson/Macro/updatedBy.html.twig' as mmm %}
|
||||
|
||||
{% set person_id = null %}
|
||||
{% if activity.person %}
|
||||
{% set person_id = activity.person.id %}
|
||||
{% endif %}
|
||||
|
||||
{% set accompanying_course_id = null %}
|
||||
{% if activity.accompanyingPeriod %}
|
||||
{% set accompanying_course_id = activity.accompanyingPeriod.id %}
|
||||
{% endif %}
|
||||
|
||||
<div class="item-bloc activity-item{% if itemBlocClass is defined %} {{ itemBlocClass }}{% endif %}">
|
||||
<div class="item-row">
|
||||
<div class="item-col" style="width: unset">
|
||||
{% if document.isPending %}
|
||||
<div class="badge text-bg-info" data-docgen-is-pending="{{ document.id }}">{{ 'docgen.Doc generation is pending'|trans }}</div>
|
||||
{% elseif document.isFailure %}
|
||||
<div class="badge text-bg-warning">{{ 'docgen.Doc generation failed'|trans }}</div>
|
||||
{% endif %}
|
||||
|
||||
<div>
|
||||
{% if activity.accompanyingPeriod is not null and context == 'person' %}
|
||||
<span class="badge bg-primary">
|
||||
<i class="fa fa-random"></i> {{ activity.accompanyingPeriod.id }}
|
||||
</span>
|
||||
{% endif %}
|
||||
<div class="badge-activity-type">
|
||||
<span class="title_label"></span>
|
||||
<span class="title_action">
|
||||
{{ activity.type.name | localize_translatable_string }}
|
||||
{% if activity.emergency %}
|
||||
<span class="badge bg-danger rounded-pill fs-6 float-end">{{ 'Emergency'|trans|upper }}</span>
|
||||
{% endif %}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="denomination h2">
|
||||
{{ document.title|chill_print_or_message("No title") }}
|
||||
</div>
|
||||
{% if document.hasTemplate %}
|
||||
<div>
|
||||
<p>{{ document.template.name|localize_translatable_string }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="item-col">
|
||||
<div class="container">
|
||||
<div class="dates row text-end">
|
||||
<span>{{ document.createdAt|format_date('short') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="item-row separator">
|
||||
<div class="item-col item-meta">
|
||||
{{ mmm.createdBy(document) }}
|
||||
</div>
|
||||
<ul class="item-col record_actions flex-shrink-1">
|
||||
{% if is_granted('CHILL_ACTIVITY_SEE_DETAILS', activity) %}
|
||||
<li>
|
||||
{{ document|chill_document_button_group(document.title, is_granted('CHILL_ACTIVITY_UPDATE', activity), {small: false}) }}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if is_granted('CHILL_ACTIVITY_SEE', activity)%}
|
||||
<li>
|
||||
<a href="{{ chill_path_add_return_path('chill_activity_activity_show', {'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}" class="btn btn-show"></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %}
|
||||
<li>
|
||||
<a href="{{ chill_path_add_return_path('chill_activity_activity_edit', {'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}" class="btn btn-edit"></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
@@ -0,0 +1,114 @@
|
||||
<?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\Service\GenericDoc\Providers;
|
||||
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\ActivityBundle\Repository\ActivityDocumentACLAwareRepositoryInterface;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
|
||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||
use Chill\DocStoreBundle\GenericDoc\FetchQuery;
|
||||
use Chill\DocStoreBundle\GenericDoc\FetchQueryInterface;
|
||||
use Chill\DocStoreBundle\GenericDoc\GenericDocForAccompanyingPeriodProviderInterface;
|
||||
use Chill\DocStoreBundle\GenericDoc\GenericDocForPersonProviderInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Mapping\MappingException;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
final class AccompanyingPeriodActivityGenericDocProvider implements GenericDocForAccompanyingPeriodProviderInterface, GenericDocForPersonProviderInterface
|
||||
{
|
||||
public const KEY = 'accompanying_period_activity_document';
|
||||
|
||||
public function __construct(
|
||||
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
|
||||
{
|
||||
$storedObjectMetadata = $this->em->getClassMetadata(StoredObject::class);
|
||||
$activityMetadata = $this->em->getClassMetadata(Activity::class);
|
||||
|
||||
$query = new FetchQuery(
|
||||
self::KEY,
|
||||
sprintf("jsonb_build_object('id', doc_obj.%s, 'activity_id', activity.%s)", $storedObjectMetadata->getSingleIdentifierColumnName(), $activityMetadata->getSingleIdentifierColumnName()),
|
||||
'doc_obj.'.$storedObjectMetadata->getColumnName('createdAt'),
|
||||
$storedObjectMetadata->getSchemaName().'.'.$storedObjectMetadata->getTableName().' AS doc_obj'
|
||||
);
|
||||
|
||||
$query->addJoinClause(
|
||||
'JOIN public.activity_storedobject activity_doc ON activity_doc.storedobject_id = doc_obj.id'
|
||||
);
|
||||
|
||||
$query->addJoinClause(
|
||||
'JOIN public.activity activity ON activity.id = activity_doc.activity_id'
|
||||
);
|
||||
|
||||
$query->addWhereClause(
|
||||
'activity.accompanyingperiod_id = ?',
|
||||
[$accompanyingPeriod->getId()],
|
||||
[Types::INTEGER]
|
||||
);
|
||||
|
||||
if (null !== $startDate) {
|
||||
$query->addWhereClause(
|
||||
sprintf('doc_obj.%s >= ?', $storedObjectMetadata->getColumnName('createdAt')),
|
||||
[$startDate],
|
||||
[Types::DATE_IMMUTABLE]
|
||||
);
|
||||
}
|
||||
|
||||
if (null !== $endDate) {
|
||||
$query->addWhereClause(
|
||||
sprintf('doc_obj.%s < ?', $storedObjectMetadata->getColumnName('createdAt')),
|
||||
[$endDate],
|
||||
[Types::DATE_IMMUTABLE]
|
||||
);
|
||||
}
|
||||
|
||||
if (null !== $content) {
|
||||
$query->addWhereClause(
|
||||
'doc_obj.title ilike ?',
|
||||
['%' . $content . '%'],
|
||||
[Types::STRING]
|
||||
);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AccompanyingPeriod $accompanyingPeriod
|
||||
* @return bool
|
||||
*/
|
||||
public function isAllowedForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod): bool
|
||||
{
|
||||
return $this->security->isGranted(ActivityVoter::SEE, $accompanyingPeriod);
|
||||
}
|
||||
|
||||
public function isAllowedForPerson(Person $person): bool
|
||||
{
|
||||
return $this->security->isGranted(AccompanyingPeriodVoter::SEE, $person);
|
||||
}
|
||||
|
||||
public function buildFetchQueryForPerson(Person $person, ?DateTimeImmutable $startDate = null, ?DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface
|
||||
{
|
||||
return $this->activityDocumentACLAwareRepository
|
||||
->buildFetchQueryActivityDocumentLinkedToAccompanyingPeriodFromPersonContext($person, $startDate, $endDate, $content);
|
||||
}
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
<?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\Service\GenericDoc\Providers;
|
||||
|
||||
use Chill\ActivityBundle\Repository\ActivityDocumentACLAwareRepository;
|
||||
use Chill\ActivityBundle\Repository\ActivityDocumentACLAwareRepositoryInterface;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
|
||||
use Chill\DocStoreBundle\GenericDoc\FetchQueryInterface;
|
||||
use Chill\DocStoreBundle\GenericDoc\GenericDocForPersonProviderInterface;
|
||||
use Chill\DocStoreBundle\Repository\PersonDocumentACLAwareRepositoryInterface;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
final readonly class PersonActivityGenericDocProvider implements GenericDocForPersonProviderInterface
|
||||
{
|
||||
public const KEY = 'person_activity_document';
|
||||
|
||||
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
|
||||
{
|
||||
return $this->personActivityDocumentACLAwareRepository->buildFetchQueryActivityDocumentLinkedToPersonFromPersonContext(
|
||||
$person,
|
||||
$startDate,
|
||||
$endDate,
|
||||
$content
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Person $person
|
||||
* @return bool
|
||||
*/
|
||||
public function isAllowedForPerson(Person $person): bool
|
||||
{
|
||||
return $this->security->isGranted(ActivityVoter::SEE, $person);
|
||||
}
|
||||
}
|
@@ -0,0 +1,52 @@
|
||||
<?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\Service\GenericDoc\Renderers;
|
||||
|
||||
use Chill\ActivityBundle\Repository\ActivityRepository;
|
||||
use Chill\ActivityBundle\Service\GenericDoc\Providers\AccompanyingPeriodActivityGenericDocProvider;
|
||||
use Chill\ActivityBundle\Service\GenericDoc\Providers\PersonActivityGenericDocProvider;
|
||||
use Chill\DocStoreBundle\GenericDoc\GenericDocDTO;
|
||||
use Chill\DocStoreBundle\GenericDoc\Twig\GenericDocRendererInterface;
|
||||
use Chill\DocStoreBundle\Repository\StoredObjectRepository;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
|
||||
final class AccompanyingPeriodActivityGenericDocRenderer implements GenericDocRendererInterface
|
||||
{
|
||||
private StoredObjectRepository $objectRepository;
|
||||
|
||||
private ActivityRepository $activityRepository;
|
||||
|
||||
public function __construct(StoredObjectRepository $storedObjectRepository, ActivityRepository $activityRepository)
|
||||
{
|
||||
$this->objectRepository = $storedObjectRepository;
|
||||
$this->activityRepository = $activityRepository;
|
||||
}
|
||||
|
||||
public function supports(GenericDocDTO $genericDocDTO, $options = []): bool
|
||||
{
|
||||
return $genericDocDTO->key === AccompanyingPeriodActivityGenericDocProvider::KEY || $genericDocDTO->key === PersonActivityGenericDocProvider::KEY;
|
||||
}
|
||||
|
||||
public function getTemplate(GenericDocDTO $genericDocDTO, $options = []): string
|
||||
{
|
||||
return '@ChillActivity/GenericDoc/activity_document.html.twig';
|
||||
}
|
||||
|
||||
public function getTemplateData(GenericDocDTO $genericDocDTO, $options = []): array
|
||||
{
|
||||
return [
|
||||
'activity' => $this->activityRepository->find($genericDocDTO->identifiers['activity_id']),
|
||||
'document' => $this->objectRepository->find($genericDocDTO->identifiers['id']),
|
||||
'context' => $genericDocDTO->getContext(),
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,126 @@
|
||||
<?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\Tests\Repository;
|
||||
|
||||
use Chill\ActivityBundle\Repository\ActivityDocumentACLAwareRepository;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
|
||||
use Chill\DocStoreBundle\GenericDoc\FetchQueryToSqlBuilder;
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelperForCurrentUserInterface;
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use phpseclib3\Math\BinaryField;
|
||||
use Prophecy\Argument;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class ActivityDocumentACLAwareRepositoryTest extends KernelTestCase
|
||||
{
|
||||
use ProphecyTrait;
|
||||
|
||||
private EntityManagerInterface $entityManager;
|
||||
|
||||
private CenterResolverManagerInterface $centerResolverManager;
|
||||
|
||||
private AuthorizationHelperForCurrentUserInterface $authorizationHelperForCurrentUser;
|
||||
|
||||
private Security $security;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
$this->entityManager = self::$container->get(EntityManagerInterface::class);
|
||||
$this->centerResolverManager = self::$container->get(CenterResolverManagerInterface::class);
|
||||
$this->authorizationHelperForCurrentUser = self::$container->get(AuthorizationHelperForCurrentUserInterface::class);
|
||||
$this->security = self::$container->get(Security::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideDataForPerson
|
||||
*/
|
||||
public function testBuildFetchQueryActivityDocumentLinkedToPersonFromPersonContext(Person $person, array $reachableScopes, bool $_unused, ?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate, ?string $content): void
|
||||
{
|
||||
$authorizationHelper = $this->prophesize(AuthorizationHelperForCurrentUserInterface::class);
|
||||
$authorizationHelper->getReachableScopes(ActivityVoter::SEE, Argument::any())
|
||||
->willReturn($reachableScopes);
|
||||
|
||||
$repository = new ActivityDocumentACLAwareRepository(
|
||||
$this->entityManager,
|
||||
$this->centerResolverManager,
|
||||
$authorizationHelper->reveal(),
|
||||
$this->security
|
||||
);
|
||||
|
||||
$query = $repository->buildFetchQueryActivityDocumentLinkedToPersonFromPersonContext($person, $startDate, $endDate, $content);
|
||||
['sql' => $sql, 'params' => $params, 'types' => $types] = (new FetchQueryToSqlBuilder())->toSql($query);
|
||||
|
||||
$nb = $this->entityManager->getConnection()->fetchOne("SELECT COUNT(*) FROM ({$sql}) sq", $params, $types);
|
||||
|
||||
self::assertIsInt($nb);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideDataForPerson
|
||||
*/
|
||||
public function testBuildFetchQueryActivityDocumentLinkedToAccompanyingPeriodFromPersonContext(Person $person, array $_unused, bool $canSeePeriod, ?\DateTimeImmutable $startDate, ?\DateTimeImmutable $endDate, ?string $content): void
|
||||
{
|
||||
$security = $this->prophesize(Security::class);
|
||||
$security->isGranted(ActivityVoter::SEE, Argument::type(AccompanyingPeriod::class))
|
||||
->willReturn($canSeePeriod);
|
||||
|
||||
$repository = new ActivityDocumentACLAwareRepository(
|
||||
$this->entityManager,
|
||||
$this->centerResolverManager,
|
||||
$this->authorizationHelperForCurrentUser,
|
||||
$security->reveal()
|
||||
);
|
||||
|
||||
$query = $repository->buildFetchQueryActivityDocumentLinkedToAccompanyingPeriodFromPersonContext($person, $startDate, $endDate, $content);
|
||||
|
||||
['sql' => $sql, 'params' => $params, 'types' => $types] = (new FetchQueryToSqlBuilder())->toSql($query);
|
||||
|
||||
$nb = $this->entityManager->getConnection()->fetchOne("SELECT COUNT(*) FROM ({$sql}) sq", $params, $types);
|
||||
|
||||
self::assertIsInt($nb);
|
||||
}
|
||||
|
||||
public function provideDataForPerson(): iterable
|
||||
{
|
||||
$this->setUp();
|
||||
|
||||
if (null === $person = $this->entityManager->createQuery("SELECT p FROM " . Person::class . " p WHERE SIZE(p.accompanyingPeriodParticipations) > 0 ")
|
||||
->setMaxResults(1)
|
||||
->getSingleResult()) {
|
||||
throw new \RuntimeException("no person in dtabase");
|
||||
}
|
||||
|
||||
if ([] === $scopes = $this->entityManager->createQuery("SELECT s FROM " . Scope::class . " s ")->setMaxResults(5)->getResult()) {
|
||||
throw new \RuntimeException("no scopes in database");
|
||||
}
|
||||
|
||||
yield [$person, [], true, null, null, null];
|
||||
yield [$person, $scopes, true, null, null, null];
|
||||
yield [$person, $scopes, true, new \DateTimeImmutable("1 month ago"), null, null];
|
||||
yield [$person, $scopes, true, new \DateTimeImmutable("1 month ago"), new \DateTimeImmutable("1 week ago"), null];
|
||||
yield [$person, $scopes, true, new \DateTimeImmutable("1 month ago"), new \DateTimeImmutable("1 week ago"), "content"];
|
||||
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"];
|
||||
}
|
||||
|
||||
}
|
@@ -38,3 +38,6 @@ services:
|
||||
|
||||
Chill\ActivityBundle\Service\EntityInfo\:
|
||||
resource: '../Service/EntityInfo/'
|
||||
|
||||
Chill\ActivityBundle\Service\GenericDoc\:
|
||||
resource: '../Service/GenericDoc/'
|
||||
|
@@ -380,3 +380,8 @@ export:
|
||||
is sent: envoyé
|
||||
is received: reçu
|
||||
Group activity by sentreceived: Grouper les échanges par envoyé / reçu
|
||||
|
||||
generic_doc:
|
||||
filter:
|
||||
keys:
|
||||
accompanying_period_activity_document: Document des échanges des parcours
|
||||
|
@@ -50,6 +50,10 @@ class ByActivityTypeAggregator implements AggregatorInterface
|
||||
{
|
||||
// No form needed
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
|
@@ -57,6 +57,10 @@ class ByUserJobAggregator implements AggregatorInterface
|
||||
{
|
||||
// nothing to add in the form
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
|
@@ -57,6 +57,10 @@ class ByUserScopeAggregator implements AggregatorInterface
|
||||
{
|
||||
// nothing to add in the form
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
|
@@ -34,6 +34,10 @@ class AvgAsideActivityDuration implements ExportInterface, GroupedExportInterfac
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes(): array
|
||||
{
|
||||
|
@@ -34,6 +34,10 @@ class CountAsideActivity implements ExportInterface, GroupedExportInterface
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes(): array
|
||||
{
|
||||
|
@@ -73,6 +73,10 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes()
|
||||
{
|
||||
|
@@ -34,6 +34,10 @@ class SumAsideActivityDuration implements ExportInterface, GroupedExportInterfac
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes(): array
|
||||
{
|
||||
|
@@ -76,6 +76,10 @@ class ByActivityTypeFilter implements FilterInterface
|
||||
},
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
|
@@ -72,11 +72,9 @@ class ByDateFilter implements FilterInterface
|
||||
$builder
|
||||
->add('date_from', PickRollingDateType::class, [
|
||||
'label' => 'export.filter.Aside activities after this date',
|
||||
'data' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START),
|
||||
])
|
||||
->add('date_to', PickRollingDateType::class, [
|
||||
'label' => 'export.filter.Aside activities before this date',
|
||||
'data' => new RollingDate(RollingDate::T_TODAY),
|
||||
]);
|
||||
|
||||
$builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) {
|
||||
@@ -119,6 +117,10 @@ class ByDateFilter implements FilterInterface
|
||||
}
|
||||
});
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return ['date_from' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START), 'date_to' => new RollingDate(RollingDate::T_TODAY)];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
|
@@ -53,6 +53,10 @@ class ByUserFilter implements FilterInterface
|
||||
'label' => 'Creators',
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
|
@@ -60,6 +60,10 @@ class ByUserJobFilter implements FilterInterface
|
||||
'expanded' => true,
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string')
|
||||
{
|
||||
|
@@ -67,6 +67,10 @@ class ByUserScopeFilter implements FilterInterface
|
||||
'expanded' => true,
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string')
|
||||
{
|
||||
|
@@ -176,11 +176,12 @@ export:
|
||||
agent_id: Utilisateur
|
||||
creator_id: Créateur
|
||||
main_scope: Service principal de l'utilisateur
|
||||
main_center: Centre principal de l'utilisteur
|
||||
main_center: Centre principal de l'utilisateur
|
||||
aside_activity_type: Catégorie d'activité annexe
|
||||
date: Date
|
||||
duration: Durée
|
||||
note: Note
|
||||
id: Identifiant
|
||||
|
||||
Exports of aside activities: Exports des activités annexes
|
||||
Count aside activities: Nombre d'activités annexes
|
||||
|
@@ -58,6 +58,10 @@ final class AgentAggregator implements AggregatorInterface
|
||||
{
|
||||
// no form
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data): Closure
|
||||
{
|
||||
|
@@ -59,6 +59,10 @@ class CancelReasonAggregator implements AggregatorInterface
|
||||
{
|
||||
// no form
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data): Closure
|
||||
{
|
||||
|
@@ -58,6 +58,10 @@ final class JobAggregator implements AggregatorInterface
|
||||
{
|
||||
// no form
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data): Closure
|
||||
{
|
||||
|
@@ -52,6 +52,10 @@ final class LocationAggregator implements AggregatorInterface
|
||||
{
|
||||
// no form
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data): Closure
|
||||
{
|
||||
|
@@ -58,6 +58,10 @@ final class LocationTypeAggregator implements AggregatorInterface
|
||||
{
|
||||
// no form
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data): Closure
|
||||
{
|
||||
|
@@ -40,6 +40,10 @@ class MonthYearAggregator implements AggregatorInterface
|
||||
{
|
||||
// No form needed
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data): Closure
|
||||
{
|
||||
|
@@ -58,6 +58,10 @@ final class ScopeAggregator implements AggregatorInterface
|
||||
{
|
||||
// no form
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data): Closure
|
||||
{
|
||||
|
@@ -56,6 +56,10 @@ class UrgencyAggregator implements AggregatorInterface
|
||||
{
|
||||
// no form
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data): Closure
|
||||
{
|
||||
|
@@ -36,6 +36,10 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
// No form necessary
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes(): array
|
||||
{
|
||||
|
@@ -36,6 +36,10 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
// no form needed
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes(): array
|
||||
{
|
||||
|
@@ -36,6 +36,10 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
// no form needed
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes(): array
|
||||
{
|
||||
|
@@ -63,6 +63,10 @@ class AgentFilter implements FilterInterface
|
||||
'expanded' => true,
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
|
@@ -60,12 +60,12 @@ class BetweenDatesFilter implements FilterInterface
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder
|
||||
->add('date_from', PickRollingDateType::class, [
|
||||
'data' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START),
|
||||
])
|
||||
->add('date_to', PickRollingDateType::class, [
|
||||
'data' => new RollingDate(RollingDate::T_TODAY),
|
||||
]);
|
||||
->add('date_from', PickRollingDateType::class, [])
|
||||
->add('date_to', PickRollingDateType::class, []);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return ['date_from' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START), 'date_to' => new RollingDate(RollingDate::T_TODAY)];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
|
@@ -69,9 +69,12 @@ class CalendarRangeFilter implements FilterInterface
|
||||
'multiple' => false,
|
||||
'expanded' => true,
|
||||
'empty_data' => self::DEFAULT_CHOICE,
|
||||
'data' => self::DEFAULT_CHOICE,
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return ['hasCalendarRange' => self::DEFAULT_CHOICE];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
|
@@ -76,6 +76,10 @@ class JobFilter implements FilterInterface
|
||||
'expanded' => true,
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
|
@@ -76,6 +76,10 @@ class ScopeFilter implements FilterInterface
|
||||
'expanded' => true,
|
||||
]);
|
||||
}
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string')
|
||||
{
|
||||
|
@@ -0,0 +1 @@
|
||||
import './scss/badge.scss';
|
@@ -0,0 +1,25 @@
|
||||
@import '~ChillPersonAssets/chill/scss/mixins.scss';
|
||||
@import '~ChillMainAssets/module/bootstrap/shared';
|
||||
|
||||
.badge-calendar {
|
||||
display: inline-block;
|
||||
background-color: #f3f3f3;
|
||||
|
||||
.title_label {
|
||||
@include chill_badge($chill-l-gray);
|
||||
}
|
||||
|
||||
.title_action {
|
||||
padding: var(--bs-badge-padding-y) var(--bs-badge-padding-x);
|
||||
margin-right: 1rem;
|
||||
|
||||
font-size: var(--bs-badge-font-size);
|
||||
font-weight: var(--bs-badge-font-weight);
|
||||
line-height: 1;
|
||||
color: var(--bs-badge-color);
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
}
|
||||
|
@@ -17,4 +17,4 @@ span.calendarRangeItems {
|
||||
text-decoration: none;
|
||||
padding: 3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,75 @@
|
||||
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
|
||||
{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}
|
||||
{% import '@ChillPerson/Macro/updatedBy.html.twig' as mmm %}
|
||||
|
||||
{% set c = document.calendar %}
|
||||
|
||||
<div class="item-bloc">
|
||||
<div class="item-row">
|
||||
<div class="item-col" style="width: unset">
|
||||
{% if document.storedObject.isPending %}
|
||||
<div class="badge text-bg-info" data-docgen-is-pending="{{ document.storedObject.id }}">{{ 'docgen.Doc generation is pending'|trans }}</div>
|
||||
{% elseif document.storedObject.isFailure %}
|
||||
<div class="badge text-bg-warning">{{ 'docgen.Doc generation failed'|trans }}</div>
|
||||
{% endif %}
|
||||
|
||||
<div>
|
||||
{% if c.accompanyingPeriod is not null and context == 'person' %}
|
||||
<span class="badge bg-primary">
|
||||
<i class="fa fa-random"></i> {{ c.accompanyingPeriod.id }}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
<span class="badge-calendar">
|
||||
<span class="title_label"></span>
|
||||
<span class="title_action">
|
||||
{{ 'Calendar'|trans }}
|
||||
{% if c.endDate.diff(c.startDate).days >= 1 %}
|
||||
{{ c.startDate|format_datetime('short', 'short') }}
|
||||
- {{ c.endDate|format_datetime('short', 'short') }}
|
||||
{% else %}
|
||||
{{ c.startDate|format_datetime('short', 'short') }}
|
||||
- {{ c.endDate|format_datetime('none', 'short') }}
|
||||
{% endif %}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="denomination h2">
|
||||
{{ document.storedObject.title|chill_print_or_message("No title") }}
|
||||
</div>
|
||||
{% if document.storedObject.hasTemplate %}
|
||||
<div>
|
||||
<p>{{ document.storedObject.template.name|localize_translatable_string }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="item-col">
|
||||
<div class="container">
|
||||
<div class="dates row text-end">
|
||||
<span>{{ document.storedObject.createdAt|format_date('short') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="item-row separator">
|
||||
<div class="item-col item-meta">
|
||||
{{ mmm.createdBy(document) }}
|
||||
</div>
|
||||
<ul class="item-col record_actions flex-shrink-1">
|
||||
{% if is_granted('CHILL_CALENDAR_DOC_SEE', document) %}
|
||||
<li>
|
||||
{{ document.storedObject|chill_document_button_group(document.storedObject.title, is_granted('CHILL_CALENDAR_CALENDAR_EDIT', c)) }}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if is_granted('CHILL_CALENDAR_CALENDAR_EDIT', c) %}
|
||||
<li>
|
||||
<a href="{{ chill_path_add_return_path('chill_calendar_calendar_edit', {'id': c.id, 'docId': document.id}) }}" class="btn btn-edit"></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
@@ -0,0 +1,192 @@
|
||||
<?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\CalendarBundle\Service\GenericDoc\Providers;
|
||||
|
||||
use Chill\CalendarBundle\Entity\Calendar;
|
||||
use Chill\CalendarBundle\Entity\CalendarDoc;
|
||||
use Chill\CalendarBundle\Security\Voter\CalendarVoter;
|
||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||
use Chill\DocStoreBundle\GenericDoc\FetchQuery;
|
||||
use Chill\DocStoreBundle\GenericDoc\FetchQueryInterface;
|
||||
use Chill\DocStoreBundle\GenericDoc\GenericDocForAccompanyingPeriodProviderInterface;
|
||||
use Chill\DocStoreBundle\GenericDoc\GenericDocForPersonProviderInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Mapping\MappingException;
|
||||
use Service\GenericDoc\Providers\AccompanyingPeriodCalendarGenericDocProviderTest;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
/**
|
||||
* @see AccompanyingPeriodCalendarGenericDocProviderTest
|
||||
*/
|
||||
final readonly class AccompanyingPeriodCalendarGenericDocProvider implements GenericDocForAccompanyingPeriodProviderInterface, GenericDocForPersonProviderInterface
|
||||
{
|
||||
public const KEY = 'accompanying_period_calendar_document';
|
||||
|
||||
public function __construct(
|
||||
private Security $security,
|
||||
private EntityManagerInterface $em
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws MappingException
|
||||
*/
|
||||
public function buildFetchQueryForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface
|
||||
{
|
||||
$classMetadata = $this->em->getClassMetadata(CalendarDoc::class);
|
||||
$storedObjectMetadata = $this->em->getClassMetadata(StoredObject::class);
|
||||
$calendarMetadata = $this->em->getClassMetadata(Calendar::class);
|
||||
|
||||
$query = new FetchQuery(
|
||||
self::KEY,
|
||||
sprintf("jsonb_build_object('id', cd.%s)", $classMetadata->getColumnName('id')),
|
||||
'cd.'.$storedObjectMetadata->getColumnName('createdAt'),
|
||||
$classMetadata->getSchemaName().'.'.$classMetadata->getTableName().' AS cd'
|
||||
);
|
||||
$query->addJoinClause(
|
||||
sprintf(
|
||||
'JOIN %s doc_store ON doc_store.%s = cd.%s',
|
||||
$storedObjectMetadata->getSchemaName().'.'.$storedObjectMetadata->getTableName(),
|
||||
$storedObjectMetadata->getColumnName('id'),
|
||||
$classMetadata->getSingleAssociationJoinColumnName('storedObject')
|
||||
)
|
||||
);
|
||||
|
||||
$query->addJoinClause(
|
||||
sprintf(
|
||||
'JOIN %s calendar ON calendar.%s = cd.%s',
|
||||
$calendarMetadata->getSchemaName().'.'.$calendarMetadata->getTableName(),
|
||||
$calendarMetadata->getColumnName('id'),
|
||||
$classMetadata->getSingleAssociationJoinColumnName('calendar')
|
||||
)
|
||||
);
|
||||
|
||||
$query->addWhereClause(
|
||||
sprintf(
|
||||
'calendar.%s = ?',
|
||||
$calendarMetadata->getAssociationMapping('accompanyingPeriod')['joinColumns'][0]['name']
|
||||
),
|
||||
[$accompanyingPeriod->getId()],
|
||||
[Types::INTEGER]
|
||||
);
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function isAllowedForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod): bool
|
||||
{
|
||||
return $this->security->isGranted(CalendarVoter::SEE, $accompanyingPeriod);
|
||||
}
|
||||
|
||||
public function buildFetchQueryForPerson(Person $person, ?DateTimeImmutable $startDate = null, ?DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface
|
||||
{
|
||||
$classMetadata = $this->em->getClassMetadata(CalendarDoc::class);
|
||||
$storedObjectMetadata = $this->em->getClassMetadata(StoredObject::class);
|
||||
$calendarMetadata = $this->em->getClassMetadata(Calendar::class);
|
||||
|
||||
$query = new FetchQuery(
|
||||
self::KEY,
|
||||
sprintf("jsonb_build_object('id', cd.%s)", $classMetadata->getColumnName('id')),
|
||||
'cd.'.$storedObjectMetadata->getColumnName('createdAt'),
|
||||
$classMetadata->getSchemaName().'.'.$classMetadata->getTableName().' AS cd'
|
||||
);
|
||||
$query->addJoinClause(
|
||||
sprintf(
|
||||
'JOIN %s doc_store ON doc_store.%s = cd.%s',
|
||||
$storedObjectMetadata->getSchemaName().'.'.$storedObjectMetadata->getTableName(),
|
||||
$storedObjectMetadata->getColumnName('id'),
|
||||
$classMetadata->getSingleAssociationJoinColumnName('storedObject')
|
||||
)
|
||||
);
|
||||
|
||||
$query->addJoinClause(
|
||||
sprintf(
|
||||
'JOIN %s calendar ON calendar.%s = cd.%s',
|
||||
$calendarMetadata->getSchemaName().'.'.$calendarMetadata->getTableName(),
|
||||
$calendarMetadata->getColumnName('id'),
|
||||
$classMetadata->getSingleAssociationJoinColumnName('calendar')
|
||||
)
|
||||
);
|
||||
|
||||
// get the documents associated with accompanying periods in which person participates
|
||||
$or = [];
|
||||
$orParams = [];
|
||||
$orTypes = [];
|
||||
foreach ($person->getAccompanyingPeriodParticipations() as $participation) {
|
||||
if (!$this->security->isGranted(CalendarVoter::SEE, $participation->getAccompanyingPeriod())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$or[] = sprintf(
|
||||
'(calendar.%s = ? AND cd.%s BETWEEN ?::date AND COALESCE(?::date, \'infinity\'::date))',
|
||||
$calendarMetadata->getSingleAssociationJoinColumnName('accompanyingPeriod'),
|
||||
$storedObjectMetadata->getColumnName('createdAt')
|
||||
);
|
||||
$orParams = [...$orParams, $participation->getAccompanyingPeriod()->getId(),
|
||||
DateTimeImmutable::createFromInterface($participation->getStartDate()),
|
||||
null === $participation->getEndDate() ? null : DateTimeImmutable::createFromInterface($participation->getEndDate())];
|
||||
$orTypes = [...$orTypes, Types::INTEGER, Types::DATE_IMMUTABLE, Types::DATE_IMMUTABLE];
|
||||
}
|
||||
|
||||
if ([] === $or) {
|
||||
$query->addWhereClause('TRUE = FALSE');
|
||||
|
||||
return $query;
|
||||
}
|
||||
return $this->addWhereClausesToQuery($query, $startDate, $endDate, $content);
|
||||
}
|
||||
|
||||
public function isAllowedForPerson(Person $person): bool
|
||||
{
|
||||
// check that the person is allowed to see an accompanying period. If yes, the
|
||||
// ACL on each accompanying period will be checked when the query is build
|
||||
return $this->security->isGranted(AccompanyingPeriodVoter::SEE, $person);
|
||||
}
|
||||
|
||||
private function addWhereClausesToQuery(FetchQuery $query, ?DateTimeImmutable $startDate, ?DateTimeImmutable $endDate, ?string $content): FetchQuery
|
||||
{
|
||||
$storedObjectMetadata = $this->em->getClassMetadata(StoredObject::class);
|
||||
|
||||
if (null !== $startDate) {
|
||||
$query->addWhereClause(
|
||||
sprintf('doc_store.%s >= ?', $storedObjectMetadata->getColumnName('createdAt')),
|
||||
[$startDate],
|
||||
[Types::DATE_IMMUTABLE]
|
||||
);
|
||||
}
|
||||
|
||||
if (null !== $endDate) {
|
||||
$query->addWhereClause(
|
||||
sprintf('doc_store.%s < ?', $storedObjectMetadata->getColumnName('createdAt')),
|
||||
[$endDate],
|
||||
[Types::DATE_IMMUTABLE]
|
||||
);
|
||||
}
|
||||
|
||||
if (null !== $content) {
|
||||
$query->addWhereClause(
|
||||
sprintf('doc_store.%s ilike ?', $storedObjectMetadata->getColumnName('title')),
|
||||
['%' . $content . '%'],
|
||||
[Types::STRING]
|
||||
);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,126 @@
|
||||
<?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\CalendarBundle\Service\GenericDoc\Providers;
|
||||
|
||||
use Chill\CalendarBundle\Entity\Calendar;
|
||||
use Chill\CalendarBundle\Entity\CalendarDoc;
|
||||
use Chill\CalendarBundle\Security\Voter\CalendarVoter;
|
||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||
use Chill\DocStoreBundle\GenericDoc\FetchQuery;
|
||||
use Chill\DocStoreBundle\GenericDoc\FetchQueryInterface;
|
||||
use Chill\DocStoreBundle\GenericDoc\GenericDocForPersonProviderInterface;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodWorkVoter;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Mapping\MappingException;
|
||||
use Service\GenericDoc\Providers\PersonCalendarGenericDocProviderTest;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
/**
|
||||
* Provide calendar documents for calendar associated to persons
|
||||
*
|
||||
* @see PersonCalendarGenericDocProviderTest
|
||||
*/
|
||||
final readonly class PersonCalendarGenericDocProvider implements GenericDocForPersonProviderInterface
|
||||
{
|
||||
public const KEY = 'person_calendar_document';
|
||||
|
||||
public function __construct(
|
||||
private Security $security,
|
||||
private EntityManagerInterface $em
|
||||
) {
|
||||
}
|
||||
|
||||
private function addWhereClausesToQuery(FetchQuery $query, ?\DateTimeImmutable $startDate = null, ?\DateTimeImmutable $endDate = null, ?string $content = null): FetchQuery
|
||||
{
|
||||
$storedObjectMetadata = $this->em->getClassMetadata(StoredObject::class);
|
||||
|
||||
if (null !== $startDate) {
|
||||
$query->addWhereClause(
|
||||
sprintf('doc_store.%s >= ?', $storedObjectMetadata->getColumnName('createdAt')),
|
||||
[$startDate],
|
||||
[Types::DATE_IMMUTABLE]
|
||||
);
|
||||
}
|
||||
|
||||
if (null !== $endDate) {
|
||||
$query->addWhereClause(
|
||||
sprintf('doc_store.%s < ?', $storedObjectMetadata->getColumnName('createdAt')),
|
||||
[$endDate],
|
||||
[Types::DATE_IMMUTABLE]
|
||||
);
|
||||
}
|
||||
|
||||
if (null !== $content) {
|
||||
$query->addWhereClause(
|
||||
sprintf('doc_store.%s ilike ?', $storedObjectMetadata->getColumnName('title')),
|
||||
['%' . $content . '%'],
|
||||
[Types::STRING]
|
||||
);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws MappingException
|
||||
*/
|
||||
public function buildFetchQueryForPerson(Person $person, ?DateTimeImmutable $startDate = null, ?DateTimeImmutable $endDate = null, ?string $content = null, ?string $origin = null): FetchQueryInterface
|
||||
{
|
||||
$classMetadata = $this->em->getClassMetadata(CalendarDoc::class);
|
||||
$storedObjectMetadata = $this->em->getClassMetadata(StoredObject::class);
|
||||
$calendarMetadata = $this->em->getClassMetadata(Calendar::class);
|
||||
|
||||
$query = new FetchQuery(
|
||||
self::KEY,
|
||||
sprintf("jsonb_build_object('id', cd.%s)", $classMetadata->getColumnName('id')),
|
||||
'cd.'.$storedObjectMetadata->getColumnName('createdAt'),
|
||||
$classMetadata->getSchemaName().'.'.$classMetadata->getTableName().' AS cd'
|
||||
);
|
||||
$query->addJoinClause(
|
||||
sprintf(
|
||||
'JOIN %s doc_store ON doc_store.%s = cd.%s',
|
||||
$storedObjectMetadata->getSchemaName().'.'.$storedObjectMetadata->getTableName(),
|
||||
$storedObjectMetadata->getColumnName('id'),
|
||||
$classMetadata->getSingleAssociationJoinColumnName('storedObject')
|
||||
)
|
||||
);
|
||||
|
||||
$query->addJoinClause(
|
||||
sprintf(
|
||||
'JOIN %s calendar ON calendar.%s = cd.%s',
|
||||
$calendarMetadata->getSchemaName().'.'.$calendarMetadata->getTableName(),
|
||||
$calendarMetadata->getColumnName('id'),
|
||||
$classMetadata->getSingleAssociationJoinColumnName('calendar')
|
||||
)
|
||||
);
|
||||
|
||||
$query->addWhereClause(
|
||||
sprintf('calendar.%s = ?', $calendarMetadata->getSingleAssociationJoinColumnName('person')),
|
||||
[$person->getId()],
|
||||
[Types::INTEGER]
|
||||
);
|
||||
|
||||
return $this->addWhereClausesToQuery($query, $startDate, $endDate, $content);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Person $person
|
||||
* @return bool
|
||||
*/
|
||||
public function isAllowedForPerson(Person $person): bool
|
||||
{
|
||||
return $this->security->isGranted(CalendarVoter::SEE, $person);
|
||||
}
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
<?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\CalendarBundle\Service\GenericDoc\Renderers;
|
||||
|
||||
use Chill\CalendarBundle\Repository\CalendarDocRepository;
|
||||
use Chill\CalendarBundle\Service\GenericDoc\Providers\AccompanyingPeriodCalendarGenericDocProvider;
|
||||
use Chill\CalendarBundle\Service\GenericDoc\Providers\PersonCalendarGenericDocProvider;
|
||||
use Chill\DocStoreBundle\GenericDoc\GenericDocDTO;
|
||||
use Chill\DocStoreBundle\GenericDoc\Twig\GenericDocRendererInterface;
|
||||
|
||||
final class AccompanyingPeriodCalendarGenericDocRenderer implements GenericDocRendererInterface
|
||||
{
|
||||
private CalendarDocRepository $repository;
|
||||
|
||||
public function __construct(CalendarDocRepository $calendarDocRepository)
|
||||
{
|
||||
$this->repository = $calendarDocRepository;
|
||||
}
|
||||
|
||||
public function supports(GenericDocDTO $genericDocDTO, $options = []): bool
|
||||
{
|
||||
return $genericDocDTO->key === AccompanyingPeriodCalendarGenericDocProvider::KEY || $genericDocDTO->key === PersonCalendarGenericDocProvider::KEY;
|
||||
}
|
||||
|
||||
public function getTemplate(GenericDocDTO $genericDocDTO, $options = []): string
|
||||
{
|
||||
return '@ChillCalendar/GenericDoc/calendar_document.html.twig';
|
||||
}
|
||||
|
||||
public function getTemplateData(GenericDocDTO $genericDocDTO, $options = []): array
|
||||
{
|
||||
return [
|
||||
'document' => $this->repository->find($genericDocDTO->identifiers['id']),
|
||||
'context' => $genericDocDTO->getContext(),
|
||||
];
|
||||
}
|
||||
}
|
@@ -1,6 +1,8 @@
|
||||
// this file loads all assets from the Chill calendar bundle
|
||||
module.exports = function(encore, entries) {
|
||||
|
||||
entries.push(__dirname + '/Resources/public/chill/chill.js');
|
||||
|
||||
encore.addAliases({
|
||||
ChillCalendarAssets: __dirname + '/Resources/public'
|
||||
});
|
||||
|
@@ -43,6 +43,7 @@ crud:
|
||||
title_edit: Modifier le motif d'annulation
|
||||
|
||||
chill_calendar:
|
||||
Document: Document d'un rendez-vous
|
||||
form:
|
||||
The main user is mandatory. He will organize the appointment.: L'utilisateur principal est obligatoire. Il est l'organisateur de l'événement.
|
||||
Create for referrer: Créer pour le référent
|
||||
@@ -65,6 +66,7 @@ chill_calendar:
|
||||
Document outdated: La date et l'heure du rendez-vous ont été modifiés après la création du document
|
||||
|
||||
|
||||
|
||||
remote_ms_graph:
|
||||
freebusy_statuses:
|
||||
busy: Occupé
|
||||
@@ -145,3 +147,9 @@ CHILL_CALENDAR_CALENDAR_EDIT: Modifier les rendez-vous
|
||||
CHILL_CALENDAR_CALENDAR_DELETE: Supprimer les rendez-vous
|
||||
CHILL_CALENDAR_CALENDAR_SEE: Voir les rendez-vous
|
||||
|
||||
|
||||
generic_doc:
|
||||
filter:
|
||||
keys:
|
||||
accompanying_period_calendar_document: Document des rendez-vous des parcours
|
||||
person_calendar_document: Document des rendez-vous de l'usager
|
||||
|
@@ -11,8 +11,21 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\DocStoreBundle;
|
||||
|
||||
use Chill\DocStoreBundle\GenericDoc\GenericDocForAccompanyingPeriodProviderInterface;
|
||||
use Chill\DocStoreBundle\GenericDoc\GenericDocForPersonProviderInterface;
|
||||
use Chill\DocStoreBundle\GenericDoc\Twig\GenericDocRendererInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
|
||||
class ChillDocStoreBundle extends Bundle
|
||||
{
|
||||
public function build(ContainerBuilder $container)
|
||||
{
|
||||
$container->registerForAutoconfiguration(GenericDocForAccompanyingPeriodProviderInterface::class)
|
||||
->addTag('chill_doc_store.generic_doc_accompanying_period_provider');
|
||||
$container->registerForAutoconfiguration(GenericDocForPersonProviderInterface::class)
|
||||
->addTag('chill_doc_store.generic_doc_person_provider');
|
||||
$container->registerForAutoconfiguration(GenericDocRendererInterface::class)
|
||||
->addTag('chill_doc_store.generic_doc_renderer');
|
||||
}
|
||||
}
|
||||
|
@@ -39,10 +39,6 @@ class DocumentAccompanyingCourseController extends AbstractController
|
||||
|
||||
protected TranslatorInterface $translator;
|
||||
|
||||
private AccompanyingCourseDocumentRepository $courseRepository;
|
||||
|
||||
private PaginatorFactory $paginatorFactory;
|
||||
|
||||
/**
|
||||
* DocumentAccompanyingCourseController constructor.
|
||||
*/
|
||||
@@ -50,14 +46,10 @@ class DocumentAccompanyingCourseController extends AbstractController
|
||||
TranslatorInterface $translator,
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
AuthorizationHelper $authorizationHelper,
|
||||
PaginatorFactory $paginatorFactory,
|
||||
AccompanyingCourseDocumentRepository $courseRepository
|
||||
) {
|
||||
$this->translator = $translator;
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->authorizationHelper = $authorizationHelper;
|
||||
$this->paginatorFactory = $paginatorFactory;
|
||||
$this->courseRepository = $courseRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,7 +74,7 @@ class DocumentAccompanyingCourseController extends AbstractController
|
||||
return $this->redirect($request->query->get('returnPath'));
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('accompanying_course_document_index', ['course' => $course->getId()]);
|
||||
return $this->redirectToRoute('chill_docstore_generic-doc_by-period_index', ['id' => $course->getId()]);
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
@@ -136,40 +128,6 @@ class DocumentAccompanyingCourseController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/", name="accompanying_course_document_index", methods="GET")
|
||||
*/
|
||||
public function index(AccompanyingPeriod $course): Response
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
if (null === $course) {
|
||||
throw $this->createNotFoundException('Accompanying period not found');
|
||||
}
|
||||
|
||||
$this->denyAccessUnlessGranted(AccompanyingCourseDocumentVoter::SEE, $course);
|
||||
|
||||
$total = $this->courseRepository->countByCourse($course);
|
||||
$pagination = $this->paginatorFactory->create($total);
|
||||
|
||||
$documents = $this->courseRepository
|
||||
->findBy(
|
||||
['course' => $course],
|
||||
['date' => 'DESC', 'id' => 'DESC'],
|
||||
$pagination->getItemsPerPage(),
|
||||
$pagination->getCurrentPageFirstItemNumber()
|
||||
);
|
||||
|
||||
return $this->render(
|
||||
'ChillDocStoreBundle:AccompanyingCourseDocument:index.html.twig',
|
||||
[
|
||||
'documents' => $documents,
|
||||
'accompanyingCourse' => $course,
|
||||
'pagination' => $pagination,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/new", name="accompanying_course_document_new", methods="GET|POST")
|
||||
*/
|
||||
@@ -202,7 +160,7 @@ class DocumentAccompanyingCourseController extends AbstractController
|
||||
|
||||
$this->addFlash('success', $this->translator->trans('The document is successfully registered'));
|
||||
|
||||
return $this->redirectToRoute('accompanying_course_document_index', ['course' => $course->getId()]);
|
||||
return $this->redirectToRoute('chill_docstore_generic-doc_by-period_index', ['id' => $course->getId()]);
|
||||
}
|
||||
|
||||
if ($form->isSubmitted() && !$form->isValid()) {
|
||||
|
@@ -45,10 +45,6 @@ class DocumentPersonController extends AbstractController
|
||||
|
||||
protected TranslatorInterface $translator;
|
||||
|
||||
private PaginatorFactory $paginatorFactory;
|
||||
|
||||
private PersonDocumentACLAwareRepositoryInterface $personDocumentACLAwareRepository;
|
||||
|
||||
/**
|
||||
* DocumentPersonController constructor.
|
||||
*/
|
||||
@@ -56,14 +52,10 @@ class DocumentPersonController extends AbstractController
|
||||
TranslatorInterface $translator,
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
AuthorizationHelper $authorizationHelper,
|
||||
PaginatorFactory $paginatorFactory,
|
||||
PersonDocumentACLAwareRepositoryInterface $personDocumentACLAwareRepository
|
||||
) {
|
||||
$this->translator = $translator;
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->authorizationHelper = $authorizationHelper;
|
||||
$this->paginatorFactory = $paginatorFactory;
|
||||
$this->personDocumentACLAwareRepository = $personDocumentACLAwareRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,7 +80,7 @@ class DocumentPersonController extends AbstractController
|
||||
return $this->redirect($request->query->get('returnPath'));
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('person_document_index', ['person' => $person->getId()]);
|
||||
return $this->redirectToRoute('chill_docstore_generic-doc_by-person_index', ['id' => $person->getId()]);
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
@@ -160,45 +152,6 @@ class DocumentPersonController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/", name="person_document_index", methods="GET")
|
||||
*/
|
||||
public function index(Person $person): Response
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
if (null === $person) {
|
||||
throw $this->createNotFoundException('Person not found');
|
||||
}
|
||||
|
||||
$this->denyAccessUnlessGranted(PersonVoter::SEE, $person);
|
||||
|
||||
$total = $this->personDocumentACLAwareRepository->countByPerson($person);
|
||||
$pagination = $this->paginatorFactory->create($total);
|
||||
|
||||
$documents = $this->personDocumentACLAwareRepository->findByPerson(
|
||||
$person,
|
||||
['date' => 'DESC', 'id' => 'DESC'],
|
||||
$pagination->getItemsPerPage(),
|
||||
$pagination->getCurrentPageFirstItemNumber()
|
||||
);
|
||||
|
||||
$event = new PrivacyEvent($person, [
|
||||
'element_class' => PersonDocument::class,
|
||||
'action' => 'index',
|
||||
]);
|
||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||
|
||||
return $this->render(
|
||||
'ChillDocStoreBundle:PersonDocument:index.html.twig',
|
||||
[
|
||||
'documents' => $documents,
|
||||
'person' => $person,
|
||||
'pagination' => $pagination,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/new", name="person_document_new", methods="GET|POST")
|
||||
*/
|
||||
@@ -233,7 +186,7 @@ class DocumentPersonController extends AbstractController
|
||||
|
||||
$this->addFlash('success', $this->translator->trans('The document is successfully registered'));
|
||||
|
||||
return $this->redirectToRoute('person_document_index', ['person' => $person->getId()]);
|
||||
return $this->redirectToRoute('chill_docstore_generic-doc_by-person_index', ['id' => $person->getId()]);
|
||||
}
|
||||
|
||||
if ($form->isSubmitted() && !$form->isValid()) {
|
||||
|
@@ -0,0 +1,98 @@
|
||||
<?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\DocStoreBundle\Controller;
|
||||
|
||||
use Chill\DocStoreBundle\GenericDoc\Manager;
|
||||
use Chill\DocStoreBundle\Security\Authorization\AccompanyingCourseDocumentVoter;
|
||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||
use Chill\MainBundle\Templating\Listing\FilterOrderHelperFactory;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Symfony\Bundle\TwigBundle\TwigEngine;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\Templating\EngineInterface;
|
||||
|
||||
final readonly class GenericDocForAccompanyingPeriodController
|
||||
{
|
||||
public function __construct(
|
||||
private FilterOrderHelperFactory $filterOrderHelperFactory,
|
||||
private Manager $manager,
|
||||
private PaginatorFactory $paginator,
|
||||
private Security $security,
|
||||
private EngineInterface $twig,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AccompanyingPeriod $accompanyingPeriod
|
||||
* @return Response
|
||||
* @throws \Doctrine\DBAL\Exception
|
||||
*
|
||||
* @Route("/{_locale}/doc-store/generic-doc/by-period/{id}/index", name="chill_docstore_generic-doc_by-period_index")
|
||||
*/
|
||||
public function list(AccompanyingPeriod $accompanyingPeriod): Response
|
||||
{
|
||||
if (!$this->security->isGranted(AccompanyingCourseDocumentVoter::SEE, $accompanyingPeriod)) {
|
||||
throw new AccessDeniedHttpException("not allowed to see the documents for accompanying period");
|
||||
}
|
||||
|
||||
$filterBuilder = $this->filterOrderHelperFactory
|
||||
->create(self::class)
|
||||
->addSearchBox()
|
||||
->addDateRange('dateRange', 'generic_doc.filter.date-range');
|
||||
|
||||
if ([] !== $places = $this->manager->placesForAccompanyingPeriod($accompanyingPeriod)) {
|
||||
$filterBuilder->addCheckbox('places', $places, [], array_map(
|
||||
static fn (string $k) => 'generic_doc.filter.keys.' . $k,
|
||||
$places
|
||||
));
|
||||
}
|
||||
|
||||
$filter = $filterBuilder
|
||||
->build();
|
||||
|
||||
['to' => $endDate, 'from' => $startDate ] = $filter->getDateRangeData('dateRange');
|
||||
$content = $filter->getQueryString();
|
||||
|
||||
$nb = $this->manager->countDocForAccompanyingPeriod(
|
||||
$accompanyingPeriod,
|
||||
$startDate,
|
||||
$endDate,
|
||||
$content,
|
||||
$filter->hasCheckBox('places') ? array_values($filter->getCheckboxData('places')) : []
|
||||
);
|
||||
$paginator = $this->paginator->create($nb);
|
||||
|
||||
$documents = $this->manager->findDocForAccompanyingPeriod(
|
||||
$accompanyingPeriod,
|
||||
$paginator->getCurrentPageFirstItemNumber(),
|
||||
$paginator->getItemsPerPage(),
|
||||
$startDate,
|
||||
$endDate,
|
||||
$content,
|
||||
$filter->hasCheckBox('places') ? array_values($filter->getCheckboxData('places')) : []
|
||||
);
|
||||
|
||||
return new Response($this->twig->render(
|
||||
'@ChillDocStore/GenericDoc/accompanying_period_list.html.twig',
|
||||
[
|
||||
'accompanyingCourse' => $accompanyingPeriod,
|
||||
'pagination' => $paginator,
|
||||
'documents' => iterator_to_array($documents),
|
||||
'filter' => $filter,
|
||||
]
|
||||
));
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,95 @@
|
||||
<?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\DocStoreBundle\Controller;
|
||||
|
||||
use Chill\DocStoreBundle\GenericDoc\Manager;
|
||||
use Chill\DocStoreBundle\Security\Authorization\PersonDocumentVoter;
|
||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||
use Chill\MainBundle\Templating\Listing\FilterOrderHelperFactory;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\Templating\EngineInterface;
|
||||
|
||||
final readonly class GenericDocForPerson
|
||||
{
|
||||
public function __construct(
|
||||
private FilterOrderHelperFactory $filterOrderHelperFactory,
|
||||
private Manager $manager,
|
||||
private PaginatorFactory $paginator,
|
||||
private Security $security,
|
||||
private EngineInterface $twig,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Doctrine\DBAL\Exception
|
||||
*
|
||||
* @Route("/{_locale}/doc-store/generic-doc/by-person/{id}/index", name="chill_docstore_generic-doc_by-person_index")
|
||||
*/
|
||||
public function list(Person $person): Response
|
||||
{
|
||||
if (!$this->security->isGranted(PersonDocumentVoter::SEE, $person)) {
|
||||
throw new AccessDeniedHttpException("not allowed to see the documents for person");
|
||||
}
|
||||
|
||||
$filterBuilder = $this->filterOrderHelperFactory
|
||||
->create(self::class)
|
||||
->addSearchBox()
|
||||
->addDateRange('dateRange', 'generic_doc.filter.date-range');
|
||||
|
||||
if ([] !== $places = $this->manager->placesForPerson($person)) {
|
||||
$filterBuilder->addCheckbox('places', $places, [], array_map(
|
||||
static fn (string $k) => 'generic_doc.filter.keys.' . $k,
|
||||
$places
|
||||
));
|
||||
}
|
||||
|
||||
$filter = $filterBuilder
|
||||
->build();
|
||||
|
||||
['to' => $endDate, 'from' => $startDate ] = $filter->getDateRangeData('dateRange');
|
||||
$content = $filter->getQueryString();
|
||||
|
||||
$nb = $this->manager->countDocForPerson(
|
||||
$person,
|
||||
$startDate,
|
||||
$endDate,
|
||||
$content,
|
||||
$filter->hasCheckBox('places') ? array_values($filter->getCheckboxData('places')) : []
|
||||
);
|
||||
$paginator = $this->paginator->create($nb);
|
||||
|
||||
$documents = $this->manager->findDocForPerson(
|
||||
$person,
|
||||
$paginator->getCurrentPageFirstItemNumber(),
|
||||
$paginator->getItemsPerPage(),
|
||||
$startDate,
|
||||
$endDate,
|
||||
$content,
|
||||
$filter->hasCheckBox('places') ? array_values($filter->getCheckboxData('places')) : []
|
||||
);
|
||||
|
||||
return new Response($this->twig->render(
|
||||
'@ChillDocStore/GenericDoc/person_list.html.twig',
|
||||
[
|
||||
'person' => $person,
|
||||
'pagination' => $paginator,
|
||||
'documents' => iterator_to_array($documents),
|
||||
'filter' => $filter,
|
||||
]
|
||||
));
|
||||
}
|
||||
|
||||
}
|
233
src/Bundle/ChillDocStoreBundle/GenericDoc/FetchQuery.php
Normal file
233
src/Bundle/ChillDocStoreBundle/GenericDoc/FetchQuery.php
Normal file
@@ -0,0 +1,233 @@
|
||||
<?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\DocStoreBundle\GenericDoc;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
|
||||
class FetchQuery implements FetchQueryInterface
|
||||
{
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
private array $joins = [];
|
||||
|
||||
/**
|
||||
* @var list<list<mixed>>
|
||||
*/
|
||||
private array $joinParams = [];
|
||||
|
||||
/**
|
||||
* @var array<list<Types::*>>
|
||||
*/
|
||||
private array $joinTypes = [];
|
||||
|
||||
/**
|
||||
* @var array<string>
|
||||
*/
|
||||
private array $wheres = [];
|
||||
|
||||
/**
|
||||
* @var array<list<mixed>>
|
||||
*/
|
||||
private array $whereParams = [];
|
||||
|
||||
/**
|
||||
* @var array<list<Types::*>>
|
||||
*/
|
||||
private array $whereTypes = [];
|
||||
|
||||
public function __construct(
|
||||
private readonly string $selectKeyString,
|
||||
private readonly string $selectIdentifierJsonB,
|
||||
private readonly string $selectDate,
|
||||
private string $from = '',
|
||||
private array $selectIdentifierParams = [],
|
||||
private array $selectIdentifierTypes = [],
|
||||
private array $selectDateParams = [],
|
||||
private array $selectDateTypes = [],
|
||||
) {
|
||||
}
|
||||
|
||||
public function addJoinClause(string $sql, array $params = [], array $types = []): int
|
||||
{
|
||||
$this->joins[] = $sql;
|
||||
$this->joinParams[] = $params;
|
||||
$this->joinTypes[] = $types;
|
||||
|
||||
return count($this->joins) - 1;
|
||||
}
|
||||
|
||||
public function addWhereClause(string $sql, array $params = [], array $types = []): int
|
||||
{
|
||||
$this->wheres[] = $sql;
|
||||
$this->whereParams[] = $params;
|
||||
$this->whereTypes[] = $types;
|
||||
|
||||
return count($this->wheres) - 1;
|
||||
}
|
||||
|
||||
public function removeWhereClause(int $index): void
|
||||
{
|
||||
if (!array_key_exists($index, $this->wheres)) {
|
||||
throw new \UnexpectedValueException("this index does not exists");
|
||||
}
|
||||
|
||||
unset($this->wheres[$index], $this->whereParams[$index], $this->whereTypes[$index]);
|
||||
|
||||
}
|
||||
|
||||
public function removeJoinClause(int $index): void
|
||||
{
|
||||
if (!array_key_exists($index, $this->joins)) {
|
||||
throw new \UnexpectedValueException("this index does not exists");
|
||||
}
|
||||
|
||||
unset($this->joins[$index], $this->joinParams[$index], $this->joinTypes[$index]);
|
||||
|
||||
}
|
||||
|
||||
public function getSelectKeyString(): string
|
||||
{
|
||||
return $this->selectKeyString;
|
||||
}
|
||||
|
||||
public function getSelectIdentifierJsonB(): string
|
||||
{
|
||||
return $this->selectIdentifierJsonB;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getSelectIdentifierParams(): array
|
||||
{
|
||||
return $this->selectIdentifierParams;
|
||||
}
|
||||
|
||||
public function getSelectIdentifiersTypes(): array
|
||||
{
|
||||
return $this->selectIdentifierTypes;
|
||||
}
|
||||
|
||||
public function getSelectDate(): string
|
||||
{
|
||||
return $this->selectDate;
|
||||
}
|
||||
|
||||
public function getSelectDateTypes(): array
|
||||
{
|
||||
return $this->selectDateTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getSelectDateParams(): array
|
||||
{
|
||||
return $this->selectDateParams;
|
||||
}
|
||||
|
||||
public function getFromQuery(): string
|
||||
{
|
||||
return $this->from . " " . implode(' ', $this->joins);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getFromQueryParams(): array
|
||||
{
|
||||
$result = [];
|
||||
|
||||
foreach ($this->joinParams as $params) {
|
||||
$result = [...$result, ...$params];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getFromQueryTypes(): array
|
||||
{
|
||||
$result = [];
|
||||
|
||||
foreach ($this->joinTypes as $types) {
|
||||
$result = [...$result, ...$types];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getWhereQuery(): string
|
||||
{
|
||||
return implode(' AND ', $this->wheres);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getWhereQueryParams(): array
|
||||
{
|
||||
$result = [];
|
||||
|
||||
foreach ($this->whereParams as $params) {
|
||||
$result = [...$result, ...$params];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getWhereQueryTypes(): array
|
||||
{
|
||||
$result = [];
|
||||
|
||||
foreach ($this->whereTypes as $types) {
|
||||
$result = [...$result, ...$types];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function setSelectIdentifierParams(array $selectIdentifierParams): self
|
||||
{
|
||||
$this->selectIdentifierParams = $selectIdentifierParams;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setSelectDateParams(array $selectDateParams): self
|
||||
{
|
||||
$this->selectDateParams = $selectDateParams;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setFrom(string $from): self
|
||||
{
|
||||
$this->from = $from;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setSelectIdentifierTypes(array $selectIdentifierTypes): self
|
||||
{
|
||||
$this->selectIdentifierTypes = $selectIdentifierTypes;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setSelectDateTypes(array $selectDateTypes): self
|
||||
{
|
||||
$this->selectDateTypes = $selectDateTypes;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
@@ -0,0 +1,67 @@
|
||||
<?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\DocStoreBundle\GenericDoc;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
|
||||
interface FetchQueryInterface
|
||||
{
|
||||
public function getSelectKeyString(): string;
|
||||
|
||||
public function getSelectIdentifierJsonB(): string;
|
||||
|
||||
/**
|
||||
* @return list<mixed>
|
||||
*/
|
||||
public function getSelectIdentifierParams(): array;
|
||||
|
||||
/**
|
||||
* @return list<Types::*>
|
||||
*/
|
||||
public function getSelectIdentifiersTypes(): array;
|
||||
|
||||
public function getSelectDate(): string;
|
||||
|
||||
/**
|
||||
* @return list<mixed>
|
||||
*/
|
||||
public function getSelectDateParams(): array;
|
||||
|
||||
/**
|
||||
* @return list<Types::*>
|
||||
*/
|
||||
public function getSelectDateTypes(): array;
|
||||
|
||||
public function getFromQuery(): string;
|
||||
|
||||
/**
|
||||
* @return list<mixed>
|
||||
*/
|
||||
public function getFromQueryParams(): array;
|
||||
|
||||
/**
|
||||
* @return list<Types::*>
|
||||
*/
|
||||
public function getFromQueryTypes(): array;
|
||||
|
||||
public function getWhereQuery(): string;
|
||||
|
||||
/**
|
||||
* @return list<mixed>
|
||||
*/
|
||||
public function getWhereQueryParams(): array;
|
||||
|
||||
/**
|
||||
* @return list<Types::*>
|
||||
*/
|
||||
public function getWhereQueryTypes(): array;
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
<?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\DocStoreBundle\GenericDoc;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
|
||||
final readonly class FetchQueryToSqlBuilder
|
||||
{
|
||||
private const SQL = <<<'SQL'
|
||||
SELECT
|
||||
'{{ key }}' AS key,
|
||||
{{ identifiers }} AS identifiers,
|
||||
{{ date }}::date AS doc_date
|
||||
FROM {{ from }}
|
||||
{{ where }}
|
||||
SQL;
|
||||
|
||||
/**
|
||||
* @param FetchQueryInterface $query
|
||||
* @return array{sql: string, params: list<mixed>, types: list<Types::*>}
|
||||
*/
|
||||
public function toSql(FetchQueryInterface $query): array
|
||||
{
|
||||
$sql = strtr(self::SQL, [
|
||||
'{{ key }}' => $query->getSelectKeyString(),
|
||||
'{{ identifiers }}' => $query->getSelectIdentifierJsonB(),
|
||||
'{{ date }}' => $query->getSelectDate(),
|
||||
'{{ from }}' => $query->getFromQuery(),
|
||||
'{{ where }}' => '' === ($w = $query->getWhereQuery()) ? '' : 'WHERE ' . $w,
|
||||
]);
|
||||
|
||||
$params = [
|
||||
...$query->getSelectIdentifierParams(),
|
||||
...$query->getSelectDateParams(),
|
||||
...$query->getFromQueryParams(),
|
||||
...$query->getWhereQueryParams()
|
||||
];
|
||||
|
||||
$types = [
|
||||
...$query->getSelectIdentifiersTypes(),
|
||||
...$query->getSelectDateTypes(),
|
||||
...$query->getFromQueryTypes(),
|
||||
...$query->getWhereQueryTypes(),
|
||||
];
|
||||
|
||||
return ['sql' => $sql, 'params' => $params, 'types' => $types];
|
||||
}
|
||||
}
|
31
src/Bundle/ChillDocStoreBundle/GenericDoc/GenericDocDTO.php
Normal file
31
src/Bundle/ChillDocStoreBundle/GenericDoc/GenericDocDTO.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?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\DocStoreBundle\GenericDoc;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
|
||||
final readonly class GenericDocDTO
|
||||
{
|
||||
public function __construct(
|
||||
public string $key,
|
||||
public array $identifiers,
|
||||
public \DateTimeImmutable $docDate,
|
||||
public AccompanyingPeriod|Person $linked,
|
||||
) {
|
||||
}
|
||||
|
||||
public function getContext(): string
|
||||
{
|
||||
return $this->linked instanceof AccompanyingPeriod ? 'accompanying-period' : 'person';
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
<?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\DocStoreBundle\GenericDoc;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
|
||||
interface GenericDocForAccompanyingPeriodProviderInterface
|
||||
{
|
||||
public function buildFetchQueryForAccompanyingPeriod(
|
||||
AccompanyingPeriod $accompanyingPeriod,
|
||||
?\DateTimeImmutable $startDate = null,
|
||||
?\DateTimeImmutable $endDate = null,
|
||||
?string $content = null,
|
||||
?string $origin = null
|
||||
): FetchQueryInterface;
|
||||
|
||||
/**
|
||||
* Return true if the user is allowed to see some documents for this provider.
|
||||
*/
|
||||
public function isAllowedForAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod): bool;
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user