Merge branch 'MDL-50816-28' of git://github.com/jleyva/moodle into MOODLE_28_STABLE
This commit is contained in:
+1
-3
@@ -48,9 +48,7 @@ if (!has_capability('moodle/notes:manage', $context)) {
|
||||
if (data_submitted() && confirm_sesskey()) {
|
||||
// If data was submitted and is valid, then delete note.
|
||||
$returnurl = $CFG->wwwroot . '/notes/index.php?course=' . $course->id . '&user=' . $note->userid;
|
||||
if (!note_delete($note)) {
|
||||
print_error('cannotdeletepost', 'notes', $returnurl);
|
||||
}
|
||||
note_delete($note);
|
||||
redirect($returnurl);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -240,12 +240,7 @@ class core_notes_external extends external_api {
|
||||
$context = context_course::instance($note->courseid);
|
||||
self::validate_context($context);
|
||||
require_capability('moodle/notes:manage', $context);
|
||||
if (!note_delete($note)) {
|
||||
$warnings[] = array(array('item' => 'note',
|
||||
'itemid' => $noteid,
|
||||
'warningcode' => 'savedfailed',
|
||||
'message' => 'Note could not be modified'));
|
||||
}
|
||||
note_delete($note);
|
||||
} else {
|
||||
$warnings[] = array('item'=>'note', 'itemid'=>$noteid, 'warningcode'=>'badid', 'message'=>'Note does not exist');
|
||||
}
|
||||
|
||||
+1
-1
@@ -150,7 +150,7 @@ function note_save(&$note) {
|
||||
* Deletes a note object based on its id.
|
||||
*
|
||||
* @param int|object $note id of the note to delete, or a note object which is to be deleted.
|
||||
* @return boolean true if the object was deleted; false otherwise
|
||||
* @return boolean true always
|
||||
*/
|
||||
function note_delete($note) {
|
||||
global $DB;
|
||||
|
||||
Reference in New Issue
Block a user