Skip to content

Calendar event are always created when importing sessions from a CSV #845

@mperreir

Description

@mperreir

Hello,

I'm trying to bulk import session with mod_attendance using the Moodle instance that my university provides (I don't have admin rights on it, so I cannot see the global module configuration and e.g. default values for some options).

If I add sessions manually there is no problem, the sessions are created using the options provided (e.g. not adding sessions to the calendar).
However if I use the CSV import feature, it seems that the options set to 1 are enabled but (some) options set to 0 do not seem to be disabled. For example, if I set calendarevent to 0, the calendar event creation checkbox is still enabled (and events added to the calendar) after the sessions are imported. This does not seem to be the case for other options, but I suspect that when an option is set 0, the default value for that option is used instead of disabling it (so maybe default values are 0 for those options).

I quickly looked at the import code and the code logic seems ok to me (default values should be used only when no value is provided for an option). However even if the code looks good, it seems that it does not work as intended.

Here is a simple example of CSV that should not create calendar event, but that indeed does (at least on the Moodle version I have access to).

groups; sessiondate; from; to; description; repeaton; repeatevery; repeatuntil; studentscanmark; studentscanupdate;  passwordgrp; randompassword; subnet; automark; autoassignstatus; absenteereport; preventsharedip; preventsharediptime; calendarevent; includeqrcode; rotateqrcode; openbeforesession
;08-09-2025;14:00;18:00;"Afternoon session";0;0;0;0;0;0;0;0;0;0;0;0;;0;0;0;0

Am I missing something or this a bug in the import code ?

Moodle version used : 4.5.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions