Commit 89dc5d888da90e2bae76fa4521c155d584fd7017

Authored by Brad Shuttleworth
1 parent 729faaee

Fix for KTS-1049: moving a document resets the state of the workflow.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5537 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/workflow/workflowutil.inc.php
@@ -114,7 +114,17 @@ class KTWorkflowUtil { @@ -114,7 +114,17 @@ class KTWorkflowUtil {
114 // }}} 114 // }}}
115 115
116 116
  117 + /* WILL NOT RESET THE WORKFLOW if changing to the -same- workflow */
117 function changeWorkflowOnDocument($oWorkflow, $oDocument) { 118 function changeWorkflowOnDocument($oWorkflow, $oDocument) {
  119 + $oDocument =& KTUtil::getObject('Document', $oDocument);
  120 +
  121 + // fix for 1049: workflows reset on document move.
  122 + // this was the original purpose of "changeWorkflowOnDocument".
  123 +
  124 + if ($oDocument->getWorkflowId() == $oWorkflow->getId()) {
  125 + return true; // bail out, essentially.
  126 + }
  127 +
118 return KTWorkflowUtil::startWorkflowOnDocument($oWorkflow, $oDocument); 128 return KTWorkflowUtil::startWorkflowOnDocument($oWorkflow, $oDocument);
119 } 129 }
120 // {{{ startWorkflowOnDocument 130 // {{{ startWorkflowOnDocument
plugins/ktstandard/KTWorkflowAssociation.php
@@ -110,7 +110,7 @@ class KTWADAddTrigger extends KTWorkflowAssociationDelegator { @@ -110,7 +110,7 @@ class KTWADAddTrigger extends KTWorkflowAssociationDelegator {
110 return ; 110 return ;
111 } 111 }
112 112
113 - $ret = KTWorkflowUtil::startWorkflowOnDocument($oWorkflow, $this->_document); 113 + $ret = KTWorkflowUtil::changeWorkflowOnDocument($oWorkflow, $this->_document);
114 } 114 }
115 } 115 }
116 116