diff --git a/classes/local/manager/workflow_manager.php b/classes/local/manager/workflow_manager.php index 13d5cae6..e77a837b 100644 --- a/classes/local/manager/workflow_manager.php +++ b/classes/local/manager/workflow_manager.php @@ -328,12 +328,14 @@ public static function change_sortindex($workflowid, $up) { array( 'sortindex' => $otherindex) ); - $otherworkflow = workflow::from_record($otherrecord); + if (false !== $otherrecord) { + $otherworkflow = workflow::from_record($otherrecord); + $otherworkflow->sortindex = $index; + self::insert_or_update($otherworkflow); + } $workflow->sortindex = $otherindex; - $otherworkflow->sortindex = $index; self::insert_or_update($workflow); - self::insert_or_update($otherworkflow); $transaction->allow_commit(); }