return getDefunts empty when the user connected is not in thanato list yet

This commit is contained in:
Tiavina 2025-01-09 16:39:50 +03:00
parent fecb319d6b
commit 66af13b124

View File

@ -486,19 +486,18 @@ class Bdd {
$conditions = [];
if($isUserThanatoOnly){
$thanato = $this->getThanatoByIdNextcloud($idNextcloud);
if($thanato != null){
if($thanato == null){
return json_encode([]);
}
$thanatoId = $thanato["id"];
$defuntsIdRelatedToThanato = $this->getDefuntIdsRelatedToThanato($thanatoId);
if(!empty($defuntsIdRelatedToThanato)){
if(empty($defuntsIdRelatedToThanato)){
return json_encode([]);
}
$defuntListConditionPlaceholder = implode(',', array_fill(0, count($defuntsIdRelatedToThanato), '?'));
$conditions = $defuntsIdRelatedToThanato;
$sql .= " WHERE ".$this->tableprefix."defunt.id IN ($defuntListConditionPlaceholder)";
}
else{
return json_encode([]);
}
}
}
$sql .= " ORDER BY ".$this->tableprefix."defunt.id DESC;";
$defuntsList = $this->execSQLNoJsonReturn($sql,$conditions);