Merge branch 'sprint/174_xieqiyu_45015'

This commit is contained in:
liyuchun
2021-12-03 13:20:29 +08:00
11 changed files with 45 additions and 25 deletions
+1 -7
View File
@@ -29,17 +29,11 @@ class productEntry extends Entry
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$product = $this->format($data->data->product, 'createdDate:time');
$product = $this->format($data->data->product, 'createdDate:time,whitelist:userList,createdBy:user,PO:user,RD:user,QD:user,feedback:user');
$this->loadModel('testcase');
$product->caseReview = ($this->config->testcase->needReview or !empty($this->config->testcase->forceReview));
$users = $data->data->users;
$product->PO = $this->formatUser($product->PO, $users);
$product->QD = $this->formatUser($product->QD, $users);
$product->RD = $this->formatUser($product->RD, $users);
$product->createdBy = $this->formatUser($product->createdBy, $users);
if(isset($product->feedback)) $product->feedback = $this->formatUser($product->feedback, $users);
if(!$fields) return $this->send(200, $product);
/* Set other fields. */
+13 -2
View File
@@ -59,8 +59,19 @@ class productplanEntry extends Entry
$data = $this->getData();
if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message);
$plan = $this->productplan->getByID($planID);
$this->sendSuccess(200, $this->format($plan, 'begin:date,end:date'));
/* Get plan info. */
$control = $this->loadController('productplan', 'view');
$control->view($planID);
$data = $this->getData();
if(!$data or !isset($data->status)) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$plan = $data->data->plan;
$plan->stories = $data->data->planStories;
$plan->bugs = $data->data->planBugs;
$this->send(200, $this->format($plan, 'begin:date,end:date,deleted:bool,stories:array,bugs:array'));
}
/**
+5 -2
View File
@@ -46,7 +46,7 @@ class productplansEntry extends entry
}
else
{
$result[$plan->id] = $plan;
$result[$plan->id] = $this->format($plan, 'begin:date,end:date,deleted:bool,project:int');
}
}
@@ -72,6 +72,9 @@ class productplansEntry extends entry
$fields = 'branch,begin,end,title,desc';
$this->batchSetPost($fields);
$this->setPost('product', $productID);
$this->setPost('parent', $this->request('parent', 0));
$this->setPost('branch', $this->request('branch', 0));
$control = $this->loadController('productplan', 'create');
$control->create($productID, $this->param('branch', 0), $this->param('parent', 0));
@@ -82,7 +85,7 @@ class productplansEntry extends entry
$plan = $this->loadModel('productplan')->getByID($data->id);
$plan->stories = array();
$plan->bugs = array();
return $this->send(200, $plan);
return $this->send(200, $this->format($plan, 'begin:date,end:date,deleted:bool,project:int'));
}
$this->sendError(400, array('message' => isset($data->message) ? $data->message : 'error'));
+3 -3
View File
@@ -79,7 +79,7 @@ class productsEntry extends entry
}
}
$result[] = $this->format($product, 'createdDate:time');
$result[] = $this->format($product, 'createdDate:time,whitelist:userList,createdBy:user,PO:user,RD:user,QD:user');
}
$data = array();
@@ -113,11 +113,11 @@ class productsEntry extends entry
$control->create($this->request('program', 0));
$data = $this->getData();
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
if(isset($data->result) and $data->result == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
/* Response */
$product = $this->loadModel('product')->getByID($data->id);
$product = $this->format($product, 'createdDate:time,whitelist:[]string');
$product = $this->format($product, 'createdDate:time,whitelist:userList,createdBy:user,PO:user,RD:user,QD:user');
$this->send(200, $product);
}
+2 -1
View File
@@ -28,11 +28,12 @@ class projectReleasesEntry extends entry
/* Response */
$data = $this->getData();
if(isset($data->status) and $data->status == 'success')
{
$result = array();
$releases = $data->data->releases;
foreach($releases as $release) $result[] = $this->format($release, 'deleted:bool,date:date');
foreach($releases as $release) $result[] = $this->format($release, 'deleted:bool,date:date,mailto:userList');
return $this->send(200, array('total' => count($result), 'releases' => $result));
}
+1 -1
View File
@@ -32,7 +32,7 @@ class releasesEntry extends entry
{
$result = array();
$releases = $data->data->releases;
foreach($releases as $release) $result[] = $this->format($release, 'deleted:bool,date:date');
foreach($releases as $release) $result[] = $this->format($release, 'deleted:bool,date:date,mailto:userList');
return $this->send(200, array('total' => count($result), 'releases' => $result));
}
+4
View File
@@ -1374,6 +1374,10 @@ class executionModel extends model
{
$link = helper::createLink($module, 'browse', "executionID=%s&from=execution");
}
elseif($module == 'testreport' and $method == 'create')
{
$link = helper::createLink('execution', 'testtask', "executionID=%s");
}
else
{
$link = helper::createLink($module, $method, "executionID=%s");
+6
View File
@@ -1994,6 +1994,12 @@ class productModel extends model
$projectID = isset($output['projectID']) ? $output['projectID'] : 0;
$link = helper::createLink($module, $method, "productID=%s&branch=" . ($branch ? "%s" : '') . "&groupBy=&projectID=$projectID") . "#app=project";
}
elseif($module == 'testreport' and ($method == 'create' or $method == 'edit'))
{
$vars = $method == 'edit' ? "objectID=%s" : "objectID=&objectType=testtask&extra=%s";
$method = $method == 'edit' ? 'browse' : $method;
$link = helper::createLink($module, $method, $vars);
}
else
{
$link = helper::createLink($module, $method, "productID=%s" . ($branch ? "&branch=%s" : ''));
+4 -4
View File
@@ -279,8 +279,8 @@ class projectrelease extends control
/**
* Notify for release.
*
* @param int $releaseID
*
* @param int $releaseID
* @access public
* @return void
*/
@@ -290,7 +290,7 @@ class projectrelease extends control
{
if(isset($_POST['notify']))
{
$notify = implode(',', $this->post->notify);
$notify = implode(',', $this->post->notify);
$this->dao->update(TABLE_RELEASE)->set('notify')->eq($notify)->where('id')->eq($releaseID)->exec();
$this->release->sendmail($releaseID);
@@ -298,7 +298,7 @@ class projectrelease extends control
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
}
$this->view->release = $this->release->getById($releaseID);
$this->view->actions = $this->loadModel('action')->getList('release', $releaseID);
$this->view->users = $this->loadModel('user')->getPairs('noletter|noclosed');
+1 -1
View File
@@ -189,7 +189,7 @@ class testreport extends control
$taskPairs = array();
$scopeAndStatus[0] = 'local';
$scopeAndStatus[1] = 'totalStatus';
$tasks = $this->testtask->getProductTasks($productID, $task->branch, 'id_desc', null, $scopeAndStatus);
$tasks = $this->testtask->getProductTasks($productID, empty($objectID) ? 0 : $task->branch, 'id_desc', null, $scopeAndStatus);
foreach($tasks as $testTask)
{
if($testTask->build == 'trunk') continue;
+5 -4
View File
@@ -114,15 +114,16 @@ class treeModel extends model
/**
* Create an option menu in html.
*
* @param int $rootID
* @param string $type
* @param int $startModule
* @param int $branch
* @param int $rootID
* @param string $type
* @param int $startModule
* @param int|array $branch
* @access public
* @return string
*/
public function getOptionMenu($rootID, $type = 'story', $startModule = 0, $branch = 0)
{
if(empty($branch)) $branch = 0;
if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getModulePairs();
/* If type of $branch is array, get modules of these branches. */