Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kickstart "import course" (old course) in Moodle 4.1 remove "manual enrolments" method #48

Open
peho72 opened this issue Jun 27, 2023 · 2 comments

Comments

@peho72
Copy link

peho72 commented Jun 27, 2023

We have updated Moodle to version 4.1.
Kickstart Version 1.3 (2023050801)
In test we had no issues, but when we did final upgrade, after that when importing old course the registration method "Manual enrolments" will be removed. I have even changed from kickstart "General restore options":
Keep current roles and enrolments = Yes
Keep current groups and groupings = Yes

Now the groups are OK but the "Manual enrolments" registration method still will be removed on the import (log: "Enrolment instance remoced"). This leave only disabled "Guest Access" on the enrolment methods.

I hope help or fix to this.

B.R. Petri

@phakkin
Copy link

phakkin commented Jul 5, 2023

I can confirm the bug, Kickstart settings
Keep current roles and enrolments = Yes
Keep current groups and groupings = Yes
does not work as expected, importing template or old course removes course participants and enrolment methods before restore.

I think that the reason is incorrect key names in $settings array
https://github.com/bdecentgmbh/moodle-format_kickstart/blob/main/classes/course_importer.php#L135

        if (get_config('format_kickstart', 'restore_replace_keep_roles_and_enrolments') < 2) {
            $settings['role_assignments'] =
                (bool)get_config('format_kickstart', 'restore_replace_keep_roles_and_enrolments');
            $settings['enrolments'] = (bool) (get_config('format_kickstart', 'restore_replace_keep_roles_and_enrolments') == 1)
                ? \backup::ENROL_ALWAYS : \backup::ENROL_NEVER;
        }

        if (get_config('format_kickstart', 'restore_replace_keep_groups_and_groupings') < 2) {
            $settings['groups'] =
                (bool)get_config('format_kickstart', 'restore_replace_keep_groups_and_groupings');
        }

They should be

$settings['keep_roles_and_enrolments']
$settings['keep_groups_and_groupings']

See restore_controller->execute_plan() function
https://github.com/moodle/moodle/blob/MOODLE_401_STABLE/backup/controller/restore_controller.class.php#L380

Workaround for this bug if you want to keep enrolment methods and groups:

  1. Edit system wide restore defaults
    Site administration > Courses > Backups > General restore defaults
    Keep current roles and enrolments: Yes
    Keep current groups and groupings: Yes
  2. Change Kickstart general settings
    Keep current roles and enrolments: Use default restore setting
    Keep current groups and groupings: Use default restore setting

@stefanscholz
Copy link
Member

Hi @phakkin and @peho72,

thanks for using Kickstart and reporting this issue.
We're currently looking into it and will get back to you here soon.

Best
Stefan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants