MDL-61736 user: Show correct status when enrol method is disabled

When disabling an enrolment method, the user status will be displayed
as "Not current" instead of "Active".
This commit is contained in:
Sara Arjona
2018-04-09 08:45:57 +02:00
parent 2bd2660751
commit 3449816e7f
2 changed files with 13 additions and 2 deletions
+4 -2
View File
@@ -385,8 +385,10 @@ class participants_table extends \table_sql {
case ENROL_USER_ACTIVE:
$currentdate = new DateTime();
$now = $currentdate->getTimestamp();
// If user enrolment status has not yet started/already ended.
if ($timestart > $now || ($timeend > 0 && $timeend < $now)) {
$isexpired = $timestart > $now || ($timeend > 0 && $timeend < $now);
$enrolmentdisabled = $ue->enrolmentinstance->status == ENROL_INSTANCE_DISABLED;
// If user enrolment status has not yet started/already ended or the enrolment instance is disabled.
if ($isexpired || $enrolmentdisabled) {
$status = get_string('participationnotcurrent', 'enrol');
$statusval = status_field::STATUS_NOT_CURRENT;
}
@@ -265,3 +265,12 @@ Feature: View course participants
# Suspended and non-current students should not be rendered.
And I should not see "Student 10x" in the "participants" "table"
And I should not see "Student 11x" in the "participants" "table"
Scenario: Check status after disabling manual enrolment
Given I log in as "admin"
And I am on "Course 1" course homepage
And I navigate to course participants
When I navigate to "Enrolment methods" in current page administration
And I click on "Disable" "link" in the "Manual enrolments" "table_row"
Then I navigate to course participants
And I should see "Not current" in the "student0x" "table_row"