From 08919cd792a902d8c67d2f02554be2f294acc4ae Mon Sep 17 00:00:00 2001 From: Justus Dieckmann Date: Tue, 27 Feb 2024 17:46:14 +0100 Subject: [PATCH] Show menu entry if there are workflows other than the default two --- lib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib.php b/lib.php index ff877af5..072cff6c 100644 --- a/lib.php +++ b/lib.php @@ -47,7 +47,9 @@ function tool_lifecycle_extend_navigation_course($navigation, $course, $context) if ($cache->has('workflowactive')) { $wfexists = $cache->get('workflowactive'); } else { - $wfexists = $DB->record_exists_select('tool_lifecycle_workflow', 'timeactive IS NOT NULL'); + $wfexists = $DB->record_exists_sql("SELECT 'yes' FROM {tool_lifecycle_workflow} wf " . + "JOIN {tool_lifecycle_trigger} t ON wf.id = t.workflowid " . + "WHERE wf.timeactive IS NOT NULL AND t.subpluginname NOT IN ('sitecourse', 'delayedcourses')"); $cache->set('workflowactive', $wfexists); }