Merge branch 'fix_household_export' into 'master'

Fix household export

See merge request Chill-Projet/chill-bundles!640
This commit is contained in:
LenaertsJ 2023-12-20 10:46:30 +00:00
commit afb79141f0
4 changed files with 17 additions and 5 deletions

View File

@ -0,0 +1,6 @@
kind: Fixed
body: Fix the household export query to exclude accompanying periods that are in draft
state.
time: 2023-12-18T16:21:57.827287397+01:00
custom:
Issue: ""

View File

@ -17,6 +17,7 @@ use Chill\MainBundle\Export\GroupedExportInterface;
use Chill\MainBundle\Form\Type\PickRollingDateType;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Household\Household;
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
use Chill\PersonBundle\Export\Declarations;
@ -121,7 +122,9 @@ class CountHouseholdInPeriod implements ExportInterface, GroupedExportInterface
->join('acppart.accompanyingPeriod', 'acp')
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL')
->andWhere('hmember.startDate <= :count_household_at_date AND (hmember.endDate IS NULL OR hmember.endDate > :count_household_at_date)')
->setParameter('count_household_at_date', $this->rollingDateConverter->convert($data['calc_date']));
->andWhere('acp.step != :count_acp_step')
->setParameter('count_household_at_date', $this->rollingDateConverter->convert($data['calc_date']))
->setParameter('count_acp_step', AccompanyingPeriod::STEP_DRAFT);
$qb
->select('COUNT(DISTINCT household.id) AS household_export_result')

View File

@ -20,6 +20,7 @@ use Chill\MainBundle\Export\ListInterface;
use Chill\MainBundle\Form\Type\PickRollingDateType;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Household\Household;
use Chill\PersonBundle\Entity\Household\HouseholdComposition;
use Chill\PersonBundle\Entity\Household\HouseholdMember;
@ -144,7 +145,9 @@ class ListHouseholdInPeriod implements ListInterface, GroupedExportInterface
->join('acppart.accompanyingPeriod', 'acp')
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL')
->andWhere('hmember.startDate <= :count_household_at_date AND (hmember.endDate IS NULL OR hmember.endDate > :count_household_at_date)')
->setParameter('count_household_at_date', $this->rollingDateConverter->convert($data['calc_date']));
->andWhere('acp.step != :list_acp_step')
->setParameter('count_household_at_date', $this->rollingDateConverter->convert($data['calc_date']))
->setParameter('list_acp_step', AccompanyingPeriod::STEP_DRAFT);
if ($this->filterStatsByCenters) {
$qb