* [misc] Fix check conditions error in the workflow extension action on the browse page.

This commit is contained in:
wangyuting
2024-07-24 14:00:17 +08:00
committed by 胡方舟
parent 3f4fcaa32c
commit f2756730ec
+7 -10
View File
@@ -753,22 +753,19 @@ function initItemActions(object &$item, string $actionMenu, array $actionList, o
if(!$method || !common::hasPriv($module, $method, $item)) return $isClickable;
/* Check flow conditions for this object. */
if(empty($model->enables) && $model->config->edition != 'open')
if($model->config->edition != 'open')
{
$flowActions = $model->loadModel('workflowaction')->getList($module);
$model->loadModel('flow');
$flowActions = $model->loadModel('workflowaction')->getList($module);
$model->enables = array();
foreach($flowActions as $flowAction)
{
$model->enables[$flowAction->action] = $flowAction->status == 'enable';
if($flowAction->status == 'enable' && $flowAction->extensionType != 'none' && !empty($flowAction->conditions)) $model->enables[$flowAction->action] = $flowAction->conditions;
if($flowAction->action == $method && $flowAction->extensionType != 'none' && $flowAction->status == 'enable' && !empty($flowAction->conditions))
{
$isClickable = $model->flow->checkConditions($flowAction->conditions, $item);
}
}
}
if(isset($model->enables[$method]))
{
if(!$model->enables[$method]) $isClickable = false;
if(is_array($model->enables[$method]) && !$model->flow->checkConditions($model->enables[$method], $item)) $isClickable = false;
}
$item->actions[] = array('name' => $action, 'disabled' => !$isClickable);