From cd431a0d7835dfc202153c43d7080dea4573ff9a Mon Sep 17 00:00:00 2001 From: qiyu-xie Date: Thu, 26 Nov 2020 15:15:11 +0800 Subject: [PATCH] * Finish task#8487. Modify dynamic links and notes. --- config/zentaopms.php | 1 + module/action/config.php | 1 + module/action/lang/zh-cn.php | 8 +++++--- module/action/model.php | 15 ++++++++------- module/program/control.php | 10 ++++++---- module/project/control.php | 34 +++++++++++++++++----------------- 6 files changed, 38 insertions(+), 31 deletions(-) diff --git a/config/zentaopms.php b/config/zentaopms.php index 3aa4ab08fb..247f68b965 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -214,6 +214,7 @@ $config->objectTables['productplan'] = TABLE_PRODUCTPLAN; $config->objectTables['release'] = TABLE_RELEASE; $config->objectTables['program'] = TABLE_PROJECT; $config->objectTables['project'] = TABLE_PROJECT; +$config->objectTables['execution'] = TABLE_PROJECT; $config->objectTables['task'] = TABLE_TASK; $config->objectTables['build'] = TABLE_BUILD; $config->objectTables['bug'] = TABLE_BUG; diff --git a/module/action/config.php b/module/action/config.php index 24343e17ac..f51864c95c 100755 --- a/module/action/config.php +++ b/module/action/config.php @@ -5,6 +5,7 @@ $config->action->objectNameFields['productplan'] = 'title'; $config->action->objectNameFields['release'] = 'name'; $config->action->objectNameFields['program'] = 'name'; $config->action->objectNameFields['project'] = 'name'; +$config->action->objectNameFields['execution'] = 'name'; $config->action->objectNameFields['task'] = 'name'; $config->action->objectNameFields['build'] = 'name'; $config->action->objectNameFields['bug'] = 'title'; diff --git a/module/action/lang/zh-cn.php b/module/action/lang/zh-cn.php index 12fec12671..1a7719a9be 100755 --- a/module/action/lang/zh-cn.php +++ b/module/action/lang/zh-cn.php @@ -68,8 +68,9 @@ $lang->action->objectTypes['product'] = $lang->productCommon; $lang->action->objectTypes['story'] = $lang->productSRCommon; $lang->action->objectTypes['productplan'] = $lang->planCommon; $lang->action->objectTypes['release'] = '发布'; -$lang->action->objectTypes['program'] = '项目'; -$lang->action->objectTypes['project'] = $lang->projectCommon; +$lang->action->objectTypes['program'] = '项目集'; +$lang->action->objectTypes['project'] = '项目'; +$lang->action->objectTypes['execution'] = '执行'; $lang->action->objectTypes['task'] = '任务'; $lang->action->objectTypes['build'] = '版本'; $lang->action->objectTypes['bug'] = 'Bug'; @@ -401,7 +402,8 @@ $lang->action->label->productplan = "{$lang->planCommon}|productplan|view|produc $lang->action->label->release = '发布|release|view|productID=%s'; $lang->action->label->story = "{$lang->productSRCommon}|story|view|storyID=%s"; $lang->action->label->program = "项目集|program|pgmproduct|programID=%s"; -$lang->action->label->project = "{$lang->projectCommon}|project|view|projectID=%s"; +$lang->action->label->project = "项目|project|view|projectID=%s"; +$lang->action->label->execution = "执行|project|task|projectID=%s"; $lang->action->label->task = '任务|task|view|taskID=%s'; $lang->action->label->build = '版本|build|view|buildID=%s'; $lang->action->label->bug = 'Bug|bug|view|bugID=%s'; diff --git a/module/action/model.php b/module/action/model.php index 01be196edf..9f5eec9d3e 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -801,12 +801,13 @@ class actionModel extends model { if(!isset($this->config->objectTables[$objectType])) continue; // If no defination for this type, omit it. - $objectIds = array_unique($objectIds); - $table = $this->config->objectTables[$objectType]; - $field = $this->config->action->objectNameFields[$objectType]; + $objectIds = array_unique($objectIds); + $table = $this->config->objectTables[$objectType]; + $field = $this->config->action->objectNameFields[$objectType]; if($table != TABLE_TODO) { - if(strpos($table, 'task') !== false or strpos($table, 'bug') !== false or strpos($table, 'build') !== false or strpos($table, 'issue') !== false) + $needGetPRJType = 'task,bug,build,issue'; + if(strpos($needGetPRJType, $objectType) !== false) { $objectInfo = $this->dao->select("id, PRJ, $field AS name")->from($table)->where('id')->in($objectIds)->fetchAll(); foreach($objectInfo as $object) @@ -815,13 +816,13 @@ class actionModel extends model $objectPRJ[$object->id] = $object->PRJ; } } - elseif(strpos($table, 'project') !== false) + elseif($objectType == 'program' or $objectType == 'project' or $objectType == 'execution') { - $objectInfo = $this->dao->select("id, $field AS name")->from($table)->where('id')->in($objectIds)->fetchAll(); + $objectInfo = $this->dao->select("id, project, $field AS name")->from($table)->where('id')->in($objectIds)->fetchAll(); foreach($objectInfo as $object) { $objectName[$object->id] = $object->name; - $objectPRJ[$object->id] = $object->id; + $objectPRJ[$object->id] = $object->project > 0 ? $object->project : $object->id; } } else diff --git a/module/program/control.php b/module/program/control.php index 328b7cfaa6..feb3eaaaf4 100644 --- a/module/program/control.php +++ b/module/program/control.php @@ -1139,7 +1139,8 @@ class program extends control if($this->post->comment != '' or !empty($changes)) { - $actionID = $this->action->create('program', $projectID, 'Started', $this->post->comment); + $objectType = $project->type == 'program' ? 'program' : 'project'; + $actionID = $this->action->create($objectType, $projectID, 'Started', $this->post->comment); $this->action->logHistory($actionID, $changes); } $this->executeHooks($projectID); @@ -1174,7 +1175,8 @@ class program extends control if($this->post->comment != '' or !empty($changes)) { - $actionID = $this->action->create('program', $projectID, 'Suspended', $this->post->comment); + $objectType = $project->type == 'program' ? 'program' : 'project'; + $actionID = $this->action->create($objectType, $projectID, 'Suspended', $this->post->comment); $this->action->logHistory($actionID, $changes); } $this->executeHooks($projectID); @@ -1210,7 +1212,7 @@ class program extends control if($this->post->comment != '' or !empty($changes)) { - $actionID = $this->action->create('program', $projectID, 'Closed', $this->post->comment); + $actionID = $this->action->create('project', $projectID, 'Closed', $this->post->comment); $this->action->logHistory($actionID, $changes); } $this->executeHooks($projectID); @@ -1246,7 +1248,7 @@ class program extends control if($this->post->comment != '' or !empty($changes)) { - $actionID = $this->action->create('program', $projectID, 'Activated', $this->post->comment); + $actionID = $this->action->create('project', $projectID, 'Activated', $this->post->comment); $this->action->logHistory($actionID, $changes); } $this->executeHooks($projectID); diff --git a/module/project/control.php b/module/project/control.php index 3792d11fab..f79d6918d8 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -81,7 +81,7 @@ class project extends control $products = $this->project->getProducts($projectID); $childProjects = $this->project->getChildExecutions($projectID); $teamMembers = $this->project->getTeamMembers($projectID); - $actions = $this->loadModel('action')->getList('project', $projectID); + $actions = $this->loadModel('action')->getList('execution', $projectID); /* Set menu. */ $this->project->setMenu($this->projects, $projectID, $buildID = 0, $extra); @@ -1149,7 +1149,7 @@ class project extends control $this->project->updateProducts($projectID); if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); - $this->loadModel('action')->create('project', $projectID, 'opened', '', join(',', $_POST['products'])); + $this->loadModel('action')->create('execution', $projectID, 'opened', '', join(',', $_POST['products'])); $this->executeHooks($projectID); @@ -1239,7 +1239,7 @@ class project extends control $this->loadModel('action'); $this->dao->update(TABLE_PROJECT)->set('deleted')->eq(0)->where('id')->eq($projectID)->exec(); $this->dao->update(TABLE_ACTION)->set('extra')->eq(ACTIONMODEL::BE_UNDELETED)->where('id')->eq($extra)->exec(); - $this->action->create('project', $projectID, 'undeleted'); + $this->action->create('execution', $projectID, 'undeleted'); } $oldProducts = array_keys($oldProducts); $newProducts = $this->project->getProducts($projectID); @@ -1249,7 +1249,7 @@ class project extends control if($changes or $diffProducts) { - $actionID = $this->loadModel('action')->create('project', $projectID, 'edited', '', $products); + $actionID = $this->loadModel('action')->create('execution', $projectID, 'edited', '', $products); $this->action->logHistory($actionID, $changes); } $this->executeHooks($projectID); @@ -1352,7 +1352,7 @@ class project extends control { if(empty($changes)) continue; - $actionID = $this->loadModel('action')->create('project', $projectID, 'Edited'); + $actionID = $this->loadModel('action')->create('execution', $projectID, 'Edited'); $this->action->logHistory($actionID, $changes); } } @@ -1425,7 +1425,7 @@ class project extends control if($this->post->comment != '' or !empty($changes)) { - $actionID = $this->action->create('project', $projectID, 'Started', $this->post->comment); + $actionID = $this->action->create('execution', $projectID, 'Started', $this->post->comment); $this->action->logHistory($actionID, $changes); } $this->executeHooks($projectID); @@ -1436,7 +1436,7 @@ class project extends control $this->view->position[] = html::a($this->createLink('project', 'browse', "projectID=$projectID"), $this->view->project->name); $this->view->position[] = $this->lang->project->start; $this->view->users = $this->loadModel('user')->getPairs('noletter'); - $this->view->actions = $this->loadModel('action')->getList('project', $projectID); + $this->view->actions = $this->loadModel('action')->getList('execution', $projectID); $this->display(); } @@ -1460,7 +1460,7 @@ class project extends control if($this->post->comment != '' or !empty($changes)) { - $actionID = $this->action->create('project', $projectID, 'Delayed', $this->post->comment); + $actionID = $this->action->create('execution', $projectID, 'Delayed', $this->post->comment); $this->action->logHistory($actionID, $changes); } $this->executeHooks($projectID); @@ -1471,7 +1471,7 @@ class project extends control $this->view->position[] = html::a($this->createLink('project', 'browse', "projectID=$projectID"), $this->view->project->name); $this->view->position[] = $this->lang->project->putoff; $this->view->users = $this->loadModel('user')->getPairs('noletter'); - $this->view->actions = $this->loadModel('action')->getList('project', $projectID); + $this->view->actions = $this->loadModel('action')->getList('execution', $projectID); $this->display(); } @@ -1495,7 +1495,7 @@ class project extends control if($this->post->comment != '' or !empty($changes)) { - $actionID = $this->action->create('project', $projectID, 'Suspended', $this->post->comment); + $actionID = $this->action->create('execution', $projectID, 'Suspended', $this->post->comment); $this->action->logHistory($actionID, $changes); } $this->executeHooks($projectID); @@ -1506,7 +1506,7 @@ class project extends control $this->view->position[] = html::a($this->createLink('project', 'browse', "projectID=$projectID"), $this->view->project->name); $this->view->position[] = $this->lang->project->suspend; $this->view->users = $this->loadModel('user')->getPairs('noletter'); - $this->view->actions = $this->loadModel('action')->getList('project', $projectID); + $this->view->actions = $this->loadModel('action')->getList('execution', $projectID); $this->display(); } @@ -1530,7 +1530,7 @@ class project extends control if($this->post->comment != '' or !empty($changes)) { - $actionID = $this->action->create('project', $projectID, 'Activated', $this->post->comment); + $actionID = $this->action->create('execution', $projectID, 'Activated', $this->post->comment); $this->action->logHistory($actionID, $changes); } $this->executeHooks($projectID); @@ -1546,7 +1546,7 @@ class project extends control $this->view->position[] = $this->lang->project->activate; $this->view->project = $project; $this->view->users = $this->loadModel('user')->getPairs('noletter'); - $this->view->actions = $this->loadModel('action')->getList('project', $projectID); + $this->view->actions = $this->loadModel('action')->getList('execution', $projectID); $this->view->newBegin = $newBegin; $this->view->newEnd = $newEnd; $this->display(); @@ -1572,7 +1572,7 @@ class project extends control if($this->post->comment != '' or !empty($changes)) { - $actionID = $this->action->create('project', $projectID, 'Closed', $this->post->comment); + $actionID = $this->action->create('execution', $projectID, 'Closed', $this->post->comment); $this->action->logHistory($actionID, $changes); } $this->executeHooks($projectID); @@ -1583,7 +1583,7 @@ class project extends control $this->view->position[] = html::a($this->createLink('project', 'browse', "projectID=$projectID"), $this->view->project->name); $this->view->position[] = $this->lang->project->close; $this->view->users = $this->loadModel('user')->getPairs('noletter'); - $this->view->actions = $this->loadModel('action')->getList('project', $projectID); + $this->view->actions = $this->loadModel('action')->getList('execution', $projectID); $this->display(); } @@ -1628,7 +1628,7 @@ class project extends control $this->view->products = $products; $this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products), '', $linkedBranches); $this->view->planGroups = $this->project->getPlans($products); - $this->view->actions = $this->loadModel('action')->getList('project', $projectID); + $this->view->actions = $this->loadModel('action')->getList('execution', $projectID); $this->view->dynamics = $this->loadModel('action')->getDynamic('all', 'all', 'date_desc', $pager, 'all', $projectID); $this->view->users = $this->loadModel('user')->getPairs('noletter'); $this->view->teamMembers = $this->project->getTeamMembers($projectID); @@ -1947,7 +1947,7 @@ class project extends control $newProducts = $this->project->getProducts($projectID); $newProducts = array_keys($newProducts); $diffProducts = array_merge(array_diff($oldProducts, $newProducts), array_diff($newProducts, $oldProducts)); - if($diffProducts) $this->loadModel('action')->create('project', $projectID, 'Managed', '', !empty($_POST['products']) ? join(',', $_POST['products']) : ''); + if($diffProducts) $this->loadModel('action')->create('execution', $projectID, 'Managed', '', !empty($_POST['products']) ? join(',', $_POST['products']) : ''); die(js::locate($browseProjectLink)); }