mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 04:30:15 +01:00
Merge branch 'MDL-8307-master' of git://github.com/FMCorz/moodle
This commit is contained in:
commit
dafc3b7a85
@ -4144,7 +4144,7 @@ class course_request {
|
||||
global $USER, $DB, $CFG;
|
||||
$data->requester = $USER->id;
|
||||
|
||||
// Setting the default category is none set.
|
||||
// Setting the default category if none set.
|
||||
if (empty($data->category) || empty($CFG->requestcategoryselection)) {
|
||||
$data->category = $CFG->defaultrequestcategory;
|
||||
}
|
||||
@ -4306,10 +4306,10 @@ class course_request {
|
||||
unset($data->reason);
|
||||
unset($data->requester);
|
||||
|
||||
// If the current user does not have the rights to change the category, or if the
|
||||
// If the category is not set, if the current user does not have the rights to change the category, or if the
|
||||
// category does not exist, we set the default category to the course to be approved.
|
||||
// The system level is used because the capability moodle/site:approvecourse is based on a system level.
|
||||
if (!has_capability('moodle/course:changecategory', context_system::instance()) ||
|
||||
if (empty($data->category) || !has_capability('moodle/course:changecategory', context_system::instance()) ||
|
||||
(!$category = get_course_category($data->category))) {
|
||||
$category = get_course_category($CFG->defaultrequestcategory);
|
||||
}
|
||||
|
@ -111,11 +111,12 @@ if (empty($pending)) {
|
||||
$course->check_shortname_collision();
|
||||
|
||||
// Retreiving category name.
|
||||
// If the user does not have the capability to change the category, we fallback on the default one.
|
||||
// If the category was not set (can happen after upgrade) or if the user does not have the capability
|
||||
// to change the category, we fallback on the default one.
|
||||
// Else, the category proposed is fetched, but we fallback on the default one if we can't find it.
|
||||
// It is just a matter of displaying the right information because the logic when approving the category
|
||||
// proceeds the same way. The system context level is used as moodle/site:approvecourse uses it.
|
||||
if (!has_capability('moodle/course:changecategory', context_system::instance()) ||
|
||||
if (empty($course->category) || !has_capability('moodle/course:changecategory', context_system::instance()) ||
|
||||
(!$category = get_course_category($course->category))) {
|
||||
$category = get_course_category($CFG->defaultrequestcategory);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user