diff --git a/main/cron/import_csv.php b/main/cron/import_csv.php index 12f7eb7c29..e0198154f5 100755 --- a/main/cron/import_csv.php +++ b/main/cron/import_csv.php @@ -884,8 +884,6 @@ class ImportCsv return 0; } - $agenda = new Agenda('course'); - $extraFieldValue = new ExtraFieldValue('calendar_event'); $extraFieldName = $this->extraFieldIdNameList['calendar_event']; $externalEventId = null; @@ -910,7 +908,6 @@ class ImportCsv $batchSize = $this->batchSize; $counter = 1; $em = Database::getManager(); - $eventSentMailList = []; foreach ($eventsToCreate as $event) { $update = false; @@ -951,6 +948,12 @@ class ImportCsv } $courseInfo = api_get_course_info_by_id($event['course_id']); + $agenda = new Agenda( + 'course', + $event['sender_id'], + $courseInfo['real_id'], + $event['session_id'] + ); $agenda->set_course($courseInfo); $agenda->setSessionId($event['session_id']); $agenda->setSenderId($event['sender_id']); diff --git a/main/inc/lib/agenda.lib.php b/main/inc/lib/agenda.lib.php index 80787f998f..8a2c5dda6e 100644 --- a/main/inc/lib/agenda.lib.php +++ b/main/inc/lib/agenda.lib.php @@ -55,7 +55,7 @@ class Agenda $sessionId = $sessionId ?: api_get_session_id(); $sessionInfo = api_get_session_info($sessionId); $this->setSessionId($sessionId); - $this->setSessioInfo($sessionInfo); + $this->setSessionInfo($sessionInfo); // Setting the course object if we are in a course $courseInfo = api_get_course_info_by_id($courseId); @@ -74,10 +74,7 @@ class Agenda } // Check - if (api_get_course_setting( - 'allow_user_edit_agenda' - ) && api_is_allowed_in_course() - ) { + if (api_get_course_setting('allow_user_edit_agenda') && api_is_allowed_in_course()) { $isAllowToEdit = true; }