Merge branch 'master' of github.com:easysoft/zentaopms

This commit is contained in:
xia0ta0
2014-03-13 15:26:51 +08:00
12 changed files with 170 additions and 16 deletions
+33
View File
@@ -825,6 +825,39 @@ class bug extends control
$this->display();
}
/**
* Batch close bugs.
*
* @access public
* @return void
*/
public function batchClose()
{
if($this->post->bugIDList)
{
$bugIDList = $this->post->bugIDList;
foreach($_POST as $postKey => $postValue) unset($_POST[$postKey]);
$bugs = $this->bug->getList($bugIDList);
foreach($bugs as $bugID => $bug)
{
if($bug->status != 'resolved')
{
if($bug->status != 'closed') $skipBugs[$bugID] = $bugID;
continue;
}
$this->bug->close($bugID);
$actionID = $this->action->create('bug', $bugID, 'Closed');
$this->sendmail($bugID, $actionID);
}
if(isset($skipBugs)) echo js::alert(sprintf($this->lang->bug->skipClose, join(',', $skipBugs)));
}
die(js::reload('parent'));
}
/**
* Confirm story change.
*
+1
View File
@@ -155,6 +155,7 @@ $lang->bug->confirmChangeProduct = 'Change product will change project, task and
$lang->bug->confirmDelete = 'Are you sure to delete this bug?';
$lang->bug->setTemplateTitle = 'Please input the template title:';
$lang->bug->remindTask = 'This bug has been to be a task, update the task:%s or not?';
$lang->bug->skipClose = 'The status of bug:%s are not resolved, so can not close!';
/* Templates. */
$lang->bug->tplStep = "<p>[Steps]</p>\n";
+1
View File
@@ -155,6 +155,7 @@ $lang->bug->confirmChangeProduct = '修改产品会导致相应的项目、需
$lang->bug->confirmDelete = '您确认要删除该Bug吗?';
$lang->bug->setTemplateTitle = '请输入bug模板标题(保存之前请先填写bug重现步骤):';
$lang->bug->remindTask = '该Bug已经转化为任务,是否更新任务(编号:%s)状态 ?';
$lang->bug->skipClose = 'Bug %s 不是已解决状态,不能关闭。';
/* 模板。*/
$lang->bug->tplStep = "<p>[步骤]</p>\n";
+22 -7
View File
@@ -194,6 +194,21 @@ class bugModel extends model
return $bug;
}
/**
* Get bug list.
*
* @param int|array|string $bugIDList
* @access public
* @return array
*/
public function getList($bugIDList = 0)
{
return $this->dao->select('*')->from(TABLE_BUG)
->where('deleted')->eq(0)
->beginIF($bugIDList)->andWhere('id')->in($bugIDList)->fi()
->fetchAll('id');
}
/**
* getActiveBugs
*
@@ -353,7 +368,7 @@ class bugModel extends model
*
* @param int $bugID
* @access public
* @return void
* @return string
*/
public function assign($bugID)
{
@@ -406,11 +421,11 @@ class bugModel extends model
*/
public function batchConfirm($bugIDList)
{
$now = helper::now();
$now = helper::now();
$bugs = $this->getList($bugIDList);
foreach($bugIDList as $bugID)
{
$oldBug = $this->getById($bugID);
if($oldBug->confirmed) continue;
if($bugs[$bugID]->confirmed) continue;
$bug = new stdclass();
$bug->assignedTo = $this->app->user->account;
@@ -466,10 +481,11 @@ class bugModel extends model
*/
public function batchResolve($bugIDList, $resolution, $resolvedBuild)
{
$now = helper::now();
$now = helper::now();
$bugs = $this->getList($bugIDList);
foreach($bugIDList as $bugID)
{
$oldBug = $this->getById($bugID);
$oldBug = $bugs[$bugID];
if($oldBug->status != 'active') continue;
$bug = new stdClass();
$bug->resolution = $resolution;
@@ -528,7 +544,6 @@ class bugModel extends model
*/
public function close($bugID)
{
$oldBug = $this->getById($bugID);
$now = helper::now();
$bug = fixer::input('post')
->add('assignedTo', 'closed')
+65 -2
View File
@@ -1,6 +1,6 @@
<table class='cont-lt1'>
<tr valign='top'>
<td class='side <?php echo $treeClass;?>' id='treebox'>
<td class='side' id='treebox'>
<nobr>
<div class='box-title'><?php echo $productName;?></div>
<div class='box-content'>
@@ -74,7 +74,13 @@
<div class='f-left'>
<?php
echo html::selectAll() . html::selectReverse();
if(common::hasPriv('bug', 'batchEdit') and $bugs) echo html::submitButton($lang->edit);
$actionLink = $this->createLink('bug', 'batchEdit', "productID=$productID");
$misc = common::hasPriv('bug', 'batchEdit') ? "onclick=\"setFormAction('$actionLink')\"" : "disabled='disabled'";
echo "<div class='groupButton dropButton'>";
echo html::commonButton($lang->edit, $misc);
echo "<button id='moreAction' type='button' onclick=\"toggleSubMenu(this.id, 'top', 0)\"><span class='caret'></span></button>";
echo "</div>";
?>
</div>
<?php endif?>
@@ -87,3 +93,60 @@
</td>
</tr>
</table>
<div id='moreActionMenu' class='listMenu hidden'>
<ul>
<?php
$class = "class='disabled'";
$actionLink = $this->createLink('bug', 'batchConfirm');
$misc = common::hasPriv('bug', 'batchConfirm') ? "onclick=\"setFormAction('$actionLink','hiddenwin')\"" : "class='disabled'";
echo "<li>" . html::a('#', $lang->bug->confirmBug, '', $misc) . "</li>";
$actionLink = $this->createLink('bug', 'batchClose');
$misc = common::hasPriv('bug', 'batchClose') ? "onclick=\"setFormAction('$actionLink','hiddenwin')\"" : "class='disabled'";
echo "<li>" . html::a('#', $lang->bug->close, '', $misc) . "</li>";
$misc = common::hasPriv('bug', 'batchResolve') ? "onmouseover='toggleSubMenu(this.id)' onmouseout='toggleSubMenu(this.id)' id='resolveItem'" : $class;
echo "<li>" . html::a('#', $lang->bug->resolve, '', $misc) . "</li>";
?>
</ul>
</div>
<div id='resolveItemMenu' class='hidden listMenu'>
<ul>
<?php
unset($lang->bug->resolutionList['']);
unset($lang->bug->resolutionList['duplicate']);
foreach($lang->bug->resolutionList as $key => $resolution)
{
$actionLink = $this->createLink('bug', 'batchResolve', "resolution=$key");
echo "<li>";
if($key == 'fixed')
{
echo html::a('#', $resolution, '', "onmouseover=\"toggleSubMenu(this.id,'right',2)\" id='fixedItem'");
}
else
{
echo html::a('#', $resolution, '', "onclick=\"setFormAction('$actionLink','hiddenwin')\"");
}
echo "</li>";
}
?>
</ul>
</div>
<div id='fixedItemMenu' class='hidden listMenu'>
<ul>
<?php
unset($builds['']);
foreach($builds as $key => $build)
{
$actionLink = $this->createLink('bug', 'batchResolve', "resolution=fixed&resolvedBuild=$key");
echo "<li>";
echo html::a('#', $build, '', "onclick=\"setFormAction('$actionLink','hiddenwin')\"");
echo "</li>";
}
?>
</ul>
</div>
+4
View File
@@ -216,6 +216,10 @@ if($customed)
$misc = common::hasPriv('bug', 'batchConfirm') ? "onclick=\"setFormAction('$actionLink','hiddenwin')\"" : "class='disabled'";
echo "<li>" . html::a('#', $lang->bug->confirmBug, '', $misc) . "</li>";
$actionLink = $this->createLink('bug', 'batchClose');
$misc = common::hasPriv('bug', 'batchClose') ? "onclick=\"setFormAction('$actionLink','hiddenwin')\"" : "class='disabled'";
echo "<li>" . html::a('#', $lang->bug->close, '', $misc) . "</li>";
$misc = common::hasPriv('bug', 'batchResolve') ? "onmouseover='toggleSubMenu(this.id)' onmouseout='toggleSubMenu(this.id)' id='resolveItem'" : $class;
echo "<li>" . html::a('#', $lang->bug->resolve, '', $misc) . "</li>";
?>
+1 -1
View File
@@ -387,7 +387,7 @@ class commonModel extends model
echo "<li id='searchbox'>";
echo html::select('searchType', $lang->searchObjects, $searchObject);
echo html::input('searchQuery', $lang->searchTips, "onclick='this.value=\"\"' onkeydown='if(event.keyCode==13) shortcut()' class='w-80px'");
echo "<a href='javascript:shortcut();return false;' id='objectSwitcher' class='icon-circle-arrow-right'></a>";
echo "<a href='javascript:shortcut()' id='objectSwitcher' class='icon-circle-arrow-right'></a>";
echo "</li>";
echo "</ul>\n";
}
+15 -1
View File
@@ -70,7 +70,21 @@
<tr><td colspan='9'>
<?php if($bugs and $canBatchEdit):?>
<div class='f-left'>
<?php echo html::selectAll() . html::selectReverse() . html::submitButton($lang->edit);?>
<?php
echo html::selectAll() . html::selectReverse();
if(common::hasPriv('bug', 'batchEdit'))
{
$actionLink = $this->createLink('bug', 'batchEdit', "productID=0");
echo html::commonButton($lang->edit, "onclick=\"setFormAction('$actionLink')\"");
}
if(common::hasPriv('bug', 'batchClose') and $type != 'closedBy')
{
$actionLink = $this->createLink('bug', 'batchClose');
echo html::commonButton($lang->bug->close, "onclick=\"setFormAction('$actionLink','hiddenwin')\"");
}
?>
</div>
<?php endif;?>
<?php $pager->show();?>
+11 -5
View File
@@ -639,15 +639,20 @@ class task extends control
{
if($this->post->taskIDList)
{
$tasks = $this->post->taskIDList;
$taskIDList = $this->post->taskIDList;
unset($_POST['taskIDList']);
$this->loadModel('action');
foreach($tasks as $taskID)
$tasks = $this->task->getList($taskIDList);
foreach($tasks as $taskID => $task)
{
$this->commonAction($taskID);
$task = $this->task->getById($taskID);
if($task->status == 'wait' or $task->status == 'doing') continue;
if($task->status == 'wait' or $task->status == 'doing')
{
$skipTasks[$taskID] = $taskID;
continue;
}
if($task->status == 'closed') continue;
$changes = $this->task->close($taskID);
@@ -658,6 +663,7 @@ class task extends control
$this->sendmail($taskID, $actionID);
}
}
if(isset($skipTasks)) echo js::alert(sprintf($this->lang->task->error->skipClose, join(',', $skipTasks)));
}
die(js::reload('parent'));
}
+1
View File
@@ -151,6 +151,7 @@ $lang->task->error->consumedSmall = '"Consumed" must be more than consumed be
$lang->task->error->consumedThisTime = 'Please input "hours"';
$lang->task->error->left = 'Please input "left"';
$lang->task->error->work = '"Comment" must be less than 255 characters';
$lang->task->error->skipClose = 'The status of Tasks : %s are not finished or canceled, can not close.';
/* Report. */
$lang->task->report = new stdclass();
+1
View File
@@ -151,6 +151,7 @@ $lang->task->error->consumedSmall = '"已经消耗"必须大于之前消耗';
$lang->task->error->consumedThisTime = '请填写"工时"';
$lang->task->error->left = '请填写"剩余"';
$lang->task->error->work = '"备注"必须小于255个字符';
$lang->task->error->skipClose = '任务:%s 不是“已完成”或“已取消”状态,不能关闭!';
/* 统计报表。*/
$lang->task->report = new stdclass();
+15
View File
@@ -677,6 +677,21 @@ class taskModel extends model
return $this->processTask($task);
}
/**
* Get task list.
*
* @param int|array|string $taskIDList
* @access public
* @return array
*/
public function getList($taskIDList = 0)
{
return $this->dao->select('*')->from(TABLE_TASK)
->where('deleted')->eq(0)
->beginIF($taskIDList)->andWhere('id')->in($taskIDList)->fi()
->fetchAll('id');
}
/**
* Get tasks list of a project.
*