From 93e0cb3feb96ebb0ecad82d5ddc9e763fb0a2318 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 18 Apr 2013 13:36:11 +0200 Subject: [PATCH] add method needsWorkflowAction($user) This method checks if the document content needs a action from the given user to trigger a transition --- SeedDMS_Core/Core/inc.ClassDocument.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/SeedDMS_Core/Core/inc.ClassDocument.php b/SeedDMS_Core/Core/inc.ClassDocument.php index f50d78cbf..65d36b083 100644 --- a/SeedDMS_Core/Core/inc.ClassDocument.php +++ b/SeedDMS_Core/Core/inc.ClassDocument.php @@ -3610,6 +3610,31 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */ return $workflowlog; } /* }}} */ + /** + * Check if the document content needs an action by a user + * + * This method will return true if document content is in a transition + * which can be triggered by the given user. + * + * @param SeedDMS_Core_User $user + * @return boolean true is action is needed + */ + function needsWorkflowAction($user) { /* {{{ */ + $needwkflaction = false; + if($this->_workflow) { + if (!$this->_workflowState) + $this->getWorkflowState(); + $workflowstate = $this->_workflowState; + $transitions = $this->_workflow->getNextTransitions($workflowstate); + foreach($transitions as $transition) { + if($this->triggerWorkflowTransitionIsAllowed($user, $transition)) { + $needwkflaction = true; + } + } + } + return $needwkflaction; + } /* }}} */ + } /* }}} */