Commit 225ca57d276d92b2d419d4cf2b84173f8212f455

Authored by Brad Shuttleworth
1 parent cc0a58fb

make ::changeWorkflowOnDocument match ::startWorkflowOnDocument in tolerance

by handling null input properly.



git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5556 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/workflow/workflowutil.inc.php
... ... @@ -120,9 +120,10 @@ class KTWorkflowUtil {
120 120  
121 121 // fix for 1049: workflows reset on document move.
122 122 // this was the original purpose of "changeWorkflowOnDocument".
123   -
124   - if ($oDocument->getWorkflowId() == $oWorkflow->getId()) {
125   - return true; // bail out, essentially.
  123 + if (!is_null($oWorkflow)) {
  124 + if ($oDocument->getWorkflowId() == $oWorkflow->getId()) {
  125 + return true; // bail out, essentially.
  126 + }
126 127 }
127 128  
128 129 return KTWorkflowUtil::startWorkflowOnDocument($oWorkflow, $oDocument);
... ... @@ -156,12 +157,12 @@ class KTWorkflowUtil {
156 157  
157 158 $oDocument->setWorkflowId($iWorkflowId);
158 159 $oDocument->setWorkflowStateId($iStartStateId);
159   -
160   - $sTransactionComments = "Workflow \"" . $oWorkflow->getHumanName() . "\" started.";
  160 + $sTransactionComments = "Workflow \"" . $oWorkflow->getHumanName() . "\" started.";
  161 +
161 162 } else {
162 163 $oDocument->setWorkflowId(null);
163 164 $oDocument->setWorkflowStateId(null);
164   - $sTransactionComments = "Workflow removed from document.";
  165 + $sTransactionComments = "Workflow removed from document.";
165 166 }
166 167  
167 168 $res = $oDocument->update();
... ...