Skip to content

Commit

Permalink
Fixed issue #13804: Error about Data security policy shown when chang…
Browse files Browse the repository at this point in the history
…e language + clear all
  • Loading branch information
lacrioque committed Jul 9, 2018
1 parent ad9f957 commit 5ebfde0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
15 changes: 10 additions & 5 deletions application/helpers/SurveyRuntimeHelper.php
Expand Up @@ -935,6 +935,7 @@ private function displayFirstPageIfNeeded()
$bDisplayFirstPage = ($this->sSurveyMode != 'survey' && $_SESSION[$this->LEMsessid]['step'] == 0);

if ($this->sSurveyMode == 'survey' || $bDisplayFirstPage) {

//Failsave to have a general standard value
if (empty($this->aSurveyInfo['datasecurity_notice_label'])) {
$this->aSurveyInfo['datasecurity_notice_label'] = gT("To continue please first accept our survey data policy.");
Expand All @@ -943,6 +944,8 @@ private function displayFirstPageIfNeeded()
if (empty($this->aSurveyInfo['datasecurity_error'])) {
$this->aSurveyInfo['datasecurity_error'] = gT("We are sorry but you can't proceed without first agreeing to our survey data policy.");
}


$this->aSurveyInfo['datasecurity_notice_label'] = Survey::replacePolicyLink($this->aSurveyInfo['datasecurity_notice_label'],$this->aSurveyInfo['sid']);
}

Expand All @@ -954,16 +957,18 @@ private function displayFirstPageIfNeeded()
}

private function checkForDataSecurityAccepted(){
if($this->param['thisstep'] === '0' && Survey::model()->findByPk($this->aSurveyInfo['sid'])->showsurveypolicynotice>0) {
$data_security_accepted = App()->request->getPost('datasecurity_accepted', false);
// if($data_security_accepted !== 'on' && ($this->aSurveyInfo['active'] == 'Y')){
if($data_security_accepted !== 'on'){
$this->aSurveyInfo['datasecuritynotaccepted'] = false;
if($this->param['thisstep'] === '0' && Survey::model()->findByPk($this->aSurveyInfo['sid'])->showsurveypolicynotice>0) {
$data_security_accepted = App()->request->getPost('datasecurity_accepted', false);
$move_step = App()->request->getPost('move', false);

if($data_security_accepted !== 'on' && ($move_step !== 'default')){
$_SESSION[$this->LEMsessid]['step'] = 0;
$this->aSurveyInfo['datasecuritynotaccepted'] = true;
$this->displayFirstPageIfNeeded(true);
Yii::app()->end(); // So we can still see debug messages
}
}
}
}

/**
Expand Down
1 change: 1 addition & 0 deletions themes/survey/vanilla/scripts/theme.js
Expand Up @@ -279,6 +279,7 @@ var ThemeScripts = function(){
var initWelcomePage = function(){
logObject.log('Starting up for first page');
if($('#datasecurity_accepted').length >0) {
$('#ls-button-submit').prop('disabled', true);
/*
* #### Animation function doesn't work on IE -> Deactivate until now.
* $('#ls-button-submit').prop('disabled', true).parent().on('mouseenter', function(e){
Expand Down
Expand Up @@ -20,7 +20,7 @@
<div class="row">
<div class="col-sm-12">
<label for="datasecurity_accepted" class="control-label {{ aSurveyInfo.class.privacydataseccheckboxlabel }}">{{ aSurveyInfo.datasecurity_notice_label }}</label>
&nbsp;<input required class="{{ aSurveyInfo.class.privacydataseccheckbox }}" type="checkbox" name="datasecurity_accepted" id="datasecurity_accepted" />
&nbsp;<input class="{{ aSurveyInfo.class.privacydataseccheckbox }}" type="checkbox" name="datasecurity_accepted" id="datasecurity_accepted" />
</div>
</div>
<div class="modal fade" id="data-security-modal-{{aSurveyInfo.sid}}">
Expand Down

0 comments on commit 5ebfde0

Please sign in to comment.