* Process createdBy if the field is not createdBy.

This commit is contained in:
daitingting
2022-08-04 01:39:12 +00:00
parent 97e36551a1
commit c95a839fcb
+36
View File
@@ -532,6 +532,8 @@ class upgradeModel extends model
$this->processBugLinkBug();
case '17_4':
$this->processCreatedInfo();
$this->updateApproval();
$this->processCreatedBy();
}
$this->deletePatch();
@@ -6813,4 +6815,38 @@ class upgradeModel extends model
return !dao::isError();
}
/**
* Process createdBy of conditions.
*
* @access public
* @return bool
*/
public function processCreatedBy()
{
$this->app->loadLang('workflow');
$this->app->loadModuleConfig('workflow');
$modules = $this->dao->select('module')->from(TABLE_WORKFLOW)->where('buildin')->eq('1')->andWhere('approval')->eq('enabled')->andWhere('module')->in(array_keys($this->config->workflow->buildin->createdBy))->fetchPairs();
$actions = $this->dao->select('id, module, conditions')->from(TABLE_WORKFLOWACTION)->where('module')->in($modules)->andWhere('action')->in('submit, cancel, edit, delete')->fetchAll('id');
foreach($actions as $id => $action)
{
$conditions = json_decode($action->conditions);
if(empty($conditions)) continue;
foreach($conditions as $index => $condition)
{
foreach($condition->fields as $field)
{
if($field->field == 'createdBy' && zget($this->config->workflow->buildin->createdBy, $action->module, '')) $field->field = zget($this->config->workflow->buildin->createdBy, $action->module);
}
$conditions[$index] = $condition;
}
$this->dao->update(TABLE_WORKFLOWACTION)->set('conditions')->eq(json_encode($conditions))->where('id')->eq($id)->exec();
}
return !dao::isError();
}
}