diff --git a/gestion/lib/Db/Bdd.php b/gestion/lib/Db/Bdd.php index 33f3fd8..0858e46 100644 --- a/gestion/lib/Db/Bdd.php +++ b/gestion/lib/Db/Bdd.php @@ -486,18 +486,17 @@ class Bdd { $conditions = []; if($isUserThanatoOnly){ $thanato = $this->getThanatoByIdNextcloud($idNextcloud); - if($thanato != null){ - $thanatoId = $thanato["id"]; - $defuntsIdRelatedToThanato = $this->getDefuntIdsRelatedToThanato($thanatoId); - if(!empty($defuntsIdRelatedToThanato)){ - $defuntListConditionPlaceholder = implode(',', array_fill(0, count($defuntsIdRelatedToThanato), '?')); - $conditions = $defuntsIdRelatedToThanato; - $sql .= " WHERE ".$this->tableprefix."defunt.id IN ($defuntListConditionPlaceholder)"; - } - else{ - return json_encode([]); - } + if($thanato == null){ + return json_encode([]); } + $thanatoId = $thanato["id"]; + $defuntsIdRelatedToThanato = $this->getDefuntIdsRelatedToThanato($thanatoId); + if(empty($defuntsIdRelatedToThanato)){ + return json_encode([]); + } + $defuntListConditionPlaceholder = implode(',', array_fill(0, count($defuntsIdRelatedToThanato), '?')); + $conditions = $defuntsIdRelatedToThanato; + $sql .= " WHERE ".$this->tableprefix."defunt.id IN ($defuntListConditionPlaceholder)"; } $sql .= " ORDER BY ".$this->tableprefix."defunt.id DESC;";