Skip to content

Commit

Permalink
Fixed issue #14270: value, valueNAOK etc … broken with GET params
Browse files Browse the repository at this point in the history
Dev: remove usage of LimeExpressionManager in prefillFromCommandLine function
Dev: since it can broke a lot EM : log potential error in setVariableAndTokenMappingsForExpressionManager
  • Loading branch information
Shnoulle committed Nov 22, 2018
1 parent d120aa3 commit 0c41165
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
5 changes: 4 additions & 1 deletion application/helpers/expressions/em_manager_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3623,7 +3623,10 @@ public function setVariableAndTokenMappingsForExpressionManager($surveyid,$force
$now = microtime(true);
$this->em->SetSurveyMode($this->surveyMode);
$survey = Survey::model()->findByPk($surveyid);

if(empty($this->surveyOptions)) {
/* Log it as error : this need some test */
Yii::log('setVariableAndTokenMappingsForExpressionManager with an empty surveyOptions.','error','application.LimeExpressionManager');
}
// TODO - do I need to force refresh, or trust that createFieldMap will cache langauges properly?
$fieldmap=createFieldMap($survey,$style='full',$forceRefresh,false,$_SESSION['LEMlang']);
$this->sid= $surveyid;
Expand Down
17 changes: 7 additions & 10 deletions application/helpers/frontend_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -881,22 +881,19 @@ function prefillFromCommandLine($surveyid)
if (Yii::app()->getRequest()->getRequestType()=='GET') {
$getValues = array_diff_key($_GET,array_combine($reservedGetValues, $reservedGetValues));
if(!empty($getValues)) {
$qcode2sgqa = LimeExpressionManager::getLEMqcode2sgqa($surveyid);
$qcode2sgqa = array();
Yii::import('application.helpers.viewHelper');
foreach ($_SESSION['survey_'.$surveyid]['fieldmap'] as $sgqa => $details) {
$qcode2sgqa[viewHelper::getFieldCode($details,array('LEMcompat'=>true))] = $sgqa;
}
foreach ($getValues as $k=>$v) {
tracevar($k);
if (isset($_SESSION['survey_'.$surveyid]['fieldmap'][$k])) {
// sXgXqa prefilling
$startingValues[$k] = $v;
} elseif( !empty($qcode2sgqa) && array_key_exists($k,$qcode2sgqa) ) {
} elseif( array_key_exists($k,$qcode2sgqa) ) {
// EM code prefilling
$startingValues[$qcode2sgqa[$k]] = $v;
/* Alternative
foreach ($_SESSION['survey_'.$surveyid]['fieldmap'] as $sgqa => $details) {
// Need Yii::import('application.helpers.viewHelper');
if (viewHelper::getFieldCode($details,array('LEMcompat'=>true)) == $k) {
$startingValues[$sgqa] = $v;
}
}
*/
}
}
}
Expand Down

0 comments on commit 0c41165

Please sign in to comment.