mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
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.
This commit is contained in:
parent
38e9a1cc79
commit
2388e7ca7d
1 changed files with 10 additions and 0 deletions
|
@ -918,9 +918,14 @@ class assignment_upload extends assignment_base {
|
||||||
}
|
}
|
||||||
|
|
||||||
function can_unfinalize($submission) {
|
function can_unfinalize($submission) {
|
||||||
|
if(is_bool($submission)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!$this->drafts_tracked()) {
|
if (!$this->drafts_tracked()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_capability('mod/assignment:grade', $this->context)
|
if (has_capability('mod/assignment:grade', $this->context)
|
||||||
and $this->isopen()
|
and $this->isopen()
|
||||||
and $this->is_finalized($submission)) {
|
and $this->is_finalized($submission)) {
|
||||||
|
@ -932,6 +937,11 @@ class assignment_upload extends assignment_base {
|
||||||
|
|
||||||
function can_finalize($submission) {
|
function can_finalize($submission) {
|
||||||
global $USER;
|
global $USER;
|
||||||
|
|
||||||
|
if(is_bool($submission)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!$this->drafts_tracked()) {
|
if (!$this->drafts_tracked()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue