diff --git a/module/datatable/control.php b/module/datatable/control.php index ebad8bbb73..77477f2545 100644 --- a/module/datatable/control.php +++ b/module/datatable/control.php @@ -96,7 +96,7 @@ class datatable extends control $value = json_encode($fields); /* Split story and requirement custom fields. */ - if($module == 'product' && $method == 'browse' && strpos(',story,requirement,', ",$extra,") !== false) $name = 'datatable.' . $module . ucfirst($method) . ucfirst($extra) . '.cols'; + if(strpos(',product-browse,execution-story,', ",$module-$method,") !== false && strpos(',story,requirement,', ",$extra,") !== false) $name = 'datatable.' . $module . ucfirst($method) . ucfirst($extra) . '.cols'; /* 保存个人配置信息。 */ $this->loadModel('setting')->setItem($account . '.' . $name, $value); @@ -200,7 +200,7 @@ class datatable extends control $this->loadModel('setting')->deleteItems("owner={$account}&module=datatable§ion={$target}&key=cols"); /* Delete story and requirement custom fields. */ - if($module == 'product' && $method == 'browse') + if(strpos(',product-browse,execution-story,', ",$module-$method,") !== false) { $storyCustom = $module . ucfirst($method) . 'Story'; $requirementCustom = $module . ucfirst($method) . 'Requirement'; @@ -223,7 +223,7 @@ class datatable extends control public function ajaxSaveGlobal(string $module, string $method, string $extra = '') { $target = $module . ucfirst($method); - if($module == 'product' && $method == 'browse' && strpos(',story,requirement', ",$extra,") !== false) $target .= ucfirst($extra); + if(strpos(',product-browse,execution-story,', ",$module-$method,") !== false && strpos(',story,requirement', ",$extra,") !== false) $target .= ucfirst($extra); $settings = isset($this->config->datatable->$target->cols) ? $this->config->datatable->$target->cols : ''; if(!empty($settings)) $this->loadModel('setting')->setItem("system.datatable.{$target}.cols", $settings); diff --git a/module/datatable/model.php b/module/datatable/model.php index c4c2da6448..7bbe448b95 100644 --- a/module/datatable/model.php +++ b/module/datatable/model.php @@ -91,7 +91,7 @@ class datatableModel extends model $datatableId = $module . ucfirst($method); /* Split story and requirement custom fields. */ - if($module == 'product' && $method == 'browse' && strpos(',story,requirement,', $extra) !== false) $datatableId .= ucfirst($extra); + if(strpos(',product-browse,execution-story,', ",$module-$method,") !== false && strpos(',story,requirement,', $extra) !== false) $datatableId .= ucfirst($extra); $module = zget($this->config->datatable->moduleAlias, "$module-$method", $module); diff --git a/module/execution/ui/story.html.php b/module/execution/ui/story.html.php index cae052e78a..6caecc74a1 100644 --- a/module/execution/ui/story.html.php +++ b/module/execution/ui/story.html.php @@ -353,13 +353,14 @@ if($canBatchAction) } /* DataTable columns. */ -$setting = $this->loadModel('datatable')->getSetting('execution'); +$config->story->dtable->fieldList['title']['title'] = $lang->story->title; +$setting = $this->loadModel('datatable')->getSetting('execution', 'story', false, $storyType); $cols = array(); +if($storyType == 'requirement') unset($setting['plan'], $setting['stage'], $setting['taskCount'], $setting['bugCount'], $setting['caseCount']); foreach($setting as $col) { if(!$execution->hasProduct && $col['name'] == 'branch') continue; if(!$execution->hasProduct && !$execution->multiple && $col['name'] == 'plan') continue; - if(!$execution->hasProduct && !$execution->multiple && $storyType == 'requirement' && $col['name'] == 'stage') continue; if($col['name'] == 'title') $col['link'] = createLink('execution', 'storyView', array('storyID' => '{id}', 'execution' => $execution->id)); @@ -395,7 +396,7 @@ dtable ( setClass('shadow rounded'), set::userMap($users), - set::customCols(true), + set::customCols(array('url' => createLink('datatable', 'ajaxcustom', "module={$app->moduleName}&method={$app->methodName}&extra={$storyType}"), 'globalUrl' => createLink('datatable', 'ajaxsaveglobal', "module={$app->moduleName}&method={$app->methodName}&extra={$storyType}"))), set::groupDivider(true), set::cols($cols), set::data($data), diff --git a/module/upgrade/model.php b/module/upgrade/model.php index ab0f7a1cda..493e9bfc76 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -8451,6 +8451,7 @@ class upgradeModel extends model public function revertStoryCustomFields() { $this->dao->delete()->from(TABLE_CONFIG)->where('section')->eq('productBrowse')->andWhere('module')->eq('datatable')->andWhere('key')->eq('cols')->exec(); + $this->dao->delete()->from(TABLE_CONFIG)->where('section')->eq('executionStory')->andWhere('module')->eq('datatable')->andWhere('key')->eq('cols')->exec(); return true; } }