From 1eab431aa42ae2dc1492c77176f4cd77dca0c45f Mon Sep 17 00:00:00 2001 From: wangyuting Date: Thu, 21 Mar 2024 09:01:37 +0800 Subject: [PATCH] * Add workflow fields to formpanel. --- framework/control.class.php | 22 ++++++++++++++++++++++ lib/zin/wg/formpanel/v1.php | 8 ++++++++ 2 files changed, 30 insertions(+) diff --git a/framework/control.class.php b/framework/control.class.php index 003a67c19b..351bd6d01b 100644 --- a/framework/control.class.php +++ b/framework/control.class.php @@ -488,6 +488,28 @@ class control extends baseControl echo $fields; } + /** + * append workflow fields to form. + * + * @param zin\fieldList $fields + * @param string $moduleName + * @param string $methodName + * @access public + * @return void + */ + public function appendExtendFields(zin\fieldList $fields, string $moduleName = '', string $methodName = '') + { + if($this->config->edition == 'open') return false; + + $moduleName = $moduleName ?: $this->app->getModuleName(); + $methodName = $methodName ?: $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); + return $this->loadModel('flow')->buildFormFields($fields, $fieldList); + } + /** * Process status of an object according to its subStatus. * diff --git a/lib/zin/wg/formpanel/v1.php b/lib/zin/wg/formpanel/v1.php index 406ed0232f..32779c95e4 100644 --- a/lib/zin/wg/formpanel/v1.php +++ b/lib/zin/wg/formpanel/v1.php @@ -73,6 +73,14 @@ class formPanel extends panel protected function created() { + $fields = $this->prop('fields'); + if(is_object($fields)) + { + global $app; + $fields = $app->control->appendExtendFields($fields); + $this->setProp('fields', $fields); + } + $customFields = $this->prop('customFields'); if($customFields === true) {