From c98afd6e58c0629bad52a5d85c3bd711d060c2d9 Mon Sep 17 00:00:00 2001 From: Olle Haerstedt Date: Tue, 20 Dec 2016 16:04:06 +0100 Subject: [PATCH] Fixed issue #12012: Partcipant with invlaid email are silently deleted --- application/controllers/admin/tokens.php | 8 ++++++-- application/views/admin/token/addtokenpost.php | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/application/controllers/admin/tokens.php b/application/controllers/admin/tokens.php index 7b215636665..3a4a2c19406 100644 --- a/application/controllers/admin/tokens.php +++ b/application/controllers/admin/tokens.php @@ -596,7 +596,7 @@ public function addnew($iSurveyId) 'validuntil' => $validuntil, ); - // add attributes + // Add attributes $attrfieldnames = Survey::model()->findByPk($iSurveyId)->tokenAttributes; $aTokenFieldNames=Yii::app()->db->getSchema()->getTable("{{tokens_$iSurveyId}}",true); $aTokenFieldNames=array_keys($aTokenFieldNames->columns); @@ -618,10 +618,14 @@ public function addnew($iSurveyId) $token = Token::create($iSurveyId); $token->setAttributes($aData, false); $inresult = $token->save(); - $aData['success'] = true; + $aData['success'] = $inresult; + $aData['errors'] = $token->getErrors(); } else { $aData['success'] = false; + $aData['errors'] = array( + 'token' => array(gT("There is already an entry with that exact token in the table. The same token cannot be used in multiple entries.")) + ); } $aData['thissurvey'] = getSurveyInfo($iSurveyId); diff --git a/application/views/admin/token/addtokenpost.php b/application/views/admin/token/addtokenpost.php index d97023e506a..fcc177b95c2 100644 --- a/application/views/admin/token/addtokenpost.php +++ b/application/views/admin/token/addtokenpost.php @@ -29,7 +29,9 @@

Add token entry

-

+ +

+
', '_top')" />