Commit 0448dbe7 authored by David Monllaó's avatar David Monllaó
Browse files

Merge branch 'MDL-51131-28' of git://github.com/marinaglancy/moodle into MOODLE_28_STABLE

parents 15737f3d 66c0fccb
......@@ -315,14 +315,16 @@ function coursetag_get_tagged_courses($tagid) {
function coursetag_delete_course_tags($courseid, $showfeedback=false) {
global $DB, $OUTPUT;
if ($taginstances = $DB->get_fieldset_select('tag_instance', 'tagid', "itemtype = 'course' AND itemid = :courseid",
array('courseid' => $courseid))) {
if ($taginstances = $DB->get_recordset_select('tag_instance', "itemtype = 'course' AND itemid = :courseid",
array('courseid' => $courseid), '', 'tagid, tiuserid')) {
tag_delete(array_values($taginstances));
foreach ($taginstances as $record) {
tag_delete_instance('course', $courseid, $record->tagid, $record->tiuserid);
}
$taginstances->close();
}
if ($showfeedback) {
echo $OUTPUT->notification(get_string('deletedcoursetags', 'tag'), 'notifysuccess');
}
}
......@@ -452,7 +452,7 @@ class core_tag_events_testcase extends advanced_testcase {
$sink = $this->redirectEvents();
coursetag_delete_course_tags($course->id);
$events = $sink->get_events();
$events = array($events[2], $events[3]);
$events = array($events[1], $events[3]);
// Check that the tags were deleted and the events data is valid.
$this->assertEquals(0, $DB->count_records('tag'));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment