Skip to content

Commit

Permalink
Dev: Abort if response is not found in the database
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Feb 21, 2020
1 parent f9820ab commit 583d666
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions application/helpers/expressions/em_manager_helper.php
Expand Up @@ -5622,6 +5622,12 @@ private function _UpdateValuesInDatabase($finished=false)
if (isset($_SESSION[$this->sessid]['srid']) && $this->surveyOptions['active'])
{
$oResponse = Response::model($this->sid)->findByPk($_SESSION[$this->sessid]['srid']);
if (empty($oResponse)) {
// This can happen if admin deletes incomple response while survey is running.
$message = submitfailed('', $this->gT('Error on response update'));

This comment has been minimized.

Copy link
@Shnoulle

Shnoulle Feb 21, 2020

Collaborator
  1. We need to send to admin user : This data was tryb to be saved but response srid didn't exist in survey id
  2. We must just show a "There are a respose on update, an email was sent to admin" ro public user.

Because they can try again and again : they data can never be saved ...

This comment has been minimized.

Copy link
@olleharstedt

olleharstedt Feb 21, 2020

Author Collaborator

On Monday...

This comment has been minimized.

Copy link
@maziminke

maziminke Feb 24, 2020

Collaborator

Usefual adjustments suggested by Denis!

This comment has been minimized.

Copy link
@olleharstedt

olleharstedt Feb 24, 2020

Author Collaborator

🐮 Mooo.

This comment has been minimized.

Copy link
@olleharstedt

olleharstedt Feb 24, 2020

Author Collaborator

image

LimeExpressionManager::addFrontendFlashMessage('error', $message, $this->sid);
return;
}
if ($oResponse->submitdate == null || Survey::model()->findByPk($this->sid)->alloweditaftercompletion == 'Y') {
$oResponse->setAttributes($aResponseAttributes, false);
if (!$oResponse->encryptSave())
Expand Down

0 comments on commit 583d666

Please sign in to comment.