Commit 39a2c4dd authored by Chenu Denis's avatar Chenu Denis
Browse files

[fix] Remove uneeded extraSurveyCheckExtraRight since code is fixed

- Update reloadAnyReponse plugin !
parent 73e0e298
......@@ -7,7 +7,7 @@
<lastUpdate>2022-06-10</lastUpdate>
<author>Denis Chenu</author>
<authorUrl>https://sondages.pro</authorUrl>
<version>5.2.2</version>
<version>5.3.0</version>
<license>AGPL</license>
<description><![CDATA[Add survey inside survey : use reloadAnyResponse plugin.]]></description>
</metadata>
......
......@@ -6,7 +6,7 @@
* @copyright 2017-2022 Denis Chenu <www.sondages.pro>
* @copyright 2017 OECD (Organisation for Economic Co-operation and Development ) <www.oecd.org>
* @license AGPL v3
* @version 5.2.2
* @version 5.3.0
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
......@@ -237,16 +237,6 @@ class questionExtraSurvey extends PluginBase
'help'=>$this->translate('If you have responseListAndManage, the response list can be found using the group of current token. If the related survey have a token table : token stay mandatory.'),
'caption'=>$this->translate('Usage of token.'),
),
/* Allow to disable startUrl for speed */
'extraSurveyCheckExtraRight'=> array(
'types' => 'XT',
'category' => $this->translate('Extra survey'),
'sortorder' => 29,
'inputtype' => 'switch',
'default' => 1,
'help' => $this->translate('With token access, for performance issue you can disable checking extra permission for editing response by reloadAnyReponse.'),
'caption' => $this->translate('Check extra rights on survey.'),
),
'extraSurveyQuestion'=>array(
'types'=>'XT',
'category'=>$this->translate('Extra survey'),
......@@ -1143,7 +1133,6 @@ class questionExtraSurvey extends PluginBase
$showId =trim($aAttributes['extraSurveyShowId']);
$orderBy = isset($aAttributes['extraSurveyOrderBy']) ? trim($aAttributes['extraSurveyOrderBy']) : null;
$qCodeSrid = trim($aAttributes['extraSurveyQuestionLink']);
$useStartUrl = isset($aAttributes['extraSurveyCheckExtraRight']) ? boolval($aAttributes['extraSurveyCheckExtraRight']) : true;
$tokenUsage = $aAttributes['extraSurveyTokenUsage'];
$aOtherFields = $this->getOtherField($qid);
......@@ -1169,7 +1158,6 @@ class questionExtraSurvey extends PluginBase
if ($token) {
switch ($tokenUsage) {
case 'no':
$useStartUrl = true;
break;
case 'group':
\reloadAnyResponse\Utilities::setForcedAllowedSettings($surveyId, 'allowTokenGroupUser');
......@@ -1179,8 +1167,6 @@ class questionExtraSurvey extends PluginBase
default:
$oCriteria->compare("token", $token);
}
} else {
$useStartUrl = true;
}
if ($qCodeSrid && $srid) {
$oQuestionSrid=Question::model()->find("sid=:sid and title=:title and parent_qid=0", array(":sid"=>$surveyId,":title"=>$qCodeSrid));
......@@ -1243,13 +1229,12 @@ class questionExtraSurvey extends PluginBase
$oResponses = Response::model($surveyId)->findAll($oCriteria);
$aResponses = array();
if ($oResponses) {
if ($useStartUrl) {
if ($tokenUsage == 'no') {
$oStartUrl = new \reloadAnyResponse\StartUrl($surveyId);
} else {
$oStartUrl = new \reloadAnyResponse\StartUrl($surveyId, $token);
}
if ($tokenUsage == 'no') {
$oStartUrl = new \reloadAnyResponse\StartUrl($surveyId);
} else {
$oStartUrl = new \reloadAnyResponse\StartUrl($surveyId, $token);
}
foreach ($oResponses as $oResponse) {
$aResponses[$oResponse->id]=array(
'submitdate'=>$oResponse->submitdate,
......@@ -1281,24 +1266,11 @@ class questionExtraSurvey extends PluginBase
if (empty($aResponses[$oResponse->id]['text'])) {
$aResponses[$oResponse->id]['text'] .= $oResponse->id;
}
if ($useStartUrl) {
$aResponses[$oResponse->id]['url'] = $oStartUrl->getUrl(
$oResponse->id,
array('extrasurveyqid' => $qid),
$tokenUsage == 'no'
);
} else {
$aResponses[$oResponse->id]['url'] = App()->createUrl(
"survey/index",
array(
'sid' => $surveyId,
'srid' => $oResponse->id,
'token' => $token,
'extrasurveyqid' => $qid,
'lang' => App()->getLanguage(),
)
);
}
$aResponses[$oResponse->id]['url'] = $oStartUrl->getUrl(
$oResponse->id,
array('extrasurveyqid' => $qid),
$tokenUsage == 'no'
);
}
}
return $aResponses;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment