add a rule 7) in activities verifications. Start activities must be autorouted and interactive. Just to alert user what he is doing can't work actually.

This commit is contained in:
Régis Leroy 2005-05-17 21:42:30 +00:00
parent f5f15999db
commit c14db352f2

View File

@ -248,6 +248,7 @@ class ActivityManager extends BaseManager {
5) Standalone activities cannot have transitions 5) Standalone activities cannot have transitions
6) Non intractive activities non-auto routed must have some role 6) Non intractive activities non-auto routed must have some role
so the user can "send" the activity so the user can "send" the activity
7) start activities must be autorouted and interactive
*/ */
function validate_process_activities($pId) function validate_process_activities($pId)
{ {
@ -269,14 +270,24 @@ class ActivityManager extends BaseManager {
} }
// Rule 2 end must be reachable from start // Rule 2 end must be reachable from start
// and Rule 7 start activities must be autorouted and interactive
$nodes = Array(); $nodes = Array();
$endId = $this->getOne("select wf_activity_id from ".GALAXIA_TABLE_PREFIX."activities where wf_p_id=$pId and wf_type='end'"); $endId = $this->getOne("select wf_activity_id from ".GALAXIA_TABLE_PREFIX."activities where wf_p_id=$pId and wf_type='end'");
$aux['id']=$endId; $aux['id']=$endId;
$aux['visited']=false; $aux['visited']=false;
$nodes[] = $aux; $nodes[] = $aux;
$startId = $this->getOne("select wf_activity_id from ".GALAXIA_TABLE_PREFIX."activities where wf_p_id=$pId and wf_type='start'"); $query = "select wf_is_autorouted,wf_is_interactive,wf_activity_id from ".GALAXIA_TABLE_PREFIX."activities where wf_p_id=$pId and wf_type='start'";
$start_node['id']=$startId; $result = $this->query($query);
while($res = $result->fetchRow()) {
$start_node['id'] = $res['wf_activity_id'];
if(!($res['wf_is_interactive'] == 'y')) {
$errors[] = tra('start activities must be interactive');
}
if(!($res['wf_is_autorouted'] == 'y')) {
$errors[] = tra('start activities must be autorouted');
}
}
$start_node['visited']=true; $start_node['visited']=true;
while($this->_list_has_unvisited_nodes($nodes) && !$this->_node_in_list($start_node,$nodes)) { while($this->_list_has_unvisited_nodes($nodes) && !$this->_node_in_list($start_node,$nodes)) {