From e57d1d1cc7beb9342092d7e9900a9036d321eb82 Mon Sep 17 00:00:00 2001 From: zhouxin Date: Fri, 12 Nov 2021 14:06:44 +0800 Subject: [PATCH 01/18] Finish task #43916. --- module/execution/model.php | 14 ++++++-------- module/product/model.php | 11 ++++------- module/program/model.php | 2 +- module/project/control.php | 9 ++++++--- module/project/model.php | 14 ++++++-------- 5 files changed, 23 insertions(+), 27 deletions(-) diff --git a/module/execution/model.php b/module/execution/model.php index 54c37ce3e8..d6d061b6dc 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -365,8 +365,8 @@ class executionModel extends model $this->dao->insert(TABLE_EXECUTION)->data($sprint) ->autoCheck($skipFields = 'begin,end') ->batchcheck($this->config->execution->create->requiredFields, 'notempty') - ->checkIF(!empty($sprint->name), 'name', 'unique', "`type` in ('sprint','stage') and `parent` = $sprint->parent") - ->checkIF(!empty($sprint->code), 'code', 'unique', "`type` in ('sprint','stage') and `parent` = $sprint->parent") + ->checkIF(!empty($sprint->name), 'name', 'unique', "`type` in ('sprint','stage') and `project` = $sprint->project") + ->checkIF(!empty($sprint->code), 'code', 'unique', "`type` in ('sprint','stage')") ->checkIF($sprint->begin != '', 'begin', 'date') ->checkIF($sprint->end != '', 'end', 'date') ->checkIF($sprint->end != '', 'end', 'ge', $sprint->begin) @@ -519,6 +519,7 @@ class executionModel extends model ->checkIF($execution->begin != '', 'begin', 'date') ->checkIF($execution->end != '', 'end', 'date') ->checkIF($execution->end != '', 'end', 'ge', $execution->begin) + ->checkIF(!empty($execution->name), 'name', 'unique', "id != $executionID and type in ('sprint','stage') and `project` = $execution->project") ->checkIF(!empty($execution->code), 'code', 'unique', "id != $executionID and type in ('sprint','stage')") ->where('id')->eq($executionID) ->limit(1) @@ -544,7 +545,7 @@ class executionModel extends model $changedAccounts[$owner] = $owner; $teamMembers[$ownerField] = $member; } - if($execution->project) $this->addProjectMembers($execution->project, $teamMembers); + if($execution->project) $this->addProjectMembers($execution->project, $teamMembers); $whitelist = explode(',', $execution->whitelist); $this->loadModel('personnel')->updateWhitelist($whitelist, 'sprint', $executionID); @@ -624,10 +625,6 @@ class executionModel extends model if(isset($data->projects)) $executions[$executionID]->project = zget($data->projects, $executionID, 0); if(isset($data->attributes)) $executions[$executionID]->attribute = zget($data->attributes, $executionID, ''); - /* Check unique name for edited executions. */ - if(isset($nameList[$executionName])) dao::$errors['name'][] = 'execution#' . $executionID . sprintf($this->lang->error->unique, $this->lang->execution->name, $executionName); - $nameList[$executionName] = $executionName; - /* Check unique code for edited executions. */ if($projectModel == 'scrum' and empty($executionCode)) { @@ -653,7 +650,8 @@ class executionModel extends model ->checkIF($execution->begin != '', 'begin', 'date') ->checkIF($execution->end != '', 'end', 'date') ->checkIF($execution->end != '', 'end', 'gt', $execution->begin) - ->checkIF(!empty($execution->code), 'code', 'unique', "id NOT " . helper::dbIN($data->executionIDList) . " and type in ('sprint','stage')") + ->checkIF(!empty($execution->name), 'name', 'unique', "id != $executionID and type in ('sprint','stage') and `project` = $oldExecution->project") + ->checkIF(!empty($execution->code), 'code', 'unique', "id != $executionID and type in ('sprint','stage')") ->where('id')->eq($executionID) ->limit(1) ->exec(); diff --git a/module/product/model.php b/module/product/model.php index ac18b4f688..70ba07f817 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -562,7 +562,7 @@ class productModel extends model $this->dao->insert(TABLE_PRODUCT)->data($product)->autoCheck() ->batchCheck($this->config->product->create->requiredFields, 'notempty') ->checkIF(!empty($product->name), 'name', 'unique', "`program` = $product->program") - ->checkIF(!empty($product->code), 'code', 'unique', "`program` = $product->program") + ->checkIF(!empty($product->code), 'code', 'unique') ->exec(); if(!dao::isError()) @@ -631,8 +631,8 @@ class productModel extends model $product = $this->loadModel('file')->processImgURL($product, $this->config->product->editor->edit['id'], $this->post->uid); $this->dao->update(TABLE_PRODUCT)->data($product)->autoCheck() ->batchCheck($this->config->product->edit->requiredFields, 'notempty') + ->checkIF(!empty($product->name), 'name', 'unique', "id != $productID and `program` = $product->program") ->checkIF(!empty($product->code), 'code', 'unique', "id != $productID") - ->check('name', 'unique', "id != $productID and deleted = '0'") ->where('id')->eq($productID) ->exec(); @@ -659,6 +659,7 @@ class productModel extends model $data = fixer::input('post')->get(); $oldProducts = $this->getByIdList($this->post->productIDList); $nameList = array(); + foreach($data->productIDList as $productID) { $productName = $data->names[$productID]; @@ -675,10 +676,6 @@ class productModel extends model $products[$productID]->status = $data->statuses[$productID]; $products[$productID]->desc = strip_tags($this->post->descs[$productID], $this->config->allowedTags); $products[$productID]->acl = $data->acls[$productID]; - - /* Check unique name for edited products. */ - if(isset($nameList[$productName])) dao::$errors['name'][] = 'product#' . $productID . sprintf($this->lang->error->unique, $this->lang->product->name, $productName); - $nameList[$productName] = $productName; } if(dao::isError()) die(js::error(dao::getError())); @@ -690,7 +687,7 @@ class productModel extends model ->data($product) ->autoCheck() ->batchCheck($this->config->product->edit->requiredFields , 'notempty') - ->check('name', 'unique', "id NOT " . helper::dbIN($data->productIDList) . " and deleted='0'") + ->checkIF(!empty($product->name), 'name', 'unique', "id != $productID and `program` = $oldProduct->program") ->where('id')->eq($productID) ->exec(); if(dao::isError()) die(js::error('product#' . $productID . dao::getError(true))); diff --git a/module/program/model.php b/module/program/model.php index 46bb357213..8ab2027d4a 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -741,7 +741,7 @@ class programModel extends model ->checkIF($program->begin != '', 'begin', 'date') ->checkIF($program->end != '', 'end', 'date') ->checkIF($program->end != '', 'end', 'gt', $program->begin) - ->check('name', 'unique', "id!=$programID and deleted='0' and `type`='program'") + ->checkIF(!empty($program->name), 'name', 'unique', "id!=$programID and `type`='program' and `parent` = $program->parent") ->where('id')->eq($programID) ->limit(1) ->exec(); diff --git a/module/project/control.php b/module/project/control.php index 1a78c40116..cc91cf633e 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -272,7 +272,7 @@ class project extends control $this->view->title = $this->lang->project->browse; $this->view->position[] = $this->lang->project->browse; - + $this->view->projectStats = $projectStats; $this->view->pager = $pager; $this->view->programID = $programID; @@ -511,9 +511,12 @@ class project extends control /* Link the plan stories. */ $newPlans = array(); - foreach($_POST['plans'] as $plans) + if(isset($_POST['plans'])) { - foreach($plans as $planID) $newPlans[$planID] = $planID; + foreach($_POST['plans'] as $plans) + { + foreach($plans as $planID) $newPlans[$planID] = $planID; + } } $diffResult = array_diff($oldPlans, $newPlans); diff --git a/module/project/model.php b/module/project/model.php index 7c3d87401b..e46937ae4a 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -840,7 +840,7 @@ class projectModel extends model ->autoCheck() ->batchcheck($requiredFields, 'notempty') ->checkIF(!empty($project->name), 'name', 'unique', "`type`='project' and `parent` = $project->parent") - ->checkIF(!empty($project->code), 'code', 'unique', "`type`='project' and `parent` = $project->parent") + ->checkIF(!empty($project->code), 'code', 'unique', "`type`='project'") ->checkIF($project->end != '', 'end', 'gt', $project->begin) ->exec(); @@ -1031,8 +1031,8 @@ class projectModel extends model ->checkIF($project->begin != '', 'begin', 'date') ->checkIF($project->end != '', 'end', 'date') ->checkIF($project->end != '', 'end', 'gt', $project->begin) - ->checkIF(!empty($project->code), 'code', 'unique', "id != $projectID and type='project'") - ->check('name', 'unique', "id != $projectID AND type='project' AND deleted='0'") + ->checkIF(!empty($project->name), 'name', 'unique', "id != $projectID and `type` = 'project' and `parent` = $project->parent") + ->checkIF(!empty($project->code), 'code', 'unique', "id != $projectID and `type` = 'project'") ->where('id')->eq($projectID) ->exec(); @@ -1096,10 +1096,6 @@ class projectModel extends model $projects[$projectID]->lastEditedBy = $this->app->user->account; $projects[$projectID]->lastEditedDate = helper::now(); - /* Check unique name for edited projects. */ - if(isset($nameList[$projectName])) dao::$errors['name'][] = 'project#' . $projectID . sprintf($this->lang->error->unique, $this->lang->project->name, $projectName); - $nameList[$projectName] = $projectName; - if($projects[$projectID]->parent) { $parentProject = $this->dao->select('*')->from(TABLE_PROGRAM)->where('id')->eq($projects[$projectID]->parent)->fetch(); @@ -1125,6 +1121,8 @@ class projectModel extends model ->checkIF($project->begin != '', 'begin', 'date') ->checkIF($project->end != '', 'end', 'date') ->checkIF($project->end != '', 'end', 'gt', $project->begin) + ->checkIF(!empty($project->name), 'name', 'unique', "id != $projectID and `type`='project' and `parent` = $project->parent") + ->checkIF(!empty($project->code), 'code', 'unique', "id != $projectID and `type`='project'") ->where('id')->eq($projectID) ->exec(); @@ -1464,7 +1462,7 @@ class projectModel extends model $class = "c-$id" . (in_array($id, array('budget', 'teamCount', 'estimate', 'consume')) ? ' c-number' : ''); if($id == 'id') $class .= ' cell-id'; - + if($id == 'code') $title = "title={$project->code}"; if($id == 'name') From 9ae77a27654e5ededad815037bace8122c8569a1 Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Fri, 12 Nov 2021 15:54:10 +0800 Subject: [PATCH 02/18] * Product->Setting Language item modification. --- module/branch/control.php | 1 + module/branch/lang/zh-cn.php | 8 ++++---- module/branch/model.php | 3 ++- module/branch/view/manage.html.php | 6 +++--- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/module/branch/control.php b/module/branch/control.php index 4e7585fd14..2ddbaa09b3 100644 --- a/module/branch/control.php +++ b/module/branch/control.php @@ -43,6 +43,7 @@ class branch extends control $this->view->browseType = $browseType; $this->view->orderBy = $orderBy; $this->view->pager = $pager; + $this->view->product = $this->loadModel('product')->getById($productID); $this->display(); } diff --git a/module/branch/lang/zh-cn.php b/module/branch/lang/zh-cn.php index c602d25d93..c2aee5e04e 100644 --- a/module/branch/lang/zh-cn.php +++ b/module/branch/lang/zh-cn.php @@ -15,7 +15,7 @@ $lang->branch->activate = '激活'; $lang->branch->activateAction = '激活分支'; $lang->branch->close = '关闭'; $lang->branch->closeAction = '关闭分支'; -$lang->branch->create = '新增分支'; +$lang->branch->create = '新增%s'; $lang->branch->merge = '合并'; $lang->branch->batchEdit = '批量编辑'; $lang->branch->defaultBranch = '默认分支'; @@ -24,11 +24,11 @@ $lang->branch->setDefaultAction = '设置默认分支'; $lang->branch->id = 'ID'; $lang->branch->product = '所属产品'; -$lang->branch->name = '分支名称'; +$lang->branch->name = '%s名称'; $lang->branch->status = '状态'; $lang->branch->createdDate = '创建时间'; $lang->branch->closedDate = '关闭时间'; -$lang->branch->desc = '分支描述'; +$lang->branch->desc = '%s描述'; $lang->branch->order = '排序'; $lang->branch->deleted = '已删除'; $lang->branch->closed = '已关闭'; @@ -43,7 +43,7 @@ $lang->branch->confirmActivate = '是否激活该@branch@?'; $lang->branch->existName = '@branch@名称已存在'; $lang->branch->noData = '暂时没有分支。'; -$lang->branch->mainBranch = '产品默认主干分支。'; +$lang->branch->mainBranch = '产品默认主干%s。'; $lang->branch->statusList = array(); $lang->branch->statusList['active'] = '激活'; diff --git a/module/branch/model.php b/module/branch/model.php index c365bb7f00..241cc824b0 100644 --- a/module/branch/model.php +++ b/module/branch/model.php @@ -55,6 +55,7 @@ class branchModel extends model ->page($pager) ->fetchAll('id'); + $product = $this->loadModel('product')->getById($productID); if($browseType == 'closed') return $branchList; $defaultBranch = BRANCH_MAIN; @@ -69,7 +70,7 @@ class branchModel extends model $mainBranch->status = 'active'; $mainBranch->createdDate = ''; $mainBranch->closedDate = ''; - $mainBranch->desc = $this->lang->branch->mainBranch; + $mainBranch->desc = sprintf($this->lang->branch->mainBranch, $this->lang->product->branchName[$product->type]); $mainBranch->order = 0; return array($mainBranch) + $branchList; diff --git a/module/branch/view/manage.html.php b/module/branch/view/manage.html.php index 3d9f729d15..5871b4fc07 100644 --- a/module/branch/view/manage.html.php +++ b/module/branch/view/manage.html.php @@ -29,7 +29,7 @@
- " . $lang->branch->create, '', "class='btn btn-primary iframe'", true, true);?> + " . sprintf($lang->branch->create, $lang->product->branchName[$product->type]), '', "class='btn btn-primary iframe'", true, true);?>
@@ -54,11 +54,11 @@ branch->order;?> - branch->name);?> + branch->name, $lang->product->branchName[$product->type]));?> branch->status);?> branch->createdDate);?> branch->closedDate);?> - branch->desc;?> + branch->desc, $lang->product->branchName[$product->type]);?> actions;?> From c2d3d4a24b19a9ec1b6f7e22bece2d3dc961cc00 Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Mon, 15 Nov 2021 09:42:16 +0800 Subject: [PATCH 03/18] * Product->Setting Language item modification. --- module/branch/control.php | 2 +- module/branch/lang/en.php | 4 ++-- module/branch/model.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/module/branch/control.php b/module/branch/control.php index 2ddbaa09b3..043a561fb5 100644 --- a/module/branch/control.php +++ b/module/branch/control.php @@ -43,7 +43,7 @@ class branch extends control $this->view->browseType = $browseType; $this->view->orderBy = $orderBy; $this->view->pager = $pager; - $this->view->product = $this->loadModel('product')->getById($productID); + $this->view->product = $this->product->getById($productID); $this->display(); } diff --git a/module/branch/lang/en.php b/module/branch/lang/en.php index 44eb3d7137..1855f28ff7 100644 --- a/module/branch/lang/en.php +++ b/module/branch/lang/en.php @@ -15,7 +15,7 @@ $lang->branch->activate = 'Activate'; $lang->branch->activateAction = 'Activate Branch'; $lang->branch->close = 'Close'; $lang->branch->closeAction = 'Close Branch'; -$lang->branch->create = 'Create Branch'; +$lang->branch->create = 'Create %s'; $lang->branch->merge = 'Merge'; $lang->branch->batchEdit = 'Batch Edit'; $lang->branch->defaultBranch = 'Default Branch'; @@ -43,7 +43,7 @@ $lang->branch->confirmActivate = 'Do you want to activate this @branch@?'; $lang->branch->existName = '@branch@ name already exists.'; $lang->branch->noData = 'No branches.'; -$lang->branch->mainBranch = 'The default main branch of the product.'; +$lang->branch->mainBranch = 'The default main %s of the product.'; $lang->branch->statusList = array(); $lang->branch->statusList['active'] = 'Active'; diff --git a/module/branch/model.php b/module/branch/model.php index 241cc824b0..e2833f45cb 100644 --- a/module/branch/model.php +++ b/module/branch/model.php @@ -55,9 +55,9 @@ class branchModel extends model ->page($pager) ->fetchAll('id'); - $product = $this->loadModel('product')->getById($productID); if($browseType == 'closed') return $branchList; + $product = $this->loadModel('product')->getById($productID); $defaultBranch = BRANCH_MAIN; foreach($branchList as $branch) $defaultBranch = $branch->default ? $branch->id : $defaultBranch; From b5ab5a03d796dd34f642fe00d3c00c6c5c11c576 Mon Sep 17 00:00:00 2001 From: zhouxin Date: Mon, 15 Nov 2021 10:07:01 +0800 Subject: [PATCH 04/18] Finish task #43916. --- module/execution/model.php | 3 ++- module/product/model.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/module/execution/model.php b/module/execution/model.php index d6d061b6dc..7d8f0cdbbd 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -643,6 +643,7 @@ class executionModel extends model { $oldExecution = $oldExecutions[$executionID]; $team = $this->loadModel('user')->getTeamMemberPairs($executionID, 'execution'); + $projectID = isset($execution->project) ? $execution->project : $oldExecution->project; $this->dao->update(TABLE_EXECUTION)->data($execution) ->autoCheck($skipFields = 'begin,end') @@ -650,7 +651,7 @@ class executionModel extends model ->checkIF($execution->begin != '', 'begin', 'date') ->checkIF($execution->end != '', 'end', 'date') ->checkIF($execution->end != '', 'end', 'gt', $execution->begin) - ->checkIF(!empty($execution->name), 'name', 'unique', "id != $executionID and type in ('sprint','stage') and `project` = $oldExecution->project") + ->checkIF(!empty($execution->name), 'name', 'unique', "id != $executionID and type in ('sprint','stage') and `project` = $projectID") ->checkIF(!empty($execution->code), 'code', 'unique', "id != $executionID and type in ('sprint','stage')") ->where('id')->eq($executionID) ->limit(1) diff --git a/module/product/model.php b/module/product/model.php index 70ba07f817..e41f59dd63 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -687,7 +687,7 @@ class productModel extends model ->data($product) ->autoCheck() ->batchCheck($this->config->product->edit->requiredFields , 'notempty') - ->checkIF(!empty($product->name), 'name', 'unique', "id != $productID and `program` = $oldProduct->program") + ->checkIF(!empty($product->name), 'name', 'unique', "id != $productID and `program` = $product->program") ->where('id')->eq($productID) ->exec(); if(dao::isError()) die(js::error('product#' . $productID . dao::getError(true))); From ccb98adb415b9fe5b21fc9d1cdbca36a4f94f3b7 Mon Sep 17 00:00:00 2001 From: zhouxin Date: Mon, 15 Nov 2021 10:44:29 +0800 Subject: [PATCH 05/18] Fix bug #16209. --- module/product/control.php | 12 ++++++++++-- module/story/css/batchedit.css | 4 +++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/module/product/control.php b/module/product/control.php index 9d409d26cd..bc1a794a16 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -216,7 +216,7 @@ class product extends control $this->app->loadLang('datatable'); $this->lang->datatable->showBranch = sprintf($this->lang->datatable->showBranch, $this->lang->product->branchName[$product->type]); } - + /* Get stories. */ if($this->app->rawModule == 'projectstory') { @@ -992,16 +992,24 @@ class product extends control } $field = $fieldID ? "plans[$fieldID]" : 'plan'; - $output = html::select($field, $plans, $planID, "class='form-control chosen'"); + $output = "
"; + $output .= "
"; + $output .= html::select($field, $plans, $planID, "class='form-control chosen'"); + $output .= "
"; if(count($plans) == 1 and $needCreate) { + $output .= "
"; $output .= "
"; $output .= html::a($this->createLink('productplan', 'create', "productID=$productID&branch=$branch", '', true), "", '', "class='btn btn-icon' data-toggle='modal' data-type='iframe' data-width='95%' title='{$this->lang->productplan->create}'"); $output .= '
'; + $output .= '
'; + $output .= "
"; $output .= "
"; $output .= html::a("javascript:void(0)", "", '', "class='btn btn-icon refresh' data-toggle='tooltip' title='{$this->lang->refresh}' onclick='loadProductPlans($productID)'"); $output .= '
'; + $output .= '
'; } + $output .= "
"; die($output); } diff --git a/module/story/css/batchedit.css b/module/story/css/batchedit.css index fc90ab0786..9ffd2dddb8 100644 --- a/module/story/css/batchedit.css +++ b/module/story/css/batchedit.css @@ -2,9 +2,11 @@ .c-id {width: 40px;} .c-estimate {width: 50px;} .c-branch, .c-module {width: 120px;} -.c-plan, .c-title {width: 150px;} +.c-title {width: 150px;} +.c-plan {width: 170px;} .c-category {width: 90px;} .c-pri {width: 70px;} .c-source {width: 130px;} .c-note, .c-stage, .c-reason {width: 100px;} .c-keywords {width: 80px;} +#batchEditForm > div > table > tbody > tr > td:nth-child(4) > div > div:nth-child(1) {width: 60%;} From 7cebe10e8d4055c6774b8b2dccafdab3955cc4ea Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Mon, 15 Nov 2021 10:55:24 +0800 Subject: [PATCH 06/18] * Product->Setting Language item modification. --- module/branch/view/batchedit.html.php | 6 +++--- module/branch/view/create.html.php | 6 +++--- module/branch/view/edit.html.php | 4 ++-- module/branch/view/manage.html.php | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/module/branch/view/batchedit.html.php b/module/branch/view/batchedit.html.php index c1164f13e4..805cc4619e 100644 --- a/module/branch/view/batchedit.html.php +++ b/module/branch/view/batchedit.html.php @@ -21,8 +21,8 @@ branch->id;?> - branch->name;?> - branch->desc;?> + branch->name, $lang->product->branchName[$product->type]);?> + branch->desc, $lang->product->branchName[$product->type]);?> branch->status;?> branch->defaultBranch;?> @@ -31,7 +31,7 @@ id == BRANCH_MAIN ? 'disabled' : '';?> - id == BRANCH_MAIN ? '' : $branch->id) . html::hidden("IDList[$branch->id]", $branch);?> + id == BRANCH_MAIN ? '' : $branch->id) . html::hidden("IDList[$branch->id]", $branch->id);?> id]", $branch->name, "class='form-control chosen' $disabled");?> id]", $branch->desc, "class='form-control' $disabled");?> id]", $lang->branch->statusList, $branch->status, "class='form-control' chosen $disabled onchange='canSetDefaultBranch(this)'");?> diff --git a/module/branch/view/create.html.php b/module/branch/view/create.html.php index db3a449ecc..899dc015ac 100644 --- a/module/branch/view/create.html.php +++ b/module/branch/view/create.html.php @@ -13,16 +13,16 @@
-

branch->create;?>

+

branch->create, $lang->product->branchName[$product->type]);?>

- + - + diff --git a/module/branch/view/edit.html.php b/module/branch/view/edit.html.php index ce23a1d75d..1ac717b388 100644 --- a/module/branch/view/edit.html.php +++ b/module/branch/view/edit.html.php @@ -18,7 +18,7 @@
branch->name;?>branch->name, $lang->product->branchName[$product->type]);?>
branch->desc;?>branch->desc, $lang->product->branchName[$product->type]);?>
- + @@ -26,7 +26,7 @@ - + diff --git a/module/branch/view/manage.html.php b/module/branch/view/manage.html.php index 5871b4fc07..4f90fae36a 100644 --- a/module/branch/view/manage.html.php +++ b/module/branch/view/manage.html.php @@ -37,7 +37,7 @@

branch->noData;?> - createLink('branch', 'create', "productID=$productID", '', true), " " . $lang->branch->create, '', "class='btn btn-info iframe'");?> + createLink('branch', 'create', "productID=$productID", '', true), " " . sprintf($lang->branch->create, $lang->product->branchName[$product->type]), '', "class='btn btn-info iframe'");?>

@@ -99,7 +99,7 @@
branch->name;?>branch->name, $lang->product->branchName[$product->type]);?> name, "class='form-control'");?>
branch->statusList, $branch->status, "class='form-control chosen'");?>
branch->desc;?>branch->desc, $lang->product->branchName[$product->type]);?> desc, "class='form-control'");?>
id", $branch, 'list', '', '', "$disabled iframe", true); + common::printIcon('branch', 'edit', "branchID=$branch->id&productID=$productID", $branch, 'list', '', '', "$disabled iframe", true); if($branch->status == 'active') { common::printIcon('branch', 'close', "branchID=$branch->id", $branch, 'list', 'off', 'hiddenwin', $disabled); From de30e9216d53a10ad8f07ef6abc7abcf90880bb7 Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Mon, 15 Nov 2021 11:03:54 +0800 Subject: [PATCH 07/18] * Product->Setting Language item modification. --- module/branch/control.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/module/branch/control.php b/module/branch/control.php index 043a561fb5..a83e5d950b 100644 --- a/module/branch/control.php +++ b/module/branch/control.php @@ -66,6 +66,7 @@ class branch extends control die(js::reload('parent.parent')); } + $this->view->product = $this->loadModel('product')->getById($productID); $this->display(); } @@ -76,7 +77,7 @@ class branch extends control * @access public * @return void */ - public function edit($branchID) + public function edit($branchID, $productID) { if($_POST) { @@ -87,7 +88,8 @@ class branch extends control die(js::reload('parent.parent')); } - $this->view->branch = $this->branch->getById($branchID, 0, ''); + $this->view->product = $this->loadModel('product')->getById($productID); + $this->view->branch = $this->branch->getById($branchID, 0, ''); $this->display(); } @@ -124,6 +126,7 @@ class branch extends control if(!in_array($branch->id, $branchIDList)) unset($branchList[$branch->id]); } + $this->view->product = $this->product->getById($productID); $this->view->branchList = $branchList; $this->display(); } From 55e0e9591be790f8c9193289d01043264f7bfced Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Mon, 15 Nov 2021 13:07:07 +0800 Subject: [PATCH 08/18] * Process branch and module when upgrade. --- module/upgrade/model.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 8953460de6..6e0f6ae652 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -732,6 +732,7 @@ class upgradeModel extends model case '15_7_1': $this->saveLogs('Execute 15_7_1'); $this->execSQL($this->getUpgradeFile('15.7.1')); + $this->updateObjectBranch(); $this->updateProjectStories(); $this->appendExec('15_7_1'); } @@ -5332,6 +5333,28 @@ class upgradeModel extends model return true; } + /** + * Update branch when object have module. + * + * @access public + * @return void + */ + public function updateObjectBranch() + { + $moduleBranchPairs = $this->dao->select('id,branch')->from(TABLE_MODULE)->fetchPairs(); + + $storyModulePairs = $this->dao->select('module')->from(TABLE_STORY)->where('module')->ne(0)->fetchPairs(); + foreach($storyModulePairs as $moduleID) $this->dao->update(TABLE_STORY)->set('`branch`')->eq($moduleBranchPairs[$moduleID])->where('module')->eq($moduleID)->exec(); + + $bugModulePairs = $this->dao->select('module')->from(TABLE_BUG)->where('module')->ne(0)->fetchPairs(); + foreach($bugModulePairs as $moduleID) $this->dao->update(TABLE_BUG)->set('`branch`')->eq($moduleBranchPairs[$moduleID])->where('module')->eq($moduleID)->exec(); + + $caseModulePairs = $this->dao->select('module')->from(TABLE_CASE)->where('module')->ne(0)->fetchPairs(); + foreach($caseModulePairs as $moduleID) $this->dao->update(TABLE_CASE)->set('`branch`')->eq($moduleBranchPairs[$moduleID])->where('module')->eq($moduleID)->exec(); + + return true; + } + /** * Update branch of project linked stories. * From f6884fd700b5c75baacb26740cb2a23da04b6a55 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Mon, 15 Nov 2021 13:09:42 +0800 Subject: [PATCH 09/18] * Modify comment. --- module/upgrade/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 6e0f6ae652..045570de02 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -5337,7 +5337,7 @@ class upgradeModel extends model * Update branch when object have module. * * @access public - * @return void + * @return bool */ public function updateObjectBranch() { From 73b5f5e057c51ab2f097aa661a46640dfece4d43 Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Mon, 15 Nov 2021 13:44:26 +0800 Subject: [PATCH 10/18] * Product-Settings-Branch/platform-Language item --- module/branch/lang/en.php | 2 +- module/branch/lang/zh-cn.php | 2 +- module/branch/view/edit.html.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/module/branch/lang/en.php b/module/branch/lang/en.php index 1855f28ff7..81588bcc14 100644 --- a/module/branch/lang/en.php +++ b/module/branch/lang/en.php @@ -10,7 +10,7 @@ $lang->branch->all = 'All '; $lang->branch->main = 'Main'; $lang->branch->edit = 'Edit'; -$lang->branch->editAction = 'Edit Branch'; +$lang->branch->editAction = 'Edit %s'; $lang->branch->activate = 'Activate'; $lang->branch->activateAction = 'Activate Branch'; $lang->branch->close = 'Close'; diff --git a/module/branch/lang/zh-cn.php b/module/branch/lang/zh-cn.php index c2aee5e04e..3e8846ae00 100644 --- a/module/branch/lang/zh-cn.php +++ b/module/branch/lang/zh-cn.php @@ -10,7 +10,7 @@ $lang->branch->all = '所有'; $lang->branch->main = '主干'; $lang->branch->edit = '编辑'; -$lang->branch->editAction = '编辑分支'; +$lang->branch->editAction = '编辑%s'; $lang->branch->activate = '激活'; $lang->branch->activateAction = '激活分支'; $lang->branch->close = '关闭'; diff --git a/module/branch/view/edit.html.php b/module/branch/view/edit.html.php index 1ac717b388..8bcb450e4e 100644 --- a/module/branch/view/edit.html.php +++ b/module/branch/view/edit.html.php @@ -13,7 +13,7 @@
-

branch->editAction;?>

+

branch->editAction, $lang->product->branchName[$product->type]);?>

From f849667ce3de7b73a35b58398eca4371a8bb006d Mon Sep 17 00:00:00 2001 From: tianshujie Date: Mon, 15 Nov 2021 14:36:48 +0800 Subject: [PATCH 11/18] * Fix bug #16296. --- module/tree/model.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/module/tree/model.php b/module/tree/model.php index cdfa10f47e..65f2921a90 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -372,10 +372,11 @@ class treeModel extends model { if($type == 'line') $rootID = 0; + $this->loadModel('branch'); $branches = array($branch => ''); if($branch) { - $branchName = $this->loadModel('branch')->getById($branch); + $branchName = $this->branch->getById($branch); $branches = array($branch => $branchName); $extra = array('rootID' => $rootID, 'branch' => $branch); } @@ -386,6 +387,22 @@ class treeModel extends model { if($product->type != 'normal') $branches = array(BRANCH_MAIN => $this->lang->branch->main) + $this->loadModel('branch')->getPairs($rootID, 'noempty'); } + elseif($type == 'story' and $this->app->rawModule == 'projectstory') + { + $projectID = zget($extra, 'projectID', 0); + if($product->type != 'normal' and $projectID) + { + $projectBranches = $this->dao->select('branch')->from(TABLE_PROJECTPRODUCT) + ->where('project')->eq($projectID) + ->andWhere('product')->eq($product->id) + ->fetchPairs(); + + if(isset($projectBranches[BRANCH_MAIN])) $branches = array(BRANCH_MAIN => $this->lang->branch->main); + $branches += $this->dao->select('id, name')->from(TABLE_BRANCH) + ->where('id')->in($projectBranches) + ->fetchPairs(); + } + } /* Add for task #1945. check the module has case or no. */ if($type == 'case' and !empty($extra)) $this->loadModel('testtask'); From f77166bfb3644de7cf51213035fe27aa942d27ac Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Mon, 15 Nov 2021 14:47:13 +0800 Subject: [PATCH 12/18] * Fix bug #16297 --- module/story/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/story/model.php b/module/story/model.php index 9539d9b3be..1d88eeb29b 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -4028,7 +4028,7 @@ class storyModel extends model } else { - $stories = $this->getProductStories($productID, 0, 0, 'all', 'story', 'id_desc', true, $excludeStories, $pager); + $stories = $this->getProductStories($productID, $branch, 0, 'all', 'story', 'id_desc', true, $excludeStories, $pager); } } From 4bc73b9223cf54984a9f8e315c68cb6d96d12095 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Mon, 15 Nov 2021 15:49:00 +0800 Subject: [PATCH 13/18] * Fix bug 16304. --- module/story/model.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/module/story/model.php b/module/story/model.php index 9539d9b3be..b0edb494b5 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -2461,10 +2461,6 @@ class storyModel extends model $storyQuery .= " AND `status` NOT IN ('draft', 'closed')"; } } - elseif($branch) - { - if($branch and strpos($storyQuery, '`branch` =') === false) $storyQuery .= " AND `branch` = $branch"; - } elseif(strpos($storyQuery, $allBranch) !== false) { $storyQuery = str_replace($allBranch, '1', $storyQuery); From b175a5057b9ac84ea6c8555743c50b8502f26cdd Mon Sep 17 00:00:00 2001 From: tianshujie Date: Mon, 15 Nov 2021 16:13:51 +0800 Subject: [PATCH 14/18] * Fix bug #16293. --- module/bug/control.php | 2 +- module/product/model.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index 3052e26bef..a48fc1ec09 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -325,7 +325,7 @@ class bug extends control } else { - $this->qa->setMenu($this->products, $productID); + $this->qa->setMenu($this->products, $productID, $branch); } foreach($output as $paramKey => $paramValue) diff --git a/module/product/model.php b/module/product/model.php index 4808a02dab..90516863c0 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -477,7 +477,8 @@ class productModel extends model if(strpos($storyMethods, "," . $currentMethod . ",") === false) $currentModule = 'product'; if($currentMethod == 'view' or $currentMethod == 'change' or $currentMethod == 'review') $currentMethod = 'browse'; } - if($currentModule == 'testcase' and $currentMethod == 'view') $currentMethod = 'browse'; + if($currentModule == 'testcase' and strpos(',view,edit,', ",$currentMethod,") !== false) $currentMethod = 'browse'; + if($currentModule == 'bug' and $currentMethod == 'edit') $currentMethod = 'browse'; if($currentMethod == 'report') $currentMethod = 'browse'; $currentProductName = $this->lang->product->common; From 432ffc6602ca51329a34475520b4465629d7214f Mon Sep 17 00:00:00 2001 From: tianshujie Date: Mon, 15 Nov 2021 16:27:30 +0800 Subject: [PATCH 15/18] * Fix bug #16303. --- module/product/css/browse.css | 1 + 1 file changed, 1 insertion(+) diff --git a/module/product/css/browse.css b/module/product/css/browse.css index 6575d2d175..ab03bd0165 100644 --- a/module/product/css/browse.css +++ b/module/product/css/browse.css @@ -35,3 +35,4 @@ a.removeModule:hover {color: red;} #batchUnlinkStoryTip .table tfoot {position: relative; bottom: -30px;} #batchUnlinkStoryTip .table td {border-bottom: 0px;} #batchUnlinkStoryTip .table th:first-child {width: 460px;} +#mainMenu .dropdown-menu>li>a>.icon {top: 4px;} From bdb5d1ee01ed5d6d454dacf3ee07663fd41ca756 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Mon, 15 Nov 2021 16:51:12 +0800 Subject: [PATCH 16/18] * Fix bug#16297. --- module/story/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/story/model.php b/module/story/model.php index a6308290cd..5d51043f70 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -4013,7 +4013,7 @@ class storyModel extends model } else { - $stories = $this->getProductStories($productID, 0, 0, 'all', 'story', 'id_desc', true, $excludeStories); + $stories = $this->getProductStories($productID, $branch, 0, 'all', 'story', 'id_desc', true, $excludeStories); } } else From dd5cf8c7bd6cd4a78b3dbe6fed24ba5625a73c0c Mon Sep 17 00:00:00 2001 From: zhouxin Date: Mon, 15 Nov 2021 19:15:20 +0800 Subject: [PATCH 17/18] Fix bug #43916. --- module/product/model.php | 4 +++- module/project/model.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/module/product/model.php b/module/product/model.php index e41f59dd63..31e6ec233c 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -657,6 +657,7 @@ class productModel extends model $products = array(); $allChanges = array(); $data = fixer::input('post')->get(); + a($data); $oldProducts = $this->getByIdList($this->post->productIDList); $nameList = array(); @@ -682,12 +683,13 @@ class productModel extends model foreach($products as $productID => $product) { $oldProduct = $oldProducts[$productID]; + $programID = !isset($product->program) ? $oldProduct->program : (empty($product->program) ? 0 : $product->program); $this->dao->update(TABLE_PRODUCT) ->data($product) ->autoCheck() ->batchCheck($this->config->product->edit->requiredFields , 'notempty') - ->checkIF(!empty($product->name), 'name', 'unique', "id != $productID and `program` = $product->program") + ->checkIF(!empty($product->name), 'name', 'unique', "id != $productID and `program` = $programID") ->where('id')->eq($productID) ->exec(); if(dao::isError()) die(js::error('product#' . $productID . dao::getError(true))); diff --git a/module/project/model.php b/module/project/model.php index e46937ae4a..5a4b73a0de 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -1115,13 +1115,15 @@ class projectModel extends model foreach($projects as $projectID => $project) { $oldProject = $oldProjects[$projectID]; + $parentID = !isset($project->parent) ? $oldProject->parent : $project->parent; + $this->dao->update(TABLE_PROJECT)->data($project) ->autoCheck($skipFields = 'begin,end') ->batchCheck($this->config->project->edit->requiredFields , 'notempty') ->checkIF($project->begin != '', 'begin', 'date') ->checkIF($project->end != '', 'end', 'date') ->checkIF($project->end != '', 'end', 'gt', $project->begin) - ->checkIF(!empty($project->name), 'name', 'unique', "id != $projectID and `type`='project' and `parent` = $project->parent") + ->checkIF(!empty($project->name), 'name', 'unique', "id != $projectID and `type`='project' and `parent` = $parentID") ->checkIF(!empty($project->code), 'code', 'unique', "id != $projectID and `type`='project'") ->where('id')->eq($projectID) ->exec(); From b521b7f6d0168ddfccc51032d4b6052e8265039a Mon Sep 17 00:00:00 2001 From: zhouxin Date: Tue, 16 Nov 2021 11:19:02 +0800 Subject: [PATCH 18/18] Fix bug. --- module/product/model.php | 1 - 1 file changed, 1 deletion(-) diff --git a/module/product/model.php b/module/product/model.php index 31e6ec233c..d557cfb14a 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -657,7 +657,6 @@ class productModel extends model $products = array(); $allChanges = array(); $data = fixer::input('post')->get(); - a($data); $oldProducts = $this->getByIdList($this->post->productIDList); $nameList = array();