Skip to content

Commit 2a33a60

Browse files
authored
Fix step and trigger reordering: only change the relevant workflow (#200)
1 parent a1166ed commit 2a33a60

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

classes/local/manager/step_manager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ private static function remove_from_sortindex(&$toberemoved) {
137137
global $DB;
138138
if (isset($toberemoved->sortindex)) {
139139
$subplugins = $DB->get_records_select('tool_lifecycle_step',
140-
"sortindex > $toberemoved->sortindex",
141-
['workflowid' => $toberemoved->workflowid]);
140+
'workflowid = :workflowid AND sortindex > :sortindex',
141+
['workflowid' => $toberemoved->workflowid, 'sortindex' => $toberemoved->sortindex]);
142142
foreach ($subplugins as $record) {
143143
$subplugin = step_subplugin::from_record($record);
144144
$subplugin->sortindex--;

classes/local/manager/trigger_manager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ private static function remove_from_sortindex(&$toberemoved) {
179179
global $DB;
180180
if (isset($toberemoved->sortindex)) {
181181
$subplugins = $DB->get_records_select('tool_lifecycle_trigger',
182-
"sortindex > $toberemoved->sortindex",
183-
['workflowid' => $toberemoved->workflowid]);
182+
'workflowid = :workflowid AND sortindex > :sortindex',
183+
['workflowid' => $toberemoved->workflowid, 'sortindex' => $toberemoved->sortindex]);
184184
foreach ($subplugins as $record) {
185185
$subplugin = trigger_subplugin::from_record($record);
186186
$subplugin->sortindex--;

0 commit comments

Comments
 (0)