Skip to content

Commit

Permalink
Move users: Fix source destination id BT#16582
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Dec 17, 2020
1 parent 36f1aac commit b7da751
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions main/coursecopy/move_users_from_course_to_session.php
Expand Up @@ -71,7 +71,19 @@
$form->addButtonCopy(get_lang('Move'), 'move');
}

$count = CourseManager::get_user_list_from_course_code($courseInfo['code'], 0, null, null, STUDENT, true);
if (empty($sourceSessionId)) {
$count = CourseManager::get_user_list_from_course_code($courseInfo['code'], 0, null, null, STUDENT, true);
} else {
$count = CourseManager::get_user_list_from_course_code(
$courseInfo['code'],
$sourceSessionId,
null,
null,
0,
true
);
}

$students = [];
if (isset($_REQUEST['compare']) || isset($_REQUEST['move'])) {
/*$default = 20;
Expand Down Expand Up @@ -100,7 +112,17 @@

//$limit = "LIMIT $begin, $default";
$limit = null;
$students = CourseManager::get_user_list_from_course_code($courseInfo['code'], 0, $limit, null, STUDENT);
if (empty($sourceSessionId)) {
$students = CourseManager::get_user_list_from_course_code($courseInfo['code'], 0, $limit, null, STUDENT);
} else {
$students = CourseManager::get_user_list_from_course_code(
$courseInfo['code'],
$sourceSessionId,
$limit,
null,
0
);
}
foreach ($students as $student) {
$studentId = $student['user_id'];
$name = $student['firstname'].' '.$student['lastname'];
Expand Down

0 comments on commit b7da751

Please sign in to comment.