From 5057abf5d8f020274ebc49ab9620c85996c99f83 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 14 Dec 2017 11:16:03 +0800 Subject: [PATCH 1/6] * finish task #3427. --- module/project/model.php | 10 ++++++---- module/project/view/story.html.php | 16 +++++++++++++++- module/story/control.php | 5 ++++- module/story/model.php | 6 ++---- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/module/project/model.php b/module/project/model.php index 74d6d665a0..23fa69b0c2 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -1423,13 +1423,15 @@ class projectModel extends model * @access public * @return void */ - public function linkStory($projectID) + public function linkStory($projectID, $stories = array()) { - if($this->post->stories == false) return false; + if(empty($stories)) $stories = $this->post->stories; + if(empty($stories)) return false; + $this->loadModel('action'); - $versions = $this->loadModel('story')->getVersions($this->post->stories); + $versions = $this->loadModel('story')->getVersions($stories); $lastOrder = (int)$this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('project')->eq($projectID)->orderBy('order_desc')->limit(1)->fetch('order'); - foreach($this->post->stories as $key => $storyID) + foreach($stories as $key => $storyID) { $productID = (int)$this->post->products[$storyID]; $data = new stdclass(); diff --git a/module/project/view/story.html.php b/module/project/view/story.html.php index 7b67a0d011..6a218c1d7c 100644 --- a/module/project/view/story.html.php +++ b/module/project/view/story.html.php @@ -27,7 +27,21 @@ common::printIcon('story', 'export', "productID=$productID&orderBy=id_desc", '', 'button', '', '', 'export'); $this->lang->story->create = $this->lang->project->createStory; - if($productID and !$this->loadModel('story')->checkForceReview()) common::printIcon('story', 'create', "productID=$productID&branch=&moduleID=0&story=0&project=$project->id"); + if($productID and !$this->loadModel('story')->checkForceReview()) + { + echo "
"; + common::printIcon('story', 'create', "productID=$productID&branch=0&moduleID=0&story=0&project=$project->id"); + + $misc = common::hasPriv('story', 'batchCreate') ? '' : "disabled"; + $link = common::hasPriv('story', 'batchCreate') ? $this->createLink('story', 'batchCreate', "productID=$productID&branch=0&moduleID=0&story=0&project=$project->id") : '#'; + echo "'; + echo "'; + echo '
'; + } if(commonModel::isTutorialMode()) { diff --git a/module/story/control.php b/module/story/control.php index 7b699d8107..1d6ddbfa68 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -200,17 +200,20 @@ class story extends control * @access public * @return void */ - public function batchCreate($productID = 0, $branch = 0, $moduleID = 0, $storyID = 0) + public function batchCreate($productID = 0, $branch = 0, $moduleID = 0, $storyID = 0, $project = 0) { if(!empty($_POST)) { $mails = $this->story->batchCreate($productID, $branch); if(dao::isError()) die(js::error(dao::getError())); + $stories = array(); foreach($mails as $mail) { + $stories[] = $mail->storyID; if($mail->actionID) $this->story->sendmail($mail->storyID, $mail->actionID); } + if($project) $this->loadModel('project')->linkStory($project, $stories); /* If storyID not equal zero, subdivide this story to child stories and close it. */ if($storyID) diff --git a/module/story/model.php b/module/story/model.php index ad0c5d1cec..d529a6db62 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -261,10 +261,6 @@ class storyModel extends model for($i = 0; $i < $batchNum; $i++) { - if(!empty($stories->title[$i]) && empty($stories->modules[$i])) - { - die(js::alert(sprintf($this->lang->error->notempty, $this->lang->story->module))); - } $module = $stories->module[$i] == 'ditto' ? $module : $stories->module[$i]; $plan = $stories->plan[$i] == 'ditto' ? $plan : $stories->plan[$i]; $pri = $stories->pri[$i] == 'ditto' ? $pri : $stories->pri[$i]; @@ -273,6 +269,8 @@ class storyModel extends model $stories->plan[$i] = $plan; $stories->pri[$i] = (int)$pri; $stories->source[$i] = $source; + + if(!empty($stories->title[$i]) && empty($stories->module[$i])) die(js::alert(sprintf($this->lang->error->notempty, $this->lang->story->module))); } if(isset($stories->uploadImage)) $this->loadModel('file'); From 0f13899945a343741f2e4ded36454ed8737503f4 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 14 Dec 2017 11:37:48 +0800 Subject: [PATCH 2/6] * code for task #3427. --- module/productplan/view/view.html.php | 10 ++++++++++ module/story/control.php | 4 ++-- module/story/view/batchcreate.html.php | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/module/productplan/view/view.html.php b/module/productplan/view/view.html.php index 2716b39533..14ba946701 100644 --- a/module/productplan/view/view.html.php +++ b/module/productplan/view/view.html.php @@ -30,7 +30,17 @@ { ob_start(); echo "
"; + echo "
"; common::printIcon('story', 'create', "productID=$plan->product&branch=$plan->branch&moduleID=0&storyID=0&projectID=0&bugID=0&planID=$plan->id", $plan, 'button', 'plus'); + $misc = common::hasPriv('story', 'batchCreate') ? '' : "disabled"; + $link = common::hasPriv('story', 'batchCreate') ? $this->createLink('story', 'batchCreate', "productID=$plan->product&branch=$plan->branch&moduleID=0&story=0&project=0&plan={$plan->id}") : '#'; + echo "'; + echo "'; + echo '
'; if(common::hasPriv('productplan', 'linkStory')) echo html::a(inlink('view', "planID=$plan->id&type=story&orderBy=id_desc&link=true"), ' ' . $lang->productplan->linkStory, '', "class='btn'"); if(common::hasPriv('productplan', 'linkBug') and $config->global->flow != 'onlyStory') echo html::a(inlink('view', "planID=$plan->id&type=bug&orderBy=id_desc&link=true"), ' ' . $lang->productplan->linkBug, '', "class='btn'"); echo '
'; diff --git a/module/story/control.php b/module/story/control.php index 1d6ddbfa68..282fa03761 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -200,7 +200,7 @@ class story extends control * @access public * @return void */ - public function batchCreate($productID = 0, $branch = 0, $moduleID = 0, $storyID = 0, $project = 0) + public function batchCreate($productID = 0, $branch = 0, $moduleID = 0, $storyID = 0, $project = 0, $plan = 0) { if(!empty($_POST)) { @@ -240,7 +240,7 @@ class story extends control $this->product->setMenu($products, $product->id, $branch); /* Init vars. */ - $planID = 0; + $planID = $plan; $pri = 0; $estimate = ''; $title = ''; diff --git a/module/story/view/batchcreate.html.php b/module/story/view/batchcreate.html.php index 20df69c929..186532129f 100644 --- a/module/story/view/batchcreate.html.php +++ b/module/story/view/batchcreate.html.php @@ -56,7 +56,7 @@ if($this->story->checkForceReview()) unset($visibleFields['review']); $fileName):?> - + @@ -88,7 +88,7 @@ if($this->story->checkForceReview()) unset($visibleFields['review']); story->batchCreate; $i++):?> - + From a069ceb65496df52e0ed8797912128076a61b850 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 14 Dec 2017 13:49:43 +0800 Subject: [PATCH 3/6] * change for task #3435. --- module/product/lang/zh-cn.php | 2 +- module/project/lang/zh-cn.php | 4 ++-- module/story/control.php | 3 +++ module/tutorial/lang/zh-cn.php | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/module/product/lang/zh-cn.php b/module/product/lang/zh-cn.php index 236ad7622f..0871c3fb3b 100644 --- a/module/product/lang/zh-cn.php +++ b/module/product/lang/zh-cn.php @@ -16,7 +16,7 @@ $lang->product->dynamic = "动态"; $lang->product->view = "{$lang->productCommon}概况"; $lang->product->edit = "编辑{$lang->productCommon}"; $lang->product->batchEdit = "批量编辑"; -$lang->product->create = "新增{$lang->productCommon}"; +$lang->product->create = "添加{$lang->productCommon}"; $lang->product->delete = "删除{$lang->productCommon}"; $lang->product->deleted = "已删除"; $lang->product->close = "关闭"; diff --git a/module/project/lang/zh-cn.php b/module/project/lang/zh-cn.php index b8eb08ef9f..d2322a676a 100644 --- a/module/project/lang/zh-cn.php +++ b/module/project/lang/zh-cn.php @@ -42,7 +42,7 @@ $lang->project->progress = '进度'; $lang->project->hours = '预计 %s 消耗 %s 剩余 %s'; $lang->project->viewBug = '查看bug'; $lang->project->noProduct = "无{$lang->productCommon}{$lang->projectCommon}"; -$lang->project->createStory = "新增需求"; +$lang->project->createStory = "添加需求"; $lang->project->all = '所有'; $lang->project->undone = '未完成'; $lang->project->unclosed = '未关闭'; @@ -214,7 +214,7 @@ $lang->project->tips = '提示'; $lang->project->afterInfo = "{$lang->projectCommon}添加成功,您现在可以进行以下操作:"; $lang->project->setTeam = '设置团队'; $lang->project->linkStory = '关联需求'; -$lang->project->createTask = '添加任务'; +$lang->project->createTask = '创建任务'; $lang->project->goback = "返回任务列表"; $lang->project->noweekend = '去除周末'; $lang->project->withweekend = '显示周末'; diff --git a/module/story/control.php b/module/story/control.php index 282fa03761..6defe6006a 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -195,8 +195,11 @@ class story extends control * Create a batch stories. * * @param int $productID + * @param int $branch * @param int $moduleID * @param int $storyID + * @param int $project + * @param int $plan * @access public * @return void */ diff --git a/module/tutorial/lang/zh-cn.php b/module/tutorial/lang/zh-cn.php index d001e2396b..5db19acc34 100644 --- a/module/tutorial/lang/zh-cn.php +++ b/module/tutorial/lang/zh-cn.php @@ -39,7 +39,7 @@ $lang->tutorial->tasks['createAccount']['nav'] = array('module' => 'user', 'met $lang->tutorial->tasks['createAccount']['desc'] = "

在系统创建一个新的用户帐号:

  • 打开 组织 用户 添加用户 页面;
  • 在添加用户表单中填写新用户信息;
  • 保存用户信息。
"; $lang->tutorial->tasks['createProduct'] = array('title' => '创建产品'); -$lang->tutorial->tasks['createProduct']['nav'] = array('module' => 'product', 'method' => 'create', 'menu' => 'create', 'form' => '#dataform', 'submit' => '#submit', 'targetPageName' => '新增产品'); +$lang->tutorial->tasks['createProduct']['nav'] = array('module' => 'product', 'method' => 'create', 'menu' => 'create', 'form' => '#dataform', 'submit' => '#submit', 'targetPageName' => '添加产品'); $lang->tutorial->tasks['createProduct']['desc'] = "

在系统创建一个新的产品:

  • 打开 产品 添加产品 页面;
  • 在表单中填写要创建的产品信息;
  • 保存产品信息。
"; $lang->tutorial->tasks['createStory'] = array('title' => '创建需求'); From fc70d4ffdb17e3016c898dd557ef1e347dc22b66 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 14 Dec 2017 14:06:47 +0800 Subject: [PATCH 4/6] * finish task #3491. --- module/bug/lang/en.php | 8 ++++---- module/bug/lang/zh-cn.php | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/module/bug/lang/en.php b/module/bug/lang/en.php index 2524661b50..8f983f6bb3 100644 --- a/module/bug/lang/en.php +++ b/module/bug/lang/en.php @@ -217,18 +217,18 @@ $lang->bug->browserList['other'] = 'Other'; $lang->bug->typeList[''] = ''; $lang->bug->typeList['codeerror'] = 'Code Error'; $lang->bug->typeList['interface'] = 'Interface Optimization'; -$lang->bug->typeList['designchange'] = 'Design Change'; -$lang->bug->typeList['newfeature'] = 'New Feature'; -$lang->bug->typeList['designdefect'] = 'Design Defect'; $lang->bug->typeList['config'] = 'Configuration'; $lang->bug->typeList['install'] = 'Install/Deploy'; $lang->bug->typeList['security'] = 'Security'; $lang->bug->typeList['performance'] = 'Performance'; $lang->bug->typeList['standard'] = 'Standard'; $lang->bug->typeList['automation'] = 'Testing Script'; -$lang->bug->typeList['trackthings'] = 'Issue Tracking'; $lang->bug->typeList['others'] = 'Other'; + + + + $lang->bug->statusList[''] = ''; $lang->bug->statusList['active'] = 'Active'; $lang->bug->statusList['resolved'] = 'Resolved'; diff --git a/module/bug/lang/zh-cn.php b/module/bug/lang/zh-cn.php index eb81221b4c..90b0fc7337 100644 --- a/module/bug/lang/zh-cn.php +++ b/module/bug/lang/zh-cn.php @@ -115,6 +115,7 @@ $lang->bug->byQuery = '搜索'; $lang->bug->needConfirm = '需求变动'; $lang->bug->allProduct = '所有' . $lang->productCommon; + $lang->bug->ditto = '同上'; $lang->bug->dittoNotice = '该bug与上一bug不属于同一产品!'; @@ -216,17 +217,17 @@ $lang->bug->browserList['other'] = '其他'; $lang->bug->typeList[''] = ''; $lang->bug->typeList['codeerror'] = '代码错误'; $lang->bug->typeList['interface'] = '界面优化'; -$lang->bug->typeList['designchange'] = '设计变更'; -$lang->bug->typeList['newfeature'] = '新增需求'; -$lang->bug->typeList['designdefect'] = '设计缺陷'; $lang->bug->typeList['config'] = '配置相关'; $lang->bug->typeList['install'] = '安装部署'; $lang->bug->typeList['security'] = '安全相关'; $lang->bug->typeList['performance'] = '性能问题'; $lang->bug->typeList['standard'] = '标准规范'; $lang->bug->typeList['automation'] = '测试脚本'; -$lang->bug->typeList['trackthings'] = '事务跟踪'; $lang->bug->typeList['others'] = '其他'; +$lang->bug->typeList['designchange'] = '设计变更'; +$lang->bug->typeList['newfeature'] = '新增需求'; +$lang->bug->typeList['designdefect'] = '设计缺陷'; +$lang->bug->typeList['trackthings'] = '事务跟踪'; $lang->bug->statusList[''] = ''; $lang->bug->statusList['active'] = '激活'; From 7770bab6afaa4788d76dd249e9ed2e41fa7191e5 Mon Sep 17 00:00:00 2001 From: dajiao007 Date: Thu, 14 Dec 2017 14:24:30 +0800 Subject: [PATCH 5/6] * fix the story of 3423 --- module/story/lang/en.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/story/lang/en.php b/module/story/lang/en.php index 8034df3b04..f572dabdef 100644 --- a/module/story/lang/en.php +++ b/module/story/lang/en.php @@ -73,7 +73,7 @@ $lang->story->lastEditedBy = 'Last Edited By'; $lang->story->lastEditedDate = 'Last Edited On'; $lang->story->closedBy = 'Closed By'; $lang->story->closedDate = 'Closed On'; -$lang->story->closedReason = 'Close Reason'; +$lang->story->closedReason = 'Reason'; $lang->story->rejectedReason = 'Reject Reason'; $lang->story->reviewedBy = 'Reviewer'; $lang->story->reviewedDate = 'Review on'; From 11d80a5d93d299ba21cd287d5f8f9862bb70ed8e Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 14 Dec 2017 15:29:09 +0800 Subject: [PATCH 6/6] * finish task #3442. --- module/action/control.php | 17 +++++++++++++++++ module/action/lang/en.php | 1 + module/action/lang/zh-cn.php | 1 + module/bug/view/view.html.php | 2 +- module/common/model.php | 2 +- module/doc/view/view.html.php | 2 +- module/group/lang/resource.php | 3 +++ module/story/model.php | 2 +- module/story/view/view.html.php | 2 +- module/task/view/view.html.php | 2 +- module/testcase/view/view.html.php | 2 +- module/upgrade/model.php | 20 ++++++++++++++++++++ 12 files changed, 49 insertions(+), 7 deletions(-) diff --git a/module/action/control.php b/module/action/control.php index 4bfd85b965..5916f33db9 100755 --- a/module/action/control.php +++ b/module/action/control.php @@ -104,6 +104,23 @@ class action extends control } } + /** + * Comment. + * + * @param string $objectType + * @param int $objectID + * @access public + * @return void + */ + public function comment($objectType, $objectID) + { + $actionID = $this->action->create($objectType, $objectID, 'Commented', $this->post->comment); + + $moduleName = $objectType == 'case' ? 'testcase' : $objectType; + $this->loadModel($moduleName)->sendmail($objectID, $actionID); + die(js::reload('parent')); + } + /** * Edit comment of a action. * diff --git a/module/action/lang/en.php b/module/action/lang/en.php index c82640c395..34e6c6c784 100755 --- a/module/action/lang/en.php +++ b/module/action/lang/en.php @@ -25,6 +25,7 @@ $lang->action->undelete = 'Restore'; $lang->action->hideOne = 'Hide'; $lang->action->hideAll = 'Hide All'; $lang->action->editComment = 'Edit'; +$lang->action->comment = 'Comment'; $lang->action->trashTips = 'Note: Delete in ZenTao is logic.'; $lang->action->textDiff = 'Text Format'; diff --git a/module/action/lang/zh-cn.php b/module/action/lang/zh-cn.php index b03587b84c..7021b27d0d 100755 --- a/module/action/lang/zh-cn.php +++ b/module/action/lang/zh-cn.php @@ -25,6 +25,7 @@ $lang->action->undelete = '还原'; $lang->action->hideOne = '隐藏'; $lang->action->hideAll = '全部隐藏'; $lang->action->editComment = '修改备注'; +$lang->action->comment = '备注'; $lang->action->trashTips = '提示:为了保证系统的完整性,禅道系统的删除都是标记删除。'; $lang->action->textDiff = '文本格式'; diff --git a/module/bug/view/view.html.php b/module/bug/view/view.html.php index 566e8e240b..1f26194dbf 100644 --- a/module/bug/view/view.html.php +++ b/module/bug/view/view.html.php @@ -89,7 +89,7 @@
deleted) echo $actionLinks;?>
comment;?> -
id&comment=true")?>'> + id")?>' target='hiddenwin'>
diff --git a/module/common/model.php b/module/common/model.php index abb20b1c12..6a1d892c9e 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -631,7 +631,7 @@ class commonModel extends model global $lang; - if(!commonModel::hasPriv($module, 'edit', $object)) return false; + if(!commonModel::hasPriv('action', 'comment', $object)) return false; echo html::a('#commentBox', '', '', "title='$lang->comment' onclick='setComment()' class='btn'"); } diff --git a/module/doc/view/view.html.php b/module/doc/view/view.html.php index 284c3dbecd..b584f29a10 100644 --- a/module/doc/view/view.html.php +++ b/module/doc/view/view.html.php @@ -126,7 +126,7 @@
comment;?> -
id&comment=true")?>'> + id")?>' target='hiddenwin'>
diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index b075352107..437461f233 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -1005,12 +1005,15 @@ $lang->resource->action->trash = 'trash'; $lang->resource->action->undelete = 'undelete'; $lang->resource->action->hideOne = 'hideOne'; $lang->resource->action->hideAll = 'hideAll'; +$lang->resource->action->comment = 'comment'; $lang->resource->action->editComment = 'editComment'; $lang->action->methodOrder[5] = 'trash'; $lang->action->methodOrder[10] = 'undelete'; $lang->action->methodOrder[15] = 'hideOne'; $lang->action->methodOrder[20] = 'hideAll'; +$lang->action->methodOrder[25] = 'comment'; +$lang->action->methodOrder[30] = 'editComment'; $lang->resource->backup = new stdclass(); $lang->resource->backup->index = 'index'; diff --git a/module/story/model.php b/module/story/model.php index d529a6db62..99373c4d66 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -479,7 +479,7 @@ class storyModel extends model ->join('mailto', ',') ->remove('linkStories,childStories,files,labels,comment') ->get(); - if(is_array($story->plan)) $story->plan = trim(join(',', $story->plan), ','); + if(isset($story->plan) and is_array($story->plan)) $story->plan = trim(join(',', $story->plan), ','); if(empty($_POST['product'])) $story->branch = $oldStory->branch; $this->dao->update(TABLE_STORY) diff --git a/module/story/view/view.html.php b/module/story/view/view.html.php index fb1993a93d..14efabf849 100644 --- a/module/story/view/view.html.php +++ b/module/story/view/view.html.php @@ -116,7 +116,7 @@
comment;?> -
id")?>'> + id")?>' target='hiddenwin'>
diff --git a/module/task/view/view.html.php b/module/task/view/view.html.php index 6513264aab..50b935fa13 100644 --- a/module/task/view/view.html.php +++ b/module/task/view/view.html.php @@ -156,7 +156,7 @@
deleted) echo $actionLinks;?>
comment;?> -
id&comment=true")?>'> + id")?>' target='hiddenwin'>
diff --git a/module/testcase/view/view.html.php b/module/testcase/view/view.html.php index 8dfc0b1984..a240f2f97d 100644 --- a/module/testcase/view/view.html.php +++ b/module/testcase/view/view.html.php @@ -119,7 +119,7 @@
comment;?> -
id&comment=true")?>'> + id")?>' target='hiddenwin'>
diff --git a/module/upgrade/model.php b/module/upgrade/model.php index a5094c9664..a41e3331c2 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -1918,4 +1918,24 @@ class upgradeModel extends model return true; } + + /** + * Adjust Priv for 9.7 + * + * @access public + * @return bool + */ + public function adjustPriv9_7() + { + $groups = $this->dao->select('*')->from(TABLE_GROUPPRIV)->where('method')->eq('edit')->andWhere('module')->in('story,task,bug,testcase')->fetchPairs('group', 'group'); + foreach($groups as $groupID) + { + $groupPriv = new stdclass(); + $groupPriv->group = $groupID; + $groupPriv->module = 'action'; + $groupPriv->method = 'comment'; + $this->dao->replace(TABLE_GROUPPRIV)->data($groupPriv)->exec(); + } + return true; + } }