mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
[person][export] Fixed: use left join for related entities in accompanying course aggregators
This commit is contained in:
parent
ca6fde934b
commit
cf9b9b3c75
@ -15,6 +15,7 @@ and this project adheres to
|
|||||||
* [activity][export] Feature: improve label for aliases in "Filter by activity type"
|
* [activity][export] Feature: improve label for aliases in "Filter by activity type"
|
||||||
* [activity][export] DX/Feature: use of an `ActivityTypeRepositoryInterface` instead of the old-style EntityRepository
|
* [activity][export] DX/Feature: use of an `ActivityTypeRepositoryInterface` instead of the old-style EntityRepository
|
||||||
* [person][export] Fixed: some inconsistency with date filter on accompanying courses
|
* [person][export] Fixed: some inconsistency with date filter on accompanying courses
|
||||||
|
* [person][export] Fixed: use left join for related entities in accompanying course aggregators
|
||||||
|
|
||||||
## Test releases
|
## Test releases
|
||||||
|
|
||||||
|
@ -40,18 +40,11 @@ class AdministrativeLocationAggregator implements AggregatorInterface
|
|||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
if (!in_array('acploc', $qb->getAllAliases(), true)) {
|
if (!in_array('acploc', $qb->getAllAliases(), true)) {
|
||||||
$qb->join('acp.administrativeLocation', 'acploc');
|
$qb->leftJoin('acp.administrativeLocation', 'acploc');
|
||||||
}
|
}
|
||||||
|
|
||||||
$qb->addSelect('IDENTITY(acp.administrativeLocation) AS location_aggregator');
|
$qb->addSelect('IDENTITY(acp.administrativeLocation) AS location_aggregator');
|
||||||
|
$qb->addGroupBy('location_aggregator');
|
||||||
$groupBy = $qb->getDQLPart('groupBy');
|
|
||||||
|
|
||||||
if (!empty($groupBy)) {
|
|
||||||
$qb->addGroupBy('location_aggregator');
|
|
||||||
} else {
|
|
||||||
$qb->groupBy('location_aggregator');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
@ -71,6 +64,10 @@ class AdministrativeLocationAggregator implements AggregatorInterface
|
|||||||
return 'Administrative location';
|
return 'Administrative location';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null === $value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$l = $this->locationRepository->find($value);
|
$l = $this->locationRepository->find($value);
|
||||||
|
|
||||||
return $l->getName() . ' (' . $this->translatableStringHelper->localize($l->getLocationType()->getTitle()) . ')';
|
return $l->getName() . ' (' . $this->translatableStringHelper->localize($l->getLocationType()->getTitle()) . ')';
|
||||||
|
@ -15,6 +15,7 @@ use Chill\MainBundle\Export\AggregatorInterface;
|
|||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
|
use Chill\PersonBundle\Repository\AccompanyingPeriod\ClosingMotiveRepository;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
@ -26,10 +27,10 @@ class ClosingMotiveAggregator implements AggregatorInterface
|
|||||||
private TranslatableStringHelper $translatableStringHelper;
|
private TranslatableStringHelper $translatableStringHelper;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
EntityManagerInterface $em,
|
ClosingMotiveRepository $motiveRepository,
|
||||||
TranslatableStringHelper $translatableStringHelper
|
TranslatableStringHelper $translatableStringHelper
|
||||||
) {
|
) {
|
||||||
$this->motiveRepository = $em->getRepository(ClosingMotive::class);
|
$this->motiveRepository = $motiveRepository;
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,19 +41,8 @@ class ClosingMotiveAggregator implements AggregatorInterface
|
|||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
if (!in_array('acpmotive', $qb->getAllAliases(), true)) {
|
|
||||||
$qb->join('acp.closingMotive', 'acpmotive');
|
|
||||||
}
|
|
||||||
|
|
||||||
$qb->addSelect('IDENTITY(acp.closingMotive) AS closingmotive_aggregator');
|
$qb->addSelect('IDENTITY(acp.closingMotive) AS closingmotive_aggregator');
|
||||||
|
$qb->addGroupBy('closingmotive_aggregator');
|
||||||
$groupBy = $qb->getDQLPart('groupBy');
|
|
||||||
|
|
||||||
if (!empty($groupBy)) {
|
|
||||||
$qb->addGroupBy('closingmotive_aggregator');
|
|
||||||
} else {
|
|
||||||
$qb->groupBy('closingmotive_aggregator');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
@ -72,6 +62,10 @@ class ClosingMotiveAggregator implements AggregatorInterface
|
|||||||
return 'Closing motive';
|
return 'Closing motive';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (NULL === $value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$cm = $this->motiveRepository->find($value);
|
$cm = $this->motiveRepository->find($value);
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize(
|
return $this->translatableStringHelper->localize(
|
||||||
|
@ -35,14 +35,7 @@ class ConfidentialAggregator implements AggregatorInterface
|
|||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
$qb->addSelect('acp.confidential AS confidential_aggregator');
|
$qb->addSelect('acp.confidential AS confidential_aggregator');
|
||||||
|
$qb->addGroupBy('confidential_aggregator');
|
||||||
$groupBy = $qb->getDQLPart('groupBy');
|
|
||||||
|
|
||||||
if (!empty($groupBy)) {
|
|
||||||
$qb->addGroupBy('confidential_aggregator');
|
|
||||||
} else {
|
|
||||||
$qb->groupBy('confidential_aggregator');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
|
@ -44,15 +44,8 @@ final class DurationAggregator implements AggregatorInterface
|
|||||||
// et ajouter une fonction custom qui calcule plus précisément les intervals, comme doctrineum/date-interval
|
// et ajouter une fonction custom qui calcule plus précisément les intervals, comme doctrineum/date-interval
|
||||||
// https://packagist.org/packages/doctrineum/date-interval#3.1.0 (mais composer fait un conflit de dépendance)
|
// https://packagist.org/packages/doctrineum/date-interval#3.1.0 (mais composer fait un conflit de dépendance)
|
||||||
|
|
||||||
$groupBy = $qb->getDQLPart('groupBy');
|
$qb->addGroupBy('duration_aggregator');
|
||||||
|
$qb->addOrderBy('duration_aggregator');
|
||||||
if (!empty($groupBy)) {
|
|
||||||
$qb->addGroupBy('duration_aggregator');
|
|
||||||
} else {
|
|
||||||
$qb->groupBy('duration_aggregator');
|
|
||||||
}
|
|
||||||
|
|
||||||
$qb->orderBy('duration_aggregator');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
|
@ -35,14 +35,7 @@ class EmergencyAggregator implements AggregatorInterface
|
|||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
$qb->addSelect('acp.emergency AS emergency_aggregator');
|
$qb->addSelect('acp.emergency AS emergency_aggregator');
|
||||||
|
$qb->addGroupBy('emergency_aggregator');
|
||||||
$groupBy = $qb->getDQLPart('groupBy');
|
|
||||||
|
|
||||||
if (!empty($groupBy)) {
|
|
||||||
$qb->addGroupBy('emergency_aggregator');
|
|
||||||
} else {
|
|
||||||
$qb->groupBy('emergency_aggregator');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
|
@ -41,22 +41,15 @@ final class EvaluationAggregator implements AggregatorInterface
|
|||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
if (!in_array('acpw', $qb->getAllAliases(), true)) {
|
if (!in_array('acpw', $qb->getAllAliases(), true)) {
|
||||||
$qb->join('acp.works', 'acpw');
|
$qb->leftJoin('acp.works', 'acpw');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array('workeval', $qb->getAllAliases(), true)) {
|
if (!in_array('workeval', $qb->getAllAliases(), true)) {
|
||||||
$qb->join('acpw.accompanyingPeriodWorkEvaluations', 'workeval');
|
$qb->leftJoin('acpw.accompanyingPeriodWorkEvaluations', 'workeval');
|
||||||
}
|
}
|
||||||
|
|
||||||
$qb->addSelect('IDENTITY(workeval.evaluation) AS evaluation_aggregator');
|
$qb->addSelect('IDENTITY(workeval.evaluation) AS evaluation_aggregator');
|
||||||
|
$qb->addGroupBy('evaluation_aggregator');
|
||||||
$groupby = $qb->getDQLPart('groupBy');
|
|
||||||
|
|
||||||
if (!empty($groupBy)) {
|
|
||||||
$qb->addGroupBy('evaluation_aggregator');
|
|
||||||
} else {
|
|
||||||
$qb->groupBy('evaluation_aggregator');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
@ -76,6 +69,10 @@ final class EvaluationAggregator implements AggregatorInterface
|
|||||||
return 'Evaluation';
|
return 'Evaluation';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null === $value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$e = $this->evaluationRepository->find($value);
|
$e = $this->evaluationRepository->find($value);
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize(
|
return $this->translatableStringHelper->localize(
|
||||||
|
@ -35,14 +35,7 @@ class IntensityAggregator implements AggregatorInterface
|
|||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
$qb->addSelect('acp.intensity AS intensity_aggregator');
|
$qb->addSelect('acp.intensity AS intensity_aggregator');
|
||||||
|
$qb->addGroupBy('intensity_aggregator');
|
||||||
$groupBy = $qb->getDQLPart('groupBy');
|
|
||||||
|
|
||||||
if (!empty($groupBy)) {
|
|
||||||
$qb->addGroupBy('intensity_aggregator');
|
|
||||||
} else {
|
|
||||||
$qb->groupBy('intensity_aggregator');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
|
@ -40,18 +40,11 @@ final class JobAggregator implements AggregatorInterface
|
|||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
if (!in_array('acpjob', $qb->getAllAliases(), true)) {
|
if (!in_array('acpjob', $qb->getAllAliases(), true)) {
|
||||||
$qb->join('acp.job', 'acpjob');
|
$qb->leftJoin('acp.job', 'acpjob');
|
||||||
}
|
}
|
||||||
|
|
||||||
$qb->addSelect('IDENTITY(acp.job) AS job_aggregator');
|
$qb->addSelect('IDENTITY(acp.job) AS job_aggregator');
|
||||||
|
$qb->addGroupBy('job_aggregator');
|
||||||
$groupBy = $qb->getDQLPart('groupBy');
|
|
||||||
|
|
||||||
if (!empty($groupBy)) {
|
|
||||||
$qb->addGroupBy('job_aggregator');
|
|
||||||
} else {
|
|
||||||
$qb->groupBy('job_aggregator');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
@ -71,6 +64,10 @@ final class JobAggregator implements AggregatorInterface
|
|||||||
return 'Job';
|
return 'Job';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null === $value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$j = $this->jobRepository->find($value);
|
$j = $this->jobRepository->find($value);
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize(
|
return $this->translatableStringHelper->localize(
|
||||||
|
@ -42,18 +42,11 @@ final class OriginAggregator implements AggregatorInterface
|
|||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
if (!in_array('acporigin', $qb->getAllAliases(), true)) {
|
if (!in_array('acporigin', $qb->getAllAliases(), true)) {
|
||||||
$qb->join('acp.origin', 'acporigin');
|
$qb->leftJoin('acp.origin', 'acporigin');
|
||||||
}
|
}
|
||||||
|
|
||||||
$qb->addSelect('acporigin.id AS origin_aggregator');
|
$qb->addSelect('acporigin.id AS origin_aggregator');
|
||||||
|
$qb->addGroupBy('origin_aggregator');
|
||||||
$groupby = $qb->getDQLPart('groupBy');
|
|
||||||
|
|
||||||
if (!empty($groupBy)) {
|
|
||||||
$qb->addGroupBy('origin_aggregator');
|
|
||||||
} else {
|
|
||||||
$qb->groupBy('origin_aggregator');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
@ -73,6 +66,10 @@ final class OriginAggregator implements AggregatorInterface
|
|||||||
return 'Origin';
|
return 'Origin';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null === $value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$o = $this->repository->find($value);
|
$o = $this->repository->find($value);
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize(
|
return $this->translatableStringHelper->localize(
|
||||||
|
@ -40,18 +40,11 @@ final class ReferrerAggregator implements AggregatorInterface
|
|||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
if (!in_array('acpuser', $qb->getAllAliases(), true)) {
|
if (!in_array('acpuser', $qb->getAllAliases(), true)) {
|
||||||
$qb->join('acp.user', 'acpuser');
|
$qb->leftJoin('acp.user', 'acpuser');
|
||||||
}
|
}
|
||||||
|
|
||||||
$qb->addSelect('acpuser.id AS referrer_aggregator');
|
$qb->addSelect('acpuser.id AS referrer_aggregator');
|
||||||
|
$qb->addGroupBy('referrer_aggregator');
|
||||||
$groupBy = $qb->getDQLPart('groupBy');
|
|
||||||
|
|
||||||
if (!empty($groupBy)) {
|
|
||||||
$qb->addGroupBy('referrer_aggregator');
|
|
||||||
} else {
|
|
||||||
$qb->groupBy('referrer_aggregator');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
@ -71,6 +64,10 @@ final class ReferrerAggregator implements AggregatorInterface
|
|||||||
return 'Referrer';
|
return 'Referrer';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null === $value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$r = $this->userRepository->find($value);
|
$r = $this->userRepository->find($value);
|
||||||
|
|
||||||
return $this->userRender->renderString($r, []);
|
return $this->userRender->renderString($r, []);
|
||||||
|
@ -57,15 +57,7 @@ final class RequestorAggregator implements AggregatorInterface
|
|||||||
END ) AS requestor_aggregator
|
END ) AS requestor_aggregator
|
||||||
");
|
");
|
||||||
|
|
||||||
$groupBy = $qb->getDQLPart('groupBy');
|
$qb->addGroupBy('requestor_aggregator');
|
||||||
|
|
||||||
if (!empty($groupBy)) {
|
|
||||||
$qb->addGroupBy('requestor_aggregator');
|
|
||||||
} else {
|
|
||||||
$qb->groupBy('requestor_aggregator');
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO 'order by' does not works !
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
|
@ -40,18 +40,11 @@ final class ScopeAggregator implements AggregatorInterface
|
|||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
if (!in_array('acpscope', $qb->getAllAliases(), true)) {
|
if (!in_array('acpscope', $qb->getAllAliases(), true)) {
|
||||||
$qb->join('acp.scopes', 'acpscope');
|
$qb->leftJoin('acp.scopes', 'acpscope');
|
||||||
}
|
}
|
||||||
|
|
||||||
$qb->addSelect('acpscope.id as scope_aggregator');
|
$qb->addSelect('acpscope.id as scope_aggregator');
|
||||||
|
$qb->addGroupBy('scope_aggregator');
|
||||||
$groupBy = $qb->getDQLPart('groupBy');
|
|
||||||
|
|
||||||
if (!empty($groupBy)) {
|
|
||||||
$qb->addGroupBy('scope_aggregator');
|
|
||||||
} else {
|
|
||||||
$qb->groupBy('scope_aggregator');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
@ -71,6 +64,10 @@ final class ScopeAggregator implements AggregatorInterface
|
|||||||
return 'Scope';
|
return 'Scope';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null === $value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$s = $this->scopeRepository->find($value);
|
$s = $this->scopeRepository->find($value);
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize(
|
return $this->translatableStringHelper->localize(
|
||||||
|
@ -41,18 +41,12 @@ final class SocialActionAggregator implements AggregatorInterface
|
|||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
if (!in_array('acpw', $qb->getAllAliases(), true)) {
|
if (!in_array('acpw', $qb->getAllAliases(), true)) {
|
||||||
|
// here, we will only see accompanying period linked with a socialAction
|
||||||
$qb->join('acp.works', 'acpw');
|
$qb->join('acp.works', 'acpw');
|
||||||
}
|
}
|
||||||
|
|
||||||
$qb->addSelect('IDENTITY(acpw.socialAction) AS socialaction_aggregator'); // DISTINCT ??
|
$qb->addSelect('IDENTITY(acpw.socialAction) AS socialaction_aggregator');
|
||||||
|
$qb->addGroupBy('socialaction_aggregator');
|
||||||
$groupby = $qb->getDQLPart('groupBy');
|
|
||||||
|
|
||||||
if (!empty($groupBy)) {
|
|
||||||
$qb->addGroupBy('socialaction_aggregator');
|
|
||||||
} else {
|
|
||||||
$qb->groupBy('socialaction_aggregator');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
@ -72,6 +66,10 @@ final class SocialActionAggregator implements AggregatorInterface
|
|||||||
return 'Social action';
|
return 'Social action';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null === $value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$sa = $this->actionRepository->find($value);
|
$sa = $this->actionRepository->find($value);
|
||||||
|
|
||||||
return $this->actionRender->renderString($sa, []);
|
return $this->actionRender->renderString($sa, []);
|
||||||
|
@ -40,18 +40,12 @@ final class SocialIssueAggregator implements AggregatorInterface
|
|||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
if (!in_array('acpsocialissue', $qb->getAllAliases(), true)) {
|
if (!in_array('acpsocialissue', $qb->getAllAliases(), true)) {
|
||||||
|
// we will see accompanying period linked with social issues
|
||||||
$qb->join('acp.socialIssues', 'acpsocialissue');
|
$qb->join('acp.socialIssues', 'acpsocialissue');
|
||||||
}
|
}
|
||||||
|
|
||||||
$qb->addSelect('acpsocialissue.id as socialissue_aggregator');
|
$qb->addSelect('acpsocialissue.id as socialissue_aggregator');
|
||||||
|
$qb->addGroupBy('socialissue_aggregator');
|
||||||
$groupBy = $qb->getDQLPart('groupBy');
|
|
||||||
|
|
||||||
if (!empty($groupBy)) {
|
|
||||||
$qb->addGroupBy('socialissue_aggregator');
|
|
||||||
} else {
|
|
||||||
$qb->groupBy('socialissue_aggregator');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
|
@ -41,15 +41,9 @@ final class StepAggregator implements AggregatorInterface //, FilterInterface
|
|||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
$qb->addSelect('acp.step AS step_aggregator');
|
$qb->addSelect('acp.step AS step_aggregator');
|
||||||
|
$qb->addGroupBy('step_aggregator');
|
||||||
|
|
||||||
$groupBy = $qb->getDQLPart('groupBy');
|
/*
|
||||||
|
|
||||||
if (!empty($groupBy)) {
|
|
||||||
$qb->addGroupBy('step_aggregator');
|
|
||||||
} else {
|
|
||||||
$qb->groupBy('step_aggregator');
|
|
||||||
}
|
|
||||||
|
|
||||||
// add date in where clause
|
// add date in where clause
|
||||||
$where = $qb->getDQLPart('where');
|
$where = $qb->getDQLPart('where');
|
||||||
|
|
||||||
@ -69,6 +63,7 @@ final class StepAggregator implements AggregatorInterface //, FilterInterface
|
|||||||
|
|
||||||
$qb->add('where', $where);
|
$qb->add('where', $where);
|
||||||
$qb->setParameter('ondate', $data['on_date'], Types::DATE_MUTABLE);
|
$qb->setParameter('ondate', $data['on_date'], Types::DATE_MUTABLE);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
|
@ -39,15 +39,8 @@ class EvaluationTypeAggregator implements AggregatorInterface
|
|||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
$qb->addSelect('IDENTITY(workeval.evaluation) AS evaluationtype_aggregator');
|
$qb->addSelect('IDENTITY(workeval.evaluation) AS eval_evaluationtype_aggregator');
|
||||||
|
$qb->addGroupBy('eval_evaluationtype_aggregator');
|
||||||
$groupBy = $qb->getDQLPart('groupBy');
|
|
||||||
|
|
||||||
if (!empty($groupBy)) {
|
|
||||||
$qb->addGroupBy('evaluationtype_aggregator');
|
|
||||||
} else {
|
|
||||||
$qb->groupBy('evaluationtype_aggregator');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
@ -67,6 +60,10 @@ class EvaluationTypeAggregator implements AggregatorInterface
|
|||||||
return 'Evaluation type';
|
return 'Evaluation type';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null === $value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$ev = $this->evaluationRepository->find($value);
|
$ev = $this->evaluationRepository->find($value);
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize($ev->getTitle());
|
return $this->translatableStringHelper->localize($ev->getTitle());
|
||||||
@ -75,7 +72,7 @@ class EvaluationTypeAggregator implements AggregatorInterface
|
|||||||
|
|
||||||
public function getQueryKeys($data): array
|
public function getQueryKeys($data): array
|
||||||
{
|
{
|
||||||
return ['evaluationtype_aggregator'];
|
return ['eval_evaluationtype_aggregator'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle(): string
|
public function getTitle(): string
|
||||||
|
@ -44,14 +44,7 @@ final class ActionTypeAggregator implements AggregatorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$qb->addSelect('acpwsocialaction.id as action_type_aggregator');
|
$qb->addSelect('acpwsocialaction.id as action_type_aggregator');
|
||||||
|
$qb->addGroupBy('action_type_aggregator');
|
||||||
$groupBy = $qb->getDQLPart('groupBy');
|
|
||||||
|
|
||||||
if (!empty($groupBy)) {
|
|
||||||
$qb->addGroupBy('action_type_aggregator');
|
|
||||||
} else {
|
|
||||||
$qb->groupBy('action_type_aggregator');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn()
|
public function applyOn()
|
||||||
@ -71,6 +64,10 @@ final class ActionTypeAggregator implements AggregatorInterface
|
|||||||
return 'Social Action Type';
|
return 'Social Action Type';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null === $value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$sa = $this->socialActionRepository->find($value);
|
$sa = $this->socialActionRepository->find($value);
|
||||||
|
|
||||||
return $this->actionRender->renderString($sa, []);
|
return $this->actionRender->renderString($sa, []);
|
||||||
|
@ -38,18 +38,11 @@ final class GoalAggregator implements AggregatorInterface
|
|||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
if (!in_array('goal', $qb->getAllAliases(), true)) {
|
if (!in_array('goal', $qb->getAllAliases(), true)) {
|
||||||
$qb->join('acpw.goals', 'goal');
|
$qb->leftJoin('acpw.goals', 'goal');
|
||||||
}
|
}
|
||||||
|
|
||||||
$qb->addSelect('IDENTITY(goal.goal) as goal_aggregator');
|
$qb->addSelect('IDENTITY(goal.goal) as acpw_goal_aggregator');
|
||||||
|
$qb->addGroupBy('acpw_goal_aggregator');
|
||||||
$groupBy = $qb->getDQLPart('groupBy');
|
|
||||||
|
|
||||||
if (!empty($groupBy)) {
|
|
||||||
$qb->addGroupBy('goal_aggregator');
|
|
||||||
} else {
|
|
||||||
$qb->groupBy('goal_aggregator');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
@ -69,8 +62,12 @@ final class GoalAggregator implements AggregatorInterface
|
|||||||
return 'Goal Type';
|
return 'Goal Type';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null === $value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$g = $this->goalRepository->find($value);
|
$g = $this->goalRepository->find($value);
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize(
|
return $this->translatableStringHelper->localize(
|
||||||
$g->getTitle()
|
$g->getTitle()
|
||||||
);
|
);
|
||||||
@ -79,7 +76,7 @@ final class GoalAggregator implements AggregatorInterface
|
|||||||
|
|
||||||
public function getQueryKeys($data): array
|
public function getQueryKeys($data): array
|
||||||
{
|
{
|
||||||
return ['goal_aggregator'];
|
return ['acpw_goal_aggregator'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle(): string
|
public function getTitle(): string
|
||||||
|
@ -40,18 +40,11 @@ final class JobAggregator implements AggregatorInterface
|
|||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
if (!in_array('acpwuser', $qb->getAllAliases(), true)) {
|
if (!in_array('acpwuser', $qb->getAllAliases(), true)) {
|
||||||
$qb->join('acpw.referrers', 'acpwuser');
|
$qb->leftJoin('acpw.referrers', 'acpwuser');
|
||||||
}
|
}
|
||||||
|
|
||||||
$qb->addSelect('IDENTITY(acpwuser.userJob) as job_aggregator');
|
$qb->addSelect('IDENTITY(acpwuser.userJob) as job_aggregator')
|
||||||
|
->addGroupBy('job_aggregator');
|
||||||
$groupBy = $qb->getDQLPart('groupBy');
|
|
||||||
|
|
||||||
if (!empty($groupBy)) {
|
|
||||||
$qb->addGroupBy('job_aggregator');
|
|
||||||
} else {
|
|
||||||
$qb->groupBy('job_aggregator');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
@ -71,6 +64,10 @@ final class JobAggregator implements AggregatorInterface
|
|||||||
return 'Job';
|
return 'Job';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null === $value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$j = $this->jobRepository->find($value);
|
$j = $this->jobRepository->find($value);
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize(
|
return $this->translatableStringHelper->localize(
|
||||||
|
@ -40,18 +40,11 @@ final class ReferrerAggregator implements AggregatorInterface
|
|||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
if (!in_array('acpwuser', $qb->getAllAliases(), true)) {
|
if (!in_array('acpwuser', $qb->getAllAliases(), true)) {
|
||||||
$qb->join('acpw.referrers', 'acpwuser');
|
$qb->leftJoin('acpw.referrers', 'acpwuser');
|
||||||
}
|
}
|
||||||
|
|
||||||
$qb->addSelect('acpwuser.id AS referrer_aggregator');
|
$qb->addSelect('acpwuser.id AS referrer_aggregator');
|
||||||
|
$qb->addGroupBy('referrer_aggregator');
|
||||||
$groupBy = $qb->getDQLPart('groupBy');
|
|
||||||
|
|
||||||
if (!empty($groupBy)) {
|
|
||||||
$qb->addGroupBy('referrer_aggregator');
|
|
||||||
} else {
|
|
||||||
$qb->groupBy('referrer_aggregator');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
@ -71,6 +64,10 @@ final class ReferrerAggregator implements AggregatorInterface
|
|||||||
return 'Referrer';
|
return 'Referrer';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null === $value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$r = $this->userRepository->find($value);
|
$r = $this->userRepository->find($value);
|
||||||
|
|
||||||
return $this->userRender->renderString($r, []);
|
return $this->userRender->renderString($r, []);
|
||||||
|
@ -41,15 +41,8 @@ final class ResultAggregator implements AggregatorInterface
|
|||||||
$qb->join('acpw.results', 'result');
|
$qb->join('acpw.results', 'result');
|
||||||
}
|
}
|
||||||
|
|
||||||
$qb->addSelect('result.id as result_aggregator');
|
$qb->addSelect('result.id AS acpw_result_aggregator');
|
||||||
|
$qb->addGroupBy('acpw_result_aggregator');
|
||||||
$groupBy = $qb->getDQLPart('groupBy');
|
|
||||||
|
|
||||||
if (!empty($groupBy)) {
|
|
||||||
$qb->addGroupBy('result_aggregator');
|
|
||||||
} else {
|
|
||||||
$qb->groupBy('result_aggregator');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
@ -69,6 +62,10 @@ final class ResultAggregator implements AggregatorInterface
|
|||||||
return 'Result Type';
|
return 'Result Type';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null === $value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$r = $this->resultRepository->find($value);
|
$r = $this->resultRepository->find($value);
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize(
|
return $this->translatableStringHelper->localize(
|
||||||
@ -79,7 +76,7 @@ final class ResultAggregator implements AggregatorInterface
|
|||||||
|
|
||||||
public function getQueryKeys($data): array
|
public function getQueryKeys($data): array
|
||||||
{
|
{
|
||||||
return ['result_aggregator'];
|
return ['acpw_result_aggregator'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle(): string
|
public function getTitle(): string
|
||||||
|
@ -40,18 +40,11 @@ final class ScopeAggregator implements AggregatorInterface
|
|||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data)
|
||||||
{
|
{
|
||||||
if (!in_array('acpwuser', $qb->getAllAliases(), true)) {
|
if (!in_array('acpwuser', $qb->getAllAliases(), true)) {
|
||||||
$qb->join('acpw.referrers', 'acpwuser');
|
$qb->leftJoin('acpw.referrers', 'acpwuser');
|
||||||
}
|
}
|
||||||
|
|
||||||
$qb->addSelect('IDENTITY(acpwuser.mainScope) as scope_aggregator');
|
$qb->addSelect('IDENTITY(acpwuser.mainScope) as scope_aggregator');
|
||||||
|
$qb->addGroupBy('scope_aggregator');
|
||||||
$groupBy = $qb->getDQLPart('groupBy');
|
|
||||||
|
|
||||||
if (!empty($groupBy)) {
|
|
||||||
$qb->addGroupBy('scope_aggregator');
|
|
||||||
} else {
|
|
||||||
$qb->groupBy('scope_aggregator');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
@ -71,6 +64,10 @@ final class ScopeAggregator implements AggregatorInterface
|
|||||||
return 'Scope';
|
return 'Scope';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null === $value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$s = $this->scopeRepository->find($value);
|
$s = $this->scopeRepository->find($value);
|
||||||
|
|
||||||
return $this->translatableStringHelper->localize(
|
return $this->translatableStringHelper->localize(
|
||||||
|
@ -98,7 +98,7 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface
|
|||||||
$qb->join('acpw.accompanyingPeriodWorkEvaluations', 'workeval');
|
$qb->join('acpw.accompanyingPeriodWorkEvaluations', 'workeval');
|
||||||
}
|
}
|
||||||
|
|
||||||
$qb->select('COUNT(workeval.id) AS export_result');
|
$qb->select('COUNT(DISTINCT workeval.id) AS export_result');
|
||||||
|
|
||||||
return $qb;
|
return $qb;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user