diff --git a/application/helpers/common_helper.php b/application/helpers/common_helper.php index 4a3cc0f9eb6..0b30ae51c18 100644 --- a/application/helpers/common_helper.php +++ b/application/helpers/common_helper.php @@ -1878,7 +1878,7 @@ function getsidgidqidaidtype($fieldcode) // but fails for type M and type P multiple choice // questions because the SESSION fieldcode is combined // and we want here to pass only the sidXgidXqid for type M and P - $fields=arraySearchByKey($fieldcode, createFieldMap($fsid), "fieldname", 1); + $fields=arraySearchByKey($fieldcode, createFieldMap($fsid,'full'), "fieldname", 1); if (count($fields) != 0) { @@ -2495,7 +2495,7 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi $aquery.=" ORDER BY group_order, question_order"; */ $CI->load->model('conditions_model'); $CI->load->model('defaultvalues_model'); - $aresult = $CI->conditions_model->getConditions($surveyid,$questionid,$s_lang) or safe_die ("Couldn't get list of questions in createFieldMap function.
$query
"); //Checked + $aresult = $CI->conditions_model->getConditions($surveyid,$questionid,$s_lang) or safe_die ("Couldn't get list of questions in createFieldMap function.
".$CI->db->last_query()."
"); //Checked foreach ($aresult->result_array() as $arow) //With each question, create the appropriate field(s)) { @@ -3163,7 +3163,7 @@ function buildLabelSetCheckSumArray() FROM ".db_table_name('labels')." WHERE lid={$row['lid']} ORDER BY language, sortorder, code"; */ - $result2 = $CI->labels_model->getLabelCodeInfo($row['lid']) or show_error("safe_died querying labelset $lid
"); //Checked + $result2 = $CI->labels_model->getLabelCodeInfo($row['lid']) or show_error("safe_died querying labelset ".$row['lid']."
"); //Checked foreach ($result2->result_array() as $row2) { $thisset .= implode('.', $row2); @@ -4874,7 +4874,8 @@ function getArrayFilterExcludesForQuestion($qid) $dbprefix = $CI->db->dbprefix; // TODO: Check list_filter values to make sure questions are previous? - $surveyid = $CI->config->item('sid'); +// $surveyid = $CI->config->item('sid'); + $surveyid=returnglobal('sid'); $qid=sanitize_int($qid); if (isset($cache[$qid])) return $cache[$qid]; diff --git a/application/helpers/expressions/em_manager_helper.php b/application/helpers/expressions/em_manager_helper.php index cb85674459f..a8a278498c4 100644 --- a/application/helpers/expressions/em_manager_helper.php +++ b/application/helpers/expressions/em_manager_helper.php @@ -540,7 +540,7 @@ public function setVariableAndTokenMappingsForExpressionManager($surveyid,$force // TODO - should these arrays only be built for questions that require substitution at run-time? $ansList = ''; - if (!is_null($ansArray)) { + if (isset($ansArray) && !is_null($ansArray)) { $answers = array(); foreach ($ansArray as $key => $value) { $answers[] = "'" . $key . "':'" . htmlspecialchars(preg_replace('/[[:space:]]/',' ',$value),ENT_QUOTES) . "'"; @@ -795,7 +795,7 @@ static function StartProcessingGroup($groupNum=NULL,$anonymized=false,$surveyid= $LEM->qid2code = array(); // List of codes for each question - needed to know which to NULL if a question is irrelevant $LEM->jsVar2qid = array(); - if (!is_null($surveyid) && $LEM->setVariableAndTokenMappingsForExpressionManager($surveyid,true,$anonymized,$LEM->allOnOnePage)) + if (!is_null($surveyid) && $LEM->setVariableAndTokenMappingsForExpressionManager($surveyid,false,$anonymized,$LEM->allOnOnePage)) { // means that some values changed, so need to update what was registered to ExpressionManager $LEM->em->RegisterVarnamesUsingMerge($LEM->knownVars); diff --git a/application/helpers/frontend_helper.php b/application/helpers/frontend_helper.php index ac8426eafec..ec271ef61e3 100644 --- a/application/helpers/frontend_helper.php +++ b/application/helpers/frontend_helper.php @@ -872,7 +872,7 @@ function checkUploadedFileValidity($surveyid, $move, $backok=null) if (!isset($backok) || $backok != "Y") { global $dbprefix; - $fieldmap = createFieldMap($surveyid); + $fieldmap = createFieldMap($surveyid,'full'); if (isset($_POST['fieldnames']) && $_POST['fieldnames']!="") { @@ -979,7 +979,7 @@ function aCheckInput($surveyid, $move,$backok=null) if (!isset($backok) || $backok != "Y") { global $dbprefix; - $fieldmap=createFieldMap($surveyid); + $fieldmap=createFieldMap($surveyid, 'full'); if (isset($_POST['fieldnames'])) { $fields=explode("|", $_POST['fieldnames']); diff --git a/application/libraries/Save.php b/application/libraries/Save.php index 718e7f76bf0..b2955b2bf5f 100644 --- a/application/libraries/Save.php +++ b/application/libraries/Save.php @@ -188,7 +188,7 @@ function run($args) { elseif (isset($move)) { // This else block is only there to take care of date conversion if the survey is not active - otherwise this is done in creatInsertQuery - $fieldmap=createFieldMap($surveyid); //Creates a list of the legitimate questions for this survey + $fieldmap=createFieldMap($surveyid,'full'); //Creates a list of the legitimate questions for this survey $inserts=array_unique($_SESSION['insertarray']); foreach ($inserts as $value) {