* Add extra form config.

This commit is contained in:
wangyuting
2024-03-21 16:57:21 +08:00
parent 5a058632a1
commit 32db461b43
3 changed files with 34 additions and 2 deletions
+32 -1
View File
@@ -542,7 +542,7 @@ class control extends baseControl
}
/**
* append workflow js and css to form.
* append workflow field to form.
*
* @param string $position info|basic
* @param object $object
@@ -597,6 +597,37 @@ class control extends baseControl
return array();
}
/**
* append workflow form config.
*
* @param array $config
* @param string $moduleName
* @param string $methodName
* @access public
* @return void
*/
public function appendExtendFormConfig(array $config, string $moduleName = '', string $methodName = '')
{
if($this->config->edition == 'open') return $config;
$moduleName = $moduleName ? $moduleName : $this->app->getModuleName();
$methodName = $methodName ? $moduleName : $this->app->getMethodName();
$flow = $this->loadModel('workflow')->getByModule($moduleName);
$action = $this->loadModel('workflowaction')->getByModuleAndAction($flow->module, $methodName);
$fieldList = $this->workflowaction->getFields($flow->module, $action->action);
$layouts = $this->loadModel('workflowlayout')->getFields($moduleName, $methodName);
if($layouts)
{
foreach($fieldList as $key => $field)
{
if($field->buildin || !$field->show || !isset($layouts[$field->field])) continue;
$config[$field->field] = array('required' => false, 'type' => $field->type);
}
}
return $config;
}
/**
* Process status of an object according to its subStatus.
*
+1
View File
@@ -72,6 +72,7 @@ class form extends fixer
global $app, $config;
if($configObject === null) $configObject = $config->{$app->moduleName}->form->{$app->methodName};
$configObject = $app->control->appendExtendFormConfig($configObject);
return (new form)->config($configObject);
}
+1 -1
View File
@@ -206,7 +206,7 @@ class bug extends control
*/
public function create(int $productID, string $branch = '', string $extras = '')
{
$extras = str_replace(array(',', ' ', '*'), array('&', '', '-'), $extras);
$extras = str_replace(array(',', ' ', '*'), array('&', '', '-'), $extras);
parse_str($extras, $params);
$from = isset($params['from']) ? $params['from'] : '';