From 2cf56e630eb82ca096aeb392044dbe285d473ace Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 4 Jul 2023 18:29:44 +0800 Subject: [PATCH] * Refactor the custom plan list. --- module/datatable/ui/ajaxcustom.html.php | 1 + module/productplan/config/dtable.php | 13 +++++++++++-- module/productplan/ui/browsebylist.html.php | 13 ++++++------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/module/datatable/ui/ajaxcustom.html.php b/module/datatable/ui/ajaxcustom.html.php index 31ce5b5eff..cbbad8f966 100644 --- a/module/datatable/ui/ajaxcustom.html.php +++ b/module/datatable/ui/ajaxcustom.html.php @@ -71,6 +71,7 @@ function buildBody(array $cols): form foreach($cols as $col) { + if($_SESSION['currentProductType'] == 'normal' && $col['name'] == 'branch') continue; if($col['type']) $col = array_merge(getDefaultConfig($col['type']), $col); if(!isset($col['fixed']) || empty($col['fixed'])) $col['fixed'] = 'no'; $itemsList[$col['fixed']][] = array( diff --git a/module/productplan/config/dtable.php b/module/productplan/config/dtable.php index 257d874167..de5acb6bfa 100644 --- a/module/productplan/config/dtable.php +++ b/module/productplan/config/dtable.php @@ -25,26 +25,30 @@ $config->productplan->dtable->fieldList['status']['title'] = $lang->productp $config->productplan->dtable->fieldList['status']['type'] = 'status'; $config->productplan->dtable->fieldList['status']['sortType'] = true; $config->productplan->dtable->fieldList['status']['align'] = 'left'; -$config->productplan->dtable->fieldList['status']['statusMap'] =$lang->productplan->statusList; +$config->productplan->dtable->fieldList['status']['statusMap'] = $lang->productplan->statusList; $config->productplan->dtable->fieldList['status']['group'] = 'g2'; +$config->productplan->dtable->fieldList['status']['show'] = true; $config->productplan->dtable->fieldList['branch']['name'] = 'branch'; $config->productplan->dtable->fieldList['branch']['title'] = ''; $config->productplan->dtable->fieldList['branch']['type'] = 'text'; $config->productplan->dtable->fieldList['branch']['sortType'] = true; $config->productplan->dtable->fieldList['branch']['group'] = 'g3'; +$config->productplan->dtable->fieldList['branch']['show'] = true; $config->productplan->dtable->fieldList['begin']['name'] = 'begin'; $config->productplan->dtable->fieldList['begin']['title'] = $lang->productplan->begin; $config->productplan->dtable->fieldList['begin']['type'] = 'date'; $config->productplan->dtable->fieldList['begin']['sortType'] = true; $config->productplan->dtable->fieldList['begin']['group'] = 'g4'; +$config->productplan->dtable->fieldList['begin']['show'] = true; $config->productplan->dtable->fieldList['end']['name'] = 'end'; $config->productplan->dtable->fieldList['end']['title'] = $lang->productplan->end; $config->productplan->dtable->fieldList['end']['type'] = 'date'; $config->productplan->dtable->fieldList['end']['sortType'] = true; $config->productplan->dtable->fieldList['end']['group'] = 'g4'; +$config->productplan->dtable->fieldList['end']['show'] = true; $config->productplan->dtable->fieldList['stories']['name'] = 'stories'; $config->productplan->dtable->fieldList['stories']['title'] = $lang->productplan->stories; @@ -52,35 +56,40 @@ $config->productplan->dtable->fieldList['stories']['type'] = 'number'; $config->productplan->dtable->fieldList['stories']['sortType'] = false; $config->productplan->dtable->fieldList['stories']['width'] = 84; $config->productplan->dtable->fieldList['stories']['group'] = 'g5'; +$config->productplan->dtable->fieldList['stories']['show'] = true; $config->productplan->dtable->fieldList['bugs']['name'] = 'bugs'; $config->productplan->dtable->fieldList['bugs']['title'] = $lang->productplan->bugs; $config->productplan->dtable->fieldList['bugs']['type'] = 'number'; $config->productplan->dtable->fieldList['bugs']['sortType'] = false; $config->productplan->dtable->fieldList['bugs']['group'] = 'g5'; +$config->productplan->dtable->fieldList['bugs']['show'] = true; $config->productplan->dtable->fieldList['hour']['name'] = 'hour'; $config->productplan->dtable->fieldList['hour']['title'] = $lang->productplan->hour; $config->productplan->dtable->fieldList['hour']['type'] = 'number'; $config->productplan->dtable->fieldList['hour']['sortType'] = false; $config->productplan->dtable->fieldList['hour']['group'] = 'g5'; +$config->productplan->dtable->fieldList['hour']['show'] = true; $config->productplan->dtable->fieldList['execution']['name'] = 'execution'; $config->productplan->dtable->fieldList['execution']['title'] = $lang->productplan->execution; $config->productplan->dtable->fieldList['execution']['type'] = 'number'; $config->productplan->dtable->fieldList['execution']['sortType'] = false; $config->productplan->dtable->fieldList['execution']['group'] = 'g6'; +$config->productplan->dtable->fieldList['execution']['show'] = true; $config->productplan->dtable->fieldList['desc']['name'] = 'desc'; $config->productplan->dtable->fieldList['desc']['title'] = $lang->productplan->desc; $config->productplan->dtable->fieldList['desc']['type'] = 'text'; $config->productplan->dtable->fieldList['desc']['sortType'] = false; $config->productplan->dtable->fieldList['desc']['group'] = 'g7'; +$config->productplan->dtable->fieldList['desc']['show'] = true; $config->productplan->dtable->fieldList['actions']['name'] = 'actions'; $config->productplan->dtable->fieldList['actions']['title'] = $lang->actions; $config->productplan->dtable->fieldList['actions']['fixed'] = 'right'; -$config->productplan->dtable->fieldList['actions']['required'] = 'yes'; +$config->productplan->dtable->fieldList['actions']['required'] = true; $config->productplan->dtable->fieldList['actions']['width'] = 'auto'; $config->productplan->dtable->fieldList['actions']['type'] = 'actions'; $config->productplan->dtable->fieldList['actions']['minWidth'] = 200; diff --git a/module/productplan/ui/browsebylist.html.php b/module/productplan/ui/browsebylist.html.php index 8ac47796c1..30d9f2456e 100644 --- a/module/productplan/ui/browsebylist.html.php +++ b/module/productplan/ui/browsebylist.html.php @@ -13,24 +13,23 @@ declare(strict_types=1); namespace zin; /* Get field list for data table. */ -$fnGetTableFieldList = function() use ($config, $browseType, $lang, $product) +$cols = $this->loadModel('datatable')->getSetting('productplan'); +$fnGetTableFieldList = function() use ($cols, $browseType, $lang, $product) { - $fieldList = $config->productplan->dtable->fieldList; - - if($browseType != 'all') unset($fieldList['status']); + if($browseType != 'all') unset($cols['status']); if($this->session->currentProductType == 'normal') { - unset($fieldList['branch']); + unset($cols['branch']); } else { - $fieldList['branch']['title'] = $lang->product->branchName[$product->type]; + $cols['branch']['title'] = $lang->product->branchName[$product->type]; } // TODO: attach extend fields of Workflow module. - return array_values($fieldList); + return array_values($cols); }; $totalParent = 0;