#172 Galaxia : bug with Join Activity resolved

open
nobody
None
5
2005-05-27
2005-05-03
pemen
No

The join activity don't work fine.

The join activity is activate even when all the previous
activities aren't completed.

Correction of sendTo function in lib/galaxia/src/API/
instance.php file.

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);
}
}

Discussion

  • Georger Araujo
    Georger Araujo
    2005-05-24

    Logged In: YES
    user_id=1087649

    Pierre,
    could you provide more detail on this? Is the bug
    reproducible? Could you upload a XML process file where we
    can see the bug in action?
    I'm currently integrating various patches in my own source
    tree in order to deploy Galaxia in my production
    environment. Regards,

    Georger

     
  • pemen
    pemen
    2005-05-27

    • summary: Galaxia : bug with Join Activity --> Galaxia : bug with Join Activity resolved