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--;