From cea6fde471f085f510c41c11e93de0c8b3bea335 Mon Sep 17 00:00:00 2001 From: Riedler Date: Fri, 26 Sep 2025 14:34:01 +0200 Subject: [PATCH 1/4] fix: remove eduplanner tags on plugin uninstall --- lbplanner/db/uninstall.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lbplanner/db/uninstall.php b/lbplanner/db/uninstall.php index 52003a1e..eacdff82 100644 --- a/lbplanner/db/uninstall.php +++ b/lbplanner/db/uninstall.php @@ -24,13 +24,15 @@ * @license https://creativecommons.org/licenses/by-nc-sa/4.0/ CC-BY-NC-SA 4.0 International or later */ -use local_lbplanner\helpers\config_helper; - +use local_lbplanner\helpers\{config_helper,course_helper}; /** * Runs when plugin is uninstalled */ function xmldb_local_lbplanner_uninstall() { config_helper::remove_customfield(); + + $tag = core_tag_tag::get_by_name(core_tag_collection::get_default(), course_helper::EDUPLANNER_TAG, strictness:MUST_EXIST); + core_tag_tag::delete_tags($tag->id); } From 92387f6ccb47e6597534d080023d48955c53009c Mon Sep 17 00:00:00 2001 From: Riedler Date: Fri, 26 Sep 2025 14:38:26 +0200 Subject: [PATCH 2/4] fix: minor doc comment mistake --- lbplanner/classes/helpers/config_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lbplanner/classes/helpers/config_helper.php b/lbplanner/classes/helpers/config_helper.php index 484bc9de..37a1ff96 100644 --- a/lbplanner/classes/helpers/config_helper.php +++ b/lbplanner/classes/helpers/config_helper.php @@ -72,7 +72,7 @@ public static function add_customfield(): void { } } /** - * Adds a customfield to moodle for each activity where teachers can select GK EK or both. + * Removes a customfield from moodle for each activity where teachers can select GK EK or both. * * @throws \coding_exception * @throws \moodle_exception From 84edbb6941d1e375afe4a73236b1cc6f15134935 Mon Sep 17 00:00:00 2001 From: Riedler Date: Sun, 28 Sep 2025 15:01:52 +0200 Subject: [PATCH 3/4] fix: don't filter out courses with disabled enddate --- lbplanner/classes/helpers/course_helper.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lbplanner/classes/helpers/course_helper.php b/lbplanner/classes/helpers/course_helper.php index d43d31d8..021eba38 100644 --- a/lbplanner/classes/helpers/course_helper.php +++ b/lbplanner/classes/helpers/course_helper.php @@ -107,7 +107,11 @@ public static function get_all_eduplanner_courses(bool $onlyenrolled=true): arra ue.status = :active AND e.status = :enabled AND ue.timestart <= :now - AND c.enddate > :courseexpiredate + AND ue.timeend >= :now + AND ( + c.enddate > :courseexpiredate + OR c.enddate = 0 + ) AND ti.tagid = :lbptagid AND ti.itemtype = 'course'", [ @@ -123,7 +127,12 @@ public static function get_all_eduplanner_courses(bool $onlyenrolled=true): arra $mdlcourses = $DB->get_records_sql(" SELECT c.* FROM {course} c INNER JOIN {tag_instance} ti ON (ti.itemid = c.id) - WHERE c.enddate > :courseexpiredate AND ti.tagid = :lbptagid AND ti.itemtype = 'course'", + WHERE ( + c.enddate > :courseexpiredate + OR c.enddate = 0 + ) + AND ti.tagid = :lbptagid + AND ti.itemtype = 'course'", [ "courseexpiredate" => $courseexpiredate, "lbptagid" => $lbptag->id, From 1b5a283d2615919d8c2cb347c8164e1f158efc1f Mon Sep 17 00:00:00 2001 From: Riedler Date: Sun, 28 Sep 2025 15:07:09 +0200 Subject: [PATCH 4/4] fix: moodle code checker --- lbplanner/db/uninstall.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lbplanner/db/uninstall.php b/lbplanner/db/uninstall.php index eacdff82..6f2c06a2 100644 --- a/lbplanner/db/uninstall.php +++ b/lbplanner/db/uninstall.php @@ -20,11 +20,11 @@ * * @package local_lbplanner * @subpackage db - * @copyright 2024 NecodeIT + * @copyright 2025 NecodeIT * @license https://creativecommons.org/licenses/by-nc-sa/4.0/ CC-BY-NC-SA 4.0 International or later */ -use local_lbplanner\helpers\{config_helper,course_helper}; +use local_lbplanner\helpers\{config_helper, course_helper}; /** * Runs when plugin is uninstalled