* finish task #1662.

This commit is contained in:
wyd621
2013-08-02 15:44:40 +08:00
parent 01dd3ac526
commit 1140dbe11f
18 changed files with 36 additions and 18 deletions

View File

@@ -353,7 +353,7 @@ class bug extends control
if(!empty($_POST)) if(!empty($_POST))
{ {
$actions = $this->bug->batchCreate($productID); $actions = $this->bug->batchCreate($productID);
foreach($actions as $bugID => $action) $this->sendmail($bugID, $actionID); foreach($actions as $bugID => $actionID) $this->sendmail($bugID, $actionID);
die(js::locate($this->session->bugList, 'parent')); die(js::locate($this->session->bugList, 'parent'));
} }
@@ -377,7 +377,6 @@ class bug extends control
$this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]); $this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]);
$this->view->position[] = $this->lang->bug->batchCreate; $this->view->position[] = $this->lang->bug->batchCreate;
$this->view->projectBuilds = $projectBuilds;
$this->view->productID = $productID; $this->view->productID = $productID;
$this->view->stories = $stories; $this->view->stories = $stories;
$this->view->builds = $builds; $this->view->builds = $builds;

View File

@@ -286,6 +286,7 @@ class bugModel extends model
{ {
$oldBug = $this->getByID($bugID); $oldBug = $this->getByID($bugID);
$bug = new stdclass();
$bug->lastEditedBy = $this->app->user->account; $bug->lastEditedBy = $this->app->user->account;
$bug->lastEditedDate = $now; $bug->lastEditedDate = $now;
$bug->type = $this->post->types[$bugID]; $bug->type = $this->post->types[$bugID];

View File

@@ -113,6 +113,7 @@ class buildModel extends model
*/ */
public function create($projectID) public function create($projectID)
{ {
$build = new stdclass();
$build->stories = ''; $build->stories = '';
$build->bugs = ''; $build->bugs = '';
@@ -169,16 +170,20 @@ class buildModel extends model
*/ */
public function updateLinkedBug($build) public function updateLinkedBug($build)
{ {
$bugs = $this->dao->select('*')->from(TABLE_BUG)->where('id')->in($build->bugs)->fetchAll(); $bugs = empty($build->bugs) ? '' : $this->dao->select('*')->from(TABLE_BUG)->where('id')->in($build->bugs)->fetchAll();
$now = helper::now(); $now = helper::now();
$resolvedPairs = array(); $resolvedPairs = array();
foreach($this->post->bugs as $key => $bugID) if(isset($_POST['bugs']))
{ {
if(isset($_POST['resolvedBy'][$key]))$resolvedPairs[$bugID] = $this->post->resolvedBy[$key]; foreach($this->post->bugs as $key => $bugID)
{
if(isset($_POST['resolvedBy'][$key]))$resolvedPairs[$bugID] = $this->post->resolvedBy[$key];
}
} }
$this->loadModel('action'); $this->loadModel('action');
if(!$bugs) return false;
foreach($bugs as $bug) foreach($bugs as $bug)
{ {
if($bug->status == 'resolved') continue; if($bug->status == 'resolved') continue;

View File

@@ -224,7 +224,8 @@ class groupModel extends model
{ {
foreach($moduleActions as $actionName) foreach($moduleActions as $actionName)
{ {
$data->group = $groupID; $data = new stdclass();
$data->group = $groupID;
$data->module = $moduleName; $data->module = $moduleName;
$data->method = $actionName; $data->method = $actionName;
$this->dao->replace(TABLE_GROUPPRIV)->data($data)->exec(); $this->dao->replace(TABLE_GROUPPRIV)->data($data)->exec();
@@ -244,7 +245,8 @@ class groupModel extends model
{ {
foreach($moduleActions as $actionName) foreach($moduleActions as $actionName)
{ {
$data->group = $groupID; $data = new stdclass();
$data->group = $groupID;
$data->module = $moduleName; $data->module = $moduleName;
$data->method = $actionName; $data->method = $actionName;
$this->dao->insert(TABLE_GROUPPRIV)->data($data)->exec(); $this->dao->insert(TABLE_GROUPPRIV)->data($data)->exec();
@@ -268,6 +270,7 @@ class groupModel extends model
{ {
foreach($this->post->groups as $group) foreach($this->post->groups as $group)
{ {
$data = new stdclass();
$data->group = $group; $data->group = $group;
$data->module = $this->post->module; $data->module = $this->post->module;
$data->method = $action; $data->method = $action;
@@ -293,6 +296,7 @@ class groupModel extends model
if($this->post->members == false) return; if($this->post->members == false) return;
foreach($this->post->members as $account) foreach($this->post->members as $account)
{ {
$data = new stdclass();
$data->account = $account; $data->account = $account;
$data->group = $groupID; $data->group = $groupID;
$this->dao->insert(TABLE_USERGROUP)->data($data)->exec(); $this->dao->insert(TABLE_USERGROUP)->data($data)->exec();

View File

@@ -62,7 +62,7 @@
<td><?php echo $users[$case->lastRunner];?></td> <td><?php echo $users[$case->lastRunner];?></td>
<td><?php if(!helper::isZeroDate($case->lastRunDate)) echo date(DT_MONTHTIME1, strtotime($case->lastRunDate));?></td> <td><?php if(!helper::isZeroDate($case->lastRunDate)) echo date(DT_MONTHTIME1, strtotime($case->lastRunDate));?></td>
<td class='<?php echo $case->lastRunResult;?>'><?php if($case->lastRunResult) echo $lang->testcase->resultList[$case->lastRunResult];?></td> <td class='<?php echo $case->lastRunResult;?>'><?php if($case->lastRunResult) echo $lang->testcase->resultList[$case->lastRunResult];?></td>
<td class='<?php echo $run->status;?>'><?php echo $lang->testcase->statusList[$case->status];?></td> <td class='<?php if(isset($run)) echo $run->status;?>'><?php echo $lang->testcase->statusList[$case->status];?></td>
<td> <td>
<?php <?php
common::printIcon('testtask', 'runCase', "runID=0&caseID=$case->id&version=$case->version", '', 'list', '', '', 'iframe'); common::printIcon('testtask', 'runCase', "runID=0&caseID=$case->id&version=$case->version", '', 'list', '', '', 'iframe');

View File

@@ -604,8 +604,9 @@ class productModel extends model
} }
$cases = $this->dao->select('DISTINCT story')->from(TABLE_CASE)->where('story')->in($storyIDs)->fetchAll(); $cases = $this->dao->select('DISTINCT story')->from(TABLE_CASE)->where('story')->in($storyIDs)->fetchAll();
$rate = count($stories) == 0 ? 0 : round(count($cases) / count($stories), 2);
return sprintf($this->lang->product->storySummary, count($stories), $totalEstimate, round(count($cases) / count($stories), 2) * 100 . "%"); return sprintf($this->lang->product->storySummary, count($stories), $totalEstimate, $rate * 100 . "%");
} }
/** /**

View File

@@ -16,7 +16,6 @@
<?php include '../../common/view/treeview.html.php';?> <?php include '../../common/view/treeview.html.php';?>
<?php include './taskheader.html.php';?> <?php include './taskheader.html.php';?>
<?php js::set('moduleID', $moduleID);?> <?php js::set('moduleID', $moduleID);?>
<?php js::set('productID', $productID);?>
<script language='Javascript'> <script language='Javascript'>
var browseType = '<?php echo $browseType;?>'; var browseType = '<?php echo $browseType;?>';
</script> </script>

View File

@@ -9,5 +9,6 @@
* @version $Id: en.php 4129 2013-01-18 01:58:14Z wwccss $ * @version $Id: en.php 4129 2013-01-18 01:58:14Z wwccss $
* @link http://www.zentao.net * @link http://www.zentao.net
*/ */
$lang->qa = new stdclass();
$lang->qa->common = 'Test'; $lang->qa->common = 'Test';
$lang->qa->index = "Index"; $lang->qa->index = "Index";

View File

@@ -9,5 +9,6 @@
* @version $Id: zh-cn.php 4129 2013-01-18 01:58:14Z wwccss $ * @version $Id: zh-cn.php 4129 2013-01-18 01:58:14Z wwccss $
* @link http://www.zentao.net * @link http://www.zentao.net
*/ */
$lang->qa = new stdclass();
$lang->qa->common = '测试视图'; $lang->qa->common = '测试视图';
$lang->qa->index = "测试首页"; $lang->qa->index = "测试首页";

View File

@@ -98,7 +98,7 @@ class releaseModel extends model
$this->dao->insert(TABLE_RELEASE)->data($release)->autoCheck()->batchCheck($this->config->release->create->requiredFields, 'notempty')->check('name','unique')->exec(); $this->dao->insert(TABLE_RELEASE)->data($release)->autoCheck()->batchCheck($this->config->release->create->requiredFields, 'notempty')->check('name','unique')->exec();
$releaseID = $this->dao->lastInsertID(); $releaseID = $this->dao->lastInsertID();
$this->dao->update(TABLE_STORY)->set('stage')->eq('released')->where('id')->in($release->stories)->exec(); if($release->stories) $this->dao->update(TABLE_STORY)->set('stage')->eq('released')->where('id')->in($release->stories)->exec();
if(!dao::isError()) return $releaseID; if(!dao::isError()) return $releaseID;
} }

View File

@@ -222,6 +222,7 @@ class storyModel extends model
$storyID = $this->dao->lastInsertID(); $storyID = $this->dao->lastInsertID();
$this->setStage($storyID); $this->setStage($storyID);
$specData[$i] = new stdclass();
$specData[$i]->story = $storyID; $specData[$i]->story = $storyID;
$specData[$i]->version = 1; $specData[$i]->version = 1;
$specData[$i]->title = htmlspecialchars($stories->title[$i]); $specData[$i]->title = htmlspecialchars($stories->title[$i]);
@@ -230,6 +231,7 @@ class storyModel extends model
$this->loadModel('action'); $this->loadModel('action');
$actionID = $this->action->create('story', $storyID, 'Opened', ''); $actionID = $this->action->create('story', $storyID, 'Opened', '');
$mails[$i] = new stdclass();
$mails[$i]->storyID = $storyID; $mails[$i]->storyID = $storyID;
$mails[$i]->actionID = $actionID; $mails[$i]->actionID = $actionID;
} }

View File

@@ -616,6 +616,7 @@ class task extends control
$this->action->logHistory($actionID, $changes); $this->action->logHistory($actionID, $changes);
$this->sendmail($taskID, $actionID); $this->sendmail($taskID, $actionID);
} }
if(isonlybody()) die(js::closeColorbox('parent.parent'));
die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent'));
} }

View File

@@ -238,6 +238,7 @@ class taskModel extends model
{ {
$oldTask = $this->getById($taskID); $oldTask = $this->getById($taskID);
$task = new stdclass();
$task->name = htmlspecialchars($this->post->names[$taskID]); $task->name = htmlspecialchars($this->post->names[$taskID]);
$task->module = isset($this->post->modules[$taskID]) ? $this->post->modules[$taskID] : 0; $task->module = isset($this->post->modules[$taskID]) ? $this->post->modules[$taskID] : 0;
$task->type = $this->post->types[$taskID]; $task->type = $this->post->types[$taskID];
@@ -438,6 +439,7 @@ class taskModel extends model
{ {
if(!$record->consumed[$id]) die(js::alert($this->lang->task->error->consumedThisTime)); if(!$record->consumed[$id]) die(js::alert($this->lang->task->error->consumedThisTime));
if($record->left[$id] === '') die(js::alert($this->lang->task->error->left)); if($record->left[$id] === '') die(js::alert($this->lang->task->error->left));
$estimates[$id] = new stdclass();
$estimates[$id]->date = $record->dates[$id]; $estimates[$id]->date = $record->dates[$id];
$estimates[$id]->task = $taskID; $estimates[$id]->task = $taskID;
$estimates[$id]->consumed = $record->consumed[$id]; $estimates[$id]->consumed = $record->consumed[$id];

View File

@@ -285,14 +285,15 @@ class testcaseModel extends model
/* Initialize cases from the post data.*/ /* Initialize cases from the post data.*/
foreach($caseIDList as $caseID) foreach($caseIDList as $caseID)
{ {
$case = new stdclass();
$case->lastEditedBy = $this->app->user->account; $case->lastEditedBy = $this->app->user->account;
$caee->lastEditedDate = $now; $case->lastEditedDate = $now;
$case->pri = $this->post->pris[$caseID]; $case->pri = $this->post->pris[$caseID];
$case->status = $this->post->statuses[$caseID]; $case->status = $this->post->statuses[$caseID];
$case->module = $this->post->modules[$caseID]; $case->module = $this->post->modules[$caseID];
$case->title = htmlspecialchars($this->post->titles[$caseID]); $case->title = htmlspecialchars($this->post->titles[$caseID]);
$case->type = $this->post->types[$caseID]; $case->type = $this->post->types[$caseID];
$case->stage = implode(',', $this->post->stages[$caseID]); $case->stage = empty($this->post->stages[$caseID]) ? '' : implode(',', $this->post->stages[$caseID]);
$cases[$caseID] = $case; $cases[$caseID] = $case;
unset($case); unset($case);

View File

@@ -35,9 +35,9 @@
?> ?>
<tr> <tr>
<th><?php echo $i;?></th> <th><?php echo $i;?></th>
<td><?php echo nl2br($stepResult['desc']);?></td> <td><?php if(isset($stepResult['desc'])) echo nl2br($stepResult['desc']);?></td>
<td><?php echo nl2br($stepResult['expect']);?></td> <td><?php if(isset($stepResult['expect'])) echo nl2br($stepResult['expect']);?></td>
<?php if(!empty($result->stepResults)):?> <?php if(!empty($stepResult['result'])):?>
<td class='<?php echo $stepResult['result'];?> a-center'><?php echo $lang->testcase->resultList[$stepResult['result']];?></td> <td class='<?php echo $stepResult['result'];?> a-center'><?php echo $lang->testcase->resultList[$stepResult['result']];?></td>
<td><?php echo $stepResult['real'];?></td> <td><?php echo $stepResult['real'];?></td>
</tr> </tr>

View File

@@ -13,7 +13,7 @@
<?php include '../../common/view/header.html.php';?> <?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?> <?php include '../../common/view/kindeditor.html.php';?>
<div id='titlebar'> <div id='titlebar'>
<div id='main' <?php if($task->deleted) echo "class='deleted'";?>>TESTTASK #<?php echo $task->id . ' ' . $task->title;?></div> <div id='main' <?php if($task->deleted) echo "class='deleted'";?>>TESTTASK #<?php echo $task->id . ' ' . $task->name;?></div>
<div> <div>
<?php <?php
$browseLink = $this->session->testtaskList ? $this->session->testtaskList : $this->createLink('testtask', 'browse', "productID=$task->product"); $browseLink = $this->session->testtaskList ? $this->session->testtaskList : $this->createLink('testtask', 'browse', "productID=$task->product");

View File

@@ -59,7 +59,7 @@ class todo extends control
$this->view->position[] = $this->lang->todo->common; $this->view->position[] = $this->lang->todo->common;
$this->view->position[] = $this->lang->todo->create; $this->view->position[] = $this->lang->todo->create;
$this->view->date = strftime("%Y-%m-%d", strtotime($date)); $this->view->date = strftime("%Y-%m-%d", strtotime($date));
$this->view->time = date::buildTimeList($this->config->todo->times->begin, $this->config->todo->times->end, $this->config->todo->times->delta); $this->view->times = date::buildTimeList($this->config->todo->times->begin, $this->config->todo->times->end, $this->config->todo->times->delta);
$this->view->time = date::now(); $this->view->time = date::now();
$this->display(); $this->display();
} }

View File

@@ -329,6 +329,7 @@ class userModel extends model
$this->dao->delete()->from(TABLE_USERGROUP)->where('account')->eq($oldUser->account)->exec(); $this->dao->delete()->from(TABLE_USERGROUP)->where('account')->eq($oldUser->account)->exec();
foreach($this->post->groups as $groupID) foreach($this->post->groups as $groupID)
{ {
$data = new stdclass();
$data->account = $this->post->account; $data->account = $this->post->account;
$data->group = $groupID; $data->group = $groupID;
$this->dao->insert(TABLE_USERGROUP)->data($data)->exec(); $this->dao->insert(TABLE_USERGROUP)->data($data)->exec();