Skip to content

Commit

Permalink
Merge pull request #2108 from gabrieljenik/bug/17628--Inconsistent-er…
Browse files Browse the repository at this point in the history
…ror-message-in-case-of-soft-mandatory

Fixed issue #17628: Inconsistent error message in case of soft mandatory
  • Loading branch information
glimz committed Nov 1, 2021
2 parents a1de78f + 71c97c5 commit 6bb4ba6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
6 changes: 5 additions & 1 deletion application/helpers/SurveyRuntimeHelper.php
Expand Up @@ -1442,7 +1442,11 @@ private function getErrorHtmlMessage()

//Mandatory question(s) with unanswered answer
if ($this->aStepInfo['mandViolation'] && $this->okToShowErrors) {
$aErrorsMandatory[] = gT("One or more mandatory questions have not been answered. You cannot proceed until these have been completed.");
if ($this->aStepInfo['mandNonSoft']) {
$aErrorsMandatory[] = gT("One or more mandatory questions have not been answered. You cannot proceed until these have been completed.");
} else {
$aErrorsMandatory[] = gT("One or more mandatory questions have not been answered. If possible, please complete them before continuing to the next page.");
}
}

// Question(s) with not valid answer(s)
Expand Down
1 change: 1 addition & 0 deletions application/helpers/expressions/em_manager_helper.php
Expand Up @@ -5752,6 +5752,7 @@ public function _ValidateGroup($groupSeq, $force = false)
'valid' => $gvalid,
'mandViolation' => $gmandViolation,
'mandSoft' => $gmandSoft,
'mandNonSoft' => $gmandNonSoft,
'show' => (($grel && !$ghidden) ? true : false),
];

Expand Down
8 changes: 7 additions & 1 deletion application/helpers/qanda_helper.php
Expand Up @@ -310,7 +310,13 @@ function mandatory_popup($ia, $notanswered = null)
//ADD WARNINGS TO QUESTIONS IF THEY WERE MANDATORY BUT NOT ANSWERED
global $mandatorypopup, $popup;
//POPUP WARNING
if (!isset($mandatorypopup) && ($ia[4] == 'T' || $ia[4] == 'S' || $ia[4] == 'U')) {
// If there is no "hard" mandatory violation (both current and previous violations belong to Soft Mandatory questions),
// we show the soft mandatory message.
if ($ia[6] == 'S' && (!isset($mandatorypopup) || $mandatorypopup == 'S')) {
$popup = gT("One or more mandatory questions have not been answered. If possible, please complete them before continuing to the next page.");
$mandatorypopup = "S";
} elseif (!isset($mandatorypopup) && ($ia[4] == 'T' || $ia[4] == 'S' || $ia[4] == 'U')) {
// If
$popup = gT("You cannot proceed until you enter some text for one or more questions.");
$mandatorypopup = "Y";
} else {
Expand Down

0 comments on commit 6bb4ba6

Please sign in to comment.