From 0315912655ebf4764889d59d6deb9f5125b74251 Mon Sep 17 00:00:00 2001
From: Moritz Strohm <strohm@data-quest.de>
Date: Mon, 17 Jun 2019 16:08:36 +0200
Subject: [PATCH] added functionality to add a copied course to the course
 groups of the source course

---
 controllers/copy.php | 10 ++++++++++
 plugin.manifest      |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/controllers/copy.php b/controllers/copy.php
index 096081d..d56f777 100755
--- a/controllers/copy.php
+++ b/controllers/copy.php
@@ -45,6 +45,16 @@ class CopyController extends PluginController
                         $newcourse['start_time'] = $semester['beginn'];
                         $newcourse->store();
 
+                        //Check if the old course is in at least one course
+                        //group ("LV-Gruppe") of the module managemeny system:
+                        $course_groups = Lvgruppe::findBySeminar($course_id);
+                        if ($course_groups) {
+                            //Add the copied course to all found course groups:
+                            foreach ($course_groups as $course_group) {
+                                $course_group->addSeminar($newcourse->id);
+                            }
+                        }
+
                         if ($lock_copied_courses) {
                             //Get the ID of the locked admission courseset:
                             $locked_admission_id = CourseSet::getGlobalLockedAdmissionSetId();
diff --git a/plugin.manifest b/plugin.manifest
index 22dab17..73af069 100755
--- a/plugin.manifest
+++ b/plugin.manifest
@@ -1,6 +1,6 @@
 pluginname=CourseCopy
 pluginclassname=CourseCopy
-version=1.1.2-rrv2
+version=1.1.3-rrv2
 origin=data-quest
 studipMinVersion=4.0
 studipMaxVersion=4.3.99
-- 
GitLab