From 94540f233eddd0eba0c4780933c5247ffc34eb66 Mon Sep 17 00:00:00 2001 From: Juan Leyva Date: Mon, 13 Jul 2015 15:05:16 +0200 Subject: [PATCH] MDL-50816 notes: Delete never met condition code --- notes/delete.php | 4 +--- notes/externallib.php | 7 +------ notes/lib.php | 2 +- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/notes/delete.php b/notes/delete.php index ccd2b16f045..3e0efc41413 100644 --- a/notes/delete.php +++ b/notes/delete.php @@ -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 { diff --git a/notes/externallib.php b/notes/externallib.php index f8aa20d982c..262897c2e60 100644 --- a/notes/externallib.php +++ b/notes/externallib.php @@ -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'); } diff --git a/notes/lib.php b/notes/lib.php index 2585f408507..ec4f5c4681e 100644 --- a/notes/lib.php +++ b/notes/lib.php @@ -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;