Loading...
 
Galaxia Workflow Engine

Galaxia Workflow Engine


Re : Problem with Join Activity

>
>
> The join activity seems to not working.
>
> The join activity is activate even when all the previous
> activities aren't completed.
>
>
> Is anybody has already work on this type of activity ???
>
>
>
> Thanks

I make a correction on the file lib/galaxia/src/API/instance.php

Please test this function. !!
I add a code that test, in a join activity, if there are still link activities that are not completed we STOP.



function sendTo($from,$activityId,$split=false) {
//1: if we are in a join check
//if this instance is also in
//other activity if so do
//nothing
$type = $this->getOne("select `type` from `".GALAXIA_TABLE_PREFIX."activities` where `activityId`=?",arrayint)$activityId;

// Verify the existance of a transition
if(!$this->getOne("select count(*) from `".GALAXIA_TABLE_PREFIX."transitions` where `actFromId`=? and `actToId`=?",array($from,(int)$activityId))) {
trigger_error(tra('Fatal error: trying to send an instance to an activity but no transition found'),E_USER_WARNING);
}

//try to determine the user or *
//Use the nextUser
if($this->nextUser) {
$putuser = $this->nextUser;
} else {
$candidates = Array();
$query = "select `roleId` from `".GALAXIA_TABLE_PREFIX."activity_roles` where `activityId`=?";
$result = $this->query($query,arrayint)$activityId;
while ($res = $result->fetchRow()) {
$roleId = $res'roleId';
$query2 = "select `user` from `".GALAXIA_TABLE_PREFIX."user_roles` where `roleId`=?";
$result2 = $this->query($query2,arrayint)$roleId;
while ($res2 = $result2->fetchRow()) {
$candidates[] = $res2'user';
}
}
if(count($candidates) == 1) {
$putuser = $candidates0;
} else {
$putuser = '*';
}
}
//update the instance_activities table
//if not splitting delete first
//please update started,status,user
if(!$split) {
// $query = "delete from `".GALAXIA_TABLE_PREFIX."instance_activities` where `instanceId`=? and `activityId`=?";
// $this->query($query,arrayint)$this->instanceId,$from;
}
$now = date("U");
$iid = $this->instanceId;
// JOIN
// NEW FROM pemen
// Test if the activity has previous link activity that are not completed
if ($type == 'join') {
$querycant = "select count(*) from `".GALAXIA_TABLE_PREFIX."transitions` tr " .
"INNER JOIN ".GALAXIA_TABLE_PREFIX."instance_activities gia ON tr.actFromId=gia.activityId " .
"where tr.pid=? and tr.actToId=? and gia.instanceId=? and gia.status = ?";
// if there is still link activities not completed STOP
if ($nb = $this->getone($querycant, arrayint)$this->pId, $activityId, $iid, 'running') {
echo 'nb en cours=' . $nb;
return;
}

}
$query="delete from `".GALAXIA_TABLE_PREFIX."instance_activities` where `instanceId`=? and `activityId`=?";
$this->query($query,arrayint)$iid,(int)$activityId;
$query="insert into `".GALAXIA_TABLE_PREFIX."instance_activities`(`instanceId`,`activityId`,`user`,`status`,`started`) values(?,?,?,?,?)";
$this->query($query,arrayint)$iid,(int)$activityId,$putuser,'running',(int)$now;
//we are now in a new activity
$this->activities=Array();
$query = "select * from `".GALAXIA_TABLE_PREFIX."instance_activities` where `instanceId`=?";
$result = $this->query($query,arrayint)$iid;
while ($res = $result->fetchRow()) {
$this->activities[]=$res;
}
/*
if ($type == 'join') {
if (count($this->activities)>1) {
// This instance will have to wait!
return;
}
}
*/
//if the activity is not interactive then
//execute the code for the activity and
//complete the activity
$isInteractive = $this->getOne("select `isInteractive` from `".GALAXIA_TABLE_PREFIX."activities` where `activityId`=?",arrayint)$activityId;
if ($isInteractive=='n') {
// Now execute the code for the activity (function defined in lib/Galaxia/config.php)
galaxia_execute_activity($activityId, $iid , 1);
// Reload in case the activity did some change
$this->getInstance($this->instanceId);
$this->complete($activityId);
}
}


There are no comments at this time.

Upcoming Events

1)  18 Apr 2024 14:00 GMT-0000
Tiki Roundtable Meeting
2)  16 May 2024 14:00 GMT-0000
Tiki Roundtable Meeting
3)  20 Jun 2024 14:00 GMT-0000
Tiki Roundtable Meeting
4)  18 Jul 2024 14:00 GMT-0000
Tiki Roundtable Meeting
5)  15 Aug 2024 14:00 GMT-0000
Tiki Roundtable Meeting
6)  19 Sep 2024 14:00 GMT-0000
Tiki Roundtable Meeting
7) 
Tiki birthday
8)  17 Oct 2024 14:00 GMT-0000
Tiki Roundtable Meeting
9)  21 Nov 2024 14:00 GMT-0000
Tiki Roundtable Meeting
10)  19 Dec 2024 14:00 GMT-0000
Tiki Roundtable Meeting