* Fix workflow extra editor field bug.

This commit is contained in:
wangyuting
2024-03-27 11:07:04 +08:00
committed by liyang
parent 1f27c15ace
commit c110e79620
7 changed files with 60 additions and 19 deletions
+8 -5
View File
@@ -637,21 +637,24 @@ class control extends baseControl
$flow = $this->loadModel('workflow')->getByModule($moduleName);
if(!$flow) return $config;
$action = $this->loadModel('workflowaction')->getByModuleAndAction($flow->module, $methodName);
$fieldList = $this->workflowaction->getFields($flow->module, $action->action);
$layouts = $this->loadModel('workflowlayout')->getFields($moduleName, $methodName);
$action = $this->loadModel('workflowaction')->getByModuleAndAction($flow->module, $methodName);
$fieldList = $this->workflowaction->getFields($flow->module, $action->action);
$layouts = $this->loadModel('workflowlayout')->getFields($moduleName, $methodName);
$notEmptyRule = $this->loadModel('workflowrule')->getByTypeAndRule('system', 'notempty');
if($layouts)
{
foreach($fieldList as $key => $field)
{
if($field->buildin || !$field->show || !isset($layouts[$field->field])) continue;
$required = $field->readonly || ($notEmptyRule && strpos(",$field->rules,", ",{$notEmptyRule->id},") !== false);
if($field->control == 'multi-select' || $field->control == 'checkbox')
{
$config[$field->field] = array('required' => false, 'type' => 'array', 'default' => array(''), 'filter' => 'join');
$config[$field->field] = array('required' => $required, 'type' => 'array', 'default' => array(''), 'filter' => 'join');
}
else
{
$config[$field->field] = array('required' => false, 'type' => 'string');
$config[$field->field] = array('required' => $required, 'type' => 'string');
if($field->control == 'richtext') $config[$field->field]['control'] = 'editor';
}
}
+21 -5
View File
@@ -553,14 +553,30 @@ class baseValidater
{
if(is_array($files['name']))
{
foreach($files['name'] as $i => $fileName)
foreach($files['name'] as $fileName)
{
$extension = ltrim(strrchr($fileName, '.'), '.');
if(stripos(",{$config->file->dangers},", ",{$extension},") !== false)
if(is_array($fileName))
{
unset($_FILES);
return array();
foreach($fileName as $name)
{
$extension = ltrim(strrchr($name, '.'), '.');
if(stripos(",{$config->file->dangers},", ",{$extension},") !== false)
{
unset($_FILES);
return array();
}
}
}
else
{
$extension = ltrim(strrchr($fileName, '.'), '.');
if(stripos(",{$config->file->dangers},", ",{$extension},") !== false)
{
unset($_FILES);
return array();
}
}
}
}
else
+2 -2
View File
@@ -39,9 +39,9 @@ class detailBody extends wg
$fieldControl = $field->control;
$extraMain[] = section
(
$field->control == 'file' && $data->files ? fileList
$field->control == 'file' && $object->files ? fileList
(
set::files($data->files),
set::files($object->files),
set::extra($field->field),
set::fieldset(false),
set::showEdit(true),
+2 -2
View File
@@ -32,9 +32,9 @@ CSS;
{
$extraSide[] = item
(
$field->control == 'file' && $data->files ? fileList
$field->control == 'file' && $object->files ? fileList
(
set::files($data->files),
set::files($object->files),
set::extra($field->field),
set::fieldset(false),
set::showEdit(true),
+2
View File
@@ -221,7 +221,9 @@ class formPanel extends panel
(
set::name($field->field),
set::label($field->name),
set::required($field->required),
set::control($field->control),
set::items($field->items),
set::width('200px')
);
}
+25 -1
View File
@@ -831,10 +831,34 @@ class bug extends control
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$oldBugs = $this->bug->getByIdList(array_column($bugs, 'id'));
$message = '';
$uidList = $this->post->uid;
$fileList = $_FILES;
$this->loadModel('file');
foreach($bugs as $bugID => $bug)
{
$_POST['uid'] = $uidList[$bugID];
$bug = $this->file->processImgURL($bug, $this->config->bug->editor->batchedit['id'], $this->post->uid);
if($fileList)
{
$currentFile = array();
foreach($fileList as $fieldName => $files)
{
foreach($files as $type => $infoList)
{
foreach($infoList as $infos)
{
foreach($infos as $key => $val)
{
if($key == $bugID) $currentFile[$fieldName][$type][] = $val;
}
}
}
}
$_FILES = $currentFile;
}
$this->bug->update($bug);
$oldBug = $oldBugs[$bugID];
-4
View File
@@ -1455,14 +1455,10 @@ class bugZen extends bug
$bugs = form::batchData($this->config->bug->form->batchEdit)->get();
$oldBugs = $this->bug->getByIdList($bugIdList);
$now = helper::now();
$uidList = $this->post->uid;
/* Process bugs. */
$this->loadModel('file');
foreach($bugs as $index => $bug)
{
$_POST['uid'] = $uidList[$index];
$bug = $this->file->processImgURL($bug, $this->config->bug->editor->batchedit['id'], $this->post->uid);
$oldBug = $oldBugs[$bug->id];
if(is_array($bug->os)) $bug->os = implode(',', $bug->os);