diff --git a/framework/control.class.php b/framework/control.class.php index 51c16f7b08..2adfdf52bb 100644 --- a/framework/control.class.php +++ b/framework/control.class.php @@ -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. * diff --git a/lib/form/form.class.php b/lib/form/form.class.php index 4adecd1a5a..927d4ab86e 100644 --- a/lib/form/form.class.php +++ b/lib/form/form.class.php @@ -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); } diff --git a/module/bug/control.php b/module/bug/control.php index 02a6254ee2..71f852ff72 100755 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -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'] : '';