diff --git a/php/libraries/Candidate.class.inc b/php/libraries/Candidate.class.inc index 81e7edeadf5..c2acc33df62 100644 --- a/php/libraries/Candidate.class.inc +++ b/php/libraries/Candidate.class.inc @@ -409,7 +409,7 @@ class Candidate function getProjectTitle() { $ProjectList = Utility::getProjectList(); - return $ProjectList[$this->getProjectID()]; + return $ProjectList[$this->getProjectID()] ?? ''; } /** @@ -621,15 +621,13 @@ class Candidate $db = $factory->database(); $candID = $this->getCandID(); - - $query = "SELECT Visit_label - FROM session s JOIN candidate c ON (c.CandID = s.CandID) - WHERE c.CandID=:cid AND Date_Visit IS NOT NULL - ORDER BY Date_Visit"; + $query = "SELECT Visit_label FROM session + LEFT JOIN candidate USING (CandID) + WHERE CandID = :cid AND VisitNo = 1 + AND Entity_type <> 'Scanner'"; $where = array('cid' => $candID); - $vLabel = $db->pselectOne($query, $where); - - return $vLabel; + $result = $db->pselectOne($query, $where); + return $result ?? ''; } /**