From f57859f19f69e0a7cb5d0faac919b82873262ef7 Mon Sep 17 00:00:00 2001 From: Katalin Lukacs Toth Date: Tue, 12 Mar 2024 19:54:48 +0100 Subject: [PATCH] Fix step and trigger reordering: only change the relevant workflow --- classes/local/manager/step_manager.php | 4 ++-- classes/local/manager/trigger_manager.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/classes/local/manager/step_manager.php b/classes/local/manager/step_manager.php index c82c9cec..3158cd40 100644 --- a/classes/local/manager/step_manager.php +++ b/classes/local/manager/step_manager.php @@ -137,8 +137,8 @@ private static function remove_from_sortindex(&$toberemoved) { global $DB; if (isset($toberemoved->sortindex)) { $subplugins = $DB->get_records_select('tool_lifecycle_step', - "sortindex > $toberemoved->sortindex", - ['workflowid' => $toberemoved->workflowid]); + 'workflowid = :workflowid AND sortindex > :sortindex', + ['workflowid' => $toberemoved->workflowid, 'sortindex' => $toberemoved->sortindex]); foreach ($subplugins as $record) { $subplugin = step_subplugin::from_record($record); $subplugin->sortindex--; diff --git a/classes/local/manager/trigger_manager.php b/classes/local/manager/trigger_manager.php index 20f20a21..656d4233 100644 --- a/classes/local/manager/trigger_manager.php +++ b/classes/local/manager/trigger_manager.php @@ -179,8 +179,8 @@ private static function remove_from_sortindex(&$toberemoved) { global $DB; if (isset($toberemoved->sortindex)) { $subplugins = $DB->get_records_select('tool_lifecycle_trigger', - "sortindex > $toberemoved->sortindex", - ['workflowid' => $toberemoved->workflowid]); + 'workflowid = :workflowid AND sortindex > :sortindex', + ['workflowid' => $toberemoved->workflowid, 'sortindex' => $toberemoved->sortindex]); foreach ($subplugins as $record) { $subplugin = trigger_subplugin::from_record($record); $subplugin->sortindex--;