mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
Fixed: fix empty result in household api search
fix https://gitlab.com/Chill-Projet/chill-bundles/-/issues/85
This commit is contained in:
@@ -84,15 +84,19 @@ class SearchHouseholdApiProvider implements SearchApiInterface
|
||||
count($phoneResult->getFound()) > 0 ? $phoneResult->getFound()[0] : null
|
||||
);
|
||||
|
||||
$previousFrom = $query->getFromClause();
|
||||
$previousParams = $query->getFromParams();
|
||||
|
||||
$query
|
||||
->setDistinct(true, 'household_id')
|
||||
->setDistinct(true, 'cpphm.household_id')
|
||||
->setFromClause(
|
||||
'view_chill_person_household_address AS vcpha ' .
|
||||
'JOIN chill_person_person AS person ON vcpha.person_id = person.id'
|
||||
$previousFrom . ' '.
|
||||
'JOIN chill_person_household_members AS cpphm ON cpphm.person_id = person.id',
|
||||
$previousParams
|
||||
)
|
||||
->andWhereClause('(cpphm.startDate <= NOW() AND (cpphm.endDate IS NULL or cpphm.endDate > NOW()))')
|
||||
->setSelectKey('household')
|
||||
->andWhereClause('vcpha.validTo IS NULL', [])
|
||||
->setSelectJsonbMetadata("jsonb_build_object('id', vcpha.household_id)");
|
||||
->setSelectJsonbMetadata("jsonb_build_object('id', cpphm.household_id)");
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
Reference in New Issue
Block a user