mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-30 11:33:49 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -27,7 +27,7 @@ class ByActivityNumberAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data): void
|
||||
{
|
||||
$qb
|
||||
->addSelect('(SELECT COUNT(activity.id) FROM ' . Activity::class . ' activity WHERE activity.accompanyingPeriod = acp) AS activity_by_number_aggregator')
|
||||
->addSelect('(SELECT COUNT(activity.id) FROM '.Activity::class.' activity WHERE activity.accompanyingPeriod = acp) AS activity_by_number_aggregator')
|
||||
->addGroupBy('activity_by_number_aggregator');
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ class ByActivityNumberAggregator implements AggregatorInterface
|
||||
{
|
||||
// No form needed
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
|
@@ -17,7 +17,6 @@ use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository;
|
||||
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use function in_array;
|
||||
|
||||
class BySocialActionAggregator implements AggregatorInterface
|
||||
{
|
||||
@@ -30,7 +29,7 @@ class BySocialActionAggregator implements AggregatorInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('actsocialaction', $qb->getAllAliases(), true)) {
|
||||
if (!\in_array('actsocialaction', $qb->getAllAliases(), true)) {
|
||||
$qb->leftJoin('activity.socialActions', 'actsocialaction');
|
||||
}
|
||||
|
||||
@@ -47,6 +46,7 @@ class BySocialActionAggregator implements AggregatorInterface
|
||||
{
|
||||
// no form
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
|
@@ -17,7 +17,6 @@ use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
|
||||
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use function in_array;
|
||||
|
||||
class BySocialIssueAggregator implements AggregatorInterface
|
||||
{
|
||||
@@ -30,7 +29,7 @@ class BySocialIssueAggregator implements AggregatorInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('actsocialissue', $qb->getAllAliases(), true)) {
|
||||
if (!\in_array('actsocialissue', $qb->getAllAliases(), true)) {
|
||||
$qb->leftJoin('activity.socialIssues', 'actsocialissue');
|
||||
}
|
||||
|
||||
@@ -47,6 +46,7 @@ class BySocialIssueAggregator implements AggregatorInterface
|
||||
{
|
||||
// no form
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
|
@@ -12,14 +12,9 @@ declare(strict_types=1);
|
||||
namespace Chill\ActivityBundle\Export\Aggregator;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\ActivityBundle\Repository\ActivityTypeRepositoryInterface;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Repository\LocationRepository;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Closure;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use function in_array;
|
||||
|
||||
final readonly class ActivityLocationAggregator implements AggregatorInterface
|
||||
{
|
||||
@@ -32,7 +27,7 @@ final readonly class ActivityLocationAggregator implements AggregatorInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('actloc', $qb->getAllAliases(), true)) {
|
||||
if (!\in_array('actloc', $qb->getAllAliases(), true)) {
|
||||
$qb->leftJoin('activity.location', 'actloc');
|
||||
}
|
||||
$qb->addSelect(sprintf('actloc.name AS %s', self::KEY));
|
||||
@@ -48,12 +43,13 @@ final readonly class ActivityLocationAggregator implements AggregatorInterface
|
||||
{
|
||||
// no form required for this aggregator
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data): Closure
|
||||
public function getLabels($key, array $values, $data): \Closure
|
||||
{
|
||||
return function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
|
@@ -15,10 +15,8 @@ use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\ActivityBundle\Repository\ActivityTypeRepositoryInterface;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Closure;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use function in_array;
|
||||
|
||||
class ActivityTypeAggregator implements AggregatorInterface
|
||||
{
|
||||
@@ -33,7 +31,7 @@ class ActivityTypeAggregator implements AggregatorInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acttype', $qb->getAllAliases(), true)) {
|
||||
if (!\in_array('acttype', $qb->getAllAliases(), true)) {
|
||||
$qb->leftJoin('activity.activityType', 'acttype');
|
||||
}
|
||||
|
||||
@@ -50,12 +48,13 @@ class ActivityTypeAggregator implements AggregatorInterface
|
||||
{
|
||||
// no form required for this aggregator
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data): Closure
|
||||
public function getLabels($key, array $values, $data): \Closure
|
||||
{
|
||||
// for performance reason, we load data from db only once
|
||||
$this->activityTypeRepository->findBy(['id' => $values]);
|
||||
|
@@ -15,7 +15,6 @@ use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Repository\UserRepository;
|
||||
use Chill\MainBundle\Templating\Entity\UserRender;
|
||||
use Closure;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
@@ -48,12 +47,13 @@ class ActivityUserAggregator implements AggregatorInterface
|
||||
{
|
||||
// nothing to add
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getLabels($key, $values, $data): Closure
|
||||
public function getLabels($key, $values, $data): \Closure
|
||||
{
|
||||
return function ($value) {
|
||||
if ('_header' === $value) {
|
||||
|
@@ -17,7 +17,6 @@ use Chill\MainBundle\Repository\UserRepositoryInterface;
|
||||
use Chill\MainBundle\Templating\Entity\UserRender;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use function in_array;
|
||||
|
||||
class ActivityUsersAggregator implements AggregatorInterface
|
||||
{
|
||||
@@ -30,7 +29,7 @@ class ActivityUsersAggregator implements AggregatorInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('actusers', $qb->getAllAliases(), true)) {
|
||||
if (!\in_array('actusers', $qb->getAllAliases(), true)) {
|
||||
$qb->leftJoin('activity.users', 'actusers');
|
||||
}
|
||||
|
||||
@@ -48,6 +47,7 @@ class ActivityUsersAggregator implements AggregatorInterface
|
||||
{
|
||||
// nothing to add on the form
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
|
@@ -39,7 +39,7 @@ class ActivityUsersJobAggregator implements AggregatorInterface
|
||||
$p = self::PREFIX;
|
||||
|
||||
$qb
|
||||
->leftJoin("activity.users", "{$p}_user")
|
||||
->leftJoin('activity.users', "{$p}_user")
|
||||
->leftJoin(
|
||||
UserJobHistory::class,
|
||||
"{$p}_history",
|
||||
@@ -49,10 +49,10 @@ class ActivityUsersJobAggregator implements AggregatorInterface
|
||||
// job_at based on activity.date
|
||||
->andWhere(
|
||||
$qb->expr()->andX(
|
||||
$qb->expr()->lte("{$p}_history.startDate", "activity.date"),
|
||||
$qb->expr()->lte("{$p}_history.startDate", 'activity.date'),
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->isNull("{$p}_history.endDate"),
|
||||
$qb->expr()->gt("{$p}_history.endDate", "activity.date")
|
||||
$qb->expr()->gt("{$p}_history.endDate", 'activity.date')
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -93,7 +93,7 @@ class ActivityUsersJobAggregator implements AggregatorInterface
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return [self::PREFIX . '_select'];
|
||||
return [self::PREFIX.'_select'];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
|
@@ -39,7 +39,7 @@ class ActivityUsersScopeAggregator implements AggregatorInterface
|
||||
$p = self::PREFIX;
|
||||
|
||||
$qb
|
||||
->leftJoin("activity.users", "{$p}_user")
|
||||
->leftJoin('activity.users', "{$p}_user")
|
||||
->leftJoin(
|
||||
UserScopeHistory::class,
|
||||
"{$p}_history",
|
||||
@@ -49,10 +49,10 @@ class ActivityUsersScopeAggregator implements AggregatorInterface
|
||||
// scope_at based on activity.date
|
||||
->andWhere(
|
||||
$qb->expr()->andX(
|
||||
$qb->expr()->lte("{$p}_history.startDate", "activity.date"),
|
||||
$qb->expr()->lte("{$p}_history.startDate", 'activity.date'),
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->isNull("{$p}_history.endDate"),
|
||||
$qb->expr()->gt("{$p}_history.endDate", "activity.date")
|
||||
$qb->expr()->gt("{$p}_history.endDate", 'activity.date')
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -93,7 +93,7 @@ class ActivityUsersScopeAggregator implements AggregatorInterface
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return [self::PREFIX . '_select'];
|
||||
return [self::PREFIX.'_select'];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
|
@@ -42,6 +42,7 @@ class ByCreatorAggregator implements AggregatorInterface
|
||||
{
|
||||
// no form
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
|
@@ -17,7 +17,6 @@ use Chill\ThirdPartyBundle\Repository\ThirdPartyRepository;
|
||||
use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use function in_array;
|
||||
|
||||
class ByThirdpartyAggregator implements AggregatorInterface
|
||||
{
|
||||
@@ -30,7 +29,7 @@ class ByThirdpartyAggregator implements AggregatorInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acttparty', $qb->getAllAliases(), true)) {
|
||||
if (!\in_array('acttparty', $qb->getAllAliases(), true)) {
|
||||
$qb->leftJoin('activity.thirdParties', 'acttparty');
|
||||
}
|
||||
|
||||
@@ -47,6 +46,7 @@ class ByThirdpartyAggregator implements AggregatorInterface
|
||||
{
|
||||
// no form
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
|
@@ -39,7 +39,7 @@ class CreatorScopeAggregator implements AggregatorInterface
|
||||
$p = self::PREFIX;
|
||||
|
||||
$qb
|
||||
->leftJoin("activity.createdBy", "{$p}_user")
|
||||
->leftJoin('activity.createdBy', "{$p}_user")
|
||||
->leftJoin(
|
||||
UserScopeHistory::class,
|
||||
"{$p}_history",
|
||||
@@ -49,10 +49,10 @@ class CreatorScopeAggregator implements AggregatorInterface
|
||||
// scope_at based on activity.date
|
||||
->andWhere(
|
||||
$qb->expr()->andX(
|
||||
$qb->expr()->lte("{$p}_history.startDate", "activity.date"),
|
||||
$qb->expr()->lte("{$p}_history.startDate", 'activity.date'),
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->isNull("{$p}_history.endDate"),
|
||||
$qb->expr()->gt("{$p}_history.endDate", "activity.date")
|
||||
$qb->expr()->gt("{$p}_history.endDate", 'activity.date')
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -93,7 +93,7 @@ class CreatorScopeAggregator implements AggregatorInterface
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return [self::PREFIX . '_select'];
|
||||
return [self::PREFIX.'_select'];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
|
@@ -14,10 +14,8 @@ namespace Chill\ActivityBundle\Export\Aggregator;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class DateAggregator implements AggregatorInterface
|
||||
{
|
||||
@@ -56,7 +54,7 @@ class DateAggregator implements AggregatorInterface
|
||||
break; // order DESC does not works !
|
||||
|
||||
default:
|
||||
throw new RuntimeException(sprintf("The frequency data '%s' is invalid.", $data['frequency']));
|
||||
throw new \RuntimeException(sprintf("The frequency data '%s' is invalid.", $data['frequency']));
|
||||
}
|
||||
|
||||
$qb->addSelect(sprintf("TO_CHAR(activity.date, '%s') AS date_aggregator", $fmt));
|
||||
@@ -78,6 +76,7 @@ class DateAggregator implements AggregatorInterface
|
||||
'empty_data' => self::DEFAULT_CHOICE,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return ['frequency' => self::DEFAULT_CHOICE];
|
||||
@@ -87,7 +86,7 @@ class DateAggregator implements AggregatorInterface
|
||||
{
|
||||
return static function ($value) use ($data): string {
|
||||
if ('_header' === $value) {
|
||||
return 'by ' . $data['frequency'];
|
||||
return 'by '.$data['frequency'];
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
|
@@ -13,7 +13,6 @@ namespace Chill\ActivityBundle\Export\Aggregator;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Entity\User\UserJobHistory;
|
||||
use Chill\MainBundle\Entity\User\UserScopeHistory;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Repository\ScopeRepository;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
@@ -40,7 +39,7 @@ class JobScopeAggregator implements AggregatorInterface
|
||||
$p = self::PREFIX;
|
||||
|
||||
$qb
|
||||
->leftJoin("activity.createdBy", "{$p}_user")
|
||||
->leftJoin('activity.createdBy', "{$p}_user")
|
||||
->leftJoin(
|
||||
UserJobHistory::class,
|
||||
"{$p}_history",
|
||||
@@ -50,10 +49,10 @@ class JobScopeAggregator implements AggregatorInterface
|
||||
// job_at based on activity.date
|
||||
->andWhere(
|
||||
$qb->expr()->andX(
|
||||
$qb->expr()->lte("{$p}_history.startDate", "activity.date"),
|
||||
$qb->expr()->lte("{$p}_history.startDate", 'activity.date'),
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->isNull("{$p}_history.endDate"),
|
||||
$qb->expr()->gt("{$p}_history.endDate", "activity.date")
|
||||
$qb->expr()->gt("{$p}_history.endDate", 'activity.date')
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -94,7 +93,7 @@ class JobScopeAggregator implements AggregatorInterface
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return [self::PREFIX . '_select'];
|
||||
return [self::PREFIX.'_select'];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
|
@@ -17,7 +17,6 @@ use Chill\MainBundle\Repository\LocationTypeRepository;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use function in_array;
|
||||
|
||||
class LocationTypeAggregator implements AggregatorInterface
|
||||
{
|
||||
@@ -30,7 +29,7 @@ class LocationTypeAggregator implements AggregatorInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('actloc', $qb->getAllAliases(), true)) {
|
||||
if (!\in_array('actloc', $qb->getAllAliases(), true)) {
|
||||
$qb->leftJoin('activity.location', 'actloc');
|
||||
}
|
||||
|
||||
@@ -47,6 +46,7 @@ class LocationTypeAggregator implements AggregatorInterface
|
||||
{
|
||||
// no form
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
|
@@ -17,17 +17,12 @@ use Chill\ActivityBundle\Repository\ActivityReasonRepository;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Doctrine\ORM\Query\Expr\Join;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
use function count;
|
||||
use function in_array;
|
||||
|
||||
class ActivityReasonAggregator implements AggregatorInterface, ExportElementValidatedInterface
|
||||
{
|
||||
public function __construct(protected ActivityReasonCategoryRepository $activityReasonCategoryRepository, protected ActivityReasonRepository $activityReasonRepository, protected TranslatableStringHelper $translatableStringHelper) {}
|
||||
@@ -47,20 +42,20 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
||||
$elem = 'actreasoncat.id';
|
||||
$alias = 'activity_categories_id';
|
||||
} else {
|
||||
throw new RuntimeException('The data provided are not recognized.');
|
||||
throw new \RuntimeException('The data provided are not recognized.');
|
||||
}
|
||||
|
||||
$qb->addSelect($elem . ' as ' . $alias);
|
||||
$qb->addSelect($elem.' as '.$alias);
|
||||
|
||||
// make a jointure only if needed
|
||||
if (!in_array('actreasons', $qb->getAllAliases(), true)) {
|
||||
if (!\in_array('actreasons', $qb->getAllAliases(), true)) {
|
||||
$qb->innerJoin('activity.reasons', 'actreasons');
|
||||
}
|
||||
|
||||
// join category if necessary
|
||||
if ('activity_categories_id' === $alias) {
|
||||
// add join only if needed
|
||||
if (!in_array('actreasoncat', $qb->getAllAliases(), true)) {
|
||||
if (!\in_array('actreasoncat', $qb->getAllAliases(), true)) {
|
||||
$qb->join('actreasons.category', 'actreasoncat');
|
||||
}
|
||||
}
|
||||
@@ -68,7 +63,7 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
||||
// add the "group by" part
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (count($groupBy) > 0) {
|
||||
if (\count($groupBy) > 0) {
|
||||
$qb->addGroupBy($alias);
|
||||
} else {
|
||||
$qb->groupBy($alias);
|
||||
@@ -96,6 +91,7 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
@@ -106,7 +102,7 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
||||
match ($data['level']) {
|
||||
'reasons' => $this->activityReasonRepository->findBy(['id' => $values]),
|
||||
'categories' => $this->activityReasonCategoryRepository->findBy(['id' => $values]),
|
||||
default => throw new RuntimeException(sprintf("The level data '%s' is invalid.", $data['level'])),
|
||||
default => throw new \RuntimeException(sprintf("The level data '%s' is invalid.", $data['level'])),
|
||||
};
|
||||
|
||||
return function ($value) use ($data) {
|
||||
@@ -147,7 +143,7 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
||||
return ['activity_categories_id'];
|
||||
}
|
||||
|
||||
throw new RuntimeException('The data provided are not recognised.');
|
||||
throw new \RuntimeException('The data provided are not recognised.');
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
|
@@ -14,7 +14,6 @@ namespace Chill\ActivityBundle\Export\Aggregator;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use LogicException;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
@@ -42,6 +41,7 @@ class SentReceivedAggregator implements AggregatorInterface
|
||||
{
|
||||
// No form needed
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
@@ -66,7 +66,7 @@ class SentReceivedAggregator implements AggregatorInterface
|
||||
return $this->translator->trans('export.aggregator.activity.by_sent_received.is received');
|
||||
|
||||
default:
|
||||
throw new LogicException(sprintf('The value %s is not valid', $value));
|
||||
throw new \LogicException(sprintf('The value %s is not valid', $value));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -24,7 +24,6 @@ use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query;
|
||||
use LogicException;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class AvgActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
@@ -38,6 +37,7 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder) {}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
@@ -61,7 +61,7 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
if ('export_avg_activity_duration' !== $key) {
|
||||
throw new LogicException("the key {$key} is not used by this export");
|
||||
throw new \LogicException("the key {$key} is not used by this export");
|
||||
}
|
||||
|
||||
return static fn ($value) => '_header' === $value ? 'Average activities linked to an accompanying period duration' : $value;
|
||||
@@ -101,8 +101,8 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
$qb
|
||||
->andWhere(
|
||||
$qb->expr()->exists(
|
||||
'SELECT 1 FROM ' . AccompanyingPeriodParticipation::class . ' acl_count_part
|
||||
JOIN ' . PersonCenterHistory::class . ' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
|
||||
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
||||
JOIN '.PersonCenterHistory::class.' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
|
||||
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||
'
|
||||
)
|
||||
|
@@ -24,7 +24,6 @@ use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query;
|
||||
use LogicException;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterface
|
||||
@@ -41,6 +40,7 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
||||
{
|
||||
// TODO: Implement buildForm() method.
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
@@ -64,7 +64,7 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
if ('export_avg_activity_visit_duration' !== $key) {
|
||||
throw new LogicException("the key {$key} is not used by this export");
|
||||
throw new \LogicException("the key {$key} is not used by this export");
|
||||
}
|
||||
|
||||
return static fn ($value) => '_header' === $value ? 'Average activities linked to an accompanying period visit duration' : $value;
|
||||
@@ -104,8 +104,8 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
||||
$qb
|
||||
->andWhere(
|
||||
$qb->expr()->exists(
|
||||
'SELECT 1 FROM ' . AccompanyingPeriodParticipation::class . ' acl_count_part
|
||||
JOIN ' . PersonCenterHistory::class . ' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
|
||||
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
||||
JOIN '.PersonCenterHistory::class.' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
|
||||
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||
'
|
||||
)
|
||||
|
@@ -24,7 +24,6 @@ use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query;
|
||||
use LogicException;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class CountActivity implements ExportInterface, GroupedExportInterface
|
||||
@@ -38,6 +37,7 @@ class CountActivity implements ExportInterface, GroupedExportInterface
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder) {}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
@@ -61,7 +61,7 @@ class CountActivity implements ExportInterface, GroupedExportInterface
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
if ('export_count_activity' !== $key) {
|
||||
throw new LogicException("the key {$key} is not used by this export");
|
||||
throw new \LogicException("the key {$key} is not used by this export");
|
||||
}
|
||||
|
||||
return static fn ($value) => '_header' === $value ? 'Number of activities linked to an accompanying period' : $value;
|
||||
@@ -98,8 +98,8 @@ class CountActivity implements ExportInterface, GroupedExportInterface
|
||||
$qb
|
||||
->andWhere(
|
||||
$qb->expr()->exists(
|
||||
'SELECT 1 FROM ' . AccompanyingPeriodParticipation::class . ' acl_count_part
|
||||
JOIN ' . PersonCenterHistory::class . ' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
|
||||
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
||||
JOIN '.PersonCenterHistory::class.' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
|
||||
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||
'
|
||||
)
|
||||
|
@@ -32,6 +32,7 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
{
|
||||
$this->helper->buildForm($builder);
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
@@ -44,7 +45,7 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return ListActivityHelper::MSG_KEY . 'List activities linked to an accompanying course';
|
||||
return ListActivityHelper::MSG_KEY.'List activities linked to an accompanying course';
|
||||
}
|
||||
|
||||
public function getGroup(): string
|
||||
@@ -57,12 +58,12 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
return match ($key) {
|
||||
'acpId' => static function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return ListActivityHelper::MSG_KEY . 'accompanying course id';
|
||||
return ListActivityHelper::MSG_KEY.'accompanying course id';
|
||||
}
|
||||
|
||||
return $value ?? '';
|
||||
},
|
||||
'scopesNames' => $this->translatableStringExportLabelHelper->getLabelMulti($key, $values, ListActivityHelper::MSG_KEY . 'course circles'),
|
||||
'scopesNames' => $this->translatableStringExportLabelHelper->getLabelMulti($key, $values, ListActivityHelper::MSG_KEY.'course circles'),
|
||||
default => $this->helper->getLabels($key, $values, $data),
|
||||
};
|
||||
}
|
||||
@@ -86,7 +87,7 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return ListActivityHelper::MSG_KEY . 'List activity linked to a course';
|
||||
return ListActivityHelper::MSG_KEY.'List activity linked to a course';
|
||||
}
|
||||
|
||||
public function getType()
|
||||
@@ -110,7 +111,7 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
->andWhere(
|
||||
$qb->expr()->exists(
|
||||
'SELECT 1
|
||||
FROM ' . PersonCenterHistory::class . ' acl_count_person_history
|
||||
FROM '.PersonCenterHistory::class.' acl_count_person_history
|
||||
WHERE acl_count_person_history.person = person
|
||||
AND acl_count_person_history.center IN (:authorized_centers)
|
||||
'
|
||||
@@ -127,7 +128,7 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
// add select for this step
|
||||
$qb
|
||||
->addSelect('acp.id AS acpId')
|
||||
->addSelect('(SELECT AGGREGATE(acpScope.name) FROM ' . Scope::class . ' acpScope WHERE acpScope MEMBER OF acp.scopes) AS scopesNames')
|
||||
->addSelect('(SELECT AGGREGATE(acpScope.name) FROM '.Scope::class.' acpScope WHERE acpScope MEMBER OF acp.scopes) AS scopesNames')
|
||||
->addGroupBy('scopesNames');
|
||||
|
||||
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||
|
@@ -24,7 +24,6 @@ use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query;
|
||||
use LogicException;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class SumActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
@@ -41,6 +40,7 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
// TODO: Implement buildForm() method.
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
@@ -64,7 +64,7 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
if ('export_sum_activity_duration' !== $key) {
|
||||
throw new LogicException("the key {$key} is not used by this export");
|
||||
throw new \LogicException("the key {$key} is not used by this export");
|
||||
}
|
||||
|
||||
return static fn ($value) => '_header' === $value ? 'Sum activities linked to an accompanying period duration' : $value;
|
||||
@@ -104,8 +104,8 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
$qb
|
||||
->andWhere(
|
||||
$qb->expr()->exists(
|
||||
'SELECT 1 FROM ' . AccompanyingPeriodParticipation::class . ' acl_count_part
|
||||
JOIN ' . PersonCenterHistory::class . ' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
|
||||
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
||||
JOIN '.PersonCenterHistory::class.' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
|
||||
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||
'
|
||||
)
|
||||
|
@@ -24,7 +24,6 @@ use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query;
|
||||
use LogicException;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class SumActivityVisitDuration implements ExportInterface, GroupedExportInterface
|
||||
@@ -41,6 +40,7 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
||||
{
|
||||
// TODO: Implement buildForm() method.
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
@@ -64,7 +64,7 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
if ('export_sum_activity_visit_duration' !== $key) {
|
||||
throw new LogicException("the key {$key} is not used by this export");
|
||||
throw new \LogicException("the key {$key} is not used by this export");
|
||||
}
|
||||
|
||||
return static fn ($value) => '_header' === $value ? 'Sum activities linked to an accompanying period visit duration' : $value;
|
||||
@@ -104,8 +104,8 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
||||
$qb
|
||||
->andWhere(
|
||||
$qb->expr()->exists(
|
||||
'SELECT 1 FROM ' . AccompanyingPeriodParticipation::class . ' acl_count_part
|
||||
JOIN ' . PersonCenterHistory::class . ' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
|
||||
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
|
||||
JOIN '.PersonCenterHistory::class.' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
|
||||
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
|
||||
'
|
||||
)
|
||||
|
@@ -19,7 +19,6 @@ use Chill\MainBundle\Export\FormatterInterface;
|
||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
||||
use Doctrine\ORM\Query;
|
||||
use LogicException;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class CountActivity implements ExportInterface, GroupedExportInterface
|
||||
@@ -27,6 +26,7 @@ class CountActivity implements ExportInterface, GroupedExportInterface
|
||||
public function __construct(protected ActivityRepository $activityRepository) {}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder) {}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
@@ -50,7 +50,7 @@ class CountActivity implements ExportInterface, GroupedExportInterface
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
if ('export_count_activity' !== $key) {
|
||||
throw new LogicException("the key {$key} is not used by this export");
|
||||
throw new \LogicException("the key {$key} is not used by this export");
|
||||
}
|
||||
|
||||
return static fn ($value) => '_header' === $value ? 'Number of activities linked to a person' : $value;
|
||||
|
@@ -20,7 +20,6 @@ use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
use Chill\MainBundle\Export\ListInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
||||
use DateTime;
|
||||
use Doctrine\DBAL\Exception\InvalidArgumentException;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Query;
|
||||
@@ -30,10 +29,6 @@ use Symfony\Component\Validator\Constraints\Callback;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
use function array_key_exists;
|
||||
use function count;
|
||||
use function in_array;
|
||||
|
||||
class ListActivity implements ListInterface, GroupedExportInterface
|
||||
{
|
||||
protected array $fields = [
|
||||
@@ -61,7 +56,7 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
'label' => 'Fields to include in export',
|
||||
'constraints' => [new Callback([
|
||||
'callback' => static function ($selected, ExecutionContextInterface $context) {
|
||||
if (count($selected) === 0) {
|
||||
if (0 === \count($selected)) {
|
||||
$context->buildViolation('You must select at least one element')
|
||||
->atPath('fields')
|
||||
->addViolation();
|
||||
@@ -70,6 +65,7 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
])],
|
||||
]);
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
@@ -99,7 +95,7 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
return 'date';
|
||||
}
|
||||
|
||||
$date = DateTime::createFromFormat('Y-m-d H:i:s', $value);
|
||||
$date = \DateTime::createFromFormat('Y-m-d H:i:s', $value);
|
||||
|
||||
return $date->format('d-m-Y');
|
||||
};
|
||||
@@ -123,11 +119,11 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
|
||||
$activity = $activityRepository->find($value);
|
||||
|
||||
return implode(', ', array_map(fn (ActivityReason $r) => '"' .
|
||||
return implode(', ', array_map(fn (ActivityReason $r) => '"'.
|
||||
$this->translatableStringHelper->localize($r->getCategory()->getName())
|
||||
. ' > ' .
|
||||
.' > '.
|
||||
$this->translatableStringHelper->localize($r->getName())
|
||||
. '"', $activity->getReasons()->toArray()));
|
||||
.'"', $activity->getReasons()->toArray()));
|
||||
};
|
||||
|
||||
case 'circle_name':
|
||||
@@ -184,7 +180,7 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||
|
||||
// throw an error if any fields are present
|
||||
if (!array_key_exists('fields', $data)) {
|
||||
if (!\array_key_exists('fields', $data)) {
|
||||
throw new InvalidArgumentException('Any fields have been checked.');
|
||||
}
|
||||
|
||||
@@ -208,7 +204,7 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
||||
->setParameter('centers', $centers);
|
||||
|
||||
foreach ($this->fields as $f) {
|
||||
if (in_array($f, $data['fields'], true)) {
|
||||
if (\in_array($f, $data['fields'], true)) {
|
||||
switch ($f) {
|
||||
case 'id':
|
||||
$qb->addSelect('activity.id AS id');
|
||||
|
@@ -20,7 +20,6 @@ use Chill\MainBundle\Export\FormatterInterface;
|
||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
||||
use Doctrine\ORM\Query;
|
||||
use LogicException;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
/**
|
||||
@@ -44,6 +43,7 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
) {}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder) {}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
@@ -60,7 +60,7 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
return 'Sum activities linked to a person duration by various parameters.';
|
||||
}
|
||||
|
||||
throw new LogicException('this action is not supported: ' . $this->action);
|
||||
throw new \LogicException('this action is not supported: '.$this->action);
|
||||
}
|
||||
|
||||
public function getGroup(): string
|
||||
@@ -71,7 +71,7 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
if ('export_stat_activity' !== $key) {
|
||||
throw new LogicException(sprintf('The key %s is not used by this export', $key));
|
||||
throw new \LogicException(sprintf('The key %s is not used by this export', $key));
|
||||
}
|
||||
|
||||
$header = self::SUM === $this->action ? 'Sum activities linked to a person duration' : false;
|
||||
@@ -95,7 +95,7 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
return 'Sum activity linked to a person duration';
|
||||
}
|
||||
|
||||
throw new LogicException('This action is not supported: ' . $this->action);
|
||||
throw new \LogicException('This action is not supported: '.$this->action);
|
||||
}
|
||||
|
||||
public function getType(): string
|
||||
|
@@ -23,10 +23,8 @@ use Chill\PersonBundle\Export\Helper\LabelPersonHelper;
|
||||
use Chill\ThirdPartyBundle\Export\Helper\LabelThirdPartyHelper;
|
||||
use Doctrine\ORM\AbstractQuery;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use LogicException;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use const SORT_NUMERIC;
|
||||
|
||||
class ListActivityHelper
|
||||
{
|
||||
@@ -88,7 +86,7 @@ class ListActivityHelper
|
||||
return match ($key) {
|
||||
'createdAt', 'updatedAt' => $this->dateTimeHelper->getLabel($key),
|
||||
'createdBy', 'updatedBy' => $this->userHelper->getLabel($key, $values, $key),
|
||||
'date' => $this->dateTimeHelper->getLabel(self::MSG_KEY . $key),
|
||||
'date' => $this->dateTimeHelper->getLabel(self::MSG_KEY.$key),
|
||||
'attendeeName' => function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return 'Attendee';
|
||||
@@ -112,13 +110,13 @@ class ListActivityHelper
|
||||
|
||||
return $this->translatableStringHelper->localize($type->getName());
|
||||
},
|
||||
'usersNames' => $this->userHelper->getLabelMulti($key, $values, self::MSG_KEY . 'users name'),
|
||||
'usersNames' => $this->userHelper->getLabelMulti($key, $values, self::MSG_KEY.'users name'),
|
||||
'usersIds', 'thirdPartiesIds', 'personsIds' => static function ($value) use ($key) {
|
||||
if ('_header' === $value) {
|
||||
return match ($key) {
|
||||
'usersIds' => self::MSG_KEY . 'users ids',
|
||||
'thirdPartiesIds' => self::MSG_KEY . 'third parties ids',
|
||||
'personsIds' => self::MSG_KEY . 'persons ids',
|
||||
'usersIds' => self::MSG_KEY.'users ids',
|
||||
'thirdPartiesIds' => self::MSG_KEY.'third parties ids',
|
||||
'personsIds' => self::MSG_KEY.'persons ids',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -128,15 +126,15 @@ class ListActivityHelper
|
||||
'|',
|
||||
array_unique(
|
||||
array_filter($decoded, static fn (?int $id) => null !== $id),
|
||||
SORT_NUMERIC
|
||||
\SORT_NUMERIC
|
||||
)
|
||||
);
|
||||
},
|
||||
'personsNames' => $this->labelPersonHelper->getLabelMulti($key, $values, self::MSG_KEY . 'persons name'),
|
||||
'thirdPartiesNames' => $this->labelThirdPartyHelper->getLabelMulti($key, $values, self::MSG_KEY . 'thirds parties'),
|
||||
'personsNames' => $this->labelPersonHelper->getLabelMulti($key, $values, self::MSG_KEY.'persons name'),
|
||||
'thirdPartiesNames' => $this->labelThirdPartyHelper->getLabelMulti($key, $values, self::MSG_KEY.'thirds parties'),
|
||||
'sentReceived' => function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return self::MSG_KEY . 'sent received';
|
||||
return self::MSG_KEY.'sent received';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
@@ -147,7 +145,7 @@ class ListActivityHelper
|
||||
},
|
||||
default => function ($value) use ($key) {
|
||||
if ('_header' === $value) {
|
||||
return self::MSG_KEY . $key;
|
||||
return self::MSG_KEY.$key;
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
|
@@ -37,7 +37,7 @@ class ActivityTypeFilter implements FilterInterface
|
||||
{
|
||||
$qb->andWhere(
|
||||
$qb->expr()->exists(
|
||||
'SELECT 1 FROM ' . Activity::class . ' act_type_filter_activity
|
||||
'SELECT 1 FROM '.Activity::class.' act_type_filter_activity
|
||||
WHERE act_type_filter_activity.activityType IN (:act_type_filter_activity_types) AND act_type_filter_activity.accompanyingPeriod = acp'
|
||||
)
|
||||
);
|
||||
@@ -54,13 +54,14 @@ class ActivityTypeFilter implements FilterInterface
|
||||
$builder->add('accepted_activitytypes', EntityType::class, [
|
||||
'class' => ActivityType::class,
|
||||
'choices' => $this->activityTypeRepository->findAllActive(),
|
||||
'choice_label' => fn (ActivityType $aty) => ($aty->hasCategory() ? $this->translatableStringHelper->localize($aty->getCategory()->getName()) . ' > ' : '')
|
||||
'choice_label' => fn (ActivityType $aty) => ($aty->hasCategory() ? $this->translatableStringHelper->localize($aty->getCategory()->getName()).' > ' : '')
|
||||
.
|
||||
$this->translatableStringHelper->localize($aty->getName()),
|
||||
'multiple' => true,
|
||||
'expanded' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
|
@@ -18,7 +18,6 @@ use Chill\PersonBundle\Form\Type\PickSocialActionType;
|
||||
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use function in_array;
|
||||
|
||||
class BySocialActionFilter implements FilterInterface
|
||||
{
|
||||
@@ -31,7 +30,7 @@ class BySocialActionFilter implements FilterInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('actsocialaction', $qb->getAllAliases(), true)) {
|
||||
if (!\in_array('actsocialaction', $qb->getAllAliases(), true)) {
|
||||
$qb->join('activity.socialActions', 'actsocialaction');
|
||||
}
|
||||
|
||||
@@ -55,6 +54,7 @@ class BySocialActionFilter implements FilterInterface
|
||||
'multiple' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
|
@@ -18,7 +18,6 @@ use Chill\PersonBundle\Form\Type\PickSocialIssueType;
|
||||
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use function in_array;
|
||||
|
||||
class BySocialIssueFilter implements FilterInterface
|
||||
{
|
||||
@@ -31,7 +30,7 @@ class BySocialIssueFilter implements FilterInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('actsocialissue', $qb->getAllAliases(), true)) {
|
||||
if (!\in_array('actsocialissue', $qb->getAllAliases(), true)) {
|
||||
$qb->join('activity.socialIssues', 'actsocialissue');
|
||||
}
|
||||
|
||||
@@ -55,6 +54,7 @@ class BySocialIssueFilter implements FilterInterface
|
||||
'multiple' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
|
@@ -18,7 +18,7 @@ use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
/**
|
||||
* Filter accompanying periods to keep only the one without any activity
|
||||
* Filter accompanying periods to keep only the one without any activity.
|
||||
*/
|
||||
class HasNoActivityFilter implements FilterInterface
|
||||
{
|
||||
@@ -32,7 +32,7 @@ class HasNoActivityFilter implements FilterInterface
|
||||
$qb
|
||||
->andWhere('
|
||||
NOT EXISTS (
|
||||
SELECT 1 FROM ' . Activity::class . ' activity
|
||||
SELECT 1 FROM '.Activity::class.' activity
|
||||
WHERE activity.accompanyingPeriod = acp
|
||||
)
|
||||
');
|
||||
@@ -45,8 +45,9 @@ class HasNoActivityFilter implements FilterInterface
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
//no form needed
|
||||
// no form needed
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
|
@@ -34,10 +34,10 @@ final readonly class PeriodHavingActivityBetweenDatesFilter implements FilterInt
|
||||
{
|
||||
$builder
|
||||
->add('start_date', PickRollingDateType::class, [
|
||||
'label' => 'export.filter.activity.course_having_activity_between_date.Receiving an activity after'
|
||||
'label' => 'export.filter.activity.course_having_activity_between_date.Receiving an activity after',
|
||||
])
|
||||
->add('end_date', PickRollingDateType::class, [
|
||||
'label' => 'export.filter.activity.course_having_activity_between_date.Receiving an activity before'
|
||||
'label' => 'export.filter.activity.course_having_activity_between_date.Receiving an activity before',
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ final readonly class PeriodHavingActivityBetweenDatesFilter implements FilterInt
|
||||
{
|
||||
return [
|
||||
'start_date' => new RollingDate(RollingDate::T_YEAR_CURRENT_START),
|
||||
'end_date' => new RollingDate(RollingDate::T_TODAY)
|
||||
'end_date' => new RollingDate(RollingDate::T_TODAY),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ final readonly class PeriodHavingActivityBetweenDatesFilter implements FilterInt
|
||||
[
|
||||
'from' => $this->rollingDateConverter->convert($data['start_date']),
|
||||
'to' => $this->rollingDateConverter->convert($data['end_date']),
|
||||
]
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ final readonly class PeriodHavingActivityBetweenDatesFilter implements FilterInt
|
||||
|
||||
$qb->andWhere(
|
||||
$qb->expr()->exists(
|
||||
'SELECT 1 FROM ' . Activity::class . " {$alias} WHERE {$alias}.date >= :{$from} AND {$alias}.date < :{$to} AND {$alias}.accompanyingPeriod = acp"
|
||||
'SELECT 1 FROM '.Activity::class." {$alias} WHERE {$alias}.date >= :{$from} AND {$alias}.date < :{$to} AND {$alias}.accompanyingPeriod = acp"
|
||||
)
|
||||
);
|
||||
|
||||
|
@@ -90,14 +90,14 @@ class ActivityDateFilter implements FilterInterface
|
||||
if (null === $date_from) {
|
||||
$form->get('date_from')->addError(new FormError(
|
||||
$this->translator->trans('This field '
|
||||
. 'should not be empty')
|
||||
.'should not be empty')
|
||||
));
|
||||
}
|
||||
|
||||
if (null === $date_to) {
|
||||
$form->get('date_to')->addError(new FormError(
|
||||
$this->translator->trans('This field '
|
||||
. 'should not be empty')
|
||||
.'should not be empty')
|
||||
));
|
||||
}
|
||||
|
||||
@@ -108,13 +108,14 @@ class ActivityDateFilter implements FilterInterface
|
||||
) {
|
||||
$form->get('date_to')->addError(new FormError(
|
||||
$this->translator->trans('This date should be after '
|
||||
. 'the date given in "Implied in an activity after '
|
||||
. 'this date" field')
|
||||
.'the date given in "Implied in an activity after '
|
||||
.'this date" field')
|
||||
));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return ['date_from' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START), 'date_to' => new RollingDate(RollingDate::T_TODAY)];
|
||||
|
@@ -22,8 +22,6 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
use function count;
|
||||
|
||||
class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInterface
|
||||
{
|
||||
public function __construct(
|
||||
@@ -54,7 +52,7 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter
|
||||
$builder->add('types', EntityType::class, [
|
||||
'choices' => $this->activityTypeRepository->findAllActive(),
|
||||
'class' => ActivityType::class,
|
||||
'choice_label' => fn (ActivityType $aty) => ($aty->hasCategory() ? $this->translatableStringHelper->localize($aty->getCategory()->getName()) . ' > ' : '')
|
||||
'choice_label' => fn (ActivityType $aty) => ($aty->hasCategory() ? $this->translatableStringHelper->localize($aty->getCategory()->getName()).' > ' : '')
|
||||
.
|
||||
$this->translatableStringHelper->localize($aty->getName()),
|
||||
'group_by' => function (ActivityType $type) {
|
||||
@@ -71,6 +69,7 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
@@ -96,7 +95,7 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter
|
||||
|
||||
public function validateForm($data, ExecutionContextInterface $context)
|
||||
{
|
||||
if (null === $data['types'] || count($data['types']) === 0) {
|
||||
if (null === $data['types'] || 0 === \count($data['types'])) {
|
||||
$context
|
||||
->buildViolation('At least one type must be chosen')
|
||||
->addViolation();
|
||||
|
@@ -32,8 +32,8 @@ class ActivityUsersFilter implements FilterInterface
|
||||
$orX = $qb->expr()->orX();
|
||||
|
||||
foreach ($data['accepted_users'] as $key => $user) {
|
||||
$orX->add($qb->expr()->isMemberOf(':activity_users_filter_u' . $key, 'activity.users'));
|
||||
$qb->setParameter('activity_users_filter_u' . $key, $user);
|
||||
$orX->add($qb->expr()->isMemberOf(':activity_users_filter_u'.$key, 'activity.users'));
|
||||
$qb->setParameter('activity_users_filter_u'.$key, $user);
|
||||
}
|
||||
|
||||
$qb->andWhere($orX);
|
||||
@@ -51,6 +51,7 @@ class ActivityUsersFilter implements FilterInterface
|
||||
'label' => 'Users',
|
||||
]);
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
|
@@ -47,6 +47,7 @@ class ByCreatorFilter implements FilterInterface
|
||||
'multiple' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
|
@@ -65,6 +65,7 @@ class EmergencyFilter implements FilterInterface
|
||||
'empty_data' => self::DEFAULT_CHOICE,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return ['accepted_emergency' => self::DEFAULT_CHOICE];
|
||||
|
@@ -14,7 +14,6 @@ namespace Chill\ActivityBundle\Export\Filter;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\MainBundle\Form\Type\PickUserLocationType;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
@@ -46,6 +45,7 @@ class LocationFilter implements FilterInterface
|
||||
'label' => 'pick location',
|
||||
]);
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
|
@@ -18,7 +18,6 @@ use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Doctrine\ORM\Query\Expr\Andx;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use function in_array;
|
||||
|
||||
class LocationTypeFilter implements FilterInterface
|
||||
{
|
||||
@@ -31,7 +30,7 @@ class LocationTypeFilter implements FilterInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('actloc', $qb->getAllAliases(), true)) {
|
||||
if (!\in_array('actloc', $qb->getAllAliases(), true)) {
|
||||
$qb->join('activity.location', 'actloc');
|
||||
}
|
||||
|
||||
@@ -57,9 +56,10 @@ class LocationTypeFilter implements FilterInterface
|
||||
{
|
||||
$builder->add('accepted_locationtype', PickLocationTypeType::class, [
|
||||
'multiple' => true,
|
||||
//'label' => false,
|
||||
// 'label' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
|
@@ -17,16 +17,12 @@ use Chill\ActivityBundle\Repository\ActivityReasonRepository;
|
||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Doctrine\ORM\Query\Expr;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
use function count;
|
||||
use function in_array;
|
||||
|
||||
class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInterface
|
||||
{
|
||||
public function __construct(protected TranslatableStringHelper $translatableStringHelper, protected ActivityReasonRepository $activityReasonRepository) {}
|
||||
@@ -42,7 +38,7 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt
|
||||
$join = $qb->getDQLPart('join');
|
||||
$clause = $qb->expr()->in('actreasons', ':selected_activity_reasons');
|
||||
|
||||
if (!in_array('actreasons', $qb->getAllAliases(), true)) {
|
||||
if (!\in_array('actreasons', $qb->getAllAliases(), true)) {
|
||||
$qb->join('activity.reasons', 'actreasons');
|
||||
}
|
||||
|
||||
@@ -72,6 +68,7 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt
|
||||
'expanded' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
@@ -81,7 +78,7 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt
|
||||
{
|
||||
// collect all the reasons'name used in this filter in one array
|
||||
$reasonsNames = array_map(
|
||||
fn (ActivityReason $r): string => '"' . $this->translatableStringHelper->localize($r->getName()) . '"',
|
||||
fn (ActivityReason $r): string => '"'.$this->translatableStringHelper->localize($r->getName()).'"',
|
||||
$this->activityReasonRepository->findBy(['id' => $data['reasons']->toArray()])
|
||||
);
|
||||
|
||||
@@ -100,7 +97,7 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt
|
||||
|
||||
public function validateForm($data, ExecutionContextInterface $context)
|
||||
{
|
||||
if (null === $data['reasons'] || count($data['reasons']) === 0) {
|
||||
if (null === $data['reasons'] || 0 === \count($data['reasons'])) {
|
||||
$context
|
||||
->buildViolation('At least one reason must be chosen')
|
||||
->addViolation();
|
||||
|
@@ -49,11 +49,11 @@ final readonly class PersonHavingActivityBetweenDateFilter implements ExportElem
|
||||
|
||||
// add clause between date
|
||||
$sqb->where('activity_person_having_activity.date BETWEEN '
|
||||
. ':person_having_activity_between_date_from'
|
||||
. ' AND '
|
||||
. ':person_having_activity_between_date_to'
|
||||
. ' AND '
|
||||
. '(person_person_having_activity.id = person.id OR person MEMBER OF activity_person_having_activity.persons)');
|
||||
.':person_having_activity_between_date_from'
|
||||
.' AND '
|
||||
.':person_having_activity_between_date_to'
|
||||
.' AND '
|
||||
.'(person_person_having_activity.id = person.id OR person MEMBER OF activity_person_having_activity.persons)');
|
||||
|
||||
if (isset($data['reasons']) && [] !== $data['reasons']) {
|
||||
// add clause activity reason
|
||||
@@ -111,6 +111,7 @@ final readonly class PersonHavingActivityBetweenDateFilter implements ExportElem
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [
|
||||
@@ -132,7 +133,7 @@ final readonly class PersonHavingActivityBetweenDateFilter implements ExportElem
|
||||
'reasons' => implode(
|
||||
', ',
|
||||
array_map(
|
||||
fn (ActivityReason $r): string => '"' . $this->translatableStringHelper->localize($r->getName()) . '"',
|
||||
fn (ActivityReason $r): string => '"'.$this->translatableStringHelper->localize($r->getName()).'"',
|
||||
$data['reasons']
|
||||
)
|
||||
),
|
||||
|
@@ -66,6 +66,7 @@ class SentReceivedFilter implements FilterInterface
|
||||
'empty_data' => self::DEFAULT_CHOICE,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return ['accepted_sentreceived' => self::DEFAULT_CHOICE];
|
||||
|
@@ -56,6 +56,7 @@ class UserFilter implements FilterInterface
|
||||
'label' => 'Creators',
|
||||
]);
|
||||
}
|
||||
|
||||
public function getFormDefaultData(): array
|
||||
{
|
||||
return [];
|
||||
|
@@ -39,7 +39,7 @@ class UserScopeFilter implements FilterInterface
|
||||
$p = self::PREFIX;
|
||||
|
||||
$qb
|
||||
->leftJoin("activity.user", "{$p}_user") // createdBy ? cfr translation
|
||||
->leftJoin('activity.user', "{$p}_user") // createdBy ? cfr translation
|
||||
->leftJoin(
|
||||
UserScopeHistory::class,
|
||||
"{$p}_history",
|
||||
@@ -49,10 +49,10 @@ class UserScopeFilter implements FilterInterface
|
||||
// scope_at based on activity.date
|
||||
->andWhere(
|
||||
$qb->expr()->andX(
|
||||
$qb->expr()->lte("{$p}_history.startDate", "activity.date"),
|
||||
$qb->expr()->lte("{$p}_history.startDate", 'activity.date'),
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->isNull("{$p}_history.endDate"),
|
||||
$qb->expr()->gt("{$p}_history.endDate", "activity.date")
|
||||
$qb->expr()->gt("{$p}_history.endDate", 'activity.date')
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -61,7 +61,7 @@ class UserScopeFilter implements FilterInterface
|
||||
)
|
||||
->setParameter(
|
||||
"{$p}_scopes",
|
||||
$data["scopes"],
|
||||
$data['scopes'],
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -41,19 +41,19 @@ class UsersJobFilter implements FilterInterface
|
||||
$qb
|
||||
->andWhere(
|
||||
$qb->expr()->exists(
|
||||
"SELECT 1 FROM " . Activity::class . " {$p}_act "
|
||||
. "JOIN {$p}_act.users {$p}_user "
|
||||
. "JOIN " . UserJobHistory::class . " {$p}_history WITH {$p}_history.user = {$p}_user "
|
||||
. "WHERE {$p}_act = activity "
|
||||
'SELECT 1 FROM '.Activity::class." {$p}_act "
|
||||
."JOIN {$p}_act.users {$p}_user "
|
||||
.'JOIN '.UserJobHistory::class." {$p}_history WITH {$p}_history.user = {$p}_user "
|
||||
."WHERE {$p}_act = activity "
|
||||
// job_at based on activity.date
|
||||
. "AND {$p}_history.startDate <= activity.date "
|
||||
. "AND ({$p}_history.endDate IS NULL OR {$p}_history.endDate > activity.date) "
|
||||
. "AND {$p}_history.job IN ( :{$p}_jobs )"
|
||||
."AND {$p}_history.startDate <= activity.date "
|
||||
."AND ({$p}_history.endDate IS NULL OR {$p}_history.endDate > activity.date) "
|
||||
."AND {$p}_history.job IN ( :{$p}_jobs )"
|
||||
)
|
||||
)
|
||||
->setParameter(
|
||||
"{$p}_jobs",
|
||||
$data["jobs"]
|
||||
$data['jobs']
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -43,19 +43,19 @@ class UsersScopeFilter implements FilterInterface
|
||||
$qb
|
||||
->andWhere(
|
||||
$qb->expr()->exists(
|
||||
"SELECT 1 FROM " . Activity::class . " {$p}_act "
|
||||
. "JOIN {$p}_act.users {$p}_user "
|
||||
. "JOIN " . UserScopeHistory::class . " {$p}_history WITH {$p}_history.user = {$p}_user "
|
||||
. "WHERE {$p}_act = activity "
|
||||
'SELECT 1 FROM '.Activity::class." {$p}_act "
|
||||
."JOIN {$p}_act.users {$p}_user "
|
||||
.'JOIN '.UserScopeHistory::class." {$p}_history WITH {$p}_history.user = {$p}_user "
|
||||
."WHERE {$p}_act = activity "
|
||||
// scope_at based on activity.date
|
||||
. "AND {$p}_history.startDate <= activity.date "
|
||||
. "AND ({$p}_history.endDate IS NULL OR {$p}_history.endDate > activity.date) "
|
||||
. "AND {$p}_history.scope IN ( :{$p}_scopes )"
|
||||
."AND {$p}_history.startDate <= activity.date "
|
||||
."AND ({$p}_history.endDate IS NULL OR {$p}_history.endDate > activity.date) "
|
||||
."AND {$p}_history.scope IN ( :{$p}_scopes )"
|
||||
)
|
||||
)
|
||||
->setParameter(
|
||||
"{$p}_scopes",
|
||||
$data["scopes"]
|
||||
$data['scopes']
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user