mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-37572 small bug fix with misplaced assignment
This commit is contained in:
parent
d220e90fbf
commit
9d093b71af
1 changed files with 2 additions and 2 deletions
|
@ -174,11 +174,10 @@ if ((!empty($moveupcat) or !empty($movedowncat)) and confirm_sesskey()) {
|
||||||
fix_course_sortorder();
|
fix_course_sortorder();
|
||||||
$swapcategory = null;
|
$swapcategory = null;
|
||||||
|
|
||||||
$params = array($movecategory->sortorder, $movecategory->parent);
|
|
||||||
|
|
||||||
if (!empty($moveupcat)) {
|
if (!empty($moveupcat)) {
|
||||||
require_capability('moodle/category:manage', context_coursecat::instance($moveupcat));
|
require_capability('moodle/category:manage', context_coursecat::instance($moveupcat));
|
||||||
if ($movecategory = $DB->get_record('course_categories', array('id' => $moveupcat))) {
|
if ($movecategory = $DB->get_record('course_categories', array('id' => $moveupcat))) {
|
||||||
|
$params = array($movecategory->sortorder, $movecategory->parent);
|
||||||
if ($swapcategory = $DB->get_records_select('course_categories', "sortorder<? AND parent=?", $params, 'sortorder DESC', '*', 0, 1)) {
|
if ($swapcategory = $DB->get_records_select('course_categories', "sortorder<? AND parent=?", $params, 'sortorder DESC', '*', 0, 1)) {
|
||||||
$swapcategory = reset($swapcategory);
|
$swapcategory = reset($swapcategory);
|
||||||
}
|
}
|
||||||
|
@ -186,6 +185,7 @@ if ((!empty($moveupcat) or !empty($movedowncat)) and confirm_sesskey()) {
|
||||||
} else {
|
} else {
|
||||||
require_capability('moodle/category:manage', context_coursecat::instance($movedowncat));
|
require_capability('moodle/category:manage', context_coursecat::instance($movedowncat));
|
||||||
if ($movecategory = $DB->get_record('course_categories', array('id' => $movedowncat))) {
|
if ($movecategory = $DB->get_record('course_categories', array('id' => $movedowncat))) {
|
||||||
|
$params = array($movecategory->sortorder, $movecategory->parent);
|
||||||
if ($swapcategory = $DB->get_records_select('course_categories', "sortorder>? AND parent=?", $params, 'sortorder ASC', '*', 0, 1)) {
|
if ($swapcategory = $DB->get_records_select('course_categories', "sortorder>? AND parent=?", $params, 'sortorder ASC', '*', 0, 1)) {
|
||||||
$swapcategory = reset($swapcategory);
|
$swapcategory = reset($swapcategory);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue