From 91094d39ce89b1bed1c0bfc5ae176a1013f2ce4e Mon Sep 17 00:00:00 2001 From: nbm Date: Fri, 21 Apr 2006 12:15:04 +0000 Subject: [PATCH] If given a KTDocumentCore object, get the Document object instead. --- lib/workflow/workflowutil.inc.php | 12 ++++++++++++ 1 file changed, 12 insertions(+), 0 deletions(-) diff --git a/lib/workflow/workflowutil.inc.php b/lib/workflow/workflowutil.inc.php index 14b3ac1..b585636 100644 --- a/lib/workflow/workflowutil.inc.php +++ b/lib/workflow/workflowutil.inc.php @@ -122,7 +122,9 @@ class KTWorkflowUtil { $oUser = User::get($_SESSION['userID']); + $iPreviousMetadataVersion = $oDocument->getMetadataVersionId(); $oDocument->startNewMetadataVersion($oUser); + KTDocumentUtil::copyMetadata($oDocument, $iPreviousMetadataVersion); if (!empty($oWorkflow)) { $oWorkflow =& KTUtil::getObject('KTWorkflow', $oWorkflow); @@ -323,6 +325,10 @@ class KTWorkflowUtil { */ function getWorkflowForDocument ($oDocument, $aOptions = null) { $ids = KTUtil::arrayGet($aOptions, 'ids', false); + + if (is_a($oDocument, 'KTDocumentCore')) { + $oDocument = $oDocument->getId(); + } $oDocument = KTUtil::getObject('Document', $oDocument); $iWorkflowId = $oDocument->getWorkflowId(); @@ -352,6 +358,10 @@ class KTWorkflowUtil { $ids = KTUtil::arrayGet($aOptions, 'ids', false); + if (is_a($oDocument, 'KTDocumentCore')) { + $oDocument = $oDocument->getId(); + } + $oDocument = KTUtil::getObject('Document', $oDocument); $iWorkflowStateId = $oDocument->getWorkflowStateId(); @@ -448,7 +458,9 @@ class KTWorkflowUtil { } $oSourceState =& KTWorkflowUtil::getWorkflowStateForDocument($oDocument); + $iPreviousMetadataVersion = $oDocument->getMetadataVersionId(); $oDocument->startNewMetadataVersion($oUser); + KTDocumentUtil::copyMetadata($oDocument, $iPreviousMetadataVersion); $iStateId = $oTransition->getTargetStateId(); -- libgit2 0.21.4