From 54a7e008913cb30688f779eb9f68c74c2b20d3ca Mon Sep 17 00:00:00 2001 From: Carsten Schmitz Date: Mon, 8 Nov 2021 16:55:14 +0100 Subject: [PATCH] Fixed issue: Database error when deleting a participant from CPDB and connected survey participant tables --- application/models/Participant.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/application/models/Participant.php b/application/models/Participant.php index 10a424127c8..f0aff4f2222 100755 --- a/application/models/Participant.php +++ b/application/models/Participant.php @@ -1083,7 +1083,9 @@ public function deleteParticipantTokenAnswer($sParticipantsIDs) if (!empty($tokenAndId['participant_id']) && $surveyTableExists) { /** @var Token $token */ $token = Token::model($aSurveyID)->find('participant_id = :pid', [':pid' => $tokenAndId['participant_id']]); - $token->delete(); + if (!is_null($token)) { + $token->delete(); + } } $iDeletedParticipants = $this->deleteParticipants($sParticipantsIDs, false); }