mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-06-01 14:37:20 +00:00
- added method addTransition()
This commit is contained in:
parent
12726382d0
commit
3bea844141
|
@ -231,6 +231,7 @@ class LetoDMS_Core_Workflow { /* {{{ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a transition from a workflow
|
* Remove a transition from a workflow
|
||||||
|
* Deprecated! User LetoDMS_Core_Workflow_Transition::remove() instead.
|
||||||
*
|
*
|
||||||
* @param object $transition
|
* @param object $transition
|
||||||
* @return boolean true if no error occured, otherwise false
|
* @return boolean true if no error occured, otherwise false
|
||||||
|
@ -239,6 +240,51 @@ class LetoDMS_Core_Workflow { /* {{{ */
|
||||||
return $transition->remove();
|
return $transition->remove();
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add new transition to workflow
|
||||||
|
*
|
||||||
|
* @param object $state
|
||||||
|
* @param object $action
|
||||||
|
* @param object $nextstate
|
||||||
|
* @param array $users
|
||||||
|
* @param array $groups
|
||||||
|
* @return object instance of new transition
|
||||||
|
*/
|
||||||
|
function addTransition($state, $action, $nextstate, $users, $groups) { /* {{{ */
|
||||||
|
$db = $this->_dms->getDB();
|
||||||
|
|
||||||
|
$db->startTransaction();
|
||||||
|
$queryStr = "INSERT INTO tblWorkflowTransitions (workflow, state, action, nextstate) VALUES (".$this->_id.", ".$state->getID().", ".$action->getID().", ".$nextstate->getID().")";
|
||||||
|
echo $queryStr;
|
||||||
|
if (!$db->getResult($queryStr)) {
|
||||||
|
$db->rollbackTransaction();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$transition = $this->getTransition($db->getInsertID());
|
||||||
|
|
||||||
|
foreach($users as $user) {
|
||||||
|
$queryStr = "INSERT INTO tblWorkflowTransitionUsers (transition, userid) VALUES (".$transition->getID().", ".$user->getID().")";
|
||||||
|
echo $queryStr;
|
||||||
|
if (!$db->getResult($queryStr)) {
|
||||||
|
$db->rollbackTransaction();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($groups as $group) {
|
||||||
|
$queryStr = "INSERT INTO tblWorkflowTransitionGroups (transition, groupid, minusers) VALUES (".$transition->getID().", ".$group->getID().", 1)";
|
||||||
|
echo $queryStr;
|
||||||
|
if (!$db->getResult($queryStr)) {
|
||||||
|
$db->rollbackTransaction();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->commitTransaction();
|
||||||
|
return $transition;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if workflow is currently used by any document
|
* Check if workflow is currently used by any document
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user