From 89dc5d888da90e2bae76fa4521c155d584fd7017 Mon Sep 17 00:00:00 2001 From: Brad Shuttleworth Date: Thu, 8 Jun 2006 10:05:33 +0000 Subject: [PATCH] Fix for KTS-1049: moving a document resets the state of the workflow. --- lib/workflow/workflowutil.inc.php | 10 ++++++++++ plugins/ktstandard/KTWorkflowAssociation.php | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/workflow/workflowutil.inc.php b/lib/workflow/workflowutil.inc.php index 479932f..38ef8b1 100644 --- a/lib/workflow/workflowutil.inc.php +++ b/lib/workflow/workflowutil.inc.php @@ -114,7 +114,17 @@ class KTWorkflowUtil { // }}} + /* WILL NOT RESET THE WORKFLOW if changing to the -same- workflow */ function changeWorkflowOnDocument($oWorkflow, $oDocument) { + $oDocument =& KTUtil::getObject('Document', $oDocument); + + // fix for 1049: workflows reset on document move. + // this was the original purpose of "changeWorkflowOnDocument". + + if ($oDocument->getWorkflowId() == $oWorkflow->getId()) { + return true; // bail out, essentially. + } + return KTWorkflowUtil::startWorkflowOnDocument($oWorkflow, $oDocument); } // {{{ startWorkflowOnDocument diff --git a/plugins/ktstandard/KTWorkflowAssociation.php b/plugins/ktstandard/KTWorkflowAssociation.php index 0e2693b..11f4cc7 100644 --- a/plugins/ktstandard/KTWorkflowAssociation.php +++ b/plugins/ktstandard/KTWorkflowAssociation.php @@ -110,7 +110,7 @@ class KTWADAddTrigger extends KTWorkflowAssociationDelegator { return ; } - $ret = KTWorkflowUtil::startWorkflowOnDocument($oWorkflow, $this->_document); + $ret = KTWorkflowUtil::changeWorkflowOnDocument($oWorkflow, $this->_document); } } -- libgit2 0.21.4