diff --git a/public/main/course_progress/index.php b/public/main/course_progress/index.php index cd7b4de2b6..7862429b99 100644 --- a/public/main/course_progress/index.php +++ b/public/main/course_progress/index.php @@ -1200,7 +1200,7 @@ switch ($action) { $startDate = $values['start_date_by_attendance']; } - $advanceId = isset($values['thematic_advance_id']) ? $values['thematic_advance_id'] : null; + $advanceId = $values['thematic_advance_id'] ?? null; $advance = null; if (!empty($advanceId)) { $advance = Container::getThematicAdvanceRepository()->find($advanceId); diff --git a/public/main/inc/lib/thematic.lib.php b/public/main/inc/lib/thematic.lib.php index 5449c46210..680b499306 100644 --- a/public/main/inc/lib/thematic.lib.php +++ b/public/main/inc/lib/thematic.lib.php @@ -544,7 +544,7 @@ class Thematic */ public function thematicAdvanceSave( CThematic $thematic, - CAttendance $attendance, + CAttendance $attendance = null, CThematicAdvance $advance = null, $content, $start_date, @@ -554,15 +554,17 @@ class Thematic $duration = (int) $duration; if (null === $advance) { - $advance = new CThematicAdvance(); - $advance + $advance = (new CThematicAdvance()) ->setContent($content) ->setThematic($thematic) - ->setAttendance($attendance) + //->setAttendance($attendance) ->setStartDate(api_get_utc_datetime($start_date, true, true)) ->setDuration($duration) ; + if ($attendance) { + $advance->setAttendance($attendance); + } //$courseEntity = api_get_course_entity(); /*$advance ->setParent($courseEntity)