Skip to content
Browse files

MDL-27521 Updates the can_finalize and can_unfinalize methods to deal…

… with passing a submission object that isn't one (in this case is a Boolean value). This will result in both methods now returning false. Kick on effect is that it corrects the bug described in MDL-27521 by removing the button if it isn't possible to finalize the submission.
  • Loading branch information...
1 parent 9de8774 commit 5e876cd379e2d2055aea32d16f7e13bfa94c3577 @dogma dogma committed with jsnfwlr
Showing with 10 additions and 0 deletions.
  1. +10 −0 mod/assignment/type/upload/assignment.class.php
View
10 mod/assignment/type/upload/assignment.class.php
@@ -918,9 +918,14 @@ function is_finalized($submission) {
}
function can_unfinalize($submission) {
+ if(is_bool($submission)) {
+ return false;
+ }
+
if (!$this->drafts_tracked()) {
return false;
}
+
if (has_capability('mod/assignment:grade', $this->context)
and $this->isopen()
and $this->is_finalized($submission)) {
@@ -932,6 +937,11 @@ function can_unfinalize($submission) {
function can_finalize($submission) {
global $USER;
+
+ if(is_bool($submission)) {
+ return false;
+ }
+
if (!$this->drafts_tracked()) {
return false;
}

0 comments on commit 5e876cd

Please sign in to comment.
Something went wrong with that request. Please try again.