* Fix bug

This commit is contained in:
滔哥
2017-12-14 16:53:59 +08:00
23 changed files with 105 additions and 33 deletions
+17
View File
@@ -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.
*
+1
View File
@@ -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';
+1
View File
@@ -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 = '文本格式';
+4 -4
View File
@@ -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';
+5 -4
View File
@@ -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'] = '激活';
+1 -1
View File
@@ -89,7 +89,7 @@
<div class='actions'><?php if(!$bug->deleted) echo $actionLinks;?></div>
<fieldset id='commentBox' class='hide'>
<legend><?php echo $lang->comment;?></legend>
<form method='post' action='<?php echo inlink('edit', "bugID=$bug->id&comment=true")?>'>
<form method='post' action='<?php echo $this->createLink('action', 'comment', "objectType=bug&objectID=$bug->id")?>' target='hiddenwin'>
<div class="form-group"><?php echo html::textarea('comment', '',"rows='5' class='w-p100'");?></div>
<?php echo html::submitButton() . html::backButton();?>
</form>
+1 -1
View File
@@ -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', '<i class="icon-comment-alt"></i>', '', "title='$lang->comment' onclick='setComment()' class='btn'");
}
+1 -1
View File
@@ -126,7 +126,7 @@
<?php include '../../common/view/action.html.php';?>
<fieldset id='commentBox' class='hide'>
<legend><?php echo $lang->comment;?></legend>
<form method='post' action='<?php echo inlink('edit', "docID=$doc->id&comment=true")?>'>
<form method='post' action='<?php echo $this->createLink('action', 'comment', "objectType=doc&objectID=$doc->id")?>' target='hiddenwin'>
<div class="form-group"><?php echo html::textarea('comment', '',"style='width:100%;height:100px'");?></div>
<?php echo html::submitButton() . html::backButton();?>
</form>
+3
View File
@@ -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';
+1 -1
View File
@@ -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 = "关闭";
+9
View File
@@ -30,7 +30,16 @@
{
ob_start();
echo "<div class='btn-group'>";
echo "<div class='btn-group' id='createActionMenu'>";
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}") : '#';
a($link);
echo "<button type='button' class='btn dropdown-toggle {$misc}' data-toggle='dropdown'><span class='caret'></span></button>";
echo "<ul class='dropdown-menu pull-right'>";
echo "<li>" . html::a($link, $lang->story->batchCreate, '', "class='$misc'") . "</li>";
echo '</ul>';
echo '</div>';
if(common::hasPriv('productplan', 'linkStory'))
{
echo html::a(inlink('view', "planID=$plan->id&type=story&orderBy=id_desc&link=true"), '<i class="icon-link"></i> ' . $lang->productplan->linkStory, '', "class='btn'");
+2 -2
View File
@@ -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 = '显示周末';
+6 -4
View File
@@ -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();
+15 -1
View File
@@ -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 "<div class='btn-group' id='createActionMenu'>";
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 "<button type='button' class='btn dropdown-toggle {$misc}' data-toggle='dropdown'>";
echo "<span class='caret'></span>";
echo '</button>';
echo "<ul class='dropdown-menu pull-right'>";
echo "<li>" . html::a($link, $lang->story->batchCreate, '', "class='$misc'") . "</li>";
echo '</ul>';
echo '</div>';
}
if(commonModel::isTutorialMode())
{
+8 -2
View File
@@ -195,22 +195,28 @@ 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
*/
public function batchCreate($productID = 0, $branch = 0, $moduleID = 0, $storyID = 0)
public function batchCreate($productID = 0, $branch = 0, $moduleID = 0, $storyID = 0, $project = 0, $plan = 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)
@@ -237,7 +243,7 @@ class story extends control
$this->product->setMenu($products, $product->id, $branch);
/* Init vars. */
$planID = 0;
$planID = $plan;
$pri = 0;
$estimate = '';
$title = '';
+1 -1
View File
@@ -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';
+3 -5
View File
@@ -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');
@@ -481,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)
+2 -2
View File
@@ -56,7 +56,7 @@ if($this->story->checkForceReview()) unset($visibleFields['review']);
<?php if(!empty($titles)):?>
<?php foreach($titles as $storyTitle => $fileName):?>
<?php $moduleID = $i == 0 ? $moduleID : 'ditto';?>
<?php $planID = $i == 0 ? '' : 'ditto';?>
<?php $planID = $i == 0 ? $planID : 'ditto';?>
<?php $pri = $i == 0 ? '' : 'ditto';?>
<?php $source = $i == 0 ? '' : 'ditto';?>
<tr class='text-center'>
@@ -88,7 +88,7 @@ if($this->story->checkForceReview()) unset($visibleFields['review']);
<?php $nextStart = $i;?>
<?php for($i = $nextStart; $i < $config->story->batchCreate; $i++):?>
<?php $moduleID = $i - $nextStart == 0 ? $moduleID : 'ditto';?>
<?php $planID = $i - $nextStart == 0 ? '' : 'ditto';?>
<?php $planID = $i - $nextStart == 0 ? $planID : 'ditto';?>
<?php $pri = $i - $nextStart == 0 ? '' : 'ditto';?>
<?php $source = $i - $nextStart == 0 ? '' : 'ditto';?>
<tr class='text-center'>
+1 -1
View File
@@ -116,7 +116,7 @@
</div>
<fieldset id='commentBox' class='hide'>
<legend><?php echo $lang->comment;?></legend>
<form method='post' action='<?php echo inlink('edit', "storyID=$story->id")?>'>
<form method='post' action='<?php echo $this->createLink('action', 'comment', "objectType=story&objectID=$story->id")?>' target='hiddenwin'>
<div class="form-group"><?php echo html::textarea('comment', '',"rows='5' class='w-p100'");?></div>
<?php echo html::submitButton() . html::backButton();?>
</form>
+1 -1
View File
@@ -156,7 +156,7 @@
<div class='actions'> <?php if(!$task->deleted) echo $actionLinks;?></div>
<fieldset id='commentBox' class='hide'>
<legend><?php echo $lang->comment;?></legend>
<form method='post' action='<?php echo inlink('edit', "taskID=$task->id&comment=true")?>'>
<form method='post' action='<?php echo $this->createLink('action', 'comment', "objectType=task&objectID=$task->id")?>' target='hiddenwin'>
<div class="form-group"><?php echo html::textarea('comment', '',"rows='5' class='w-p100'");?></div>
<?php echo html::submitButton() . html::backButton();?>
</form>
+1 -1
View File
@@ -119,7 +119,7 @@
<div class='actions'><?php echo $actionLinks;?></div>
<fieldset id='commentBox' class='hide'>
<legend><?php echo $lang->comment;?></legend>
<form method='post' action='<?php echo inlink('edit', "caseID=$case->id&comment=true")?>'>
<form method='post' action='<?php echo $this->creatLink('action', 'comment', "objectType=case&objectID=$case->id")?>' target='hiddenwin'>
<div class="form-group"><?php echo html::textarea('comment', '',"rows='5' class='w-p100'");?></div>
<?php echo html::submitButton() . html::backButton();?>
</form>
+1 -1
View File
@@ -39,7 +39,7 @@ $lang->tutorial->tasks['createAccount']['nav'] = array('module' => 'user', 'met
$lang->tutorial->tasks['createAccount']['desc'] = "<p>在系统创建一个新的用户帐号:</p><ul><li data-target='nav'>打开 <span class='task-nav'>组织 <i class='icon icon-angle-right'></i> 用户 <i class='icon icon-angle-right'></i> 添加用户</span> 页面;</li><li data-target='form'>在添加用户表单中填写新用户信息;</li><li data-target='submit'>保存用户信息。</li></ul>";
$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'] = "<p>在系统创建一个新的产品:</p><ul><li data-target='nav'>打开 <span class='task-nav'>产品 <i class='icon icon-angle-right'></i> 添加产品</span> 页面;</li><li data-target='form'>在表单中填写要创建的产品信息;</li><li data-target='submit'>保存产品信息。</li></ul>";
$lang->tutorial->tasks['createStory'] = array('title' => '创建需求');
+20
View File
@@ -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;
}
}