Skip to content

Commit

Permalink
Fixed issue: RemoteControl add_participants did not return the actual…
Browse files Browse the repository at this point in the history
… saved values or errors
  • Loading branch information
c-schmitz committed Mar 27, 2021
1 parent ed93599 commit a7e9d31
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions application/helpers/remotecontrol/remotecontrol_handle.php
Original file line number Diff line number Diff line change
Expand Up @@ -1817,19 +1817,20 @@ public function add_participants($sSessionKey, $iSurveyID, $aParticipantData, $b
return array('status' => 'No survey participants table');
}
$aDestinationFields = array_flip(Token::model($iSurveyID)->getMetaData()->tableSchema->columnNames);
$aReturn = [];
foreach ($aParticipantData as &$aParticipant) {
$token = Token::create($iSurveyID);
$token->setAttributes(array_intersect_key($aParticipant, $aDestinationFields));
if ($bCreateToken) {
$token->generateToken();
}
if ($token->encryptSave(true)) {
$aParticipant = $token->getAttributes();
$aReturn[] = $token->getAttributes();
} else {
$aParticipant["errors"] = $token->errors;
$aReturn["errors"][] = $token->errors;
}
}
return $aParticipantData;
return $aReturn;
} else {
return array('status' => 'No permission');
}
Expand Down

0 comments on commit a7e9d31

Please sign in to comment.