Skip to content

Commit

Permalink
Fix PSR-12 in remote handler
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Jun 30, 2021
1 parent 6ed8242 commit f575bc5
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions application/helpers/remotecontrol/remotecontrol_handle.php
Original file line number Diff line number Diff line change
Expand Up @@ -2750,7 +2750,7 @@ public function update_response($sSessionKey, $iSurveyID, $aResponseData)
}

/**
* Delete a response in a given survey using its Id
* Delete a response in a given survey using its id
*
* RPC Routine to delete responses of particular id in a survey.
* Returns array
Expand All @@ -2761,35 +2761,32 @@ public function update_response($sSessionKey, $iSurveyID, $aResponseData)
* @param int $iResponseID Id of the response to delete
* @return array Result of the change action
*/
public function delete_responses($sSessionKey, $iSurveyID, $iResponseID)
{
// check sessionKey is valid or not
if ($this->_checkSessionKey($sSessionKey)){
$oSurvey = Survey::model()->findByPk($iSurveyID);
if (!isset($oSurvey)){
return array('status' => 'Error: Invalid survey ID');
public function delete_response($sSessionKey, $iSurveyID, $iResponseID)
{
// check sessionKey is valid or not
if ($this->_checkSessionKey($sSessionKey)) {
$oSurvey = Survey::model()->findByPk($iSurveyID);
if (!isset($oSurvey)) {
return array('status' => 'Error: Invalid survey ID');
}

if (Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'delete')){
if (Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'delete')) {
// get response id from response table using ID
$Response = Response::model($iSurveyID)->findByPk($iResponseID);
if ($Response){
if ($Response) {
// delete the files and timings and row
if ($Response->delete()){
return array($iResponseID=>'deleted');
if ($Response->delete()) {
return array($iResponseID => 'deleted');
}
return array('status' => 'Response not deleted for unknow reason');
}
else{
} else {
return array('status' => 'Response Id not found');
}
} else {
return array('status' => 'No permission');
}
else{
return array('status' => 'No permission');
}
}
else{
return array('status' => 'Invalid Session Key');
} else {
return array('status' => 'Invalid Session Key');
}
}

Expand Down

0 comments on commit f575bc5

Please sign in to comment.