mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-01-15 22:01:23 +00:00
Fix: acc periods of which user is the referrer should not be included if when the list is filtered by center and none of the participations are part of the center
This commit is contained in:
6
.changes/unreleased/Fixed-20260115-132538.yaml
Normal file
6
.changes/unreleased/Fixed-20260115-132538.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: Fixed
|
||||
body: 'Fix: acc periods of which user is the referrer should not be included if when the list is filtered by center and none of the participations are part of the center'
|
||||
time: 2026-01-15T13:25:38.269774735+01:00
|
||||
custom:
|
||||
Issue: "491"
|
||||
SchemaChange: No schema change
|
||||
@@ -44,12 +44,10 @@ final readonly class FilterListAccompanyingPeriodHelper implements FilterListAcc
|
||||
};
|
||||
|
||||
// add filtering on confidential accompanying period. The confidential is applyed on the current status of
|
||||
// the accompanying period (we do not use the 'calc_date' here
|
||||
$aclConditionsOrX = $qb->expr()->orX(
|
||||
// either the current user is the refferer for the course
|
||||
'acp.user = :list_acp_current_user',
|
||||
);
|
||||
$qb->setParameter('list_acp_current_user', $user);
|
||||
// the accompanying period (we do not use the 'calc_date' here)
|
||||
//
|
||||
// IMPORTANT: we must NOT bypass selected centers just because the current user is the referrer.
|
||||
$aclConditionsOrX = $qb->expr()->orX();
|
||||
|
||||
$i = 0;
|
||||
foreach ($centers as $center) {
|
||||
@@ -93,6 +91,12 @@ final readonly class FilterListAccompanyingPeriodHelper implements FilterListAcc
|
||||
++$i;
|
||||
}
|
||||
|
||||
$qb->andWhere($aclConditionsOrX);
|
||||
// Prevent invalid/empty WHERE when no conditions were added (e.g., no centers available)
|
||||
if (method_exists($aclConditionsOrX, 'getParts') && 0 === count($aclConditionsOrX->getParts())) {
|
||||
// No allowed conditions => return no rows
|
||||
$qb->andWhere('1 = 0');
|
||||
} else {
|
||||
$qb->andWhere($aclConditionsOrX);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user