Skip to content

Commit

Permalink
Fixed issue #5092: Error during preview of questions that are using r…
Browse files Browse the repository at this point in the history
…eplacement field from a previous question

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey@9987 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed Apr 11, 2011
1 parent a9d0c81 commit ffd8351
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions admin/preview.php
Expand Up @@ -87,6 +87,18 @@ function noop_checkconditions(value, name, type)
$question['class'] = question_class($qrows['type']);
$question['essentials'] = 'id="question'.$qrows['qid'].'"';
$question['sgq']=$ia[1];

//Temporary fix for error condition arising from linked question via replacement fields
//@todo: find a consistent way to check and handle this - I guess this is already handled but the wrong values are entered into the DB

$search_for = '{INSERTANS';
if(strpos($question['text'],$search_for)!==false){
$pattern_text = '/{([A-Z])*:([0-9])*X([0-9])*X([0-9])*}/';
$replacement_text = $clang->gT('[Dependency on another question (ID $4)]');
$text = preg_replace($pattern_text,$replacement_text,$question['text']);
$question['text']=$text;
}

if ($qrows['mandatory'] == 'Y')
{
$question['man_class'] = ' mandatory';
Expand Down

0 comments on commit ffd8351

Please sign in to comment.