Skip to content

Commit

Permalink
* [CHD-4017] [Virtual Attendants/Create Task] Fixed an issue with the…
Browse files Browse the repository at this point in the history
… 'Create task' action in Virtual Attendant behaviors where a worker list variable is allowed when setting a single worker custom field. Previously, this generated an error. Now, a random worker from the given array will be selected.
  • Loading branch information
jstanden committed Mar 5, 2015
1 parent edffd8e commit b50d464
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions libs/devblocks/api/services/event/event_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3141,13 +3141,30 @@ static function simulateActionCreateTask($params, DevblocksDictionaryDelegate $d
if(!empty($val) && !is_numeric($val)) {
if(isset($dict->$val)) {
$val = $dict->$val;

// If it's an array, pick a random key
if(is_array($val)) {
$key = array_rand($val, 1);

if(is_numeric($key)) {
$val = $key;

} else {
$val = array_shift($val);

if($val instanceof DevblocksDictionaryDelegate) {
@$val = intval($val->id);
}
}
}

}
}

if(isset($workers[$val])) {
$set_worker = $workers[$val];
$val = $set_worker->getName();
}
}
break;

default:
Expand Down

0 comments on commit b50d464

Please sign in to comment.