Loading...
 
Skip to main content

Galaxia Workflow Engine


Re: two questions about the source code of instance.php

i download the 1.10 tiki source code(in development) from de.tiki.org
i notice that there some difference between 1.10 instance.php and 1.9.2 one.
in the sendTo(), below codes was removed:

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

although for auto-routed activities, the $instance->activities array could be reload by the following codes in the end of sendTo():

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

(the $instance->getInstance() read the array from database again), to user interactive ones, the array could only be refreshed until in the tiki-g-run_acitivites.php:

if 'post'" class="wiki wikinew text-danger tips isset">$_REQUEST'__post' {
$instance->getInstance($_REQUEST'iid');
$instance->replace_instance_comment($_REQUEST'
cid', $activity->getActivityId(), $activity->getName(),
$user, $_REQUEST'title', $_REQUEST'comment');
}

before that the $instance->complete() in the user activity codes will be excuted and the workitem started attribute will set to $this->getStarted():

$act = $this->_get_instance_activity($activityId);
if (!$act)
{
$started = $this->getStarted();
$putuser = $this->getOwner();
}
else
{
$started=$act'started';
$putuser = $act'user';
}

could we change the first segment of codes in sendTo() to:

$query = "select * from `".GALAXIA_TABLE_PREFIX."instance_activities` where `instanceId`=? and `activityId`=?";
$result = $this->query($query,arrayint)$this->instanceId,(int)$this->activityId;
array_push($this->activities,$result->fetchRow());

that will reload the activities array.