Skip to content

Commit

Permalink
Merge branch 'MDL-31998_27' of git://github.com/grabs/moodle into MOO…
Browse files Browse the repository at this point in the history
…DLE_27_STABLE
  • Loading branch information
Damyon Wiese committed Jun 16, 2014
2 parents 1742e76 + 253bbbb commit b3b4f9a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions mod/feedback/lib.php
Expand Up @@ -2231,6 +2231,22 @@ function feedback_check_values($firstitem, $lastitem) {
}
$value = $itemobj->clean_input_value($value);

// If the item is not visible due to its dependency so it shouldn't be required.
// Many thanks to Pau Ferrer Ocaña.
if ($item->dependitem > 0 AND $item->required == 1) {
$comparevalue = false;
if ($feedbackcompletedtmp = feedback_get_current_completed($item->feedback, true)) {
$comparevalue = feedback_compare_item_value($feedbackcompletedtmp->id,
$item->dependitem,
$item->dependvalue,
true);
}

if (!$comparevalue) {
$item->required = 0; // Override the required property.
}
}

//check if the value is set
if (is_null($value) AND $item->required == 1) {
return false;
Expand Down

0 comments on commit b3b4f9a

Please sign in to comment.