Skip to content

Commit

Permalink
Fixed issue #16738: Check logic, error in question group shown as err…
Browse files Browse the repository at this point in the history
…or in question
  • Loading branch information
olleharstedt committed Oct 15, 2020
2 parents 153f23a + e7a55b3 commit f65ff25
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
12 changes: 12 additions & 0 deletions application/helpers/expressions/em_core_helper.php
Expand Up @@ -1612,6 +1612,18 @@ public function ResetWarnings()
$this->RDP_warnings = array();
}

/**
* Reset current errors
* @see Related issue #16738: https://bugs.limesurvey.org/view.php?id=16738
* @link https://bugs.limesurvey.org/view.php?id=16738
* ProcessBooleanExpression didn't reset RDP_errors anb RDP_warnings, need a way to reset for Survey logic checking
* @return void
*/
public function ResetErrors()
{
$this->RDP_errs = array();
}

/**
* Return true if there are syntax errors
* @return boolean
Expand Down
15 changes: 10 additions & 5 deletions application/helpers/expressions/em_manager_helper.php
Expand Up @@ -9539,10 +9539,12 @@ static public function ShowSurveyLogicFile($sid, $gid=NULL, $qid=NULL,$LEMdebugL
$gid = $q['info']['gid'];
$qid = $q['info']['qid'];
$qseq = $q['info']['qseq'];
$LEM->em->ResetWarnings();
$LEM->em->ResetErrors();
$errorCount=0;
/* @var warnings information for current question, see ExpressionManager::RDP_warnings */
$aWarnings = array();
$LEM->em->ResetWarnings();

//////
// SHOW GROUP-LEVEL INFO
//////
Expand All @@ -9562,18 +9564,21 @@ static public function ShowSurveyLogicFile($sid, $gid=NULL, $qid=NULL,$LEMdebugL
$bGroupHaveError=$bGroupHaveError || $LEM->em->HasErrors();
$sGroupText= viewHelper::purified(viewHelper::filterScript($LEM->GetLastPrettyPrintExpression()));
$editlink = Yii::app()->getController()->createUrl('admin/questiongroups/sa/view/surveyid/' . $LEM->sid . '/gid/' . $gid);
$errText = "";
if($bGroupHaveError)
{
$errClass='text-danger';
$errClass = 'danger';
$errText = "<br><em class='label label-danger'>".$LEM->gT("This group has at least 1 error.")."</em>";
}
$groupRow = "<tr class='LEMgroup'>"
. "<td class='$errClass'>G-$gseq</td>"
. "<td><b>".viewHelper::flatEllipsizeText($ginfo['group_name'])."</b><br />[<a target='_blank' href='$editlink'>GID ".$gid."</a>]</td>"
. "<td>".$sGroupRelevance."</td>"
. "<td>".$sGroupText."</td>"
. "<td><b>".viewHelper::flatEllipsizeText($ginfo['group_name'])."</b><br />[<a target='_blank' href='$editlink'>GID ".$gid."</a>] {$errText}</td>"
. "<td>{$sGroupRelevance}</td>"
. "<td>{$sGroupText}</td>"
. "</tr>\n";
$out .= $groupRow;
$LEM->em->ResetWarnings();
$LEM->em->ResetErrors();
}

//////
Expand Down

0 comments on commit f65ff25

Please sign in to comment.