From 06a87595066f2be340da82e3506d8e8e17ed8bdc Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Thu, 7 Jan 2016 13:40:19 -0500 Subject: [PATCH] Fix issue with course info not available in Oogie documents conversion - refs BT#10596 --- main/newscorm/learnpath.class.php | 5 +++++ main/newscorm/openoffice_document.class.php | 2 ++ 2 files changed, 7 insertions(+) diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index d8d16f72e0..daca1b9280 100755 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -492,6 +492,11 @@ class learnpath if ($this->debug > 0) { error_log('New LP - In learnpath::add_item(' . $parent . ',' . $previous . ',' . $type . ',' . $id . ',' . $title . ')', 0); } + if (empty($course_id)) { + // Sometimes Oogie doesn't catch the course info but sets $this->cc + $this->course_info = api_get_course_info($this->cc); + $course_id = $this->course_info['real_id']; + } $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); $_course = $this->course_info; $parent = intval($parent); diff --git a/main/newscorm/openoffice_document.class.php b/main/newscorm/openoffice_document.class.php index 7592218d3b..340616b0ac 100755 --- a/main/newscorm/openoffice_document.class.php +++ b/main/newscorm/openoffice_document.class.php @@ -151,6 +151,8 @@ abstract class OpenofficeDocument extends learnpath if (!empty($files)) { // Create lp $this->lp_id = learnpath::add_lp($_course['id'], $this->file_name, '', 'guess', 'manual'); + // make sure we have a course code available for later + $this->cc = $_course['id']; // Call to the function implemented by child following action_after_conversion parameter. switch ($action_after_conversion) {