Fix agenda obj creation

pull/2487/head
jmontoyaa 8 years ago
parent 28b5db5bdf
commit 2e3b5971a0
  1. 9
      main/cron/import_csv.php
  2. 7
      main/inc/lib/agenda.lib.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']);

@ -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;
}

Loading…
Cancel
Save